@wix/himalaya-cli 0.1049.0 → 0.1051.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +397 -308
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -2829,8 +2829,8 @@ function committedProvisioningPath(name) {
2829
2829
  function committedShellFor(path2) {
2830
2830
  const normalized = path2.replace(/\\/g, "/");
2831
2831
  return SHELL_NAMES2.find((name) => {
2832
- const relative11 = committedProvisioningPath(name);
2833
- return normalized === relative11 || normalized.endsWith(`/${relative11}`);
2832
+ const relative12 = committedProvisioningPath(name);
2833
+ return normalized === relative12 || normalized.endsWith(`/${relative12}`);
2834
2834
  });
2835
2835
  }
2836
2836
  function isBrandable(repoRoot2, name) {
@@ -3610,11 +3610,14 @@ async function buildBundleFromEntry(entry, outfile, opts = {}) {
3610
3610
  return outfile;
3611
3611
  }
3612
3612
  async function buildAppEntry(entry, outfile, opts = {}) {
3613
- const { umbrella = false, resolveTsExtensions = false, absWorkingDir = REPO_ROOT4, confineTo } = opts;
3613
+ const { umbrella = false, resolveTsExtensions = false, absWorkingDir = REPO_ROOT4, confineTo, inputs } = opts;
3614
3614
  const confine = confinementFor(confineTo, "buildAppEntry", entry);
3615
3615
  if (!existsSync8(entry)) throw new Error(`unknown app entry: ${entry}`);
3616
- await build({
3616
+ const result = await build({
3617
3617
  entryPoints: [entry],
3618
+ // `inputs` (a Set) receives every source file the bundle read, as absolute paths — the
3619
+ // dev-server watches that import closure so an edit to shared screen code reloads (#3307).
3620
+ metafile: !!inputs,
3618
3621
  outfile,
3619
3622
  bundle: true,
3620
3623
  format: "esm",
@@ -3644,6 +3647,11 @@ async function buildAppEntry(entry, outfile, opts = {}) {
3644
3647
  ...umbrella && !process.env.HIMI_CLI_RUNTIME_DIR ? [umbrellaRewritePlugin({ external: true })] : []
3645
3648
  ]
3646
3649
  });
3650
+ if (inputs && result.metafile) {
3651
+ for (const rel of Object.keys(result.metafile.inputs)) {
3652
+ if (!rel.includes(":")) inputs.add(resolve8(absWorkingDir, rel));
3653
+ }
3654
+ }
3647
3655
  return outfile;
3648
3656
  }
3649
3657
  async function buildContainedAppConfig(entry, opts = {}) {
@@ -33667,7 +33675,7 @@ var init_config2 = __esm({
33667
33675
  import { createServer as createServer2 } from "node:http";
33668
33676
  import { readFile, stat } from "node:fs/promises";
33669
33677
  import { readFileSync as readFileSync41, existsSync as existsSync38, watch, mkdirSync as mkdirSync18, rmSync as rmSync7 } from "node:fs";
33670
- import { extname as extname2, resolve as resolve31, normalize as normalize3, sep as sep8 } from "node:path";
33678
+ import { basename as basename9, dirname as dirname22, extname as extname2, join as join36, relative as relative6, resolve as resolve31, normalize as normalize3, sep as sep8 } from "node:path";
33671
33679
  import { createHash as createHash16, randomUUID as randomUUID2 } from "node:crypto";
33672
33680
  import { fileURLToPath as fileURLToPath18, pathToFileURL as pathToFileURL6 } from "node:url";
33673
33681
  function deepMerge3(base, patch) {
@@ -34563,7 +34571,8 @@ async function reloadAppModuleNow(state, opts) {
34563
34571
  const outfile = resolve31(HMR_TMP_DIR, `${current.name}-${++appReloadSeq}.mjs`);
34564
34572
  try {
34565
34573
  const lib = await import(pathToFileURL6(resolve31(TIER5_SRC_ROOT, "build-lib.mjs")).href);
34566
- await lib.buildAppEntry(entry, outfile, { confineTo: current.dir });
34574
+ const inputs = /* @__PURE__ */ new Set();
34575
+ await lib.buildAppEntry(entry, outfile, { confineTo: current.dir, inputs });
34567
34576
  const mod = await import(pathToFileURL6(outfile).href);
34568
34577
  const next = mod.default;
34569
34578
  if (!next || !next.config || typeof next.homeScreenId !== "string" || !next.screens || typeof next.screens.exact !== "object" || Object.keys(next.screens.exact).length === 0 || !Array.isArray(next.actions) || !next.seed) {
@@ -34601,6 +34610,7 @@ async function reloadAppModuleNow(state, opts) {
34601
34610
  state.announcedTokensHash = tokensHash;
34602
34611
  publishSSE(state, "tokens.changed", { reason: opts.reason, at: Date.now() });
34603
34612
  }
34613
+ if (state.hotReloadEnabled) syncAppDependencyWatchers(state, inputs);
34604
34614
  console.log(`[himalaya-dev] reloaded app module in-process: ${current.name} (${opts.reason})`);
34605
34615
  return { ok: true };
34606
34616
  } catch (err) {
@@ -34625,6 +34635,77 @@ function servedTokensHash(app) {
34625
34635
  return "";
34626
34636
  }
34627
34637
  }
34638
+ function appDependencyFiles(inputs, appDir2) {
34639
+ const inside = (root, p) => p === root || p.startsWith(root + sep8);
34640
+ const out = /* @__PURE__ */ new Set();
34641
+ for (const raw of inputs) {
34642
+ const p = resolve31(raw);
34643
+ if (!inside(ROOT6, p) || inside(resolve31(appDir2), p) || inside(HMR_TMP_DIR, p)) continue;
34644
+ if (p.split(sep8).includes("node_modules")) continue;
34645
+ out.add(p);
34646
+ }
34647
+ return [...out].sort();
34648
+ }
34649
+ function syncAppDependencyWatchers(state, inputs) {
34650
+ if (!state.app || state.closed) return;
34651
+ for (const w of state.appDepWatchers ?? []) {
34652
+ try {
34653
+ w.close();
34654
+ } catch {
34655
+ }
34656
+ }
34657
+ const byDir = /* @__PURE__ */ new Map();
34658
+ for (const file of appDependencyFiles(inputs, state.app.dir)) {
34659
+ const dir = dirname22(file);
34660
+ if (!byDir.has(dir)) byDir.set(dir, /* @__PURE__ */ new Set());
34661
+ byDir.get(dir).add(basename9(file));
34662
+ }
34663
+ let timer;
34664
+ const changed = /* @__PURE__ */ new Set();
34665
+ const watchers = [];
34666
+ for (const [dir, names] of byDir) {
34667
+ try {
34668
+ const w = watch(dir, { persistent: false }, (_event, filename) => {
34669
+ if (!filename || !names.has(String(filename))) return;
34670
+ changed.add(join36(dir, String(filename)));
34671
+ if (timer) clearTimeout(timer);
34672
+ timer = setTimeout(() => {
34673
+ timer = void 0;
34674
+ const files = [...changed].map((f) => relative6(ROOT6, f));
34675
+ changed.clear();
34676
+ console.log(`[himalaya-dev] app dependency changed: ${files.join(", ")}`);
34677
+ void reloadAppModule(state, { reason: "dependency_changed" });
34678
+ }, 200);
34679
+ });
34680
+ w.on("error", () => {
34681
+ });
34682
+ watchers.push(w);
34683
+ } catch {
34684
+ }
34685
+ }
34686
+ state.appDepWatchers = watchers;
34687
+ }
34688
+ async function primeAppDependencyWatchers(state) {
34689
+ const current = state.app;
34690
+ if (!current) return;
34691
+ const entry = resolve31(current.dir, "dev/index.ts");
34692
+ if (!existsSync38(entry)) return;
34693
+ mkdirSync18(HMR_TMP_DIR, { recursive: true });
34694
+ const outfile = resolve31(HMR_TMP_DIR, `${current.name}-deps-${++appReloadSeq}.mjs`);
34695
+ try {
34696
+ const lib = await import(pathToFileURL6(resolve31(TIER5_SRC_ROOT, "build-lib.mjs")).href);
34697
+ const inputs = /* @__PURE__ */ new Set();
34698
+ await lib.buildAppEntry(entry, outfile, { confineTo: current.dir, inputs });
34699
+ if (state.app === current && !state.appDepWatchers) syncAppDependencyWatchers(state, inputs);
34700
+ } catch (err) {
34701
+ console.warn(`[himalaya-dev] app dependency watch unavailable: ${err.message}`);
34702
+ } finally {
34703
+ try {
34704
+ rmSync7(outfile, { force: true });
34705
+ } catch {
34706
+ }
34707
+ }
34708
+ }
34628
34709
  function classifyAppPath(rel) {
34629
34710
  if (!rel || rel.startsWith("..")) return null;
34630
34711
  if (rel === "tokens.json") return "tokens";
@@ -35882,8 +35963,8 @@ async function handleActionHandlerBundleGet(res, app) {
35882
35963
  }
35883
35964
  async function serveStatic(req, res, root, prefix) {
35884
35965
  const requested = decodeURIComponent((req.url ?? "").split("?")[0]);
35885
- const relative11 = requested.replace(prefix, "").replace(/^\//, "");
35886
- const safe = normalize3(relative11).replace(/^(\.\.[\/\\])+/, "");
35966
+ const relative12 = requested.replace(prefix, "").replace(/^\//, "");
35967
+ const safe = normalize3(relative12).replace(/^(\.\.[\/\\])+/, "");
35887
35968
  const fullPath = resolve31(root, safe);
35888
35969
  if (!fullPath.startsWith(root)) {
35889
35970
  return send(res, 403, "forbidden");
@@ -36114,6 +36195,7 @@ function createDevServer(opts = {}) {
36114
36195
  state.bundleSourceWatcher = startBundleSourceWatcher(state);
36115
36196
  if (state.app) state.announcedTokensHash = servedTokensHash(state.app);
36116
36197
  state.appWatcher = startAppSourceWatcher(state);
36198
+ void primeAppDependencyWatchers(state);
36117
36199
  }
36118
36200
  const handleRequest = (req, res) => {
36119
36201
  logRequest(req, res, Date.now());
@@ -36504,12 +36586,20 @@ ${err.message}`);
36504
36586
  }
36505
36587
  });
36506
36588
  httpServer.on("close", () => {
36589
+ state.closed = true;
36507
36590
  state.bundleWatcher?.close();
36508
36591
  state.bundleWatcher = void 0;
36509
36592
  state.bundleSourceWatcher?.close();
36510
36593
  state.bundleSourceWatcher = void 0;
36511
36594
  state.appWatcher?.close();
36512
36595
  state.appWatcher = void 0;
36596
+ for (const w of state.appDepWatchers ?? []) {
36597
+ try {
36598
+ w.close();
36599
+ } catch {
36600
+ }
36601
+ }
36602
+ state.appDepWatchers = void 0;
36513
36603
  for (const client2 of [...state.sseClients, ...state.adminClients]) {
36514
36604
  try {
36515
36605
  client2.end();
@@ -39519,7 +39609,7 @@ __export(build_exports2, {
39519
39609
  });
39520
39610
  import { createHash as createHash19 } from "node:crypto";
39521
39611
  import { readFileSync as readFileSync42, readdirSync as readdirSync21, existsSync as existsSync39 } from "node:fs";
39522
- import { dirname as dirname22, join as join36, resolve as resolve32 } from "node:path";
39612
+ import { dirname as dirname23, join as join37, resolve as resolve32 } from "node:path";
39523
39613
  import { fileURLToPath as fileURLToPath19 } from "node:url";
39524
39614
  import { createRequire as createRequire2 } from "node:module";
39525
39615
  import { execFileSync as execFileSync4 } from "node:child_process";
@@ -39557,7 +39647,7 @@ function l10nLintOptions(locale, appDir2) {
39557
39647
  const tags = (locale.translations ?? []).filter((t) => t !== locale.default);
39558
39648
  const catalog = /* @__PURE__ */ new Set();
39559
39649
  for (const tag of tags) {
39560
- const path2 = join36(appDir2, "l10n", `${tag}.json`);
39650
+ const path2 = join37(appDir2, "l10n", `${tag}.json`);
39561
39651
  if (!existsSync39(path2)) continue;
39562
39652
  try {
39563
39653
  const parsed = JSON.parse(readFileSync42(path2, "utf8"));
@@ -39708,8 +39798,7 @@ function hydrationServices(tier5Dir, bundleName, input = {}) {
39708
39798
  return js ? servicesFromBundleJs(js, input) : null;
39709
39799
  }
39710
39800
  function releaseIdFor(sha, content) {
39711
- if (sha === "dev") return contentReleaseId(content);
39712
- return `${sha}-${contentReleaseId(content).slice(0, 12)}`;
39801
+ return sha !== "dev" ? sha : contentReleaseId(content);
39713
39802
  }
39714
39803
  function shellSha(root = REPO_ROOT7) {
39715
39804
  if (!isMonorepoCheckout(root)) return "";
@@ -39726,7 +39815,7 @@ function shellSha(root = REPO_ROOT7) {
39726
39815
  function isMonorepoCheckout(dir) {
39727
39816
  try {
39728
39817
  const top = execFileSync4("git", ["rev-parse", "--show-toplevel"], { cwd: dir, stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
39729
- return top.length > 0 && existsSync39(join36(top, "core", "schema", "core.proto"));
39818
+ return top.length > 0 && existsSync39(join37(top, "core", "schema", "core.proto"));
39730
39819
  } catch {
39731
39820
  return false;
39732
39821
  }
@@ -40014,7 +40103,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40014
40103
  if (addrCache.has(name)) return addrCache.get(name);
40015
40104
  let bytes2;
40016
40105
  try {
40017
- bytes2 = readFileSync42(join36(tier5Dir, `${name}.bundle.js`));
40106
+ bytes2 = readFileSync42(join37(tier5Dir, `${name}.bundle.js`));
40018
40107
  } catch {
40019
40108
  return null;
40020
40109
  }
@@ -40035,7 +40124,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40035
40124
  const MAX_AUTHORING_DOC_BYTES = 128 * 1024;
40036
40125
  if (store.putDoc) {
40037
40126
  for (const [name, file] of [["spec", "SPEC.md"], ["mobile-ux", "MOBILE-UX.md"]]) {
40038
- const path2 = join36(preloaded.dir, file);
40127
+ const path2 = join37(preloaded.dir, file);
40039
40128
  if (!existsSync39(path2)) continue;
40040
40129
  const bytes2 = readFileSync42(path2);
40041
40130
  if (bytes2.length === 0 || bytes2.length > MAX_AUTHORING_DOC_BYTES) {
@@ -40096,7 +40185,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40096
40185
  const fontWarnings = [];
40097
40186
  try {
40098
40187
  const appTokens = readTokensForLint(preloaded) ?? {};
40099
- const policy = existsSync39(join36(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync42(join36(preloaded.dir, "fonts.json"), "utf8")) : {};
40188
+ const policy = existsSync39(join37(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync42(join37(preloaded.dir, "fonts.json"), "utf8")) : {};
40100
40189
  fontPlan = planFonts(appTokens, policy);
40101
40190
  } catch (err) {
40102
40191
  throw new Error(
@@ -40599,7 +40688,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
40599
40688
  await store.reset(app);
40600
40689
  const sources = {};
40601
40690
  for (const definition of config.functions.functions) {
40602
- const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join36(preloaded.dir, "functions", `${definition.name}${extension}`));
40691
+ const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join37(preloaded.dir, "functions", `${definition.name}${extension}`));
40603
40692
  const source = candidates.find((candidate) => existsSync39(candidate));
40604
40693
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
40605
40694
  sources[definition.name] = readFileSync42(source, "utf8");
@@ -40630,7 +40719,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
40630
40719
  return { manifest, failedToBuild: [], missingBundles: [], auth: {} };
40631
40720
  }
40632
40721
  function listBuildableApps() {
40633
- const appsDir = join36(REPO_ROOT7, "apps");
40722
+ const appsDir = join37(REPO_ROOT7, "apps");
40634
40723
  return readdirSync21(appsDir, { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith("_")).map((d) => d.name);
40635
40724
  }
40636
40725
  var BAKE_OFFLINE_BASE, KNOWN_ICON_NAMES, KNOWN_ICONS, REPO_ROOT7, TIER5_DIR, requireFromHere, SOURCEMAP_ON_DEMAND_PATH, BAKED_SERVER_BASE_URL;
@@ -40664,10 +40753,10 @@ var init_build3 = __esm({
40664
40753
  BAKE_OFFLINE_BASE = "http://himalaya-bake.invalid";
40665
40754
  KNOWN_ICON_NAMES = [...ICON_NAMES].sort();
40666
40755
  KNOWN_ICONS = new Set(KNOWN_ICON_NAMES);
40667
- REPO_ROOT7 = resolve32(dirname22(fileURLToPath19(import.meta.url)), "../..");
40668
- TIER5_DIR = join36(REPO_ROOT7, "core/dev-server/tier5-bundles");
40756
+ REPO_ROOT7 = resolve32(dirname23(fileURLToPath19(import.meta.url)), "../..");
40757
+ TIER5_DIR = join37(REPO_ROOT7, "core/dev-server/tier5-bundles");
40669
40758
  requireFromHere = createRequire2(import.meta.url);
40670
- SOURCEMAP_ON_DEMAND_PATH = join36(REPO_ROOT7, "core/dev-server/tier5-bundles-src/sourcemap-on-demand.mjs");
40759
+ SOURCEMAP_ON_DEMAND_PATH = join37(REPO_ROOT7, "core/dev-server/tier5-bundles-src/sourcemap-on-demand.mjs");
40671
40760
  BAKED_SERVER_BASE_URL = "http://baked.himalaya.invalid";
40672
40761
  }
40673
40762
  });
@@ -41136,7 +41225,7 @@ var init_studio_page = __esm({
41136
41225
 
41137
41226
  // src/studio-timeline.ts
41138
41227
  import { existsSync as existsSync40, readFileSync as readFileSync43 } from "node:fs";
41139
- import { join as join37 } from "node:path";
41228
+ import { join as join38 } from "node:path";
41140
41229
  function stateOf(view) {
41141
41230
  const j = view.journal[0];
41142
41231
  const h = view.health;
@@ -41203,7 +41292,7 @@ function validFrame(f) {
41203
41292
  return true;
41204
41293
  }
41205
41294
  function readTimeline(dir) {
41206
- const file = join37(dir, TIMELINE_FILE);
41295
+ const file = join38(dir, TIMELINE_FILE);
41207
41296
  if (!existsSync40(file)) return [];
41208
41297
  const out = [];
41209
41298
  for (const line of readFileSync43(file, "utf8").split("\n")) {
@@ -41223,14 +41312,14 @@ function trim(frames) {
41223
41312
  return frames.slice(-MAX_FRAMES);
41224
41313
  }
41225
41314
  function writeTimelineJs(dir, frames) {
41226
- writeFileAtomic(join37(dir, TIMELINE_JS), `window.__himiTimeline && window.__himiTimeline(${scriptJson(frames)});
41315
+ writeFileAtomic(join38(dir, TIMELINE_JS), `window.__himiTimeline && window.__himiTimeline(${scriptJson(frames)});
41227
41316
  `);
41228
41317
  }
41229
41318
  function appendFrame(dir, view, reveal = null) {
41230
41319
  const frames = readTimeline(dir);
41231
41320
  const last = frames[frames.length - 1];
41232
41321
  if (last && last.v === view.v && !reveal) {
41233
- if (!existsSync40(join37(dir, TIMELINE_JS))) writeTimelineJs(dir, frames);
41322
+ if (!existsSync40(join38(dir, TIMELINE_JS))) writeTimelineJs(dir, frames);
41234
41323
  return frames.length;
41235
41324
  }
41236
41325
  let prev = null;
@@ -41238,7 +41327,7 @@ function appendFrame(dir, view, reveal = null) {
41238
41327
  const frame = frameFor(stateOf(view), prev, view.generatedAt, view.v, frames.length % KEYFRAME_EVERY === 0);
41239
41328
  if (reveal) frame.reveal = reveal;
41240
41329
  const kept = trim([...frames, frame]);
41241
- writeFileAtomic(join37(dir, TIMELINE_FILE), kept.map((f) => JSON.stringify(f)).join("\n") + "\n");
41330
+ writeFileAtomic(join38(dir, TIMELINE_FILE), kept.map((f) => JSON.stringify(f)).join("\n") + "\n");
41242
41331
  writeTimelineJs(dir, kept);
41243
41332
  return kept.length;
41244
41333
  }
@@ -41260,8 +41349,8 @@ var init_studio_timeline = __esm({
41260
41349
  "src/studio-timeline.ts"() {
41261
41350
  init_progress();
41262
41351
  init_studio_page();
41263
- TIMELINE_FILE = join37(".himi", "studio", "timeline.jsonl");
41264
- TIMELINE_JS = join37(".himi", "studio", "timeline.js");
41352
+ TIMELINE_FILE = join38(".himi", "studio", "timeline.jsonl");
41353
+ TIMELINE_JS = join38(".himi", "studio", "timeline.js");
41265
41354
  MAX_FRAMES = 2e3;
41266
41355
  KEYFRAME_EVERY = 50;
41267
41356
  same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
@@ -41299,7 +41388,7 @@ __export(studio_exports, {
41299
41388
  });
41300
41389
  import { createHash as createHash20 } from "node:crypto";
41301
41390
  import { existsSync as existsSync41, readdirSync as readdirSync22, readFileSync as readFileSync44, realpathSync as realpathSync5, statSync as statSync8 } from "node:fs";
41302
- import { basename as basename9, extname as extname3, join as join38, relative as relative6, resolve as resolve33, sep as sep9 } from "node:path";
41391
+ import { basename as basename10, extname as extname3, join as join39, relative as relative7, resolve as resolve33, sep as sep9 } from "node:path";
41303
41392
  import { pathToFileURL as pathToFileURL7 } from "node:url";
41304
41393
  function realInside(dir, abs) {
41305
41394
  try {
@@ -41322,9 +41411,9 @@ function archiveFile(dir, memory, abs) {
41322
41411
  return null;
41323
41412
  }
41324
41413
  if (size === 0) return null;
41325
- const key2 = relative6(dir, abs);
41414
+ const key2 = relative7(dir, abs);
41326
41415
  const hit = memory.files?.[key2];
41327
- if (hit && hit.size === size && hit.mtimeMs === mtimeMs && hit.ino === ino && existsSync41(join38(dir, HISTORY_DIR, `${hit.sha}.${hit.ext}`))) {
41416
+ if (hit && hit.size === size && hit.mtimeMs === mtimeMs && hit.ino === ino && existsSync41(join39(dir, HISTORY_DIR, `${hit.sha}.${hit.ext}`))) {
41328
41417
  return { sha: hit.sha, ext: hit.ext, file: `${hit.sha}.${hit.ext}` };
41329
41418
  }
41330
41419
  let archived;
@@ -41338,17 +41427,17 @@ function archiveFile(dir, memory, abs) {
41338
41427
  return { sha: archived.sha256, ext: archived.ext, file: `${archived.sha256}.${archived.ext}` };
41339
41428
  }
41340
41429
  function loadMemory(dir, now) {
41341
- const raw = obj(readJson2(join38(dir, MEMORY_FILE)));
41430
+ const raw = obj(readJson2(join39(dir, MEMORY_FILE)));
41342
41431
  if (raw && raw.version === 1 && obj(raw.shots) && Array.isArray(raw.timeline)) return raw;
41343
41432
  return { version: 1, createdAt: now, shots: {}, timeline: [] };
41344
41433
  }
41345
41434
  function observeShots(dir, memory, now) {
41346
- const shotsDir = join38(dir, ".himi", "shots");
41435
+ const shotsDir = join39(dir, ".himi", "shots");
41347
41436
  const seen = /* @__PURE__ */ new Set();
41348
41437
  const files = existsSync41(shotsDir) ? readdirSync22(shotsDir).filter((f) => /\.(png|jpe?g)$/i.test(f)).sort() : [];
41349
41438
  for (const f of files) {
41350
- const id = basename9(f, extname3(f));
41351
- const archived = archiveFile(dir, memory, join38(shotsDir, f));
41439
+ const id = basename10(f, extname3(f));
41440
+ const archived = archiveFile(dir, memory, join39(shotsDir, f));
41352
41441
  if (!archived) continue;
41353
41442
  seen.add(id);
41354
41443
  const { sha, ext } = archived;
@@ -41370,7 +41459,7 @@ function observeShots(dir, memory, now) {
41370
41459
  return memory;
41371
41460
  }
41372
41461
  function palette(dir) {
41373
- const colors = obj(obj(readJson2(join38(dir, "tokens.json")))?.colors);
41462
+ const colors = obj(obj(readJson2(join39(dir, "tokens.json")))?.colors);
41374
41463
  if (!colors) return [];
41375
41464
  const pick2 = (key2) => {
41376
41465
  const v = colors[key2];
@@ -41380,20 +41469,20 @@ function palette(dir) {
41380
41469
  return ["accentPrimary", "accentSecondary", "accentSurface", "surfacePrimary", "textPrimary"].map(pick2).filter((x) => !!x);
41381
41470
  }
41382
41471
  function appIdentity(dir) {
41383
- const manifest = obj(readJson2(join38(dir, "himalaya.content.json")));
41384
- const name = text(manifest?.name) ?? basename9(resolve33(dir));
41472
+ const manifest = obj(readJson2(join39(dir, "himalaya.content.json")));
41473
+ const name = text(manifest?.name) ?? basename10(resolve33(dir));
41385
41474
  const icon = text(manifest?.icon)?.trim();
41386
41475
  const iconPath = icon ? resolve33(dir, icon) : null;
41387
41476
  const real = iconPath ? realInside(dir, iconPath) : null;
41388
41477
  return { name, iconFile: real && statSync8(real).isFile() ? iconPath : null };
41389
41478
  }
41390
41479
  function testRuns(dir) {
41391
- const att = join38(dir, ".himi", "attestations");
41480
+ const att = join39(dir, ".himi", "attestations");
41392
41481
  if (!existsSync41(att)) return [];
41393
41482
  const runs = [];
41394
41483
  for (const f of readdirSync22(att)) {
41395
41484
  if (!f.endsWith(".json") || f === "latest.json") continue;
41396
- const r = obj(readJson2(join38(att, f)));
41485
+ const r = obj(readJson2(join39(att, f)));
41397
41486
  if (!r || r.tool !== "himi-test" || typeof r.runId !== "string") continue;
41398
41487
  const report2 = obj(r.report);
41399
41488
  const coverage = obj(r.coverage);
@@ -41409,20 +41498,20 @@ function testRuns(dir) {
41409
41498
  return runs.sort((a, b) => a.runId.localeCompare(b.runId));
41410
41499
  }
41411
41500
  function siteHome(dir) {
41412
- for (const pages of [join38(dir, ".himi", "business-book", "evidence", "pages"), join38(dir, "evidence", "pages")]) {
41501
+ for (const pages of [join39(dir, ".himi", "business-book", "evidence", "pages"), join39(dir, "evidence", "pages")]) {
41413
41502
  if (!existsSync41(pages)) continue;
41414
41503
  const home = readdirSync22(pages).filter((f) => /^home.*\.(png|jpe?g)$/i.test(f)).sort()[0];
41415
- if (home) return join38(pages, home);
41504
+ if (home) return join39(pages, home);
41416
41505
  }
41417
41506
  return null;
41418
41507
  }
41419
41508
  function uxStatuses(dir) {
41420
- const platforms = obj(obj(readJson2(join38(dir, ".himi", "ux-audit.json")))?.platforms);
41509
+ const platforms = obj(obj(readJson2(join39(dir, ".himi", "ux-audit.json")))?.platforms);
41421
41510
  if (!platforms) return [];
41422
41511
  return Object.entries(platforms).map(([platform, rec]) => ({ platform, status: text(obj(rec)?.status) ?? "" })).filter((p) => p.status);
41423
41512
  }
41424
41513
  function liveRun(dir) {
41425
- const rec = obj(readJson2(join38(dir, RUN_RECORD)));
41514
+ const rec = obj(readJson2(join39(dir, RUN_RECORD)));
41426
41515
  const url = text(rec?.url);
41427
41516
  const pid = rec?.pid;
41428
41517
  if (!url || !/^https?:\/\//i.test(url) || typeof pid !== "number") return null;
@@ -41472,9 +41561,9 @@ function buildView(dir, memory, now) {
41472
41561
  const runs = testRuns(dir);
41473
41562
  const last = runs[runs.length - 1];
41474
41563
  const prev = runs[runs.length - 2];
41475
- const validate3 = obj(readJson2(join38(dir, VALIDATE_RECORD)));
41476
- const push = obj(readJson2(join38(dir, PUSH_RECORD)));
41477
- const edges = readJson2(join38(dir, EDGES_RECORD));
41564
+ const validate3 = obj(readJson2(join39(dir, VALIDATE_RECORD)));
41565
+ const push = obj(readJson2(join39(dir, PUSH_RECORD)));
41566
+ const edges = readJson2(join39(dir, EDGES_RECORD));
41478
41567
  const nav = [];
41479
41568
  if (Array.isArray(edges)) {
41480
41569
  const seen = /* @__PURE__ */ new Set();
@@ -41500,7 +41589,7 @@ function buildView(dir, memory, now) {
41500
41589
  message: e.message,
41501
41590
  step: e.step ?? null,
41502
41591
  stepNumber: e.stepNumber ?? null,
41503
- images: (e.images ?? []).map((i) => historyUrl(basename9(i.file)))
41592
+ images: (e.images ?? []).map((i) => historyUrl(basename10(i.file)))
41504
41593
  })),
41505
41594
  screens,
41506
41595
  focus,
@@ -41545,15 +41634,15 @@ function writeBoard(dir, now) {
41545
41634
  } catch {
41546
41635
  view.timelineFrames = 0;
41547
41636
  }
41548
- writeAtomic(join38(dir, MEMORY_FILE), JSON.stringify(memory));
41549
- writeAtomic(join38(dir, STATE_FILE), `window.__himiStudio && window.__himiStudio(${scriptJson(view)});
41637
+ writeAtomic(join39(dir, MEMORY_FILE), JSON.stringify(memory));
41638
+ writeAtomic(join39(dir, STATE_FILE), `window.__himiStudio && window.__himiStudio(${scriptJson(view)});
41550
41639
  `);
41551
- writeAtomic(join38(dir, STUDIO_PAGE), renderStudioHtml(view));
41640
+ writeAtomic(join39(dir, STUDIO_PAGE), renderStudioHtml(view));
41552
41641
  return view;
41553
41642
  }
41554
41643
  function refreshStudio(dir, now = /* @__PURE__ */ new Date()) {
41555
41644
  try {
41556
- if (!existsSync41(join38(dir, STUDIO_PAGE))) return { refreshed: false };
41645
+ if (!existsSync41(join39(dir, STUDIO_PAGE))) return { refreshed: false };
41557
41646
  return { refreshed: true, view: writeBoard(dir, now.toISOString()) };
41558
41647
  } catch {
41559
41648
  return { refreshed: false };
@@ -41561,13 +41650,13 @@ function refreshStudio(dir, now = /* @__PURE__ */ new Date()) {
41561
41650
  }
41562
41651
  function openStudio(dir, now = /* @__PURE__ */ new Date()) {
41563
41652
  const view = writeBoard(dir, now.toISOString());
41564
- const page = join38(dir, STUDIO_PAGE);
41653
+ const page = join39(dir, STUDIO_PAGE);
41565
41654
  return { page, url: pathToFileURL7(page).href, view };
41566
41655
  }
41567
41656
  function writeStudioRecord(dir, record2, value) {
41568
41657
  try {
41569
41658
  if (!realDirIn(dir, ".himi")) return;
41570
- writeAtomic(join38(dir, record2), `${JSON.stringify(value, null, 2)}
41659
+ writeAtomic(join39(dir, record2), `${JSON.stringify(value, null, 2)}
41571
41660
  `);
41572
41661
  } catch {
41573
41662
  }
@@ -41579,14 +41668,14 @@ var init_studio = __esm({
41579
41668
  init_studio_timeline();
41580
41669
  init_progress();
41581
41670
  init_studio_page();
41582
- STUDIO_DIR = join38(".himi", "studio");
41583
- STUDIO_PAGE = join38(STUDIO_DIR, "index.html");
41584
- STATE_FILE = join38(STUDIO_DIR, "state.js");
41585
- MEMORY_FILE = join38(STUDIO_DIR, "memory.json");
41586
- VALIDATE_RECORD = join38(".himi", "validate.json");
41587
- PUSH_RECORD = join38(".himi", "last-push.json");
41588
- EDGES_RECORD = join38(".himi", "test-edges.json");
41589
- RUN_RECORD = join38(".himi", "run.json");
41671
+ STUDIO_DIR = join39(".himi", "studio");
41672
+ STUDIO_PAGE = join39(STUDIO_DIR, "index.html");
41673
+ STATE_FILE = join39(STUDIO_DIR, "state.js");
41674
+ MEMORY_FILE = join39(STUDIO_DIR, "memory.json");
41675
+ VALIDATE_RECORD = join39(".himi", "validate.json");
41676
+ PUSH_RECORD = join39(".himi", "last-push.json");
41677
+ EDGES_RECORD = join39(".himi", "test-edges.json");
41678
+ RUN_RECORD = join39(".himi", "run.json");
41590
41679
  MAX_TIMELINE = 500;
41591
41680
  MAX_JOURNAL = 80;
41592
41681
  MAX_NAV_EDGES = 40;
@@ -42229,7 +42318,7 @@ var init_push_setup_apple_credentials = __esm({
42229
42318
 
42230
42319
  // src/push-onboarding.ts
42231
42320
  import { existsSync as existsSync42, mkdirSync as mkdirSync19, readFileSync as readFileSync46, statSync as statSync9, writeFileSync as writeFileSync15, chmodSync as chmodSync2 } from "node:fs";
42232
- import { basename as basename10, dirname as dirname23, join as join39, resolve as resolve35 } from "node:path";
42321
+ import { basename as basename11, dirname as dirname24, join as join40, resolve as resolve35 } from "node:path";
42233
42322
  function readJson3(path2) {
42234
42323
  try {
42235
42324
  const parsed = JSON.parse(readFileSync46(path2, "utf8"));
@@ -42240,9 +42329,9 @@ function readJson3(path2) {
42240
42329
  }
42241
42330
  function pushInputsFromContent(dir) {
42242
42331
  const root = resolve35(dir);
42243
- if (!existsSync42(join39(root, "himalaya.content.json"))) return { initialized: false };
42244
- const content = readJson3(join39(root, "himalaya.content.json"));
42245
- const provisioning = readJson3(join39(root, "provisioning.json"));
42332
+ if (!existsSync42(join40(root, "himalaya.content.json"))) return { initialized: false };
42333
+ const content = readJson3(join40(root, "himalaya.content.json"));
42334
+ const provisioning = readJson3(join40(root, "provisioning.json"));
42246
42335
  const native = provisioning.native ?? {};
42247
42336
  return {
42248
42337
  initialized: true,
@@ -42250,7 +42339,7 @@ function pushInputsFromContent(dir) {
42250
42339
  // autoClaimSlug's docblock describes as the project-declared slug. Without the fallback a
42251
42340
  // package with no `name` sent a body missing `app` and earned `400 invalid_app_id` with both
42252
42341
  // private keys already on the wire.
42253
- app: text3(content.name) ?? basename10(root),
42342
+ app: text3(content.name) ?? basename11(root),
42254
42343
  ...text3(provisioning.siteId) ? { site: text3(provisioning.siteId) } : {},
42255
42344
  ...text3(native.iosBundleId) ? { bundleId: text3(native.iosBundleId) } : {},
42256
42345
  ...text3(native.androidApplicationId) ? { androidApplicationId: text3(native.androidApplicationId) } : {}
@@ -42371,14 +42460,14 @@ function buildPushSetupBody(i, keys) {
42371
42460
  };
42372
42461
  }
42373
42462
  function readPushOnboarding(dir) {
42374
- const path2 = join39(resolve35(dir), PUSH_ONBOARDING_PATH);
42463
+ const path2 = join40(resolve35(dir), PUSH_ONBOARDING_PATH);
42375
42464
  if (!existsSync42(path2)) return { version: 1 };
42376
42465
  const parsed = readJson3(path2);
42377
42466
  return { version: 1, ...parsed };
42378
42467
  }
42379
42468
  function writeFile(dir, file) {
42380
- const path2 = join39(resolve35(dir), PUSH_ONBOARDING_PATH);
42381
- mkdirSync19(dirname23(path2), { recursive: true, mode: 448 });
42469
+ const path2 = join40(resolve35(dir), PUSH_ONBOARDING_PATH);
42470
+ mkdirSync19(dirname24(path2), { recursive: true, mode: 448 });
42382
42471
  writeFileSync15(path2, JSON.stringify(file, null, 2) + "\n", { mode: 384 });
42383
42472
  try {
42384
42473
  chmodSync2(path2, 384);
@@ -42406,7 +42495,7 @@ function recordPushDeferral(dir, d) {
42406
42495
  return push;
42407
42496
  }
42408
42497
  function clearPushDeferral(dir) {
42409
- const path2 = join39(resolve35(dir), PUSH_ONBOARDING_PATH);
42498
+ const path2 = join40(resolve35(dir), PUSH_ONBOARDING_PATH);
42410
42499
  if (!existsSync42(path2)) return;
42411
42500
  const { push: _dropped, ...rest } = readPushOnboarding(dir);
42412
42501
  writeFile(dir, { ...rest, version: 1 });
@@ -43179,7 +43268,7 @@ __export(template_trim_exports, {
43179
43268
  runTemplateTrim: () => runTemplateTrim
43180
43269
  });
43181
43270
  import { cpSync, existsSync as existsSync43, mkdirSync as mkdirSync20, readdirSync as readdirSync23, readFileSync as readFileSync47, renameSync as renameSync5, rmSync as rmSync8, statSync as statSync10, writeFileSync as writeFileSync16 } from "node:fs";
43182
- import { dirname as dirname24, join as join40 } from "node:path";
43271
+ import { dirname as dirname25, join as join41 } from "node:path";
43183
43272
  function routeMatcher(pattern) {
43184
43273
  const detail = /^\^([A-Za-z0-9_]+)\(\?:\[_\/\]\(\.\+\)\)\?\$$/.exec(pattern);
43185
43274
  if (detail) {
@@ -43873,20 +43962,20 @@ function homeModulesPass(app, kept, edited) {
43873
43962
  return { text: patched.src, dropped: patched.droppedModules };
43874
43963
  }
43875
43964
  function listWorkers(dir) {
43876
- const root = join40(dir, "tier5-src");
43965
+ const root = join41(dir, "tier5-src");
43877
43966
  if (!existsSync43(root)) return { dirs: [], files: {} };
43878
- const dirs = readdirSync23(root).filter((n) => statSync10(join40(root, n)).isDirectory()).sort();
43967
+ const dirs = readdirSync23(root).filter((n) => statSync10(join41(root, n)).isDirectory()).sort();
43879
43968
  const files = {};
43880
43969
  const walk2 = (abs, rel) => {
43881
43970
  for (const name of readdirSync23(abs)) {
43882
43971
  if (name === "node_modules") continue;
43883
- const p = join40(abs, name);
43972
+ const p = join41(abs, name);
43884
43973
  const r = `${rel}/${name}`;
43885
43974
  if (statSync10(p).isDirectory()) walk2(p, r);
43886
43975
  else if (/\.(?:[cm]?[jt]sx?|json)$/.test(name)) files[r] = readFileSync47(p, "utf8");
43887
43976
  }
43888
43977
  };
43889
- for (const d of dirs) walk2(join40(root, d), `tier5-src/${d}`);
43978
+ for (const d of dirs) walk2(join41(root, d), `tier5-src/${d}`);
43890
43979
  return { dirs, files };
43891
43980
  }
43892
43981
  function csv(v) {
@@ -43909,8 +43998,8 @@ async function runTemplateTrim(req, deps) {
43909
43998
  links = req.links;
43910
43999
  }
43911
44000
  const dir = req.dir;
43912
- const devPath = join40(dir, "dev/index.ts");
43913
- const configPath = join40(dir, "config.ts");
44001
+ const devPath = join41(dir, "dev/index.ts");
44002
+ const configPath = join41(dir, "config.ts");
43914
44003
  if (!existsSync43(devPath) || !existsSync43(configPath)) {
43915
44004
  return refuse3(new TrimRefusal(`${dir} has no dev/index.ts + config.ts \u2014 point --content at an app scaffolded with \`himi init --template\``));
43916
44005
  }
@@ -43928,23 +44017,23 @@ async function runTemplateTrim(req, deps) {
43928
44017
  throw e;
43929
44018
  }
43930
44019
  if (req.dryRun) return { code: 0, result: { ok: true, dryRun: true, ...plan.report, validate: null } };
43931
- const hadHimi = existsSync43(join40(dir, ".himi"));
43932
- const backupRel = join40(".himi", "trim-backup", (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-"));
43933
- const backup = join40(dir, backupRel);
44020
+ const hadHimi = existsSync43(join41(dir, ".himi"));
44021
+ const backupRel = join41(".himi", "trim-backup", (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-"));
44022
+ const backup = join41(dir, backupRel);
43934
44023
  const originals = [[devPath, "dev/index.ts"], [configPath, "config.ts"]];
43935
44024
  const moved = [];
43936
44025
  const restore = () => {
43937
44026
  for (const [path2, rel] of originals) {
43938
- const original = readFileSync47(join40(backup, rel));
44027
+ const original = readFileSync47(join41(backup, rel));
43939
44028
  if (!existsSync43(path2) || !readFileSync47(path2).equals(original)) writeFileSync16(path2, original);
43940
44029
  }
43941
- for (const name of [...moved].reverse()) renameSync5(join40(backup, "tier5-src", name), join40(dir, "tier5-src", name));
44030
+ for (const name of [...moved].reverse()) renameSync5(join41(backup, "tier5-src", name), join41(dir, "tier5-src", name));
43942
44031
  moved.length = 0;
43943
44032
  };
43944
44033
  const apply = () => {
43945
44034
  const moveDir = deps.moveDir ?? renameSync5;
43946
44035
  for (const name of plan.removedWorkers) {
43947
- moveDir(join40(dir, "tier5-src", name), join40(backup, "tier5-src", name));
44036
+ moveDir(join41(dir, "tier5-src", name), join41(backup, "tier5-src", name));
43948
44037
  moved.push(name);
43949
44038
  }
43950
44039
  if (plan.dev !== dev) writeFileSync16(devPath, plan.dev);
@@ -43952,8 +44041,8 @@ async function runTemplateTrim(req, deps) {
43952
44041
  };
43953
44042
  const dropBackup = () => {
43954
44043
  rmSync8(backup, { recursive: true, force: true });
43955
- for (const d of [dirname24(backup), join40(dir, ".himi")]) {
43956
- if (d === join40(dir, ".himi") && hadHimi) break;
44044
+ for (const d of [dirname25(backup), join41(dir, ".himi")]) {
44045
+ if (d === join41(dir, ".himi") && hadHimi) break;
43957
44046
  try {
43958
44047
  if (!readdirSync23(d).length) rmSync8(d, { recursive: true });
43959
44048
  } catch {
@@ -43979,9 +44068,9 @@ async function runTemplateTrim(req, deps) {
43979
44068
  return { code: 1, result: { ok: false, error: `${error} (${message}); every file was restored`, rolledBack: true, ...base(validate4) } };
43980
44069
  };
43981
44070
  try {
43982
- mkdirSync20(join40(backup, "dev"), { recursive: true });
43983
- for (const [path2, rel] of originals) cpSync(path2, join40(backup, rel));
43984
- if (plan.removedWorkers.length) mkdirSync20(join40(backup, "tier5-src"), { recursive: true });
44071
+ mkdirSync20(join41(backup, "dev"), { recursive: true });
44072
+ for (const [path2, rel] of originals) cpSync(path2, join41(backup, rel));
44073
+ if (plan.removedWorkers.length) mkdirSync20(join41(backup, "tier5-src"), { recursive: true });
43985
44074
  } catch (e) {
43986
44075
  dropBackup();
43987
44076
  return { code: 1, result: { ok: false, error: `could not back up the app before trimming it (${e.message}); nothing was changed`, rolledBack: true, ...base() } };
@@ -44763,7 +44852,7 @@ __export(pack_exports, {
44763
44852
  import { createHash as createHash21 } from "node:crypto";
44764
44853
  import { deflateRawSync, inflateRawSync } from "node:zlib";
44765
44854
  import { existsSync as existsSync44, mkdirSync as mkdirSync21, readFileSync as readFileSync48, readdirSync as readdirSync24, rmSync as rmSync9, statSync as statSync11, writeFileSync as writeFileSync17 } from "node:fs";
44766
- import { dirname as dirname25, join as join41, resolve as resolve37 } from "node:path";
44855
+ import { dirname as dirname26, join as join42, resolve as resolve37 } from "node:path";
44767
44856
  function writeZip(entries) {
44768
44857
  const sorted2 = entries.slice().sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
44769
44858
  const total = sorted2.reduce((n, e) => n + e.bytes.length, 0);
@@ -44860,10 +44949,10 @@ function readIf(path2) {
44860
44949
  return existsSync44(path2) && statSync11(path2).isFile() ? readFileSync48(path2) : null;
44861
44950
  }
44862
44951
  function listDir(dir) {
44863
- return existsSync44(dir) ? readdirSync24(dir).filter((f) => statSync11(join41(dir, f)).isFile()) : [];
44952
+ return existsSync44(dir) ? readdirSync24(dir).filter((f) => statSync11(join42(dir, f)).isFile()) : [];
44864
44953
  }
44865
44954
  function gatherReleaseEntries(appDir2) {
44866
- const manifestPath = join41(appDir2, HIMI_PACKAGE_MANIFEST_PATH);
44955
+ const manifestPath = join42(appDir2, HIMI_PACKAGE_MANIFEST_PATH);
44867
44956
  const manifestBytes = readIf(manifestPath);
44868
44957
  if (!manifestBytes) throw new Error(`no ${HIMI_PACKAGE_MANIFEST_PATH} in ${appDir2} \u2014 build a release there first`);
44869
44958
  const manifest = JSON.parse(manifestBytes.toString("utf8"));
@@ -44887,7 +44976,7 @@ function gatherReleaseEntries(appDir2) {
44887
44976
  }
44888
44977
  const missing = [];
44889
44978
  for (const rel of wanted) {
44890
- const bytes2 = readIf(join41(appDir2, rel));
44979
+ const bytes2 = readIf(join42(appDir2, rel));
44891
44980
  if (bytes2) entries.push({ path: rel, bytes: bytes2 });
44892
44981
  else missing.push(rel);
44893
44982
  }
@@ -44898,12 +44987,12 @@ function gatherReleaseEntries(appDir2) {
44898
44987
  );
44899
44988
  }
44900
44989
  for (const name of SINGLETONS) {
44901
- const bytes2 = readIf(join41(appDir2, name));
44990
+ const bytes2 = readIf(join42(appDir2, name));
44902
44991
  if (bytes2) entries.push({ path: name, bytes: bytes2 });
44903
44992
  }
44904
44993
  const skipped = [];
44905
44994
  for (const sub of ["screens", "bundles", "assets", "widgets"]) {
44906
- for (const f of listDir(join41(appDir2, sub))) {
44995
+ for (const f of listDir(join42(appDir2, sub))) {
44907
44996
  if (!wanted.has(`${sub}/${f}`)) skipped.push(`${sub}/${f}`);
44908
44997
  }
44909
44998
  }
@@ -44936,18 +45025,18 @@ function buildEntries(appDir2, app, opts) {
44936
45025
  return { all, header, manifest, skipped };
44937
45026
  }
44938
45027
  function packRelease(releaseRoot, app, out, opts = {}) {
44939
- const appDir2 = join41(resolve37(releaseRoot), app);
45028
+ const appDir2 = join42(resolve37(releaseRoot), app);
44940
45029
  const { all, header, skipped } = buildEntries(appDir2, app, opts);
44941
45030
  const buf = writeZip(all);
44942
45031
  const isDir2 = existsSync44(out) && statSync11(out).isDirectory();
44943
- const outFile = isDir2 ? join41(resolve37(out), packageFileName(app, header.releaseId)) : resolve37(out);
44944
- mkdirSync21(dirname25(outFile), { recursive: true });
45032
+ const outFile = isDir2 ? join42(resolve37(out), packageFileName(app, header.releaseId)) : resolve37(out);
45033
+ mkdirSync21(dirname26(outFile), { recursive: true });
44945
45034
  writeFileSync17(outFile, buf);
44946
45035
  return { app, releaseId: header.releaseId, header, out: outFile, bytes: buf.length, entryCount: all.length, skipped };
44947
45036
  }
44948
45037
  function resolvePackageDirDest(outDir, app, releaseId) {
44949
45038
  const packagedApp = (dir) => {
44950
- const bytes2 = readIf(join41(dir, HIMI_PACKAGE_HEADER_PATH));
45039
+ const bytes2 = readIf(join42(dir, HIMI_PACKAGE_HEADER_PATH));
44951
45040
  if (!bytes2) return void 0;
44952
45041
  try {
44953
45042
  return JSON.parse(bytes2.toString("utf8")).app;
@@ -44964,7 +45053,7 @@ function resolvePackageDirDest(outDir, app, releaseId) {
44964
45053
  throw new Error(`refusing to write a package tree over ${outDir} \u2014 it is a file, not a directory`);
44965
45054
  }
44966
45055
  if (replaceable(outDir)) return outDir;
44967
- const child = join41(outDir, packageDirName(app, releaseId));
45056
+ const child = join42(outDir, packageDirName(app, releaseId));
44968
45057
  if (!replaceable(child)) {
44969
45058
  throw new Error(
44970
45059
  `refusing to replace ${child}: it is not empty and is not a ${app} package (no ${HIMI_PACKAGE_HEADER_PATH}). Pass --out to a new or empty directory.`
@@ -44978,14 +45067,14 @@ function packReleaseToDir(releaseRoot, app, outDir, opts = {}) {
44978
45067
  "a package carrying the app's source has no --format dir form: readers that predate the source entry drop it before hashing a directory and refuse the package as tampered. Pack it as a .himi archive."
44979
45068
  );
44980
45069
  }
44981
- const appDir2 = join41(resolve37(releaseRoot), app);
45070
+ const appDir2 = join42(resolve37(releaseRoot), app);
44982
45071
  const { all, header, skipped } = buildEntries(appDir2, app, opts);
44983
45072
  const dest = resolvePackageDirDest(resolve37(outDir), app, header.releaseId);
44984
45073
  rmSync9(dest, { recursive: true, force: true });
44985
45074
  let bytes2 = 0;
44986
45075
  for (const entry of all) {
44987
- const target = join41(dest, entry.path);
44988
- mkdirSync21(dirname25(target), { recursive: true });
45076
+ const target = join42(dest, entry.path);
45077
+ mkdirSync21(dirname26(target), { recursive: true });
44989
45078
  writeFileSync17(target, entry.bytes);
44990
45079
  bytes2 += entry.bytes.length;
44991
45080
  }
@@ -45013,10 +45102,10 @@ function openPackageDir(dir) {
45013
45102
  const root = resolve37(dir);
45014
45103
  const entries = /* @__PURE__ */ new Map();
45015
45104
  const walk2 = (rel) => {
45016
- const abs = rel ? join41(root, rel) : root;
45105
+ const abs = rel ? join42(root, rel) : root;
45017
45106
  for (const name of readdirSync24(abs)) {
45018
45107
  const childRel = rel ? `${rel}/${name}` : name;
45019
- const childAbs = join41(abs, name);
45108
+ const childAbs = join42(abs, name);
45020
45109
  if (statSync11(childAbs).isDirectory()) walk2(childRel);
45021
45110
  else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync48(childAbs));
45022
45111
  }
@@ -45063,11 +45152,11 @@ function unpackTo(buf, dest, appFallback) {
45063
45152
  if (!app) throw new Error("package declares no app id (no himi-package.json and no manifest.app)");
45064
45153
  if (!isSafeAppId(app)) throw new Error(`package declares an unsafe app id ${JSON.stringify(app)} \u2014 refusing to unpack it`);
45065
45154
  const root = resolve37(dest);
45066
- const appDir2 = join41(root, app);
45155
+ const appDir2 = join42(root, app);
45067
45156
  rmSync9(appDir2, { recursive: true, force: true });
45068
45157
  for (const [rel, bytes2] of entries) {
45069
- const target = join41(appDir2, rel);
45070
- mkdirSync21(dirname25(target), { recursive: true });
45158
+ const target = join42(appDir2, rel);
45159
+ mkdirSync21(dirname26(target), { recursive: true });
45071
45160
  writeFileSync17(target, bytes2);
45072
45161
  }
45073
45162
  return { root, appDir: appDir2, app };
@@ -45103,19 +45192,19 @@ __export(app_source_exports, {
45103
45192
  zipAppSource: () => zipAppSource
45104
45193
  });
45105
45194
  import { readdirSync as readdirSync25, lstatSync as lstatSync8, readFileSync as readFileSync49, mkdirSync as mkdirSync22, writeFileSync as writeFileSync18, existsSync as existsSync45, rmSync as rmSync10, rmdirSync as rmdirSync2, unlinkSync as unlinkSync3 } from "node:fs";
45106
- import { join as join42, resolve as resolve38, sep as sep10 } from "node:path";
45195
+ import { join as join43, resolve as resolve38, sep as sep10 } from "node:path";
45107
45196
  import { deflateRawSync as deflateRawSync2 } from "node:zlib";
45108
45197
  function walkSourceTree(dir, file, skip) {
45109
45198
  const walk2 = (relDir) => {
45110
- for (const name of readdirSync25(join42(dir, relDir))) {
45111
- const rel = relDir ? join42(relDir, name) : name;
45112
- const st = lstatSync8(join42(dir, rel));
45199
+ for (const name of readdirSync25(join43(dir, relDir))) {
45200
+ const rel = relDir ? join43(relDir, name) : name;
45201
+ const st = lstatSync8(join43(dir, rel));
45113
45202
  if (st.isSymbolicLink()) {
45114
45203
  skip(rel);
45115
45204
  continue;
45116
45205
  }
45117
45206
  if (st.isDirectory()) {
45118
- if (isDeniedSourceDir(name, relDir) || existsSync45(join42(dir, rel, PACKAGE_DIR_MARKER))) skip(rel);
45207
+ if (isDeniedSourceDir(name, relDir) || existsSync45(join43(dir, rel, PACKAGE_DIR_MARKER))) skip(rel);
45119
45208
  else walk2(rel);
45120
45209
  continue;
45121
45210
  }
@@ -45133,7 +45222,7 @@ function collectAppSource(dir) {
45133
45222
  const skipped = [];
45134
45223
  walkSourceTree(
45135
45224
  dir,
45136
- (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync49(join42(dir, hostRel)) }),
45225
+ (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync49(join43(dir, hostRel)) }),
45137
45226
  (hostRel) => skipped.push(hostRel)
45138
45227
  );
45139
45228
  entries.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
@@ -45187,13 +45276,13 @@ function writeAppSource(entries, destDir) {
45187
45276
  const segments = entry.path.split("/");
45188
45277
  let dir = root;
45189
45278
  for (const segment of segments.slice(0, -1)) {
45190
- dir = join42(dir, segment);
45279
+ dir = join43(dir, segment);
45191
45280
  const kind = pathKind(dir);
45192
45281
  if (kind?.isSymbolicLink()) unlinkSync3(dir);
45193
45282
  else if (kind) continue;
45194
45283
  mkdirSync22(dir);
45195
45284
  }
45196
- const target = join42(root, ...segments);
45285
+ const target = join43(root, ...segments);
45197
45286
  if (pathKind(target)?.isSymbolicLink()) unlinkSync3(target);
45198
45287
  writeFileSync18(target, entry.bytes);
45199
45288
  written.push(entry.path);
@@ -45228,7 +45317,7 @@ function writeConflicts(entries, destDir) {
45228
45317
  let dir = root;
45229
45318
  let stop = false;
45230
45319
  for (const [i, segment] of segments.slice(0, -1).entries()) {
45231
- dir = join42(dir, segment);
45320
+ dir = join43(dir, segment);
45232
45321
  const kind2 = pathKind(dir);
45233
45322
  if (!kind2 || kind2.isSymbolicLink()) {
45234
45323
  stop = true;
@@ -45240,7 +45329,7 @@ function writeConflicts(entries, destDir) {
45240
45329
  break;
45241
45330
  }
45242
45331
  if (stop) continue;
45243
- const kind = pathKind(join42(root, ...segments));
45332
+ const kind = pathKind(join43(root, ...segments));
45244
45333
  if (kind && !kind.isSymbolicLink() && kind.isDirectory()) {
45245
45334
  say(entry.path, "is a directory here, but the release has a file at that path");
45246
45335
  }
@@ -45250,7 +45339,7 @@ function writeConflicts(entries, destDir) {
45250
45339
  function removeStaleSource(entries, destDir) {
45251
45340
  const root = resolve38(destDir);
45252
45341
  const removed = staleSourcePaths(entries, root);
45253
- for (const rel of removed) rmSync10(join42(root, ...rel.split("/")), { force: true });
45342
+ for (const rel of removed) rmSync10(join43(root, ...rel.split("/")), { force: true });
45254
45343
  const needed = /* @__PURE__ */ new Set();
45255
45344
  for (const entry of entries) {
45256
45345
  if (isDeniedSourcePath(entry.path)) continue;
@@ -45262,10 +45351,10 @@ function removeStaleSource(entries, destDir) {
45262
45351
  }
45263
45352
  function pruneEmptyDirs(root, rel, needed, removed) {
45264
45353
  let empty = true;
45265
- for (const name of readdirSync25(rel ? join42(root, rel) : root)) {
45266
- const childRel = rel ? join42(rel, name) : name;
45354
+ for (const name of readdirSync25(rel ? join43(root, rel) : root)) {
45355
+ const childRel = rel ? join43(rel, name) : name;
45267
45356
  const posix4 = childRel.split(sep10).join("/");
45268
- const kind = lstatSync8(join42(root, childRel));
45357
+ const kind = lstatSync8(join43(root, childRel));
45269
45358
  if (kind.isSymbolicLink() || !kind.isDirectory() || isDeniedSourceDir(name, rel)) {
45270
45359
  empty = false;
45271
45360
  continue;
@@ -45275,7 +45364,7 @@ function pruneEmptyDirs(root, rel, needed, removed) {
45275
45364
  empty = false;
45276
45365
  continue;
45277
45366
  }
45278
- rmdirSync2(join42(root, childRel));
45367
+ rmdirSync2(join43(root, childRel));
45279
45368
  removed.push(`${posix4}/`);
45280
45369
  }
45281
45370
  return empty;
@@ -45331,7 +45420,7 @@ __export(eject_exports, {
45331
45420
  ejectModule: () => ejectModule
45332
45421
  });
45333
45422
  import { existsSync as existsSync46, mkdirSync as mkdirSync23, readFileSync as readFileSync50, writeFileSync as writeFileSync19 } from "node:fs";
45334
- import { dirname as dirname26, join as join43, relative as relative7, resolve as resolve39, sep as sep11 } from "node:path";
45423
+ import { dirname as dirname27, join as join44, relative as relative8, resolve as resolve39, sep as sep11 } from "node:path";
45335
45424
  function locate(repoRootOrCwd, mod) {
45336
45425
  const inRepo = resolve39(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
45337
45426
  if (existsSync46(inRepo)) return { path: inRepo, form: "source" };
@@ -45360,8 +45449,8 @@ function ejectModule(opts) {
45360
45449
  };
45361
45450
  }
45362
45451
  const ext = found.form === "source" ? "ts" : "mjs";
45363
- const target = join43(contentDir2, "tier5-src", "_ejected", `${mod}.${ext}`);
45364
- mkdirSync23(dirname26(target), { recursive: true });
45452
+ const target = join44(contentDir2, "tier5-src", "_ejected", `${mod}.${ext}`);
45453
+ mkdirSync23(dirname27(target), { recursive: true });
45365
45454
  const banner = `// EJECTED from @wix/himalaya/${mod}. This app owns this file now.
45366
45455
  //
45367
45456
  // Central fixes to @wix/himalaya/${mod} NO LONGER REACH THIS APP \u2014 including any
@@ -45384,7 +45473,7 @@ function ejectModule(opts) {
45384
45473
  if (!existsSync46(f)) continue;
45385
45474
  const before = readFileSync50(f, "utf8");
45386
45475
  let after = before;
45387
- let rel = relative7(dirname26(f), target).split(sep11).join("/").replace(/\.tsx?$/, ".js");
45476
+ let rel = relative8(dirname27(f), target).split(sep11).join("/").replace(/\.tsx?$/, ".js");
45388
45477
  if (!rel.startsWith(".")) rel = `./${rel}`;
45389
45478
  for (const spec of specifiersFor(mod)) {
45390
45479
  const q = spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -45416,7 +45505,7 @@ var init_eject = __esm({
45416
45505
 
45417
45506
  // src/wix-writes.ts
45418
45507
  import { existsSync as existsSync47, readFileSync as readFileSync51 } from "node:fs";
45419
- import { join as join44 } from "node:path";
45508
+ import { join as join45 } from "node:path";
45420
45509
  function isProvenRead(method, path2) {
45421
45510
  if (/[#\x00-\x1F\x7F]/.test(path2)) return false;
45422
45511
  const verb = method.toUpperCase();
@@ -45497,7 +45586,7 @@ function parseDataAccess(text5, from) {
45497
45586
  }
45498
45587
  function readDataAccess(dir) {
45499
45588
  for (const name of ["SPEC.md", "MOBILE-UX.md"]) {
45500
- const p = join44(dir, name);
45589
+ const p = join45(dir, name);
45501
45590
  if (!existsSync47(p)) continue;
45502
45591
  let text5;
45503
45592
  try {
@@ -45609,7 +45698,7 @@ __export(test_exports, {
45609
45698
  writeRecordedMocks: () => writeRecordedMocks
45610
45699
  });
45611
45700
  import { existsSync as existsSync48, mkdirSync as mkdirSync24, readFileSync as readFileSync52, writeFileSync as writeFileSync20 } from "node:fs";
45612
- import { join as join45, resolve as resolve40 } from "node:path";
45701
+ import { join as join46, resolve as resolve40 } from "node:path";
45613
45702
  function readTestConfig(dir) {
45614
45703
  const p = resolve40(dir, TEST_CONFIG_FILE);
45615
45704
  if (!existsSync48(p)) return {};
@@ -45789,8 +45878,8 @@ function writeRecordedMocks(opts) {
45789
45878
  mkdir: (p) => mkdirSync24(p, { recursive: true }),
45790
45879
  write: (p, s) => writeFileSync20(p, s)
45791
45880
  };
45792
- fs.mkdir(join45(opts.dir, "dev"));
45793
- fs.write(join45(opts.dir, "dev", "net-mocks.json"), JSON.stringify(opts.mocks, null, 2) + "\n");
45881
+ fs.mkdir(join46(opts.dir, "dev"));
45882
+ fs.write(join46(opts.dir, "dev", "net-mocks.json"), JSON.stringify(opts.mocks, null, 2) + "\n");
45794
45883
  return { ok: true, rules, to: "dev/net-mocks.json" };
45795
45884
  }
45796
45885
  function scopeDescriptors(descriptors, requestedIds, invalidScreens) {
@@ -46273,9 +46362,9 @@ __export(mobile_ux_lint_exports, {
46273
46362
  mobileUxIssues: () => mobileUxIssues
46274
46363
  });
46275
46364
  import { existsSync as existsSync49, readFileSync as readFileSync53 } from "node:fs";
46276
- import { join as join46 } from "node:path";
46365
+ import { join as join47 } from "node:path";
46277
46366
  function mobileUxIssues(dir, strict) {
46278
- const file = join46(dir, "MOBILE-UX.md");
46367
+ const file = join47(dir, "MOBILE-UX.md");
46279
46368
  if (!existsSync49(file)) return [];
46280
46369
  let text5;
46281
46370
  try {
@@ -47955,7 +48044,7 @@ __export(functions_exports, {
47955
48044
  runRemoteFunctionOperation: () => runRemoteFunctionOperation
47956
48045
  });
47957
48046
  import { readFileSync as readFileSync54, existsSync as existsSync50 } from "node:fs";
47958
- import { join as join47, resolve as resolve41 } from "node:path";
48047
+ import { join as join48, resolve as resolve41 } from "node:path";
47959
48048
  function resolveFunctionsTarget(input) {
47960
48049
  const explicitUrl = input.functionsUrl?.trim();
47961
48050
  if (explicitUrl) return { mode: "remote", baseUrl: explicitUrl };
@@ -47974,7 +48063,7 @@ async function loadFunctionsApp(dir) {
47974
48063
  }
47975
48064
  const sources = {};
47976
48065
  for (const definition of config.functions.functions) {
47977
- const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join47(loaded.dir, "functions", `${definition.name}${extension}`)).find(existsSync50);
48066
+ const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join48(loaded.dir, "functions", `${definition.name}${extension}`)).find(existsSync50);
47978
48067
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
47979
48068
  sources[definition.name] = readFileSync54(source, "utf8");
47980
48069
  }
@@ -48129,9 +48218,9 @@ __export(studio_reel_exports, {
48129
48218
  });
48130
48219
  import { createHash as createHash24 } from "node:crypto";
48131
48220
  import { lstatSync as lstatSync9, readFileSync as readFileSync55 } from "node:fs";
48132
- import { basename as basename11, join as join48 } from "node:path";
48221
+ import { basename as basename12, join as join49 } from "node:path";
48133
48222
  function loadMemory2(dir) {
48134
- const m = readJson4(join48(dir, ".himi", "studio", "memory.json"));
48223
+ const m = readJson4(join49(dir, ".himi", "studio", "memory.json"));
48135
48224
  if (!isObj2(m) || m.version !== 1 || !isObj2(m.shots) || !Array.isArray(m.timeline)) return null;
48136
48225
  const shots = [];
48137
48226
  for (const [id, s] of Object.entries(m.shots)) {
@@ -48168,8 +48257,8 @@ function planReel(dir) {
48168
48257
  const memory = loadMemory2(dir);
48169
48258
  const { entries } = readProgress(dir);
48170
48259
  const summary = summarizeProgress(entries);
48171
- const manifest = readJson4(join48(dir, "himalaya.content.json"));
48172
- const tokens = readJson4(join48(dir, "tokens.json"));
48260
+ const manifest = readJson4(join49(dir, "himalaya.content.json"));
48261
+ const tokens = readJson4(join49(dir, "tokens.json"));
48173
48262
  const accentToken = tokens?.colors?.accentPrimary;
48174
48263
  const accentRaw = typeof accentToken === "string" ? accentToken : accentToken?.light;
48175
48264
  const accent = typeof accentRaw === "string" && ACCENT.test(accentRaw) ? accentRaw : DEFAULT_ACCENT;
@@ -48184,13 +48273,13 @@ function planReel(dir) {
48184
48273
  ts: e.ts,
48185
48274
  message: e.message,
48186
48275
  step: str(e.step),
48187
- files: (Array.isArray(e.images) ? e.images : []).map((i) => isObj2(i) && typeof i.file === "string" ? basename11(i.file) : "").filter((f) => HISTORY_NAME.test(f))
48276
+ files: (Array.isArray(e.images) ? e.images : []).map((i) => isObj2(i) && typeof i.file === "string" ? basename12(i.file) : "").filter((f) => HISTORY_NAME.test(f))
48188
48277
  }));
48189
48278
  const times = [summary.startedAt, ...timeline.map((t) => t.ts), memory?.createdAt].filter((x) => !!x).sort();
48190
48279
  const startedAt = times[0] ?? null;
48191
48280
  const endedAt = [summary.lastAt, ...timeline.map((t) => t.ts)].filter((x) => !!x).sort().pop() ?? null;
48192
48281
  return {
48193
- app: typeof manifest?.name === "string" && manifest.name ? manifest.name : basename11(dir),
48282
+ app: typeof manifest?.name === "string" && manifest.name ? manifest.name : basename12(dir),
48194
48283
  accent,
48195
48284
  startedAt,
48196
48285
  endedAt,
@@ -48211,7 +48300,7 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
48211
48300
  const verified = (f) => {
48212
48301
  if (!HISTORY_NAME.test(f)) return null;
48213
48302
  try {
48214
- const path2 = join48(dir, HISTORY_DIR, f);
48303
+ const path2 = join49(dir, HISTORY_DIR, f);
48215
48304
  const st = lstatSync9(path2);
48216
48305
  if (!st.isFile() || st.nlink !== 1) return null;
48217
48306
  const bytes2 = readFileSync55(path2);
@@ -48381,7 +48470,7 @@ __export(native_decode_exports, {
48381
48470
  import { execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
48382
48471
  import { existsSync as existsSync51, mkdtempSync as mkdtempSync2, readFileSync as readFileSync56, rmSync as rmSync11, writeFileSync as writeFileSync21 } from "node:fs";
48383
48472
  import { tmpdir as tmpdir3 } from "node:os";
48384
- import { join as join49 } from "node:path";
48473
+ import { join as join50 } from "node:path";
48385
48474
  import { fileURLToPath as fileURLToPath20 } from "node:url";
48386
48475
  function nativeDecodePackageDir() {
48387
48476
  return fileURLToPath20(new URL("../../../core/runtime/ios/HimalayaCore/", import.meta.url));
@@ -48391,8 +48480,8 @@ function nativeDecodeAndroidHarnessDir() {
48391
48480
  }
48392
48481
  function nativeOracleShipped() {
48393
48482
  return {
48394
- ios: existsSync51(join49(nativeDecodePackageDir(), "Package.swift")),
48395
- android: existsSync51(join49(nativeDecodeAndroidHarnessDir(), "gradlew"))
48483
+ ios: existsSync51(join50(nativeDecodePackageDir(), "Package.swift")),
48484
+ android: existsSync51(join50(nativeDecodeAndroidHarnessDir(), "gradlew"))
48396
48485
  };
48397
48486
  }
48398
48487
  function detectNativeDecode(options = {}) {
@@ -48403,7 +48492,7 @@ function detectNativeDecode(options = {}) {
48403
48492
  return { platform: "ios", available: false, reason: `the iOS decoder oracle requires macOS (darwin); this host is ${hostPlatform}` };
48404
48493
  }
48405
48494
  if (!swiftAvailable) return { platform: "ios", available: false, reason: "swift is not on PATH" };
48406
- const packageAvailable = options.packageAvailable ?? existsSync51(join49(packageDir, "Package.swift"));
48495
+ const packageAvailable = options.packageAvailable ?? existsSync51(join50(packageDir, "Package.swift"));
48407
48496
  if (!packageAvailable) {
48408
48497
  return {
48409
48498
  platform: "ios",
@@ -48415,7 +48504,7 @@ function detectNativeDecode(options = {}) {
48415
48504
  }
48416
48505
  function localPropertiesSdk(harnessDir) {
48417
48506
  try {
48418
- const match = readFileSync56(join49(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
48507
+ const match = readFileSync56(join50(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
48419
48508
  return match?.[1]?.trim().replace(/\\([ :\\])/g, "$1") ?? null;
48420
48509
  } catch {
48421
48510
  return null;
@@ -48423,7 +48512,7 @@ function localPropertiesSdk(harnessDir) {
48423
48512
  }
48424
48513
  function detectAndroidNativeDecode(options = {}) {
48425
48514
  const harnessDir = options.harnessDir ?? nativeDecodeAndroidHarnessDir();
48426
- const gradlew = join49(harnessDir, "gradlew");
48515
+ const gradlew = join50(harnessDir, "gradlew");
48427
48516
  const gradlewAvailable = options.gradlewAvailable ?? existsSync51(gradlew);
48428
48517
  if (!gradlewAvailable) {
48429
48518
  return {
@@ -48506,14 +48595,14 @@ function parseNativeDecodeOutput(stdout, expectedScreenIds, platform = "ios") {
48506
48595
  return verdicts;
48507
48596
  }
48508
48597
  function runNativeDecode(options) {
48509
- const descriptorDir = mkdtempSync2(join49(tmpdir3(), "himi-native-decode-"));
48598
+ const descriptorDir = mkdtempSync2(join50(tmpdir3(), "himi-native-decode-"));
48510
48599
  const startedAt = Date.now();
48511
48600
  try {
48512
48601
  for (const descriptor of options.descriptors) {
48513
48602
  if (typeof descriptor.descriptorJson !== "string") {
48514
48603
  throw new Error(`native decode cannot judge ${descriptor.screenId}: the release builder did not return its exact baked JSON bytes`);
48515
48604
  }
48516
- writeFileSync21(join49(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48605
+ writeFileSync21(join50(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48517
48606
  }
48518
48607
  options.progress?.("building cached Swift oracle");
48519
48608
  execFileSync5("swift", ["build", "--package-path", options.packageDir, "--product", "himi-decode-oracle"], {
@@ -48525,7 +48614,7 @@ function runNativeDecode(options) {
48525
48614
  encoding: "utf8"
48526
48615
  }).trim();
48527
48616
  options.progress?.(`running real Swift decoder over ${options.descriptors.length} screen${options.descriptors.length === 1 ? "" : "s"}`);
48528
- const stdout = execFileSync5(join49(binPath, "himi-decode-oracle"), ["--dir", descriptorDir], {
48617
+ const stdout = execFileSync5(join50(binPath, "himi-decode-oracle"), ["--dir", descriptorDir], {
48529
48618
  stdio: ["ignore", "pipe", "pipe"],
48530
48619
  encoding: "utf8"
48531
48620
  });
@@ -48543,15 +48632,15 @@ function runNativeDecode(options) {
48543
48632
  }
48544
48633
  }
48545
48634
  function runAndroidNativeDecode(options) {
48546
- const descriptorDir = mkdtempSync2(join49(tmpdir3(), "himi-native-decode-android-"));
48547
- const outputPath = join49(descriptorDir, "verdicts.ndjson");
48635
+ const descriptorDir = mkdtempSync2(join50(tmpdir3(), "himi-native-decode-android-"));
48636
+ const outputPath = join50(descriptorDir, "verdicts.ndjson");
48548
48637
  const startedAt = Date.now();
48549
48638
  try {
48550
48639
  for (const descriptor of options.descriptors) {
48551
48640
  if (typeof descriptor.descriptorJson !== "string") {
48552
48641
  throw new Error(`native decode cannot judge ${descriptor.screenId}: the release builder did not return its exact baked JSON bytes`);
48553
48642
  }
48554
- writeFileSync21(join49(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48643
+ writeFileSync21(join50(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48555
48644
  }
48556
48645
  options.progress?.(`running real Kotlin decoder over ${options.descriptors.length} screen${options.descriptors.length === 1 ? "" : "s"}`);
48557
48646
  execFileSync5(options.gradlew, [
@@ -48637,12 +48726,12 @@ __export(browser_authoring_exports, {
48637
48726
  import { createServer as createServer3 } from "node:http";
48638
48727
  import { createHash as createHash25, randomBytes as randomBytes4 } from "node:crypto";
48639
48728
  import { existsSync as existsSync52, readdirSync as readdirSync26, readFileSync as readFileSync57, realpathSync as realpathSync6, statSync as statSync12 } from "node:fs";
48640
- import { join as join50, posix as posix2, relative as relative8, sep as sep12 } from "node:path";
48729
+ import { join as join51, posix as posix2, relative as relative9, sep as sep12 } from "node:path";
48641
48730
  function humanMs(ms) {
48642
48731
  return ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`;
48643
48732
  }
48644
48733
  function collectWorkerSources(tier5SrcDir, bundleName) {
48645
- const root = join50(tier5SrcDir, bundleName);
48734
+ const root = join51(tier5SrcDir, bundleName);
48646
48735
  const files = {};
48647
48736
  const visitedDirs = /* @__PURE__ */ new Set();
48648
48737
  const walk2 = (abs, rel) => {
@@ -48650,7 +48739,7 @@ function collectWorkerSources(tier5SrcDir, bundleName) {
48650
48739
  if (visitedDirs.has(real)) return;
48651
48740
  visitedDirs.add(real);
48652
48741
  for (const name of readdirSync26(abs).sort()) {
48653
- const childAbs = join50(abs, name);
48742
+ const childAbs = join51(abs, name);
48654
48743
  const childRel = posix2.join(rel, name);
48655
48744
  if (statSync12(childAbs).isDirectory()) {
48656
48745
  walk2(childAbs, childRel);
@@ -48676,18 +48765,18 @@ function collectRelativeSiblings(files, tier5SrcDir) {
48676
48765
  const spec = m[1];
48677
48766
  const virtual = posix2.normalize(posix2.join(dir, spec));
48678
48767
  if (!virtual.startsWith("/tier5-src/")) continue;
48679
- const onDisk = join50(tier5SrcDir, virtual.slice("/tier5-src/".length));
48768
+ const onDisk = join51(tier5SrcDir, virtual.slice("/tier5-src/".length));
48680
48769
  const candidates = [
48681
48770
  onDisk,
48682
48771
  `${onDisk}.ts`,
48683
48772
  `${onDisk}.js`,
48684
48773
  onDisk.replace(/\.js$/, ".ts"),
48685
- join50(onDisk, "index.ts"),
48686
- join50(onDisk, "index.js")
48774
+ join51(onDisk, "index.ts"),
48775
+ join51(onDisk, "index.js")
48687
48776
  ];
48688
48777
  for (const abs of candidates) {
48689
48778
  if (!existsSync52(abs) || statSync12(abs).isDirectory()) continue;
48690
- const key2 = `/tier5-src/${relative8(tier5SrcDir, abs).split(sep12).join(posix2.sep)}`;
48779
+ const key2 = `/tier5-src/${relative9(tier5SrcDir, abs).split(sep12).join(posix2.sep)}`;
48691
48780
  if (key2 in files) break;
48692
48781
  files[key2] = readFileSync57(abs, "utf8");
48693
48782
  queue.push(key2);
@@ -48897,7 +48986,7 @@ __export(coverage_exports, {
48897
48986
  trendAndStore: () => trendAndStore
48898
48987
  });
48899
48988
  import { existsSync as existsSync53, mkdirSync as mkdirSync25, readFileSync as readFileSync58, writeFileSync as writeFileSync22 } from "node:fs";
48900
- import { dirname as dirname27, join as join51 } from "node:path";
48989
+ import { dirname as dirname28, join as join52 } from "node:path";
48901
48990
  function suppressedNativeKeys(oracle) {
48902
48991
  return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
48903
48992
  }
@@ -49077,7 +49166,7 @@ function assembleLedger(r, options = {}) {
49077
49166
  return out;
49078
49167
  }
49079
49168
  function trendAndStore(dir, entries, suppressed) {
49080
- const p = join51(dir, LEDGER_FILE);
49169
+ const p = join52(dir, LEDGER_FILE);
49081
49170
  let previous = null;
49082
49171
  try {
49083
49172
  if (existsSync53(p)) {
@@ -49089,7 +49178,7 @@ function trendAndStore(dir, entries, suppressed) {
49089
49178
  const current = entries.map((e) => e.key);
49090
49179
  const stored = [.../* @__PURE__ */ new Set([...current, ...(previous ?? []).filter((key2) => (suppressed ?? []).includes(key2))])];
49091
49180
  try {
49092
- mkdirSync25(dirname27(p), { recursive: true });
49181
+ mkdirSync25(dirname28(p), { recursive: true });
49093
49182
  writeFileSync22(p, JSON.stringify({ keys: stored, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
49094
49183
  } catch {
49095
49184
  return null;
@@ -49120,7 +49209,7 @@ function formatLedger(entries, trend) {
49120
49209
  return out.join("\n");
49121
49210
  }
49122
49211
  function diffAndStoreObservations(dir, current) {
49123
- const p = join51(dir, OBS_FILE);
49212
+ const p = join52(dir, OBS_FILE);
49124
49213
  let previous = null;
49125
49214
  try {
49126
49215
  if (existsSync53(p)) {
@@ -49134,7 +49223,7 @@ function diffAndStoreObservations(dir, current) {
49134
49223
  } catch {
49135
49224
  }
49136
49225
  try {
49137
- mkdirSync25(dirname27(p), { recursive: true });
49226
+ mkdirSync25(dirname28(p), { recursive: true });
49138
49227
  writeFileSync22(p, JSON.stringify({ screens: current, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
49139
49228
  } catch {
49140
49229
  return null;
@@ -49173,8 +49262,8 @@ var LEDGER_FILE, OBS_FILE;
49173
49262
  var init_coverage = __esm({
49174
49263
  "src/coverage.ts"() {
49175
49264
  init_native_decode();
49176
- LEDGER_FILE = join51(".himi", "test-ledger.json");
49177
- OBS_FILE = join51(".himi", "test-observations.json");
49265
+ LEDGER_FILE = join52(".himi", "test-ledger.json");
49266
+ OBS_FILE = join52(".himi", "test-observations.json");
49178
49267
  }
49179
49268
  });
49180
49269
 
@@ -49186,7 +49275,7 @@ __export(design_kits_exports, {
49186
49275
  listKits: () => listKits2
49187
49276
  });
49188
49277
  import { existsSync as existsSync54, readFileSync as readFileSync59, readdirSync as readdirSync27 } from "node:fs";
49189
- import { join as join52, basename as basename12 } from "node:path";
49278
+ import { join as join53, basename as basename13 } from "node:path";
49190
49279
  import { fileURLToPath as fileURLToPath21 } from "node:url";
49191
49280
  function kitsDir() {
49192
49281
  return KIT_DIR_CANDIDATES.find((p) => existsSync54(p));
@@ -49194,7 +49283,7 @@ function kitsDir() {
49194
49283
  function listKits2() {
49195
49284
  const dir = kitsDir();
49196
49285
  if (!dir) return [];
49197
- return readdirSync27(dir).filter((f) => f.endsWith(".json")).map((f) => basename12(f, ".json")).sort();
49286
+ return readdirSync27(dir).filter((f) => f.endsWith(".json")).map((f) => basename13(f, ".json")).sort();
49198
49287
  }
49199
49288
  function kitReport(name) {
49200
49289
  const dir = kitsDir();
@@ -49213,7 +49302,7 @@ In a published @wix/himalaya-cli this is a packaging bug \u2014 the kits should
49213
49302
  if (!kits.includes(name)) {
49214
49303
  return { ok: false, kit: name, kits, problems: [`no design kit named "${name}". Available: ${kits.join(", ")}`] };
49215
49304
  }
49216
- const raw = readFileSync59(join52(dir, `${name}.json`), "utf8");
49305
+ const raw = readFileSync59(join53(dir, `${name}.json`), "utf8");
49217
49306
  let parsed;
49218
49307
  try {
49219
49308
  parsed = JSON.parse(raw);
@@ -49237,9 +49326,9 @@ var init_design_kits = __esm({
49237
49326
  "src/design-kits.ts"() {
49238
49327
  KIT_DIR_CANDIDATES = [
49239
49328
  // in-repo: tools/himi-cli/src/design-kits.ts → <repo>/stdlib/design-kits/
49240
- join52(fileURLToPath21(new URL("../../..", import.meta.url)), "stdlib", "design-kits"),
49329
+ join53(fileURLToPath21(new URL("../../..", import.meta.url)), "stdlib", "design-kits"),
49241
49330
  // published CLI: <pkg>/dist/cli.mjs → <pkg>/stdlib/design-kits/
49242
- join52(fileURLToPath21(new URL("..", import.meta.url)), "stdlib", "design-kits")
49331
+ join53(fileURLToPath21(new URL("..", import.meta.url)), "stdlib", "design-kits")
49243
49332
  ];
49244
49333
  }
49245
49334
  });
@@ -49254,7 +49343,7 @@ __export(assets_exports, {
49254
49343
  verifyReport: () => verifyReport
49255
49344
  });
49256
49345
  import { readFileSync as readFileSync60 } from "node:fs";
49257
- import { basename as basename13 } from "node:path";
49346
+ import { basename as basename14 } from "node:path";
49258
49347
  function declaredAssets(dir) {
49259
49348
  return collectAssets(dir).map((a) => {
49260
49349
  const bytes2 = readFileSync60(a.path);
@@ -49335,7 +49424,7 @@ function verifyReport(dir, app, manifest) {
49335
49424
  }
49336
49425
  function addAssetPayload(manifest, filePath, opts) {
49337
49426
  const bytes2 = readFileSync60(filePath);
49338
- const name = opts.name ?? basename13(filePath);
49427
+ const name = opts.name ?? basename14(filePath);
49339
49428
  const sha2565 = assetSha256(bytes2);
49340
49429
  const record2 = {
49341
49430
  sha256: sha2565,
@@ -51009,7 +51098,7 @@ __export(run_exports, {
51009
51098
  });
51010
51099
  import { cpSync as cpSync2, existsSync as existsSync55, mkdirSync as mkdirSync26, mkdtempSync as mkdtempSync3, readFileSync as readFileSync61, rmSync as rmSync12, statSync as statSync13 } from "node:fs";
51011
51100
  import { tmpdir as tmpdir4 } from "node:os";
51012
- import { dirname as dirname28, join as join53 } from "node:path";
51101
+ import { dirname as dirname29, join as join54 } from "node:path";
51013
51102
  import { fileURLToPath as fileURLToPath22 } from "node:url";
51014
51103
  function makePackageRunHandler(opts) {
51015
51104
  const store = new FileReleaseStore(opts.releaseRoot);
@@ -51038,7 +51127,7 @@ async function fetchBytes(url) {
51038
51127
  async function resolvePackage(source, workDir) {
51039
51128
  const isUrl2 = /^https?:\/\//i.test(source);
51040
51129
  if (!isUrl2 && existsSync55(source) && statSync13(source).isDirectory()) {
51041
- const appDirManifest = join53(source, "release-manifest.json");
51130
+ const appDirManifest = join54(source, "release-manifest.json");
51042
51131
  if (existsSync55(appDirManifest)) {
51043
51132
  const opened2 = openPackageDir(source);
51044
51133
  if (!opened2.validation.ok) {
@@ -51048,9 +51137,9 @@ async function resolvePackage(source, workDir) {
51048
51137
  const app2 = opened2.header?.app ?? opened2.manifest?.app;
51049
51138
  if (!app2) throw new Error(`${source} has no app id (no himi-package.json and no manifest.app)`);
51050
51139
  if (!isSafeAppId(app2)) throw new Error(`${source} declares an unsafe app id ${JSON.stringify(app2)} \u2014 refusing to open it`);
51051
- const root2 = workDir ?? mkdtempSync3(join53(tmpdir4(), "himi-run-"));
51052
- const target = join53(root2, app2);
51053
- if (join53(source) !== target) {
51140
+ const root2 = workDir ?? mkdtempSync3(join54(tmpdir4(), "himi-run-"));
51141
+ const target = join54(root2, app2);
51142
+ if (join54(source) !== target) {
51054
51143
  mkdirSync26(root2, { recursive: true });
51055
51144
  rmSync12(target, { recursive: true, force: true });
51056
51145
  cpSync2(source, target, { recursive: true });
@@ -51068,7 +51157,7 @@ async function resolvePackage(source, workDir) {
51068
51157
  throw new Error(`${source} is a directory but has no release-manifest.json \u2014 is it a package?`);
51069
51158
  }
51070
51159
  const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync61(source);
51071
- const root = workDir ?? mkdtempSync3(join53(tmpdir4(), "himi-run-"));
51160
+ const root = workDir ?? mkdtempSync3(join54(tmpdir4(), "himi-run-"));
51072
51161
  const { app, appDir: appDir2 } = unpackTo(bytes2, root);
51073
51162
  const opened = openPackageDir(appDir2);
51074
51163
  if (!opened.validation.ok) {
@@ -51089,11 +51178,11 @@ async function resolvePackage(source, workDir) {
51089
51178
  async function loadPreviewAssets() {
51090
51179
  try {
51091
51180
  const mod = await Promise.resolve().then(() => (init_preview_assets_generated(), preview_assets_generated_exports));
51092
- const here = dirname28(fileURLToPath22(import.meta.url));
51181
+ const here = dirname29(fileURLToPath22(import.meta.url));
51093
51182
  const candidates = [
51094
- join53(here, "preview-assets.generated.bin"),
51183
+ join54(here, "preview-assets.generated.bin"),
51095
51184
  // published: copied next to the bundled CLI
51096
- join53(here, "../../../packages/serve/src/preview-assets.generated.bin")
51185
+ join54(here, "../../../packages/serve/src/preview-assets.generated.bin")
51097
51186
  // in-repo checkout
51098
51187
  ];
51099
51188
  for (const path2 of candidates) {
@@ -51197,7 +51286,7 @@ __export(run_watch_exports, {
51197
51286
  });
51198
51287
  import { closeSync as closeSync2, constants, existsSync as existsSync56, fstatSync, lstatSync as lstatSync10, statSync as statSync14, mkdirSync as mkdirSync27, openSync as openSync2, readFileSync as readFileSync62, realpathSync as realpathSync7, renameSync as renameSync6, rmSync as rmSync13, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
51199
51288
  import { randomUUID as randomUUID3 } from "node:crypto";
51200
- import { extname as extname4, join as join54, resolve as resolve42, sep as sep13 } from "node:path";
51289
+ import { extname as extname4, join as join55, resolve as resolve42, sep as sep13 } from "node:path";
51201
51290
  function diffReleases(prev, next) {
51202
51291
  const bundles = Object.keys(next.bundles).filter((b) => prev.bundles[b]?.sha256 !== next.bundles[b].sha256).sort();
51203
51292
  const changedBundles = new Set(bundles);
@@ -51238,7 +51327,7 @@ function watchContent(dir, onChange, opts = {}) {
51238
51327
  let timer = null;
51239
51328
  const pending = /* @__PURE__ */ new Set();
51240
51329
  const watcher2 = watch2(dir, { recursive: true }, (_event, file) => {
51241
- if (!file || ignoredChange(file, (rel) => isDir(join54(dir, rel)))) return;
51330
+ if (!file || ignoredChange(file, (rel) => isDir(join55(dir, rel)))) return;
51242
51331
  pending.add(file);
51243
51332
  if (timer) clearTimeout(timer);
51244
51333
  timer = setTimeout(() => {
@@ -51259,7 +51348,7 @@ function watchedContentDir(source) {
51259
51348
  if (!source || /^https?:\/\//i.test(source)) return null;
51260
51349
  const dir = resolve42(source);
51261
51350
  try {
51262
- return statSync14(dir).isDirectory() && existsSync56(join54(dir, "himalaya.content.json")) ? dir : null;
51351
+ return statSync14(dir).isDirectory() && existsSync56(join55(dir, "himalaya.content.json")) ? dir : null;
51263
51352
  } catch {
51264
51353
  return null;
51265
51354
  }
@@ -51316,7 +51405,7 @@ function serialize(task) {
51316
51405
  });
51317
51406
  }
51318
51407
  function himiDir(dir) {
51319
- const root = join54(dir, ".himi");
51408
+ const root = join55(dir, ".himi");
51320
51409
  try {
51321
51410
  return lstatSync10(root).isDirectory() ? root : null;
51322
51411
  } catch (e) {
@@ -51328,11 +51417,11 @@ function himiDir(dir) {
51328
51417
  function writeRunRecord(dir, record2) {
51329
51418
  const root = himiDir(dir);
51330
51419
  if (!root) return false;
51331
- const tmp = join54(root, `.run.json.${process.pid}.${randomUUID3()}.tmp`);
51420
+ const tmp = join55(root, `.run.json.${process.pid}.${randomUUID3()}.tmp`);
51332
51421
  try {
51333
51422
  writeFileSync23(tmp, `${JSON.stringify(record2, null, 2)}
51334
51423
  `, { flag: "wx" });
51335
- renameSync6(tmp, join54(root, "run.json"));
51424
+ renameSync6(tmp, join55(root, "run.json"));
51336
51425
  } catch (e) {
51337
51426
  rmSync13(tmp, { force: true });
51338
51427
  throw e;
@@ -51340,7 +51429,7 @@ function writeRunRecord(dir, record2) {
51340
51429
  return true;
51341
51430
  }
51342
51431
  function removeRunRecord(dir, owner) {
51343
- const root = join54(dir, ".himi");
51432
+ const root = join55(dir, ".himi");
51344
51433
  try {
51345
51434
  if (!lstatSync10(root).isDirectory()) return;
51346
51435
  } catch {
@@ -51355,16 +51444,16 @@ function removeRunRecord(dir, owner) {
51355
51444
  }
51356
51445
  if (typeof pid === "number" && pid !== owner) return;
51357
51446
  }
51358
- rmSync13(join54(root, "run.json"), { force: true });
51447
+ rmSync13(join55(root, "run.json"), { force: true });
51359
51448
  }
51360
51449
  function boardFile(dir, pathname) {
51361
51450
  let rel = null;
51362
- if (pathname === "/__himi/studio/" || pathname === "/__himi/studio/index.html") rel = join54("studio", "index.html");
51363
- else if (pathname === "/__himi/studio/state.js") rel = join54("studio", "state.js");
51364
- else if (pathname === "/__himi/studio/timeline.js") rel = join54("studio", "timeline.js");
51451
+ if (pathname === "/__himi/studio/" || pathname === "/__himi/studio/index.html") rel = join55("studio", "index.html");
51452
+ else if (pathname === "/__himi/studio/state.js") rel = join55("studio", "state.js");
51453
+ else if (pathname === "/__himi/studio/timeline.js") rel = join55("studio", "timeline.js");
51365
51454
  else {
51366
51455
  const m = /^\/__himi\/history\/([0-9a-f]{64}\.(png|jpg|gif|webp))$/.exec(pathname);
51367
- if (m) rel = join54("history", m[1]);
51456
+ if (m) rel = join55("history", m[1]);
51368
51457
  }
51369
51458
  if (!rel) return null;
51370
51459
  const bytes2 = readConfined(resolve42(dir, ".himi"), rel);
@@ -51380,7 +51469,7 @@ function readConfined(root, rel) {
51380
51469
  const parts = rel.split(sep13);
51381
51470
  let at = root;
51382
51471
  for (let i = 0; i < parts.length; i++) {
51383
- at = join54(at, parts[i]);
51472
+ at = join55(at, parts[i]);
51384
51473
  const st = lstatSync10(at);
51385
51474
  if (st.isSymbolicLink() || !(i === parts.length - 1 ? st.isFile() : st.isDirectory())) return null;
51386
51475
  }
@@ -51443,7 +51532,7 @@ __export(run_browser_exports, {
51443
51532
  import { createServer as createServer5 } from "node:http";
51444
51533
  import { existsSync as existsSync57, readFileSync as readFileSync63 } from "node:fs";
51445
51534
  import { spawnSync as spawnSync3 } from "node:child_process";
51446
- import { dirname as dirname29, resolve as resolve43 } from "node:path";
51535
+ import { dirname as dirname30, resolve as resolve43 } from "node:path";
51447
51536
  import { fileURLToPath as fileURLToPath23 } from "node:url";
51448
51537
  function stagedDir() {
51449
51538
  return process.env.HIMI_BROWSER_PLANE_OUT ? resolve43(process.env.HIMI_BROWSER_PLANE_OUT) : resolve43(REPO, "packages", "serve", "dist", "browser-plane");
@@ -51585,7 +51674,7 @@ var init_run_browser = __esm({
51585
51674
  init_open_url();
51586
51675
  init_file_store();
51587
51676
  init_wix_client_id();
51588
- HERE = dirname29(fileURLToPath23(import.meta.url));
51677
+ HERE = dirname30(fileURLToPath23(import.meta.url));
51589
51678
  REPO = resolve43(HERE, "..", "..", "..");
51590
51679
  SERVED = /* @__PURE__ */ new Set(["host.html", "sw.js", "package-reader.js"]);
51591
51680
  }
@@ -52006,9 +52095,9 @@ __export(preflight_exports, {
52006
52095
  requireEnv: () => requireEnv
52007
52096
  });
52008
52097
  import { existsSync as existsSync58, readFileSync as readFileSync64 } from "node:fs";
52009
- import { isAbsolute as isAbsolute3, relative as relative9, resolve as resolve44 } from "node:path";
52098
+ import { isAbsolute as isAbsolute3, relative as relative10, resolve as resolve44 } from "node:path";
52010
52099
  function isInsideRepo(p) {
52011
- const rel = relative9(REPO_ROOT3, resolve44(p));
52100
+ const rel = relative10(REPO_ROOT3, resolve44(p));
52012
52101
  return rel !== "" && !rel.startsWith("..") && !isAbsolute3(rel);
52013
52102
  }
52014
52103
  function assertCredentialOutsideRepo(label2, p) {
@@ -52086,17 +52175,17 @@ __export(credential_profile_exports, {
52086
52175
  });
52087
52176
  import { existsSync as existsSync59, readFileSync as readFileSync65 } from "node:fs";
52088
52177
  import { homedir as homedir5 } from "node:os";
52089
- import { join as join55 } from "node:path";
52178
+ import { join as join56 } from "node:path";
52090
52179
  function credentialsDir(home = homedir5()) {
52091
- return join55(home, ".himalaya", "store-credentials");
52180
+ return join56(home, ".himalaya", "store-credentials");
52092
52181
  }
52093
52182
  function profilePath(name, home = homedir5()) {
52094
52183
  if (!PROFILE_NAME.test(name)) {
52095
52184
  throw new Error(
52096
- `credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join55(credentialsDir(home), "<name>.json")}; it is never a path.`
52185
+ `credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join56(credentialsDir(home), "<name>.json")}; it is never a path.`
52097
52186
  );
52098
52187
  }
52099
- return join55(credentialsDir(home), `${name}.json`);
52188
+ return join56(credentialsDir(home), `${name}.json`);
52100
52189
  }
52101
52190
  function parseProfile(text5, label2) {
52102
52191
  let doc;
@@ -52210,7 +52299,7 @@ __export(preflight_app_exports, {
52210
52299
  });
52211
52300
  import { readFileSync as readFileSync66, existsSync as existsSync60, readdirSync as readdirSync28, statSync as statSync15 } from "node:fs";
52212
52301
  import { createHash as createHash26 } from "node:crypto";
52213
- import { join as join56 } from "node:path";
52302
+ import { join as join57 } from "node:path";
52214
52303
  function analyze(projectYml, storeConfig, icon, account) {
52215
52304
  const f = [];
52216
52305
  const has = (re, s) => re.test(s);
@@ -52280,7 +52369,7 @@ async function preflightApp(app, opts = {}) {
52280
52369
  const findings = analyze(
52281
52370
  projectYml,
52282
52371
  storeConfig,
52283
- await appIconState(join56(appDir(app), "ios")),
52372
+ await appIconState(join57(appDir(app), "ios")),
52284
52373
  profileAccount(app, storeConfig, opts)
52285
52374
  );
52286
52375
  findings.push(...analyzeListing(metadataFilesPresent(app), listScreenshots(app)));
@@ -52309,16 +52398,16 @@ function analyzeSubmissionRecord(appLevel, review, opts) {
52309
52398
  return f;
52310
52399
  }
52311
52400
  function appLevelMetadataFiles(app, locale = "en-US") {
52312
- const root = join56(storeDir(app), "metadata");
52401
+ const root = join57(storeDir(app), "metadata");
52313
52402
  const out = /* @__PURE__ */ new Set();
52314
52403
  if (existsSync60(root)) {
52315
52404
  for (const n of readdirSync28(root)) if (n.endsWith(".txt")) out.add(n);
52316
52405
  }
52317
- if (existsSync60(join56(root, locale, "privacy_url.txt"))) out.add("privacy_url.txt");
52406
+ if (existsSync60(join57(root, locale, "privacy_url.txt"))) out.add("privacy_url.txt");
52318
52407
  return out;
52319
52408
  }
52320
52409
  function reviewInfoFiles(app) {
52321
- const dir = join56(storeDir(app), "review_information");
52410
+ const dir = join57(storeDir(app), "review_information");
52322
52411
  if (!existsSync60(dir)) return /* @__PURE__ */ new Set();
52323
52412
  return new Set(readdirSync28(dir).filter((n) => n.endsWith(".txt")));
52324
52413
  }
@@ -52429,10 +52518,10 @@ function analyzePlayListing(assets) {
52429
52518
  return f;
52430
52519
  }
52431
52520
  function playListingAssets(app, locale = "en-US") {
52432
- const dir = join56(storeDir(app), "play", locale, "images");
52521
+ const dir = join57(storeDir(app), "play", locale, "images");
52433
52522
  const read = (names) => {
52434
52523
  for (const name of names) {
52435
- const p = join56(dir, name);
52524
+ const p = join57(dir, name);
52436
52525
  try {
52437
52526
  if (statSync15(p).isFile()) return { name, bytes: readFileSync66(p) };
52438
52527
  } catch {
@@ -52465,26 +52554,26 @@ function analyzeListing(metaFiles, shots) {
52465
52554
  return f;
52466
52555
  }
52467
52556
  function metadataFilesPresent(app, locale = "en-US") {
52468
- const dir = join56(storeDir(app), "metadata", locale);
52557
+ const dir = join57(storeDir(app), "metadata", locale);
52469
52558
  if (!existsSync60(dir)) return /* @__PURE__ */ new Set();
52470
52559
  return new Set(readdirSync28(dir).filter((n) => n.endsWith(".txt")));
52471
52560
  }
52472
52561
  function listScreenshots(app, locale = "en-US") {
52473
52562
  const out = [];
52474
- const flat = join56(storeDir(app), "screenshots", locale);
52563
+ const flat = join57(storeDir(app), "screenshots", locale);
52475
52564
  if (existsSync60(flat)) {
52476
52565
  for (const png of readdirSync28(flat).filter((n) => n.endsWith(".png"))) {
52477
- const sz = pngSize(readFileSync66(join56(flat, png)));
52566
+ const sz = pngSize(readFileSync66(join57(flat, png)));
52478
52567
  if (sz) out.push({ name: png, w: sz.w, h: sz.h });
52479
52568
  }
52480
52569
  }
52481
- const legacy = join56(storeDir(app), "metadata", locale, "screenshots");
52570
+ const legacy = join57(storeDir(app), "metadata", locale, "screenshots");
52482
52571
  if (existsSync60(legacy)) {
52483
52572
  for (const deviceDir of readdirSync28(legacy)) {
52484
- const d = join56(legacy, deviceDir);
52573
+ const d = join57(legacy, deviceDir);
52485
52574
  if (!statSync15(d).isDirectory()) continue;
52486
52575
  for (const png of readdirSync28(d).filter((n) => n.endsWith(".png"))) {
52487
- const sz = pngSize(readFileSync66(join56(d, png)));
52576
+ const sz = pngSize(readFileSync66(join57(d, png)));
52488
52577
  if (sz) out.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
52489
52578
  }
52490
52579
  }
@@ -52492,10 +52581,10 @@ function listScreenshots(app, locale = "en-US") {
52492
52581
  return out;
52493
52582
  }
52494
52583
  function placeholderHashes2() {
52495
- const templateIos = join56(appDir("_template"), "ios");
52584
+ const templateIos = join57(appDir("_template"), "ios");
52496
52585
  if (!existsSync60(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
52497
52586
  for (const target of readdirSync28(templateIos)) {
52498
- const p = join56(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52587
+ const p = join57(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52499
52588
  try {
52500
52589
  if (!statSync15(p).isFile()) continue;
52501
52590
  return [LEGACY_PLACEHOLDER_SHA2562, createHash26("sha256").update(readFileSync66(p)).digest("hex")];
@@ -52531,7 +52620,7 @@ async function pixelIssues(bytes2) {
52531
52620
  async function appIconState(iosDir) {
52532
52621
  if (!existsSync60(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
52533
52622
  for (const target of readdirSync28(iosDir)) {
52534
- const p = join56(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52623
+ const p = join57(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52535
52624
  try {
52536
52625
  if (!statSync15(p).isFile()) continue;
52537
52626
  const bytes2 = readFileSync66(p);
@@ -52817,7 +52906,7 @@ var init_asc_status = __esm({
52817
52906
  // ../../core/functions-secrets/src/vault.ts
52818
52907
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes5 } from "node:crypto";
52819
52908
  import { mkdir, readFile as readFile2, rename, writeFile as writeFile2 } from "node:fs/promises";
52820
- import { dirname as dirname30 } from "node:path";
52909
+ import { dirname as dirname31 } from "node:path";
52821
52910
  function createJsonSecretStore(filePath) {
52822
52911
  const read = async () => {
52823
52912
  try {
@@ -52830,7 +52919,7 @@ function createJsonSecretStore(filePath) {
52830
52919
  }
52831
52920
  };
52832
52921
  const write2 = async (records) => {
52833
- await mkdir(dirname30(filePath), { recursive: true });
52922
+ await mkdir(dirname31(filePath), { recursive: true });
52834
52923
  const temporary = `${filePath}.${process.pid}.tmp`;
52835
52924
  await writeFile2(temporary, `${JSON.stringify(records, null, 2)}
52836
52925
  `, { mode: 384 });
@@ -53026,9 +53115,9 @@ __export(notify_exports, {
53026
53115
  });
53027
53116
  import { chmodSync as chmodSync3, mkdirSync as mkdirSync28, readFileSync as readFileSync71, writeFileSync as writeFileSync25 } from "node:fs";
53028
53117
  import { homedir as homedir6 } from "node:os";
53029
- import { dirname as dirname31, join as join57 } from "node:path";
53118
+ import { dirname as dirname32, join as join58 } from "node:path";
53030
53119
  function defaultSessionsPath() {
53031
- return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join57(homedir6(), ".himalaya", "admin-sessions.json");
53120
+ return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join58(homedir6(), ".himalaya", "admin-sessions.json");
53032
53121
  }
53033
53122
  function loadSessionsFile(path2 = defaultSessionsPath()) {
53034
53123
  try {
@@ -53040,10 +53129,10 @@ function loadSessionsFile(path2 = defaultSessionsPath()) {
53040
53129
  function saveAdminSession(adminUrl, session, path2 = defaultSessionsPath()) {
53041
53130
  const file = loadSessionsFile(path2);
53042
53131
  file.sessions = { ...file.sessions, [adminUrl]: session };
53043
- mkdirSync28(dirname31(path2), { recursive: true, mode: 448 });
53132
+ mkdirSync28(dirname32(path2), { recursive: true, mode: 448 });
53044
53133
  writeFileSync25(path2, JSON.stringify(file, null, 2) + "\n", { mode: 384 });
53045
53134
  try {
53046
- chmodSync3(dirname31(path2), 448);
53135
+ chmodSync3(dirname32(path2), 448);
53047
53136
  chmodSync3(path2, 384);
53048
53137
  } catch {
53049
53138
  }
@@ -56972,7 +57061,7 @@ var init_brand_font = __esm({
56972
57061
 
56973
57062
  // src/site-analyze/write-artifacts.ts
56974
57063
  import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync26 } from "node:fs";
56975
- import { join as join58 } from "node:path";
57064
+ import { join as join59 } from "node:path";
56976
57065
  function attachVeloSources(book, sources, put) {
56977
57066
  const byPath = new Map((sources ?? []).map((s) => [s.path, s.text]));
56978
57067
  for (const f of book.velo.files) {
@@ -57127,12 +57216,12 @@ async function downloadMedia(book, fetchImpl, put) {
57127
57216
  }
57128
57217
  async function writeBusinessBook(result, opts) {
57129
57218
  const out = opts.outDir;
57130
- mkdirSync29(join58(out, "evidence/pages"), { recursive: true });
57131
- mkdirSync29(join58(out, "media/catalog"), { recursive: true });
57219
+ mkdirSync29(join59(out, "evidence/pages"), { recursive: true });
57220
+ mkdirSync29(join59(out, "media/catalog"), { recursive: true });
57132
57221
  const files = [];
57133
57222
  const put = (rel, body) => {
57134
- const p = join58(out, rel);
57135
- mkdirSync29(join58(p, ".."), { recursive: true });
57223
+ const p = join59(out, rel);
57224
+ mkdirSync29(join59(p, ".."), { recursive: true });
57136
57225
  writeFileSync26(p, body);
57137
57226
  files.push(rel);
57138
57227
  };
@@ -57227,7 +57316,7 @@ var init_customer_build = __esm({
57227
57316
 
57228
57317
  // src/site-analyze/apply.ts
57229
57318
  import { existsSync as existsSync61, readFileSync as readFileSync72, writeFileSync as writeFileSync27, copyFileSync as copyFileSync3, mkdirSync as mkdirSync30, realpathSync as realpathSync8, statSync as statSync16 } from "node:fs";
57230
- import { dirname as dirname32, isAbsolute as isAbsolute4, join as join59, resolve as resolve45, sep as sep14 } from "node:path";
57319
+ import { dirname as dirname33, isAbsolute as isAbsolute4, join as join60, resolve as resolve45, sep as sep14 } from "node:path";
57231
57320
  import { spawnSync as spawnSync4 } from "node:child_process";
57232
57321
  function unpairedRedirectNote(overlay) {
57233
57322
  if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
@@ -57242,8 +57331,8 @@ function committedShellProvisioning(path2) {
57242
57331
  function findRepoRoot(cwd) {
57243
57332
  let dir = cwd;
57244
57333
  for (let i = 0; i < 8; i++) {
57245
- if (SHELL_NAMES2.some((name) => existsSync61(join59(dir, shellAppDir(name), "package.json")))) return dir;
57246
- const next = dirname32(dir);
57334
+ if (SHELL_NAMES2.some((name) => existsSync61(join60(dir, shellAppDir(name), "package.json")))) return dir;
57335
+ const next = dirname33(dir);
57247
57336
  if (next === dir) break;
57248
57337
  dir = next;
57249
57338
  }
@@ -57311,7 +57400,7 @@ function mergeCustomerOwned(committed, overlay) {
57311
57400
  }
57312
57401
  function buildMergedContract(options) {
57313
57402
  const { appDir: appDir2, packageDir, overlay } = options;
57314
- const committedPath = join59(appDir2, "provisioning.json");
57403
+ const committedPath = join60(appDir2, "provisioning.json");
57315
57404
  if (!existsSync61(committedPath)) {
57316
57405
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
57317
57406
  }
@@ -57327,7 +57416,7 @@ function buildMergedContract(options) {
57327
57416
  };
57328
57417
  const stage = (fromRel, toRel) => {
57329
57418
  const from = contained(packageDir, fromRel);
57330
- const to = contained(join59(appDir2, STAGED), toRel.slice(STAGED.length + 1));
57419
+ const to = contained(join60(appDir2, STAGED), toRel.slice(STAGED.length + 1));
57331
57420
  if (!from || !to || !existsSync61(from)) return void 0;
57332
57421
  let real;
57333
57422
  let realRoot;
@@ -57340,7 +57429,7 @@ function buildMergedContract(options) {
57340
57429
  if (!real.startsWith(realRoot + sep14)) return void 0;
57341
57430
  try {
57342
57431
  if (!statSync16(real).isFile()) return void 0;
57343
- mkdirSync30(dirname32(to), { recursive: true });
57432
+ mkdirSync30(dirname33(to), { recursive: true });
57344
57433
  copyFileSync3(real, to);
57345
57434
  } catch {
57346
57435
  return void 0;
@@ -57350,7 +57439,7 @@ function buildMergedContract(options) {
57350
57439
  };
57351
57440
  const icon = stage("media/icon.png", `${STAGED}/icon.png`);
57352
57441
  if (icon) branding.appIconPath = icon;
57353
- const facesPath = join59(packageDir, "media/fonts/faces.json");
57442
+ const facesPath = join60(packageDir, "media/fonts/faces.json");
57354
57443
  if (existsSync61(facesPath)) {
57355
57444
  let faces = [];
57356
57445
  try {
@@ -57375,10 +57464,10 @@ function buildMergedContract(options) {
57375
57464
  merged.branding = branding;
57376
57465
  const body = `${JSON.stringify(merged, null, 2)}
57377
57466
  `;
57378
- const path2 = join59(packageDir, "provisioning.contract.json");
57467
+ const path2 = join60(packageDir, "provisioning.contract.json");
57379
57468
  writeFileSync27(path2, body);
57380
- const localPath = join59(appDir2, LOCAL_CONTRACT_REL);
57381
- mkdirSync30(dirname32(localPath), { recursive: true });
57469
+ const localPath = join60(appDir2, LOCAL_CONTRACT_REL);
57470
+ mkdirSync30(dirname33(localPath), { recursive: true });
57382
57471
  writeFileSync27(localPath, body);
57383
57472
  staged.push(localPath);
57384
57473
  return { path: path2, staged };
@@ -57412,7 +57501,7 @@ function catalogTypography(overlay, template) {
57412
57501
  function staticFaqFor(overlay, overlayPath) {
57413
57502
  const own3 = overlay.faq;
57414
57503
  if (own3 !== void 0) return deriveStaticFaq(own3);
57415
- const bookPath = join59(dirname32(resolve45(overlayPath)), "book.json");
57504
+ const bookPath = join60(dirname33(resolve45(overlayPath)), "book.json");
57416
57505
  if (!existsSync61(bookPath)) return void 0;
57417
57506
  try {
57418
57507
  const book = JSON.parse(readFileSync72(bookPath, "utf8"));
@@ -57442,8 +57531,8 @@ async function applyOverlays(input) {
57442
57531
  `shell "${shell}" cannot bake a customer brand \u2014 it ships no prepare:customer script`
57443
57532
  );
57444
57533
  }
57445
- const appDir2 = join59(repoRoot2, shellAppDir(shell));
57446
- const packageDir = dirname32(resolve45(input.overlayPath));
57534
+ const appDir2 = join60(repoRoot2, shellAppDir(shell));
57535
+ const packageDir = dirname33(resolve45(input.overlayPath));
57447
57536
  const { path: contract, staged } = buildMergedContract({ appDir: appDir2, packageDir, overlay });
57448
57537
  wrote.push(...staged);
57449
57538
  const r = spawnSync4("npm", ["run", "prepare:customer", "--", "--contract", contract], {
@@ -57464,7 +57553,7 @@ async function applyOverlays(input) {
57464
57553
  note: `prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
57465
57554
  };
57466
57555
  }
57467
- const pkgProv = join59(cwd, "provisioning.json");
57556
+ const pkgProv = join60(cwd, "provisioning.json");
57468
57557
  assertNotCommitted(pkgProv, input.forbiddenProvisioning);
57469
57558
  let packageFaq = faq;
57470
57559
  if (existsSync61(pkgProv)) {
@@ -57477,7 +57566,7 @@ async function applyOverlays(input) {
57477
57566
  writeFileSync27(pkgProv, JSON.stringify(overlay, null, 2) + "\n");
57478
57567
  wrote.push(pkgProv);
57479
57568
  }
57480
- const pkgTokens = join59(cwd, "tokens.json");
57569
+ const pkgTokens = join60(cwd, "tokens.json");
57481
57570
  if (existsSync61(pkgTokens) && (tokens.colors || tokens.typography)) {
57482
57571
  const cur = JSON.parse(readFileSync72(pkgTokens, "utf8"));
57483
57572
  let tokensIn = tokens;
@@ -57504,7 +57593,7 @@ async function applyOverlays(input) {
57504
57593
  wrote.push(pkgTokens);
57505
57594
  }
57506
57595
  const homeAction = homeRefreshActionId(shell);
57507
- const homeSrc = join59(cwd, "dev/index.ts");
57596
+ const homeSrc = join60(cwd, "dev/index.ts");
57508
57597
  if (homeAction && existsSync61(homeSrc)) {
57509
57598
  const prev = readFileSync72(homeSrc, "utf8");
57510
57599
  const patched = patchBrandParams(prev, overlay, homeAction);
@@ -57538,7 +57627,7 @@ async function applyOverlays(input) {
57538
57627
  }
57539
57628
  }
57540
57629
  if (!input.iconPath || !existsSync61(input.iconPath)) {
57541
- const book = input.iconPath ? dirname32(dirname32(resolve45(input.iconPath))) : void 0;
57630
+ const book = input.iconPath ? dirname33(dirname33(resolve45(input.iconPath))) : void 0;
57542
57631
  notes.push(
57543
57632
  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"
57544
57633
  );
@@ -62914,7 +63003,7 @@ import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync75, mkdirSync
62914
63003
  import { execFile, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn6 } from "node:child_process";
62915
63004
  import { createHash as createHash27, randomUUID as randomUUID5 } from "node:crypto";
62916
63005
  import { tmpdir as tmpdir5, homedir as homedir7, hostname } from "node:os";
62917
- import { join as join60, resolve as resolve47, relative as relative10, basename as basename14, dirname as dirname33 } from "node:path";
63006
+ import { join as join61, resolve as resolve47, relative as relative11, basename as basename15, dirname as dirname34 } from "node:path";
62918
63007
  import { fileURLToPath as fileURLToPath24 } from "node:url";
62919
63008
 
62920
63009
  // ../serve-cli/src/client.ts
@@ -66035,7 +66124,7 @@ var str6 = (v) => typeof v === "string" ? v : void 0;
66035
66124
  var num2 = (v) => typeof v === "string" && v !== "" && Number.isFinite(Number(v)) ? Number(v) : void 0;
66036
66125
  function embeddedTemplateCatalog() {
66037
66126
  return availableTemplates().map((name) => {
66038
- const path2 = join60(templateSourceDir(name), TEMPLATE_META_FILE);
66127
+ const path2 = join61(templateSourceDir(name), TEMPLATE_META_FILE);
66039
66128
  const meta = JSON.parse(readFileSync75(path2, "utf8"));
66040
66129
  if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
66041
66130
  throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
@@ -66839,9 +66928,9 @@ function packageVersion(path2) {
66839
66928
  function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("./authoring-runtime/node_modules/@wix/himalaya/package.json", import.meta.url)) {
66840
66929
  let dir = resolve47(fromDir);
66841
66930
  for (; ; ) {
66842
- const version2 = packageVersion(join60(dir, "node_modules", "@wix", "himalaya", "package.json"));
66931
+ const version2 = packageVersion(join61(dir, "node_modules", "@wix", "himalaya", "package.json"));
66843
66932
  if (version2) return { version: version2, source: "local" };
66844
- const parent = dirname33(dir);
66933
+ const parent = dirname34(dir);
66845
66934
  if (parent === dir) break;
66846
66935
  dir = parent;
66847
66936
  }
@@ -66849,7 +66938,7 @@ function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("
66849
66938
  if (bundled) return { version: bundled, source: "bundled" };
66850
66939
  try {
66851
66940
  const root = execFileSync7("npm", ["root", "-g"], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
66852
- const version2 = root ? packageVersion(join60(root, "@wix", "himalaya", "package.json")) : void 0;
66941
+ const version2 = root ? packageVersion(join61(root, "@wix", "himalaya", "package.json")) : void 0;
66853
66942
  return version2 ? { version: version2, source: "global" } : {};
66854
66943
  } catch {
66855
66944
  return {};
@@ -66896,7 +66985,7 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
66896
66985
  var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
66897
66986
  var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
66898
66987
  function updateCachePath(env = process.env) {
66899
- return env.HIMI_UPDATE_CACHE_FILE ?? join60(homedir7(), ".himalaya", "update-check.json");
66988
+ return env.HIMI_UPDATE_CACHE_FILE ?? join61(homedir7(), ".himalaya", "update-check.json");
66900
66989
  }
66901
66990
  function readUpdateCache(path2) {
66902
66991
  try {
@@ -66908,7 +66997,7 @@ function readUpdateCache(path2) {
66908
66997
  }
66909
66998
  function writeUpdateCache(path2, cache) {
66910
66999
  try {
66911
- mkdirSync31(dirname33(path2), { recursive: true, mode: 448 });
67000
+ mkdirSync31(dirname34(path2), { recursive: true, mode: 448 });
66912
67001
  writeFileSync29(path2, JSON.stringify(cache, null, 2) + "\n", { mode: 384 });
66913
67002
  } catch {
66914
67003
  }
@@ -66968,11 +67057,11 @@ function createUpdateRunner(spawn7 = spawnSync5) {
66968
67057
  },
66969
67058
  installedVersion: () => {
66970
67059
  const root = globalNodeModulesRoot();
66971
- return root ? packageVersion(join60(root, "@wix", "himalaya-cli", "package.json")) : void 0;
67060
+ return root ? packageVersion(join61(root, "@wix", "himalaya-cli", "package.json")) : void 0;
66972
67061
  },
66973
67062
  reexec: (argv) => {
66974
67063
  const root = globalNodeModulesRoot();
66975
- const entry = root ? join60(root, "@wix", "himalaya-cli", "dist", "cli.mjs") : void 0;
67064
+ const entry = root ? join61(root, "@wix", "himalaya-cli", "dist", "cli.mjs") : void 0;
66976
67065
  if (!entry || !existsSync63(entry)) return void 0;
66977
67066
  const result = spawnSync5(process.execPath, [entry, ...argv], {
66978
67067
  // inherit keeps PIPED STDIN working — commands that read stdin must survive a re-exec.
@@ -67064,7 +67153,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
67064
67153
  };
67065
67154
  const release = () => removeIfMine(lockPath);
67066
67155
  try {
67067
- mkdirSync31(dirname33(lockPath), { recursive: true, mode: 448 });
67156
+ mkdirSync31(dirname34(lockPath), { recursive: true, mode: 448 });
67068
67157
  } catch {
67069
67158
  return () => {
67070
67159
  };
@@ -67627,7 +67716,7 @@ function executableOnPath(name, env = process.env) {
67627
67716
  const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
67628
67717
  for (const dir of entries) {
67629
67718
  for (const suffix of suffixes) {
67630
- const candidate = join60(dir, `${name}${suffix}`);
67719
+ const candidate = join61(dir, `${name}${suffix}`);
67631
67720
  try {
67632
67721
  if (!statSync17(candidate).isFile()) continue;
67633
67722
  if (process.platform !== "win32") accessSync(candidate, constants2.X_OK);
@@ -67750,13 +67839,13 @@ async function nativeConfigAdvisories(app, configSource) {
67750
67839
  }
67751
67840
  function readConfigSource(dir) {
67752
67841
  try {
67753
- return readFileSync75(join60(dir, "config.ts"), "utf8");
67842
+ return readFileSync75(join61(dir, "config.ts"), "utf8");
67754
67843
  } catch {
67755
67844
  return null;
67756
67845
  }
67757
67846
  }
67758
67847
  function writePngFile(path2, base64) {
67759
- mkdirSync31(dirname33(path2), { recursive: true });
67848
+ mkdirSync31(dirname34(path2), { recursive: true });
67760
67849
  writeFileSync29(path2, Buffer.from(base64, "base64"));
67761
67850
  return path2;
67762
67851
  }
@@ -67786,7 +67875,7 @@ function keptPlan(kept) {
67786
67875
  }
67787
67876
  async function initFromRemoteTemplate(name, parentDir, template, c) {
67788
67877
  const dir = resolve47(parentDir, name);
67789
- if (existsSync63(join60(dir, "himalaya.content.json"))) {
67878
+ if (existsSync63(join61(dir, "himalaya.content.json"))) {
67790
67879
  throw new Error(`content package already exists at ${dir}`);
67791
67880
  }
67792
67881
  const r = await c.fetchTemplateSource(TEMPLATE_APP_PREFIX + template);
@@ -67844,8 +67933,8 @@ function restoreDestinationIssue(dest, force) {
67844
67933
  function isHimalayaMonorepoCheckout(start) {
67845
67934
  let dir = resolve47(start);
67846
67935
  for (; ; ) {
67847
- if (existsSync63(join60(dir, "tools", "himi-cli", "src", "cli.ts")) && existsSync63(join60(dir, "core", "serve", "src", "server.ts"))) return true;
67848
- const parent = dirname33(dir);
67936
+ if (existsSync63(join61(dir, "tools", "himi-cli", "src", "cli.ts")) && existsSync63(join61(dir, "core", "serve", "src", "server.ts"))) return true;
67937
+ const parent = dirname34(dir);
67849
67938
  if (parent === dir) return false;
67850
67939
  dir = parent;
67851
67940
  }
@@ -67882,7 +67971,7 @@ function shellShaDivergenceWarnings(jobs) {
67882
67971
  }
67883
67972
  async function templatePublishName(sourceDir) {
67884
67973
  const id = await appId(sourceDir);
67885
- return IDENTITY_SENTINELS.some((s) => id.includes(s)) ? basename14(sourceDir) : id;
67974
+ return IDENTITY_SENTINELS.some((s) => id.includes(s)) ? basename15(sourceDir) : id;
67886
67975
  }
67887
67976
  function templateNameError(name, from) {
67888
67977
  if (name.startsWith(TEMPLATE_APP_PREFIX)) {
@@ -67905,7 +67994,7 @@ function materializeForPreview(appDir2, slug, displayName) {
67905
67994
  Object.entries(files).map(([rel, body]) => [rel, rel === "himalaya.content.json" ? substituteIdentity(body, slug) : body])
67906
67995
  );
67907
67996
  const repoRoot2 = resolve47(fileURLToPath24(new URL("../../..", import.meta.url)));
67908
- const root = join60(repoRoot2, "node_modules", ".cache", "himi-template-preview");
67997
+ const root = join61(repoRoot2, "node_modules", ".cache", "himi-template-preview");
67909
67998
  const stillRunning = (pid) => {
67910
67999
  try {
67911
68000
  process.kill(pid, 0);
@@ -67919,12 +68008,12 @@ function materializeForPreview(appDir2, slug, displayName) {
67919
68008
  if (!entry.isDirectory()) continue;
67920
68009
  const pid = Number(entry.name.startsWith(`${slug}-`) ? entry.name.slice(slug.length + 1) : NaN);
67921
68010
  if (Number.isInteger(pid) && pid > 0 && pid !== process.pid && !stillRunning(pid)) {
67922
- rmSync14(join60(root, entry.name), { recursive: true, force: true });
68011
+ rmSync14(join61(root, entry.name), { recursive: true, force: true });
67923
68012
  }
67924
68013
  }
67925
68014
  } catch {
67926
68015
  }
67927
- const dest = join60(root, `${slug}-${process.pid}`);
68016
+ const dest = join61(root, `${slug}-${process.pid}`);
67928
68017
  rmSync14(dest, { recursive: true, force: true });
67929
68018
  mkdirSync31(dest, { recursive: true });
67930
68019
  try {
@@ -67938,16 +68027,16 @@ function materializeForPreview(appDir2, slug, displayName) {
67938
68027
  async function appId(dir) {
67939
68028
  try {
67940
68029
  const { readFileSync: readFileSync76 } = await import("node:fs");
67941
- const m = JSON.parse(readFileSync76(join60(dir, "himalaya.content.json"), "utf8"));
68030
+ const m = JSON.parse(readFileSync76(join61(dir, "himalaya.content.json"), "utf8"));
67942
68031
  if (m.name) return m.name;
67943
68032
  } catch {
67944
68033
  }
67945
- return basename14(dir);
68034
+ return basename15(dir);
67946
68035
  }
67947
68036
  async function contentVisibility(dir) {
67948
68037
  try {
67949
68038
  const { readFileSync: readFileSync76 } = await import("node:fs");
67950
- const m = JSON.parse(readFileSync76(join60(dir, "himalaya.content.json"), "utf8"));
68039
+ const m = JSON.parse(readFileSync76(join61(dir, "himalaya.content.json"), "utf8"));
67951
68040
  if (m.visibility === "public" || m.visibility === "unlisted") return m.visibility;
67952
68041
  } catch {
67953
68042
  }
@@ -68171,7 +68260,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
68171
68260
  ...res.removed.length ? { removed: res.removed, note: "older copies at the app root, moved to .himi/legacy-agent-files/ (a backup, in case one became app code) \u2014 the current ones live in .agents/skills/himalaya/" } : {},
68172
68261
  // In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
68173
68262
  // hash is shared with the repo gates and deliberately exempts nothing but its own metadata).
68174
- ...existsSync63(join60(dir, ".himi", "attestations", "latest.json")) ? { next: "if `himi push` then refuses the attestation as stale, re-run `himi test` \u2014 in a git checkout this refresh changed the tree it covered" } : {},
68263
+ ...existsSync63(join61(dir, ".himi", "attestations", "latest.json")) ? { next: "if `himi push` then refuses the attestation as stale, re-run `himi test` \u2014 in a git checkout this refresh changed the tree it covered" } : {},
68175
68264
  ...res.skipped.length ? { skipped: res.skipped } : {},
68176
68265
  portalUrl: idx.portalUrl
68177
68266
  });
@@ -68194,7 +68283,7 @@ async function recordedReleaseForContentQuietly(dir, resolution, onDrift) {
68194
68283
  try {
68195
68284
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
68196
68285
  const bres = await buildContentForValidation2(dir, { resolution });
68197
- out = mkdtempSync4(join60(tmpdir5(), "himi-ux-record-"));
68286
+ out = mkdtempSync4(join61(tmpdir5(), "himi-ux-record-"));
68198
68287
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
68199
68288
  const outcome = await buildReleaseFromContent2(dir, out, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {}, collect: { lint: true } });
68200
68289
  const releaseId = outcome.manifest.releaseId;
@@ -68372,7 +68461,7 @@ async function producedWidgetFamilies(dir) {
68372
68461
  let js;
68373
68462
  for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
68374
68463
  try {
68375
- js = readFileSync75(join60(outDir, candidate), "utf8");
68464
+ js = readFileSync75(join61(outDir, candidate), "utf8");
68376
68465
  break;
68377
68466
  } catch {
68378
68467
  }
@@ -68403,7 +68492,7 @@ async function producedWidgetFamilies(dir) {
68403
68492
  }
68404
68493
  return { families, source: "dist/bundles" };
68405
68494
  }
68406
- var boardOpen = (dir) => existsSync63(join60(dir, ".himi", "studio", "index.html"));
68495
+ var boardOpen = (dir) => existsSync63(join61(dir, ".himi", "studio", "index.html"));
68407
68496
  var BOARD_REFRESHERS = /* @__PURE__ */ new Set(["render", "test", "validate", "build", "push", "icon", "site", "ux", "progress"]);
68408
68497
  async function leaveForBoard(dir, record2, value) {
68409
68498
  if (!boardOpen(dir)) return;
@@ -68683,7 +68772,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68683
68772
  const owed = openApprovals2(readApprovals2(dir).events).length;
68684
68773
  next.push(`carried the planning journal into the app (${carried.join(", ")}${owed ? `; ${owed} approval${owed === 1 ? "" : "s"} still owed` : ""}) \u2014 \`himi progress --brief\` there shows it`);
68685
68774
  }
68686
- const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f) => existsSync63(join60(parentDir, f)));
68775
+ const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f) => existsSync63(join61(parentDir, f)));
68687
68776
  if (planInParent.length) {
68688
68777
  next.push(`${planInParent.join(" and ")} in ${parentDir} ${planInParent.length > 1 ? "are" : "is"} not the app's \u2014 if that is the approved plan, move it over the template's boilerplate in ${dir}`);
68689
68778
  }
@@ -68810,7 +68899,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68810
68899
  const sourceDir = resolve47(str6(flags["source-dir"]) ?? appDir2);
68811
68900
  let meta;
68812
68901
  try {
68813
- meta = JSON.parse(readFileSync75(join60(sourceDir, TEMPLATE_META_FILE), "utf8"));
68902
+ meta = JSON.parse(readFileSync75(join61(sourceDir, TEMPLATE_META_FILE), "utf8"));
68814
68903
  } catch {
68815
68904
  io.error(JSON.stringify({ error: `no ${TEMPLATE_META_FILE} in ${sourceDir} \u2014 a template must declare { title, description, tags } to be published`, hint: `add ${TEMPLATE_META_FILE} next to himalaya.content.json (or pass --source-dir <dir>)` }));
68816
68905
  return 2;
@@ -68820,7 +68909,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68820
68909
  return 2;
68821
68910
  }
68822
68911
  try {
68823
- const appearance = extractTemplateAppearance(JSON.parse(readFileSync75(join60(sourceDir, "tokens.json"), "utf8")));
68912
+ const appearance = extractTemplateAppearance(JSON.parse(readFileSync75(join61(sourceDir, "tokens.json"), "utf8")));
68824
68913
  meta = { ...appearance, ...meta };
68825
68914
  } catch {
68826
68915
  }
@@ -68842,7 +68931,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68842
68931
  const force = flags.force === true;
68843
68932
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
68844
68933
  const bres = await buildContentForValidation2(buildDir, { resolution: resolutionFlag(flags) });
68845
- const out = mkdtempSync4(join60(tmpdir5(), "himi-template-"));
68934
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-template-"));
68846
68935
  publishScratch.push(out);
68847
68936
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
68848
68937
  const outcome = await buildReleaseFromContent2(buildDir, out, {
@@ -69138,7 +69227,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69138
69227
  const { navIssues: navIssues2 } = await Promise.resolve().then(() => (init_nav_lint(), nav_lint_exports));
69139
69228
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
69140
69229
  const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
69141
- const out = mkdtempSync4(join60(tmpdir5(), "himi-validate-"));
69230
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-validate-"));
69142
69231
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
69143
69232
  const outcome = await buildReleaseFromContent2(dir, out, {
69144
69233
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -69301,15 +69390,15 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69301
69390
  case "studio": {
69302
69391
  const { openStudio: openStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
69303
69392
  const dir = contentDir(flags);
69304
- if (!existsSync63(join60(dir, "himalaya.content.json"))) {
69393
+ if (!existsSync63(join61(dir, "himalaya.content.json"))) {
69305
69394
  io.error(JSON.stringify({ ok: false, error: "not_a_content_package", dir, hint: "run from the app directory (or pass --content <dir>) \u2014 the board reads that package's .himi/" }));
69306
69395
  return 2;
69307
69396
  }
69308
69397
  if (pos[1] === "reel") {
69309
69398
  const { buildReel: buildReel2 } = await Promise.resolve().then(() => (init_studio_reel(), studio_reel_exports));
69310
- const out = resolve47(str6(flags.out) ?? join60(dir, ".himi", "making-of.html"));
69399
+ const out = resolve47(str6(flags.out) ?? join61(dir, ".himi", "making-of.html"));
69311
69400
  const { html, plan } = buildReel2(dir);
69312
- mkdirSync31(dirname33(out), { recursive: true });
69401
+ mkdirSync31(dirname34(out), { recursive: true });
69313
69402
  writeFileSync29(out, html);
69314
69403
  const { pathToFileURL: pathToFileURL9 } = await import("node:url");
69315
69404
  const url2 = pathToFileURL9(out).href;
@@ -69374,7 +69463,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69374
69463
  } = await Promise.resolve().then(() => (init_progress(), progress_exports));
69375
69464
  const dir = contentDir(flags);
69376
69465
  const journal = journalPath2(dir);
69377
- const isContentPackage = existsSync63(join60(dir, "himalaya.content.json"));
69466
+ const isContentPackage = existsSync63(join61(dir, "himalaya.content.json"));
69378
69467
  const hint = isContentPackage ? {} : { hint: "no himalaya.content.json here \u2014 run from the app directory (or pass --content <dir>) so the build board finds this journal" };
69379
69468
  const message = pos.slice(1).join(" ").trim();
69380
69469
  const approvalFlags = ["approve", "done", "drop"].filter((f) => flags[f] !== void 0);
@@ -69510,7 +69599,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69510
69599
  case "test": {
69511
69600
  const dir = contentDir(flags);
69512
69601
  const structuredOutput = flags.json === true || io.isTTY !== true;
69513
- if (existsSync63(join60(dir, "functions"))) {
69602
+ if (existsSync63(join61(dir, "functions"))) {
69514
69603
  const { invokeLocalFunction: invokeLocalFunction2, loadFunctionsApp: loadFunctionsApp2 } = await Promise.resolve().then(() => (init_functions(), functions_exports));
69515
69604
  const loaded = await loadFunctionsApp2(dir);
69516
69605
  const results = [];
@@ -69597,7 +69686,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69597
69686
  }
69598
69687
  }
69599
69688
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
69600
- const out = mkdtempSync4(join60(tmpdir5(), "himi-test-"));
69689
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-test-"));
69601
69690
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
69602
69691
  const outcome = await buildReleaseFromContent2(dir, out, {
69603
69692
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -69642,7 +69731,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69642
69731
  io.error(JSON.stringify({ error: `screen "${screen.screenId}" has no Tier-5 worker, so there is nothing for the browser loop to build` }));
69643
69732
  return 2;
69644
69733
  }
69645
- const sources = collectWorkerSources2(join60(dir, "tier5-src"), screen.bundleName);
69734
+ const sources = collectWorkerSources2(join61(dir, "tier5-src"), screen.bundleName);
69646
69735
  if (!sources) {
69647
69736
  io.error(JSON.stringify({ error: `no worker source found at tier5-src/${screen.bundleName} \u2014 the browser loop compiles SOURCE, not the built bundle` }));
69648
69737
  return 2;
@@ -69803,7 +69892,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69803
69892
  const sp = await runShotsPass2({
69804
69893
  descriptors: scopeDescriptors2(outcome.descriptors ?? [], pos.slice(1), invalidScreens),
69805
69894
  tokens: outcome.tokens,
69806
- outDir: join60(dir, ".himi", "shots"),
69895
+ outDir: join61(dir, ".himi", "shots"),
69807
69896
  width: 390,
69808
69897
  layers: { rules: shotRules, ...cmsSeed ? { cmsSeed } : {}, ...canned ? { canned: canned.byKey } : {} },
69809
69898
  ...budgetMs ? { budgetMs } : {},
@@ -69841,7 +69930,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69841
69930
  releaseId: result.releaseId,
69842
69931
  releasePayload: release,
69843
69932
  descriptors: attestedDescriptors,
69844
- screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""), join60(dir, ".himi", "shots", name)])),
69933
+ screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""), join61(dir, ".himi", "shots", name)])),
69845
69934
  coverage: {
69846
69935
  screens: crawledScreens.size,
69847
69936
  actionsDispatched: result.actions.exercised,
@@ -69995,7 +70084,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69995
70084
  }
69996
70085
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
69997
70086
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
69998
- const out = mkdtempSync4(join60(tmpdir5(), "himi-render-"));
70087
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-render-"));
69999
70088
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
70000
70089
  const outcome = await buildReleaseFromContent2(dir, out, {
70001
70090
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -70009,7 +70098,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
70009
70098
  const diagnostics = (outcome.lint ?? []).find((s) => s.screenId === screenId)?.issues ?? [];
70010
70099
  let pngFile;
70011
70100
  let attestationPngFile;
70012
- const shotPath = join60(dir, ".himi", "shots", `${screenId}.png`);
70101
+ const shotPath = join61(dir, ".himi", "shots", `${screenId}.png`);
70013
70102
  const pngTarget = typeof flags.png === "string" ? str6(flags.png) : flags.png === true ? shotPath : void 0;
70014
70103
  if (pngTarget && r.pngBase64) {
70015
70104
  pngFile = writePngFile(pngTarget, r.pngBase64);
@@ -70358,7 +70447,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
70358
70447
  io.error(JSON.stringify({ error: `${dest} already exists and is not empty`, hint: "pass --force to write into it anyway (merging, and naming what it keeps), --replace to restore exactly what was archived, or --out/--name to land somewhere else" }));
70359
70448
  return 1;
70360
70449
  }
70361
- if (replace && occupied && !existsSync63(join60(dest, "himalaya.content.json"))) {
70450
+ if (replace && occupied && !existsSync63(join61(dest, "himalaya.content.json"))) {
70362
70451
  io.error(JSON.stringify({
70363
70452
  error: `${dest} is not a content package \u2014 refusing to --replace it`,
70364
70453
  hint: "--replace only clears a directory that holds himalaya.content.json. Check --out/--name, or pass --force to merge into it instead."
@@ -70499,7 +70588,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
70499
70588
  const force = flags.force === true;
70500
70589
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
70501
70590
  const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
70502
- const out = mkdtempSync4(join60(tmpdir5(), "himi-push-"));
70591
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-push-"));
70503
70592
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
70504
70593
  const outcome = await buildReleaseFromContent2(dir, out, {
70505
70594
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -70525,7 +70614,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
70525
70614
  const manifest = outcome.manifest;
70526
70615
  const payload = await loadReleaseFromDir(declared, out);
70527
70616
  const { shellQuote: shellQuote2 } = await Promise.resolve().then(() => (init_shell_quote(), shell_quote_exports));
70528
- const contentRel = relative10(process.cwd(), dir) || ".";
70617
+ const contentRel = relative11(process.cwd(), dir) || ".";
70529
70618
  const contentArg = shellQuote2(contentRel);
70530
70619
  if (onlyRaw !== void 0) {
70531
70620
  const onlyDraft = flags.draft === true;
@@ -71020,7 +71109,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71020
71109
  }
71021
71110
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
71022
71111
  const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
71023
- const built = mkdtempSync4(join60(tmpdir5(), "himi-pack-"));
71112
+ const built = mkdtempSync4(join61(tmpdir5(), "himi-pack-"));
71024
71113
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
71025
71114
  const outcome = await buildReleaseFromContent2(dir, built, {
71026
71115
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -71279,11 +71368,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71279
71368
  const app = await appId(dir2);
71280
71369
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
71281
71370
  const bres = await buildContentBundles2(dir2, { resolution: resolutionFlag(flags) });
71282
- temp = mkdtempSync4(join60(tmpdir5(), "himi-run-build-"));
71371
+ temp = mkdtempSync4(join61(tmpdir5(), "himi-run-build-"));
71283
71372
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
71284
71373
  const initial = await buildReleaseFromContent2(dir2, temp, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir2) } : {} });
71285
71374
  servedMissing = initial.missingBundles;
71286
- source = join60(temp, app);
71375
+ source = join61(temp, app);
71287
71376
  }
71288
71377
  const chromeArg = str6(flags.chrome) ?? "preview";
71289
71378
  if (chromeArg !== "preview" && chromeArg !== "app") {
@@ -71319,7 +71408,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71319
71408
  if (!recordKit) return;
71320
71409
  startedAt = (/* @__PURE__ */ new Date()).toISOString();
71321
71410
  const failure = record2(served2, { ok: true, at: startedAt });
71322
- if (!recorded) io.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${join60(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
71411
+ if (!recorded) io.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${join61(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
71323
71412
  await refreshBoard();
71324
71413
  };
71325
71414
  const retract = async () => {
@@ -71350,7 +71439,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71350
71439
  }
71351
71440
  const watchKit = watch2 ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
71352
71441
  const bus = watchKit ? new watchKit.ReloadBus() : void 0;
71353
- if (watch2) served = mkdtempSync4(join60(tmpdir5(), "himi-run-served-"));
71442
+ if (watch2) served = mkdtempSync4(join61(tmpdir5(), "himi-run-served-"));
71354
71443
  const running = await runPackage2(source, {
71355
71444
  port,
71356
71445
  chrome: chromeArg,
@@ -71371,8 +71460,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71371
71460
  await announce(running);
71372
71461
  if (watchKit && bus) {
71373
71462
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
71374
- const live2 = join60(running.releaseRoot, running.app);
71375
- const manifestOf = (tree) => JSON.parse(readFileSync75(join60(tree, "release-manifest.json"), "utf8"));
71463
+ const live2 = join61(running.releaseRoot, running.app);
71464
+ const manifestOf = (tree) => JSON.parse(readFileSync75(join61(tree, "release-manifest.json"), "utf8"));
71376
71465
  let current = manifestOf(live2);
71377
71466
  const failed2 = async (message) => {
71378
71467
  if (stopping) return;
@@ -71383,7 +71472,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71383
71472
  };
71384
71473
  rebuild = watchKit.serialize(async () => {
71385
71474
  const t0 = Date.now();
71386
- const next = mkdtempSync4(join60(tmpdir5(), "himi-run-build-"));
71475
+ const next = mkdtempSync4(join61(tmpdir5(), "himi-run-build-"));
71387
71476
  try {
71388
71477
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
71389
71478
  if (bres.compileErrors.length) {
@@ -71400,14 +71489,14 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71400
71489
  return;
71401
71490
  }
71402
71491
  if (stopping) return;
71403
- const fresh = manifestOf(join60(next, running.app));
71492
+ const fresh = manifestOf(join61(next, running.app));
71404
71493
  const diff = watchKit.diffReleases(current, fresh);
71405
71494
  const retired = `${live2}.retired-${Date.now()}`;
71406
71495
  renameSync7(live2, retired);
71407
71496
  try {
71408
- renameSync7(join60(next, running.app), live2);
71497
+ renameSync7(join61(next, running.app), live2);
71409
71498
  } catch {
71410
- cpSync3(join60(next, running.app), live2, { recursive: true });
71499
+ cpSync3(join61(next, running.app), live2, { recursive: true });
71411
71500
  }
71412
71501
  rmSync14(retired, { recursive: true, force: true });
71413
71502
  current = fresh;
@@ -72724,7 +72813,7 @@ ${label2}`);
72724
72813
  const platform = str6(flags.platform)?.split(",").map((p) => p.trim()).filter(Boolean);
72725
72814
  {
72726
72815
  const distDir = contentDir(flags);
72727
- if (existsSync63(join60(distDir, "himalaya.content.json"))) {
72816
+ if (existsSync63(join61(distDir, "himalaya.content.json"))) {
72728
72817
  const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
72729
72818
  const errors = issues.filter((i) => i.severity === "error");
72730
72819
  for (const i of issues.filter((i2) => i2.severity === "warning")) {