@wix/himalaya-cli 0.1016.0 → 0.1018.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -5345,7 +5345,6 @@ function walk(node, registry, path2, out) {
5345
5345
  var SYSTEM_FONT_FAMILY;
5346
5346
  var init_tokens = __esm({
5347
5347
  "../../core/ts/src/tokens.ts"() {
5348
- "use strict";
5349
5348
  SYSTEM_FONT_FAMILY = "$system";
5350
5349
  }
5351
5350
  });
@@ -19816,7 +19815,6 @@ function shouldRevealError(args) {
19816
19815
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
19817
19816
  var init_validation = __esm({
19818
19817
  "../../core/ts/src/validation.ts"() {
19819
- "use strict";
19820
19818
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
19821
19819
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
19822
19820
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -23241,7 +23239,6 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
23241
23239
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
23242
23240
  var init_worker_subtree = __esm({
23243
23241
  "../../core/ts/src/worker-subtree.ts"() {
23244
- "use strict";
23245
23242
  init_worker_subtree_safe_types_generated();
23246
23243
  WORKER_SUBTREE_CEILINGS = Object.freeze({
23247
23244
  maxEncodedBytes: 65536,
@@ -38769,7 +38766,12 @@ function liveRun(dir) {
38769
38766
  const build2 = obj(rec?.build);
38770
38767
  try {
38771
38768
  process.kill(pid, 0);
38772
- return { url, buildError: build2?.ok === false ? text(build2.error) ?? "the last rebuild failed" : null };
38769
+ return {
38770
+ url,
38771
+ buildError: build2?.ok === false ? text(build2.error) ?? "the last rebuild failed" : null,
38772
+ // Only `--watch` wrote this record before plain runs did, so a record without the key is one.
38773
+ watching: rec?.watching !== false
38774
+ };
38773
38775
  } catch {
38774
38776
  return null;
38775
38777
  }
@@ -38957,7 +38959,7 @@ function render(s){
38957
38959
  $("nowmsg").textContent=last?last.message:"Waiting for the first postcard.";
38958
38960
  $("nowmeta").textContent=last?("Now \xB7 "+(last.step?("step "+last.stepNumber+" of 8, "+last.step+" \xB7 "):"")+ago(last.ts)):"Now";
38959
38961
  var focus=$("focus");clear(focus);var film=$("film");clear(film);
38960
- if(s.live){$("focuslbl").textContent="Live preview";var f=el("div","phone");var fr=document.createElement("iframe");fr.src=s.live.url;fr.title="Live preview";f.appendChild(fr);focus.appendChild(f);if(s.live.buildError){var be=el("div","chip bad",null);be.style.display="block";be.style.marginTop="8px";be.textContent="Last edit did not build, still showing the last good version: "+s.live.buildError;focus.appendChild(be)}focus.appendChild(el("div","cap","Repaints as the app is edited \xB7 "+s.live.url))}
38962
+ if(s.live){$("focuslbl").textContent="Live preview";var f=el("div","phone");var fr=document.createElement("iframe");fr.src=s.live.url;fr.title="Live preview";f.appendChild(fr);focus.appendChild(f);if(s.live.buildError){var be=el("div","chip bad",null);be.style.display="block";be.style.marginTop="8px";be.textContent="Last edit did not build, still showing the last good version: "+s.live.buildError;focus.appendChild(be)}focus.appendChild(el("div","cap",(s.live.watching?"Repaints as the app is edited \xB7 ":"The build this run started with; himi run --watch repaints on every edit \xB7 ")+s.live.url))}
38961
38963
  else if(s.focus&&s.focus.frames.length){var fl=s.focus.frames;$("focuslbl").textContent="Latest \xB7 "+s.focus.id;var p=el("div","phone");p.appendChild(img(fl[fl.length-1].img));focus.appendChild(p);focus.appendChild(el("div","cap",fl.length+(fl.length===1?" version":" versions")+" so far"))}
38962
38964
  else{$("focuslbl").textContent="Latest";focus.appendChild(el("div","empty","The first render appears here."))}
38963
38965
  if(s.focus&&s.focus.frames.length>1)s.focus.frames.forEach(function(fm){film.appendChild(img(fm.img))});
@@ -47994,19 +47996,19 @@ var init_preview_assets_generated = __esm({
47994
47996
  "../../packages/serve/src/preview-assets.generated.ts"() {
47995
47997
  init_preview_assets_format();
47996
47998
  PREVIEW_ASSET_MANIFEST = [
47997
- { key: "assets/index-DH7r6zgZ.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1016081, sha256: "da605bbde6f416c275340836d0b6d327478e5d067c24905a46274d18c1b00b98" },
47998
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 1016089, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
47999
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1107013, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
48000
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1197997, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
48001
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1288977, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
48002
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1379849, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
48003
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1470829, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
48004
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1579465, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
48005
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1688549, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
48006
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1797597, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
48007
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1905297, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
48008
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1993405, length: 4448, sha256: "ce170a0a2ee86aac30f70b5468e744898c697fb5f46c685ebc5d83b4402b22db" },
48009
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1997853, length: 17209, sha256: "dffc9718e2faa63ae2cc919e0a842f585ed565aaaa7c53778e90379442c731b6" }
47999
+ { key: "assets/index-DRerTUYc.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1016478, sha256: "42a5b901a0a58a495e5261f68782d28d12aa95cf64df33d9d8d14236e8ea6ead" },
48000
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 1016486, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
48001
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1107410, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
48002
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1198394, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
48003
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1289374, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
48004
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1380246, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
48005
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1471226, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
48006
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1579862, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
48007
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1688946, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
48008
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1797994, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
48009
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1905694, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
48010
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1993802, length: 4448, sha256: "98239860f1289aebffdb28d2b9f5ce15fbb95a657bb63d262c650ca21513dde3" },
48011
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1998250, length: 17209, sha256: "dffc9718e2faa63ae2cc919e0a842f585ed565aaaa7c53778e90379442c731b6" }
48010
48012
  ];
48011
48013
  }
48012
48014
  });
@@ -48342,13 +48344,22 @@ function writeRunRecord(dir, record2) {
48342
48344
  }
48343
48345
  return true;
48344
48346
  }
48345
- function removeRunRecord(dir) {
48347
+ function removeRunRecord(dir, owner) {
48346
48348
  const root = join51(dir, ".himi");
48347
48349
  try {
48348
48350
  if (!lstatSync8(root).isDirectory()) return;
48349
48351
  } catch {
48350
48352
  return;
48351
48353
  }
48354
+ if (owner !== void 0) {
48355
+ const bytes2 = readConfined(root, "run.json");
48356
+ let pid;
48357
+ try {
48358
+ pid = bytes2 ? JSON.parse(bytes2.toString("utf8")).pid : void 0;
48359
+ } catch {
48360
+ }
48361
+ if (typeof pid === "number" && pid !== owner) return;
48362
+ }
48352
48363
  rmSync12(join51(root, "run.json"), { force: true });
48353
48364
  }
48354
48365
  function boardFile(dir, pathname) {
@@ -48475,7 +48486,7 @@ async function releasePayloadFromDir(root, app, header) {
48475
48486
  await addDoc(meta.descriptorHash);
48476
48487
  }
48477
48488
  for (const hash of Object.values(manifest.catalogs ?? {})) await addDoc(hash);
48478
- for (const d of manifest.authoringDocs ?? []) await addDoc(d.sha256);
48489
+ for (const d of Object.values(manifest.authoringDocs ?? {})) await addDoc(d?.sha256);
48479
48490
  await addDoc(manifest.tokensHash);
48480
48491
  await addDoc(manifest.appConfigHash);
48481
48492
  await addDoc(manifest.sourceHash);
@@ -63332,7 +63343,7 @@ var COMMANDS = [
63332
63343
  { name: "import", summary: "turn a `himi pack --dev` package back into an EDITABLE content package \u2014 the file counterpart of `himi pull`, needing no serve plane, no account and no network. Refuses an invalid package before trusting its source (the content hash is recomputed over every entry on open, so the archive is provably the one that was packed), and refuses a RELEASE package by naming the absence \u2014 it carries built output and no source \u2014 rather than reporting a missing file. `--name` re-substitutes the app identity through the same machinery `himi init --template` and `himi pull --name` use, so the restored tree is a NEW app rather than a second copy of the same one, and a name that also appears inside a screen id (`feed` in `feed_home`) is left alone. A non-empty destination needs `--force` and a merge NAMES what it kept (`left: [...]`), the same contract `himi pull --force` has; a shape clash is refused whole before anything is written. There is no `--replace`: a file you were handed is not the plane's per-release archive.", required: "<package.himi> [--out <dir>] [--name <new>] [--force]" },
63333
63344
  { name: "pull", summary: "restore an app's SOURCE from the serve plane into an editable content package \u2014 the other half of `himi push`, which archives the content package on every publish. Owner or editor only: a viewer may download the RUNNING app (`/v1/owner/package`), not the codebase it was built from. A PAST release is restorable, not only the live one \u2014 the archive is content-addressed per release, so it has none of the live-single-slot problem that makes `himi pack` current-release-only. Two limits: pruning keeps the current release plus the newest ~20 ledger entries, and a release id identifies OTA content rather than source, so a source-only change republishes under the same id and replaces that id's archive. A release published before source archiving shipped, or pushed with `--no-source`, answers `app_source_not_found` and says to push again. `--name` re-substitutes the app identity through the same machinery `himi init --template` uses, so the restored tree is a NEW app rather than a second copy of the same one, and a name that also appears inside a screen id (`feed` in `feed_home`) is left alone. A NON-EMPTY destination is refused unless you say which you mean: `--force` merges and reports \u2014 it writes the archive over what is there, keeps files the release does not carry, and NAMES every one of them as `left: [...]` so a tree that matches no release is never silent (#2437); `--replace` restores exactly what was archived, removing those files first (`removed: [...]`) and implying `--force`. `--replace` refuses a directory holding no `himalaya.content.json`, so a mistyped `--out` cannot clear an unrelated tree, and the only paths it can remove are the ones a push would have archived \u2014 `.git/`, `node_modules/`, `dist/`, `.env*` and key material are out of its reach by construction.", required: "<app> [--release <id>] [--out <dir>] [--name <new>] [--force|--replace] [--target <t>]" },
63334
63345
  { name: "share", summary: "publish or revoke a content-addressed `.himi` share link. The package must be a validated archive for an already-published release; the resulting https URL is safe to QR, copy, or open in Himi Player.", required: "--file <package.himi> [--expires-at <ISO>] | revoke --app <app> <shareId>" },
63335
- { name: "run", summary: "serve a .himi package on localhost and open it in a browser \u2014 no serve plane, no dev-server, no setup. Given no argument it builds the current content package first, so `himi run` is the inner loop: edit, run, look at it. The SPA and /v1 are served from ONE origin because Tier-5 bundle fetches on web are same-origin-only. --chrome preview frames the app in a device chassis; --chrome app serves it as a plain web app. Blocks until Ctrl-C, like any dev server. --browser runs the whole plane INSIDE the tab (service worker + in-memory store) so no app code executes in this process or on any pod. --watch keeps the preview LIVE: every save in the content package rebuilds it and repaints the open tab with only what changed (the dev-server's hot-reload events); a build that fails keeps the last good preview on screen and says why. It also frames itself on the build board (`himi studio`) and serves the board at /__himi/studio/ on the same origin.", required: "[<package.himi|dir|url>] [--browser] [--watch] [--content <dir>] [--port <n>] [--chrome preview|app] [--screen <id>] [--surface <id>] [--no-open] [--spa <url>]" },
63346
+ { name: "run", summary: "serve a .himi package on localhost and open it in a browser \u2014 no serve plane, no dev-server, no setup. Given no argument it builds the current content package first, so `himi run` is the inner loop: edit, run, look at it. The SPA and /v1 are served from ONE origin because Tier-5 bundle fetches on web are same-origin-only. --chrome preview frames the app in a device chassis; --chrome app serves it as a plain web app. Blocks until Ctrl-C, like any dev server. --browser runs the whole plane INSIDE the tab (service worker + in-memory store) so no app code executes in this process or on any pod. --watch keeps the preview LIVE: every save in the content package rebuilds it and repaints the open tab with only what changed (the dev-server's hot-reload events); a build that fails keeps the last good preview on screen and says why. Any `himi run` of a content package (plain, --watch or --browser) frames its preview on the build board (`himi studio`) while it serves, and all but --browser also serve that board at /__himi/studio/ on the preview's own origin.", required: "[<package.himi|dir|url>] [--browser] [--watch] [--content <dir>] [--port <n>] [--chrome preview|app] [--screen <id>] [--surface <id>] [--no-open] [--spa <url>]" },
63336
63347
  { name: "preview", summary: "print the shareable web URL + himi:// deep link + agent /v1/preview JSON URLs for an app+release; --surface frames the web preview as any catalog surface (?surface=)", required: "--app --release [--screen] [--surface]" },
63337
63348
  { name: "surfaces", summary: "the surface catalog vs this app's envelope (platforms.json): targeted surfaces, the opt-in key for the rest, per-surface preview links with --app --release, and which widget families the package produces with --measure-widgets (which runs its built bundles)", required: "[--content <dir>] [--app --release] [--measure-widgets]" },
63338
63349
  { name: "context", summary: "fetch the agent preview envelope (GET /v1/preview/a/<app>) \u2014 ok/issues/screens/links; exit 1 if ok:false", required: "--app --release [--screen] [--include telemetry]" },
@@ -67704,6 +67715,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67704
67715
  }
67705
67716
  let served = null;
67706
67717
  let servedMissing = [];
67718
+ const fromContent = !source;
67707
67719
  try {
67708
67720
  if (!source) {
67709
67721
  const dir2 = contentDir(flags);
@@ -67729,6 +67741,36 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67729
67741
  return 2;
67730
67742
  }
67731
67743
  }
67744
+ const dir = contentDir(flags);
67745
+ const refreshBoard = async () => {
67746
+ if (!boardOpen(dir)) return;
67747
+ const { refreshStudio: refreshStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
67748
+ refreshStudio2(dir);
67749
+ };
67750
+ const recordKit = fromContent ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
67751
+ let recorded = false;
67752
+ let startedAt = "";
67753
+ const record2 = (served2, build2) => {
67754
+ try {
67755
+ if (recordKit?.writeRunRecord(dir, { url: served2.url, port: served2.port, pid: process.pid, startedAt, watching: watch2, build: build2 })) recorded = true;
67756
+ return null;
67757
+ } catch (e) {
67758
+ return e.message;
67759
+ }
67760
+ };
67761
+ const announce = async (served2) => {
67762
+ if (!recordKit) return;
67763
+ startedAt = (/* @__PURE__ */ new Date()).toISOString();
67764
+ const failure = record2(served2, { ok: true, at: startedAt });
67765
+ if (!recorded) io.error(JSON.stringify({ run: "run_record_skipped", message: `${failure ?? `${join57(dir, ".himi")} is not a real directory`}, so the build board will not frame this preview.` }));
67766
+ await refreshBoard();
67767
+ };
67768
+ const retract = async () => {
67769
+ if (!recorded) return;
67770
+ recorded = false;
67771
+ recordKit?.removeRunRecord(dir, process.pid);
67772
+ await refreshBoard();
67773
+ };
67732
67774
  if (flags.browser === true) {
67733
67775
  const { runInBrowser: runInBrowser2 } = await Promise.resolve().then(() => (init_run_browser(), run_browser_exports));
67734
67776
  const { resolvePackage: resolvePackage2 } = await Promise.resolve().then(() => (init_run(), run_exports));
@@ -67738,17 +67780,17 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67738
67780
  chrome: chromeArg,
67739
67781
  open: flags["no-open"] !== true
67740
67782
  });
67783
+ await announce(run2);
67741
67784
  print({ ok: true, app: run2.app, url: run2.url, port: run2.port, plane: "browser" });
67742
67785
  await new Promise((resolve48) => {
67743
67786
  const stop = () => {
67744
- void run2.close().finally(() => resolve48());
67787
+ void retract().catch((e) => io.error(JSON.stringify({ run: "stop_cleanup_failed", message: e.message }))).finally(() => run2.close().finally(() => resolve48()));
67745
67788
  };
67746
67789
  process.once("SIGINT", stop);
67747
67790
  process.once("SIGTERM", stop);
67748
67791
  });
67749
67792
  return 0;
67750
67793
  }
67751
- const dir = contentDir(flags);
67752
67794
  const watchKit = watch2 ? await Promise.resolve().then(() => (init_run_watch(), run_watch_exports)) : null;
67753
67795
  const bus = watchKit ? new watchKit.ReloadBus() : void 0;
67754
67796
  if (watch2) served = mkdtempSync4(join57(tmpdir5(), "himi-run-served-"));
@@ -67759,26 +67801,16 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67759
67801
  surface: str6(flags.surface),
67760
67802
  spa: str6(flags.spa),
67761
67803
  open: flags["no-open"] !== true,
67762
- ...watchKit && served && bus ? { workDir: served, screenEvents: bus, extraRoutes: (request) => watchKit.boardFile(dir, new URL(request.url).pathname) } : {}
67804
+ // The build board on the preview's own origin, for any run of this content package.
67805
+ ...recordKit ? { extraRoutes: (request) => recordKit.boardFile(dir, new URL(request.url).pathname) } : {},
67806
+ ...watchKit && served && bus ? { workDir: served, screenEvents: bus } : {}
67763
67807
  });
67764
67808
  let watcher;
67765
67809
  let rebuild;
67766
- let recorded = false;
67767
67810
  let stopping = false;
67768
- const refreshBoard = async () => {
67769
- if (!boardOpen(dir)) return;
67770
- const { refreshStudio: refreshStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
67771
- refreshStudio2(dir);
67772
- };
67773
- if (watchKit && bus) {
67774
- try {
67775
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
67776
- const record2 = (build2) => {
67777
- if (watchKit.writeRunRecord(dir, { url: running.url, port: running.port, pid: process.pid, startedAt, build: build2 })) recorded = true;
67778
- };
67779
- record2({ ok: true, at: startedAt });
67780
- if (!recorded) io.error(JSON.stringify({ watch: "run_record_skipped", message: `${join57(dir, ".himi")} is not a real directory, so the build board will not frame this preview.` }));
67781
- await refreshBoard();
67811
+ try {
67812
+ await announce(running);
67813
+ if (watchKit && bus) {
67782
67814
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
67783
67815
  const live2 = join57(running.releaseRoot, running.app);
67784
67816
  const manifestOf = (tree) => JSON.parse(readFileSync72(join57(tree, "release-manifest.json"), "utf8"));
@@ -67786,7 +67818,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67786
67818
  const failed2 = async (message) => {
67787
67819
  if (stopping) return;
67788
67820
  bus.publish("build.failed", { message });
67789
- record2({ ok: false, at: (/* @__PURE__ */ new Date()).toISOString(), error: message });
67821
+ record2(running, { ok: false, at: (/* @__PURE__ */ new Date()).toISOString(), error: message });
67790
67822
  await refreshBoard();
67791
67823
  io.error(JSON.stringify({ watch: "build_failed", keptLastGood: true, message }));
67792
67824
  };
@@ -67822,7 +67854,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67822
67854
  current = fresh;
67823
67855
  servedMissing = outcome.missingBundles;
67824
67856
  for (const [event, data] of watchKit.reloadEvents(diff)) bus.publish(event, data);
67825
- record2({ ok: true, at: (/* @__PURE__ */ new Date()).toISOString() });
67857
+ record2(running, { ok: true, at: (/* @__PURE__ */ new Date()).toISOString() });
67826
67858
  await refreshBoard();
67827
67859
  io.error(JSON.stringify({ watch: "rebuilt", ms: Date.now() - t0, screens: diff.screens, tokens: diff.tokens, config: diff.config, tabs: bus.listeners }));
67828
67860
  } catch (e) {
@@ -67832,11 +67864,12 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67832
67864
  }
67833
67865
  });
67834
67866
  watcher = watchKit.watchContent(dir, () => rebuild?.());
67835
- } catch (e) {
67836
- if (recorded) watchKit.removeRunRecord(dir);
67837
- await running.close();
67838
- throw e;
67839
67867
  }
67868
+ } catch (e) {
67869
+ await retract().catch(() => {
67870
+ });
67871
+ await running.close();
67872
+ throw e;
67840
67873
  }
67841
67874
  print({
67842
67875
  ok: true,
@@ -67844,7 +67877,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67844
67877
  releaseId: running.releaseId,
67845
67878
  url: running.url,
67846
67879
  port: running.port,
67847
- ...watch2 ? { watching: dir, ...boardOpen(dir) ? { board: `${running.origin}/__himi/studio/` } : {} } : {},
67880
+ ...watch2 ? { watching: dir } : {},
67881
+ ...recordKit && boardOpen(dir) ? { board: `${running.origin}/__himi/studio/` } : {},
67848
67882
  ...running.warnings.length ? { warnings: running.warnings } : {},
67849
67883
  stop: "Ctrl-C"
67850
67884
  });
@@ -67854,12 +67888,9 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
67854
67888
  watcher?.close();
67855
67889
  try {
67856
67890
  await rebuild?.stop();
67857
- if (recorded) {
67858
- watchKit?.removeRunRecord(dir);
67859
- await refreshBoard();
67860
- }
67891
+ await retract();
67861
67892
  } catch (e) {
67862
- io.error(JSON.stringify({ watch: "stop_cleanup_failed", message: e.message }));
67893
+ io.error(JSON.stringify({ run: "stop_cleanup_failed", message: e.message }));
67863
67894
  } finally {
67864
67895
  await running.close();
67865
67896
  done();
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1016.0",
3
+ "version": "0.1018.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -65,5 +65,5 @@
65
65
  "artifactId": "himalaya-cli"
66
66
  }
67
67
  },
68
- "falconPackageHash": "8d9c295e5bb131686c4267b1ca8dee02e1722595723466ab792c6e83"
68
+ "falconPackageHash": "94fed53fcfc6d8dbb2472ab3ebd2f6fc24d2cbe457604bc1f3601f2d"
69
69
  }