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.
160 lines
4.2 KiB
JavaScript
160 lines
4.2 KiB
JavaScript
import { format as format$1, plugins } from '@vitest/pretty-format';
|
|
import * as loupe from 'loupe';
|
|
|
|
const {
|
|
AsymmetricMatcher,
|
|
DOMCollection,
|
|
DOMElement,
|
|
Immutable,
|
|
ReactElement,
|
|
ReactTestComponent
|
|
} = plugins;
|
|
const PLUGINS = [
|
|
ReactTestComponent,
|
|
ReactElement,
|
|
DOMElement,
|
|
DOMCollection,
|
|
Immutable,
|
|
AsymmetricMatcher
|
|
];
|
|
function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
|
|
const MAX_LENGTH = maxLength ?? 1e4;
|
|
let result;
|
|
try {
|
|
result = format$1(object, {
|
|
maxDepth,
|
|
escapeString: false,
|
|
// min: true,
|
|
plugins: PLUGINS,
|
|
...options
|
|
});
|
|
} catch {
|
|
result = format$1(object, {
|
|
callToJSON: false,
|
|
maxDepth,
|
|
escapeString: false,
|
|
// min: true,
|
|
plugins: PLUGINS,
|
|
...options
|
|
});
|
|
}
|
|
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
|
|
}
|
|
const formatRegExp = /%[sdjifoOc%]/g;
|
|
function format(...args) {
|
|
if (typeof args[0] !== "string") {
|
|
const objects = [];
|
|
for (let i2 = 0; i2 < args.length; i2++) {
|
|
objects.push(inspect(args[i2], { depth: 0, colors: false }));
|
|
}
|
|
return objects.join(" ");
|
|
}
|
|
const len = args.length;
|
|
let i = 1;
|
|
const template = args[0];
|
|
let str = String(template).replace(formatRegExp, (x) => {
|
|
if (x === "%%") {
|
|
return "%";
|
|
}
|
|
if (i >= len) {
|
|
return x;
|
|
}
|
|
switch (x) {
|
|
case "%s": {
|
|
const value = args[i++];
|
|
if (typeof value === "bigint") {
|
|
return `${value.toString()}n`;
|
|
}
|
|
if (typeof value === "number" && value === 0 && 1 / value < 0) {
|
|
return "-0";
|
|
}
|
|
if (typeof value === "object" && value !== null) {
|
|
return inspect(value, { depth: 0, colors: false });
|
|
}
|
|
return String(value);
|
|
}
|
|
case "%d": {
|
|
const value = args[i++];
|
|
if (typeof value === "bigint") {
|
|
return `${value.toString()}n`;
|
|
}
|
|
return Number(value).toString();
|
|
}
|
|
case "%i": {
|
|
const value = args[i++];
|
|
if (typeof value === "bigint") {
|
|
return `${value.toString()}n`;
|
|
}
|
|
return Number.parseInt(String(value)).toString();
|
|
}
|
|
case "%f":
|
|
return Number.parseFloat(String(args[i++])).toString();
|
|
case "%o":
|
|
return inspect(args[i++], { showHidden: true, showProxy: true });
|
|
case "%O":
|
|
return inspect(args[i++]);
|
|
case "%c": {
|
|
i++;
|
|
return "";
|
|
}
|
|
case "%j":
|
|
try {
|
|
return JSON.stringify(args[i++]);
|
|
} catch (err) {
|
|
const m = err.message;
|
|
if (
|
|
// chromium
|
|
m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")
|
|
) {
|
|
return "[Circular]";
|
|
}
|
|
throw err;
|
|
}
|
|
default:
|
|
return x;
|
|
}
|
|
});
|
|
for (let x = args[i]; i < len; x = args[++i]) {
|
|
if (x === null || typeof x !== "object") {
|
|
str += ` ${x}`;
|
|
} else {
|
|
str += ` ${inspect(x)}`;
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
function inspect(obj, options = {}) {
|
|
if (options.truncate === 0) {
|
|
options.truncate = Number.POSITIVE_INFINITY;
|
|
}
|
|
return loupe.inspect(obj, options);
|
|
}
|
|
function objDisplay(obj, options = {}) {
|
|
if (typeof options.truncate === "undefined") {
|
|
options.truncate = 40;
|
|
}
|
|
const str = inspect(obj, options);
|
|
const type = Object.prototype.toString.call(obj);
|
|
if (options.truncate && str.length >= options.truncate) {
|
|
if (type === "[object Function]") {
|
|
const fn = obj;
|
|
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
} else if (type === "[object Array]") {
|
|
return `[ Array(${obj.length}) ]`;
|
|
} else if (type === "[object Object]") {
|
|
const keys = Object.keys(obj);
|
|
const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ");
|
|
return `{ Object (${kstr}) }`;
|
|
} else {
|
|
return str;
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
|
|
function getDefaultExportFromCjs (x) {
|
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
}
|
|
|
|
export { format as f, getDefaultExportFromCjs as g, inspect as i, objDisplay as o, stringify as s };
|