@wix/himalaya-cli 0.1861.0 → 0.1862.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 +196 -70
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -4450,6 +4450,7 @@ var init_himi_package = __esm({
4450
4450
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
4451
4451
  var init_icon_catalog_generated = __esm({
4452
4452
  "../../core/ts/src/icon-catalog.generated.ts"() {
4453
+ "use strict";
4453
4454
  init_define_HHP_CATALOG();
4454
4455
  ICON_VIEW_BOX = 24;
4455
4456
  ICON_STROKE_WIDTH = 2;
@@ -11308,6 +11309,100 @@ var init_css = __esm({
11308
11309
  }
11309
11310
  });
11310
11311
 
11312
+ // ../html-to-t5/src/v2/nano-actions.ts
11313
+ function depthOf(value2) {
11314
+ let max = 0;
11315
+ const stack = [[value2, 0]];
11316
+ while (stack.length) {
11317
+ const [v2, d2] = stack.pop();
11318
+ if (d2 > max) max = d2;
11319
+ if (max > MAX_BLOCK_DEPTH) return max;
11320
+ if (v2 && typeof v2 === "object") for (const x2 of Object.values(v2)) stack.push([x2, d2 + 1]);
11321
+ }
11322
+ return max;
11323
+ }
11324
+ function analyzeNanoActions(source2, file2, diagnostics, seedComputed) {
11325
+ const err = (code3, message5, hint) => diagnostics.push({ file: file2, line: 1, column: 1, code: code3, severity: "error", message: message5, ...hint ? { hint } : {} });
11326
+ let raw;
11327
+ try {
11328
+ raw = JSON.parse(source2);
11329
+ } catch (e2) {
11330
+ err("HHP-NANO-JSON", `The nano-actions block is not valid JSON: ${e2.message}.`, "Emit one JSON object; no comments or trailing commas.");
11331
+ return;
11332
+ }
11333
+ if (!isRecord(raw)) {
11334
+ err("HHP-NANO-SHAPE", "The nano-actions block must be a JSON object.");
11335
+ return;
11336
+ }
11337
+ if (depthOf(raw) > MAX_BLOCK_DEPTH) {
11338
+ err("HHP-NANO-SHAPE", `The nano-actions block nests deeper than ${MAX_BLOCK_DEPTH} levels.`, "Keep state flat: lists of small objects.");
11339
+ return;
11340
+ }
11341
+ for (const key4 of Object.keys(raw)) if (!KEYS.has(key4)) err("HHP-NANO-SHAPE", `Unknown nano-actions key "${key4}".`, "Allowed keys: state, computed, persist, onOpen, actions.");
11342
+ if (!isRecord(raw.state)) {
11343
+ err("HHP-NANO-SHAPE", "nano-actions.state must be an object of JSON values.");
11344
+ return;
11345
+ }
11346
+ if (!isRecord(raw.actions)) {
11347
+ err("HHP-NANO-SHAPE", "nano-actions.actions must map action names to op lists.");
11348
+ return;
11349
+ }
11350
+ const computed = raw.computed ?? {};
11351
+ if (!isRecord(computed) || Object.values(computed).some((v2) => typeof v2 !== "string")) {
11352
+ err("HHP-NANO-SHAPE", "nano-actions.computed must map names to expression strings.");
11353
+ return;
11354
+ }
11355
+ const block = raw;
11356
+ const handlers = /* @__PURE__ */ new Set();
11357
+ for (const [name, ops] of Object.entries(block.actions)) {
11358
+ if (!NAME.test(name) || name.startsWith("__hhp") || unsafe2.has(name)) err("HHP-NANO-SHAPE", `Invalid action name "${name}".`);
11359
+ else if (!Array.isArray(ops)) err("HHP-NANO-SHAPE", `Action "${name}" must be a list of ops.`);
11360
+ else handlers.add(name);
11361
+ }
11362
+ const state = { ...block.state };
11363
+ let seeds = {};
11364
+ if (seedComputed) {
11365
+ try {
11366
+ seeds = seedComputed(block) ?? {};
11367
+ } catch {
11368
+ seeds = {};
11369
+ }
11370
+ }
11371
+ for (const key4 of Object.keys(state)) if (!NAME.test(key4) || key4.startsWith("__hhp") || unsafe2.has(key4)) err("HHP-NANO-SHAPE", `Invalid state key "${key4}".`);
11372
+ for (const key4 of Object.keys(computed)) {
11373
+ if (!NAME.test(key4) || key4.startsWith("__hhp") || unsafe2.has(key4)) err("HHP-NANO-SHAPE", `Invalid computed key "${key4}".`);
11374
+ else if (Object.hasOwn(state, key4)) err("HHP-NANO-SHAPE", `"${key4}" is both state and computed.`);
11375
+ else state[key4] = Object.hasOwn(seeds, key4) && seeds[key4] !== void 0 && seeds[key4] !== null ? seeds[key4] : "";
11376
+ }
11377
+ if (block.onOpen != null && (typeof block.onOpen !== "string" || !handlers.has(block.onOpen)))
11378
+ err("HHP-NANO-ACTION", `onOpen names unknown action "${String(block.onOpen)}".`);
11379
+ if (block.persist !== void 0) {
11380
+ if (!Array.isArray(block.persist)) err("HHP-NANO-SHAPE", "nano-actions.persist must be a list of state keys.");
11381
+ else for (const key4 of block.persist) if (typeof key4 !== "string" || !Object.hasOwn(block.state, key4)) err("HHP-NANO-ACTION", `persist names unknown state key "${String(key4)}".`);
11382
+ }
11383
+ const paths2 = /* @__PURE__ */ new Map();
11384
+ const collect2 = (value2, prefix = "") => {
11385
+ for (const [key4, v2] of Object.entries(value2)) {
11386
+ const path2 = prefix ? `${prefix}.${key4}` : key4;
11387
+ paths2.set(path2, v2);
11388
+ if (isRecord(v2)) collect2(v2, path2);
11389
+ }
11390
+ };
11391
+ collect2(state);
11392
+ return { info: { state, paths: paths2, handlers }, block };
11393
+ }
11394
+ var KEYS, MAX_BLOCK_DEPTH, NAME, unsafe2, isRecord;
11395
+ var init_nano_actions = __esm({
11396
+ "../html-to-t5/src/v2/nano-actions.ts"() {
11397
+ init_define_HHP_CATALOG();
11398
+ KEYS = /* @__PURE__ */ new Set(["state", "computed", "persist", "onOpen", "actions"]);
11399
+ MAX_BLOCK_DEPTH = 32;
11400
+ NAME = /^[a-zA-Z_]\w*$/;
11401
+ unsafe2 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
11402
+ isRecord = (v2) => typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
11403
+ }
11404
+ });
11405
+
11311
11406
  // ../../core/ts/src/worker-subtree-safe-types.generated.ts
11312
11407
  var WORKER_SUBTREE_SAFE_TYPE_RULES, WORKER_SUBTREE_COMMON_ACTION_PATHS;
11313
11408
  var init_worker_subtree_safe_types_generated = __esm({
@@ -11449,20 +11544,20 @@ var init_worker_subtree_safe_types_generated = __esm({
11449
11544
  });
11450
11545
 
11451
11546
  // ../../core/ts/src/worker-subtree.ts
11452
- function isRecord(value2) {
11547
+ function isRecord2(value2) {
11453
11548
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
11454
11549
  }
11455
11550
  function valueAtPath(value2, path2) {
11456
11551
  let current = value2;
11457
11552
  for (const segment3 of path2.split(".")) {
11458
- if (!isRecord(current)) return void 0;
11553
+ if (!isRecord2(current)) return void 0;
11459
11554
  current = current[segment3];
11460
11555
  }
11461
11556
  return current;
11462
11557
  }
11463
11558
  function componentShape(value2) {
11464
- if (!isRecord(value2) || typeof value2.id !== "string" || !isRecord(value2.body)) return false;
11465
- return typeof value2.body.package === "string" && typeof value2.body.type === "string" && isRecord(value2.body.props);
11559
+ if (!isRecord2(value2) || typeof value2.id !== "string" || !isRecord2(value2.body)) return false;
11560
+ return typeof value2.body.package === "string" && typeof value2.body.type === "string" && isRecord2(value2.body.props);
11466
11561
  }
11467
11562
  function rotateRight(value2, count3) {
11468
11563
  return value2 >>> count3 | value2 << 32 - count3;
@@ -11620,7 +11715,7 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
11620
11715
  let rejection = null;
11621
11716
  const checkAction = (value2) => {
11622
11717
  if (value2 == null || rejection) return;
11623
- if (!isRecord(value2) || typeof value2.actionId !== "string") {
11718
+ if (!isRecord2(value2) || typeof value2.actionId !== "string") {
11624
11719
  rejection = "typed_decode";
11625
11720
  return;
11626
11721
  }
@@ -11751,10 +11846,25 @@ function compileV2(html, profile, options2) {
11751
11846
  if (!title) error(null, "HHP-TITLE", "Provide a document title.");
11752
11847
  let controller = options2.controller;
11753
11848
  let directService;
11849
+ let nanoActions;
11850
+ let nanoActionsSeen = false;
11754
11851
  const scripts = $2("script").toArray();
11755
11852
  for (const script2 of scripts) {
11756
11853
  const type2 = $2(script2).attr("type"), src = $2(script2).attr("src");
11757
11854
  if (type2 === "application/himalaya-props") continue;
11855
+ if (options2.declarativeLogic && type2 !== "application/nano-actions") {
11856
+ error(script2, "HHP-SCRIPT", "HHP-N documents carry no JavaScript; use exactly one application/nano-actions block.");
11857
+ continue;
11858
+ }
11859
+ if (type2 === "application/nano-actions" && options2.declarativeLogic && !controller && !directService && !src) {
11860
+ if (nanoActionsSeen) {
11861
+ error(script2, "HHP-NANO-SHAPE", "Use exactly one application/nano-actions block.");
11862
+ continue;
11863
+ }
11864
+ nanoActionsSeen = true;
11865
+ nanoActions = analyzeNanoActions($2(script2).text(), options2.file, diagnostics, typeof options2.declarativeLogic === "object" ? options2.declarativeLogic.seedComputed : void 0);
11866
+ continue;
11867
+ }
11758
11868
  if (type2 === "application/himalaya-service" && !controller && !directService) {
11759
11869
  try {
11760
11870
  directService = src && options2.readLocal ? { ...options2.readLocal(src, options2.file), external: true } : { source: $2(script2).text(), file: options2.file, external: false };
@@ -11770,7 +11880,7 @@ function compileV2(html, profile, options2) {
11770
11880
  }
11771
11881
  } else error(script2, "HHP-SCRIPT", "Use one external application/himalaya-controller script. Inline/page JavaScript is unavailable.");
11772
11882
  }
11773
- let info4;
11883
+ let info4 = nanoActions?.info;
11774
11884
  for (const cap2 of moduleCapabilities(controller?.source ?? directService?.source ?? "", controller?.file ?? options2.file, profile)) requiredCapabilities2.add(cap2);
11775
11885
  if (controller) {
11776
11886
  dependencies.push(controller.file);
@@ -11809,6 +11919,7 @@ function compileV2(html, profile, options2) {
11809
11919
  const tags = new Map(Object.entries(profile.components).map(([name, spec]) => [spec.tag, name]));
11810
11920
  const ids2 = /* @__PURE__ */ new Set(), bindings = /* @__PURE__ */ new Map();
11811
11921
  const textProjections = [];
11922
+ const keyedLists = /* @__PURE__ */ new Set();
11812
11923
  let subtreeCount = 0;
11813
11924
  const own6 = (record5, key4) => Object.hasOwn(record5, key4) ? record5[key4] : void 0;
11814
11925
  function structured(el2, value2) {
@@ -11938,7 +12049,7 @@ function compileV2(html, profile, options2) {
11938
12049
  if (matches2.length) {
11939
12050
  if (matches2.length === 1 && matches2[0][0] === text32 && type2 === "Text") {
11940
12051
  props2.text = path2(el2, matches2[0][1], row2);
11941
- } else if (controller && type2 === "Text") {
12052
+ } else if ((controller || nanoActions) && type2 === "Text") {
11942
12053
  for (const match of matches2) path2(el2, match[1], row2);
11943
12054
  const key4 = `t${textProjections.length}`;
11944
12055
  const normalized2 = text32.replace(/{{\s*([\w.$]+)\s*}}/g, (_match, raw) => `{{${raw.startsWith("$item.") ? raw : statePath(raw)}}}`);
@@ -12057,6 +12168,10 @@ function compileV2(html, profile, options2) {
12057
12168
  error(el2, "HHP-EVENT", `Unknown or unsupported ${event} handler ${raw}.`);
12058
12169
  continue;
12059
12170
  }
12171
+ if (attrs["data-action-args"] !== void 0) {
12172
+ error(el2, "HHP-ACTION-ARGS", `data-action-args is ignored on ${attr3}; the handler would receive no args.`, `Use data-action="${raw}" with data-action-args instead.`);
12173
+ continue;
12174
+ }
12060
12175
  (spec.fields[field2] ? props2 : mods)[field2] = { actionId: `tier5.${serviceName2}.${raw}` };
12061
12176
  continue;
12062
12177
  }
@@ -12172,6 +12287,7 @@ function compileV2(html, profile, options2) {
12172
12287
  else keys2.add(item2.id);
12173
12288
  }
12174
12289
  props2.itemsPath = path2(el2, each, false);
12290
+ if (!each.startsWith("$item.")) keyedLists.add(statePath(each));
12175
12291
  }
12176
12292
  }
12177
12293
  const childField = Object.entries(spec.fields).find(([, f2]) => f2.kind === "children")?.[0];
@@ -12249,14 +12365,14 @@ function compileV2(html, profile, options2) {
12249
12365
  let payload;
12250
12366
  if (roots2.length === 1) payload = compile(roots2[0], "root");
12251
12367
  else error(null, "HHP-ROOT", "Use exactly one root layout element.");
12252
- const bundleName = info4 ? `hhp-${screenId?.replace(/[._]/g, "-")}` : void 0;
12368
+ const bundleName = info4 && !nanoActions ? `hhp-${screenId?.replace(/[._]/g, "-")}` : void 0;
12253
12369
  const descriptor = payload && screenId ? {
12254
12370
  screenId,
12255
12371
  renderer: "sdui_layout",
12256
12372
  schemaVersion: 1,
12257
12373
  title,
12258
12374
  payload,
12259
- ...info4 ? { logicBundle: { url: `/v1/bundles/${bundleName}`, integrity: "", contentType: "application/javascript+ts-bundle", declaredCapabilities: profile.declaredCapabilities, minBinaryVersion: "0.1.0", bundleVersion: "0.0.1" } } : {}
12375
+ ...info4 && !nanoActions ? { logicBundle: { url: `/v1/bundles/${bundleName}`, integrity: "", contentType: "application/javascript+ts-bundle", declaredCapabilities: profile.declaredCapabilities, minBinaryVersion: "0.1.0", bundleVersion: "0.0.1" } } : {}
12260
12376
  } : void 0;
12261
12377
  const worker = info4 && controller ? controllerWorker(serviceName2, controller.workerImport, info4, bindings, textProjections) : directService ? directService.external ? `// GENERATED HHP v2 worker.
12262
12378
  import ${JSON.stringify(directService.file)};
@@ -12271,7 +12387,16 @@ ${directService.source}
12271
12387
  bundleName,
12272
12388
  sourceMap: sourceMap2,
12273
12389
  dependencies,
12274
- manifest: { profileVersion: "hhp/2", catalogVersion: profile.catalogVersion, screenId, bundleName, serviceName: info4 ? serviceName2 : null, requiredCapabilities: [...requiredCapabilities2].sort(), inputSha256: createHash4("sha256").update(html).digest("hex") }
12390
+ manifest: {
12391
+ profileVersion: "hhp/2",
12392
+ catalogVersion: profile.catalogVersion,
12393
+ screenId,
12394
+ bundleName,
12395
+ serviceName: info4 ? serviceName2 : null,
12396
+ requiredCapabilities: [...requiredCapabilities2].sort(),
12397
+ inputSha256: createHash4("sha256").update(html).digest("hex"),
12398
+ ...nanoActions ? { logic: "nano-actions", nanoLogic: { service: serviceName2, bindings: Object.fromEntries(bindings), projections: textProjections, keyed: [...keyedLists], block: nanoActions.block } } : {}
12399
+ }
12275
12400
  };
12276
12401
  }
12277
12402
  var camel, semantic, attributeAliases, typographyStyled, actionAliases, ajv, validators;
@@ -12281,6 +12406,7 @@ var init_compile = __esm({
12281
12406
  init_controller();
12282
12407
  init_catalog();
12283
12408
  init_css();
12409
+ init_nano_actions();
12284
12410
  init_worker_subtree();
12285
12411
  init_implications();
12286
12412
  camel = (s5) => s5.replace(/-([a-z])/g, (_2, c2) => c2.toUpperCase());
@@ -18295,8 +18421,8 @@ function componentNodes(descriptor) {
18295
18421
  if (!value2 || typeof value2 !== "object") continue;
18296
18422
  let childAncestors = ancestors;
18297
18423
  let childConditional = conditional2;
18298
- if (isRecord2(value2) && isRecord2(value2.body) && typeof value2.body.type === "string" && typeof value2.body.package === "string") {
18299
- const mods = isRecord2(value2.modifiers) ? value2.modifiers : void 0;
18424
+ if (isRecord3(value2) && isRecord3(value2.body) && typeof value2.body.type === "string" && typeof value2.body.package === "string") {
18425
+ const mods = isRecord3(value2.modifiers) ? value2.modifiers : void 0;
18300
18426
  const hiddenHere = mods !== void 0 && (mods.hidden === true || typeof mods.hiddenPath === "string" && mods.hiddenPath !== "");
18301
18427
  const selfConditional = conditional2 || hiddenHere;
18302
18428
  out2.push({ node: value2, path: path2, ancestors, conditional: selfConditional });
@@ -18446,10 +18572,10 @@ function motionBindingIssues(descriptor) {
18446
18572
  const byTransitionId = /* @__PURE__ */ new Map();
18447
18573
  for (const visit of componentNodes(descriptor)) {
18448
18574
  const mods = visit.node.modifiers;
18449
- if (!isRecord2(mods)) continue;
18575
+ if (!isRecord3(mods)) continue;
18450
18576
  const at2 = visit.path ? `${visit.path}.modifiers` : "modifiers";
18451
18577
  out2.push(...transformPathIssues(mods, at2));
18452
- if (isRecord2(mods.scrollLinked)) out2.push(...scrollLinkedIssues(visit, mods.scrollLinked, at2));
18578
+ if (isRecord3(mods.scrollLinked)) out2.push(...scrollLinkedIssues(visit, mods.scrollLinked, at2));
18453
18579
  const tid2 = mods.transitionId;
18454
18580
  if (typeof tid2 === "string" && tid2 !== "" && !tid2.includes("$") && !visit.conditional) {
18455
18581
  byTransitionId.set(tid2, [...byTransitionId.get(tid2) ?? [], `${at2}.transitionId`]);
@@ -18467,7 +18593,7 @@ function motionBindingIssues(descriptor) {
18467
18593
  }
18468
18594
  return out2;
18469
18595
  }
18470
- var TRANSFORM_PATH_KEYS, SCROLL_LINKED_OUTPUTS, SCROLL_CONTAINER_TYPES, CONDITIONAL_CONTAINER_TYPES, isRecord2, issue, finiteNumbers;
18596
+ var TRANSFORM_PATH_KEYS, SCROLL_LINKED_OUTPUTS, SCROLL_CONTAINER_TYPES, CONDITIONAL_CONTAINER_TYPES, isRecord3, issue, finiteNumbers;
18471
18597
  var init_motion_bindings_lint = __esm({
18472
18598
  "../../core/dev-server/src/motion-bindings-lint.ts"() {
18473
18599
  init_define_HHP_CATALOG();
@@ -18494,7 +18620,7 @@ var init_motion_bindings_lint = __esm({
18494
18620
  "Tooltip",
18495
18621
  "DisclosureGroup"
18496
18622
  ]);
18497
- isRecord2 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
18623
+ isRecord3 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
18498
18624
  issue = (severity, pass, code3, path2, message5) => ({ severity, pass, code: code3, ruleCode: code3, path: path2, message: message5 });
18499
18625
  finiteNumbers = (v2) => Array.isArray(v2) && v2.every((n2) => typeof n2 === "number" && Number.isFinite(n2));
18500
18626
  }
@@ -41207,15 +41333,15 @@ function authored(overlays, name) {
41207
41333
  function selectIdiomOverlay(doc, ctx = {}) {
41208
41334
  const policy = doc.idiomPolicy;
41209
41335
  const overlays = doc.idiom;
41210
- const isRecord6 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
41211
- if (!isRecord6(policy) || !isRecord6(overlays)) return void 0;
41336
+ const isRecord7 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
41337
+ if (!isRecord7(policy) || !isRecord7(overlays)) return void 0;
41212
41338
  const kind = policy.policy ?? "follow-surface";
41213
41339
  if (kind === "none") return void 0;
41214
41340
  if (kind === "pinned") return authored(overlays, policy.pin) ? policy.pin : void 0;
41215
41341
  if (kind !== "follow-surface") return void 0;
41216
41342
  const surfaces = policy.surfaces;
41217
41343
  const candidates = [
41218
- ctx.surface !== void 0 && isRecord6(surfaces) && Object.hasOwn(surfaces, ctx.surface) ? surfaces[ctx.surface] : void 0,
41344
+ ctx.surface !== void 0 && isRecord7(surfaces) && Object.hasOwn(surfaces, ctx.surface) ? surfaces[ctx.surface] : void 0,
41219
41345
  ...ctx.native ?? [],
41220
41346
  policy.fallback
41221
41347
  ];
@@ -42326,7 +42452,7 @@ var init_store2 = __esm({
42326
42452
  });
42327
42453
 
42328
42454
  // ../../core/ts/src/stream-policy.ts
42329
- function isRecord3(value2) {
42455
+ function isRecord4(value2) {
42330
42456
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
42331
42457
  }
42332
42458
  function isLoopback(host) {
@@ -42334,7 +42460,7 @@ function isLoopback(host) {
42334
42460
  }
42335
42461
  function endpointErrors(endpoint, index, options2) {
42336
42462
  const at2 = `streamPolicy.endpoints[${index}]`;
42337
- if (!isRecord3(endpoint)) return [`${at2} must be an object`];
42463
+ if (!isRecord4(endpoint)) return [`${at2} must be an object`];
42338
42464
  const errors = [];
42339
42465
  let origin;
42340
42466
  if (typeof endpoint.origin !== "string") {
@@ -42382,7 +42508,7 @@ function endpointErrors(endpoint, index, options2) {
42382
42508
  return errors;
42383
42509
  }
42384
42510
  function validateStreamPolicy(policy, options2) {
42385
- if (!isRecord3(policy)) return ["streamPolicy must be an object"];
42511
+ if (!isRecord4(policy)) return ["streamPolicy must be an object"];
42386
42512
  const errors = [];
42387
42513
  if (policy.version !== STREAM_POLICY_VERSION) errors.push(`streamPolicy.version must equal ${STREAM_POLICY_VERSION}`);
42388
42514
  if (!Array.isArray(policy.endpoints)) {
@@ -42399,7 +42525,7 @@ function validateNavigationStreamPolicyConfig(appConfig, options2) {
42399
42525
  } catch {
42400
42526
  return ["appConfig must be valid JSON"];
42401
42527
  }
42402
- if (!isRecord3(config)) return ["appConfig must be an object"];
42528
+ if (!isRecord4(config)) return ["appConfig must be an object"];
42403
42529
  if (config.streamPolicy === void 0) return [];
42404
42530
  return validateStreamPolicy(config.streamPolicy, options2);
42405
42531
  }
@@ -57999,7 +58125,7 @@ var init_pdf = __esm({
57999
58125
  var TYPED_ARRAY_CONSTRUCTOR = "TypedArrayConstructor";
58000
58126
  var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis2.opera) !== "Opera";
58001
58127
  var TYPED_ARRAY_TAG_REQUIRED = false;
58002
- var NAME2, Constructor, Prototype;
58128
+ var NAME3, Constructor, Prototype;
58003
58129
  var TypedArrayConstructorsList = {
58004
58130
  Int8Array: 1,
58005
58131
  Uint8Array: 1,
@@ -58081,14 +58207,14 @@ var init_pdf = __esm({
58081
58207
  }
58082
58208
  }
58083
58209
  };
58084
- for (NAME2 in TypedArrayConstructorsList) {
58085
- Constructor = globalThis2[NAME2];
58210
+ for (NAME3 in TypedArrayConstructorsList) {
58211
+ Constructor = globalThis2[NAME3];
58086
58212
  Prototype = Constructor && Constructor.prototype;
58087
58213
  if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
58088
58214
  else NATIVE_ARRAY_BUFFER_VIEWS = false;
58089
58215
  }
58090
- for (NAME2 in BigIntArrayConstructorsList) {
58091
- Constructor = globalThis2[NAME2];
58216
+ for (NAME3 in BigIntArrayConstructorsList) {
58217
+ Constructor = globalThis2[NAME3];
58092
58218
  Prototype = Constructor && Constructor.prototype;
58093
58219
  if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
58094
58220
  }
@@ -58096,14 +58222,14 @@ var init_pdf = __esm({
58096
58222
  TypedArray = function TypedArray2() {
58097
58223
  throw new TypeError2("Incorrect invocation");
58098
58224
  };
58099
- if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME2 in TypedArrayConstructorsList) {
58100
- if (globalThis2[NAME2]) setPrototypeOf(globalThis2[NAME2], TypedArray);
58225
+ if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME3 in TypedArrayConstructorsList) {
58226
+ if (globalThis2[NAME3]) setPrototypeOf(globalThis2[NAME3], TypedArray);
58101
58227
  }
58102
58228
  }
58103
58229
  if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
58104
58230
  TypedArrayPrototype = TypedArray.prototype;
58105
- if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME2 in TypedArrayConstructorsList) {
58106
- if (globalThis2[NAME2]) setPrototypeOf(globalThis2[NAME2].prototype, TypedArrayPrototype);
58231
+ if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME3 in TypedArrayConstructorsList) {
58232
+ if (globalThis2[NAME3]) setPrototypeOf(globalThis2[NAME3].prototype, TypedArrayPrototype);
58107
58233
  }
58108
58234
  }
58109
58235
  if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
@@ -58117,8 +58243,8 @@ var init_pdf = __esm({
58117
58243
  return isObject6(this) ? this[TYPED_ARRAY_TAG] : void 0;
58118
58244
  }
58119
58245
  });
58120
- for (NAME2 in TypedArrayConstructorsList) if (globalThis2[NAME2]) {
58121
- createNonEnumerableProperty(globalThis2[NAME2].prototype, TYPED_ARRAY_TAG, NAME2);
58246
+ for (NAME3 in TypedArrayConstructorsList) if (globalThis2[NAME3]) {
58247
+ createNonEnumerableProperty(globalThis2[NAME3].prototype, TYPED_ARRAY_TAG, NAME3);
58122
58248
  }
58123
58249
  }
58124
58250
  module.exports = {
@@ -150384,7 +150510,7 @@ function bakeBootState(bundleJs, input, opts = {}) {
150384
150510
  const omitted = [];
150385
150511
  for (const [name, state] of Object.entries(services2)) {
150386
150512
  const probe2 = probed[name];
150387
- if (name === BOOT_STATE_STORAGE_KEYS || drifting.includes(name) || !isRecord4(state) || !isRecord4(probe2)) {
150513
+ if (name === BOOT_STATE_STORAGE_KEYS || drifting.includes(name) || !isRecord5(state) || !isRecord5(probe2)) {
150388
150514
  omitted.push(name);
150389
150515
  continue;
150390
150516
  }
@@ -150411,7 +150537,7 @@ function steadyPart(state, probe2, at2, omitted) {
150411
150537
  for (const [key4, value2] of Object.entries(state)) {
150412
150538
  const other = probe2[key4];
150413
150539
  if (sameJson3(value2, other)) steady[key4] = value2;
150414
- else if (isRecord4(value2) && isRecord4(other)) {
150540
+ else if (isRecord5(value2) && isRecord5(other)) {
150415
150541
  const part5 = steadyPart(value2, other, `${at2}.${key4}`, omitted);
150416
150542
  if (Object.keys(part5).length > 0) steady[key4] = part5;
150417
150543
  } else omitted.push(`${at2}.${key4}`);
@@ -150431,9 +150557,9 @@ function gatesUnbakedPath(descriptor, state, services2) {
150431
150557
  }
150432
150558
  function withoutClosedSheets(node3, state) {
150433
150559
  if (Array.isArray(node3)) return node3.map((v2) => withoutClosedSheets(v2, state));
150434
- if (!isRecord4(node3)) return node3;
150560
+ if (!isRecord5(node3)) return node3;
150435
150561
  const body = node3.body;
150436
- if (isRecord4(body) && body.type === "BottomSheet" && isRecord4(body.props) && typeof body.props.presentedPath === "string") {
150562
+ if (isRecord5(body) && body.type === "BottomSheet" && isRecord5(body.props) && typeof body.props.presentedPath === "string") {
150437
150563
  const m2 = /^\$service:([A-Za-z0-9_-]+)\.(.+)$/.exec(body.props.presentedPath);
150438
150564
  if (m2 && valueAt3(state[m2[1]], m2[2]) === false) {
150439
150565
  const { content: _closed, footer: _closedFooter, ...props2 } = body.props;
@@ -150450,7 +150576,7 @@ function valueAt3(root, path2) {
150450
150576
  }
150451
150577
  return v2;
150452
150578
  }
150453
- function isRecord4(v2) {
150579
+ function isRecord5(v2) {
150454
150580
  return v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
150455
150581
  }
150456
150582
  function sameJson3(a3, b3) {
@@ -175227,7 +175353,7 @@ function optHttpsUrl(obj19, key4) {
175227
175353
  return url.href;
175228
175354
  }
175229
175355
  function parseAppSpec(raw, specDir = process.cwd()) {
175230
- if (!isRecord5(raw)) invalid("must be a JSON object");
175356
+ if (!isRecord6(raw)) invalid("must be a JSON object");
175231
175357
  onlyKeys(raw, [...TOP_KEYS2], "the spec");
175232
175358
  const spec = {};
175233
175359
  const url = optString(raw, "url");
@@ -175255,14 +175381,14 @@ function parseAppSpec(raw, specDir = process.cwd()) {
175255
175381
  }
175256
175382
  }
175257
175383
  if (raw.colors !== void 0) {
175258
- if (!isRecord5(raw.colors)) invalid("colors must be an object");
175384
+ if (!isRecord6(raw.colors)) invalid("colors must be an object");
175259
175385
  onlyKeys(raw.colors, ["primary", "secondary"], "colors");
175260
175386
  const primary = optHex(raw.colors, "primary", "colors.primary");
175261
175387
  const secondary = optHex(raw.colors, "secondary", "colors.secondary");
175262
175388
  spec.colors = { ...primary ? { primary } : {}, ...secondary ? { secondary } : {} };
175263
175389
  }
175264
175390
  if (raw.splash !== void 0) {
175265
- if (!isRecord5(raw.splash)) invalid("splash must be an object");
175391
+ if (!isRecord6(raw.splash)) invalid("splash must be an object");
175266
175392
  onlyKeys(raw.splash, ["backgroundColor", "caption"], "splash");
175267
175393
  const splash = {};
175268
175394
  const bg = optString(raw.splash, "backgroundColor", "splash.backgroundColor");
@@ -175281,7 +175407,7 @@ function parseAppSpec(raw, specDir = process.cwd()) {
175281
175407
  if (raw.base44 !== void 0) {
175282
175408
  if (raw.base44 === false) spec.base44 = false;
175283
175409
  else {
175284
- if (!isRecord5(raw.base44)) invalid("base44 must be an object or false");
175410
+ if (!isRecord6(raw.base44)) invalid("base44 must be an object or false");
175285
175411
  onlyKeys(raw.base44, ["appId"], "base44");
175286
175412
  const appId3 = optString(raw.base44, "appId", "base44.appId");
175287
175413
  if (appId3 !== void 0 && !BASE44_ID.test(appId3)) invalid(`base44.appId must be 8-64 letters and digits (the id in https://app.base44.com/apps/<id>), got ${JSON.stringify(appId3)}`);
@@ -175293,7 +175419,7 @@ function parseAppSpec(raw, specDir = process.cwd()) {
175293
175419
  const seen = /* @__PURE__ */ new Set();
175294
175420
  spec.pages = raw.pages.map((p2, i2) => {
175295
175421
  const where = `pages[${i2}]`;
175296
- if (!isRecord5(p2)) invalid(`${where} must be an object`);
175422
+ if (!isRecord6(p2)) invalid(`${where} must be an object`);
175297
175423
  onlyKeys(p2, ["id", "title", "path", "icon", "placement"], where);
175298
175424
  const id = optString(p2, "id", `${where}.id`);
175299
175425
  const title = optString(p2, "title", `${where}.title`);
@@ -175350,7 +175476,7 @@ function normalized(u2) {
175350
175476
  return u2;
175351
175477
  }
175352
175478
  }
175353
- var FromUrlError, HEX2, BASE44_ID, PAGE_ID2, TOP_KEYS2, isRecord5;
175479
+ var FromUrlError, HEX2, BASE44_ID, PAGE_ID2, TOP_KEYS2, isRecord6;
175354
175480
  var init_spec = __esm({
175355
175481
  "src/from-url/spec.ts"() {
175356
175482
  init_define_HHP_CATALOG();
@@ -175366,7 +175492,7 @@ var init_spec = __esm({
175366
175492
  BASE44_ID = /^[A-Za-z0-9]{8,64}$/;
175367
175493
  PAGE_ID2 = /^[a-z][a-z0-9_]*$/;
175368
175494
  TOP_KEYS2 = /* @__PURE__ */ new Set(["$schema", "url", "name", "description", "icon", "colors", "splash", "base44", "pages", "supportUrl", "privacyUrl", "termsUrl"]);
175369
- isRecord5 = (v2) => v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
175495
+ isRecord6 = (v2) => v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
175370
175496
  }
175371
175497
  });
175372
175498
 
@@ -180998,17 +181124,17 @@ function gatherReleaseEntries(appDir3) {
180998
181124
  wanted.delete(HIMI_PACKAGE_MANIFEST_PATH);
180999
181125
  wanted.delete(HIMI_PACKAGE_HEADER_PATH);
181000
181126
  for (const singleton of SINGLETONS) wanted.delete(singleton);
181001
- const unsafe2 = [
181127
+ const unsafe3 = [
181002
181128
  ...Object.keys(manifest2.screens ?? {}).filter((id) => !isSafePackageSegment(id)).map((id) => `screen "${id}"`),
181003
181129
  ...Object.keys(manifest2.widgets ?? {}).filter((id) => !isSafePackageSegment(id)).map((id) => `widget "${id}"`),
181004
181130
  ...Object.entries(manifest2.bundles ?? {}).filter(([, m2]) => !m2?.sha256 || !/^[a-f0-9]{64}$/.test(m2.sha256)).map(([name]) => `bundle "${name}"`),
181005
181131
  ...Object.entries(manifest2.assets ?? {}).filter(([, r3]) => !r3?.sha256 || !/^[a-f0-9]{64}$/.test(r3.sha256)).map(([name]) => `asset "${name}"`),
181006
181132
  ...handlerRecords(manifest2).filter((h2) => !h2?.bundleHash || !/^[a-f0-9]{64}$/.test(h2.bundleHash)).map((h2) => `handler "${h2?.id ?? "?"}"`)
181007
181133
  ];
181008
- if (unsafe2.length) {
181134
+ if (unsafe3.length) {
181009
181135
  throw new Error(
181010
- `release at ${appDir3} names ${unsafe2.length} entr${unsafe2.length === 1 ? "y" : "ies"} whose id is not a safe file name \u2014 refusing to pack it:
181011
- ${unsafe2.slice(0, 10).join("\n ")}`
181136
+ `release at ${appDir3} names ${unsafe3.length} entr${unsafe3.length === 1 ? "y" : "ies"} whose id is not a safe file name \u2014 refusing to pack it:
181137
+ ${unsafe3.slice(0, 10).join("\n ")}`
181012
181138
  );
181013
181139
  }
181014
181140
  const missing4 = [];
@@ -183516,18 +183642,18 @@ function configuredTokensPath(dir) {
183516
183642
  }
183517
183643
  function tokenNumericIssues(tokens2, tokensPath = "tokens.json") {
183518
183644
  const issues = [];
183519
- const isRecord6 = (v2) => v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
183520
- if (!isRecord6(tokens2)) return issues;
183645
+ const isRecord7 = (v2) => v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
183646
+ if (!isRecord7(tokens2)) return issues;
183521
183647
  const shown3 = (v2) => typeof v2 === "string" ? JSON.stringify(v2) : JSON.stringify(v2) ?? String(v2);
183522
183648
  const bad4 = (v2) => !(typeof v2 === "number" && Number.isInteger(v2));
183523
183649
  const check = (layer, where) => {
183524
- if (!isRecord6(layer)) return;
183650
+ if (!isRecord7(layer)) return;
183525
183651
  const loses = where ? `the ${where.slice(0, -1)} overlay is dropped on device and the base look is used instead` : 'iOS and Android reject the WHOLE tokens.json otherwise ("Theme unavailable" on iOS, the default palette and fonts on Android)';
183526
183652
  for (const { group, field, unit } of INTEGER_TOKEN_FIELDS) {
183527
183653
  const entries = layer[group];
183528
- if (!isRecord6(entries)) continue;
183654
+ if (!isRecord7(entries)) continue;
183529
183655
  for (const [name, token] of Object.entries(entries)) {
183530
- if (!isRecord6(token) || !(field in token)) continue;
183656
+ if (!isRecord7(token) || !(field in token)) continue;
183531
183657
  const value2 = token[field];
183532
183658
  if (!bad4(value2)) continue;
183533
183659
  const path2 = `${where}${group}.${name}.${field}`;
@@ -183543,7 +183669,7 @@ function tokenNumericIssues(tokens2, tokensPath = "tokens.json") {
183543
183669
  }
183544
183670
  for (const group of INTEGER_TOKEN_MAPS) {
183545
183671
  const entries = layer[group];
183546
- if (!isRecord6(entries)) continue;
183672
+ if (!isRecord7(entries)) continue;
183547
183673
  for (const [name, value2] of Object.entries(entries)) {
183548
183674
  if (!bad4(value2)) continue;
183549
183675
  const fix = typeof value2 === "number" && Number.isFinite(value2) ? ` Write ${Math.round(value2)}.` : "";
@@ -183559,7 +183685,7 @@ function tokenNumericIssues(tokens2, tokensPath = "tokens.json") {
183559
183685
  };
183560
183686
  check(tokens2, "");
183561
183687
  const idiom = tokens2.idiom;
183562
- if (isRecord6(idiom)) {
183688
+ if (isRecord7(idiom)) {
183563
183689
  for (const [overlay, layer] of Object.entries(idiom)) check(layer, `idiom.${overlay}.`);
183564
183690
  }
183565
183691
  return issues;
@@ -197357,7 +197483,7 @@ function createFunctionCallCapability(options2) {
197357
197483
  if (options2.signal?.aborted) {
197358
197484
  throw new FunctionCallError("function_call_canceled", "parent invocation was canceled");
197359
197485
  }
197360
- if (!NAME.test(name)) {
197486
+ if (!NAME2.test(name)) {
197361
197487
  throw new FunctionCallError("function_not_found", "target function does not exist");
197362
197488
  }
197363
197489
  const target = targets.get(name);
@@ -197403,7 +197529,7 @@ function createFunctionCallCapability(options2) {
197403
197529
  }
197404
197530
  };
197405
197531
  }
197406
- var FunctionCallError, NAME;
197532
+ var FunctionCallError, NAME2;
197407
197533
  var init_calls = __esm({
197408
197534
  "../../core/functions-runtime/src/calls.ts"() {
197409
197535
  init_define_HHP_CATALOG();
@@ -197414,7 +197540,7 @@ var init_calls = __esm({
197414
197540
  this.name = "FunctionCallError";
197415
197541
  }
197416
197542
  };
197417
- NAME = /^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/;
197543
+ NAME2 = /^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/;
197418
197544
  }
197419
197545
  });
197420
197546
 
@@ -208236,7 +208362,7 @@ function checkPolicy(doc, source2 = "asc-policy.yml") {
208236
208362
  throw new PolicyError(["the document must be a mapping"], source2);
208237
208363
  const d2 = doc;
208238
208364
  for (const key4 of Object.keys(d2))
208239
- if (!KEYS.has(key4))
208365
+ if (!KEYS2.has(key4))
208240
208366
  problems.push(`unknown key "${key4}"`);
208241
208367
  if (d2.version !== 1)
208242
208368
  problems.push("version must be 1");
@@ -208308,12 +208434,12 @@ function checkPolicy(doc, source2 = "asc-policy.yml") {
208308
208434
  function gplayPolicy() {
208309
208435
  return checkPolicy({ version: 1, default: "one", reads: "auto", actions: { ...GPLAY_POLICY_ACTIONS }, fleet: { twoApprovalsOverApps: 20, twoApprovalsAcrossAccounts: true }, agents: { mayApproveOwnJobs: false } }, "the gplay policy");
208310
208436
  }
208311
- var LEVELS, KEYS, PolicyError, GPLAY_POLICY_ACTIONS;
208437
+ var LEVELS, KEYS2, PolicyError, GPLAY_POLICY_ACTIONS;
208312
208438
  var init_policy_check = __esm({
208313
208439
  "../../node_modules/@wix/asc-jobs/dist/policy-check.js"() {
208314
208440
  init_define_HHP_CATALOG();
208315
208441
  LEVELS = /* @__PURE__ */ new Set(["auto", "one", "two", "never"]);
208316
- KEYS = /* @__PURE__ */ new Set(["version", "default", "reads", "actions", "fleet", "agents", "testApps"]);
208442
+ KEYS2 = /* @__PURE__ */ new Set(["version", "default", "reads", "actions", "fleet", "agents", "testApps"]);
208317
208443
  PolicyError = class extends Error {
208318
208444
  problems;
208319
208445
  constructor(problems, source2) {
@@ -253794,7 +253920,7 @@ async function printRenderBatch(ctx, o2) {
253794
253920
  const entries = [];
253795
253921
  const ownShots = {};
253796
253922
  const ownFiles = [];
253797
- let unsafe2 = false;
253923
+ let unsafe3 = false;
253798
253924
  const missing4 = [];
253799
253925
  for (const screenId of asked) {
253800
253926
  const rendered = built.renders.filter((r3) => r3.screenId === screenId).sort((a3, b3) => variantIndex(a3) - variantIndex(b3));
@@ -253812,7 +253938,7 @@ async function printRenderBatch(ctx, o2) {
253812
253938
  if (wantPng && r3.pngBase64) {
253813
253939
  const own6 = shotKit.writeScreenShot(dir, r3.screenId, r3.pngBase64);
253814
253940
  if (own6 === null) {
253815
- unsafe2 = true;
253941
+ unsafe3 = true;
253816
253942
  return [{ ok: false, code: "unsafe_screen_id", screenId: r3.screenId, ...v2.width ? { width: v2.width } : {}, error: `screen id "${r3.screenId}" would write outside .himi/renders and .himi/shots, so no PNG was written` }];
253817
253943
  }
253818
253944
  pngFile = own6;
@@ -253834,7 +253960,7 @@ async function printRenderBatch(ctx, o2) {
253834
253960
  }
253835
253961
  const renderedScreens = [...new Set(built.renders.map((r3) => r3.screenId))];
253836
253962
  const findings = renderedScreens.flatMap((id) => lintOf(id));
253837
- const ok5 = entries.length > 0 && entries.every((e2) => e2.ok === true) && !unsafe2;
253963
+ const ok5 = entries.length > 0 && entries.every((e2) => e2.ok === true) && !unsafe3;
253838
253964
  const failedEntries = entries.filter((e2) => e2.ok !== true).length;
253839
253965
  const legacy = {
253840
253966
  ok: ok5,
@@ -299635,14 +299761,14 @@ async function l10nCommand(ctx) {
299635
299761
  }
299636
299762
  const { convertOneApp: convertOneApp2, undeclaredLocales: undeclaredLocales2 } = await Promise.resolve().then(() => (init_import_oneapp(), import_oneapp_exports));
299637
299763
  const existing = {};
299638
- let unsafe2;
299764
+ let unsafe3;
299639
299765
  try {
299640
- unsafe2 = unsafeDestination(appDir3, requested);
299766
+ unsafe3 = unsafeDestination(appDir3, requested);
299641
299767
  } catch (e2) {
299642
299768
  return fail16("catalog_write_failed", { error: `cannot inspect ${relative37(process.cwd(), join188(appDir3, "l10n"))}: ${e2.message}`, written: [] }, 1);
299643
299769
  }
299644
- if (unsafe2 !== void 0) {
299645
- return fail16("unsafe_path", { error: `${unsafe2} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
299770
+ if (unsafe3 !== void 0) {
299771
+ return fail16("unsafe_path", { error: `${unsafe3} \u2014 the import does not read or write through links`, hint: "replace the link with a real directory/file inside the app, then re-run" }, 1);
299646
299772
  }
299647
299773
  for (const tag of requested) {
299648
299774
  const path2 = join188(appDir3, "l10n", `${tag}.json`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1861.0",
3
+ "version": "0.1862.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": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "1ed4563bb6b4ad243b4fab3bbfd1842121d5779869ed5fe130505418"
85
+ "falconPackageHash": "e214a5b200f410398725a2dfd3fc30b5059076faaf3ebfa548716932"
86
86
  }