Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
99 lines
2.8 KiB
JavaScript
99 lines
2.8 KiB
JavaScript
export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js';
|
|
export { stringify } from './cst-stringify.js';
|
|
export { visit } from './cst-visit.js';
|
|
|
|
/** The byte order mark */
|
|
const BOM = '\u{FEFF}';
|
|
/** Start of doc-mode */
|
|
const DOCUMENT = '\x02'; // C0: Start of Text
|
|
/** Unexpected end of flow-mode */
|
|
const FLOW_END = '\x18'; // C0: Cancel
|
|
/** Next token is a scalar value */
|
|
const SCALAR = '\x1f'; // C0: Unit Separator
|
|
/** @returns `true` if `token` is a flow or block collection */
|
|
const isCollection = (token) => !!token && 'items' in token;
|
|
/** @returns `true` if `token` is a flow or block scalar; not an alias */
|
|
const isScalar = (token) => !!token &&
|
|
(token.type === 'scalar' ||
|
|
token.type === 'single-quoted-scalar' ||
|
|
token.type === 'double-quoted-scalar' ||
|
|
token.type === 'block-scalar');
|
|
/* istanbul ignore next */
|
|
/** Get a printable representation of a lexer token */
|
|
function prettyToken(token) {
|
|
switch (token) {
|
|
case BOM:
|
|
return '<BOM>';
|
|
case DOCUMENT:
|
|
return '<DOC>';
|
|
case FLOW_END:
|
|
return '<FLOW_END>';
|
|
case SCALAR:
|
|
return '<SCALAR>';
|
|
default:
|
|
return JSON.stringify(token);
|
|
}
|
|
}
|
|
/** Identify the type of a lexer token. May return `null` for unknown tokens. */
|
|
function tokenType(source) {
|
|
switch (source) {
|
|
case BOM:
|
|
return 'byte-order-mark';
|
|
case DOCUMENT:
|
|
return 'doc-mode';
|
|
case FLOW_END:
|
|
return 'flow-error-end';
|
|
case SCALAR:
|
|
return 'scalar';
|
|
case '---':
|
|
return 'doc-start';
|
|
case '...':
|
|
return 'doc-end';
|
|
case '':
|
|
case '\n':
|
|
case '\r\n':
|
|
return 'newline';
|
|
case '-':
|
|
return 'seq-item-ind';
|
|
case '?':
|
|
return 'explicit-key-ind';
|
|
case ':':
|
|
return 'map-value-ind';
|
|
case '{':
|
|
return 'flow-map-start';
|
|
case '}':
|
|
return 'flow-map-end';
|
|
case '[':
|
|
return 'flow-seq-start';
|
|
case ']':
|
|
return 'flow-seq-end';
|
|
case ',':
|
|
return 'comma';
|
|
}
|
|
switch (source[0]) {
|
|
case ' ':
|
|
case '\t':
|
|
return 'space';
|
|
case '#':
|
|
return 'comment';
|
|
case '%':
|
|
return 'directive-line';
|
|
case '*':
|
|
return 'alias';
|
|
case '&':
|
|
return 'anchor';
|
|
case '!':
|
|
return 'tag';
|
|
case "'":
|
|
return 'single-quoted-scalar';
|
|
case '"':
|
|
return 'double-quoted-scalar';
|
|
case '|':
|
|
case '>':
|
|
return 'block-scalar-header';
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export { BOM, DOCUMENT, FLOW_END, SCALAR, isCollection, isScalar, prettyToken, tokenType };
|