@wix/himalaya-cli 0.1049.0 → 0.1050.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 +398 -306
  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 = {}) {
@@ -21498,6 +21506,7 @@ function shouldRevealError(args) {
21498
21506
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
21499
21507
  var init_validation = __esm({
21500
21508
  "../../core/ts/src/validation.ts"() {
21509
+ "use strict";
21501
21510
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
21502
21511
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
21503
21512
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -25098,6 +25107,7 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
25098
25107
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
25099
25108
  var init_worker_subtree = __esm({
25100
25109
  "../../core/ts/src/worker-subtree.ts"() {
25110
+ "use strict";
25101
25111
  init_worker_subtree_safe_types_generated();
25102
25112
  WORKER_SUBTREE_CEILINGS = Object.freeze({
25103
25113
  maxEncodedBytes: 65536,
@@ -33667,7 +33677,7 @@ var init_config2 = __esm({
33667
33677
  import { createServer as createServer2 } from "node:http";
33668
33678
  import { readFile, stat } from "node:fs/promises";
33669
33679
  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";
33680
+ 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
33681
  import { createHash as createHash16, randomUUID as randomUUID2 } from "node:crypto";
33672
33682
  import { fileURLToPath as fileURLToPath18, pathToFileURL as pathToFileURL6 } from "node:url";
33673
33683
  function deepMerge3(base, patch) {
@@ -34563,7 +34573,8 @@ async function reloadAppModuleNow(state, opts) {
34563
34573
  const outfile = resolve31(HMR_TMP_DIR, `${current.name}-${++appReloadSeq}.mjs`);
34564
34574
  try {
34565
34575
  const lib = await import(pathToFileURL6(resolve31(TIER5_SRC_ROOT, "build-lib.mjs")).href);
34566
- await lib.buildAppEntry(entry, outfile, { confineTo: current.dir });
34576
+ const inputs = /* @__PURE__ */ new Set();
34577
+ await lib.buildAppEntry(entry, outfile, { confineTo: current.dir, inputs });
34567
34578
  const mod = await import(pathToFileURL6(outfile).href);
34568
34579
  const next = mod.default;
34569
34580
  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 +34612,7 @@ async function reloadAppModuleNow(state, opts) {
34601
34612
  state.announcedTokensHash = tokensHash;
34602
34613
  publishSSE(state, "tokens.changed", { reason: opts.reason, at: Date.now() });
34603
34614
  }
34615
+ if (state.hotReloadEnabled) syncAppDependencyWatchers(state, inputs);
34604
34616
  console.log(`[himalaya-dev] reloaded app module in-process: ${current.name} (${opts.reason})`);
34605
34617
  return { ok: true };
34606
34618
  } catch (err) {
@@ -34625,6 +34637,77 @@ function servedTokensHash(app) {
34625
34637
  return "";
34626
34638
  }
34627
34639
  }
34640
+ function appDependencyFiles(inputs, appDir2) {
34641
+ const inside = (root, p) => p === root || p.startsWith(root + sep8);
34642
+ const out = /* @__PURE__ */ new Set();
34643
+ for (const raw of inputs) {
34644
+ const p = resolve31(raw);
34645
+ if (!inside(ROOT6, p) || inside(resolve31(appDir2), p) || inside(HMR_TMP_DIR, p)) continue;
34646
+ if (p.split(sep8).includes("node_modules")) continue;
34647
+ out.add(p);
34648
+ }
34649
+ return [...out].sort();
34650
+ }
34651
+ function syncAppDependencyWatchers(state, inputs) {
34652
+ if (!state.app || state.closed) return;
34653
+ for (const w of state.appDepWatchers ?? []) {
34654
+ try {
34655
+ w.close();
34656
+ } catch {
34657
+ }
34658
+ }
34659
+ const byDir = /* @__PURE__ */ new Map();
34660
+ for (const file of appDependencyFiles(inputs, state.app.dir)) {
34661
+ const dir = dirname22(file);
34662
+ if (!byDir.has(dir)) byDir.set(dir, /* @__PURE__ */ new Set());
34663
+ byDir.get(dir).add(basename9(file));
34664
+ }
34665
+ let timer;
34666
+ const changed = /* @__PURE__ */ new Set();
34667
+ const watchers = [];
34668
+ for (const [dir, names] of byDir) {
34669
+ try {
34670
+ const w = watch(dir, { persistent: false }, (_event, filename) => {
34671
+ if (!filename || !names.has(String(filename))) return;
34672
+ changed.add(join36(dir, String(filename)));
34673
+ if (timer) clearTimeout(timer);
34674
+ timer = setTimeout(() => {
34675
+ timer = void 0;
34676
+ const files = [...changed].map((f) => relative6(ROOT6, f));
34677
+ changed.clear();
34678
+ console.log(`[himalaya-dev] app dependency changed: ${files.join(", ")}`);
34679
+ void reloadAppModule(state, { reason: "dependency_changed" });
34680
+ }, 200);
34681
+ });
34682
+ w.on("error", () => {
34683
+ });
34684
+ watchers.push(w);
34685
+ } catch {
34686
+ }
34687
+ }
34688
+ state.appDepWatchers = watchers;
34689
+ }
34690
+ async function primeAppDependencyWatchers(state) {
34691
+ const current = state.app;
34692
+ if (!current) return;
34693
+ const entry = resolve31(current.dir, "dev/index.ts");
34694
+ if (!existsSync38(entry)) return;
34695
+ mkdirSync18(HMR_TMP_DIR, { recursive: true });
34696
+ const outfile = resolve31(HMR_TMP_DIR, `${current.name}-deps-${++appReloadSeq}.mjs`);
34697
+ try {
34698
+ const lib = await import(pathToFileURL6(resolve31(TIER5_SRC_ROOT, "build-lib.mjs")).href);
34699
+ const inputs = /* @__PURE__ */ new Set();
34700
+ await lib.buildAppEntry(entry, outfile, { confineTo: current.dir, inputs });
34701
+ if (state.app === current && !state.appDepWatchers) syncAppDependencyWatchers(state, inputs);
34702
+ } catch (err) {
34703
+ console.warn(`[himalaya-dev] app dependency watch unavailable: ${err.message}`);
34704
+ } finally {
34705
+ try {
34706
+ rmSync7(outfile, { force: true });
34707
+ } catch {
34708
+ }
34709
+ }
34710
+ }
34628
34711
  function classifyAppPath(rel) {
34629
34712
  if (!rel || rel.startsWith("..")) return null;
34630
34713
  if (rel === "tokens.json") return "tokens";
@@ -35882,8 +35965,8 @@ async function handleActionHandlerBundleGet(res, app) {
35882
35965
  }
35883
35966
  async function serveStatic(req, res, root, prefix) {
35884
35967
  const requested = decodeURIComponent((req.url ?? "").split("?")[0]);
35885
- const relative11 = requested.replace(prefix, "").replace(/^\//, "");
35886
- const safe = normalize3(relative11).replace(/^(\.\.[\/\\])+/, "");
35968
+ const relative12 = requested.replace(prefix, "").replace(/^\//, "");
35969
+ const safe = normalize3(relative12).replace(/^(\.\.[\/\\])+/, "");
35887
35970
  const fullPath = resolve31(root, safe);
35888
35971
  if (!fullPath.startsWith(root)) {
35889
35972
  return send(res, 403, "forbidden");
@@ -36114,6 +36197,7 @@ function createDevServer(opts = {}) {
36114
36197
  state.bundleSourceWatcher = startBundleSourceWatcher(state);
36115
36198
  if (state.app) state.announcedTokensHash = servedTokensHash(state.app);
36116
36199
  state.appWatcher = startAppSourceWatcher(state);
36200
+ void primeAppDependencyWatchers(state);
36117
36201
  }
36118
36202
  const handleRequest = (req, res) => {
36119
36203
  logRequest(req, res, Date.now());
@@ -36504,12 +36588,20 @@ ${err.message}`);
36504
36588
  }
36505
36589
  });
36506
36590
  httpServer.on("close", () => {
36591
+ state.closed = true;
36507
36592
  state.bundleWatcher?.close();
36508
36593
  state.bundleWatcher = void 0;
36509
36594
  state.bundleSourceWatcher?.close();
36510
36595
  state.bundleSourceWatcher = void 0;
36511
36596
  state.appWatcher?.close();
36512
36597
  state.appWatcher = void 0;
36598
+ for (const w of state.appDepWatchers ?? []) {
36599
+ try {
36600
+ w.close();
36601
+ } catch {
36602
+ }
36603
+ }
36604
+ state.appDepWatchers = void 0;
36513
36605
  for (const client2 of [...state.sseClients, ...state.adminClients]) {
36514
36606
  try {
36515
36607
  client2.end();
@@ -39519,7 +39611,7 @@ __export(build_exports2, {
39519
39611
  });
39520
39612
  import { createHash as createHash19 } from "node:crypto";
39521
39613
  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";
39614
+ import { dirname as dirname23, join as join37, resolve as resolve32 } from "node:path";
39523
39615
  import { fileURLToPath as fileURLToPath19 } from "node:url";
39524
39616
  import { createRequire as createRequire2 } from "node:module";
39525
39617
  import { execFileSync as execFileSync4 } from "node:child_process";
@@ -39557,7 +39649,7 @@ function l10nLintOptions(locale, appDir2) {
39557
39649
  const tags = (locale.translations ?? []).filter((t) => t !== locale.default);
39558
39650
  const catalog = /* @__PURE__ */ new Set();
39559
39651
  for (const tag of tags) {
39560
- const path2 = join36(appDir2, "l10n", `${tag}.json`);
39652
+ const path2 = join37(appDir2, "l10n", `${tag}.json`);
39561
39653
  if (!existsSync39(path2)) continue;
39562
39654
  try {
39563
39655
  const parsed = JSON.parse(readFileSync42(path2, "utf8"));
@@ -39726,7 +39818,7 @@ function shellSha(root = REPO_ROOT7) {
39726
39818
  function isMonorepoCheckout(dir) {
39727
39819
  try {
39728
39820
  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"));
39821
+ return top.length > 0 && existsSync39(join37(top, "core", "schema", "core.proto"));
39730
39822
  } catch {
39731
39823
  return false;
39732
39824
  }
@@ -40014,7 +40106,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40014
40106
  if (addrCache.has(name)) return addrCache.get(name);
40015
40107
  let bytes2;
40016
40108
  try {
40017
- bytes2 = readFileSync42(join36(tier5Dir, `${name}.bundle.js`));
40109
+ bytes2 = readFileSync42(join37(tier5Dir, `${name}.bundle.js`));
40018
40110
  } catch {
40019
40111
  return null;
40020
40112
  }
@@ -40035,7 +40127,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40035
40127
  const MAX_AUTHORING_DOC_BYTES = 128 * 1024;
40036
40128
  if (store.putDoc) {
40037
40129
  for (const [name, file] of [["spec", "SPEC.md"], ["mobile-ux", "MOBILE-UX.md"]]) {
40038
- const path2 = join36(preloaded.dir, file);
40130
+ const path2 = join37(preloaded.dir, file);
40039
40131
  if (!existsSync39(path2)) continue;
40040
40132
  const bytes2 = readFileSync42(path2);
40041
40133
  if (bytes2.length === 0 || bytes2.length > MAX_AUTHORING_DOC_BYTES) {
@@ -40096,7 +40188,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40096
40188
  const fontWarnings = [];
40097
40189
  try {
40098
40190
  const appTokens = readTokensForLint(preloaded) ?? {};
40099
- const policy = existsSync39(join36(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync42(join36(preloaded.dir, "fonts.json"), "utf8")) : {};
40191
+ const policy = existsSync39(join37(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync42(join37(preloaded.dir, "fonts.json"), "utf8")) : {};
40100
40192
  fontPlan = planFonts(appTokens, policy);
40101
40193
  } catch (err) {
40102
40194
  throw new Error(
@@ -40599,7 +40691,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
40599
40691
  await store.reset(app);
40600
40692
  const sources = {};
40601
40693
  for (const definition of config.functions.functions) {
40602
- const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join36(preloaded.dir, "functions", `${definition.name}${extension}`));
40694
+ const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join37(preloaded.dir, "functions", `${definition.name}${extension}`));
40603
40695
  const source = candidates.find((candidate) => existsSync39(candidate));
40604
40696
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
40605
40697
  sources[definition.name] = readFileSync42(source, "utf8");
@@ -40630,7 +40722,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
40630
40722
  return { manifest, failedToBuild: [], missingBundles: [], auth: {} };
40631
40723
  }
40632
40724
  function listBuildableApps() {
40633
- const appsDir = join36(REPO_ROOT7, "apps");
40725
+ const appsDir = join37(REPO_ROOT7, "apps");
40634
40726
  return readdirSync21(appsDir, { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith("_")).map((d) => d.name);
40635
40727
  }
40636
40728
  var BAKE_OFFLINE_BASE, KNOWN_ICON_NAMES, KNOWN_ICONS, REPO_ROOT7, TIER5_DIR, requireFromHere, SOURCEMAP_ON_DEMAND_PATH, BAKED_SERVER_BASE_URL;
@@ -40664,10 +40756,10 @@ var init_build3 = __esm({
40664
40756
  BAKE_OFFLINE_BASE = "http://himalaya-bake.invalid";
40665
40757
  KNOWN_ICON_NAMES = [...ICON_NAMES].sort();
40666
40758
  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");
40759
+ REPO_ROOT7 = resolve32(dirname23(fileURLToPath19(import.meta.url)), "../..");
40760
+ TIER5_DIR = join37(REPO_ROOT7, "core/dev-server/tier5-bundles");
40669
40761
  requireFromHere = createRequire2(import.meta.url);
40670
- SOURCEMAP_ON_DEMAND_PATH = join36(REPO_ROOT7, "core/dev-server/tier5-bundles-src/sourcemap-on-demand.mjs");
40762
+ SOURCEMAP_ON_DEMAND_PATH = join37(REPO_ROOT7, "core/dev-server/tier5-bundles-src/sourcemap-on-demand.mjs");
40671
40763
  BAKED_SERVER_BASE_URL = "http://baked.himalaya.invalid";
40672
40764
  }
40673
40765
  });
@@ -41136,7 +41228,7 @@ var init_studio_page = __esm({
41136
41228
 
41137
41229
  // src/studio-timeline.ts
41138
41230
  import { existsSync as existsSync40, readFileSync as readFileSync43 } from "node:fs";
41139
- import { join as join37 } from "node:path";
41231
+ import { join as join38 } from "node:path";
41140
41232
  function stateOf(view) {
41141
41233
  const j = view.journal[0];
41142
41234
  const h = view.health;
@@ -41203,7 +41295,7 @@ function validFrame(f) {
41203
41295
  return true;
41204
41296
  }
41205
41297
  function readTimeline(dir) {
41206
- const file = join37(dir, TIMELINE_FILE);
41298
+ const file = join38(dir, TIMELINE_FILE);
41207
41299
  if (!existsSync40(file)) return [];
41208
41300
  const out = [];
41209
41301
  for (const line of readFileSync43(file, "utf8").split("\n")) {
@@ -41223,14 +41315,14 @@ function trim(frames) {
41223
41315
  return frames.slice(-MAX_FRAMES);
41224
41316
  }
41225
41317
  function writeTimelineJs(dir, frames) {
41226
- writeFileAtomic(join37(dir, TIMELINE_JS), `window.__himiTimeline && window.__himiTimeline(${scriptJson(frames)});
41318
+ writeFileAtomic(join38(dir, TIMELINE_JS), `window.__himiTimeline && window.__himiTimeline(${scriptJson(frames)});
41227
41319
  `);
41228
41320
  }
41229
41321
  function appendFrame(dir, view, reveal = null) {
41230
41322
  const frames = readTimeline(dir);
41231
41323
  const last = frames[frames.length - 1];
41232
41324
  if (last && last.v === view.v && !reveal) {
41233
- if (!existsSync40(join37(dir, TIMELINE_JS))) writeTimelineJs(dir, frames);
41325
+ if (!existsSync40(join38(dir, TIMELINE_JS))) writeTimelineJs(dir, frames);
41234
41326
  return frames.length;
41235
41327
  }
41236
41328
  let prev = null;
@@ -41238,7 +41330,7 @@ function appendFrame(dir, view, reveal = null) {
41238
41330
  const frame = frameFor(stateOf(view), prev, view.generatedAt, view.v, frames.length % KEYFRAME_EVERY === 0);
41239
41331
  if (reveal) frame.reveal = reveal;
41240
41332
  const kept = trim([...frames, frame]);
41241
- writeFileAtomic(join37(dir, TIMELINE_FILE), kept.map((f) => JSON.stringify(f)).join("\n") + "\n");
41333
+ writeFileAtomic(join38(dir, TIMELINE_FILE), kept.map((f) => JSON.stringify(f)).join("\n") + "\n");
41242
41334
  writeTimelineJs(dir, kept);
41243
41335
  return kept.length;
41244
41336
  }
@@ -41260,8 +41352,8 @@ var init_studio_timeline = __esm({
41260
41352
  "src/studio-timeline.ts"() {
41261
41353
  init_progress();
41262
41354
  init_studio_page();
41263
- TIMELINE_FILE = join37(".himi", "studio", "timeline.jsonl");
41264
- TIMELINE_JS = join37(".himi", "studio", "timeline.js");
41355
+ TIMELINE_FILE = join38(".himi", "studio", "timeline.jsonl");
41356
+ TIMELINE_JS = join38(".himi", "studio", "timeline.js");
41265
41357
  MAX_FRAMES = 2e3;
41266
41358
  KEYFRAME_EVERY = 50;
41267
41359
  same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
@@ -41299,7 +41391,7 @@ __export(studio_exports, {
41299
41391
  });
41300
41392
  import { createHash as createHash20 } from "node:crypto";
41301
41393
  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";
41394
+ import { basename as basename10, extname as extname3, join as join39, relative as relative7, resolve as resolve33, sep as sep9 } from "node:path";
41303
41395
  import { pathToFileURL as pathToFileURL7 } from "node:url";
41304
41396
  function realInside(dir, abs) {
41305
41397
  try {
@@ -41322,9 +41414,9 @@ function archiveFile(dir, memory, abs) {
41322
41414
  return null;
41323
41415
  }
41324
41416
  if (size === 0) return null;
41325
- const key2 = relative6(dir, abs);
41417
+ const key2 = relative7(dir, abs);
41326
41418
  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}`))) {
41419
+ if (hit && hit.size === size && hit.mtimeMs === mtimeMs && hit.ino === ino && existsSync41(join39(dir, HISTORY_DIR, `${hit.sha}.${hit.ext}`))) {
41328
41420
  return { sha: hit.sha, ext: hit.ext, file: `${hit.sha}.${hit.ext}` };
41329
41421
  }
41330
41422
  let archived;
@@ -41338,17 +41430,17 @@ function archiveFile(dir, memory, abs) {
41338
41430
  return { sha: archived.sha256, ext: archived.ext, file: `${archived.sha256}.${archived.ext}` };
41339
41431
  }
41340
41432
  function loadMemory(dir, now) {
41341
- const raw = obj(readJson2(join38(dir, MEMORY_FILE)));
41433
+ const raw = obj(readJson2(join39(dir, MEMORY_FILE)));
41342
41434
  if (raw && raw.version === 1 && obj(raw.shots) && Array.isArray(raw.timeline)) return raw;
41343
41435
  return { version: 1, createdAt: now, shots: {}, timeline: [] };
41344
41436
  }
41345
41437
  function observeShots(dir, memory, now) {
41346
- const shotsDir = join38(dir, ".himi", "shots");
41438
+ const shotsDir = join39(dir, ".himi", "shots");
41347
41439
  const seen = /* @__PURE__ */ new Set();
41348
41440
  const files = existsSync41(shotsDir) ? readdirSync22(shotsDir).filter((f) => /\.(png|jpe?g)$/i.test(f)).sort() : [];
41349
41441
  for (const f of files) {
41350
- const id = basename9(f, extname3(f));
41351
- const archived = archiveFile(dir, memory, join38(shotsDir, f));
41442
+ const id = basename10(f, extname3(f));
41443
+ const archived = archiveFile(dir, memory, join39(shotsDir, f));
41352
41444
  if (!archived) continue;
41353
41445
  seen.add(id);
41354
41446
  const { sha, ext } = archived;
@@ -41370,7 +41462,7 @@ function observeShots(dir, memory, now) {
41370
41462
  return memory;
41371
41463
  }
41372
41464
  function palette(dir) {
41373
- const colors = obj(obj(readJson2(join38(dir, "tokens.json")))?.colors);
41465
+ const colors = obj(obj(readJson2(join39(dir, "tokens.json")))?.colors);
41374
41466
  if (!colors) return [];
41375
41467
  const pick2 = (key2) => {
41376
41468
  const v = colors[key2];
@@ -41380,20 +41472,20 @@ function palette(dir) {
41380
41472
  return ["accentPrimary", "accentSecondary", "accentSurface", "surfacePrimary", "textPrimary"].map(pick2).filter((x) => !!x);
41381
41473
  }
41382
41474
  function appIdentity(dir) {
41383
- const manifest = obj(readJson2(join38(dir, "himalaya.content.json")));
41384
- const name = text(manifest?.name) ?? basename9(resolve33(dir));
41475
+ const manifest = obj(readJson2(join39(dir, "himalaya.content.json")));
41476
+ const name = text(manifest?.name) ?? basename10(resolve33(dir));
41385
41477
  const icon = text(manifest?.icon)?.trim();
41386
41478
  const iconPath = icon ? resolve33(dir, icon) : null;
41387
41479
  const real = iconPath ? realInside(dir, iconPath) : null;
41388
41480
  return { name, iconFile: real && statSync8(real).isFile() ? iconPath : null };
41389
41481
  }
41390
41482
  function testRuns(dir) {
41391
- const att = join38(dir, ".himi", "attestations");
41483
+ const att = join39(dir, ".himi", "attestations");
41392
41484
  if (!existsSync41(att)) return [];
41393
41485
  const runs = [];
41394
41486
  for (const f of readdirSync22(att)) {
41395
41487
  if (!f.endsWith(".json") || f === "latest.json") continue;
41396
- const r = obj(readJson2(join38(att, f)));
41488
+ const r = obj(readJson2(join39(att, f)));
41397
41489
  if (!r || r.tool !== "himi-test" || typeof r.runId !== "string") continue;
41398
41490
  const report2 = obj(r.report);
41399
41491
  const coverage = obj(r.coverage);
@@ -41409,20 +41501,20 @@ function testRuns(dir) {
41409
41501
  return runs.sort((a, b) => a.runId.localeCompare(b.runId));
41410
41502
  }
41411
41503
  function siteHome(dir) {
41412
- for (const pages of [join38(dir, ".himi", "business-book", "evidence", "pages"), join38(dir, "evidence", "pages")]) {
41504
+ for (const pages of [join39(dir, ".himi", "business-book", "evidence", "pages"), join39(dir, "evidence", "pages")]) {
41413
41505
  if (!existsSync41(pages)) continue;
41414
41506
  const home = readdirSync22(pages).filter((f) => /^home.*\.(png|jpe?g)$/i.test(f)).sort()[0];
41415
- if (home) return join38(pages, home);
41507
+ if (home) return join39(pages, home);
41416
41508
  }
41417
41509
  return null;
41418
41510
  }
41419
41511
  function uxStatuses(dir) {
41420
- const platforms = obj(obj(readJson2(join38(dir, ".himi", "ux-audit.json")))?.platforms);
41512
+ const platforms = obj(obj(readJson2(join39(dir, ".himi", "ux-audit.json")))?.platforms);
41421
41513
  if (!platforms) return [];
41422
41514
  return Object.entries(platforms).map(([platform, rec]) => ({ platform, status: text(obj(rec)?.status) ?? "" })).filter((p) => p.status);
41423
41515
  }
41424
41516
  function liveRun(dir) {
41425
- const rec = obj(readJson2(join38(dir, RUN_RECORD)));
41517
+ const rec = obj(readJson2(join39(dir, RUN_RECORD)));
41426
41518
  const url = text(rec?.url);
41427
41519
  const pid = rec?.pid;
41428
41520
  if (!url || !/^https?:\/\//i.test(url) || typeof pid !== "number") return null;
@@ -41472,9 +41564,9 @@ function buildView(dir, memory, now) {
41472
41564
  const runs = testRuns(dir);
41473
41565
  const last = runs[runs.length - 1];
41474
41566
  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));
41567
+ const validate3 = obj(readJson2(join39(dir, VALIDATE_RECORD)));
41568
+ const push = obj(readJson2(join39(dir, PUSH_RECORD)));
41569
+ const edges = readJson2(join39(dir, EDGES_RECORD));
41478
41570
  const nav = [];
41479
41571
  if (Array.isArray(edges)) {
41480
41572
  const seen = /* @__PURE__ */ new Set();
@@ -41500,7 +41592,7 @@ function buildView(dir, memory, now) {
41500
41592
  message: e.message,
41501
41593
  step: e.step ?? null,
41502
41594
  stepNumber: e.stepNumber ?? null,
41503
- images: (e.images ?? []).map((i) => historyUrl(basename9(i.file)))
41595
+ images: (e.images ?? []).map((i) => historyUrl(basename10(i.file)))
41504
41596
  })),
41505
41597
  screens,
41506
41598
  focus,
@@ -41545,15 +41637,15 @@ function writeBoard(dir, now) {
41545
41637
  } catch {
41546
41638
  view.timelineFrames = 0;
41547
41639
  }
41548
- writeAtomic(join38(dir, MEMORY_FILE), JSON.stringify(memory));
41549
- writeAtomic(join38(dir, STATE_FILE), `window.__himiStudio && window.__himiStudio(${scriptJson(view)});
41640
+ writeAtomic(join39(dir, MEMORY_FILE), JSON.stringify(memory));
41641
+ writeAtomic(join39(dir, STATE_FILE), `window.__himiStudio && window.__himiStudio(${scriptJson(view)});
41550
41642
  `);
41551
- writeAtomic(join38(dir, STUDIO_PAGE), renderStudioHtml(view));
41643
+ writeAtomic(join39(dir, STUDIO_PAGE), renderStudioHtml(view));
41552
41644
  return view;
41553
41645
  }
41554
41646
  function refreshStudio(dir, now = /* @__PURE__ */ new Date()) {
41555
41647
  try {
41556
- if (!existsSync41(join38(dir, STUDIO_PAGE))) return { refreshed: false };
41648
+ if (!existsSync41(join39(dir, STUDIO_PAGE))) return { refreshed: false };
41557
41649
  return { refreshed: true, view: writeBoard(dir, now.toISOString()) };
41558
41650
  } catch {
41559
41651
  return { refreshed: false };
@@ -41561,13 +41653,13 @@ function refreshStudio(dir, now = /* @__PURE__ */ new Date()) {
41561
41653
  }
41562
41654
  function openStudio(dir, now = /* @__PURE__ */ new Date()) {
41563
41655
  const view = writeBoard(dir, now.toISOString());
41564
- const page = join38(dir, STUDIO_PAGE);
41656
+ const page = join39(dir, STUDIO_PAGE);
41565
41657
  return { page, url: pathToFileURL7(page).href, view };
41566
41658
  }
41567
41659
  function writeStudioRecord(dir, record2, value) {
41568
41660
  try {
41569
41661
  if (!realDirIn(dir, ".himi")) return;
41570
- writeAtomic(join38(dir, record2), `${JSON.stringify(value, null, 2)}
41662
+ writeAtomic(join39(dir, record2), `${JSON.stringify(value, null, 2)}
41571
41663
  `);
41572
41664
  } catch {
41573
41665
  }
@@ -41579,14 +41671,14 @@ var init_studio = __esm({
41579
41671
  init_studio_timeline();
41580
41672
  init_progress();
41581
41673
  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");
41674
+ STUDIO_DIR = join39(".himi", "studio");
41675
+ STUDIO_PAGE = join39(STUDIO_DIR, "index.html");
41676
+ STATE_FILE = join39(STUDIO_DIR, "state.js");
41677
+ MEMORY_FILE = join39(STUDIO_DIR, "memory.json");
41678
+ VALIDATE_RECORD = join39(".himi", "validate.json");
41679
+ PUSH_RECORD = join39(".himi", "last-push.json");
41680
+ EDGES_RECORD = join39(".himi", "test-edges.json");
41681
+ RUN_RECORD = join39(".himi", "run.json");
41590
41682
  MAX_TIMELINE = 500;
41591
41683
  MAX_JOURNAL = 80;
41592
41684
  MAX_NAV_EDGES = 40;
@@ -42229,7 +42321,7 @@ var init_push_setup_apple_credentials = __esm({
42229
42321
 
42230
42322
  // src/push-onboarding.ts
42231
42323
  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";
42324
+ import { basename as basename11, dirname as dirname24, join as join40, resolve as resolve35 } from "node:path";
42233
42325
  function readJson3(path2) {
42234
42326
  try {
42235
42327
  const parsed = JSON.parse(readFileSync46(path2, "utf8"));
@@ -42240,9 +42332,9 @@ function readJson3(path2) {
42240
42332
  }
42241
42333
  function pushInputsFromContent(dir) {
42242
42334
  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"));
42335
+ if (!existsSync42(join40(root, "himalaya.content.json"))) return { initialized: false };
42336
+ const content = readJson3(join40(root, "himalaya.content.json"));
42337
+ const provisioning = readJson3(join40(root, "provisioning.json"));
42246
42338
  const native = provisioning.native ?? {};
42247
42339
  return {
42248
42340
  initialized: true,
@@ -42250,7 +42342,7 @@ function pushInputsFromContent(dir) {
42250
42342
  // autoClaimSlug's docblock describes as the project-declared slug. Without the fallback a
42251
42343
  // package with no `name` sent a body missing `app` and earned `400 invalid_app_id` with both
42252
42344
  // private keys already on the wire.
42253
- app: text3(content.name) ?? basename10(root),
42345
+ app: text3(content.name) ?? basename11(root),
42254
42346
  ...text3(provisioning.siteId) ? { site: text3(provisioning.siteId) } : {},
42255
42347
  ...text3(native.iosBundleId) ? { bundleId: text3(native.iosBundleId) } : {},
42256
42348
  ...text3(native.androidApplicationId) ? { androidApplicationId: text3(native.androidApplicationId) } : {}
@@ -42371,14 +42463,14 @@ function buildPushSetupBody(i, keys) {
42371
42463
  };
42372
42464
  }
42373
42465
  function readPushOnboarding(dir) {
42374
- const path2 = join39(resolve35(dir), PUSH_ONBOARDING_PATH);
42466
+ const path2 = join40(resolve35(dir), PUSH_ONBOARDING_PATH);
42375
42467
  if (!existsSync42(path2)) return { version: 1 };
42376
42468
  const parsed = readJson3(path2);
42377
42469
  return { version: 1, ...parsed };
42378
42470
  }
42379
42471
  function writeFile(dir, file) {
42380
- const path2 = join39(resolve35(dir), PUSH_ONBOARDING_PATH);
42381
- mkdirSync19(dirname23(path2), { recursive: true, mode: 448 });
42472
+ const path2 = join40(resolve35(dir), PUSH_ONBOARDING_PATH);
42473
+ mkdirSync19(dirname24(path2), { recursive: true, mode: 448 });
42382
42474
  writeFileSync15(path2, JSON.stringify(file, null, 2) + "\n", { mode: 384 });
42383
42475
  try {
42384
42476
  chmodSync2(path2, 384);
@@ -42406,7 +42498,7 @@ function recordPushDeferral(dir, d) {
42406
42498
  return push;
42407
42499
  }
42408
42500
  function clearPushDeferral(dir) {
42409
- const path2 = join39(resolve35(dir), PUSH_ONBOARDING_PATH);
42501
+ const path2 = join40(resolve35(dir), PUSH_ONBOARDING_PATH);
42410
42502
  if (!existsSync42(path2)) return;
42411
42503
  const { push: _dropped, ...rest } = readPushOnboarding(dir);
42412
42504
  writeFile(dir, { ...rest, version: 1 });
@@ -43179,7 +43271,7 @@ __export(template_trim_exports, {
43179
43271
  runTemplateTrim: () => runTemplateTrim
43180
43272
  });
43181
43273
  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";
43274
+ import { dirname as dirname25, join as join41 } from "node:path";
43183
43275
  function routeMatcher(pattern) {
43184
43276
  const detail = /^\^([A-Za-z0-9_]+)\(\?:\[_\/\]\(\.\+\)\)\?\$$/.exec(pattern);
43185
43277
  if (detail) {
@@ -43873,20 +43965,20 @@ function homeModulesPass(app, kept, edited) {
43873
43965
  return { text: patched.src, dropped: patched.droppedModules };
43874
43966
  }
43875
43967
  function listWorkers(dir) {
43876
- const root = join40(dir, "tier5-src");
43968
+ const root = join41(dir, "tier5-src");
43877
43969
  if (!existsSync43(root)) return { dirs: [], files: {} };
43878
- const dirs = readdirSync23(root).filter((n) => statSync10(join40(root, n)).isDirectory()).sort();
43970
+ const dirs = readdirSync23(root).filter((n) => statSync10(join41(root, n)).isDirectory()).sort();
43879
43971
  const files = {};
43880
43972
  const walk2 = (abs, rel) => {
43881
43973
  for (const name of readdirSync23(abs)) {
43882
43974
  if (name === "node_modules") continue;
43883
- const p = join40(abs, name);
43975
+ const p = join41(abs, name);
43884
43976
  const r = `${rel}/${name}`;
43885
43977
  if (statSync10(p).isDirectory()) walk2(p, r);
43886
43978
  else if (/\.(?:[cm]?[jt]sx?|json)$/.test(name)) files[r] = readFileSync47(p, "utf8");
43887
43979
  }
43888
43980
  };
43889
- for (const d of dirs) walk2(join40(root, d), `tier5-src/${d}`);
43981
+ for (const d of dirs) walk2(join41(root, d), `tier5-src/${d}`);
43890
43982
  return { dirs, files };
43891
43983
  }
43892
43984
  function csv(v) {
@@ -43909,8 +44001,8 @@ async function runTemplateTrim(req, deps) {
43909
44001
  links = req.links;
43910
44002
  }
43911
44003
  const dir = req.dir;
43912
- const devPath = join40(dir, "dev/index.ts");
43913
- const configPath = join40(dir, "config.ts");
44004
+ const devPath = join41(dir, "dev/index.ts");
44005
+ const configPath = join41(dir, "config.ts");
43914
44006
  if (!existsSync43(devPath) || !existsSync43(configPath)) {
43915
44007
  return refuse3(new TrimRefusal(`${dir} has no dev/index.ts + config.ts \u2014 point --content at an app scaffolded with \`himi init --template\``));
43916
44008
  }
@@ -43928,23 +44020,23 @@ async function runTemplateTrim(req, deps) {
43928
44020
  throw e;
43929
44021
  }
43930
44022
  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);
44023
+ const hadHimi = existsSync43(join41(dir, ".himi"));
44024
+ const backupRel = join41(".himi", "trim-backup", (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-"));
44025
+ const backup = join41(dir, backupRel);
43934
44026
  const originals = [[devPath, "dev/index.ts"], [configPath, "config.ts"]];
43935
44027
  const moved = [];
43936
44028
  const restore = () => {
43937
44029
  for (const [path2, rel] of originals) {
43938
- const original = readFileSync47(join40(backup, rel));
44030
+ const original = readFileSync47(join41(backup, rel));
43939
44031
  if (!existsSync43(path2) || !readFileSync47(path2).equals(original)) writeFileSync16(path2, original);
43940
44032
  }
43941
- for (const name of [...moved].reverse()) renameSync5(join40(backup, "tier5-src", name), join40(dir, "tier5-src", name));
44033
+ for (const name of [...moved].reverse()) renameSync5(join41(backup, "tier5-src", name), join41(dir, "tier5-src", name));
43942
44034
  moved.length = 0;
43943
44035
  };
43944
44036
  const apply = () => {
43945
44037
  const moveDir = deps.moveDir ?? renameSync5;
43946
44038
  for (const name of plan.removedWorkers) {
43947
- moveDir(join40(dir, "tier5-src", name), join40(backup, "tier5-src", name));
44039
+ moveDir(join41(dir, "tier5-src", name), join41(backup, "tier5-src", name));
43948
44040
  moved.push(name);
43949
44041
  }
43950
44042
  if (plan.dev !== dev) writeFileSync16(devPath, plan.dev);
@@ -43952,8 +44044,8 @@ async function runTemplateTrim(req, deps) {
43952
44044
  };
43953
44045
  const dropBackup = () => {
43954
44046
  rmSync8(backup, { recursive: true, force: true });
43955
- for (const d of [dirname24(backup), join40(dir, ".himi")]) {
43956
- if (d === join40(dir, ".himi") && hadHimi) break;
44047
+ for (const d of [dirname25(backup), join41(dir, ".himi")]) {
44048
+ if (d === join41(dir, ".himi") && hadHimi) break;
43957
44049
  try {
43958
44050
  if (!readdirSync23(d).length) rmSync8(d, { recursive: true });
43959
44051
  } catch {
@@ -43979,9 +44071,9 @@ async function runTemplateTrim(req, deps) {
43979
44071
  return { code: 1, result: { ok: false, error: `${error} (${message}); every file was restored`, rolledBack: true, ...base(validate4) } };
43980
44072
  };
43981
44073
  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 });
44074
+ mkdirSync20(join41(backup, "dev"), { recursive: true });
44075
+ for (const [path2, rel] of originals) cpSync(path2, join41(backup, rel));
44076
+ if (plan.removedWorkers.length) mkdirSync20(join41(backup, "tier5-src"), { recursive: true });
43985
44077
  } catch (e) {
43986
44078
  dropBackup();
43987
44079
  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 +44855,7 @@ __export(pack_exports, {
44763
44855
  import { createHash as createHash21 } from "node:crypto";
44764
44856
  import { deflateRawSync, inflateRawSync } from "node:zlib";
44765
44857
  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";
44858
+ import { dirname as dirname26, join as join42, resolve as resolve37 } from "node:path";
44767
44859
  function writeZip(entries) {
44768
44860
  const sorted2 = entries.slice().sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
44769
44861
  const total = sorted2.reduce((n, e) => n + e.bytes.length, 0);
@@ -44860,10 +44952,10 @@ function readIf(path2) {
44860
44952
  return existsSync44(path2) && statSync11(path2).isFile() ? readFileSync48(path2) : null;
44861
44953
  }
44862
44954
  function listDir(dir) {
44863
- return existsSync44(dir) ? readdirSync24(dir).filter((f) => statSync11(join41(dir, f)).isFile()) : [];
44955
+ return existsSync44(dir) ? readdirSync24(dir).filter((f) => statSync11(join42(dir, f)).isFile()) : [];
44864
44956
  }
44865
44957
  function gatherReleaseEntries(appDir2) {
44866
- const manifestPath = join41(appDir2, HIMI_PACKAGE_MANIFEST_PATH);
44958
+ const manifestPath = join42(appDir2, HIMI_PACKAGE_MANIFEST_PATH);
44867
44959
  const manifestBytes = readIf(manifestPath);
44868
44960
  if (!manifestBytes) throw new Error(`no ${HIMI_PACKAGE_MANIFEST_PATH} in ${appDir2} \u2014 build a release there first`);
44869
44961
  const manifest = JSON.parse(manifestBytes.toString("utf8"));
@@ -44887,7 +44979,7 @@ function gatherReleaseEntries(appDir2) {
44887
44979
  }
44888
44980
  const missing = [];
44889
44981
  for (const rel of wanted) {
44890
- const bytes2 = readIf(join41(appDir2, rel));
44982
+ const bytes2 = readIf(join42(appDir2, rel));
44891
44983
  if (bytes2) entries.push({ path: rel, bytes: bytes2 });
44892
44984
  else missing.push(rel);
44893
44985
  }
@@ -44898,12 +44990,12 @@ function gatherReleaseEntries(appDir2) {
44898
44990
  );
44899
44991
  }
44900
44992
  for (const name of SINGLETONS) {
44901
- const bytes2 = readIf(join41(appDir2, name));
44993
+ const bytes2 = readIf(join42(appDir2, name));
44902
44994
  if (bytes2) entries.push({ path: name, bytes: bytes2 });
44903
44995
  }
44904
44996
  const skipped = [];
44905
44997
  for (const sub of ["screens", "bundles", "assets", "widgets"]) {
44906
- for (const f of listDir(join41(appDir2, sub))) {
44998
+ for (const f of listDir(join42(appDir2, sub))) {
44907
44999
  if (!wanted.has(`${sub}/${f}`)) skipped.push(`${sub}/${f}`);
44908
45000
  }
44909
45001
  }
@@ -44936,18 +45028,18 @@ function buildEntries(appDir2, app, opts) {
44936
45028
  return { all, header, manifest, skipped };
44937
45029
  }
44938
45030
  function packRelease(releaseRoot, app, out, opts = {}) {
44939
- const appDir2 = join41(resolve37(releaseRoot), app);
45031
+ const appDir2 = join42(resolve37(releaseRoot), app);
44940
45032
  const { all, header, skipped } = buildEntries(appDir2, app, opts);
44941
45033
  const buf = writeZip(all);
44942
45034
  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 });
45035
+ const outFile = isDir2 ? join42(resolve37(out), packageFileName(app, header.releaseId)) : resolve37(out);
45036
+ mkdirSync21(dirname26(outFile), { recursive: true });
44945
45037
  writeFileSync17(outFile, buf);
44946
45038
  return { app, releaseId: header.releaseId, header, out: outFile, bytes: buf.length, entryCount: all.length, skipped };
44947
45039
  }
44948
45040
  function resolvePackageDirDest(outDir, app, releaseId) {
44949
45041
  const packagedApp = (dir) => {
44950
- const bytes2 = readIf(join41(dir, HIMI_PACKAGE_HEADER_PATH));
45042
+ const bytes2 = readIf(join42(dir, HIMI_PACKAGE_HEADER_PATH));
44951
45043
  if (!bytes2) return void 0;
44952
45044
  try {
44953
45045
  return JSON.parse(bytes2.toString("utf8")).app;
@@ -44964,7 +45056,7 @@ function resolvePackageDirDest(outDir, app, releaseId) {
44964
45056
  throw new Error(`refusing to write a package tree over ${outDir} \u2014 it is a file, not a directory`);
44965
45057
  }
44966
45058
  if (replaceable(outDir)) return outDir;
44967
- const child = join41(outDir, packageDirName(app, releaseId));
45059
+ const child = join42(outDir, packageDirName(app, releaseId));
44968
45060
  if (!replaceable(child)) {
44969
45061
  throw new Error(
44970
45062
  `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 +45070,14 @@ function packReleaseToDir(releaseRoot, app, outDir, opts = {}) {
44978
45070
  "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
45071
  );
44980
45072
  }
44981
- const appDir2 = join41(resolve37(releaseRoot), app);
45073
+ const appDir2 = join42(resolve37(releaseRoot), app);
44982
45074
  const { all, header, skipped } = buildEntries(appDir2, app, opts);
44983
45075
  const dest = resolvePackageDirDest(resolve37(outDir), app, header.releaseId);
44984
45076
  rmSync9(dest, { recursive: true, force: true });
44985
45077
  let bytes2 = 0;
44986
45078
  for (const entry of all) {
44987
- const target = join41(dest, entry.path);
44988
- mkdirSync21(dirname25(target), { recursive: true });
45079
+ const target = join42(dest, entry.path);
45080
+ mkdirSync21(dirname26(target), { recursive: true });
44989
45081
  writeFileSync17(target, entry.bytes);
44990
45082
  bytes2 += entry.bytes.length;
44991
45083
  }
@@ -45013,10 +45105,10 @@ function openPackageDir(dir) {
45013
45105
  const root = resolve37(dir);
45014
45106
  const entries = /* @__PURE__ */ new Map();
45015
45107
  const walk2 = (rel) => {
45016
- const abs = rel ? join41(root, rel) : root;
45108
+ const abs = rel ? join42(root, rel) : root;
45017
45109
  for (const name of readdirSync24(abs)) {
45018
45110
  const childRel = rel ? `${rel}/${name}` : name;
45019
- const childAbs = join41(abs, name);
45111
+ const childAbs = join42(abs, name);
45020
45112
  if (statSync11(childAbs).isDirectory()) walk2(childRel);
45021
45113
  else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync48(childAbs));
45022
45114
  }
@@ -45063,11 +45155,11 @@ function unpackTo(buf, dest, appFallback) {
45063
45155
  if (!app) throw new Error("package declares no app id (no himi-package.json and no manifest.app)");
45064
45156
  if (!isSafeAppId(app)) throw new Error(`package declares an unsafe app id ${JSON.stringify(app)} \u2014 refusing to unpack it`);
45065
45157
  const root = resolve37(dest);
45066
- const appDir2 = join41(root, app);
45158
+ const appDir2 = join42(root, app);
45067
45159
  rmSync9(appDir2, { recursive: true, force: true });
45068
45160
  for (const [rel, bytes2] of entries) {
45069
- const target = join41(appDir2, rel);
45070
- mkdirSync21(dirname25(target), { recursive: true });
45161
+ const target = join42(appDir2, rel);
45162
+ mkdirSync21(dirname26(target), { recursive: true });
45071
45163
  writeFileSync17(target, bytes2);
45072
45164
  }
45073
45165
  return { root, appDir: appDir2, app };
@@ -45103,19 +45195,19 @@ __export(app_source_exports, {
45103
45195
  zipAppSource: () => zipAppSource
45104
45196
  });
45105
45197
  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";
45198
+ import { join as join43, resolve as resolve38, sep as sep10 } from "node:path";
45107
45199
  import { deflateRawSync as deflateRawSync2 } from "node:zlib";
45108
45200
  function walkSourceTree(dir, file, skip) {
45109
45201
  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));
45202
+ for (const name of readdirSync25(join43(dir, relDir))) {
45203
+ const rel = relDir ? join43(relDir, name) : name;
45204
+ const st = lstatSync8(join43(dir, rel));
45113
45205
  if (st.isSymbolicLink()) {
45114
45206
  skip(rel);
45115
45207
  continue;
45116
45208
  }
45117
45209
  if (st.isDirectory()) {
45118
- if (isDeniedSourceDir(name, relDir) || existsSync45(join42(dir, rel, PACKAGE_DIR_MARKER))) skip(rel);
45210
+ if (isDeniedSourceDir(name, relDir) || existsSync45(join43(dir, rel, PACKAGE_DIR_MARKER))) skip(rel);
45119
45211
  else walk2(rel);
45120
45212
  continue;
45121
45213
  }
@@ -45133,7 +45225,7 @@ function collectAppSource(dir) {
45133
45225
  const skipped = [];
45134
45226
  walkSourceTree(
45135
45227
  dir,
45136
- (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync49(join42(dir, hostRel)) }),
45228
+ (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync49(join43(dir, hostRel)) }),
45137
45229
  (hostRel) => skipped.push(hostRel)
45138
45230
  );
45139
45231
  entries.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
@@ -45187,13 +45279,13 @@ function writeAppSource(entries, destDir) {
45187
45279
  const segments = entry.path.split("/");
45188
45280
  let dir = root;
45189
45281
  for (const segment of segments.slice(0, -1)) {
45190
- dir = join42(dir, segment);
45282
+ dir = join43(dir, segment);
45191
45283
  const kind = pathKind(dir);
45192
45284
  if (kind?.isSymbolicLink()) unlinkSync3(dir);
45193
45285
  else if (kind) continue;
45194
45286
  mkdirSync22(dir);
45195
45287
  }
45196
- const target = join42(root, ...segments);
45288
+ const target = join43(root, ...segments);
45197
45289
  if (pathKind(target)?.isSymbolicLink()) unlinkSync3(target);
45198
45290
  writeFileSync18(target, entry.bytes);
45199
45291
  written.push(entry.path);
@@ -45228,7 +45320,7 @@ function writeConflicts(entries, destDir) {
45228
45320
  let dir = root;
45229
45321
  let stop = false;
45230
45322
  for (const [i, segment] of segments.slice(0, -1).entries()) {
45231
- dir = join42(dir, segment);
45323
+ dir = join43(dir, segment);
45232
45324
  const kind2 = pathKind(dir);
45233
45325
  if (!kind2 || kind2.isSymbolicLink()) {
45234
45326
  stop = true;
@@ -45240,7 +45332,7 @@ function writeConflicts(entries, destDir) {
45240
45332
  break;
45241
45333
  }
45242
45334
  if (stop) continue;
45243
- const kind = pathKind(join42(root, ...segments));
45335
+ const kind = pathKind(join43(root, ...segments));
45244
45336
  if (kind && !kind.isSymbolicLink() && kind.isDirectory()) {
45245
45337
  say(entry.path, "is a directory here, but the release has a file at that path");
45246
45338
  }
@@ -45250,7 +45342,7 @@ function writeConflicts(entries, destDir) {
45250
45342
  function removeStaleSource(entries, destDir) {
45251
45343
  const root = resolve38(destDir);
45252
45344
  const removed = staleSourcePaths(entries, root);
45253
- for (const rel of removed) rmSync10(join42(root, ...rel.split("/")), { force: true });
45345
+ for (const rel of removed) rmSync10(join43(root, ...rel.split("/")), { force: true });
45254
45346
  const needed = /* @__PURE__ */ new Set();
45255
45347
  for (const entry of entries) {
45256
45348
  if (isDeniedSourcePath(entry.path)) continue;
@@ -45262,10 +45354,10 @@ function removeStaleSource(entries, destDir) {
45262
45354
  }
45263
45355
  function pruneEmptyDirs(root, rel, needed, removed) {
45264
45356
  let empty = true;
45265
- for (const name of readdirSync25(rel ? join42(root, rel) : root)) {
45266
- const childRel = rel ? join42(rel, name) : name;
45357
+ for (const name of readdirSync25(rel ? join43(root, rel) : root)) {
45358
+ const childRel = rel ? join43(rel, name) : name;
45267
45359
  const posix4 = childRel.split(sep10).join("/");
45268
- const kind = lstatSync8(join42(root, childRel));
45360
+ const kind = lstatSync8(join43(root, childRel));
45269
45361
  if (kind.isSymbolicLink() || !kind.isDirectory() || isDeniedSourceDir(name, rel)) {
45270
45362
  empty = false;
45271
45363
  continue;
@@ -45275,7 +45367,7 @@ function pruneEmptyDirs(root, rel, needed, removed) {
45275
45367
  empty = false;
45276
45368
  continue;
45277
45369
  }
45278
- rmdirSync2(join42(root, childRel));
45370
+ rmdirSync2(join43(root, childRel));
45279
45371
  removed.push(`${posix4}/`);
45280
45372
  }
45281
45373
  return empty;
@@ -45331,7 +45423,7 @@ __export(eject_exports, {
45331
45423
  ejectModule: () => ejectModule
45332
45424
  });
45333
45425
  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";
45426
+ import { dirname as dirname27, join as join44, relative as relative8, resolve as resolve39, sep as sep11 } from "node:path";
45335
45427
  function locate(repoRootOrCwd, mod) {
45336
45428
  const inRepo = resolve39(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
45337
45429
  if (existsSync46(inRepo)) return { path: inRepo, form: "source" };
@@ -45360,8 +45452,8 @@ function ejectModule(opts) {
45360
45452
  };
45361
45453
  }
45362
45454
  const ext = found.form === "source" ? "ts" : "mjs";
45363
- const target = join43(contentDir2, "tier5-src", "_ejected", `${mod}.${ext}`);
45364
- mkdirSync23(dirname26(target), { recursive: true });
45455
+ const target = join44(contentDir2, "tier5-src", "_ejected", `${mod}.${ext}`);
45456
+ mkdirSync23(dirname27(target), { recursive: true });
45365
45457
  const banner = `// EJECTED from @wix/himalaya/${mod}. This app owns this file now.
45366
45458
  //
45367
45459
  // Central fixes to @wix/himalaya/${mod} NO LONGER REACH THIS APP \u2014 including any
@@ -45384,7 +45476,7 @@ function ejectModule(opts) {
45384
45476
  if (!existsSync46(f)) continue;
45385
45477
  const before = readFileSync50(f, "utf8");
45386
45478
  let after = before;
45387
- let rel = relative7(dirname26(f), target).split(sep11).join("/").replace(/\.tsx?$/, ".js");
45479
+ let rel = relative8(dirname27(f), target).split(sep11).join("/").replace(/\.tsx?$/, ".js");
45388
45480
  if (!rel.startsWith(".")) rel = `./${rel}`;
45389
45481
  for (const spec of specifiersFor(mod)) {
45390
45482
  const q = spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -45416,7 +45508,7 @@ var init_eject = __esm({
45416
45508
 
45417
45509
  // src/wix-writes.ts
45418
45510
  import { existsSync as existsSync47, readFileSync as readFileSync51 } from "node:fs";
45419
- import { join as join44 } from "node:path";
45511
+ import { join as join45 } from "node:path";
45420
45512
  function isProvenRead(method, path2) {
45421
45513
  if (/[#\x00-\x1F\x7F]/.test(path2)) return false;
45422
45514
  const verb = method.toUpperCase();
@@ -45497,7 +45589,7 @@ function parseDataAccess(text5, from) {
45497
45589
  }
45498
45590
  function readDataAccess(dir) {
45499
45591
  for (const name of ["SPEC.md", "MOBILE-UX.md"]) {
45500
- const p = join44(dir, name);
45592
+ const p = join45(dir, name);
45501
45593
  if (!existsSync47(p)) continue;
45502
45594
  let text5;
45503
45595
  try {
@@ -45609,7 +45701,7 @@ __export(test_exports, {
45609
45701
  writeRecordedMocks: () => writeRecordedMocks
45610
45702
  });
45611
45703
  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";
45704
+ import { join as join46, resolve as resolve40 } from "node:path";
45613
45705
  function readTestConfig(dir) {
45614
45706
  const p = resolve40(dir, TEST_CONFIG_FILE);
45615
45707
  if (!existsSync48(p)) return {};
@@ -45789,8 +45881,8 @@ function writeRecordedMocks(opts) {
45789
45881
  mkdir: (p) => mkdirSync24(p, { recursive: true }),
45790
45882
  write: (p, s) => writeFileSync20(p, s)
45791
45883
  };
45792
- fs.mkdir(join45(opts.dir, "dev"));
45793
- fs.write(join45(opts.dir, "dev", "net-mocks.json"), JSON.stringify(opts.mocks, null, 2) + "\n");
45884
+ fs.mkdir(join46(opts.dir, "dev"));
45885
+ fs.write(join46(opts.dir, "dev", "net-mocks.json"), JSON.stringify(opts.mocks, null, 2) + "\n");
45794
45886
  return { ok: true, rules, to: "dev/net-mocks.json" };
45795
45887
  }
45796
45888
  function scopeDescriptors(descriptors, requestedIds, invalidScreens) {
@@ -46273,9 +46365,9 @@ __export(mobile_ux_lint_exports, {
46273
46365
  mobileUxIssues: () => mobileUxIssues
46274
46366
  });
46275
46367
  import { existsSync as existsSync49, readFileSync as readFileSync53 } from "node:fs";
46276
- import { join as join46 } from "node:path";
46368
+ import { join as join47 } from "node:path";
46277
46369
  function mobileUxIssues(dir, strict) {
46278
- const file = join46(dir, "MOBILE-UX.md");
46370
+ const file = join47(dir, "MOBILE-UX.md");
46279
46371
  if (!existsSync49(file)) return [];
46280
46372
  let text5;
46281
46373
  try {
@@ -47955,7 +48047,7 @@ __export(functions_exports, {
47955
48047
  runRemoteFunctionOperation: () => runRemoteFunctionOperation
47956
48048
  });
47957
48049
  import { readFileSync as readFileSync54, existsSync as existsSync50 } from "node:fs";
47958
- import { join as join47, resolve as resolve41 } from "node:path";
48050
+ import { join as join48, resolve as resolve41 } from "node:path";
47959
48051
  function resolveFunctionsTarget(input) {
47960
48052
  const explicitUrl = input.functionsUrl?.trim();
47961
48053
  if (explicitUrl) return { mode: "remote", baseUrl: explicitUrl };
@@ -47974,7 +48066,7 @@ async function loadFunctionsApp(dir) {
47974
48066
  }
47975
48067
  const sources = {};
47976
48068
  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);
48069
+ const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join48(loaded.dir, "functions", `${definition.name}${extension}`)).find(existsSync50);
47978
48070
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
47979
48071
  sources[definition.name] = readFileSync54(source, "utf8");
47980
48072
  }
@@ -48129,9 +48221,9 @@ __export(studio_reel_exports, {
48129
48221
  });
48130
48222
  import { createHash as createHash24 } from "node:crypto";
48131
48223
  import { lstatSync as lstatSync9, readFileSync as readFileSync55 } from "node:fs";
48132
- import { basename as basename11, join as join48 } from "node:path";
48224
+ import { basename as basename12, join as join49 } from "node:path";
48133
48225
  function loadMemory2(dir) {
48134
- const m = readJson4(join48(dir, ".himi", "studio", "memory.json"));
48226
+ const m = readJson4(join49(dir, ".himi", "studio", "memory.json"));
48135
48227
  if (!isObj2(m) || m.version !== 1 || !isObj2(m.shots) || !Array.isArray(m.timeline)) return null;
48136
48228
  const shots = [];
48137
48229
  for (const [id, s] of Object.entries(m.shots)) {
@@ -48168,8 +48260,8 @@ function planReel(dir) {
48168
48260
  const memory = loadMemory2(dir);
48169
48261
  const { entries } = readProgress(dir);
48170
48262
  const summary = summarizeProgress(entries);
48171
- const manifest = readJson4(join48(dir, "himalaya.content.json"));
48172
- const tokens = readJson4(join48(dir, "tokens.json"));
48263
+ const manifest = readJson4(join49(dir, "himalaya.content.json"));
48264
+ const tokens = readJson4(join49(dir, "tokens.json"));
48173
48265
  const accentToken = tokens?.colors?.accentPrimary;
48174
48266
  const accentRaw = typeof accentToken === "string" ? accentToken : accentToken?.light;
48175
48267
  const accent = typeof accentRaw === "string" && ACCENT.test(accentRaw) ? accentRaw : DEFAULT_ACCENT;
@@ -48184,13 +48276,13 @@ function planReel(dir) {
48184
48276
  ts: e.ts,
48185
48277
  message: e.message,
48186
48278
  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))
48279
+ 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
48280
  }));
48189
48281
  const times = [summary.startedAt, ...timeline.map((t) => t.ts), memory?.createdAt].filter((x) => !!x).sort();
48190
48282
  const startedAt = times[0] ?? null;
48191
48283
  const endedAt = [summary.lastAt, ...timeline.map((t) => t.ts)].filter((x) => !!x).sort().pop() ?? null;
48192
48284
  return {
48193
- app: typeof manifest?.name === "string" && manifest.name ? manifest.name : basename11(dir),
48285
+ app: typeof manifest?.name === "string" && manifest.name ? manifest.name : basename12(dir),
48194
48286
  accent,
48195
48287
  startedAt,
48196
48288
  endedAt,
@@ -48211,7 +48303,7 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
48211
48303
  const verified = (f) => {
48212
48304
  if (!HISTORY_NAME.test(f)) return null;
48213
48305
  try {
48214
- const path2 = join48(dir, HISTORY_DIR, f);
48306
+ const path2 = join49(dir, HISTORY_DIR, f);
48215
48307
  const st = lstatSync9(path2);
48216
48308
  if (!st.isFile() || st.nlink !== 1) return null;
48217
48309
  const bytes2 = readFileSync55(path2);
@@ -48381,7 +48473,7 @@ __export(native_decode_exports, {
48381
48473
  import { execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
48382
48474
  import { existsSync as existsSync51, mkdtempSync as mkdtempSync2, readFileSync as readFileSync56, rmSync as rmSync11, writeFileSync as writeFileSync21 } from "node:fs";
48383
48475
  import { tmpdir as tmpdir3 } from "node:os";
48384
- import { join as join49 } from "node:path";
48476
+ import { join as join50 } from "node:path";
48385
48477
  import { fileURLToPath as fileURLToPath20 } from "node:url";
48386
48478
  function nativeDecodePackageDir() {
48387
48479
  return fileURLToPath20(new URL("../../../core/runtime/ios/HimalayaCore/", import.meta.url));
@@ -48391,8 +48483,8 @@ function nativeDecodeAndroidHarnessDir() {
48391
48483
  }
48392
48484
  function nativeOracleShipped() {
48393
48485
  return {
48394
- ios: existsSync51(join49(nativeDecodePackageDir(), "Package.swift")),
48395
- android: existsSync51(join49(nativeDecodeAndroidHarnessDir(), "gradlew"))
48486
+ ios: existsSync51(join50(nativeDecodePackageDir(), "Package.swift")),
48487
+ android: existsSync51(join50(nativeDecodeAndroidHarnessDir(), "gradlew"))
48396
48488
  };
48397
48489
  }
48398
48490
  function detectNativeDecode(options = {}) {
@@ -48403,7 +48495,7 @@ function detectNativeDecode(options = {}) {
48403
48495
  return { platform: "ios", available: false, reason: `the iOS decoder oracle requires macOS (darwin); this host is ${hostPlatform}` };
48404
48496
  }
48405
48497
  if (!swiftAvailable) return { platform: "ios", available: false, reason: "swift is not on PATH" };
48406
- const packageAvailable = options.packageAvailable ?? existsSync51(join49(packageDir, "Package.swift"));
48498
+ const packageAvailable = options.packageAvailable ?? existsSync51(join50(packageDir, "Package.swift"));
48407
48499
  if (!packageAvailable) {
48408
48500
  return {
48409
48501
  platform: "ios",
@@ -48415,7 +48507,7 @@ function detectNativeDecode(options = {}) {
48415
48507
  }
48416
48508
  function localPropertiesSdk(harnessDir) {
48417
48509
  try {
48418
- const match = readFileSync56(join49(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
48510
+ const match = readFileSync56(join50(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
48419
48511
  return match?.[1]?.trim().replace(/\\([ :\\])/g, "$1") ?? null;
48420
48512
  } catch {
48421
48513
  return null;
@@ -48423,7 +48515,7 @@ function localPropertiesSdk(harnessDir) {
48423
48515
  }
48424
48516
  function detectAndroidNativeDecode(options = {}) {
48425
48517
  const harnessDir = options.harnessDir ?? nativeDecodeAndroidHarnessDir();
48426
- const gradlew = join49(harnessDir, "gradlew");
48518
+ const gradlew = join50(harnessDir, "gradlew");
48427
48519
  const gradlewAvailable = options.gradlewAvailable ?? existsSync51(gradlew);
48428
48520
  if (!gradlewAvailable) {
48429
48521
  return {
@@ -48506,14 +48598,14 @@ function parseNativeDecodeOutput(stdout, expectedScreenIds, platform = "ios") {
48506
48598
  return verdicts;
48507
48599
  }
48508
48600
  function runNativeDecode(options) {
48509
- const descriptorDir = mkdtempSync2(join49(tmpdir3(), "himi-native-decode-"));
48601
+ const descriptorDir = mkdtempSync2(join50(tmpdir3(), "himi-native-decode-"));
48510
48602
  const startedAt = Date.now();
48511
48603
  try {
48512
48604
  for (const descriptor of options.descriptors) {
48513
48605
  if (typeof descriptor.descriptorJson !== "string") {
48514
48606
  throw new Error(`native decode cannot judge ${descriptor.screenId}: the release builder did not return its exact baked JSON bytes`);
48515
48607
  }
48516
- writeFileSync21(join49(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48608
+ writeFileSync21(join50(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48517
48609
  }
48518
48610
  options.progress?.("building cached Swift oracle");
48519
48611
  execFileSync5("swift", ["build", "--package-path", options.packageDir, "--product", "himi-decode-oracle"], {
@@ -48525,7 +48617,7 @@ function runNativeDecode(options) {
48525
48617
  encoding: "utf8"
48526
48618
  }).trim();
48527
48619
  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], {
48620
+ const stdout = execFileSync5(join50(binPath, "himi-decode-oracle"), ["--dir", descriptorDir], {
48529
48621
  stdio: ["ignore", "pipe", "pipe"],
48530
48622
  encoding: "utf8"
48531
48623
  });
@@ -48543,15 +48635,15 @@ function runNativeDecode(options) {
48543
48635
  }
48544
48636
  }
48545
48637
  function runAndroidNativeDecode(options) {
48546
- const descriptorDir = mkdtempSync2(join49(tmpdir3(), "himi-native-decode-android-"));
48547
- const outputPath = join49(descriptorDir, "verdicts.ndjson");
48638
+ const descriptorDir = mkdtempSync2(join50(tmpdir3(), "himi-native-decode-android-"));
48639
+ const outputPath = join50(descriptorDir, "verdicts.ndjson");
48548
48640
  const startedAt = Date.now();
48549
48641
  try {
48550
48642
  for (const descriptor of options.descriptors) {
48551
48643
  if (typeof descriptor.descriptorJson !== "string") {
48552
48644
  throw new Error(`native decode cannot judge ${descriptor.screenId}: the release builder did not return its exact baked JSON bytes`);
48553
48645
  }
48554
- writeFileSync21(join49(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48646
+ writeFileSync21(join50(descriptorDir, `${encodeURIComponent(descriptor.screenId)}.json`), descriptor.descriptorJson);
48555
48647
  }
48556
48648
  options.progress?.(`running real Kotlin decoder over ${options.descriptors.length} screen${options.descriptors.length === 1 ? "" : "s"}`);
48557
48649
  execFileSync5(options.gradlew, [
@@ -48637,12 +48729,12 @@ __export(browser_authoring_exports, {
48637
48729
  import { createServer as createServer3 } from "node:http";
48638
48730
  import { createHash as createHash25, randomBytes as randomBytes4 } from "node:crypto";
48639
48731
  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";
48732
+ import { join as join51, posix as posix2, relative as relative9, sep as sep12 } from "node:path";
48641
48733
  function humanMs(ms) {
48642
48734
  return ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`;
48643
48735
  }
48644
48736
  function collectWorkerSources(tier5SrcDir, bundleName) {
48645
- const root = join50(tier5SrcDir, bundleName);
48737
+ const root = join51(tier5SrcDir, bundleName);
48646
48738
  const files = {};
48647
48739
  const visitedDirs = /* @__PURE__ */ new Set();
48648
48740
  const walk2 = (abs, rel) => {
@@ -48650,7 +48742,7 @@ function collectWorkerSources(tier5SrcDir, bundleName) {
48650
48742
  if (visitedDirs.has(real)) return;
48651
48743
  visitedDirs.add(real);
48652
48744
  for (const name of readdirSync26(abs).sort()) {
48653
- const childAbs = join50(abs, name);
48745
+ const childAbs = join51(abs, name);
48654
48746
  const childRel = posix2.join(rel, name);
48655
48747
  if (statSync12(childAbs).isDirectory()) {
48656
48748
  walk2(childAbs, childRel);
@@ -48676,18 +48768,18 @@ function collectRelativeSiblings(files, tier5SrcDir) {
48676
48768
  const spec = m[1];
48677
48769
  const virtual = posix2.normalize(posix2.join(dir, spec));
48678
48770
  if (!virtual.startsWith("/tier5-src/")) continue;
48679
- const onDisk = join50(tier5SrcDir, virtual.slice("/tier5-src/".length));
48771
+ const onDisk = join51(tier5SrcDir, virtual.slice("/tier5-src/".length));
48680
48772
  const candidates = [
48681
48773
  onDisk,
48682
48774
  `${onDisk}.ts`,
48683
48775
  `${onDisk}.js`,
48684
48776
  onDisk.replace(/\.js$/, ".ts"),
48685
- join50(onDisk, "index.ts"),
48686
- join50(onDisk, "index.js")
48777
+ join51(onDisk, "index.ts"),
48778
+ join51(onDisk, "index.js")
48687
48779
  ];
48688
48780
  for (const abs of candidates) {
48689
48781
  if (!existsSync52(abs) || statSync12(abs).isDirectory()) continue;
48690
- const key2 = `/tier5-src/${relative8(tier5SrcDir, abs).split(sep12).join(posix2.sep)}`;
48782
+ const key2 = `/tier5-src/${relative9(tier5SrcDir, abs).split(sep12).join(posix2.sep)}`;
48691
48783
  if (key2 in files) break;
48692
48784
  files[key2] = readFileSync57(abs, "utf8");
48693
48785
  queue.push(key2);
@@ -48897,7 +48989,7 @@ __export(coverage_exports, {
48897
48989
  trendAndStore: () => trendAndStore
48898
48990
  });
48899
48991
  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";
48992
+ import { dirname as dirname28, join as join52 } from "node:path";
48901
48993
  function suppressedNativeKeys(oracle) {
48902
48994
  return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
48903
48995
  }
@@ -49077,7 +49169,7 @@ function assembleLedger(r, options = {}) {
49077
49169
  return out;
49078
49170
  }
49079
49171
  function trendAndStore(dir, entries, suppressed) {
49080
- const p = join51(dir, LEDGER_FILE);
49172
+ const p = join52(dir, LEDGER_FILE);
49081
49173
  let previous = null;
49082
49174
  try {
49083
49175
  if (existsSync53(p)) {
@@ -49089,7 +49181,7 @@ function trendAndStore(dir, entries, suppressed) {
49089
49181
  const current = entries.map((e) => e.key);
49090
49182
  const stored = [.../* @__PURE__ */ new Set([...current, ...(previous ?? []).filter((key2) => (suppressed ?? []).includes(key2))])];
49091
49183
  try {
49092
- mkdirSync25(dirname27(p), { recursive: true });
49184
+ mkdirSync25(dirname28(p), { recursive: true });
49093
49185
  writeFileSync22(p, JSON.stringify({ keys: stored, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
49094
49186
  } catch {
49095
49187
  return null;
@@ -49120,7 +49212,7 @@ function formatLedger(entries, trend) {
49120
49212
  return out.join("\n");
49121
49213
  }
49122
49214
  function diffAndStoreObservations(dir, current) {
49123
- const p = join51(dir, OBS_FILE);
49215
+ const p = join52(dir, OBS_FILE);
49124
49216
  let previous = null;
49125
49217
  try {
49126
49218
  if (existsSync53(p)) {
@@ -49134,7 +49226,7 @@ function diffAndStoreObservations(dir, current) {
49134
49226
  } catch {
49135
49227
  }
49136
49228
  try {
49137
- mkdirSync25(dirname27(p), { recursive: true });
49229
+ mkdirSync25(dirname28(p), { recursive: true });
49138
49230
  writeFileSync22(p, JSON.stringify({ screens: current, ts: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
49139
49231
  } catch {
49140
49232
  return null;
@@ -49173,8 +49265,8 @@ var LEDGER_FILE, OBS_FILE;
49173
49265
  var init_coverage = __esm({
49174
49266
  "src/coverage.ts"() {
49175
49267
  init_native_decode();
49176
- LEDGER_FILE = join51(".himi", "test-ledger.json");
49177
- OBS_FILE = join51(".himi", "test-observations.json");
49268
+ LEDGER_FILE = join52(".himi", "test-ledger.json");
49269
+ OBS_FILE = join52(".himi", "test-observations.json");
49178
49270
  }
49179
49271
  });
49180
49272
 
@@ -49186,7 +49278,7 @@ __export(design_kits_exports, {
49186
49278
  listKits: () => listKits2
49187
49279
  });
49188
49280
  import { existsSync as existsSync54, readFileSync as readFileSync59, readdirSync as readdirSync27 } from "node:fs";
49189
- import { join as join52, basename as basename12 } from "node:path";
49281
+ import { join as join53, basename as basename13 } from "node:path";
49190
49282
  import { fileURLToPath as fileURLToPath21 } from "node:url";
49191
49283
  function kitsDir() {
49192
49284
  return KIT_DIR_CANDIDATES.find((p) => existsSync54(p));
@@ -49194,7 +49286,7 @@ function kitsDir() {
49194
49286
  function listKits2() {
49195
49287
  const dir = kitsDir();
49196
49288
  if (!dir) return [];
49197
- return readdirSync27(dir).filter((f) => f.endsWith(".json")).map((f) => basename12(f, ".json")).sort();
49289
+ return readdirSync27(dir).filter((f) => f.endsWith(".json")).map((f) => basename13(f, ".json")).sort();
49198
49290
  }
49199
49291
  function kitReport(name) {
49200
49292
  const dir = kitsDir();
@@ -49213,7 +49305,7 @@ In a published @wix/himalaya-cli this is a packaging bug \u2014 the kits should
49213
49305
  if (!kits.includes(name)) {
49214
49306
  return { ok: false, kit: name, kits, problems: [`no design kit named "${name}". Available: ${kits.join(", ")}`] };
49215
49307
  }
49216
- const raw = readFileSync59(join52(dir, `${name}.json`), "utf8");
49308
+ const raw = readFileSync59(join53(dir, `${name}.json`), "utf8");
49217
49309
  let parsed;
49218
49310
  try {
49219
49311
  parsed = JSON.parse(raw);
@@ -49237,9 +49329,9 @@ var init_design_kits = __esm({
49237
49329
  "src/design-kits.ts"() {
49238
49330
  KIT_DIR_CANDIDATES = [
49239
49331
  // in-repo: tools/himi-cli/src/design-kits.ts → <repo>/stdlib/design-kits/
49240
- join52(fileURLToPath21(new URL("../../..", import.meta.url)), "stdlib", "design-kits"),
49332
+ join53(fileURLToPath21(new URL("../../..", import.meta.url)), "stdlib", "design-kits"),
49241
49333
  // published CLI: <pkg>/dist/cli.mjs → <pkg>/stdlib/design-kits/
49242
- join52(fileURLToPath21(new URL("..", import.meta.url)), "stdlib", "design-kits")
49334
+ join53(fileURLToPath21(new URL("..", import.meta.url)), "stdlib", "design-kits")
49243
49335
  ];
49244
49336
  }
49245
49337
  });
@@ -49254,7 +49346,7 @@ __export(assets_exports, {
49254
49346
  verifyReport: () => verifyReport
49255
49347
  });
49256
49348
  import { readFileSync as readFileSync60 } from "node:fs";
49257
- import { basename as basename13 } from "node:path";
49349
+ import { basename as basename14 } from "node:path";
49258
49350
  function declaredAssets(dir) {
49259
49351
  return collectAssets(dir).map((a) => {
49260
49352
  const bytes2 = readFileSync60(a.path);
@@ -49335,7 +49427,7 @@ function verifyReport(dir, app, manifest) {
49335
49427
  }
49336
49428
  function addAssetPayload(manifest, filePath, opts) {
49337
49429
  const bytes2 = readFileSync60(filePath);
49338
- const name = opts.name ?? basename13(filePath);
49430
+ const name = opts.name ?? basename14(filePath);
49339
49431
  const sha2565 = assetSha256(bytes2);
49340
49432
  const record2 = {
49341
49433
  sha256: sha2565,
@@ -51009,7 +51101,7 @@ __export(run_exports, {
51009
51101
  });
51010
51102
  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
51103
  import { tmpdir as tmpdir4 } from "node:os";
51012
- import { dirname as dirname28, join as join53 } from "node:path";
51104
+ import { dirname as dirname29, join as join54 } from "node:path";
51013
51105
  import { fileURLToPath as fileURLToPath22 } from "node:url";
51014
51106
  function makePackageRunHandler(opts) {
51015
51107
  const store = new FileReleaseStore(opts.releaseRoot);
@@ -51038,7 +51130,7 @@ async function fetchBytes(url) {
51038
51130
  async function resolvePackage(source, workDir) {
51039
51131
  const isUrl2 = /^https?:\/\//i.test(source);
51040
51132
  if (!isUrl2 && existsSync55(source) && statSync13(source).isDirectory()) {
51041
- const appDirManifest = join53(source, "release-manifest.json");
51133
+ const appDirManifest = join54(source, "release-manifest.json");
51042
51134
  if (existsSync55(appDirManifest)) {
51043
51135
  const opened2 = openPackageDir(source);
51044
51136
  if (!opened2.validation.ok) {
@@ -51048,9 +51140,9 @@ async function resolvePackage(source, workDir) {
51048
51140
  const app2 = opened2.header?.app ?? opened2.manifest?.app;
51049
51141
  if (!app2) throw new Error(`${source} has no app id (no himi-package.json and no manifest.app)`);
51050
51142
  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) {
51143
+ const root2 = workDir ?? mkdtempSync3(join54(tmpdir4(), "himi-run-"));
51144
+ const target = join54(root2, app2);
51145
+ if (join54(source) !== target) {
51054
51146
  mkdirSync26(root2, { recursive: true });
51055
51147
  rmSync12(target, { recursive: true, force: true });
51056
51148
  cpSync2(source, target, { recursive: true });
@@ -51068,7 +51160,7 @@ async function resolvePackage(source, workDir) {
51068
51160
  throw new Error(`${source} is a directory but has no release-manifest.json \u2014 is it a package?`);
51069
51161
  }
51070
51162
  const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync61(source);
51071
- const root = workDir ?? mkdtempSync3(join53(tmpdir4(), "himi-run-"));
51163
+ const root = workDir ?? mkdtempSync3(join54(tmpdir4(), "himi-run-"));
51072
51164
  const { app, appDir: appDir2 } = unpackTo(bytes2, root);
51073
51165
  const opened = openPackageDir(appDir2);
51074
51166
  if (!opened.validation.ok) {
@@ -51089,11 +51181,11 @@ async function resolvePackage(source, workDir) {
51089
51181
  async function loadPreviewAssets() {
51090
51182
  try {
51091
51183
  const mod = await Promise.resolve().then(() => (init_preview_assets_generated(), preview_assets_generated_exports));
51092
- const here = dirname28(fileURLToPath22(import.meta.url));
51184
+ const here = dirname29(fileURLToPath22(import.meta.url));
51093
51185
  const candidates = [
51094
- join53(here, "preview-assets.generated.bin"),
51186
+ join54(here, "preview-assets.generated.bin"),
51095
51187
  // published: copied next to the bundled CLI
51096
- join53(here, "../../../packages/serve/src/preview-assets.generated.bin")
51188
+ join54(here, "../../../packages/serve/src/preview-assets.generated.bin")
51097
51189
  // in-repo checkout
51098
51190
  ];
51099
51191
  for (const path2 of candidates) {
@@ -51197,7 +51289,7 @@ __export(run_watch_exports, {
51197
51289
  });
51198
51290
  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
51291
  import { randomUUID as randomUUID3 } from "node:crypto";
51200
- import { extname as extname4, join as join54, resolve as resolve42, sep as sep13 } from "node:path";
51292
+ import { extname as extname4, join as join55, resolve as resolve42, sep as sep13 } from "node:path";
51201
51293
  function diffReleases(prev, next) {
51202
51294
  const bundles = Object.keys(next.bundles).filter((b) => prev.bundles[b]?.sha256 !== next.bundles[b].sha256).sort();
51203
51295
  const changedBundles = new Set(bundles);
@@ -51238,7 +51330,7 @@ function watchContent(dir, onChange, opts = {}) {
51238
51330
  let timer = null;
51239
51331
  const pending = /* @__PURE__ */ new Set();
51240
51332
  const watcher2 = watch2(dir, { recursive: true }, (_event, file) => {
51241
- if (!file || ignoredChange(file, (rel) => isDir(join54(dir, rel)))) return;
51333
+ if (!file || ignoredChange(file, (rel) => isDir(join55(dir, rel)))) return;
51242
51334
  pending.add(file);
51243
51335
  if (timer) clearTimeout(timer);
51244
51336
  timer = setTimeout(() => {
@@ -51259,7 +51351,7 @@ function watchedContentDir(source) {
51259
51351
  if (!source || /^https?:\/\//i.test(source)) return null;
51260
51352
  const dir = resolve42(source);
51261
51353
  try {
51262
- return statSync14(dir).isDirectory() && existsSync56(join54(dir, "himalaya.content.json")) ? dir : null;
51354
+ return statSync14(dir).isDirectory() && existsSync56(join55(dir, "himalaya.content.json")) ? dir : null;
51263
51355
  } catch {
51264
51356
  return null;
51265
51357
  }
@@ -51316,7 +51408,7 @@ function serialize(task) {
51316
51408
  });
51317
51409
  }
51318
51410
  function himiDir(dir) {
51319
- const root = join54(dir, ".himi");
51411
+ const root = join55(dir, ".himi");
51320
51412
  try {
51321
51413
  return lstatSync10(root).isDirectory() ? root : null;
51322
51414
  } catch (e) {
@@ -51328,11 +51420,11 @@ function himiDir(dir) {
51328
51420
  function writeRunRecord(dir, record2) {
51329
51421
  const root = himiDir(dir);
51330
51422
  if (!root) return false;
51331
- const tmp = join54(root, `.run.json.${process.pid}.${randomUUID3()}.tmp`);
51423
+ const tmp = join55(root, `.run.json.${process.pid}.${randomUUID3()}.tmp`);
51332
51424
  try {
51333
51425
  writeFileSync23(tmp, `${JSON.stringify(record2, null, 2)}
51334
51426
  `, { flag: "wx" });
51335
- renameSync6(tmp, join54(root, "run.json"));
51427
+ renameSync6(tmp, join55(root, "run.json"));
51336
51428
  } catch (e) {
51337
51429
  rmSync13(tmp, { force: true });
51338
51430
  throw e;
@@ -51340,7 +51432,7 @@ function writeRunRecord(dir, record2) {
51340
51432
  return true;
51341
51433
  }
51342
51434
  function removeRunRecord(dir, owner) {
51343
- const root = join54(dir, ".himi");
51435
+ const root = join55(dir, ".himi");
51344
51436
  try {
51345
51437
  if (!lstatSync10(root).isDirectory()) return;
51346
51438
  } catch {
@@ -51355,16 +51447,16 @@ function removeRunRecord(dir, owner) {
51355
51447
  }
51356
51448
  if (typeof pid === "number" && pid !== owner) return;
51357
51449
  }
51358
- rmSync13(join54(root, "run.json"), { force: true });
51450
+ rmSync13(join55(root, "run.json"), { force: true });
51359
51451
  }
51360
51452
  function boardFile(dir, pathname) {
51361
51453
  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");
51454
+ if (pathname === "/__himi/studio/" || pathname === "/__himi/studio/index.html") rel = join55("studio", "index.html");
51455
+ else if (pathname === "/__himi/studio/state.js") rel = join55("studio", "state.js");
51456
+ else if (pathname === "/__himi/studio/timeline.js") rel = join55("studio", "timeline.js");
51365
51457
  else {
51366
51458
  const m = /^\/__himi\/history\/([0-9a-f]{64}\.(png|jpg|gif|webp))$/.exec(pathname);
51367
- if (m) rel = join54("history", m[1]);
51459
+ if (m) rel = join55("history", m[1]);
51368
51460
  }
51369
51461
  if (!rel) return null;
51370
51462
  const bytes2 = readConfined(resolve42(dir, ".himi"), rel);
@@ -51380,7 +51472,7 @@ function readConfined(root, rel) {
51380
51472
  const parts = rel.split(sep13);
51381
51473
  let at = root;
51382
51474
  for (let i = 0; i < parts.length; i++) {
51383
- at = join54(at, parts[i]);
51475
+ at = join55(at, parts[i]);
51384
51476
  const st = lstatSync10(at);
51385
51477
  if (st.isSymbolicLink() || !(i === parts.length - 1 ? st.isFile() : st.isDirectory())) return null;
51386
51478
  }
@@ -51443,7 +51535,7 @@ __export(run_browser_exports, {
51443
51535
  import { createServer as createServer5 } from "node:http";
51444
51536
  import { existsSync as existsSync57, readFileSync as readFileSync63 } from "node:fs";
51445
51537
  import { spawnSync as spawnSync3 } from "node:child_process";
51446
- import { dirname as dirname29, resolve as resolve43 } from "node:path";
51538
+ import { dirname as dirname30, resolve as resolve43 } from "node:path";
51447
51539
  import { fileURLToPath as fileURLToPath23 } from "node:url";
51448
51540
  function stagedDir() {
51449
51541
  return process.env.HIMI_BROWSER_PLANE_OUT ? resolve43(process.env.HIMI_BROWSER_PLANE_OUT) : resolve43(REPO, "packages", "serve", "dist", "browser-plane");
@@ -51585,7 +51677,7 @@ var init_run_browser = __esm({
51585
51677
  init_open_url();
51586
51678
  init_file_store();
51587
51679
  init_wix_client_id();
51588
- HERE = dirname29(fileURLToPath23(import.meta.url));
51680
+ HERE = dirname30(fileURLToPath23(import.meta.url));
51589
51681
  REPO = resolve43(HERE, "..", "..", "..");
51590
51682
  SERVED = /* @__PURE__ */ new Set(["host.html", "sw.js", "package-reader.js"]);
51591
51683
  }
@@ -52006,9 +52098,9 @@ __export(preflight_exports, {
52006
52098
  requireEnv: () => requireEnv
52007
52099
  });
52008
52100
  import { existsSync as existsSync58, readFileSync as readFileSync64 } from "node:fs";
52009
- import { isAbsolute as isAbsolute3, relative as relative9, resolve as resolve44 } from "node:path";
52101
+ import { isAbsolute as isAbsolute3, relative as relative10, resolve as resolve44 } from "node:path";
52010
52102
  function isInsideRepo(p) {
52011
- const rel = relative9(REPO_ROOT3, resolve44(p));
52103
+ const rel = relative10(REPO_ROOT3, resolve44(p));
52012
52104
  return rel !== "" && !rel.startsWith("..") && !isAbsolute3(rel);
52013
52105
  }
52014
52106
  function assertCredentialOutsideRepo(label2, p) {
@@ -52086,17 +52178,17 @@ __export(credential_profile_exports, {
52086
52178
  });
52087
52179
  import { existsSync as existsSync59, readFileSync as readFileSync65 } from "node:fs";
52088
52180
  import { homedir as homedir5 } from "node:os";
52089
- import { join as join55 } from "node:path";
52181
+ import { join as join56 } from "node:path";
52090
52182
  function credentialsDir(home = homedir5()) {
52091
- return join55(home, ".himalaya", "store-credentials");
52183
+ return join56(home, ".himalaya", "store-credentials");
52092
52184
  }
52093
52185
  function profilePath(name, home = homedir5()) {
52094
52186
  if (!PROFILE_NAME.test(name)) {
52095
52187
  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.`
52188
+ `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
52189
  );
52098
52190
  }
52099
- return join55(credentialsDir(home), `${name}.json`);
52191
+ return join56(credentialsDir(home), `${name}.json`);
52100
52192
  }
52101
52193
  function parseProfile(text5, label2) {
52102
52194
  let doc;
@@ -52210,7 +52302,7 @@ __export(preflight_app_exports, {
52210
52302
  });
52211
52303
  import { readFileSync as readFileSync66, existsSync as existsSync60, readdirSync as readdirSync28, statSync as statSync15 } from "node:fs";
52212
52304
  import { createHash as createHash26 } from "node:crypto";
52213
- import { join as join56 } from "node:path";
52305
+ import { join as join57 } from "node:path";
52214
52306
  function analyze(projectYml, storeConfig, icon, account) {
52215
52307
  const f = [];
52216
52308
  const has = (re, s) => re.test(s);
@@ -52280,7 +52372,7 @@ async function preflightApp(app, opts = {}) {
52280
52372
  const findings = analyze(
52281
52373
  projectYml,
52282
52374
  storeConfig,
52283
- await appIconState(join56(appDir(app), "ios")),
52375
+ await appIconState(join57(appDir(app), "ios")),
52284
52376
  profileAccount(app, storeConfig, opts)
52285
52377
  );
52286
52378
  findings.push(...analyzeListing(metadataFilesPresent(app), listScreenshots(app)));
@@ -52309,16 +52401,16 @@ function analyzeSubmissionRecord(appLevel, review, opts) {
52309
52401
  return f;
52310
52402
  }
52311
52403
  function appLevelMetadataFiles(app, locale = "en-US") {
52312
- const root = join56(storeDir(app), "metadata");
52404
+ const root = join57(storeDir(app), "metadata");
52313
52405
  const out = /* @__PURE__ */ new Set();
52314
52406
  if (existsSync60(root)) {
52315
52407
  for (const n of readdirSync28(root)) if (n.endsWith(".txt")) out.add(n);
52316
52408
  }
52317
- if (existsSync60(join56(root, locale, "privacy_url.txt"))) out.add("privacy_url.txt");
52409
+ if (existsSync60(join57(root, locale, "privacy_url.txt"))) out.add("privacy_url.txt");
52318
52410
  return out;
52319
52411
  }
52320
52412
  function reviewInfoFiles(app) {
52321
- const dir = join56(storeDir(app), "review_information");
52413
+ const dir = join57(storeDir(app), "review_information");
52322
52414
  if (!existsSync60(dir)) return /* @__PURE__ */ new Set();
52323
52415
  return new Set(readdirSync28(dir).filter((n) => n.endsWith(".txt")));
52324
52416
  }
@@ -52429,10 +52521,10 @@ function analyzePlayListing(assets) {
52429
52521
  return f;
52430
52522
  }
52431
52523
  function playListingAssets(app, locale = "en-US") {
52432
- const dir = join56(storeDir(app), "play", locale, "images");
52524
+ const dir = join57(storeDir(app), "play", locale, "images");
52433
52525
  const read = (names) => {
52434
52526
  for (const name of names) {
52435
- const p = join56(dir, name);
52527
+ const p = join57(dir, name);
52436
52528
  try {
52437
52529
  if (statSync15(p).isFile()) return { name, bytes: readFileSync66(p) };
52438
52530
  } catch {
@@ -52465,26 +52557,26 @@ function analyzeListing(metaFiles, shots) {
52465
52557
  return f;
52466
52558
  }
52467
52559
  function metadataFilesPresent(app, locale = "en-US") {
52468
- const dir = join56(storeDir(app), "metadata", locale);
52560
+ const dir = join57(storeDir(app), "metadata", locale);
52469
52561
  if (!existsSync60(dir)) return /* @__PURE__ */ new Set();
52470
52562
  return new Set(readdirSync28(dir).filter((n) => n.endsWith(".txt")));
52471
52563
  }
52472
52564
  function listScreenshots(app, locale = "en-US") {
52473
52565
  const out = [];
52474
- const flat = join56(storeDir(app), "screenshots", locale);
52566
+ const flat = join57(storeDir(app), "screenshots", locale);
52475
52567
  if (existsSync60(flat)) {
52476
52568
  for (const png of readdirSync28(flat).filter((n) => n.endsWith(".png"))) {
52477
- const sz = pngSize(readFileSync66(join56(flat, png)));
52569
+ const sz = pngSize(readFileSync66(join57(flat, png)));
52478
52570
  if (sz) out.push({ name: png, w: sz.w, h: sz.h });
52479
52571
  }
52480
52572
  }
52481
- const legacy = join56(storeDir(app), "metadata", locale, "screenshots");
52573
+ const legacy = join57(storeDir(app), "metadata", locale, "screenshots");
52482
52574
  if (existsSync60(legacy)) {
52483
52575
  for (const deviceDir of readdirSync28(legacy)) {
52484
- const d = join56(legacy, deviceDir);
52576
+ const d = join57(legacy, deviceDir);
52485
52577
  if (!statSync15(d).isDirectory()) continue;
52486
52578
  for (const png of readdirSync28(d).filter((n) => n.endsWith(".png"))) {
52487
- const sz = pngSize(readFileSync66(join56(d, png)));
52579
+ const sz = pngSize(readFileSync66(join57(d, png)));
52488
52580
  if (sz) out.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
52489
52581
  }
52490
52582
  }
@@ -52492,10 +52584,10 @@ function listScreenshots(app, locale = "en-US") {
52492
52584
  return out;
52493
52585
  }
52494
52586
  function placeholderHashes2() {
52495
- const templateIos = join56(appDir("_template"), "ios");
52587
+ const templateIos = join57(appDir("_template"), "ios");
52496
52588
  if (!existsSync60(templateIos)) return [LEGACY_PLACEHOLDER_SHA2562];
52497
52589
  for (const target of readdirSync28(templateIos)) {
52498
- const p = join56(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52590
+ const p = join57(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52499
52591
  try {
52500
52592
  if (!statSync15(p).isFile()) continue;
52501
52593
  return [LEGACY_PLACEHOLDER_SHA2562, createHash26("sha256").update(readFileSync66(p)).digest("hex")];
@@ -52531,7 +52623,7 @@ async function pixelIssues(bytes2) {
52531
52623
  async function appIconState(iosDir) {
52532
52624
  if (!existsSync60(iosDir)) return { exists: false, isPlaceholder: false, storeIssues: [] };
52533
52625
  for (const target of readdirSync28(iosDir)) {
52534
- const p = join56(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52626
+ const p = join57(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
52535
52627
  try {
52536
52628
  if (!statSync15(p).isFile()) continue;
52537
52629
  const bytes2 = readFileSync66(p);
@@ -52817,7 +52909,7 @@ var init_asc_status = __esm({
52817
52909
  // ../../core/functions-secrets/src/vault.ts
52818
52910
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes5 } from "node:crypto";
52819
52911
  import { mkdir, readFile as readFile2, rename, writeFile as writeFile2 } from "node:fs/promises";
52820
- import { dirname as dirname30 } from "node:path";
52912
+ import { dirname as dirname31 } from "node:path";
52821
52913
  function createJsonSecretStore(filePath) {
52822
52914
  const read = async () => {
52823
52915
  try {
@@ -52830,7 +52922,7 @@ function createJsonSecretStore(filePath) {
52830
52922
  }
52831
52923
  };
52832
52924
  const write2 = async (records) => {
52833
- await mkdir(dirname30(filePath), { recursive: true });
52925
+ await mkdir(dirname31(filePath), { recursive: true });
52834
52926
  const temporary = `${filePath}.${process.pid}.tmp`;
52835
52927
  await writeFile2(temporary, `${JSON.stringify(records, null, 2)}
52836
52928
  `, { mode: 384 });
@@ -53026,9 +53118,9 @@ __export(notify_exports, {
53026
53118
  });
53027
53119
  import { chmodSync as chmodSync3, mkdirSync as mkdirSync28, readFileSync as readFileSync71, writeFileSync as writeFileSync25 } from "node:fs";
53028
53120
  import { homedir as homedir6 } from "node:os";
53029
- import { dirname as dirname31, join as join57 } from "node:path";
53121
+ import { dirname as dirname32, join as join58 } from "node:path";
53030
53122
  function defaultSessionsPath() {
53031
- return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join57(homedir6(), ".himalaya", "admin-sessions.json");
53123
+ return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join58(homedir6(), ".himalaya", "admin-sessions.json");
53032
53124
  }
53033
53125
  function loadSessionsFile(path2 = defaultSessionsPath()) {
53034
53126
  try {
@@ -53040,10 +53132,10 @@ function loadSessionsFile(path2 = defaultSessionsPath()) {
53040
53132
  function saveAdminSession(adminUrl, session, path2 = defaultSessionsPath()) {
53041
53133
  const file = loadSessionsFile(path2);
53042
53134
  file.sessions = { ...file.sessions, [adminUrl]: session };
53043
- mkdirSync28(dirname31(path2), { recursive: true, mode: 448 });
53135
+ mkdirSync28(dirname32(path2), { recursive: true, mode: 448 });
53044
53136
  writeFileSync25(path2, JSON.stringify(file, null, 2) + "\n", { mode: 384 });
53045
53137
  try {
53046
- chmodSync3(dirname31(path2), 448);
53138
+ chmodSync3(dirname32(path2), 448);
53047
53139
  chmodSync3(path2, 384);
53048
53140
  } catch {
53049
53141
  }
@@ -56972,7 +57064,7 @@ var init_brand_font = __esm({
56972
57064
 
56973
57065
  // src/site-analyze/write-artifacts.ts
56974
57066
  import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync26 } from "node:fs";
56975
- import { join as join58 } from "node:path";
57067
+ import { join as join59 } from "node:path";
56976
57068
  function attachVeloSources(book, sources, put) {
56977
57069
  const byPath = new Map((sources ?? []).map((s) => [s.path, s.text]));
56978
57070
  for (const f of book.velo.files) {
@@ -57127,12 +57219,12 @@ async function downloadMedia(book, fetchImpl, put) {
57127
57219
  }
57128
57220
  async function writeBusinessBook(result, opts) {
57129
57221
  const out = opts.outDir;
57130
- mkdirSync29(join58(out, "evidence/pages"), { recursive: true });
57131
- mkdirSync29(join58(out, "media/catalog"), { recursive: true });
57222
+ mkdirSync29(join59(out, "evidence/pages"), { recursive: true });
57223
+ mkdirSync29(join59(out, "media/catalog"), { recursive: true });
57132
57224
  const files = [];
57133
57225
  const put = (rel, body) => {
57134
- const p = join58(out, rel);
57135
- mkdirSync29(join58(p, ".."), { recursive: true });
57226
+ const p = join59(out, rel);
57227
+ mkdirSync29(join59(p, ".."), { recursive: true });
57136
57228
  writeFileSync26(p, body);
57137
57229
  files.push(rel);
57138
57230
  };
@@ -57227,7 +57319,7 @@ var init_customer_build = __esm({
57227
57319
 
57228
57320
  // src/site-analyze/apply.ts
57229
57321
  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";
57322
+ import { dirname as dirname33, isAbsolute as isAbsolute4, join as join60, resolve as resolve45, sep as sep14 } from "node:path";
57231
57323
  import { spawnSync as spawnSync4 } from "node:child_process";
57232
57324
  function unpairedRedirectNote(overlay) {
57233
57325
  if (!overlay.wix?.clientId || overlay.wix.redirectUri) return void 0;
@@ -57242,8 +57334,8 @@ function committedShellProvisioning(path2) {
57242
57334
  function findRepoRoot(cwd) {
57243
57335
  let dir = cwd;
57244
57336
  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);
57337
+ if (SHELL_NAMES2.some((name) => existsSync61(join60(dir, shellAppDir(name), "package.json")))) return dir;
57338
+ const next = dirname33(dir);
57247
57339
  if (next === dir) break;
57248
57340
  dir = next;
57249
57341
  }
@@ -57311,7 +57403,7 @@ function mergeCustomerOwned(committed, overlay) {
57311
57403
  }
57312
57404
  function buildMergedContract(options) {
57313
57405
  const { appDir: appDir2, packageDir, overlay } = options;
57314
- const committedPath = join59(appDir2, "provisioning.json");
57406
+ const committedPath = join60(appDir2, "provisioning.json");
57315
57407
  if (!existsSync61(committedPath)) {
57316
57408
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
57317
57409
  }
@@ -57327,7 +57419,7 @@ function buildMergedContract(options) {
57327
57419
  };
57328
57420
  const stage = (fromRel, toRel) => {
57329
57421
  const from = contained(packageDir, fromRel);
57330
- const to = contained(join59(appDir2, STAGED), toRel.slice(STAGED.length + 1));
57422
+ const to = contained(join60(appDir2, STAGED), toRel.slice(STAGED.length + 1));
57331
57423
  if (!from || !to || !existsSync61(from)) return void 0;
57332
57424
  let real;
57333
57425
  let realRoot;
@@ -57340,7 +57432,7 @@ function buildMergedContract(options) {
57340
57432
  if (!real.startsWith(realRoot + sep14)) return void 0;
57341
57433
  try {
57342
57434
  if (!statSync16(real).isFile()) return void 0;
57343
- mkdirSync30(dirname32(to), { recursive: true });
57435
+ mkdirSync30(dirname33(to), { recursive: true });
57344
57436
  copyFileSync3(real, to);
57345
57437
  } catch {
57346
57438
  return void 0;
@@ -57350,7 +57442,7 @@ function buildMergedContract(options) {
57350
57442
  };
57351
57443
  const icon = stage("media/icon.png", `${STAGED}/icon.png`);
57352
57444
  if (icon) branding.appIconPath = icon;
57353
- const facesPath = join59(packageDir, "media/fonts/faces.json");
57445
+ const facesPath = join60(packageDir, "media/fonts/faces.json");
57354
57446
  if (existsSync61(facesPath)) {
57355
57447
  let faces = [];
57356
57448
  try {
@@ -57375,10 +57467,10 @@ function buildMergedContract(options) {
57375
57467
  merged.branding = branding;
57376
57468
  const body = `${JSON.stringify(merged, null, 2)}
57377
57469
  `;
57378
- const path2 = join59(packageDir, "provisioning.contract.json");
57470
+ const path2 = join60(packageDir, "provisioning.contract.json");
57379
57471
  writeFileSync27(path2, body);
57380
- const localPath = join59(appDir2, LOCAL_CONTRACT_REL);
57381
- mkdirSync30(dirname32(localPath), { recursive: true });
57472
+ const localPath = join60(appDir2, LOCAL_CONTRACT_REL);
57473
+ mkdirSync30(dirname33(localPath), { recursive: true });
57382
57474
  writeFileSync27(localPath, body);
57383
57475
  staged.push(localPath);
57384
57476
  return { path: path2, staged };
@@ -57412,7 +57504,7 @@ function catalogTypography(overlay, template) {
57412
57504
  function staticFaqFor(overlay, overlayPath) {
57413
57505
  const own3 = overlay.faq;
57414
57506
  if (own3 !== void 0) return deriveStaticFaq(own3);
57415
- const bookPath = join59(dirname32(resolve45(overlayPath)), "book.json");
57507
+ const bookPath = join60(dirname33(resolve45(overlayPath)), "book.json");
57416
57508
  if (!existsSync61(bookPath)) return void 0;
57417
57509
  try {
57418
57510
  const book = JSON.parse(readFileSync72(bookPath, "utf8"));
@@ -57442,8 +57534,8 @@ async function applyOverlays(input) {
57442
57534
  `shell "${shell}" cannot bake a customer brand \u2014 it ships no prepare:customer script`
57443
57535
  );
57444
57536
  }
57445
- const appDir2 = join59(repoRoot2, shellAppDir(shell));
57446
- const packageDir = dirname32(resolve45(input.overlayPath));
57537
+ const appDir2 = join60(repoRoot2, shellAppDir(shell));
57538
+ const packageDir = dirname33(resolve45(input.overlayPath));
57447
57539
  const { path: contract, staged } = buildMergedContract({ appDir: appDir2, packageDir, overlay });
57448
57540
  wrote.push(...staged);
57449
57541
  const r = spawnSync4("npm", ["run", "prepare:customer", "--", "--contract", contract], {
@@ -57464,7 +57556,7 @@ async function applyOverlays(input) {
57464
57556
  note: `prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
57465
57557
  };
57466
57558
  }
57467
- const pkgProv = join59(cwd, "provisioning.json");
57559
+ const pkgProv = join60(cwd, "provisioning.json");
57468
57560
  assertNotCommitted(pkgProv, input.forbiddenProvisioning);
57469
57561
  let packageFaq = faq;
57470
57562
  if (existsSync61(pkgProv)) {
@@ -57477,7 +57569,7 @@ async function applyOverlays(input) {
57477
57569
  writeFileSync27(pkgProv, JSON.stringify(overlay, null, 2) + "\n");
57478
57570
  wrote.push(pkgProv);
57479
57571
  }
57480
- const pkgTokens = join59(cwd, "tokens.json");
57572
+ const pkgTokens = join60(cwd, "tokens.json");
57481
57573
  if (existsSync61(pkgTokens) && (tokens.colors || tokens.typography)) {
57482
57574
  const cur = JSON.parse(readFileSync72(pkgTokens, "utf8"));
57483
57575
  let tokensIn = tokens;
@@ -57504,7 +57596,7 @@ async function applyOverlays(input) {
57504
57596
  wrote.push(pkgTokens);
57505
57597
  }
57506
57598
  const homeAction = homeRefreshActionId(shell);
57507
- const homeSrc = join59(cwd, "dev/index.ts");
57599
+ const homeSrc = join60(cwd, "dev/index.ts");
57508
57600
  if (homeAction && existsSync61(homeSrc)) {
57509
57601
  const prev = readFileSync72(homeSrc, "utf8");
57510
57602
  const patched = patchBrandParams(prev, overlay, homeAction);
@@ -57538,7 +57630,7 @@ async function applyOverlays(input) {
57538
57630
  }
57539
57631
  }
57540
57632
  if (!input.iconPath || !existsSync61(input.iconPath)) {
57541
- const book = input.iconPath ? dirname32(dirname32(resolve45(input.iconPath))) : void 0;
57633
+ const book = input.iconPath ? dirname33(dirname33(resolve45(input.iconPath))) : void 0;
57542
57634
  notes.push(
57543
57635
  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
57636
  );
@@ -62914,7 +63006,7 @@ import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync75, mkdirSync
62914
63006
  import { execFile, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn6 } from "node:child_process";
62915
63007
  import { createHash as createHash27, randomUUID as randomUUID5 } from "node:crypto";
62916
63008
  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";
63009
+ import { join as join61, resolve as resolve47, relative as relative11, basename as basename15, dirname as dirname34 } from "node:path";
62918
63010
  import { fileURLToPath as fileURLToPath24 } from "node:url";
62919
63011
 
62920
63012
  // ../serve-cli/src/client.ts
@@ -66035,7 +66127,7 @@ var str6 = (v) => typeof v === "string" ? v : void 0;
66035
66127
  var num2 = (v) => typeof v === "string" && v !== "" && Number.isFinite(Number(v)) ? Number(v) : void 0;
66036
66128
  function embeddedTemplateCatalog() {
66037
66129
  return availableTemplates().map((name) => {
66038
- const path2 = join60(templateSourceDir(name), TEMPLATE_META_FILE);
66130
+ const path2 = join61(templateSourceDir(name), TEMPLATE_META_FILE);
66039
66131
  const meta = JSON.parse(readFileSync75(path2, "utf8"));
66040
66132
  if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
66041
66133
  throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
@@ -66839,9 +66931,9 @@ function packageVersion(path2) {
66839
66931
  function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("./authoring-runtime/node_modules/@wix/himalaya/package.json", import.meta.url)) {
66840
66932
  let dir = resolve47(fromDir);
66841
66933
  for (; ; ) {
66842
- const version2 = packageVersion(join60(dir, "node_modules", "@wix", "himalaya", "package.json"));
66934
+ const version2 = packageVersion(join61(dir, "node_modules", "@wix", "himalaya", "package.json"));
66843
66935
  if (version2) return { version: version2, source: "local" };
66844
- const parent = dirname33(dir);
66936
+ const parent = dirname34(dir);
66845
66937
  if (parent === dir) break;
66846
66938
  dir = parent;
66847
66939
  }
@@ -66849,7 +66941,7 @@ function resolvedSdkVersion(fromDir = process.cwd(), bundledManifest = new URL("
66849
66941
  if (bundled) return { version: bundled, source: "bundled" };
66850
66942
  try {
66851
66943
  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;
66944
+ const version2 = root ? packageVersion(join61(root, "@wix", "himalaya", "package.json")) : void 0;
66853
66945
  return version2 ? { version: version2, source: "global" } : {};
66854
66946
  } catch {
66855
66947
  return {};
@@ -66896,7 +66988,7 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
66896
66988
  var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
66897
66989
  var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
66898
66990
  function updateCachePath(env = process.env) {
66899
- return env.HIMI_UPDATE_CACHE_FILE ?? join60(homedir7(), ".himalaya", "update-check.json");
66991
+ return env.HIMI_UPDATE_CACHE_FILE ?? join61(homedir7(), ".himalaya", "update-check.json");
66900
66992
  }
66901
66993
  function readUpdateCache(path2) {
66902
66994
  try {
@@ -66908,7 +67000,7 @@ function readUpdateCache(path2) {
66908
67000
  }
66909
67001
  function writeUpdateCache(path2, cache) {
66910
67002
  try {
66911
- mkdirSync31(dirname33(path2), { recursive: true, mode: 448 });
67003
+ mkdirSync31(dirname34(path2), { recursive: true, mode: 448 });
66912
67004
  writeFileSync29(path2, JSON.stringify(cache, null, 2) + "\n", { mode: 384 });
66913
67005
  } catch {
66914
67006
  }
@@ -66968,11 +67060,11 @@ function createUpdateRunner(spawn7 = spawnSync5) {
66968
67060
  },
66969
67061
  installedVersion: () => {
66970
67062
  const root = globalNodeModulesRoot();
66971
- return root ? packageVersion(join60(root, "@wix", "himalaya-cli", "package.json")) : void 0;
67063
+ return root ? packageVersion(join61(root, "@wix", "himalaya-cli", "package.json")) : void 0;
66972
67064
  },
66973
67065
  reexec: (argv) => {
66974
67066
  const root = globalNodeModulesRoot();
66975
- const entry = root ? join60(root, "@wix", "himalaya-cli", "dist", "cli.mjs") : void 0;
67067
+ const entry = root ? join61(root, "@wix", "himalaya-cli", "dist", "cli.mjs") : void 0;
66976
67068
  if (!entry || !existsSync63(entry)) return void 0;
66977
67069
  const result = spawnSync5(process.execPath, [entry, ...argv], {
66978
67070
  // inherit keeps PIPED STDIN working — commands that read stdin must survive a re-exec.
@@ -67064,7 +67156,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
67064
67156
  };
67065
67157
  const release = () => removeIfMine(lockPath);
67066
67158
  try {
67067
- mkdirSync31(dirname33(lockPath), { recursive: true, mode: 448 });
67159
+ mkdirSync31(dirname34(lockPath), { recursive: true, mode: 448 });
67068
67160
  } catch {
67069
67161
  return () => {
67070
67162
  };
@@ -67627,7 +67719,7 @@ function executableOnPath(name, env = process.env) {
67627
67719
  const suffixes = process.platform === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
67628
67720
  for (const dir of entries) {
67629
67721
  for (const suffix of suffixes) {
67630
- const candidate = join60(dir, `${name}${suffix}`);
67722
+ const candidate = join61(dir, `${name}${suffix}`);
67631
67723
  try {
67632
67724
  if (!statSync17(candidate).isFile()) continue;
67633
67725
  if (process.platform !== "win32") accessSync(candidate, constants2.X_OK);
@@ -67750,13 +67842,13 @@ async function nativeConfigAdvisories(app, configSource) {
67750
67842
  }
67751
67843
  function readConfigSource(dir) {
67752
67844
  try {
67753
- return readFileSync75(join60(dir, "config.ts"), "utf8");
67845
+ return readFileSync75(join61(dir, "config.ts"), "utf8");
67754
67846
  } catch {
67755
67847
  return null;
67756
67848
  }
67757
67849
  }
67758
67850
  function writePngFile(path2, base64) {
67759
- mkdirSync31(dirname33(path2), { recursive: true });
67851
+ mkdirSync31(dirname34(path2), { recursive: true });
67760
67852
  writeFileSync29(path2, Buffer.from(base64, "base64"));
67761
67853
  return path2;
67762
67854
  }
@@ -67786,7 +67878,7 @@ function keptPlan(kept) {
67786
67878
  }
67787
67879
  async function initFromRemoteTemplate(name, parentDir, template, c) {
67788
67880
  const dir = resolve47(parentDir, name);
67789
- if (existsSync63(join60(dir, "himalaya.content.json"))) {
67881
+ if (existsSync63(join61(dir, "himalaya.content.json"))) {
67790
67882
  throw new Error(`content package already exists at ${dir}`);
67791
67883
  }
67792
67884
  const r = await c.fetchTemplateSource(TEMPLATE_APP_PREFIX + template);
@@ -67844,8 +67936,8 @@ function restoreDestinationIssue(dest, force) {
67844
67936
  function isHimalayaMonorepoCheckout(start) {
67845
67937
  let dir = resolve47(start);
67846
67938
  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);
67939
+ if (existsSync63(join61(dir, "tools", "himi-cli", "src", "cli.ts")) && existsSync63(join61(dir, "core", "serve", "src", "server.ts"))) return true;
67940
+ const parent = dirname34(dir);
67849
67941
  if (parent === dir) return false;
67850
67942
  dir = parent;
67851
67943
  }
@@ -67882,7 +67974,7 @@ function shellShaDivergenceWarnings(jobs) {
67882
67974
  }
67883
67975
  async function templatePublishName(sourceDir) {
67884
67976
  const id = await appId(sourceDir);
67885
- return IDENTITY_SENTINELS.some((s) => id.includes(s)) ? basename14(sourceDir) : id;
67977
+ return IDENTITY_SENTINELS.some((s) => id.includes(s)) ? basename15(sourceDir) : id;
67886
67978
  }
67887
67979
  function templateNameError(name, from) {
67888
67980
  if (name.startsWith(TEMPLATE_APP_PREFIX)) {
@@ -67905,7 +67997,7 @@ function materializeForPreview(appDir2, slug, displayName) {
67905
67997
  Object.entries(files).map(([rel, body]) => [rel, rel === "himalaya.content.json" ? substituteIdentity(body, slug) : body])
67906
67998
  );
67907
67999
  const repoRoot2 = resolve47(fileURLToPath24(new URL("../../..", import.meta.url)));
67908
- const root = join60(repoRoot2, "node_modules", ".cache", "himi-template-preview");
68000
+ const root = join61(repoRoot2, "node_modules", ".cache", "himi-template-preview");
67909
68001
  const stillRunning = (pid) => {
67910
68002
  try {
67911
68003
  process.kill(pid, 0);
@@ -67919,12 +68011,12 @@ function materializeForPreview(appDir2, slug, displayName) {
67919
68011
  if (!entry.isDirectory()) continue;
67920
68012
  const pid = Number(entry.name.startsWith(`${slug}-`) ? entry.name.slice(slug.length + 1) : NaN);
67921
68013
  if (Number.isInteger(pid) && pid > 0 && pid !== process.pid && !stillRunning(pid)) {
67922
- rmSync14(join60(root, entry.name), { recursive: true, force: true });
68014
+ rmSync14(join61(root, entry.name), { recursive: true, force: true });
67923
68015
  }
67924
68016
  }
67925
68017
  } catch {
67926
68018
  }
67927
- const dest = join60(root, `${slug}-${process.pid}`);
68019
+ const dest = join61(root, `${slug}-${process.pid}`);
67928
68020
  rmSync14(dest, { recursive: true, force: true });
67929
68021
  mkdirSync31(dest, { recursive: true });
67930
68022
  try {
@@ -67938,16 +68030,16 @@ function materializeForPreview(appDir2, slug, displayName) {
67938
68030
  async function appId(dir) {
67939
68031
  try {
67940
68032
  const { readFileSync: readFileSync76 } = await import("node:fs");
67941
- const m = JSON.parse(readFileSync76(join60(dir, "himalaya.content.json"), "utf8"));
68033
+ const m = JSON.parse(readFileSync76(join61(dir, "himalaya.content.json"), "utf8"));
67942
68034
  if (m.name) return m.name;
67943
68035
  } catch {
67944
68036
  }
67945
- return basename14(dir);
68037
+ return basename15(dir);
67946
68038
  }
67947
68039
  async function contentVisibility(dir) {
67948
68040
  try {
67949
68041
  const { readFileSync: readFileSync76 } = await import("node:fs");
67950
- const m = JSON.parse(readFileSync76(join60(dir, "himalaya.content.json"), "utf8"));
68042
+ const m = JSON.parse(readFileSync76(join61(dir, "himalaya.content.json"), "utf8"));
67951
68043
  if (m.visibility === "public" || m.visibility === "unlisted") return m.visibility;
67952
68044
  } catch {
67953
68045
  }
@@ -68171,7 +68263,7 @@ Seed your coding agent with \`himi agent-init\`. Guides: ${idx.portalUrl}`);
68171
68263
  ...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
68264
  // In a git repo the refresh moves the diff identity an earlier `himi test` attested (that
68173
68265
  // 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" } : {},
68266
+ ...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
68267
  ...res.skipped.length ? { skipped: res.skipped } : {},
68176
68268
  portalUrl: idx.portalUrl
68177
68269
  });
@@ -68194,7 +68286,7 @@ async function recordedReleaseForContentQuietly(dir, resolution, onDrift) {
68194
68286
  try {
68195
68287
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
68196
68288
  const bres = await buildContentForValidation2(dir, { resolution });
68197
- out = mkdtempSync4(join60(tmpdir5(), "himi-ux-record-"));
68289
+ out = mkdtempSync4(join61(tmpdir5(), "himi-ux-record-"));
68198
68290
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
68199
68291
  const outcome = await buildReleaseFromContent2(dir, out, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {}, collect: { lint: true } });
68200
68292
  const releaseId = outcome.manifest.releaseId;
@@ -68372,7 +68464,7 @@ async function producedWidgetFamilies(dir) {
68372
68464
  let js;
68373
68465
  for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
68374
68466
  try {
68375
- js = readFileSync75(join60(outDir, candidate), "utf8");
68467
+ js = readFileSync75(join61(outDir, candidate), "utf8");
68376
68468
  break;
68377
68469
  } catch {
68378
68470
  }
@@ -68403,7 +68495,7 @@ async function producedWidgetFamilies(dir) {
68403
68495
  }
68404
68496
  return { families, source: "dist/bundles" };
68405
68497
  }
68406
- var boardOpen = (dir) => existsSync63(join60(dir, ".himi", "studio", "index.html"));
68498
+ var boardOpen = (dir) => existsSync63(join61(dir, ".himi", "studio", "index.html"));
68407
68499
  var BOARD_REFRESHERS = /* @__PURE__ */ new Set(["render", "test", "validate", "build", "push", "icon", "site", "ux", "progress"]);
68408
68500
  async function leaveForBoard(dir, record2, value) {
68409
68501
  if (!boardOpen(dir)) return;
@@ -68683,7 +68775,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68683
68775
  const owed = openApprovals2(readApprovals2(dir).events).length;
68684
68776
  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
68777
  }
68686
- const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f) => existsSync63(join60(parentDir, f)));
68778
+ const planInParent = ["SPEC.md", "MOBILE-UX.md"].filter((f) => existsSync63(join61(parentDir, f)));
68687
68779
  if (planInParent.length) {
68688
68780
  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
68781
  }
@@ -68810,7 +68902,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68810
68902
  const sourceDir = resolve47(str6(flags["source-dir"]) ?? appDir2);
68811
68903
  let meta;
68812
68904
  try {
68813
- meta = JSON.parse(readFileSync75(join60(sourceDir, TEMPLATE_META_FILE), "utf8"));
68905
+ meta = JSON.parse(readFileSync75(join61(sourceDir, TEMPLATE_META_FILE), "utf8"));
68814
68906
  } catch {
68815
68907
  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
68908
  return 2;
@@ -68820,7 +68912,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68820
68912
  return 2;
68821
68913
  }
68822
68914
  try {
68823
- const appearance = extractTemplateAppearance(JSON.parse(readFileSync75(join60(sourceDir, "tokens.json"), "utf8")));
68915
+ const appearance = extractTemplateAppearance(JSON.parse(readFileSync75(join61(sourceDir, "tokens.json"), "utf8")));
68824
68916
  meta = { ...appearance, ...meta };
68825
68917
  } catch {
68826
68918
  }
@@ -68842,7 +68934,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
68842
68934
  const force = flags.force === true;
68843
68935
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
68844
68936
  const bres = await buildContentForValidation2(buildDir, { resolution: resolutionFlag(flags) });
68845
- const out = mkdtempSync4(join60(tmpdir5(), "himi-template-"));
68937
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-template-"));
68846
68938
  publishScratch.push(out);
68847
68939
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
68848
68940
  const outcome = await buildReleaseFromContent2(buildDir, out, {
@@ -69138,7 +69230,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69138
69230
  const { navIssues: navIssues2 } = await Promise.resolve().then(() => (init_nav_lint(), nav_lint_exports));
69139
69231
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
69140
69232
  const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
69141
- const out = mkdtempSync4(join60(tmpdir5(), "himi-validate-"));
69233
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-validate-"));
69142
69234
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
69143
69235
  const outcome = await buildReleaseFromContent2(dir, out, {
69144
69236
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -69301,15 +69393,15 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69301
69393
  case "studio": {
69302
69394
  const { openStudio: openStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
69303
69395
  const dir = contentDir(flags);
69304
- if (!existsSync63(join60(dir, "himalaya.content.json"))) {
69396
+ if (!existsSync63(join61(dir, "himalaya.content.json"))) {
69305
69397
  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
69398
  return 2;
69307
69399
  }
69308
69400
  if (pos[1] === "reel") {
69309
69401
  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"));
69402
+ const out = resolve47(str6(flags.out) ?? join61(dir, ".himi", "making-of.html"));
69311
69403
  const { html, plan } = buildReel2(dir);
69312
- mkdirSync31(dirname33(out), { recursive: true });
69404
+ mkdirSync31(dirname34(out), { recursive: true });
69313
69405
  writeFileSync29(out, html);
69314
69406
  const { pathToFileURL: pathToFileURL9 } = await import("node:url");
69315
69407
  const url2 = pathToFileURL9(out).href;
@@ -69374,7 +69466,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69374
69466
  } = await Promise.resolve().then(() => (init_progress(), progress_exports));
69375
69467
  const dir = contentDir(flags);
69376
69468
  const journal = journalPath2(dir);
69377
- const isContentPackage = existsSync63(join60(dir, "himalaya.content.json"));
69469
+ const isContentPackage = existsSync63(join61(dir, "himalaya.content.json"));
69378
69470
  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
69471
  const message = pos.slice(1).join(" ").trim();
69380
69472
  const approvalFlags = ["approve", "done", "drop"].filter((f) => flags[f] !== void 0);
@@ -69510,7 +69602,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69510
69602
  case "test": {
69511
69603
  const dir = contentDir(flags);
69512
69604
  const structuredOutput = flags.json === true || io.isTTY !== true;
69513
- if (existsSync63(join60(dir, "functions"))) {
69605
+ if (existsSync63(join61(dir, "functions"))) {
69514
69606
  const { invokeLocalFunction: invokeLocalFunction2, loadFunctionsApp: loadFunctionsApp2 } = await Promise.resolve().then(() => (init_functions(), functions_exports));
69515
69607
  const loaded = await loadFunctionsApp2(dir);
69516
69608
  const results = [];
@@ -69597,7 +69689,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69597
69689
  }
69598
69690
  }
69599
69691
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
69600
- const out = mkdtempSync4(join60(tmpdir5(), "himi-test-"));
69692
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-test-"));
69601
69693
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
69602
69694
  const outcome = await buildReleaseFromContent2(dir, out, {
69603
69695
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -69642,7 +69734,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69642
69734
  io.error(JSON.stringify({ error: `screen "${screen.screenId}" has no Tier-5 worker, so there is nothing for the browser loop to build` }));
69643
69735
  return 2;
69644
69736
  }
69645
- const sources = collectWorkerSources2(join60(dir, "tier5-src"), screen.bundleName);
69737
+ const sources = collectWorkerSources2(join61(dir, "tier5-src"), screen.bundleName);
69646
69738
  if (!sources) {
69647
69739
  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
69740
  return 2;
@@ -69803,7 +69895,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69803
69895
  const sp = await runShotsPass2({
69804
69896
  descriptors: scopeDescriptors2(outcome.descriptors ?? [], pos.slice(1), invalidScreens),
69805
69897
  tokens: outcome.tokens,
69806
- outDir: join60(dir, ".himi", "shots"),
69898
+ outDir: join61(dir, ".himi", "shots"),
69807
69899
  width: 390,
69808
69900
  layers: { rules: shotRules, ...cmsSeed ? { cmsSeed } : {}, ...canned ? { canned: canned.byKey } : {} },
69809
69901
  ...budgetMs ? { budgetMs } : {},
@@ -69841,7 +69933,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69841
69933
  releaseId: result.releaseId,
69842
69934
  releasePayload: release,
69843
69935
  descriptors: attestedDescriptors,
69844
- screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""), join60(dir, ".himi", "shots", name)])),
69936
+ screenshots: Object.fromEntries(writtenShots.filter((name) => crawledScreens.has(name.replace(/\.png$/, ""))).map((name) => [name.replace(/\.png$/, ""), join61(dir, ".himi", "shots", name)])),
69845
69937
  coverage: {
69846
69938
  screens: crawledScreens.size,
69847
69939
  actionsDispatched: result.actions.exercised,
@@ -69995,7 +70087,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
69995
70087
  }
69996
70088
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
69997
70089
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
69998
- const out = mkdtempSync4(join60(tmpdir5(), "himi-render-"));
70090
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-render-"));
69999
70091
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
70000
70092
  const outcome = await buildReleaseFromContent2(dir, out, {
70001
70093
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -70009,7 +70101,7 @@ himi v${cliVersion()} \u2014 run \`himi --version\`. If authoring commands fail
70009
70101
  const diagnostics = (outcome.lint ?? []).find((s) => s.screenId === screenId)?.issues ?? [];
70010
70102
  let pngFile;
70011
70103
  let attestationPngFile;
70012
- const shotPath = join60(dir, ".himi", "shots", `${screenId}.png`);
70104
+ const shotPath = join61(dir, ".himi", "shots", `${screenId}.png`);
70013
70105
  const pngTarget = typeof flags.png === "string" ? str6(flags.png) : flags.png === true ? shotPath : void 0;
70014
70106
  if (pngTarget && r.pngBase64) {
70015
70107
  pngFile = writePngFile(pngTarget, r.pngBase64);
@@ -70358,7 +70450,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
70358
70450
  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
70451
  return 1;
70360
70452
  }
70361
- if (replace && occupied && !existsSync63(join60(dest, "himalaya.content.json"))) {
70453
+ if (replace && occupied && !existsSync63(join61(dest, "himalaya.content.json"))) {
70362
70454
  io.error(JSON.stringify({
70363
70455
  error: `${dest} is not a content package \u2014 refusing to --replace it`,
70364
70456
  hint: "--replace only clears a directory that holds himalaya.content.json. Check --out/--name, or pass --force to merge into it instead."
@@ -70499,7 +70591,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
70499
70591
  const force = flags.force === true;
70500
70592
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
70501
70593
  const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
70502
- const out = mkdtempSync4(join60(tmpdir5(), "himi-push-"));
70594
+ const out = mkdtempSync4(join61(tmpdir5(), "himi-push-"));
70503
70595
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
70504
70596
  const outcome = await buildReleaseFromContent2(dir, out, {
70505
70597
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -70525,7 +70617,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
70525
70617
  const manifest = outcome.manifest;
70526
70618
  const payload = await loadReleaseFromDir(declared, out);
70527
70619
  const { shellQuote: shellQuote2 } = await Promise.resolve().then(() => (init_shell_quote(), shell_quote_exports));
70528
- const contentRel = relative10(process.cwd(), dir) || ".";
70620
+ const contentRel = relative11(process.cwd(), dir) || ".";
70529
70621
  const contentArg = shellQuote2(contentRel);
70530
70622
  if (onlyRaw !== void 0) {
70531
70623
  const onlyDraft = flags.draft === true;
@@ -71020,7 +71112,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71020
71112
  }
71021
71113
  const { buildContentForValidation: buildContentForValidation2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
71022
71114
  const bres = await buildContentForValidation2(dir, { resolution: resolutionFlag(flags) });
71023
- const built = mkdtempSync4(join60(tmpdir5(), "himi-pack-"));
71115
+ const built = mkdtempSync4(join61(tmpdir5(), "himi-pack-"));
71024
71116
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
71025
71117
  const outcome = await buildReleaseFromContent2(dir, built, {
71026
71118
  ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {},
@@ -71279,11 +71371,11 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71279
71371
  const app = await appId(dir2);
71280
71372
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
71281
71373
  const bres = await buildContentBundles2(dir2, { resolution: resolutionFlag(flags) });
71282
- temp = mkdtempSync4(join60(tmpdir5(), "himi-run-build-"));
71374
+ temp = mkdtempSync4(join61(tmpdir5(), "himi-run-build-"));
71283
71375
  const hasWorkers = bres.built.length > 0 || bres.compileErrors.length > 0;
71284
71376
  const initial = await buildReleaseFromContent2(dir2, temp, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir2) } : {} });
71285
71377
  servedMissing = initial.missingBundles;
71286
- source = join60(temp, app);
71378
+ source = join61(temp, app);
71287
71379
  }
71288
71380
  const chromeArg = str6(flags.chrome) ?? "preview";
71289
71381
  if (chromeArg !== "preview" && chromeArg !== "app") {
@@ -71319,7 +71411,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71319
71411
  if (!recordKit) return;
71320
71412
  startedAt = (/* @__PURE__ */ new Date()).toISOString();
71321
71413
  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.` }));
71414
+ 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
71415
  await refreshBoard();
71324
71416
  };
71325
71417
  const retract = async () => {
@@ -71350,7 +71442,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71350
71442
  }
71351
71443
  const watchKit = watch2 ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
71352
71444
  const bus = watchKit ? new watchKit.ReloadBus() : void 0;
71353
- if (watch2) served = mkdtempSync4(join60(tmpdir5(), "himi-run-served-"));
71445
+ if (watch2) served = mkdtempSync4(join61(tmpdir5(), "himi-run-served-"));
71354
71446
  const running = await runPackage2(source, {
71355
71447
  port,
71356
71448
  chrome: chromeArg,
@@ -71371,8 +71463,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71371
71463
  await announce(running);
71372
71464
  if (watchKit && bus) {
71373
71465
  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"));
71466
+ const live2 = join61(running.releaseRoot, running.app);
71467
+ const manifestOf = (tree) => JSON.parse(readFileSync75(join61(tree, "release-manifest.json"), "utf8"));
71376
71468
  let current = manifestOf(live2);
71377
71469
  const failed2 = async (message) => {
71378
71470
  if (stopping) return;
@@ -71383,7 +71475,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71383
71475
  };
71384
71476
  rebuild = watchKit.serialize(async () => {
71385
71477
  const t0 = Date.now();
71386
- const next = mkdtempSync4(join60(tmpdir5(), "himi-run-build-"));
71478
+ const next = mkdtempSync4(join61(tmpdir5(), "himi-run-build-"));
71387
71479
  try {
71388
71480
  const bres = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
71389
71481
  if (bres.compileErrors.length) {
@@ -71400,14 +71492,14 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
71400
71492
  return;
71401
71493
  }
71402
71494
  if (stopping) return;
71403
- const fresh = manifestOf(join60(next, running.app));
71495
+ const fresh = manifestOf(join61(next, running.app));
71404
71496
  const diff = watchKit.diffReleases(current, fresh);
71405
71497
  const retired = `${live2}.retired-${Date.now()}`;
71406
71498
  renameSync7(live2, retired);
71407
71499
  try {
71408
- renameSync7(join60(next, running.app), live2);
71500
+ renameSync7(join61(next, running.app), live2);
71409
71501
  } catch {
71410
- cpSync3(join60(next, running.app), live2, { recursive: true });
71502
+ cpSync3(join61(next, running.app), live2, { recursive: true });
71411
71503
  }
71412
71504
  rmSync14(retired, { recursive: true, force: true });
71413
71505
  current = fresh;
@@ -72724,7 +72816,7 @@ ${label2}`);
72724
72816
  const platform = str6(flags.platform)?.split(",").map((p) => p.trim()).filter(Boolean);
72725
72817
  {
72726
72818
  const distDir = contentDir(flags);
72727
- if (existsSync63(join60(distDir, "himalaya.content.json"))) {
72819
+ if (existsSync63(join61(distDir, "himalaya.content.json"))) {
72728
72820
  const issues = await iconIssues(distDir, flags.strict === true, { requireDeclared: true, requireVerified: true });
72729
72821
  const errors = issues.filter((i) => i.severity === "error");
72730
72822
  for (const i of issues.filter((i2) => i2.severity === "warning")) {