@wix/himalaya-cli 0.1960.0 → 0.1961.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 +169 -100
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -3964,6 +3964,7 @@ var init_himi_package = __esm({
3964
3964
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
3965
3965
  var init_icon_catalog_generated = __esm({
3966
3966
  "../../core/ts/src/icon-catalog.generated.ts"() {
3967
+ "use strict";
3967
3968
  init_define_HHP_CATALOG();
3968
3969
  ICON_VIEW_BOX = 24;
3969
3970
  ICON_STROKE_WIDTH = 2;
@@ -10714,7 +10715,7 @@ var init_catalog_cache = __esm({
10714
10715
  return [f2.path, f2];
10715
10716
  })
10716
10717
  );
10717
- const seen = /* @__PURE__ */ new Set(), decoded2 = [];
10718
+ const seen = /* @__PURE__ */ new Set(), decoded3 = [];
10718
10719
  let total = 0;
10719
10720
  for (const f2 of pack.files) {
10720
10721
  file(f2);
@@ -10731,7 +10732,7 @@ var init_catalog_cache = __esm({
10731
10732
  if (total > MAX_EXPANDED || body.length !== f2.bytes || spec.bytes !== f2.bytes || hash(body) !== f2.digest || spec.digest !== f2.digest)
10732
10733
  fail("catalog_digest_mismatch", "reference file size/digest mismatch");
10733
10734
  seen.add(f2.path);
10734
- decoded2.push({ path: f2.path, body });
10735
+ decoded3.push({ path: f2.path, body });
10735
10736
  }
10736
10737
  for (const r3 of m2.resources.filter(
10737
10738
  (r4) => r4.pack ? r4.pack === "references" : !["templates", "examples"].includes(r4.kind ?? "") && r4.id !== "foundations/browser-runtime"
@@ -10747,7 +10748,7 @@ var init_catalog_cache = __esm({
10747
10748
  const tempRel = `staging-${randomUUID()}`;
10748
10749
  mkdirSync3(this.target(tempRel), { recursive: true });
10749
10750
  try {
10750
- for (const f2 of decoded2) {
10751
+ for (const f2 of decoded3) {
10751
10752
  const p2 = this.target(`${tempRel}/${f2.path}`);
10752
10753
  mkdirSync3(dirname6(p2), { recursive: true });
10753
10754
  writeFileSync3(p2, f2.body);
@@ -10757,7 +10758,7 @@ var init_catalog_cache = __esm({
10757
10758
  mkdirSync3(dirname6(dest), { recursive: true });
10758
10759
  if (!existsSync5(dest)) renameSync(this.target(tempRel), dest);
10759
10760
  else {
10760
- for (const f2 of decoded2)
10761
+ for (const f2 of decoded3)
10761
10762
  this.readCachedFile(selected, expected.get(f2.path));
10762
10763
  renameSync(
10763
10764
  this.target(`${tempRel}/manifest.json`),
@@ -21514,46 +21515,76 @@ var init_validator = __esm({
21514
21515
  });
21515
21516
 
21516
21517
  // ../../core/dev-server/src/bundle-source-map.ts
21517
- function mapBundleFrame(mapJson, genLine, genCol) {
21518
+ function decode(mapJson) {
21519
+ decodes += 1;
21520
+ let map2;
21518
21521
  try {
21519
- const map2 = JSON.parse(mapJson);
21520
- if (!Array.isArray(map2.sources) || typeof map2.mappings !== "string") return null;
21521
- const lines2 = map2.mappings.split(";");
21522
- if (genLine < 1 || genLine > lines2.length) return null;
21523
- let srcIdx = 0, srcLine = 0, srcCol = 0;
21524
- let best = null;
21525
- for (let li2 = 0; li2 < genLine; li2++) {
21526
- let genColAcc = 0;
21527
- for (const seg2 of lines2[li2].split(",")) {
21528
- if (!seg2) continue;
21529
- const fields2 = [];
21530
- let shift = 0, value2 = 0;
21531
- for (const ch2 of seg2) {
21532
- const digit = VLQ.indexOf(ch2);
21533
- if (digit < 0) return null;
21534
- value2 += (digit & 31) << shift;
21535
- if (digit & 32) {
21536
- shift += 5;
21537
- continue;
21538
- }
21539
- fields2.push(value2 & 1 ? -(value2 >>> 1) : value2 >>> 1);
21540
- shift = 0;
21541
- value2 = 0;
21522
+ map2 = JSON.parse(mapJson);
21523
+ } catch {
21524
+ return null;
21525
+ }
21526
+ if (!map2 || !Array.isArray(map2.sources) || typeof map2.mappings !== "string") return null;
21527
+ const rawLines = map2.mappings.split(";");
21528
+ const out2 = { sources: map2.sources, lineCount: rawLines.length, lines: [] };
21529
+ let srcIdx = 0, srcLine = 0;
21530
+ for (let li2 = 0; li2 < rawLines.length; li2++) {
21531
+ const segments2 = [];
21532
+ out2.lines.push(segments2);
21533
+ let genColAcc = 0;
21534
+ for (const seg2 of rawLines[li2].split(",")) {
21535
+ if (!seg2) continue;
21536
+ const fields2 = [];
21537
+ let shift = 0, value2 = 0;
21538
+ for (const ch2 of seg2) {
21539
+ const digit = VLQ.indexOf(ch2);
21540
+ if (digit < 0) {
21541
+ out2.bad = { line: li2, before: segments2.length };
21542
+ return out2;
21542
21543
  }
21543
- if (fields2.length < 4) {
21544
- genColAcc += fields2[0] ?? 0;
21544
+ value2 += (digit & 31) << shift;
21545
+ if (digit & 32) {
21546
+ shift += 5;
21545
21547
  continue;
21546
21548
  }
21547
- genColAcc += fields2[0];
21548
- srcIdx += fields2[1];
21549
- srcLine += fields2[2];
21550
- srcCol += fields2[3];
21551
- if (li2 === genLine - 1) {
21552
- if (genColAcc > genCol && best) break;
21553
- best = { srcIdx, srcLine };
21554
- }
21549
+ fields2.push(value2 & 1 ? -(value2 >>> 1) : value2 >>> 1);
21550
+ shift = 0;
21551
+ value2 = 0;
21555
21552
  }
21553
+ if (fields2.length < 4) {
21554
+ genColAcc += fields2[0] ?? 0;
21555
+ continue;
21556
+ }
21557
+ genColAcc += fields2[0];
21558
+ srcIdx += fields2[1];
21559
+ srcLine += fields2[2];
21560
+ segments2.push({ genCol: genColAcc, srcIdx, srcLine });
21561
+ }
21562
+ }
21563
+ return out2;
21564
+ }
21565
+ function decodedMap(mapJson) {
21566
+ if (decoded2.has(mapJson)) return decoded2.get(mapJson);
21567
+ const result = decode(mapJson);
21568
+ if (decoded2.size >= DECODED_MAX) decoded2.delete(decoded2.keys().next().value);
21569
+ decoded2.set(mapJson, result);
21570
+ return result;
21571
+ }
21572
+ function mapBundleFrame(mapJson, genLine, genCol) {
21573
+ try {
21574
+ const map2 = decodedMap(mapJson);
21575
+ if (!map2) return null;
21576
+ if (genLine < 1 || genLine > map2.lineCount) return null;
21577
+ const target = genLine - 1;
21578
+ if (map2.bad && map2.bad.line < target) return null;
21579
+ const segments2 = map2.lines[target] ?? [];
21580
+ let best = null;
21581
+ let reached = 0;
21582
+ for (const segment3 of segments2) {
21583
+ if (segment3.genCol > genCol && best) break;
21584
+ best = segment3;
21585
+ reached += 1;
21556
21586
  }
21587
+ if (map2.bad && map2.bad.line === target && reached === map2.bad.before) return null;
21557
21588
  if (!best || !map2.sources[best.srcIdx]) return null;
21558
21589
  const raw = String(map2.sources[best.srcIdx]).replace(/^(\.\.\/)+/, "");
21559
21590
  return `${raw}:${best.srcLine + 1}`;
@@ -21561,11 +21592,14 @@ function mapBundleFrame(mapJson, genLine, genCol) {
21561
21592
  return null;
21562
21593
  }
21563
21594
  }
21564
- var VLQ;
21595
+ var VLQ, decoded2, DECODED_MAX, decodes;
21565
21596
  var init_bundle_source_map = __esm({
21566
21597
  "../../core/dev-server/src/bundle-source-map.ts"() {
21567
21598
  init_define_HHP_CATALOG();
21568
21599
  VLQ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
21600
+ decoded2 = /* @__PURE__ */ new Map();
21601
+ DECODED_MAX = 8;
21602
+ decodes = 0;
21569
21603
  }
21570
21604
  });
21571
21605
 
@@ -31688,8 +31722,8 @@ async function rasterizeSvg(svg, scale = 3, inputPixelLimit = SHARP_INPUT_PIXEL_
31688
31722
  const { width = 0, height = 0 } = await sharp(svg, { limitInputPixels: false }).metadata();
31689
31723
  const edge = Math.max(width, height);
31690
31724
  const density = edge > 0 ? Math.max(1, Math.min(72 * scale, 72 * SVG_RASTER_MAX_EDGE / edge)) : 72 * scale;
31691
- const decoded2 = Math.round(width * density / 72) * Math.round(height * density / 72);
31692
- if (decoded2 > inputPixelLimit) {
31725
+ const decoded3 = Math.round(width * density / 72) * Math.round(height * density / 72);
31726
+ if (decoded3 > inputPixelLimit) {
31693
31727
  throw new Error(`SVG is too large to rasterize: ${width}x${height} intrinsic size; give it a width/height (or viewBox) under ${Math.floor(72 * Math.sqrt(inputPixelLimit))}px per side`);
31694
31728
  }
31695
31729
  return sharp(svg, { density, limitInputPixels: inputPixelLimit }).resize({ width: SVG_RASTER_MAX_EDGE, height: SVG_RASTER_MAX_EDGE, fit: "inside", withoutEnlargement: true }).png().toBuffer();
@@ -46361,6 +46395,7 @@ function shouldRevealError(args) {
46361
46395
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
46362
46396
  var init_validation = __esm({
46363
46397
  "../../core/ts/src/validation.ts"() {
46398
+ "use strict";
46364
46399
  init_define_HHP_CATALOG();
46365
46400
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
46366
46401
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -59222,10 +59257,10 @@ function richTextEditedHtml(originalHtml, originalText, nextText) {
59222
59257
  }
59223
59258
  continue;
59224
59259
  }
59225
- const decoded2 = decodeHTML(raw);
59226
- if (raw.startsWith("&")) append(decoded2, start2, start2 + raw.length);
59260
+ const decoded3 = decodeHTML(raw);
59261
+ if (raw.startsWith("&")) append(decoded3, start2, start2 + raw.length);
59227
59262
  else {
59228
- for (let i2 = 0; i2 < decoded2.length; i2++) append(decoded2[i2], start2 + i2, start2 + i2 + 1);
59263
+ for (let i2 = 0; i2 < decoded3.length; i2++) append(decoded3[i2], start2 + i2, start2 + i2 + 1);
59229
59264
  }
59230
59265
  }
59231
59266
  const entries = spans.map((span, i2) => ({ char: visible[i2], ...span }));
@@ -60615,16 +60650,16 @@ function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
60615
60650
  if (!newURL) {
60616
60651
  return defaultFilename;
60617
60652
  }
60618
- const decode = (name) => {
60653
+ const decode2 = (name) => {
60619
60654
  try {
60620
- let decoded2 = decodeURIComponent(name);
60621
- if (decoded2.includes("/")) {
60622
- decoded2 = stripPath(decoded2);
60623
- if (decoded2.length === 4 && pdfRegex.test(decoded2)) {
60655
+ let decoded3 = decodeURIComponent(name);
60656
+ if (decoded3.includes("/")) {
60657
+ decoded3 = stripPath(decoded3);
60658
+ if (decoded3.length === 4 && pdfRegex.test(decoded3)) {
60624
60659
  return name;
60625
60660
  }
60626
60661
  }
60627
- return decoded2;
60662
+ return decoded3;
60628
60663
  } catch {
60629
60664
  return name;
60630
60665
  }
@@ -60632,13 +60667,13 @@ function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
60632
60667
  const pdfRegex = /\.pdf$/i;
60633
60668
  const filename = stripPath(newURL.pathname);
60634
60669
  if (pdfRegex.test(filename)) {
60635
- return decode(filename);
60670
+ return decode2(filename);
60636
60671
  }
60637
60672
  if (newURL.searchParams.size > 0) {
60638
60673
  const getLast = (iterator) => [...iterator].findLast((v2) => pdfRegex.test(v2));
60639
60674
  const name = getLast(newURL.searchParams.values()) ?? getLast(newURL.searchParams.keys());
60640
60675
  if (name) {
60641
- return decode(name);
60676
+ return decode2(name);
60642
60677
  }
60643
60678
  }
60644
60679
  if (newURL.hash) {
@@ -60657,7 +60692,7 @@ function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
60657
60692
  filenameStart--;
60658
60693
  }
60659
60694
  if (filenameStart < extensionStart) {
60660
- return decode(hash3.slice(filenameStart, extensionStart + 4));
60695
+ return decode2(hash3.slice(filenameStart, extensionStart + 4));
60661
60696
  }
60662
60697
  }
60663
60698
  }
@@ -104383,7 +104418,7 @@ var init_pdf_worker_min = __esm({
104383
104418
  e3.runningState >= 0 && (e3.runningState = t3);
104384
104419
  throw new Error("Brotli error code: " + t3);
104385
104420
  }
104386
- return function decode(e3, t3) {
104421
+ return function decode2(e3, t3) {
104387
104422
  let n3 = new State();
104388
104423
  n3.input = new InputStream(e3);
104389
104424
  initState(n3);
@@ -167651,8 +167686,8 @@ function contentDir(flags) {
167651
167686
  function renameRestoredSource(restored, declaredApp, renamed) {
167652
167687
  const text32 = {};
167653
167688
  for (const entry of restored) {
167654
- const decoded2 = entry.bytes.toString("utf8");
167655
- if (Buffer.from(decoded2, "utf8").equals(entry.bytes)) text32[entry.path] = decoded2;
167689
+ const decoded3 = entry.bytes.toString("utf8");
167690
+ if (Buffer.from(decoded3, "utf8").equals(entry.bytes)) text32[entry.path] = decoded3;
167656
167691
  }
167657
167692
  const sentineled = sentinelizeArchive(text32, declaredApp);
167658
167693
  for (const entry of restored) {
@@ -177567,11 +177602,11 @@ function decodeCustomerSigningAssets(assets, expected, now) {
177567
177602
  if (!/^[A-Z0-9]{10}$/.test(expected.teamId) || !/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(expected.bundleId)) {
177568
177603
  return refuse2("customer_signing_identity_mismatch");
177569
177604
  }
177570
- const decoded2 = decodePkcs12(Buffer.from(assets.certificate), assets.certificatePassword);
177571
- if (!decoded2?.certificate) return refuse2("customer_certificate_invalid");
177572
- if (!decoded2.privateKeyPem) return refuse2("customer_private_key_missing");
177573
- if (!decoded2.matchesCertificate) return refuse2("customer_private_key_mismatch");
177574
- const cert = decoded2.certificate;
177605
+ const decoded3 = decodePkcs12(Buffer.from(assets.certificate), assets.certificatePassword);
177606
+ if (!decoded3?.certificate) return refuse2("customer_certificate_invalid");
177607
+ if (!decoded3.privateKeyPem) return refuse2("customer_private_key_missing");
177608
+ if (!decoded3.matchesCertificate) return refuse2("customer_private_key_mismatch");
177609
+ const cert = decoded3.certificate;
177575
177610
  if (Date.parse(cert.validTo) <= now.getTime()) return refuse2("customer_certificate_expired");
177576
177611
  if (Date.parse(cert.validFrom) > now.getTime()) return refuse2("customer_certificate_not_yet_valid");
177577
177612
  const profile = readCustomerProfile(assets.provisioningProfile);
@@ -177599,19 +177634,19 @@ function apnsEnvironment(entitlements, required3) {
177599
177634
  if (apns !== "production") return refuse2("customer_profile_apns_mismatch");
177600
177635
  return "production";
177601
177636
  }
177602
- function toBundle(assets, expected, decoded2, profileType, apns, deviceCount) {
177637
+ function toBundle(assets, expected, decoded3, profileType, apns, deviceCount) {
177603
177638
  return {
177604
177639
  signing: "byo",
177605
177640
  ...expected,
177606
177641
  profileType,
177607
- profileFileName: String(decoded2.profile.UUID),
177642
+ profileFileName: String(decoded3.profile.UUID),
177608
177643
  certificate: Buffer.from(assets.certificate).toString("base64"),
177609
177644
  certificatePassword: Buffer.from(assets.certificatePassword).toString("base64"),
177610
177645
  provisioningProfile: Buffer.from(assets.provisioningProfile).toString("base64"),
177611
177646
  profileSha256: sha2564(assets.provisioningProfile),
177612
- certificateSha256: sha2564(decoded2.cert.raw),
177613
- certificateSha1: createHash30("sha1").update(decoded2.cert.raw).digest("hex").toUpperCase(),
177614
- expiresAt: new Date(Math.min(decoded2.expiration, Date.parse(decoded2.cert.validTo))).toISOString(),
177647
+ certificateSha256: sha2564(decoded3.cert.raw),
177648
+ certificateSha1: createHash30("sha1").update(decoded3.cert.raw).digest("hex").toUpperCase(),
177649
+ expiresAt: new Date(Math.min(decoded3.expiration, Date.parse(decoded3.cert.validTo))).toISOString(),
177615
177650
  ...apns ? { apnsEnvironment: apns } : {},
177616
177651
  deviceCount
177617
177652
  };
@@ -177626,14 +177661,14 @@ function inspectCustomerSigningAssets(assets, expected, now = /* @__PURE__ */ ne
177626
177661
  if (stored.profile.ProvisionsAllDevices === true || stored.entitlements["get-task-allow"] !== false || !Array.isArray(devices) || !devices.length || devices.some((d2) => typeof d2 !== "string" || !d2)) {
177627
177662
  return refuse2("customer_profile_not_adhoc");
177628
177663
  }
177629
- const decoded2 = decodeCustomerSigningAssets(assets, expected, now);
177630
- const apns = apnsEnvironment(decoded2.entitlements, true);
177631
- return toBundle(assets, expected, decoded2, "AD_HOC", apns, devices.length);
177664
+ const decoded3 = decodeCustomerSigningAssets(assets, expected, now);
177665
+ const apns = apnsEnvironment(decoded3.entitlements, true);
177666
+ return toBundle(assets, expected, decoded3, "AD_HOC", apns, devices.length);
177632
177667
  }
177633
177668
  function customerDistributionTeamId(assets) {
177634
- const decoded2 = decodePkcs12(Buffer.from(assets.certificate), assets.certificatePassword);
177635
- if (!decoded2?.certificate) return void 0;
177636
- const ids2 = decoded2.certificate.subject.split("\n").flatMap((line) => {
177669
+ const decoded3 = decodePkcs12(Buffer.from(assets.certificate), assets.certificatePassword);
177670
+ if (!decoded3?.certificate) return void 0;
177671
+ const ids2 = decoded3.certificate.subject.split("\n").flatMap((line) => {
177637
177672
  const match = /^OU=([A-Z0-9]{10})$/.exec(line);
177638
177673
  return match ? [match[1]] : [];
177639
177674
  });
@@ -177642,8 +177677,8 @@ function customerDistributionTeamId(assets) {
177642
177677
  function inspectCustomerAppStoreSigningAssets(assets, expected, now = /* @__PURE__ */ new Date()) {
177643
177678
  const teamId = expected.teamId ?? customerDistributionTeamId(assets);
177644
177679
  if (!teamId) {
177645
- const decoded3 = decodePkcs12(Buffer.from(assets.certificate), assets.certificatePassword);
177646
- return refuse2(decoded3?.certificate ? "customer_signing_identity_mismatch" : "customer_certificate_invalid");
177680
+ const decoded4 = decodePkcs12(Buffer.from(assets.certificate), assets.certificatePassword);
177681
+ return refuse2(decoded4?.certificate ? "customer_signing_identity_mismatch" : "customer_certificate_invalid");
177647
177682
  }
177648
177683
  const stored = profileEntitlements(assets.provisioningProfile);
177649
177684
  const devices = stored.profile.ProvisionedDevices;
@@ -177651,9 +177686,9 @@ function inspectCustomerAppStoreSigningAssets(assets, expected, now = /* @__PURE
177651
177686
  return refuse2("customer_profile_not_app_store");
177652
177687
  }
177653
177688
  const identity = { bundleId: expected.bundleId, teamId };
177654
- const decoded2 = decodeCustomerSigningAssets(assets, identity, now);
177655
- const apns = apnsEnvironment(decoded2.entitlements, false);
177656
- return toBundle(assets, identity, decoded2, "APP_STORE", apns, 0);
177689
+ const decoded3 = decodeCustomerSigningAssets(assets, identity, now);
177690
+ const apns = apnsEnvironment(decoded3.entitlements, false);
177691
+ return toBundle(assets, identity, decoded3, "APP_STORE", apns, 0);
177657
177692
  }
177658
177693
  var sha2564, refuse2;
177659
177694
  var init_customer_signing_assets = __esm({
@@ -180193,7 +180228,9 @@ __export(template_adopt_exports, {
180193
180228
  leadingEmptySlot: () => leadingEmptySlot,
180194
180229
  matrixMarkdown: () => matrixMarkdown,
180195
180230
  moduleEvaluationCalls: () => moduleEvaluationCalls,
180231
+ moduleEvaluationParses: () => moduleEvaluationParses,
180196
180232
  primaryNodeIds: () => primaryNodeIds,
180233
+ readAppEntrySources: () => readAppEntrySources,
180197
180234
  readAppSources: () => readAppSources,
180198
180235
  removeScreens: () => removeScreens,
180199
180236
  replaceScreen: () => replaceScreen,
@@ -180210,12 +180247,16 @@ __export(template_adopt_exports, {
180210
180247
  import { existsSync as existsSync55, lstatSync as lstatSync19, mkdirSync as mkdirSync27, readdirSync as readdirSync31, readFileSync as readFileSync59, renameSync as renameSync11, statSync as statSync18, writeFileSync as writeFileSync23 } from "node:fs";
180211
180248
  import { dirname as dirname33, join as join48, posix as posix2, relative as relative13 } from "node:path";
180212
180249
  import ts10 from "typescript";
180213
- function readAppSources(dir) {
180250
+ function readAppEntrySources(dir) {
180214
180251
  const devPath = join48(dir, "dev", "index.ts");
180215
180252
  const configPath = join48(dir, "config.ts");
180216
180253
  if (!existsSync55(devPath) || !existsSync55(configPath)) {
180217
180254
  throw new TrimRefusal(`no dev/index.ts + config.ts under ${dir} \u2014 run this in (or point --content at) an app \`himi init --template\` scaffolded`);
180218
180255
  }
180256
+ return { dev: readFileSync59(devPath, "utf8"), config: readFileSync59(configPath, "utf8") };
180257
+ }
180258
+ function readAppSources(dir) {
180259
+ const { dev, config } = readAppEntrySources(dir);
180219
180260
  const workers = /* @__PURE__ */ new Map();
180220
180261
  const root = join48(dir, "tier5-src");
180221
180262
  if (existsSync55(root)) {
@@ -180236,10 +180277,24 @@ function readAppSources(dir) {
180236
180277
  workers.set(name, files);
180237
180278
  }
180238
180279
  }
180239
- return { dev: readFileSync59(devPath, "utf8"), config: readFileSync59(configPath, "utf8"), workers };
180280
+ return { dev, config, workers };
180240
180281
  }
180241
180282
  function moduleEvaluationCalls(text32, fileName = "worker.ts") {
180242
- const source2 = ts10.createSourceFile(fileName, text32, ts10.ScriptTarget.Latest, false, /\.[cm]?tsx$|\.jsx$/.test(fileName) ? ts10.ScriptKind.TSX : ts10.ScriptKind.TS);
180283
+ const kind = /\.[cm]?tsx$|\.jsx$/.test(fileName) ? ts10.ScriptKind.TSX : ts10.ScriptKind.TS;
180284
+ const key4 = `${kind}\0${text32}`;
180285
+ const cached3 = moduleCallsCache.get(key4);
180286
+ if (cached3) return [...cached3];
180287
+ const calls = parseModuleEvaluationCalls(text32, fileName, kind);
180288
+ if (moduleCallsCache.size >= MODULE_CALLS_CACHE_MAX) moduleCallsCache.delete(moduleCallsCache.keys().next().value);
180289
+ moduleCallsCache.set(key4, calls);
180290
+ return [...calls];
180291
+ }
180292
+ function moduleEvaluationParses() {
180293
+ return moduleCallParses;
180294
+ }
180295
+ function parseModuleEvaluationCalls(text32, fileName, kind) {
180296
+ moduleCallParses += 1;
180297
+ const source2 = ts10.createSourceFile(fileName, text32, ts10.ScriptTarget.Latest, false, kind);
180243
180298
  const out2 = [];
180244
180299
  const label4 = (callee) => {
180245
180300
  let e2 = callee;
@@ -180589,7 +180644,7 @@ function findRoute(app2, id) {
180589
180644
  return app2.routes.find((r3) => r3.label === id);
180590
180645
  }
180591
180646
  function replaceScreen(dir, id, entry) {
180592
- const src = readAppSources(dir);
180647
+ const src = readAppEntrySources(dir);
180593
180648
  const app2 = parseApp(src.dev, src.config);
180594
180649
  const r3 = findRoute(app2, id);
180595
180650
  if (!r3) throw new TrimRefusal(`no screen "${id}" in dev/index.ts \u2014 \`himi template screens\` lists the ids`);
@@ -180907,7 +180962,7 @@ function droppedPrimaryTaps(dropped, primaryIds = /* @__PURE__ */ new Set()) {
180907
180962
  }
180908
180963
  return [...out2.values()];
180909
180964
  }
180910
- var ADOPT_FILE, JOURNEY_STUB_FILE, ADOPT_MATRIX_FILE, WIX_MODULE, SDK_MODULE, LOCAL_ONLY_SDK, RELATIVE_IMPORT, PURE_CALLS, BUILTIN_CONSTRUCTORS, reaches, UI_VERB, DESTRUCTIVE_VERB, PAYMENT_VERB, WRITE_VERB, ABORT_DIALOG, DESTRUCTIVE_ANYWHERE, VIEW_STATE, COMMIT_TRIGGER, PLACEHOLDER, SAMPLE_COPY, IGNORED, SUBMIT, INPUT_TYPES, LIST_HOSTS;
180965
+ var ADOPT_FILE, JOURNEY_STUB_FILE, ADOPT_MATRIX_FILE, WIX_MODULE, SDK_MODULE, LOCAL_ONLY_SDK, RELATIVE_IMPORT, PURE_CALLS, BUILTIN_CONSTRUCTORS, moduleCallsCache, MODULE_CALLS_CACHE_MAX, moduleCallParses, reaches, UI_VERB, DESTRUCTIVE_VERB, PAYMENT_VERB, WRITE_VERB, ABORT_DIALOG, DESTRUCTIVE_ANYWHERE, VIEW_STATE, COMMIT_TRIGGER, PLACEHOLDER, SAMPLE_COPY, IGNORED, SUBMIT, INPUT_TYPES, LIST_HOSTS;
180911
180966
  var init_template_adopt = __esm({
180912
180967
  "src/template-adopt.ts"() {
180913
180968
  init_define_HHP_CATALOG();
@@ -180945,6 +181000,9 @@ var init_template_adopt = __esm({
180945
181000
  RELATIVE_IMPORT = /(?:from|import)\s*\(?\s*["'](\.{1,2}\/[^"']+)["']/g;
180946
181001
  PURE_CALLS = /* @__PURE__ */ new Set(["defineService"]);
180947
181002
  BUILTIN_CONSTRUCTORS = /* @__PURE__ */ new Set(["Set", "Map", "WeakMap", "WeakSet", "Date", "Error", "TypeError", "RangeError", "URL", "URLSearchParams", "RegExp", "Array", "Object", "TextEncoder", "TextDecoder", "AbortController", "Uint8Array", "ArrayBuffer", "Intl.NumberFormat", "Intl.DateTimeFormat", "Intl.Collator", "Intl.PluralRules", "Intl.RelativeTimeFormat", "Intl.Segmenter", "Intl.ListFormat"]);
181003
+ moduleCallsCache = /* @__PURE__ */ new Map();
181004
+ MODULE_CALLS_CACHE_MAX = 4096;
181005
+ moduleCallParses = 0;
180948
181006
  reaches = (r3) => !!r3 && (r3.wixModules.length > 0 || r3.rawWixApi || r3.fetch || r3.unresolvedImports.length > 0);
180949
181007
  UI_VERB = /^(?:change|select|search|filter|sort|toggle|open|close|show|hide|expand|collapse|refresh|reload|load|retry|next|prev|previous|page|go|nav|navigate|tab|focus|blur|scroll|dismiss|clear[A-Z]?\w*(?:Filter|Search|Query)|set\w*(?:Filter|Tab|Query|Sort|Draft|Mode|View|Page))/;
180950
181008
  DESTRUCTIVE_VERB = /^(?:delete|remove|cancel|archive|refund|void|unpublish|revoke|block|ban|deactivate|disable|reject|leave|unfollow|unsubscribe|destroy|purge|wipe)/i;
@@ -213329,8 +213387,7 @@ function provisionChatTarget(dir, memberChat, dryRun = false) {
213329
213387
  if (!dryRun) {
213330
213388
  if (config.fixed) writeFileSync46(join104(dir, "config.ts"), config.fixed, "utf8");
213331
213389
  for (const id of screens) {
213332
- const route = parseApp(readAppSources(dir).dev, readAppSources(dir).config).routes.find((r3) => r3.kind === "screen" && r3.label === id);
213333
- const descriptor = parseEntry(readAppSources(dir).dev.slice(route.lineStart, route.end), id);
213390
+ const descriptor = readEntry(dir, id);
213334
213391
  reopenAsInbox(descriptor);
213335
213392
  replaceScreen(dir, id, screenEntry(id, descriptor));
213336
213393
  }
@@ -213380,11 +213437,21 @@ function provisionAppName(dir, displayName3, dryRun = false) {
213380
213437
  return { status: "set", from: correction.current, to: displayName3.trim() };
213381
213438
  }
213382
213439
  function readEntry(dir, screenId) {
213383
- const sources = readAppSources(dir);
213384
- const app2 = parseApp(sources.dev, sources.config);
213385
- const route = app2.routes.find((r3) => r3.label === screenId && r3.kind === "screen");
213386
- if (!route) return void 0;
213387
- return parseEntry(sources.dev.slice(route.lineStart, route.end), screenId);
213440
+ const { dev, config } = readAppEntrySources(dir);
213441
+ const span = screenSpans(dev, config).get(screenId);
213442
+ if (!span) return void 0;
213443
+ return parseEntry(dev.slice(span[0], span[1]), screenId);
213444
+ }
213445
+ function screenSpans(dev, config) {
213446
+ const key4 = `${config}\0${dev}`;
213447
+ const known2 = spansByText.get(key4);
213448
+ if (known2) return known2;
213449
+ spanParses += 1;
213450
+ const spans = /* @__PURE__ */ new Map();
213451
+ for (const r3 of parseApp(dev, config).routes) if (r3.kind === "screen" && !spans.has(r3.label)) spans.set(r3.label, [r3.lineStart, r3.end]);
213452
+ if (spansByText.size >= 4) spansByText.delete(spansByText.keys().next().value);
213453
+ spansByText.set(key4, spans);
213454
+ return spans;
213388
213455
  }
213389
213456
  function parseEntry(entryText2, screenId) {
213390
213457
  try {
@@ -213541,7 +213608,7 @@ async function runOneAppProvision(args, io2) {
213541
213608
  return report3(io2, false, { code: "content_invalid", error: error instanceof Error ? error.message : String(error) });
213542
213609
  }
213543
213610
  }
213544
- var obj20, PROVISION_USAGE, PROVISIONED_PARAMS, propName8, propOf, GUID2, BUSINESS_CHAT_SCREEN2, INBOX_DOOR_SCREENS, NAME_SLOTS;
213611
+ var obj20, PROVISION_USAGE, PROVISIONED_PARAMS, propName8, propOf, GUID2, BUSINESS_CHAT_SCREEN2, INBOX_DOOR_SCREENS, NAME_SLOTS, spansByText, spanParses;
213545
213612
  var init_provision = __esm({
213546
213613
  "src/one-app/provision.ts"() {
213547
213614
  init_define_HHP_CATALOG();
@@ -213576,6 +213643,8 @@ var init_provision = __esm({
213576
213643
  BUSINESS_CHAT_SCREEN2 = "himi_business_chat";
213577
213644
  INBOX_DOOR_SCREENS = ["himi_account", "himi_chat_thread"];
213578
213645
  NAME_SLOTS = /* @__PURE__ */ new Set([...DISPLAY_KEYS, "title", "text", "displayName"]);
213646
+ spansByText = /* @__PURE__ */ new Map();
213647
+ spanParses = 0;
213579
213648
  }
213580
213649
  });
213581
213650
 
@@ -215973,7 +216042,7 @@ function createFunctionDataCapability(options2) {
215973
216042
  });
215974
216043
  return encoded3;
215975
216044
  };
215976
- const decode = (result) => {
216045
+ const decode2 = (result) => {
215977
216046
  if (!result || typeof result !== "object") return result;
215978
216047
  const output = structuredClone(result);
215979
216048
  const decodeItem2 = (item2) => {
@@ -215988,15 +216057,15 @@ function createFunctionDataCapability(options2) {
215988
216057
  return output;
215989
216058
  };
215990
216059
  return Object.freeze({
215991
- query: async (query = {}) => decode(await options2.wix.call("POST", "/wix-data/v2/items/query", { dataCollectionId: id, query: encodeQuery(query) })),
216060
+ query: async (query = {}) => decode2(await options2.wix.call("POST", "/wix-data/v2/items/query", { dataCollectionId: id, query: encodeQuery(query) })),
215992
216061
  insert: async (item2) => {
215993
216062
  if (readOnly) throw new Error(`adopted collection "${id}" is read-only`);
215994
- return decode(await options2.wix.call("POST", "/wix-data/v2/items", { dataCollectionId: id, dataItem: { data: encode2(item2) } }));
216063
+ return decode2(await options2.wix.call("POST", "/wix-data/v2/items", { dataCollectionId: id, dataItem: { data: encode2(item2) } }));
215995
216064
  },
215996
216065
  update: async (itemId3, item2) => {
215997
216066
  if (readOnly) throw new Error(`adopted collection "${id}" is read-only`);
215998
216067
  if (!itemId3) throw new Error("item id is required");
215999
- return decode(await options2.wix.call("PUT", `/wix-data/v2/items/${encodeURIComponent(itemId3)}`, { dataCollectionId: id, dataItem: { id: itemId3, data: encode2(item2) } }));
216068
+ return decode2(await options2.wix.call("PUT", `/wix-data/v2/items/${encodeURIComponent(itemId3)}`, { dataCollectionId: id, dataItem: { id: itemId3, data: encode2(item2) } }));
216000
216069
  }
216001
216070
  });
216002
216071
  }
@@ -216032,14 +216101,14 @@ function routeMatch(template, actual) {
216032
216101
  for (let i2 = 0; i2 < expected.length; i2++) {
216033
216102
  const left = expected[i2];
216034
216103
  const right = received[i2];
216035
- let decoded2;
216104
+ let decoded3;
216036
216105
  try {
216037
- decoded2 = decodeURIComponent(right);
216106
+ decoded3 = decodeURIComponent(right);
216038
216107
  } catch {
216039
216108
  return null;
216040
216109
  }
216041
- if (left.startsWith(":")) params[left.slice(1)] = decoded2;
216042
- else if (left !== decoded2) return null;
216110
+ if (left.startsWith(":")) params[left.slice(1)] = decoded3;
216111
+ else if (left !== decoded3) return null;
216043
216112
  }
216044
216113
  return params;
216045
216114
  }
@@ -251101,8 +251170,8 @@ function codeFromRow(row2) {
251101
251170
  return plain5;
251102
251171
  if (!row2.attributedBody?.length)
251103
251172
  return void 0;
251104
- const decoded2 = decodeTypedstreamString(row2.attributedBody);
251105
- return decoded2 && extractAppleCode(decoded2) || extractAppleCode(row2.attributedBody.toString("utf8").replace(/�/g, " "));
251173
+ const decoded3 = decodeTypedstreamString(row2.attributedBody);
251174
+ return decoded3 && extractAppleCode(decoded3) || extractAppleCode(row2.attributedBody.toString("utf8").replace(/�/g, " "));
251106
251175
  }
251107
251176
  function selectAppleCode(rows, cutoffMs) {
251108
251177
  const sorted3 = [...rows].sort((a3, b3) => messagesDateToMs(b3.date) - messagesDateToMs(a3.date) || (b3.rowId > a3.rowId ? 1 : b3.rowId < a3.rowId ? -1 : 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1960.0",
3
+ "version": "0.1961.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": "e632d8b51a5e1a846c30337b85ce4bc0effff49f85daf8aba8024a1b"
85
+ "falconPackageHash": "3dc7e1a57a31bc14c60f06a7554814f23a51182b9c07ccb96a878554"
86
86
  }