@wix/himalaya-cli 0.1090.0 → 0.1091.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +189 -170
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -1455,7 +1455,7 @@ function sentinelizeIdentity(body, identity) {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
if (identity.name) {
|
|
1457
1457
|
const re = new RegExp(`\\b(${NAME_FIELDS.join("|")})(["']?\\s*[:=]\\s*)(["'])${escapeRe(identity.name)}\\3`, "g");
|
|
1458
|
-
out2 = out2.replace(re, (_m, key2,
|
|
1458
|
+
out2 = out2.replace(re, (_m, key2, sep17, q) => `${key2}${sep17}${q}__HIMI_APP_NAME__${q}`);
|
|
1459
1459
|
}
|
|
1460
1460
|
return out2;
|
|
1461
1461
|
}
|
|
@@ -3738,7 +3738,7 @@ async function mintToken(args, label2, cacheKey, spawnImpl) {
|
|
|
3738
3738
|
tokenCache.set(cacheKey, fromEnv);
|
|
3739
3739
|
return fromEnv;
|
|
3740
3740
|
}
|
|
3741
|
-
const token = await new Promise((
|
|
3741
|
+
const token = await new Promise((resolve52, reject) => {
|
|
3742
3742
|
let child;
|
|
3743
3743
|
try {
|
|
3744
3744
|
child = spawnImpl("wix", [...args]);
|
|
@@ -3767,12 +3767,12 @@ async function mintToken(args, label2, cacheKey, spawnImpl) {
|
|
|
3767
3767
|
child.stdout?.on("data", (d) => {
|
|
3768
3768
|
out2 += String(d);
|
|
3769
3769
|
const m = out2.match(TOKEN_RE);
|
|
3770
|
-
if (m) done(() =>
|
|
3770
|
+
if (m) done(() => resolve52(m[0]));
|
|
3771
3771
|
});
|
|
3772
3772
|
child.stderr?.on("data", (d) => {
|
|
3773
3773
|
out2 += String(d);
|
|
3774
3774
|
const m = out2.match(TOKEN_RE);
|
|
3775
|
-
if (m) done(() =>
|
|
3775
|
+
if (m) done(() => resolve52(m[0]));
|
|
3776
3776
|
});
|
|
3777
3777
|
child.on("error", (e) => done(() => reject(new Error(mintHelp(label2, e.message)))));
|
|
3778
3778
|
child.on("exit", (code) => done(() => reject(new Error(
|
|
@@ -8434,8 +8434,8 @@ function textOf(node) {
|
|
|
8434
8434
|
function plainText(node) {
|
|
8435
8435
|
if (typeOf(node) === "TEXT") return str(at(node, "textData", "text"));
|
|
8436
8436
|
const children = kids(node).filter(isObj);
|
|
8437
|
-
const
|
|
8438
|
-
return children.map(plainText).join(
|
|
8437
|
+
const sep17 = children.every((c) => typeOf(c) === "TEXT") ? "" : "\n";
|
|
8438
|
+
return children.map(plainText).join(sep17);
|
|
8439
8439
|
}
|
|
8440
8440
|
function alignOf(v) {
|
|
8441
8441
|
switch (v) {
|
|
@@ -19328,10 +19328,10 @@ var init_preview = __esm({
|
|
|
19328
19328
|
}
|
|
19329
19329
|
},
|
|
19330
19330
|
kill: (pid, signal) => process.kill(pid, signal),
|
|
19331
|
-
portFree: (port) => new Promise((
|
|
19331
|
+
portFree: (port) => new Promise((resolve52) => {
|
|
19332
19332
|
const s = createServer2();
|
|
19333
|
-
s.once("error", () =>
|
|
19334
|
-
s.listen(port, "127.0.0.1", () => s.close(() =>
|
|
19333
|
+
s.once("error", () => resolve52(false));
|
|
19334
|
+
s.listen(port, "127.0.0.1", () => s.close(() => resolve52(true)));
|
|
19335
19335
|
}),
|
|
19336
19336
|
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
19337
19337
|
servingIdentity: async (origin) => {
|
|
@@ -20475,7 +20475,7 @@ async function injectRequest(listener, request) {
|
|
|
20475
20475
|
req.headers.host ??= url.host;
|
|
20476
20476
|
if (body && body.length > 0) req.push(body);
|
|
20477
20477
|
req.push(null);
|
|
20478
|
-
return await new Promise((
|
|
20478
|
+
return await new Promise((resolve52, reject) => {
|
|
20479
20479
|
const streamed = () => {
|
|
20480
20480
|
queueMicrotask(() => {
|
|
20481
20481
|
req.emit("close");
|
|
@@ -20491,7 +20491,7 @@ async function injectRequest(listener, request) {
|
|
|
20491
20491
|
else headers2.set(name, value);
|
|
20492
20492
|
}
|
|
20493
20493
|
const bodyless = out2.status === 204 || out2.status === 304 || request.method === "HEAD";
|
|
20494
|
-
|
|
20494
|
+
resolve52(new Response(bodyless ? null : out2.body, { status: out2.status, headers: headers2 }));
|
|
20495
20495
|
}, streamed);
|
|
20496
20496
|
res.on("inject-error", reject);
|
|
20497
20497
|
try {
|
|
@@ -21197,7 +21197,7 @@ function redactBodyString(body) {
|
|
|
21197
21197
|
} catch {
|
|
21198
21198
|
}
|
|
21199
21199
|
}
|
|
21200
|
-
return body.replace(FORM_ASSIGNMENT_RE, (m, name) => isSensitiveBodyName(name) ? `${name}=${REDACTED}` : m).replace(JSON_FIELD_RE, (m, name,
|
|
21200
|
+
return body.replace(FORM_ASSIGNMENT_RE, (m, name) => isSensitiveBodyName(name) ? `${name}=${REDACTED}` : m).replace(JSON_FIELD_RE, (m, name, sep17) => isSensitiveBodyName(name) ? `"${name}"${sep17}"${REDACTED}"` : m).replace(JSON_FIELD_UNTERMINATED_RE, (m, name, sep17) => isSensitiveBodyName(name) ? `"${name}"${sep17}"${REDACTED}` : m).replace(BEARER_RE, (_m, s) => `${s} ${REDACTED}`);
|
|
21201
21201
|
}
|
|
21202
21202
|
function createWixGatewayState() {
|
|
21203
21203
|
return { mode: "record", rules: [], traffic: [], clients: /* @__PURE__ */ new Set(), seq: 0, ruleSeq: 0 };
|
|
@@ -23025,12 +23025,12 @@ function finalizeRecording(key2, rec) {
|
|
|
23025
23025
|
if (rec.finalize) return rec.finalize;
|
|
23026
23026
|
rec.finalize = (async () => {
|
|
23027
23027
|
clearTimeout(rec.autoStop);
|
|
23028
|
-
await new Promise((
|
|
23028
|
+
await new Promise((resolve52) => {
|
|
23029
23029
|
let done = false;
|
|
23030
23030
|
const finish2 = () => {
|
|
23031
23031
|
if (!done) {
|
|
23032
23032
|
done = true;
|
|
23033
|
-
|
|
23033
|
+
resolve52();
|
|
23034
23034
|
}
|
|
23035
23035
|
};
|
|
23036
23036
|
rec.child.once("close", finish2);
|
|
@@ -23141,7 +23141,7 @@ var init_preview2 = __esm({
|
|
|
23141
23141
|
DEVICE_LIST_TIMEOUT_MS = 5e3;
|
|
23142
23142
|
defaultRunner2 = {
|
|
23143
23143
|
capture(cmd, args, timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS) {
|
|
23144
|
-
return new Promise((
|
|
23144
|
+
return new Promise((resolve52, reject) => {
|
|
23145
23145
|
const child = spawn4(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
23146
23146
|
const out2 = [];
|
|
23147
23147
|
const err = [];
|
|
@@ -23163,7 +23163,7 @@ var init_preview2 = __esm({
|
|
|
23163
23163
|
child.stderr.on("data", (b) => err.push(b));
|
|
23164
23164
|
child.on("error", (e) => settle(reject, e));
|
|
23165
23165
|
child.on("close", (code) => {
|
|
23166
|
-
if (code === 0) settle(
|
|
23166
|
+
if (code === 0) settle(resolve52, Buffer.concat(out2));
|
|
23167
23167
|
else settle(reject, new Error(`${cmd} exited ${code}: ${Buffer.concat(err).toString("utf8")}`));
|
|
23168
23168
|
});
|
|
23169
23169
|
});
|
|
@@ -28633,8 +28633,8 @@ function ensureCountUpRuntime() {
|
|
|
28633
28633
|
const neg = fixed.startsWith("-");
|
|
28634
28634
|
const body = neg ? fixed.slice(1) : fixed;
|
|
28635
28635
|
const [int2, frac] = body.split(".");
|
|
28636
|
-
const
|
|
28637
|
-
return (neg ? "-" : "") +
|
|
28636
|
+
const sep17 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
28637
|
+
return (neg ? "-" : "") + sep17 + (frac ? "." + frac : "");
|
|
28638
28638
|
};
|
|
28639
28639
|
const animateEl = (el) => {
|
|
28640
28640
|
const node = el;
|
|
@@ -34981,7 +34981,7 @@ async function stabilizePngPage(page, scheme) {
|
|
|
34981
34981
|
const browser = globalThis;
|
|
34982
34982
|
browser.document.documentElement.style.colorScheme = selected;
|
|
34983
34983
|
await browser.document.fonts?.ready;
|
|
34984
|
-
await new Promise((
|
|
34984
|
+
await new Promise((resolve52) => browser.requestAnimationFrame(() => browser.requestAnimationFrame(() => resolve52())));
|
|
34985
34985
|
}, scheme);
|
|
34986
34986
|
}
|
|
34987
34987
|
async function renderPngBatch(items) {
|
|
@@ -38550,7 +38550,7 @@ async function handleWebWix(req, res, state) {
|
|
|
38550
38550
|
}
|
|
38551
38551
|
if (match) {
|
|
38552
38552
|
const mocked = match.rule.response;
|
|
38553
|
-
if (mocked.delayMs) await new Promise((
|
|
38553
|
+
if (mocked.delayMs) await new Promise((resolve52) => setTimeout(resolve52, mocked.delayMs));
|
|
38554
38554
|
const responseBody = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
38555
38555
|
record2("mock", mocked.status, responseBody, match.rule.id, mocked.headers);
|
|
38556
38556
|
return reply(200, { status: mocked.status, body: responseBody ?? "" });
|
|
@@ -40649,12 +40649,12 @@ var init_query = __esm({
|
|
|
40649
40649
|
});
|
|
40650
40650
|
|
|
40651
40651
|
// ../../core/dev-server/src/crawl-input.ts
|
|
40652
|
-
function resolved(v,
|
|
40653
|
-
if (typeof v === "string") return v.startsWith("$service:") ?
|
|
40652
|
+
function resolved(v, resolve52) {
|
|
40653
|
+
if (typeof v === "string") return v.startsWith("$service:") ? resolve52(v) : v;
|
|
40654
40654
|
if (Array.isArray(v)) {
|
|
40655
40655
|
const out2 = v.flatMap((el) => {
|
|
40656
40656
|
if (typeof el !== "string" || !el.startsWith("$service:")) return [el];
|
|
40657
|
-
const r =
|
|
40657
|
+
const r = resolve52(el);
|
|
40658
40658
|
return Array.isArray(r) ? r : [r];
|
|
40659
40659
|
});
|
|
40660
40660
|
return out2;
|
|
@@ -40668,9 +40668,9 @@ function hasRowBinding(props) {
|
|
|
40668
40668
|
return itemToken(v) || Array.isArray(v) && v.some(itemToken);
|
|
40669
40669
|
});
|
|
40670
40670
|
}
|
|
40671
|
-
function declaredOptionIds(props,
|
|
40671
|
+
function declaredOptionIds(props, resolve52) {
|
|
40672
40672
|
const literal = props.options ?? props.tabs ?? props.chips;
|
|
40673
|
-
const bound = props.optionsPath !== void 0 ? resolved(props.optionsPath,
|
|
40673
|
+
const bound = props.optionsPath !== void 0 ? resolved(props.optionsPath, resolve52) : void 0;
|
|
40674
40674
|
const raw = Array.isArray(bound) ? bound : literal;
|
|
40675
40675
|
if (!Array.isArray(raw)) return [];
|
|
40676
40676
|
const out2 = [];
|
|
@@ -40713,24 +40713,24 @@ function seedTokens(state, limit = 48) {
|
|
|
40713
40713
|
walk2(state, 0);
|
|
40714
40714
|
return out2;
|
|
40715
40715
|
}
|
|
40716
|
-
function synthesizeInput(control,
|
|
40716
|
+
function synthesizeInput(control, resolve52, tokens) {
|
|
40717
40717
|
const id = `${control.type}.${control.callback}`;
|
|
40718
40718
|
const row = SYNTHESIZED_CONTROLS[id];
|
|
40719
40719
|
if (!row) return null;
|
|
40720
40720
|
const props = control.props;
|
|
40721
40721
|
if (hasRowBinding(props)) return null;
|
|
40722
40722
|
if (row.from === "declared-options") {
|
|
40723
|
-
const ids = declaredOptionIds(props,
|
|
40723
|
+
const ids = declaredOptionIds(props, resolve52);
|
|
40724
40724
|
if (!ids.length) return null;
|
|
40725
40725
|
if (row.encoding === "string-array") {
|
|
40726
|
-
const currentRaw2 = resolved(props.selectedIds,
|
|
40726
|
+
const currentRaw2 = resolved(props.selectedIds, resolve52);
|
|
40727
40727
|
const current3 = (Array.isArray(currentRaw2) ? currentRaw2 : []).filter((x) => typeof x === "string");
|
|
40728
40728
|
const pick4 = ids.find((o) => !current3.includes(o));
|
|
40729
40729
|
if (pick4 === void 0) return null;
|
|
40730
40730
|
const value = props.multiSelect === true ? [...current3, pick4] : [pick4];
|
|
40731
40731
|
return { key: row.key, value, from: row.from, current: current3, control: id };
|
|
40732
40732
|
}
|
|
40733
|
-
const currentRaw = resolved(props.selectedId,
|
|
40733
|
+
const currentRaw = resolved(props.selectedId, resolve52);
|
|
40734
40734
|
const current2 = typeof currentRaw === "string" ? currentRaw : void 0;
|
|
40735
40735
|
const pick3 = ids.find((o) => o !== current2);
|
|
40736
40736
|
if (pick3 === void 0) return null;
|
|
@@ -40738,7 +40738,7 @@ function synthesizeInput(control, resolve51, tokens) {
|
|
|
40738
40738
|
}
|
|
40739
40739
|
if (!acceptsWords(props) || !acceptsWords(control.wrapper ?? {})) return null;
|
|
40740
40740
|
const binding2 = typeof props.valuePath === "string" ? props.valuePath : typeof props.value === "string" && props.value.startsWith("$service:") ? props.value : void 0;
|
|
40741
|
-
const bound = binding2 === void 0 ? void 0 :
|
|
40741
|
+
const bound = binding2 === void 0 ? void 0 : resolve52(binding2);
|
|
40742
40742
|
const literal = typeof props.value === "string" && !props.value.startsWith("$") ? props.value : void 0;
|
|
40743
40743
|
const current = typeof bound === "string" ? bound : typeof bound === "number" ? String(bound) : literal ?? "";
|
|
40744
40744
|
const max = typeof props.maxLength === "number" && props.maxLength > 0 ? props.maxLength : void 0;
|
|
@@ -42223,8 +42223,8 @@ async function crawlScreenInner(opts) {
|
|
|
42223
42223
|
if (linkable.has(target)) return true;
|
|
42224
42224
|
for (const base of linkable) {
|
|
42225
42225
|
if (target.length > base.length + 1 && target.startsWith(base)) {
|
|
42226
|
-
const
|
|
42227
|
-
if (
|
|
42226
|
+
const sep17 = target[base.length];
|
|
42227
|
+
if (sep17 === "_" || sep17 === "/") return true;
|
|
42228
42228
|
}
|
|
42229
42229
|
}
|
|
42230
42230
|
return false;
|
|
@@ -47680,6 +47680,7 @@ __export(milestones_exports, {
|
|
|
47680
47680
|
firstLookAtInit: () => firstLookAtInit,
|
|
47681
47681
|
homeScreenIdOf: () => homeScreenIdOf,
|
|
47682
47682
|
homeShotForPostcard: () => homeShotForPostcard,
|
|
47683
|
+
homeShotPath: () => homeShotPath,
|
|
47683
47684
|
initDivergence: () => initDivergence,
|
|
47684
47685
|
liveWatchRunning: () => liveWatchRunning,
|
|
47685
47686
|
openBoardForSession: () => openBoardForSession,
|
|
@@ -47694,7 +47695,7 @@ __export(milestones_exports, {
|
|
|
47694
47695
|
import { createHash as createHash26, randomUUID as randomUUID3 } from "node:crypto";
|
|
47695
47696
|
import { spawn as spawn5 } from "node:child_process";
|
|
47696
47697
|
import { existsSync as existsSync47, lstatSync as lstatSync11, readFileSync as readFileSync52, statSync as statSync11 } from "node:fs";
|
|
47697
|
-
import { basename as basename14, isAbsolute as isAbsolute4, join as join46, relative as relative9 } from "node:path";
|
|
47698
|
+
import { basename as basename14, dirname as dirname27, isAbsolute as isAbsolute4, join as join46, relative as relative9, resolve as resolve41, sep as sep12 } from "node:path";
|
|
47698
47699
|
function homeScreenIdOf(dir) {
|
|
47699
47700
|
let src;
|
|
47700
47701
|
try {
|
|
@@ -47706,6 +47707,19 @@ function homeScreenIdOf(dir) {
|
|
|
47706
47707
|
const id = m ? m[1] ?? m[2] : void 0;
|
|
47707
47708
|
return id && /^[A-Za-z0-9_.\-/{}]+$/.test(id) ? id : null;
|
|
47708
47709
|
}
|
|
47710
|
+
function homeShotPath(dir, home) {
|
|
47711
|
+
const root = resolve41(dir);
|
|
47712
|
+
const base = resolve41(root, ".himi", "shots");
|
|
47713
|
+
const shot = resolve41(base, `${home}.png`);
|
|
47714
|
+
if (!shot.startsWith(base + sep12)) return null;
|
|
47715
|
+
for (let p = shot; p !== root && p.startsWith(root + sep12); p = dirname27(p)) {
|
|
47716
|
+
try {
|
|
47717
|
+
if (lstatSync11(p).isSymbolicLink()) return null;
|
|
47718
|
+
} catch {
|
|
47719
|
+
}
|
|
47720
|
+
}
|
|
47721
|
+
return shot;
|
|
47722
|
+
}
|
|
47709
47723
|
function displayPath(p, cwd = process.cwd()) {
|
|
47710
47724
|
const rel = relative9(cwd, p);
|
|
47711
47725
|
return rel && !rel.startsWith("..") && !isAbsolute4(rel) ? rel : p;
|
|
@@ -47718,7 +47732,8 @@ async function firstLookAtInit(dir, opts) {
|
|
|
47718
47732
|
const home = opts.home;
|
|
47719
47733
|
if (!home) return { skipped: "no literal homeScreenId in dev/index.ts, so there is no home screen to render" };
|
|
47720
47734
|
const budgetMs = opts.budgetMs ?? FIRST_LOOK_BUDGET_MS;
|
|
47721
|
-
const shot =
|
|
47735
|
+
const shot = homeShotPath(dir, home);
|
|
47736
|
+
if (!shot) return { skipped: "the homeScreenId does not name a file under .himi/shots" };
|
|
47722
47737
|
const started = Date.now();
|
|
47723
47738
|
return await new Promise((done) => {
|
|
47724
47739
|
let settled = false;
|
|
@@ -47929,7 +47944,8 @@ function startingPointMessage(template) {
|
|
|
47929
47944
|
function homeShotForPostcard(dir) {
|
|
47930
47945
|
const home = homeScreenIdOf(dir);
|
|
47931
47946
|
if (!home) return { skipped: "no literal homeScreenId in dev/index.ts, so there is no home shot to attach" };
|
|
47932
|
-
const shot =
|
|
47947
|
+
const shot = homeShotPath(dir, home);
|
|
47948
|
+
if (!shot) return { skipped: "the homeScreenId does not name a file under .himi/shots" };
|
|
47933
47949
|
const render = `\`himi render ${shellQuote(home)} --png\``;
|
|
47934
47950
|
if (!existsSync47(shot)) return { skipped: `no home shot yet \u2014 ${render} makes one, and the next postcard carries it` };
|
|
47935
47951
|
let changed;
|
|
@@ -47941,8 +47957,10 @@ function homeShotForPostcard(dir) {
|
|
|
47941
47957
|
if (!shotIsCurrent(shot, changed)) return { skipped: `the home shot is older than the last source change \u2014 ${render} makes a current one` };
|
|
47942
47958
|
try {
|
|
47943
47959
|
const sha = sha256Of(shot);
|
|
47944
|
-
const
|
|
47945
|
-
|
|
47960
|
+
const entries = readProgress(dir, { all: true }).entries;
|
|
47961
|
+
const latest = entries[entries.length - 1];
|
|
47962
|
+
const shown2 = Array.isArray(latest?.images) && latest.images.some((i) => !!i && typeof i === "object" && i.sha256 === sha);
|
|
47963
|
+
if (shown2) return { skipped: "the latest postcard already shows this home picture" };
|
|
47946
47964
|
} catch {
|
|
47947
47965
|
return { skipped: "the home shot could not be read" };
|
|
47948
47966
|
}
|
|
@@ -48466,7 +48484,7 @@ __export(template_trim_exports, {
|
|
|
48466
48484
|
runTemplateTrim: () => runTemplateTrim
|
|
48467
48485
|
});
|
|
48468
48486
|
import { cpSync, existsSync as existsSync48, mkdirSync as mkdirSync23, readdirSync as readdirSync26, readFileSync as readFileSync53, renameSync as renameSync5, rmSync as rmSync11, statSync as statSync12, writeFileSync as writeFileSync18 } from "node:fs";
|
|
48469
|
-
import { dirname as
|
|
48487
|
+
import { dirname as dirname28, join as join47 } from "node:path";
|
|
48470
48488
|
function routeMatcher(pattern) {
|
|
48471
48489
|
const detail = /^\^([A-Za-z0-9_]+)\(\?:\[_\/\]\(\.\+\)\)\?\$$/.exec(pattern);
|
|
48472
48490
|
if (detail) {
|
|
@@ -49239,7 +49257,7 @@ async function runTemplateTrim(req, deps) {
|
|
|
49239
49257
|
};
|
|
49240
49258
|
const dropBackup = () => {
|
|
49241
49259
|
rmSync11(backup, { recursive: true, force: true });
|
|
49242
|
-
for (const d of [
|
|
49260
|
+
for (const d of [dirname28(backup), join47(dir, ".himi")]) {
|
|
49243
49261
|
if (d === join47(dir, ".himi") && hadHimi) break;
|
|
49244
49262
|
try {
|
|
49245
49263
|
if (!readdirSync26(d).length) rmSync11(d, { recursive: true });
|
|
@@ -49605,11 +49623,11 @@ __export(eject_exports, {
|
|
|
49605
49623
|
ejectModule: () => ejectModule
|
|
49606
49624
|
});
|
|
49607
49625
|
import { existsSync as existsSync49, mkdirSync as mkdirSync24, readFileSync as readFileSync54, writeFileSync as writeFileSync19 } from "node:fs";
|
|
49608
|
-
import { dirname as
|
|
49626
|
+
import { dirname as dirname29, join as join48, relative as relative10, resolve as resolve42, sep as sep13 } from "node:path";
|
|
49609
49627
|
function locate(repoRootOrCwd, mod) {
|
|
49610
|
-
const inRepo =
|
|
49628
|
+
const inRepo = resolve42(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
|
|
49611
49629
|
if (existsSync49(inRepo)) return { path: inRepo, form: "source" };
|
|
49612
|
-
const dist =
|
|
49630
|
+
const dist = resolve42(repoRootOrCwd, `node_modules/@wix/himalaya/dist/${mod}.mjs`);
|
|
49613
49631
|
if (existsSync49(dist)) return { path: dist, form: "bundle" };
|
|
49614
49632
|
return null;
|
|
49615
49633
|
}
|
|
@@ -49635,7 +49653,7 @@ function ejectModule(opts) {
|
|
|
49635
49653
|
}
|
|
49636
49654
|
const ext = found.form === "source" ? "ts" : "mjs";
|
|
49637
49655
|
const target = join48(contentDir2, "tier5-src", "_ejected", `${mod}.${ext}`);
|
|
49638
|
-
mkdirSync24(
|
|
49656
|
+
mkdirSync24(dirname29(target), { recursive: true });
|
|
49639
49657
|
const banner = `// EJECTED from @wix/himalaya/${mod}. This app owns this file now.
|
|
49640
49658
|
//
|
|
49641
49659
|
// Central fixes to @wix/himalaya/${mod} NO LONGER REACH THIS APP \u2014 including any
|
|
@@ -49658,7 +49676,7 @@ function ejectModule(opts) {
|
|
|
49658
49676
|
if (!existsSync49(f)) continue;
|
|
49659
49677
|
const before = readFileSync54(f, "utf8");
|
|
49660
49678
|
let after = before;
|
|
49661
|
-
let rel = relative10(
|
|
49679
|
+
let rel = relative10(dirname29(f), target).split(sep13).join("/").replace(/\.tsx?$/, ".js");
|
|
49662
49680
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
49663
49681
|
for (const spec of specifiersFor(mod)) {
|
|
49664
49682
|
const q = spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -49762,8 +49780,8 @@ function baseOf(target, linkable, known) {
|
|
|
49762
49780
|
let best = null;
|
|
49763
49781
|
for (const base of linkable ?? []) {
|
|
49764
49782
|
if (!known.has(base) || target.length <= base.length + 1 || !target.startsWith(base)) continue;
|
|
49765
|
-
const
|
|
49766
|
-
if ((
|
|
49783
|
+
const sep17 = target[base.length];
|
|
49784
|
+
if ((sep17 === "_" || sep17 === "/") && (!best || base.length > best.length)) best = base;
|
|
49767
49785
|
}
|
|
49768
49786
|
return best;
|
|
49769
49787
|
}
|
|
@@ -50013,9 +50031,9 @@ __export(test_exports, {
|
|
|
50013
50031
|
writeRecordedMocks: () => writeRecordedMocks
|
|
50014
50032
|
});
|
|
50015
50033
|
import { existsSync as existsSync51, mkdirSync as mkdirSync25, readFileSync as readFileSync56, writeFileSync as writeFileSync20 } from "node:fs";
|
|
50016
|
-
import { join as join50, resolve as
|
|
50034
|
+
import { join as join50, resolve as resolve43 } from "node:path";
|
|
50017
50035
|
function readTestConfig(dir) {
|
|
50018
|
-
const p =
|
|
50036
|
+
const p = resolve43(dir, TEST_CONFIG_FILE);
|
|
50019
50037
|
if (!existsSync51(p)) return {};
|
|
50020
50038
|
let parsed;
|
|
50021
50039
|
try {
|
|
@@ -50086,7 +50104,7 @@ function readNetRules(path2) {
|
|
|
50086
50104
|
}
|
|
50087
50105
|
function defaultNetRules(dir) {
|
|
50088
50106
|
for (const rel of ["dev/net-mocks.json", "tests/net-mocks.json"]) {
|
|
50089
|
-
const p =
|
|
50107
|
+
const p = resolve43(dir, rel);
|
|
50090
50108
|
if (existsSync51(p)) {
|
|
50091
50109
|
const rules = readNetRules(p);
|
|
50092
50110
|
if (rules.length) return { rules, from: rel };
|
|
@@ -50268,7 +50286,7 @@ async function runCrawl(opts) {
|
|
|
50268
50286
|
for (const d of list) if (d.screenId !== rep.screenId) coveredBy.set(d.screenId, rep.screenId);
|
|
50269
50287
|
}
|
|
50270
50288
|
}
|
|
50271
|
-
const net = opts.offline ? null : opts.netPath ? { rules: readNetRules(
|
|
50289
|
+
const net = opts.offline ? null : opts.netPath ? { rules: readNetRules(resolve43(opts.netPath)), from: opts.netPath } : defaultNetRules(opts.dir);
|
|
50272
50290
|
const suppressions = opts.config?.skip ?? [];
|
|
50273
50291
|
const suppressed = [];
|
|
50274
50292
|
const matchSuppression = (screen, actionId, componentId, invariant) => suppressions.find((s) => (s.screen === void 0 || s.screen === screen) && (s.action === void 0 || s.action === actionId) && (s.component === void 0 || s.component === componentId) && (s.invariant === void 0 || s.invariant === invariant));
|
|
@@ -51004,7 +51022,7 @@ async function pinnedFetch(url, init, addresses, maxResponseBytes) {
|
|
|
51004
51022
|
const headers2 = Object.fromEntries(new Headers(init.headers).entries());
|
|
51005
51023
|
const request = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
51006
51024
|
const hostname2 = url.hostname.replace(/^\[|\]$/g, "");
|
|
51007
|
-
return await new Promise((
|
|
51025
|
+
return await new Promise((resolve52, reject) => {
|
|
51008
51026
|
let settled = false;
|
|
51009
51027
|
const finish2 = (fn) => {
|
|
51010
51028
|
if (settled) return;
|
|
@@ -51041,7 +51059,7 @@ async function pinnedFetch(url, init, addresses, maxResponseBytes) {
|
|
|
51041
51059
|
}
|
|
51042
51060
|
const responseHeaders = new Headers();
|
|
51043
51061
|
for (const [key2, value] of Object.entries(response.headers)) if (value !== void 0) responseHeaders.set(key2, Array.isArray(value) ? value.join(", ") : value);
|
|
51044
|
-
|
|
51062
|
+
resolve52(new Response(bytes2, { status: response.statusCode, statusText: response.statusMessage, headers: responseHeaders }));
|
|
51045
51063
|
}));
|
|
51046
51064
|
});
|
|
51047
51065
|
req.once("error", (error) => finish2(() => reject(error)));
|
|
@@ -51341,7 +51359,7 @@ function createLocalTestSandbox() {
|
|
|
51341
51359
|
}
|
|
51342
51360
|
})();
|
|
51343
51361
|
`;
|
|
51344
|
-
return await new Promise((
|
|
51362
|
+
return await new Promise((resolve52, reject) => {
|
|
51345
51363
|
const { port1, port2 } = new MessageChannel();
|
|
51346
51364
|
const serializableContext = {
|
|
51347
51365
|
auth: context.auth,
|
|
@@ -51417,7 +51435,7 @@ function createLocalTestSandbox() {
|
|
|
51417
51435
|
timer = setTimeout(() => finish2(() => reject(new SandboxError("timeout", `execution exceeded ${limits.timeoutMs}ms`))), Math.max(1, limits.timeoutMs));
|
|
51418
51436
|
return;
|
|
51419
51437
|
}
|
|
51420
|
-
if (message.ok) finish2(() =>
|
|
51438
|
+
if (message.ok) finish2(() => resolve52({ value: message.value, durationMs: Date.now() - started }));
|
|
51421
51439
|
else finish2(() => reject(new SandboxError("execution_failed", message.message ?? "handler failed")));
|
|
51422
51440
|
});
|
|
51423
51441
|
worker.once("error", (error) => finish2(() => reject(new SandboxError("execution_failed", error.message))));
|
|
@@ -52386,7 +52404,7 @@ __export(functions_exports, {
|
|
|
52386
52404
|
runRemoteFunctionOperation: () => runRemoteFunctionOperation
|
|
52387
52405
|
});
|
|
52388
52406
|
import { readFileSync as readFileSync58, existsSync as existsSync53 } from "node:fs";
|
|
52389
|
-
import { join as join52, resolve as
|
|
52407
|
+
import { join as join52, resolve as resolve44 } from "node:path";
|
|
52390
52408
|
function resolveFunctionsTarget(input) {
|
|
52391
52409
|
const explicitUrl = input.functionsUrl?.trim();
|
|
52392
52410
|
if (explicitUrl) return { mode: "remote", baseUrl: explicitUrl };
|
|
@@ -52398,7 +52416,7 @@ function resolveFunctionsTarget(input) {
|
|
|
52398
52416
|
return { mode: "local" };
|
|
52399
52417
|
}
|
|
52400
52418
|
async function loadFunctionsApp(dir) {
|
|
52401
|
-
const loaded = await loadContent(
|
|
52419
|
+
const loaded = await loadContent(resolve44(dir));
|
|
52402
52420
|
const config = loaded.module.config;
|
|
52403
52421
|
if (config.kind !== "functions" || !Array.isArray(config.functions?.functions)) {
|
|
52404
52422
|
throw new Error(`content package "${dir}" is not a functions-only app`);
|
|
@@ -52596,7 +52614,7 @@ var init_cli_bridge = __esm({
|
|
|
52596
52614
|
|
|
52597
52615
|
// src/mcp/tools.ts
|
|
52598
52616
|
import * as z from "zod";
|
|
52599
|
-
import { resolve as
|
|
52617
|
+
import { resolve as resolve45 } from "node:path";
|
|
52600
52618
|
function fromCli(r, extra = []) {
|
|
52601
52619
|
const body = r.json !== void 0 ? JSON.stringify(r.json, null, 2) : r.text.trim();
|
|
52602
52620
|
const content = [];
|
|
@@ -52608,7 +52626,7 @@ ${r.stderr.trim()}`) });
|
|
|
52608
52626
|
}
|
|
52609
52627
|
async function appDir2(args, deps) {
|
|
52610
52628
|
const base = await deps.defaultDir();
|
|
52611
|
-
return typeof args.dir === "string" && args.dir ?
|
|
52629
|
+
return typeof args.dir === "string" && args.dir ? resolve45(base, args.dir) : base;
|
|
52612
52630
|
}
|
|
52613
52631
|
async function requireLogin(deps) {
|
|
52614
52632
|
const who = await deps.runCli(["whoami"]);
|
|
@@ -52679,7 +52697,7 @@ function rawTools() {
|
|
|
52679
52697
|
}),
|
|
52680
52698
|
handler: async (a, d) => {
|
|
52681
52699
|
const base = await d.defaultDir();
|
|
52682
|
-
const parent = typeof a.parentDir === "string" && a.parentDir ?
|
|
52700
|
+
const parent = typeof a.parentDir === "string" && a.parentDir ? resolve45(base, a.parentDir) : base;
|
|
52683
52701
|
return fromCli(await d.runCli(["init", String(a.name), "--dir", parent, ...opt("--template", a.template)]));
|
|
52684
52702
|
}
|
|
52685
52703
|
},
|
|
@@ -52837,7 +52855,7 @@ ${log}` : ""}`, true);
|
|
|
52837
52855
|
handler: async (a, d) => {
|
|
52838
52856
|
const gate = await requireLogin(d);
|
|
52839
52857
|
if (gate) return gate;
|
|
52840
|
-
return fromCli(await d.runCli(["share", "--file",
|
|
52858
|
+
return fromCli(await d.runCli(["share", "--file", resolve45(await d.defaultDir(), String(a.file)), ...opt("--expires-at", a.expiresAt)]));
|
|
52841
52859
|
}
|
|
52842
52860
|
},
|
|
52843
52861
|
{
|
|
@@ -52938,9 +52956,9 @@ async function startMcpServer(opts) {
|
|
|
52938
52956
|
},
|
|
52939
52957
|
readFile: (p) => readFileSync59(p)
|
|
52940
52958
|
};
|
|
52941
|
-
const closed = new Promise((
|
|
52942
|
-
stdin.once("end",
|
|
52943
|
-
stdin.once("close",
|
|
52959
|
+
const closed = new Promise((resolve52) => {
|
|
52960
|
+
stdin.once("end", resolve52);
|
|
52961
|
+
stdin.once("close", resolve52);
|
|
52944
52962
|
});
|
|
52945
52963
|
const handle = serveStdio(
|
|
52946
52964
|
() => {
|
|
@@ -53235,7 +53253,7 @@ __export(browser_authoring_exports, {
|
|
|
53235
53253
|
import { createServer as createServer4 } from "node:http";
|
|
53236
53254
|
import { createHash as createHash29, randomBytes as randomBytes4 } from "node:crypto";
|
|
53237
53255
|
import { existsSync as existsSync55, readdirSync as readdirSync27, readFileSync as readFileSync61, realpathSync as realpathSync7, statSync as statSync13 } from "node:fs";
|
|
53238
|
-
import { join as join54, posix as posix2, relative as relative11, sep as
|
|
53256
|
+
import { join as join54, posix as posix2, relative as relative11, sep as sep14 } from "node:path";
|
|
53239
53257
|
function humanMs(ms) {
|
|
53240
53258
|
return ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`;
|
|
53241
53259
|
}
|
|
@@ -53285,7 +53303,7 @@ function collectRelativeSiblings(files, tier5SrcDir) {
|
|
|
53285
53303
|
];
|
|
53286
53304
|
for (const abs of candidates) {
|
|
53287
53305
|
if (!existsSync55(abs) || statSync13(abs).isDirectory()) continue;
|
|
53288
|
-
const key2 = `/tier5-src/${relative11(tier5SrcDir, abs).split(
|
|
53306
|
+
const key2 = `/tier5-src/${relative11(tier5SrcDir, abs).split(sep14).join(posix2.sep)}`;
|
|
53289
53307
|
if (key2 in files) break;
|
|
53290
53308
|
files[key2] = readFileSync61(abs, "utf8");
|
|
53291
53309
|
queue.push(key2);
|
|
@@ -53319,10 +53337,10 @@ function collectSdkModules(files, resolveSubpath) {
|
|
|
53319
53337
|
for (const source of Object.values(files)) visit(source);
|
|
53320
53338
|
return { modules, unsupported };
|
|
53321
53339
|
}
|
|
53322
|
-
function sdkSubpathReader(
|
|
53340
|
+
function sdkSubpathReader(resolve52) {
|
|
53323
53341
|
return (sub) => {
|
|
53324
53342
|
try {
|
|
53325
|
-
return readFileSync61(
|
|
53343
|
+
return readFileSync61(resolve52(`@wix/himalaya/${sub}`), "utf8");
|
|
53326
53344
|
} catch {
|
|
53327
53345
|
return null;
|
|
53328
53346
|
}
|
|
@@ -53400,7 +53418,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
53400
53418
|
const token = mintToken2(payload);
|
|
53401
53419
|
const unusable = await probeAuthoringPage(opts.authoringBase, opts.fetchImpl, opts.probeTimeoutMs);
|
|
53402
53420
|
if (unusable) throw new Error(unusable);
|
|
53403
|
-
return await new Promise((
|
|
53421
|
+
return await new Promise((resolve52, reject) => {
|
|
53404
53422
|
let settled = false;
|
|
53405
53423
|
let url = "";
|
|
53406
53424
|
const server = createServer4();
|
|
@@ -53452,7 +53470,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
53452
53470
|
}
|
|
53453
53471
|
res.writeHead(200, { "content-type": "text/plain" }).end("ok");
|
|
53454
53472
|
const report2 = body.result;
|
|
53455
|
-
finish2(() =>
|
|
53473
|
+
finish2(() => resolve52({ report: report2, url }));
|
|
53456
53474
|
})();
|
|
53457
53475
|
});
|
|
53458
53476
|
server.on("error", (e) => finish2(() => reject(e)));
|
|
@@ -53495,7 +53513,7 @@ __export(coverage_exports, {
|
|
|
53495
53513
|
trendAndStore: () => trendAndStore
|
|
53496
53514
|
});
|
|
53497
53515
|
import { existsSync as existsSync56, mkdirSync as mkdirSync26, readFileSync as readFileSync62, writeFileSync as writeFileSync22 } from "node:fs";
|
|
53498
|
-
import { dirname as
|
|
53516
|
+
import { dirname as dirname30, join as join55 } from "node:path";
|
|
53499
53517
|
function suppressedNativeKeys(oracle) {
|
|
53500
53518
|
return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
|
|
53501
53519
|
}
|
|
@@ -53687,7 +53705,7 @@ function trendAndStore(dir, entries, suppressed) {
|
|
|
53687
53705
|
const current = entries.map((e) => e.key);
|
|
53688
53706
|
const stored = [.../* @__PURE__ */ new Set([...current, ...(previous ?? []).filter((key2) => (suppressed ?? []).includes(key2))])];
|
|
53689
53707
|
try {
|
|
53690
|
-
mkdirSync26(
|
|
53708
|
+
mkdirSync26(dirname30(p), { recursive: true });
|
|
53691
53709
|
writeFileSync22(p, JSON.stringify({ keys: stored, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
|
|
53692
53710
|
} catch {
|
|
53693
53711
|
return null;
|
|
@@ -53732,7 +53750,7 @@ function diffAndStoreObservations(dir, current) {
|
|
|
53732
53750
|
} catch {
|
|
53733
53751
|
}
|
|
53734
53752
|
try {
|
|
53735
|
-
mkdirSync26(
|
|
53753
|
+
mkdirSync26(dirname30(p), { recursive: true });
|
|
53736
53754
|
writeFileSync22(p, JSON.stringify({ screens: current, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
|
|
53737
53755
|
} catch {
|
|
53738
53756
|
return null;
|
|
@@ -55626,7 +55644,7 @@ __export(run_exports, {
|
|
|
55626
55644
|
});
|
|
55627
55645
|
import { cpSync as cpSync2, existsSync as existsSync58, mkdirSync as mkdirSync27, mkdtempSync as mkdtempSync3, readFileSync as readFileSync65, rmSync as rmSync13, statSync as statSync14 } from "node:fs";
|
|
55628
55646
|
import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir4 } from "node:os";
|
|
55629
|
-
import { dirname as
|
|
55647
|
+
import { dirname as dirname31, join as join57 } from "node:path";
|
|
55630
55648
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
55631
55649
|
function makePackageRunHandler(opts) {
|
|
55632
55650
|
const store = new FileReleaseStore(opts.releaseRoot);
|
|
@@ -55706,7 +55724,7 @@ async function resolvePackage(source, workDir) {
|
|
|
55706
55724
|
async function loadPreviewAssets() {
|
|
55707
55725
|
try {
|
|
55708
55726
|
const mod = await Promise.resolve().then(() => (init_preview_assets_generated(), preview_assets_generated_exports));
|
|
55709
|
-
const here =
|
|
55727
|
+
const here = dirname31(fileURLToPath24(import.meta.url));
|
|
55710
55728
|
const candidates = [
|
|
55711
55729
|
join57(here, "preview-assets.generated.bin"),
|
|
55712
55730
|
// published: copied next to the bundled CLI
|
|
@@ -55864,7 +55882,7 @@ __export(run_watch_exports, {
|
|
|
55864
55882
|
});
|
|
55865
55883
|
import { closeSync as closeSync3, constants, existsSync as existsSync59, fstatSync, lstatSync as lstatSync12, statSync as statSync15, mkdirSync as mkdirSync28, openSync as openSync3, readFileSync as readFileSync66, realpathSync as realpathSync8, renameSync as renameSync6, rmSync as rmSync14, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
|
|
55866
55884
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
55867
|
-
import { extname as extname4, join as join58, resolve as
|
|
55885
|
+
import { extname as extname4, join as join58, resolve as resolve46, sep as sep15 } from "node:path";
|
|
55868
55886
|
function diffReleases(prev, next) {
|
|
55869
55887
|
const bundles = Object.keys(next.bundles).filter((b) => prev.bundles[b]?.sha256 !== next.bundles[b].sha256).sort();
|
|
55870
55888
|
const changedBundles = new Set(bundles);
|
|
@@ -55924,7 +55942,7 @@ function watchContent(dir, onChange, opts = {}) {
|
|
|
55924
55942
|
}
|
|
55925
55943
|
function watchedContentDir(source) {
|
|
55926
55944
|
if (!source || /^https?:\/\//i.test(source)) return null;
|
|
55927
|
-
const dir =
|
|
55945
|
+
const dir = resolve46(source);
|
|
55928
55946
|
try {
|
|
55929
55947
|
return statSync15(dir).isDirectory() && existsSync59(join58(dir, "himalaya.content.json")) ? dir : null;
|
|
55930
55948
|
} catch {
|
|
@@ -56037,7 +56055,7 @@ function boardFile(dir, pathname) {
|
|
|
56037
56055
|
if (m) rel = join58("history", m[1]);
|
|
56038
56056
|
}
|
|
56039
56057
|
if (!rel) return null;
|
|
56040
|
-
const bytes2 = readConfined(
|
|
56058
|
+
const bytes2 = readConfined(resolve46(dir, ".himi"), rel);
|
|
56041
56059
|
if (!bytes2) return new Response("not found", { status: 404 });
|
|
56042
56060
|
return new Response(bytes2, {
|
|
56043
56061
|
status: 200,
|
|
@@ -56047,7 +56065,7 @@ function boardFile(dir, pathname) {
|
|
|
56047
56065
|
function readConfined(root, rel) {
|
|
56048
56066
|
try {
|
|
56049
56067
|
if (!lstatSync12(root).isDirectory()) return null;
|
|
56050
|
-
const parts = rel.split(
|
|
56068
|
+
const parts = rel.split(sep15);
|
|
56051
56069
|
let at2 = root;
|
|
56052
56070
|
for (let i = 0; i < parts.length; i++) {
|
|
56053
56071
|
at2 = join58(at2, parts[i]);
|
|
@@ -56055,7 +56073,7 @@ function readConfined(root, rel) {
|
|
|
56055
56073
|
if (st.isSymbolicLink() || !(i === parts.length - 1 ? st.isFile() : st.isDirectory())) return null;
|
|
56056
56074
|
}
|
|
56057
56075
|
const canonicalRoot = realpathSync8(root);
|
|
56058
|
-
if (!realpathSync8(at2).startsWith(canonicalRoot +
|
|
56076
|
+
if (!realpathSync8(at2).startsWith(canonicalRoot + sep15)) return null;
|
|
56059
56077
|
const fd = openSync3(at2, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
56060
56078
|
try {
|
|
56061
56079
|
if (!fstatSync(fd).isFile()) return null;
|
|
@@ -56114,17 +56132,17 @@ __export(run_browser_exports, {
|
|
|
56114
56132
|
import { createServer as createServer6 } from "node:http";
|
|
56115
56133
|
import { existsSync as existsSync60, readFileSync as readFileSync67 } from "node:fs";
|
|
56116
56134
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
56117
|
-
import { dirname as
|
|
56135
|
+
import { dirname as dirname32, resolve as resolve47 } from "node:path";
|
|
56118
56136
|
import { fileURLToPath as fileURLToPath25 } from "node:url";
|
|
56119
56137
|
function stagedDir() {
|
|
56120
|
-
return process.env.HIMI_BROWSER_PLANE_OUT ?
|
|
56138
|
+
return process.env.HIMI_BROWSER_PLANE_OUT ? resolve47(process.env.HIMI_BROWSER_PLANE_OUT) : resolve47(REPO, "packages", "serve", "dist", "browser-plane");
|
|
56121
56139
|
}
|
|
56122
56140
|
function missingStaged() {
|
|
56123
|
-
return [...SERVED].filter((f) => !existsSync60(
|
|
56141
|
+
return [...SERVED].filter((f) => !existsSync60(resolve47(stagedDir(), f))).sort();
|
|
56124
56142
|
}
|
|
56125
56143
|
function ensureBrowserPlaneStaged() {
|
|
56126
56144
|
if (missingStaged().length === 0) return { ok: true, detail: "already staged" };
|
|
56127
|
-
const r = spawnSync3(process.execPath, [
|
|
56145
|
+
const r = spawnSync3(process.execPath, [resolve47(REPO, "core/serve/scripts/stage-browser-plane.mjs")], {
|
|
56128
56146
|
cwd: REPO,
|
|
56129
56147
|
encoding: "utf8"
|
|
56130
56148
|
});
|
|
@@ -56210,7 +56228,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
|
|
|
56210
56228
|
}
|
|
56211
56229
|
const name = path2 === "/" || path2 === "/index.html" ? "host.html" : path2.slice(1);
|
|
56212
56230
|
if (SERVED.has(name)) {
|
|
56213
|
-
if (!existsSync60(
|
|
56231
|
+
if (!existsSync60(resolve47(stagedDir(), name))) {
|
|
56214
56232
|
const restaged = ensureBrowserPlaneStaged();
|
|
56215
56233
|
if (!restaged.ok) {
|
|
56216
56234
|
res.writeHead(503, { "content-type": "application/json" });
|
|
@@ -56220,7 +56238,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
|
|
|
56220
56238
|
}
|
|
56221
56239
|
let bytes2;
|
|
56222
56240
|
try {
|
|
56223
|
-
bytes2 = readFileSync67(
|
|
56241
|
+
bytes2 = readFileSync67(resolve47(stagedDir(), name));
|
|
56224
56242
|
} catch (e) {
|
|
56225
56243
|
res.writeHead(503, { "content-type": "application/json" });
|
|
56226
56244
|
res.end(JSON.stringify({ error: "browser_plane_unstaged", file: name, detail: String(e) }));
|
|
@@ -56262,8 +56280,8 @@ var init_run_browser = __esm({
|
|
|
56262
56280
|
init_open_url();
|
|
56263
56281
|
init_file_store();
|
|
56264
56282
|
init_wix_client_id();
|
|
56265
|
-
HERE2 =
|
|
56266
|
-
REPO =
|
|
56283
|
+
HERE2 = dirname32(fileURLToPath25(import.meta.url));
|
|
56284
|
+
REPO = resolve47(HERE2, "..", "..", "..");
|
|
56267
56285
|
SERVED = /* @__PURE__ */ new Set(["host.html", "sw.js", "package-reader.js"]);
|
|
56268
56286
|
}
|
|
56269
56287
|
});
|
|
@@ -56683,9 +56701,9 @@ __export(preflight_exports, {
|
|
|
56683
56701
|
requireEnv: () => requireEnv
|
|
56684
56702
|
});
|
|
56685
56703
|
import { existsSync as existsSync61, readFileSync as readFileSync68 } from "node:fs";
|
|
56686
|
-
import { isAbsolute as isAbsolute5, relative as relative12, resolve as
|
|
56704
|
+
import { isAbsolute as isAbsolute5, relative as relative12, resolve as resolve48 } from "node:path";
|
|
56687
56705
|
function isInsideRepo(p) {
|
|
56688
|
-
const rel = relative12(REPO_ROOT3,
|
|
56706
|
+
const rel = relative12(REPO_ROOT3, resolve48(p));
|
|
56689
56707
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute5(rel);
|
|
56690
56708
|
}
|
|
56691
56709
|
function assertCredentialOutsideRepo(label2, p) {
|
|
@@ -57494,7 +57512,7 @@ var init_asc_status = __esm({
|
|
|
57494
57512
|
// ../../core/functions-secrets/src/vault.ts
|
|
57495
57513
|
import { createCipheriv, createDecipheriv, randomBytes as randomBytes5 } from "node:crypto";
|
|
57496
57514
|
import { mkdir, readFile as readFile2, rename, writeFile as writeFile2 } from "node:fs/promises";
|
|
57497
|
-
import { dirname as
|
|
57515
|
+
import { dirname as dirname33 } from "node:path";
|
|
57498
57516
|
function createJsonSecretStore(filePath) {
|
|
57499
57517
|
const read = async () => {
|
|
57500
57518
|
try {
|
|
@@ -57507,7 +57525,7 @@ function createJsonSecretStore(filePath) {
|
|
|
57507
57525
|
}
|
|
57508
57526
|
};
|
|
57509
57527
|
const write2 = async (records) => {
|
|
57510
|
-
await mkdir(
|
|
57528
|
+
await mkdir(dirname33(filePath), { recursive: true });
|
|
57511
57529
|
const temporary = `${filePath}.${process.pid}.tmp`;
|
|
57512
57530
|
await writeFile2(temporary, `${JSON.stringify(records, null, 2)}
|
|
57513
57531
|
`, { mode: 384 });
|
|
@@ -57703,7 +57721,7 @@ __export(notify_exports, {
|
|
|
57703
57721
|
});
|
|
57704
57722
|
import { chmodSync as chmodSync3, mkdirSync as mkdirSync29, readFileSync as readFileSync75, writeFileSync as writeFileSync25 } from "node:fs";
|
|
57705
57723
|
import { homedir as homedir6 } from "node:os";
|
|
57706
|
-
import { dirname as
|
|
57724
|
+
import { dirname as dirname34, join as join61 } from "node:path";
|
|
57707
57725
|
function defaultSessionsPath() {
|
|
57708
57726
|
return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join61(homedir6(), ".himalaya", "admin-sessions.json");
|
|
57709
57727
|
}
|
|
@@ -57717,10 +57735,10 @@ function loadSessionsFile(path2 = defaultSessionsPath()) {
|
|
|
57717
57735
|
function saveAdminSession(adminUrl, session, path2 = defaultSessionsPath()) {
|
|
57718
57736
|
const file = loadSessionsFile(path2);
|
|
57719
57737
|
file.sessions = { ...file.sessions, [adminUrl]: session };
|
|
57720
|
-
mkdirSync29(
|
|
57738
|
+
mkdirSync29(dirname34(path2), { recursive: true, mode: 448 });
|
|
57721
57739
|
writeFileSync25(path2, JSON.stringify(file, null, 2) + "\n", { mode: 384 });
|
|
57722
57740
|
try {
|
|
57723
|
-
chmodSync3(
|
|
57741
|
+
chmodSync3(dirname34(path2), 448);
|
|
57724
57742
|
chmodSync3(path2, 384);
|
|
57725
57743
|
} catch {
|
|
57726
57744
|
}
|
|
@@ -60320,10 +60338,10 @@ function assertPublicSiteUrl(raw) {
|
|
|
60320
60338
|
if (refusal) throw new Error(refusal);
|
|
60321
60339
|
}
|
|
60322
60340
|
function resolveAll(hostname2) {
|
|
60323
|
-
return new Promise((
|
|
60341
|
+
return new Promise((resolve52, reject) => {
|
|
60324
60342
|
dnsLookup(hostname2, { all: true, verbatim: true }, (err, addresses) => {
|
|
60325
60343
|
if (err) reject(err);
|
|
60326
|
-
else
|
|
60344
|
+
else resolve52(addresses);
|
|
60327
60345
|
});
|
|
60328
60346
|
});
|
|
60329
60347
|
}
|
|
@@ -60331,13 +60349,13 @@ function withAbort(start, signal, what) {
|
|
|
60331
60349
|
if (signal?.aborted) return Promise.reject(new Error(`${what} aborted`));
|
|
60332
60350
|
const work = start();
|
|
60333
60351
|
if (!signal) return work;
|
|
60334
|
-
return new Promise((
|
|
60352
|
+
return new Promise((resolve52, reject) => {
|
|
60335
60353
|
const onAbort = () => reject(new Error(`${what} aborted`));
|
|
60336
60354
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
60337
|
-
work.then(
|
|
60355
|
+
work.then(resolve52, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
60338
60356
|
});
|
|
60339
60357
|
}
|
|
60340
|
-
async function pinAddress(url,
|
|
60358
|
+
async function pinAddress(url, resolve52 = resolveAll, signal) {
|
|
60341
60359
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
60342
60360
|
if (ipv4Octets(host)) {
|
|
60343
60361
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
@@ -60347,7 +60365,7 @@ async function pinAddress(url, resolve51 = resolveAll, signal) {
|
|
|
60347
60365
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
60348
60366
|
return { address: host, family: 6 };
|
|
60349
60367
|
}
|
|
60350
|
-
const addresses = await withAbort(() =>
|
|
60368
|
+
const addresses = await withAbort(() => resolve52(host), signal, `${host} lookup`);
|
|
60351
60369
|
if (!addresses.length) throw new Error(`${host} resolved to no address`);
|
|
60352
60370
|
const blocked = addresses.filter((a) => isBlockedAddress(a.address)).map((a) => a.address);
|
|
60353
60371
|
if (blocked.length) throw new Error(`${host} resolves to a blocked address (${blocked.join(", ")})`);
|
|
@@ -60387,7 +60405,7 @@ function copyIncomingHeaders(headers2) {
|
|
|
60387
60405
|
return out2;
|
|
60388
60406
|
}
|
|
60389
60407
|
function requestOnce(url, pinned, init) {
|
|
60390
|
-
return new Promise((
|
|
60408
|
+
return new Promise((resolve52, reject) => {
|
|
60391
60409
|
const headers2 = { host: url.host, "accept-encoding": "identity" };
|
|
60392
60410
|
new Headers(init.headers ?? {}).forEach((value, key2) => {
|
|
60393
60411
|
if (key2.toLowerCase() !== "host") headers2[key2] = value;
|
|
@@ -60417,7 +60435,7 @@ function requestOnce(url, pinned, init) {
|
|
|
60417
60435
|
reject(err);
|
|
60418
60436
|
return;
|
|
60419
60437
|
}
|
|
60420
|
-
|
|
60438
|
+
resolve52(new Response(body, { status, statusText: res.statusMessage ?? "", headers: out2 }));
|
|
60421
60439
|
}
|
|
60422
60440
|
);
|
|
60423
60441
|
req.on("error", reject);
|
|
@@ -61733,14 +61751,14 @@ var init_customer_build = __esm({
|
|
|
61733
61751
|
|
|
61734
61752
|
// src/site-analyze/apply.ts
|
|
61735
61753
|
import { existsSync as existsSync64, readFileSync as readFileSync76, writeFileSync as writeFileSync27, copyFileSync as copyFileSync3, mkdirSync as mkdirSync31, realpathSync as realpathSync9, statSync as statSync17 } from "node:fs";
|
|
61736
|
-
import { dirname as
|
|
61754
|
+
import { dirname as dirname35, isAbsolute as isAbsolute6, join as join63, resolve as resolve49, sep as sep16 } from "node:path";
|
|
61737
61755
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
61738
61756
|
function unpairedRedirectNote(overlay) {
|
|
61739
61757
|
if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
|
|
61740
61758
|
return `no OAuth redirect paired with client ${overlay.wix.clientId} \u2014 the app (and prepare:customer) will refuse to start until one is set. Register it with \`himi site client ensure --site ${overlay.siteId?.trim() || "<msid>"} --redirect-uri <uri> --yes\`, then re-run analyze with \`--redirect-uri <uri>\` (or export HIMI_BRANDED_LITE_WIX_REDIRECT_URI)`;
|
|
61741
61759
|
}
|
|
61742
61760
|
function posix3(p) {
|
|
61743
|
-
return
|
|
61761
|
+
return resolve49(p).replace(/\\/g, "/");
|
|
61744
61762
|
}
|
|
61745
61763
|
function committedShellProvisioning(path2) {
|
|
61746
61764
|
return committedShellFor(posix3(path2));
|
|
@@ -61749,7 +61767,7 @@ function findRepoRoot(cwd) {
|
|
|
61749
61767
|
let dir = cwd;
|
|
61750
61768
|
for (let i = 0; i < 8; i++) {
|
|
61751
61769
|
if (SHELL_NAMES2.some((name) => existsSync64(join63(dir, shellAppDir(name), "package.json")))) return dir;
|
|
61752
|
-
const next =
|
|
61770
|
+
const next = dirname35(dir);
|
|
61753
61771
|
if (next === dir) break;
|
|
61754
61772
|
dir = next;
|
|
61755
61773
|
}
|
|
@@ -61774,7 +61792,7 @@ function assertNotCommitted(path2, forbidden) {
|
|
|
61774
61792
|
`refusing to overwrite committed ${committedProvisioningPath(committed)} \u2014 use prepare:customer --contract`
|
|
61775
61793
|
);
|
|
61776
61794
|
}
|
|
61777
|
-
if (forbidden &&
|
|
61795
|
+
if (forbidden && resolve49(path2) === resolve49(forbidden)) {
|
|
61778
61796
|
const named = committedShellProvisioning(forbidden);
|
|
61779
61797
|
throw new Error(
|
|
61780
61798
|
`refusing to overwrite committed ${named ? committedProvisioningPath(named) : forbidden} \u2014 pass a content-package provisioning.json or use prepare:customer --contract`
|
|
@@ -61828,8 +61846,8 @@ function buildMergedContract(options) {
|
|
|
61828
61846
|
const staged = [];
|
|
61829
61847
|
const contained = (root, rel) => {
|
|
61830
61848
|
if (isAbsolute6(rel)) return void 0;
|
|
61831
|
-
const full =
|
|
61832
|
-
return full.startsWith(
|
|
61849
|
+
const full = resolve49(root, rel);
|
|
61850
|
+
return full.startsWith(resolve49(root) + sep16) ? full : void 0;
|
|
61833
61851
|
};
|
|
61834
61852
|
const stage = (fromRel, toRel) => {
|
|
61835
61853
|
const from = contained(packageDir, fromRel);
|
|
@@ -61843,10 +61861,10 @@ function buildMergedContract(options) {
|
|
|
61843
61861
|
} catch {
|
|
61844
61862
|
return void 0;
|
|
61845
61863
|
}
|
|
61846
|
-
if (!real.startsWith(realRoot +
|
|
61864
|
+
if (!real.startsWith(realRoot + sep16)) return void 0;
|
|
61847
61865
|
try {
|
|
61848
61866
|
if (!statSync17(real).isFile()) return void 0;
|
|
61849
|
-
mkdirSync31(
|
|
61867
|
+
mkdirSync31(dirname35(to), { recursive: true });
|
|
61850
61868
|
copyFileSync3(real, to);
|
|
61851
61869
|
} catch {
|
|
61852
61870
|
return void 0;
|
|
@@ -61884,7 +61902,7 @@ function buildMergedContract(options) {
|
|
|
61884
61902
|
const path2 = join63(packageDir, "provisioning.contract.json");
|
|
61885
61903
|
writeFileSync27(path2, body);
|
|
61886
61904
|
const localPath = join63(appDir3, LOCAL_CONTRACT_REL);
|
|
61887
|
-
mkdirSync31(
|
|
61905
|
+
mkdirSync31(dirname35(localPath), { recursive: true });
|
|
61888
61906
|
writeFileSync27(localPath, body);
|
|
61889
61907
|
staged.push(localPath);
|
|
61890
61908
|
return { path: path2, staged };
|
|
@@ -61918,7 +61936,7 @@ function catalogTypography(overlay, template) {
|
|
|
61918
61936
|
function staticFaqFor(overlay, overlayPath) {
|
|
61919
61937
|
const own3 = overlay.faq;
|
|
61920
61938
|
if (own3 !== void 0) return deriveStaticFaq(own3);
|
|
61921
|
-
const bookPath = join63(
|
|
61939
|
+
const bookPath = join63(dirname35(resolve49(overlayPath)), "book.json");
|
|
61922
61940
|
if (!existsSync64(bookPath)) return void 0;
|
|
61923
61941
|
try {
|
|
61924
61942
|
const book = JSON.parse(readFileSync76(bookPath, "utf8"));
|
|
@@ -61932,7 +61950,7 @@ function staticFaqFor(overlay, overlayPath) {
|
|
|
61932
61950
|
}
|
|
61933
61951
|
}
|
|
61934
61952
|
async function applyOverlays(input) {
|
|
61935
|
-
const cwd =
|
|
61953
|
+
const cwd = resolve49(input.cwd);
|
|
61936
61954
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
61937
61955
|
assertKnownShell(shell);
|
|
61938
61956
|
const overlay = JSON.parse(readFileSync76(input.overlayPath, "utf8"));
|
|
@@ -61956,7 +61974,7 @@ async function applyOverlays(input) {
|
|
|
61956
61974
|
`shell "${shell}" is a site shell: its contract names the customer's website (a \`site\` block), which this analysis does not produce yet. Write the site block into a contract and run \`npm run prepare:customer -- --contract <file>\` in ${shellAppDir(shell)} (or \`himi dist --shell ${shell}\`).`
|
|
61957
61975
|
);
|
|
61958
61976
|
}
|
|
61959
|
-
const packageDir =
|
|
61977
|
+
const packageDir = dirname35(resolve49(input.overlayPath));
|
|
61960
61978
|
const { path: contract, staged } = buildMergedContract({ appDir: appDir3, packageDir, overlay });
|
|
61961
61979
|
wrote.push(...staged);
|
|
61962
61980
|
const r = spawnSync4("npm", ["run", "prepare:customer", "--", "--contract", contract], {
|
|
@@ -62051,7 +62069,7 @@ async function applyOverlays(input) {
|
|
|
62051
62069
|
}
|
|
62052
62070
|
}
|
|
62053
62071
|
if (!input.iconPath || !existsSync64(input.iconPath)) {
|
|
62054
|
-
const book = input.iconPath ?
|
|
62072
|
+
const book = input.iconPath ? dirname35(dirname35(resolve49(input.iconPath))) : void 0;
|
|
62055
62073
|
notes.push(
|
|
62056
62074
|
book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
|
|
62057
62075
|
);
|
|
@@ -63006,10 +63024,10 @@ function permuteDomain(domain, allowSpecialUseDomain) {
|
|
|
63006
63024
|
}
|
|
63007
63025
|
function createPromiseCallback(cb) {
|
|
63008
63026
|
let callback;
|
|
63009
|
-
let
|
|
63027
|
+
let resolve52;
|
|
63010
63028
|
let reject;
|
|
63011
63029
|
const promise = new Promise((_resolve, _reject) => {
|
|
63012
|
-
|
|
63030
|
+
resolve52 = _resolve;
|
|
63013
63031
|
reject = _reject;
|
|
63014
63032
|
});
|
|
63015
63033
|
if (typeof cb === "function") {
|
|
@@ -63025,7 +63043,7 @@ function createPromiseCallback(cb) {
|
|
|
63025
63043
|
callback = (err, result) => {
|
|
63026
63044
|
try {
|
|
63027
63045
|
if (err) reject(err);
|
|
63028
|
-
else
|
|
63046
|
+
else resolve52(result);
|
|
63029
63047
|
} catch (e) {
|
|
63030
63048
|
reject(e instanceof Error ? e : new Error());
|
|
63031
63049
|
}
|
|
@@ -66244,7 +66262,7 @@ __export(cli_exports, {
|
|
|
66244
66262
|
runSiteFunctionCli: () => runSiteFunctionCli
|
|
66245
66263
|
});
|
|
66246
66264
|
import { readFileSync as readFileSync77 } from "node:fs";
|
|
66247
|
-
import { resolve as
|
|
66265
|
+
import { resolve as resolve50 } from "node:path";
|
|
66248
66266
|
function assetFetchFor(_opts) {
|
|
66249
66267
|
return pinnedFetch2;
|
|
66250
66268
|
}
|
|
@@ -66263,7 +66281,7 @@ async function runSiteAnalyze(opts) {
|
|
|
66263
66281
|
const assetFetch = assetFetchFor(opts);
|
|
66264
66282
|
const siteFetch = guardedSiteFetch;
|
|
66265
66283
|
const cwd = opts.cwd ?? process.cwd();
|
|
66266
|
-
const outDir =
|
|
66284
|
+
const outDir = resolve50(cwd, opts.outDir ?? ".himi/business-book");
|
|
66267
66285
|
let ownerAuth;
|
|
66268
66286
|
let msid;
|
|
66269
66287
|
const ownerSite = ownerSiteFor(opts);
|
|
@@ -66303,9 +66321,9 @@ async function runSiteAnalyze(opts) {
|
|
|
66303
66321
|
if (opts.apply) {
|
|
66304
66322
|
applied = await applyOverlays({
|
|
66305
66323
|
cwd,
|
|
66306
|
-
overlayPath:
|
|
66307
|
-
tokensPath:
|
|
66308
|
-
iconPath:
|
|
66324
|
+
overlayPath: resolve50(outDir, "provisioning.overlay.json"),
|
|
66325
|
+
tokensPath: resolve50(outDir, "tokens.overlay.json"),
|
|
66326
|
+
iconPath: resolve50(outDir, "media/icon.png"),
|
|
66309
66327
|
shell: opts.shell
|
|
66310
66328
|
});
|
|
66311
66329
|
const note = noteWithWarnings(applied.note, warnings);
|
|
@@ -66341,7 +66359,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
66341
66359
|
const token = opts.token ?? await siteToken(msid);
|
|
66342
66360
|
let source;
|
|
66343
66361
|
if (opts.sourcePath) {
|
|
66344
|
-
const p =
|
|
66362
|
+
const p = resolve50(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
66345
66363
|
source = readFileSync77(p, "utf8");
|
|
66346
66364
|
}
|
|
66347
66365
|
let body;
|
|
@@ -66395,7 +66413,7 @@ async function accountToken2(spawnImpl = spawn6) {
|
|
|
66395
66413
|
cached2 = fromEnv;
|
|
66396
66414
|
return fromEnv;
|
|
66397
66415
|
}
|
|
66398
|
-
const token = await new Promise((
|
|
66416
|
+
const token = await new Promise((resolve52, reject) => {
|
|
66399
66417
|
let child;
|
|
66400
66418
|
try {
|
|
66401
66419
|
child = spawnImpl("wix", ["token"]);
|
|
@@ -66424,7 +66442,7 @@ async function accountToken2(spawnImpl = spawn6) {
|
|
|
66424
66442
|
const scan = (d) => {
|
|
66425
66443
|
out2 += String(d);
|
|
66426
66444
|
const m = out2.match(TOKEN_RE2);
|
|
66427
|
-
if (m) done(() =>
|
|
66445
|
+
if (m) done(() => resolve52(m[0]));
|
|
66428
66446
|
};
|
|
66429
66447
|
child.stdout?.on("data", scan);
|
|
66430
66448
|
child.stderr?.on("data", scan);
|
|
@@ -67427,7 +67445,7 @@ import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync79, mkdirSync
|
|
|
67427
67445
|
import { execFile, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn7 } from "node:child_process";
|
|
67428
67446
|
import { createHash as createHash31, randomUUID as randomUUID6 } from "node:crypto";
|
|
67429
67447
|
import { tmpdir as tmpdir5, homedir as homedir7, hostname } from "node:os";
|
|
67430
|
-
import { join as join64, resolve as
|
|
67448
|
+
import { join as join64, resolve as resolve51, relative as relative13, basename as basename17, dirname as dirname36 } from "node:path";
|
|
67431
67449
|
import { fileURLToPath as fileURLToPath26 } from "node:url";
|
|
67432
67450
|
|
|
67433
67451
|
// ../serve-cli/src/client.ts
|
|
@@ -68153,7 +68171,7 @@ async function browserLogin(opts) {
|
|
|
68153
68171
|
const log = opts.log ?? (() => {
|
|
68154
68172
|
});
|
|
68155
68173
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
68156
|
-
return await new Promise((
|
|
68174
|
+
return await new Promise((resolve52, reject) => {
|
|
68157
68175
|
let settled = false;
|
|
68158
68176
|
let loginUrl = "";
|
|
68159
68177
|
const server = createServer();
|
|
@@ -68217,7 +68235,7 @@ async function browserLogin(opts) {
|
|
|
68217
68235
|
return;
|
|
68218
68236
|
}
|
|
68219
68237
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", connection: "close" }).end(CLOSE_PAGE);
|
|
68220
|
-
finish2(() =>
|
|
68238
|
+
finish2(() => resolve52({ token, loginUrl }));
|
|
68221
68239
|
});
|
|
68222
68240
|
});
|
|
68223
68241
|
server.on("error", (err) => finish2(() => reject(err)));
|
|
@@ -70191,7 +70209,7 @@ var COMMANDS = [
|
|
|
70191
70209
|
{ name: "validate", summary: "lint the content package (no push): fixed-contract TypeScript checking for tier5-src workers + schema/proto + token refs + component allowlist + $service bindings + strict-enum foot-guns + capability decls + worker boot dry-run + build/compile failures. Type issues are advisory warnings normally; --strict promotes them and hygiene warnings to errors. Exit 1 on any error. Off-repo, the CLI supplies its compiler and SDK declarations.", required: "[--content <dir>] [--strict]" },
|
|
70192
70210
|
{ name: "test", summary: "DERIVED behavioral crawl \u2014 no test files to write. Boots each screen's real worker, replays its onAppear, then dispatches every action site the descriptor already declares (each from a fresh boot) and checks a narrow set of unambiguous invariants: no uncaught throw, never stuck on `loading`, no `$service:` token or NaN/undefined/[object Object] reaching visible text, no binding aimed at state the worker never defines, no nav param silently dropped, no dead nav target. Catches what validate/render cannot \u2014 a WRONG REDUCER passes both with ok:true. Runs the worker in a DEVICE-PARITY sandbox (no setTimeout/setInterval, as on JSC/WebView) so a bundle that would die on device fails here. Crawls on HERMETIC DATA by default \u2014 zero network: the app's own dev/net-mocks.json first (--net <file> overrides), then the config's CMS `seed:` rows, then a canned fixture of frozen real vertical responses shipped with the CLI (exercises code paths, not API-contract truth) \u2014 so the success/mapping path runs, not just the failure UI. Two boot-only HOSTILE passes (every list empty; every request 500) then check the failure/empty day \u2014 corpus-proven, so their findings are errors. NAV EDGES are followed too: every himi.open site ($item params resolved against row 0 of its list, $service against worker state) and worker _nav directive is harvested, and each baked target is booted WITH the params the source sends \u2014 detail screens finally run their content arm; edge findings are errors tagged edge:<source>. --native runs both real native decoders over the exact baked JSON bytes; --native ios or --native android selects one. It is explicit, runs only from a Himalaya SOURCE CHECKOUT (the decoder oracles are that tree's own HimalayaCore Swift package and Gradle harness, which a published install does not ship), and needs the selected local toolchain. From a source checkout, default runs name missing native verdicts in the coverage ledger; elsewhere the ledger stays silent about them rather than offering a remedy you cannot run. --offline strips all data layers (the old reject-all axis); --no-hostile skips the hostile passes. --record (EXPLICIT, never automatic) refreshes dev/net-mocks.json from live reads first: it boots each screen (load + root onAppear ONLY \u2014 nothing the app's own launch would not fire; the tap/action crawl never sees the live transport, and only proven reads \u2014 GET, or read-shaped POST (/query, /search, /list*, \u2026) \u2014 ever reach the wire), freezes the round-trips, then crawls hermetically on the fresh fixture; record against a QA site, not production. Nodes it cannot judge headless are named, never silently passed. Exit 1 on any error. The CLI carries the authoring runtime off-repo; no per-app SDK install is required. --browser runs the whole loop (build \u2192 extract \u2192 validate \u2192 render \u2192 test) in YOUR browser instead of here, so the source never reaches a pod: it opens one screen's worker + descriptor in a tab, blocks on a loopback callback, and prints the report it posts back. One screen per tab \u2014 name it. --no-open prints the URL rather than launching a browser (SSH); --timeout <ms> bounds the wait, which matters because the page has no execution deadline of its own and an infinite loop in the worker hangs the tab.", required: "[<screenId>\u2026] [--content <dir>] [--net <file>] [--budget <ms>] [--deep [n]] [--record] [--native [ios|android]] [--no-shots] [--offline] [--no-hostile] [--all-screens] [--browser] [--no-open] [--timeout <ms>] [--json]" },
|
|
70193
70211
|
{ name: "ux", summary: "audit or record mobile UX evidence. `audit` checks the public-safe contract, seeded blank acceptance rows, placeholder source copy, app-specific mocks, and iOS/Android audit records. It warns while existing templates migrate; `--strict` promotes missing evidence. `record` stores checks performed on an installed iOS/Android build: `--checks` is required for passed|failed and empty for unavailable, which drove nothing and needs a `--reason` instead. `record` also STAMPS the release it audited (it resolves the id from a build, the same one a push would publish), because an unforced `himi push` of a release with screens refuses when no drive is recorded for THAT release, or when the one that is recorded says `failed` \u2014 the artifact stopped being advice nobody reads (#2955). `unavailable` still satisfies it; only `failed` refuses.", required: "audit [--content <dir>] [--strict] [--json] | record --content <dir> --platform ios|android --status passed|failed|unavailable [--checks back,keyboard,...] [--reason <text>]" },
|
|
70194
|
-
{ name: "progress", summary: 'the build JOURNAL an agent keeps for the owner while it works. `himi progress "<what changed>" --step <1-8|name> --image <png>` appends one postcard to .himi/progress.jsonl \u2014 the step is one of the customer journey\'s eight (discover, classify, plan, implement, brand, validate, review, download) \u2014 and COPIES each image, content-addressed, into .himi/history/, because .himi/shots/ is overwritten by every render and cleared by every full `himi test`, so a path into it would later show a different picture than the one the owner was sent. --image repeats. With NO --image, the home screen\'s current shot is attached automatically, only when it is no older than the last source change and not the picture the latest journaled postcard already shows; `imageAttached` in the output says whether the postcard carries a picture (with `imageNote` saying why not), and `--no-image` sends a text-only postcard. --notify also raises a best-effort desktop notification for an owner who stepped away. A bare `himi progress` prints the journal with the current step and elapsed time \u2014 also how an agent recovers its place after its context was compacted. APPROVALS: `--approve <gate> "<what>"` records one the customer just gave (gates: site-create, connect, private-data, draft, promote, push-signing, qa-build) in .himi/approvals.jsonl, and `--done <gate>` / `--drop <gate>` closes it \u2014 an approval is owed until then, and the chat that held it does not survive a new session. `--brief` prints plain text for a session start: the current step, the last postcard, every open approval, and whether this app\'s agent files are stale \u2014 the SessionStart hook `himi agent-init` installs runs exactly this. The CLI also journals milestones by itself \u2014 the first PNG render of the home screen (for an app a current `himi init` started: once as the template\'s "Starting point" while the source is what init wrote, then once as "First look at your app" after it diverges, Markdown edits not counting; once per app otherwise), a `himi test` crawl whose outcome changed since the last one (its counts or its home picture; an identical re-run writes none), every draft push (with the home picture only when that shot is newer than the last source edit) \u2014 marked `"by": "himi"`; they never move the journey step, carry no link or credential, and step aside (folded out of every reader) when the agent journals the same step or picture within five minutes. Local only: nothing is sent anywhere.', required: '["<message>" [--step <1-8|name>] [--image <png>]\u2026 [--notify]] [--content <dir>] | --approve|--done|--drop <gate> ["<note>"] | --brief' },
|
|
70212
|
+
{ name: "progress", summary: 'the build JOURNAL an agent keeps for the owner while it works. `himi progress "<what changed>" --step <1-8|name> --image <png>` appends one postcard to .himi/progress.jsonl \u2014 the step is one of the customer journey\'s eight (discover, classify, plan, implement, brand, validate, review, download) \u2014 and COPIES each image, content-addressed, into .himi/history/, because .himi/shots/ is overwritten by every render and cleared by every full `himi test`, so a path into it would later show a different picture than the one the owner was sent. --image repeats. With NO --image, the home screen\'s current shot is attached automatically, only when it is no older than the last source change and not the picture the latest journaled postcard already shows; `imageAttached` in the output says whether the postcard carries a picture (with `imageNote` saying why not), and `--no-image` sends a text-only postcard. --notify also raises a best-effort desktop notification for an owner who stepped away. A bare `himi progress` prints the journal with the current step and elapsed time \u2014 also how an agent recovers its place after its context was compacted. APPROVALS: `--approve <gate> "<what>"` records one the customer just gave (gates: site-create, connect, private-data, draft, promote, push-signing, qa-build) in .himi/approvals.jsonl, and `--done <gate>` / `--drop <gate>` closes it \u2014 an approval is owed until then, and the chat that held it does not survive a new session. `--brief` prints plain text for a session start: the current step, the last postcard, every open approval, and whether this app\'s agent files are stale \u2014 the SessionStart hook `himi agent-init` installs runs exactly this. The CLI also journals milestones by itself \u2014 the first PNG render of the home screen (for an app a current `himi init` started: once as the template\'s "Starting point" while the source is what init wrote, then once as "First look at your app" after it diverges, Markdown edits not counting; once per app otherwise), a `himi test` crawl whose outcome changed since the last one (its counts or its home picture; an identical re-run writes none), every draft push (with the home picture only when that shot is newer than the last source edit) \u2014 marked `"by": "himi"`; they never move the journey step, carry no link or credential, and step aside (folded out of every reader) when the agent journals the same step or picture within five minutes. Local only: nothing is sent anywhere.', required: '["<message>" [--step <1-8|name>] [--image <png>]\u2026 [--no-image] [--notify]] [--content <dir>] | --approve|--done|--drop <gate> ["<note>"] | --brief' },
|
|
70195
70213
|
{ name: "studio", summary: "open the BUILD BOARD \u2014 one local page the owner can leave open while an agent builds their app, which fills itself in: every screen as it renders (NEW/CHANGED badges, and each earlier version kept for a filmstrip), the journey stepper and the latest postcard from `himi progress`, the validate/test/UX/draft checks as they run, the site next to the app's home screen with its palette, and the navigation the test crawl followed. Writes .himi/studio/index.html and opens it; the page re-reads its state every two seconds, so nothing needs to be served. OPT-IN BY EXISTENCE: until this command (or `himi init`, which makes the board for every app it creates, without opening a browser) has run, no other command touches .himi/studio/ \u2014 after it, render/test/validate/push/icon/site/ux/progress each refresh the board as they finish (best-effort; never fails a command). Every image is a content-addressed copy in .himi/history/, never a live path into .himi/shots/. Local only, no secrets: it never reads a preview token, handover code or control token. --no-open prints the path instead (SSH, CI). `himi studio reel` writes the MAKING-OF: one self-contained HTML file (every image inlined, nothing fetched) with a flipbook of the home screen version by version, captioned by the postcard in effect at the time, the final screens, and every postcard \u2014 sized to stay attachable, thinning frames first. Defaults to .himi/making-of.html (never archived by push), which every successful `himi push --draft` also rebuilds and names as `reel` in its output; --out to put it elsewhere. The output names that file as the one to hand the owner (`handover: {file, hint}` in JSON; two plain lines at a terminal) \u2014 beside the preview link, never instead of it.", required: "[--content <dir>] [--no-open] | reel [--out <file>] [--no-open]" },
|
|
70196
70214
|
{ name: "render", summary: "headless-render a screen with the web renderer: render-tree + diagnostics, optional --png [<file>] (bare: .himi/shots/<id>.png, what the build board shows), --scheme dark, --tree. Local by default (content dir). Pass --remote --app --release to hit GET /v1/preview/\u2026/render on the serve plane after a push. Boots the worker so $service bindings resolve; --static raw bindings; --live real Wix fetches; --state injects worker state; --input supplies pre-boot navigation params; --width/--device for PNG viewport; --rtl for dir=rtl + $env:isRTL.", required: "<screenId> [--content <dir>] [--scheme dark] [--png [<file>]] [--tree] [--static] [--live] [--state <json|file>] [--input <json|file>] [--width <px> | --device <name>] [--rtl] [--remote --app --release]" },
|
|
70197
70215
|
{ name: "cms", summary: "inspect, provision, and seed the app's CMS (Wix Data) collections, declared as a `cms` block in config.ts. `query` is READ-ONLY \u2014 by default it fetches ONLY the physical ids `config.ts` declares (item counts + schema drift) and reports `siteScanned: false`; it never lists the site, so an UNDECLARED `himi_<app>_` collection this app owns is not reached without `--all`. `--all` SCANS the site \u2014 every collection it lists is labeled `owned`/`adopted`/`foreign`, and it describes every foreign one \u2014 id, non-system field keys + types, and the site's read role \u2014 so an app with no `cms` block at all can DISCOVER a collection to adopt (`--all` is the one case where a missing `cms` block is not 'nothing to do'). Foreign collections are described up to a cap and are never item-counted (`itemCount: null`), because a row count is one query each; `foreign.count` is how many the scan LISTED \u2014 it follows the list endpoint's pages, and `listingIncomplete: true` says when the walk stopped short of the end, with `unlistedCollections` counting what it left out when Wix gave a paging total \u2014 and `foreign.truncated` says how many of those went undescribed, each still NAMED in `foreign.others` (id + displayName), so a collection the site already has is never hidden behind the cap. The scan is OWNER-scoped \u2014 it needs --site <msid> (or WIX_SITE_ID) plus owner auth via `wix token`; a visitor token can read a public collection's ITEMS but can never enumerate collections, so there is no tokenless discovery path. `create` reconciles declared collections additively and idempotently, and REFUSES any id outside the app's `himi_<app>_` namespace, so it is safe against a production site. It reports declared-vs-site `permissionDrift` but never writes permissions unless asked with --apply-permissions, so a field reconcile can't silently revert access control changed in the dashboard. `seed` inserts the git-tracked `seed:` rows into EMPTY owned collections (--force to add to a non-empty one; --ai writes placeholder rows plus a refinement prompt for you to review). Adopted collections (declared by `wixId`) are read-only and never created, updated, or seeded. Site from --site <msid> or WIX_SITE_ID; owner auth via `wix token`.", required: "query|create|seed [--site <msid>] [--content <dir>] [--all] [--dry-run] [--force] [--allow-destructive] [--apply-permissions] [--only <id>] [--ai] [--count <n>]" },
|
|
@@ -70293,16 +70311,16 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
|
|
|
70293
70311
|
}
|
|
70294
70312
|
var SCOPED_REGISTRY_TIMEOUT_MS = 5e3;
|
|
70295
70313
|
function execNpmConfig(file, args, options) {
|
|
70296
|
-
return new Promise((
|
|
70297
|
-
execFile(file, args, { ...options, windowsHide: true }, (error, stdout) => error ? reject(error) :
|
|
70314
|
+
return new Promise((resolve52, reject) => {
|
|
70315
|
+
execFile(file, args, { ...options, windowsHide: true }, (error, stdout) => error ? reject(error) : resolve52(String(stdout)));
|
|
70298
70316
|
});
|
|
70299
70317
|
}
|
|
70300
70318
|
var npmScopedWixRegistry = createScopedRegistryResolver();
|
|
70301
70319
|
async function scopedRegistryBefore(lookup2, deadline) {
|
|
70302
70320
|
let cancel = () => {
|
|
70303
70321
|
};
|
|
70304
|
-
const expired = new Promise((
|
|
70305
|
-
const timer = setTimeout(() =>
|
|
70322
|
+
const expired = new Promise((resolve52) => {
|
|
70323
|
+
const timer = setTimeout(() => resolve52(void 0), Math.max(0, deadline - Date.now()));
|
|
70306
70324
|
cancel = () => clearTimeout(timer);
|
|
70307
70325
|
});
|
|
70308
70326
|
try {
|
|
@@ -70367,11 +70385,11 @@ function packageVersion(path2) {
|
|
|
70367
70385
|
}
|
|
70368
70386
|
}
|
|
70369
70387
|
function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("./authoring-runtime/node_modules/@wix/himalaya/package.json", import.meta.url)) {
|
|
70370
|
-
let dir =
|
|
70388
|
+
let dir = resolve51(fromDir);
|
|
70371
70389
|
for (; ; ) {
|
|
70372
70390
|
const version2 = packageVersion(join64(dir, "node_modules", "@wix", "himalaya", "package.json"));
|
|
70373
70391
|
if (version2) return { version: version2, source: "local" };
|
|
70374
|
-
const parent =
|
|
70392
|
+
const parent = dirname36(dir);
|
|
70375
70393
|
if (parent === dir) break;
|
|
70376
70394
|
dir = parent;
|
|
70377
70395
|
}
|
|
@@ -70438,7 +70456,7 @@ function readUpdateCache(path2) {
|
|
|
70438
70456
|
}
|
|
70439
70457
|
function writeUpdateCache(path2, cache) {
|
|
70440
70458
|
try {
|
|
70441
|
-
mkdirSync32(
|
|
70459
|
+
mkdirSync32(dirname36(path2), { recursive: true, mode: 448 });
|
|
70442
70460
|
writeFileSync29(path2, JSON.stringify(cache, null, 2) + "\n", { mode: 384 });
|
|
70443
70461
|
} catch {
|
|
70444
70462
|
}
|
|
@@ -70595,7 +70613,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
|
|
|
70595
70613
|
};
|
|
70596
70614
|
const release = () => removeIfMine(lockPath);
|
|
70597
70615
|
try {
|
|
70598
|
-
mkdirSync32(
|
|
70616
|
+
mkdirSync32(dirname36(lockPath), { recursive: true, mode: 448 });
|
|
70599
70617
|
} catch {
|
|
70600
70618
|
return () => {
|
|
70601
70619
|
};
|
|
@@ -70708,7 +70726,7 @@ function createTrimValidator(deps = {}, spawnFn = spawn7) {
|
|
|
70708
70726
|
return { code, counts, ...errors ? { errors } : {}, ...code !== 0 ? { tail: said.slice(-4e3) } : {} };
|
|
70709
70727
|
};
|
|
70710
70728
|
return async (dir, opts = {}) => {
|
|
70711
|
-
const argv = ["validate", "--content",
|
|
70729
|
+
const argv = ["validate", "--content", resolve51(dir), "--strict", "--skip-version-check"];
|
|
70712
70730
|
if (!opts.fresh) {
|
|
70713
70731
|
const out2 = [];
|
|
70714
70732
|
const err = [];
|
|
@@ -71295,7 +71313,7 @@ function readConfigSource(dir) {
|
|
|
71295
71313
|
}
|
|
71296
71314
|
}
|
|
71297
71315
|
function writePngFile(path2, base64) {
|
|
71298
|
-
mkdirSync32(
|
|
71316
|
+
mkdirSync32(dirname36(path2), { recursive: true });
|
|
71299
71317
|
writeFileSync29(path2, Buffer.from(base64, "base64"));
|
|
71300
71318
|
return path2;
|
|
71301
71319
|
}
|
|
@@ -71324,7 +71342,7 @@ function keptPlan(kept) {
|
|
|
71324
71342
|
return note ? { kept, note } : {};
|
|
71325
71343
|
}
|
|
71326
71344
|
async function initFromRemoteTemplate(name, parentDir, template, c) {
|
|
71327
|
-
const dir =
|
|
71345
|
+
const dir = resolve51(parentDir, name);
|
|
71328
71346
|
if (existsSync66(join64(dir, "himalaya.content.json"))) {
|
|
71329
71347
|
throw new Error(`content package already exists at ${dir}`);
|
|
71330
71348
|
}
|
|
@@ -71337,7 +71355,7 @@ async function initFromRemoteTemplate(name, parentDir, template, c) {
|
|
|
71337
71355
|
return finishScaffold(materializeSource(archive.files, name, dir), template);
|
|
71338
71356
|
}
|
|
71339
71357
|
function contentDir(flags) {
|
|
71340
|
-
return
|
|
71358
|
+
return resolve51(str7(flags.content) ?? process.cwd());
|
|
71341
71359
|
}
|
|
71342
71360
|
function renameRestoredSource(restored, declaredApp, renamed) {
|
|
71343
71361
|
const text6 = {};
|
|
@@ -71381,10 +71399,10 @@ function restoreDestinationIssue(dest, force) {
|
|
|
71381
71399
|
return null;
|
|
71382
71400
|
}
|
|
71383
71401
|
function isHimalayaMonorepoCheckout(start) {
|
|
71384
|
-
let dir =
|
|
71402
|
+
let dir = resolve51(start);
|
|
71385
71403
|
for (; ; ) {
|
|
71386
71404
|
if (existsSync66(join64(dir, "tools", "himi-cli", "src", "cli.ts")) && existsSync66(join64(dir, "core", "serve", "src", "server.ts"))) return true;
|
|
71387
|
-
const parent =
|
|
71405
|
+
const parent = dirname36(dir);
|
|
71388
71406
|
if (parent === dir) return false;
|
|
71389
71407
|
dir = parent;
|
|
71390
71408
|
}
|
|
@@ -71443,7 +71461,7 @@ function materializeForPreview(appDir3, slug, displayName) {
|
|
|
71443
71461
|
const forBuild = Object.fromEntries(
|
|
71444
71462
|
Object.entries(files).map(([rel, body]) => [rel, rel === "himalaya.content.json" ? substituteIdentity(body, slug) : body])
|
|
71445
71463
|
);
|
|
71446
|
-
const repoRoot2 =
|
|
71464
|
+
const repoRoot2 = resolve51(fileURLToPath26(new URL("../../..", import.meta.url)));
|
|
71447
71465
|
const root = join64(repoRoot2, "node_modules", ".cache", "himi-template-preview");
|
|
71448
71466
|
const stillRunning = (pid) => {
|
|
71449
71467
|
try {
|
|
@@ -71689,7 +71707,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
|
|
|
71689
71707
|
return 0;
|
|
71690
71708
|
}
|
|
71691
71709
|
case "agent-init": {
|
|
71692
|
-
const dir =
|
|
71710
|
+
const dir = resolve51(str7(flags.dir) ?? process.cwd());
|
|
71693
71711
|
const { seedAgentFiles: seedAgentFiles2, NotAContentPackage: NotAContentPackage2 } = await Promise.resolve().then(() => (init_agent_context(), agent_context_exports));
|
|
71694
71712
|
let res;
|
|
71695
71713
|
try {
|
|
@@ -72225,7 +72243,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
|
|
|
72225
72243
|
return 2;
|
|
72226
72244
|
}
|
|
72227
72245
|
const template = str7(flags.template);
|
|
72228
|
-
const parentDir =
|
|
72246
|
+
const parentDir = resolve51(str7(flags.dir) ?? process.cwd());
|
|
72229
72247
|
const withAgentFiles = async (dir) => {
|
|
72230
72248
|
const seeded = await seedAgentFilesFor(dir, flags);
|
|
72231
72249
|
if (!seeded.agent || "error" in seeded.agent) return seeded;
|
|
@@ -72374,8 +72392,8 @@ ${doNow.map((l) => ` ${l}`).join("\n")}`);
|
|
|
72374
72392
|
return 2;
|
|
72375
72393
|
}
|
|
72376
72394
|
}
|
|
72377
|
-
const appDir3 =
|
|
72378
|
-
const sourceDir =
|
|
72395
|
+
const appDir3 = resolve51(str7(flags.dir) ?? process.cwd());
|
|
72396
|
+
const sourceDir = resolve51(str7(flags["source-dir"]) ?? appDir3);
|
|
72379
72397
|
let meta;
|
|
72380
72398
|
try {
|
|
72381
72399
|
meta = JSON.parse(readFileSync79(join64(sourceDir, TEMPLATE_META_FILE), "utf8"));
|
|
@@ -72417,7 +72435,7 @@ ${doNow.map((l) => ` ${l}`).join("\n")}`);
|
|
|
72417
72435
|
...hasWorkers ? { tier5Dir: bundleOutDir2(buildDir) } : {},
|
|
72418
72436
|
collect: { lint: true, strict }
|
|
72419
72437
|
});
|
|
72420
|
-
const scaffoldSourceFindings =
|
|
72438
|
+
const scaffoldSourceFindings = resolve51(sourceDir) === resolve51(appDir3) ? [] : [
|
|
72421
72439
|
...tokenColorIssues(sourceDir),
|
|
72422
72440
|
...surfaceIssues(sourceDir, void 0, strict),
|
|
72423
72441
|
...await fontIssues(sourceDir, strict),
|
|
@@ -72460,7 +72478,7 @@ ${doNow.map((l) => ` ${l}`).join("\n")}`);
|
|
|
72460
72478
|
}));
|
|
72461
72479
|
return 1;
|
|
72462
72480
|
}
|
|
72463
|
-
const iconPath = str7(flags.icon) ?
|
|
72481
|
+
const iconPath = str7(flags.icon) ? resolve51(str7(flags.icon)) : templateIconPath(name);
|
|
72464
72482
|
let iconHash;
|
|
72465
72483
|
if (iconPath) {
|
|
72466
72484
|
try {
|
|
@@ -72882,10 +72900,10 @@ ${doNow.map((l) => ` ${l}`).join("\n")}`);
|
|
|
72882
72900
|
return 1;
|
|
72883
72901
|
}
|
|
72884
72902
|
const { himiPluginFiles: himiPluginFiles2 } = await Promise.resolve().then(() => (init_claude_plugin(), claude_plugin_exports));
|
|
72885
|
-
const dir =
|
|
72903
|
+
const dir = resolve51(out2);
|
|
72886
72904
|
const files = himiPluginFiles2(skills.skillMd);
|
|
72887
72905
|
for (const f of files) {
|
|
72888
|
-
mkdirSync32(
|
|
72906
|
+
mkdirSync32(dirname36(join64(dir, f.path)), { recursive: true });
|
|
72889
72907
|
writeFileSync29(join64(dir, f.path), f.text);
|
|
72890
72908
|
}
|
|
72891
72909
|
print({ ok: true, dir, files: files.map((f) => f.path), next: [`claude plugin validate ${dir}`, `claude --plugin-dir ${dir}`] });
|
|
@@ -72904,9 +72922,9 @@ ${doNow.map((l) => ` ${l}`).join("\n")}`);
|
|
|
72904
72922
|
}
|
|
72905
72923
|
if (pos[1] === "reel") {
|
|
72906
72924
|
const { buildReel: buildReel2 } = await Promise.resolve().then(() => (init_studio_reel(), studio_reel_exports));
|
|
72907
|
-
const out2 =
|
|
72925
|
+
const out2 = resolve51(str7(flags.out) ?? join64(dir, ".himi", "making-of.html"));
|
|
72908
72926
|
const { html, plan } = buildReel2(dir);
|
|
72909
|
-
mkdirSync32(
|
|
72927
|
+
mkdirSync32(dirname36(out2), { recursive: true });
|
|
72910
72928
|
writeFileSync29(out2, html);
|
|
72911
72929
|
const { pathToFileURL: pathToFileURL9 } = await import("node:url");
|
|
72912
72930
|
const url2 = pathToFileURL9(out2).href;
|
|
@@ -73482,7 +73500,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
73482
73500
|
}
|
|
73483
73501
|
});
|
|
73484
73502
|
const home = outcome.homeScreenId;
|
|
73485
|
-
const { afterTestRun: afterTestRun2, watchReminder: watchReminder2 } = await Promise.resolve().then(() => (init_milestones(), milestones_exports));
|
|
73503
|
+
const { afterTestRun: afterTestRun2, watchReminder: watchReminder2, homeShotPath: homeShotPath2 } = await Promise.resolve().then(() => (init_milestones(), milestones_exports));
|
|
73486
73504
|
const testReminder = watchReminder2(dir, { content: str7(flags.content) });
|
|
73487
73505
|
const afterRun = afterTestRun2(dir, {
|
|
73488
73506
|
runId: attestation.runId,
|
|
@@ -73490,7 +73508,7 @@ ${handover.hint[0].toUpperCase()}${handover.hint.slice(1)}.`);
|
|
|
73490
73508
|
actions: result.actions.exercised,
|
|
73491
73509
|
errors: result.counts.errors,
|
|
73492
73510
|
...result.navGraph ? { broken: result.navGraph.broken.length, unreached: result.navGraph.unreached.length } : {},
|
|
73493
|
-
...home && writtenShots.includes(`${home}.png`) ? { homeShot:
|
|
73511
|
+
...home && writtenShots.includes(`${home}.png`) && homeShotPath2(dir, home) ? { homeShot: homeShotPath2(dir, home) } : {},
|
|
73494
73512
|
boardOpen: boardOpen(dir)
|
|
73495
73513
|
});
|
|
73496
73514
|
if (structuredOutput) {
|
|
@@ -73660,7 +73678,7 @@ ${[...testReminder ? [testReminder] : [], ...afterRun.next].join("\n")}`);
|
|
|
73660
73678
|
const pngTarget = typeof flags.png === "string" ? str7(flags.png) : flags.png === true ? shotPath : void 0;
|
|
73661
73679
|
if (pngTarget && r.pngBase64) {
|
|
73662
73680
|
pngFile = writePngFile(pngTarget, r.pngBase64);
|
|
73663
|
-
attestationPngFile =
|
|
73681
|
+
attestationPngFile = resolve51(pngTarget) === resolve51(shotPath) ? pngFile : writePngFile(shotPath, r.pngBase64);
|
|
73664
73682
|
}
|
|
73665
73683
|
if (renderWidth !== void 0 && r.renderable) {
|
|
73666
73684
|
recordRenderWidth(dir, {
|
|
@@ -73995,7 +74013,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
73995
74013
|
return 2;
|
|
73996
74014
|
}
|
|
73997
74015
|
const renamed = str7(flags.name);
|
|
73998
|
-
const dest =
|
|
74016
|
+
const dest = resolve51(str7(flags.out) ?? process.cwd(), renamed ?? wanted);
|
|
73999
74017
|
const replace = flags.replace === true;
|
|
74000
74018
|
const force = replace || flags.force === true;
|
|
74001
74019
|
const linked = symlinkDestinationIssue(dest);
|
|
@@ -74479,11 +74497,12 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74479
74497
|
} catch {
|
|
74480
74498
|
}
|
|
74481
74499
|
}
|
|
74500
|
+
const draftShot = draft && outcome.homeScreenId ? (await Promise.resolve().then(() => (init_milestones(), milestones_exports))).homeShotPath(dir, outcome.homeScreenId) : null;
|
|
74482
74501
|
const afterDraft = draft ? (await Promise.resolve().then(() => (init_milestones(), milestones_exports))).afterDraftPush(dir, {
|
|
74483
74502
|
app,
|
|
74484
74503
|
releaseId: release,
|
|
74485
74504
|
content: str7(flags.content),
|
|
74486
|
-
...
|
|
74505
|
+
...draftShot ? { homeShot: draftShot, sourceChangedAtMs } : {}
|
|
74487
74506
|
}) : null;
|
|
74488
74507
|
print({
|
|
74489
74508
|
ok: true,
|
|
@@ -74649,7 +74668,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74649
74668
|
return 2;
|
|
74650
74669
|
}
|
|
74651
74670
|
try {
|
|
74652
|
-
const res = writePack(
|
|
74671
|
+
const res = writePack(resolve51(releaseDir), only, resolve51(str7(flags.out) ?? process.cwd()));
|
|
74653
74672
|
print({
|
|
74654
74673
|
ok: true,
|
|
74655
74674
|
app: res.app,
|
|
@@ -74720,7 +74739,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74720
74739
|
return 1;
|
|
74721
74740
|
}
|
|
74722
74741
|
try {
|
|
74723
|
-
const res = writePack(built, app,
|
|
74742
|
+
const res = writePack(built, app, resolve51(str7(flags.out) ?? dir), sourceArchive);
|
|
74724
74743
|
print({
|
|
74725
74744
|
ok: true,
|
|
74726
74745
|
app: res.app,
|
|
@@ -74765,7 +74784,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74765
74784
|
const { HIMI_PACKAGE_SOURCE_PATH: HIMI_PACKAGE_SOURCE_PATH2, isSafeAppId: isSafeAppId2, packageContents: packageContents2 } = await Promise.resolve().then(() => (init_himi_package(), himi_package_exports));
|
|
74766
74785
|
let opened;
|
|
74767
74786
|
try {
|
|
74768
|
-
opened = openPackageFile2(
|
|
74787
|
+
opened = openPackageFile2(resolve51(file));
|
|
74769
74788
|
} catch (e) {
|
|
74770
74789
|
io.error(JSON.stringify({ error: e.message }));
|
|
74771
74790
|
return 1;
|
|
@@ -74778,7 +74797,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74778
74797
|
io.error(JSON.stringify({
|
|
74779
74798
|
ok: false,
|
|
74780
74799
|
error: "app_source_not_in_package",
|
|
74781
|
-
detail: `${
|
|
74800
|
+
detail: `${resolve51(file)} is a release package: it carries built output (screens, bundles, tokens) and no source`,
|
|
74782
74801
|
hint: "re-pack it from the content package with `himi pack --dev`, or restore from the serve plane with `himi pull <app>`"
|
|
74783
74802
|
}));
|
|
74784
74803
|
return 1;
|
|
@@ -74801,7 +74820,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74801
74820
|
return 1;
|
|
74802
74821
|
}
|
|
74803
74822
|
}
|
|
74804
|
-
const dest =
|
|
74823
|
+
const dest = resolve51(str7(flags.out) ?? process.cwd(), renamed ?? opened.header.app);
|
|
74805
74824
|
const issue2 = restoreDestinationIssue(dest, flags.force === true);
|
|
74806
74825
|
if (issue2) {
|
|
74807
74826
|
io.error(JSON.stringify(issue2));
|
|
@@ -74888,7 +74907,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74888
74907
|
}
|
|
74889
74908
|
try {
|
|
74890
74909
|
const { openPackageFile: openPackageFile2 } = await Promise.resolve().then(() => (init_pack(), pack_exports));
|
|
74891
|
-
const opened = openPackageFile2(
|
|
74910
|
+
const opened = openPackageFile2(resolve51(file));
|
|
74892
74911
|
if (!opened.validation.ok || !opened.header) {
|
|
74893
74912
|
io.error(JSON.stringify({ error: "refusing to share an invalid package", issues: opened.validation.errors }));
|
|
74894
74913
|
return 1;
|
|
@@ -74898,12 +74917,12 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
74898
74917
|
io.error(JSON.stringify({
|
|
74899
74918
|
ok: false,
|
|
74900
74919
|
error: "refusing to share a package that carries the app's source",
|
|
74901
|
-
detail: `${
|
|
74920
|
+
detail: `${resolve51(file)} was packed with --dev, and a share link is public and unauthenticated \u2014 anyone with the URL could \`himi import\` your codebase`,
|
|
74902
74921
|
hint: "share a release package instead (`himi pack` with no --dev), or hand the dev package over directly"
|
|
74903
74922
|
}));
|
|
74904
74923
|
return 1;
|
|
74905
74924
|
}
|
|
74906
|
-
const archive = readFileSync79(
|
|
74925
|
+
const archive = readFileSync79(resolve51(file));
|
|
74907
74926
|
const result = await client2().createPackageShare({
|
|
74908
74927
|
app: opened.header.app,
|
|
74909
74928
|
releaseId: opened.header.releaseId,
|
|
@@ -75025,9 +75044,9 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
|
|
|
75025
75044
|
});
|
|
75026
75045
|
await announce(run2);
|
|
75027
75046
|
print({ ok: true, app: run2.app, url: run2.url, port: run2.port, plane: "browser" });
|
|
75028
|
-
await new Promise((
|
|
75047
|
+
await new Promise((resolve52) => {
|
|
75029
75048
|
const stop = () => {
|
|
75030
|
-
void retract().catch((e) => io.error(JSON.stringify({ run: "stop_cleanup_failed", message: e.message }))).finally(() => run2.close().finally(() =>
|
|
75049
|
+
void retract().catch((e) => io.error(JSON.stringify({ run: "stop_cleanup_failed", message: e.message }))).finally(() => run2.close().finally(() => resolve52()));
|
|
75031
75050
|
};
|
|
75032
75051
|
process.once("SIGINT", stop);
|
|
75033
75052
|
process.once("SIGTERM", stop);
|