@wix/himalaya-cli 0.1041.0 → 0.1043.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 +39 -10
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -21250,6 +21250,7 @@ function shouldRevealError(args) {
21250
21250
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
21251
21251
  var init_validation = __esm({
21252
21252
  "../../core/ts/src/validation.ts"() {
21253
+ "use strict";
21253
21254
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
21254
21255
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
21255
21256
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -24850,6 +24851,7 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
24850
24851
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
24851
24852
  var init_worker_subtree = __esm({
24852
24853
  "../../core/ts/src/worker-subtree.ts"() {
24854
+ "use strict";
24853
24855
  init_worker_subtree_safe_types_generated();
24854
24856
  WORKER_SUBTREE_CEILINGS = Object.freeze({
24855
24857
  maxEncodedBytes: 65536,
@@ -33628,11 +33630,13 @@ async function readBody2(req) {
33628
33630
  function makeEtag(body) {
33629
33631
  return `"${createHash16("sha256").update(body).digest("hex").slice(0, 32)}"`;
33630
33632
  }
33633
+ function servedTokensPath(app) {
33634
+ return app.module.designTokensPath ?? resolve31(app.dir, app.module.config.designTokensPath ?? "tokens.json");
33635
+ }
33631
33636
  function readAppTokens(state) {
33632
33637
  if (!state.app) return null;
33633
33638
  try {
33634
- const tokenPath = state.app.module.designTokensPath ?? resolve31(state.app.dir, state.app.module.config.designTokensPath ?? "tokens.json");
33635
- const parsed = JSON.parse(readFileSync41(tokenPath, "utf8"));
33639
+ const parsed = JSON.parse(readFileSync41(servedTokensPath(state.app), "utf8"));
33636
33640
  delete parsed._meta;
33637
33641
  return parsed;
33638
33642
  } catch {
@@ -34501,13 +34505,17 @@ async function reloadAppModuleNow(state, opts) {
34501
34505
  state.moduleStore = next.createStore(current.name);
34502
34506
  }
34503
34507
  state.serverCache.clear();
34504
- const screenIds = [.../* @__PURE__ */ new Set([...oldMeta.screenIds, ...state.app.meta.screenIds])];
34505
- publishSSE(state, "screen.invalidated", { screenIds, reason: opts.reason });
34508
+ if (opts.invalidateScreens !== false) {
34509
+ const screenIds = [.../* @__PURE__ */ new Set([...oldMeta.screenIds, ...state.app.meta.screenIds])];
34510
+ publishSSE(state, "screen.invalidated", { screenIds, reason: opts.reason });
34511
+ }
34506
34512
  const newNav = JSON.stringify(deriveNavigationConfig(state.app.meta) ?? null);
34507
34513
  if (oldNav !== newNav) {
34508
34514
  publishSSE(state, "config.invalidated", { reason: opts.reason, at: Date.now() });
34509
34515
  }
34510
- if (idiomOf(next) !== oldIdiom) {
34516
+ const tokensHash = servedTokensHash(state.app);
34517
+ if (idiomOf(next) !== oldIdiom || tokensHash !== state.announcedTokensHash) {
34518
+ state.announcedTokensHash = tokensHash;
34511
34519
  publishSSE(state, "tokens.changed", { reason: opts.reason, at: Date.now() });
34512
34520
  }
34513
34521
  console.log(`[himalaya-dev] reloaded app module in-process: ${current.name} (${opts.reason})`);
@@ -34523,6 +34531,17 @@ async function reloadAppModuleNow(state, opts) {
34523
34531
  }
34524
34532
  }
34525
34533
  }
34534
+ function tokensAreDerived(state) {
34535
+ if (!state.app) return false;
34536
+ return resolve31(servedTokensPath(state.app)) !== resolve31(state.app.dir, "tokens.json");
34537
+ }
34538
+ function servedTokensHash(app) {
34539
+ try {
34540
+ return createHash16("sha256").update(readFileSync41(servedTokensPath(app))).digest("hex");
34541
+ } catch {
34542
+ return "";
34543
+ }
34544
+ }
34526
34545
  function classifyAppPath(rel) {
34527
34546
  if (!rel || rel.startsWith("..")) return null;
34528
34547
  if (rel === "tokens.json") return "tokens";
@@ -34548,21 +34567,30 @@ function startAppSourceWatcher(state) {
34548
34567
  pending.clear();
34549
34568
  if (paths.length === 0) return;
34550
34569
  const kinds = new Set(paths.map(classifyAppPath));
34551
- if (kinds.has("tokens")) {
34552
- publishSSE(state, "tokens.changed", { reason: "file_changed", at: Date.now() });
34553
- }
34570
+ const tokensNeedReload = kinds.has("tokens") && tokensAreDerived(state);
34554
34571
  if (kinds.has("appconfig")) {
34555
34572
  publishSSE(state, "config.invalidated", { reason: "file_changed", at: Date.now() });
34556
34573
  }
34557
- if (kinds.has("module")) {
34574
+ if (kinds.has("module") || tokensNeedReload) {
34558
34575
  reloading = true;
34559
34576
  const recreateStore = paths.some((p) => p.startsWith("data/") || p.startsWith("seed/"));
34560
34577
  try {
34561
- await reloadAppModule(state, { reason: "source_changed", recreateStore });
34578
+ await reloadAppModule(state, {
34579
+ reason: kinds.has("module") ? "source_changed" : "tokens_changed",
34580
+ recreateStore,
34581
+ invalidateScreens: kinds.has("module")
34582
+ });
34562
34583
  } finally {
34563
34584
  reloading = false;
34564
34585
  }
34565
34586
  }
34587
+ if (kinds.has("tokens") && state.app) {
34588
+ const tokensHash = servedTokensHash(state.app);
34589
+ if (tokensHash !== state.announcedTokensHash) {
34590
+ state.announcedTokensHash = tokensHash;
34591
+ publishSSE(state, "tokens.changed", { reason: "file_changed", at: Date.now() });
34592
+ }
34593
+ }
34566
34594
  };
34567
34595
  try {
34568
34596
  const watcher2 = watch(appDir2, { persistent: false, recursive: true }, (_event, filename) => {
@@ -36001,6 +36029,7 @@ function createDevServer(opts = {}) {
36001
36029
  if (state.hotReloadEnabled) {
36002
36030
  state.bundleWatcher = startBundleArtifactWatcher(state);
36003
36031
  state.bundleSourceWatcher = startBundleSourceWatcher(state);
36032
+ if (state.app) state.announcedTokensHash = servedTokensHash(state.app);
36004
36033
  state.appWatcher = startAppSourceWatcher(state);
36005
36034
  }
36006
36035
  const handleRequest = (req, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1041.0",
3
+ "version": "0.1043.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": "dd4df2399eb1b1291c67e97ee46032f9e71d157626062dc91558d20a"
68
+ "falconPackageHash": "a5e6e48bed44a158e954ca18b52ebff9ef438aac9078851aa8034c92"
69
69
  }