@wix/himalaya-cli 0.827.0 → 0.829.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
@@ -25258,7 +25258,6 @@ function shouldRevealError(args) {
25258
25258
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
25259
25259
  var init_validation = __esm({
25260
25260
  "../../core/ts/src/validation.ts"() {
25261
- "use strict";
25262
25261
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
25263
25262
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
25264
25263
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -28646,7 +28645,6 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
28646
28645
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
28647
28646
  var init_worker_subtree = __esm({
28648
28647
  "../../core/ts/src/worker-subtree.ts"() {
28649
- "use strict";
28650
28648
  init_worker_subtree_safe_types_generated();
28651
28649
  WORKER_SUBTREE_CEILINGS = Object.freeze({
28652
28650
  maxEncodedBytes: 65536,
@@ -35840,11 +35838,20 @@ function readBuiltBundleMap(tier5Root, bundleName) {
35840
35838
  const p = resolve26(tier5Root, `${bundleName}.bundle.js.map`);
35841
35839
  return existsSync32(p) ? readFileSync37(p, "utf8") : void 0;
35842
35840
  }
35843
- function nativeSourceFiles(directory, extension) {
35841
+ function nativeSourceFiles(directory, extension, buildDirMaxDepth, depth = 1) {
35844
35842
  if (!existsSync32(directory)) return [];
35845
- return readdirSync17(directory, { withFileTypes: true }).flatMap((entry) => {
35843
+ let entries;
35844
+ try {
35845
+ entries = readdirSync17(directory, { withFileTypes: true });
35846
+ } catch (err) {
35847
+ if (!vanished(err)) throw err;
35848
+ return [];
35849
+ }
35850
+ return entries.flatMap((entry) => {
35851
+ if (NATIVE_SCRATCH_DIRS.has(entry.name)) return [];
35852
+ if (entry.name === BUILD_OUTPUT_DIR && depth <= buildDirMaxDepth) return [];
35846
35853
  const path = resolve26(directory, entry.name);
35847
- if (entry.isDirectory()) return nativeSourceFiles(path, extension);
35854
+ if (entry.isDirectory()) return nativeSourceFiles(path, extension, buildDirMaxDepth, depth + 1);
35848
35855
  return entry.name.endsWith(extension) ? [path] : [];
35849
35856
  });
35850
35857
  }
@@ -35853,14 +35860,23 @@ function registeredActions(source) {
35853
35860
  }
35854
35861
  function discoverNativeActions(appDir2) {
35855
35862
  const roots = NATIVE_SOURCE_ROOTS.filter(({ directory }) => existsSync32(resolve26(appDir2, directory)));
35856
- const sources = roots.flatMap(({ directory, extension }) => nativeSourceFiles(resolve26(appDir2, directory), extension));
35857
- const registered = sources.flatMap((source) => registeredActions(readFileSync37(source, "utf8")));
35863
+ const sources = roots.flatMap(({ directory, extension, buildDirMaxDepth }) => nativeSourceFiles(resolve26(appDir2, directory), extension, buildDirMaxDepth));
35864
+ const registered = sources.flatMap((source) => {
35865
+ let text2;
35866
+ try {
35867
+ text2 = readFileSync37(source, "utf8");
35868
+ } catch (err) {
35869
+ if (!vanished(err)) throw err;
35870
+ return [];
35871
+ }
35872
+ return registeredActions(text2);
35873
+ });
35858
35874
  return {
35859
35875
  registered: new Set(registered),
35860
35876
  searched: roots.map(({ searched }) => searched)
35861
35877
  };
35862
35878
  }
35863
- var nodeVmEvaluator, navContractMemo, NATIVE_SOURCE_ROOTS;
35879
+ var nodeVmEvaluator, navContractMemo, NATIVE_SCRATCH_DIRS, BUILD_OUTPUT_DIR, VANISHED, vanished, NATIVE_SOURCE_ROOTS;
35864
35880
  var init_validate_descriptor = __esm({
35865
35881
  "../../core/dev-server/src/validate-descriptor.ts"() {
35866
35882
  init_validate_descriptor_core();
@@ -35872,10 +35888,25 @@ var init_validate_descriptor = __esm({
35872
35888
  };
35873
35889
  setDefaultEvaluator(nodeVmEvaluator);
35874
35890
  navContractMemo = null;
35891
+ NATIVE_SCRATCH_DIRS = /* @__PURE__ */ new Set([
35892
+ ".build",
35893
+ "build-sim",
35894
+ "build-device",
35895
+ "build-mac",
35896
+ "SourcePackages",
35897
+ "DerivedData",
35898
+ ".swiftpm",
35899
+ "Pods",
35900
+ "node_modules",
35901
+ ".gradle"
35902
+ ]);
35903
+ BUILD_OUTPUT_DIR = "build";
35904
+ VANISHED = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR", "ELOOP"]);
35905
+ vanished = (err) => VANISHED.has(err?.code ?? "");
35875
35906
  NATIVE_SOURCE_ROOTS = [
35876
- { directory: "ios", extension: ".swift", searched: "ios/**/*.swift" },
35877
- { directory: "android", extension: ".kt", searched: "android/**/*.kt" },
35878
- { directory: "macos", extension: ".swift", searched: "macos/**/*.swift" }
35907
+ { directory: "ios", extension: ".swift", searched: "ios/**/*.swift", buildDirMaxDepth: 1 },
35908
+ { directory: "android", extension: ".kt", searched: "android/**/*.kt", buildDirMaxDepth: 2 },
35909
+ { directory: "macos", extension: ".swift", searched: "macos/**/*.swift", buildDirMaxDepth: 1 }
35879
35910
  ];
35880
35911
  }
35881
35912
  });
@@ -39250,6 +39281,7 @@ __export(build_exports2, {
39250
39281
  gitSha: () => gitSha,
39251
39282
  isMonorepoCheckout: () => isMonorepoCheckout,
39252
39283
  l10nLintOptions: () => l10nLintOptions,
39284
+ linkableScreenIdsFrom: () => linkableScreenIdsFrom,
39253
39285
  listBuildableApps: () => listBuildableApps,
39254
39286
  maximumBinaryVersion: () => maximumBinaryVersion,
39255
39287
  navLogicBundleUrl: () => navLogicBundleUrl,
@@ -39464,6 +39496,21 @@ async function withStoreNavBundle(text2, address) {
39464
39496
  }
39465
39497
  return JSON.stringify(cfg);
39466
39498
  }
39499
+ function linkableScreenIdsFrom(text2) {
39500
+ let cfg;
39501
+ try {
39502
+ cfg = JSON.parse(text2);
39503
+ } catch {
39504
+ return [];
39505
+ }
39506
+ const ids = /* @__PURE__ */ new Set();
39507
+ for (const list of [cfg?.linkableScreens, cfg?.navigation?.linkableScreens]) {
39508
+ for (const s of Array.isArray(list) ? list : []) {
39509
+ if (typeof s?.screenId === "string" && s.screenId) ids.add(s.screenId);
39510
+ }
39511
+ }
39512
+ return [...ids];
39513
+ }
39467
39514
  function withProdServeAppConfig(text2, prod) {
39468
39515
  if (!prod?.serve) return text2;
39469
39516
  let cfg;
@@ -40027,15 +40074,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
40027
40074
  });
40028
40075
  await store.putAppConfig(app, text2);
40029
40076
  appConfigHash = sha2564(text2);
40030
- if (collect?.descriptors) {
40031
- try {
40032
- const cfg = JSON.parse(text2);
40033
- for (const s of cfg.navigation?.linkableScreens ?? []) {
40034
- if (typeof s?.screenId === "string" && s.screenId) linkable.add(s.screenId);
40035
- }
40036
- } catch {
40037
- }
40038
- }
40077
+ if (collect?.descriptors) for (const id of linkableScreenIdsFrom(text2)) linkable.add(id);
40039
40078
  }
40040
40079
  const ahRes = await devFetch(`${base}/v1/action-handlers/${encodeURIComponent(app)}`, { headers: { "X-Himalaya-App": app } });
40041
40080
  if (ahRes.ok) {
@@ -51765,6 +51804,13 @@ async function analyzeSite(input, ports) {
51765
51804
  bookingsCategories: bookingsCats,
51766
51805
  menuSections: probes.find((p) => p.vertical === "restaurants")?.items.map((m) => ({ id: m.id, name: m.title })) ?? [],
51767
51806
  cms,
51807
+ // The same three facts the warnings below report, recorded in the BOOK as well. The
51808
+ // warnings are transient stdout; `docs/wix-site-to-himi-app.md` sends the next agent to
51809
+ // `book.json` / `book.md`, where `cms: []` alone reads as "this site has no collections"
51810
+ // (#2484). Mirrors `permissions.memberRolesStatus`, which carries the same distinction.
51811
+ cmsStatus: cmsRead.status,
51812
+ ...cmsRead.errorStatus ? { cmsErrorStatus: cmsRead.errorStatus } : {},
51813
+ ...cmsRead.truncated ? { cmsTruncated: cmsRead.truncated } : {},
51768
51814
  pageRoles: pageRolesOf(look, siteUrl),
51769
51815
  topics: topicsFrom(probes),
51770
51816
  installedApps: mergeApps(installedApps, published.appDefIds),
@@ -52035,6 +52081,32 @@ function cmsLabel(c) {
52035
52081
  const roles = [c.readRole && `read=${c.readRole}`, c.writeRole && `write=${c.writeRole}`].filter(Boolean);
52036
52082
  return roles.length ? `${name} [${roles.join(" ")}]` : name;
52037
52083
  }
52084
+ function cmsStatusNote(taxonomy) {
52085
+ const bits = [];
52086
+ switch (taxonomy.cmsStatus) {
52087
+ case "ok":
52088
+ bits.push("ok");
52089
+ break;
52090
+ case "empty":
52091
+ bits.push("empty: the site reported no data collections");
52092
+ break;
52093
+ case "skipped":
52094
+ bits.push("skipped: no owner token \u2014 re-run with `--site <msid>` (owner auth) to list the site's collections");
52095
+ break;
52096
+ case "error": {
52097
+ const http = taxonomy.cmsErrorStatus;
52098
+ const remedy = http === 429 ? "the site rate-limited the listing \u2014 wait and re-run" : http != null && http >= 500 ? "Wix Data failed upstream \u2014 retry later, and investigate the service if it persists" : http === 401 || http === 403 ? "check the owner token is current and carries the Wix Data read permission, then re-run" : "check the owner token and the `--site <msid>` you passed, then re-run";
52099
+ bits.push(`error${http ? ` HTTP ${http}` : ""}: the listing call failed \u2014 ${remedy}`);
52100
+ break;
52101
+ }
52102
+ default:
52103
+ break;
52104
+ }
52105
+ if (taxonomy.cmsTruncated) {
52106
+ bits.push(`${taxonomy.cmsTruncated} more not read \u2014 the listing stops at ${CMS_LIST_LIMIT}`);
52107
+ }
52108
+ return bits.length ? ` (${bits.join("; ")})` : "";
52109
+ }
52038
52110
  function yn(v) {
52039
52111
  return v == null || v === "" ? "\u2014" : String(v);
52040
52112
  }
@@ -52231,7 +52303,7 @@ function renderBookMarkdown(book) {
52231
52303
  lines.push(`- bookings categories: ${taxonomy.bookingsCategories.map((c) => c.name).join(", ") || "\u2014"}`);
52232
52304
  lines.push(`- blog categories: ${taxonomy.blogCategories.map((c) => c.name).join(", ") || "\u2014"}`);
52233
52305
  lines.push(`- menu sections: ${taxonomy.menuSections.map((c) => c.name).join(", ") || "\u2014"}`);
52234
- lines.push(`- cms collections: ${taxonomy.cms.map(cmsLabel).join(", ") || "\u2014"}`);
52306
+ lines.push(`- cms collections: ${taxonomy.cms.map(cmsLabel).join(", ") || "\u2014"}${cmsStatusNote(taxonomy)}`);
52235
52307
  if (taxonomy.installedApps.length) lines.push(`- installed apps: ${taxonomy.installedApps.map((a) => a.name ?? a.id).join(", ")}`);
52236
52308
  lines.push(`- member roles: ${taxonomy.memberRoles.join(", ") || "\u2014"}`);
52237
52309
  if (taxonomy.faviconUrl) lines.push(`- favicon: ${taxonomy.faviconUrl}`);
@@ -52325,6 +52397,7 @@ var AUTH_ONLY_ASCII, EVIDENCE_ROW_WITH, EVIDENCE_ROW_WITHOUT, EVIDENCE_ROW_GATED
52325
52397
  var init_book = __esm({
52326
52398
  "src/site-analyze/book.ts"() {
52327
52399
  init_permissions();
52400
+ init_probes();
52328
52401
  AUTH_ONLY_ASCII = /^(sign[ -]?up|sign[ -]?in|log[ -]?in|login|register|create (an )?account|members? area)$/i;
52329
52402
  EVIDENCE_ROW_WITH = "; **`pages/*.png` \u2014 full-page screenshots of the real site**";
52330
52403
  EVIDENCE_ROW_WITHOUT = "; `pages/` is EMPTY (no screenshots were captured)";
@@ -156,9 +156,16 @@ in-repo `prepare:customer` path — never Amit1 `provisioning.json`, but also
156
156
  not your new app.
157
157
 
158
158
  ```sh
159
- himi site analyze --client-id … --url … --out .himi/business-book --apply --content .
159
+ himi site analyze --client-id … --url … --site <msid> --out .himi/business-book --apply --content .
160
160
  ```
161
161
 
162
+ Keep `--site <msid>` here, exactly as in step 1. It is what mints the **owner** token, and
163
+ `--apply` without one ships `cmsCollections: []` — collections are *enumerated* with an owner
164
+ token (`GET /data/v2/collections` wants *Manage Data Collections*; a visitor token can read the
165
+ items of an `ANYONE`-read collection but cannot list it), so a tokenless run never looks. The
166
+ book says which happened on the `cms collections:` line (`(skipped: no owner token …)`).
167
+ The `clientId`-is-the-binding rule above is about the **app's** runtime site binding, not this.
168
+
162
169
  `--apply` writes `provisioning.json` + token **values**, and patches the branded-lite
163
170
  home `onAppear` params (`ownerDefaultLayout`, `brandAccent`, `verticals`) in
164
171
  `dev/index.ts`. It does **not** rewrite `config.ts` tabBar — you still set 2–4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.827.0",
3
+ "version": "0.829.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": [
@@ -63,5 +63,5 @@
63
63
  "artifactId": "himalaya-cli"
64
64
  }
65
65
  },
66
- "falconPackageHash": "1f67eedd183563d5753b32ea4eb82f8764a58881413ef36f01f8324c"
66
+ "falconPackageHash": "63e3ba88b71ed4fdd866382d1faf9a8e341668daab48feb0c1be4584"
67
67
  }