@wix/himalaya-cli 0.1369.0 → 0.1370.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.
@@ -11,6 +11,9 @@ export interface WixCachePolicy {
11
11
  rules: WixCacheRule[];
12
12
  defaultCacheable: boolean;
13
13
  }
14
+ /** The path a rule's prefix names: itself, or the path of an absolute `https://host/path` prefix
15
+ * (an account-level read a worker makes to a full Wix URL) — so the platform denies apply to it. */
16
+ export declare function rulePath(pathPrefix: string): string;
14
17
  export declare function clampRule(rule: WixCacheRule, denyPrefixes: string[], maxTTL: number): WixCacheRule;
15
18
  /** What an app declares in `defineApp({ cache })`. */
16
19
  export type DeclaredWixCache = AppCacheConfig;
@@ -652,11 +652,15 @@ export interface AndroidAssetLinks {
652
652
  packageName: string;
653
653
  sha256CertFingerprints: string[];
654
654
  }
655
+ /** An absolute cache-rule prefix: `https://` + a Wix host + a path (`https://apps.wix.com/…`). */
656
+ export declare function isWixAbsoluteCachePrefix(prefix: string): boolean;
655
657
  /** Per-endpoint cache intent declared by an app. */
656
658
  export interface AppCacheRule {
657
659
  /** HTTP method this rule applies to. Omit for any method. */
658
660
  method?: string;
659
- /** Path prefix, e.g. "/stores/v3/products/". Matched by prefix. */
661
+ /** Path prefix, e.g. "/stores/v3/products/". Matched by prefix. A call a worker makes to an
662
+ * absolute Wix URL (an account-level read such as `https://apps.wix.com/…`) is matched by an
663
+ * absolute prefix instead: `https://` + a Wix host (`*.wix.com`, `*.wixapis.com`) + a path. */
660
664
  pathPrefix: string;
661
665
  cacheable: boolean;
662
666
  /** Fresh window, seconds. */
@@ -7272,6 +7272,12 @@ function validateNames(kind, names) {
7272
7272
  }
7273
7273
 
7274
7274
  // ../../core/ts/src/define-app.ts
7275
+ function isWixAbsoluteCachePrefix(prefix) {
7276
+ const m = /^https:\/\/([a-z0-9.-]+)(\/.*)$/i.exec(prefix);
7277
+ if (!m) return false;
7278
+ const host = m[1].toLowerCase();
7279
+ return host === "wix.com" || host.endsWith(".wix.com") || host === "wixapis.com" || host.endsWith(".wixapis.com");
7280
+ }
7275
7281
  var ALL_ORIENTATIONS = [
7276
7282
  "portrait",
7277
7283
  "portraitUpsideDown",
@@ -7630,8 +7636,8 @@ function validateConfigShape(config) {
7630
7636
  }
7631
7637
  if (config.cache) {
7632
7638
  for (const r of config.cache.rules ?? []) {
7633
- if (!r.pathPrefix || !r.pathPrefix.startsWith("/")) {
7634
- throw new Error(`defineApp: cache rule pathPrefix must start with "/". Got "${r.pathPrefix}".`);
7639
+ if (!r.pathPrefix || !(r.pathPrefix.startsWith("/") || isWixAbsoluteCachePrefix(r.pathPrefix))) {
7640
+ throw new Error(`defineApp: cache rule pathPrefix must start with "/" or be an https:// Wix URL (*.wix.com, *.wixapis.com). Got "${r.pathPrefix}".`);
7635
7641
  }
7636
7642
  if (r.ttl < 0 || (r.swr ?? 0) < 0) {
7637
7643
  throw new Error(`defineApp: cache rule ttl/swr must be non-negative (pathPrefix "${r.pathPrefix}").`);
@@ -13851,6 +13857,7 @@ export {
13851
13857
  isValidStreamPolicy,
13852
13858
  isViewTarget,
13853
13859
  isWidgetFamilySurface,
13860
+ isWixAbsoluteCachePrefix,
13854
13861
  layoutDirection,
13855
13862
  mergeIdiomOverlay,
13856
13863
  mergeSiteMenu,
package/dist/cli.mjs CHANGED
@@ -28688,8 +28688,17 @@ var init_wix_cache_defaults_generated = __esm({
28688
28688
  });
28689
28689
 
28690
28690
  // ../../core/dev-server/src/wix-cache-policy.ts
28691
+ function rulePath(pathPrefix) {
28692
+ const m2 = /^https?:\/\/[^/]+(\/.*)?$/i.exec(pathPrefix);
28693
+ return m2 ? m2[1] ?? "/" : pathPrefix;
28694
+ }
28695
+ function originOf(pathPrefix) {
28696
+ const m2 = /^(https?:\/\/[^/]+)/i.exec(pathPrefix);
28697
+ return m2 ? m2[1] : null;
28698
+ }
28691
28699
  function clampRule(rule, denyPrefixes, maxTTL) {
28692
- const denied2 = denyPrefixes.some((p2) => rule.pathPrefix.startsWith(p2));
28700
+ const path2 = rulePath(rule.pathPrefix);
28701
+ const denied2 = denyPrefixes.some((p2) => path2.startsWith(p2));
28693
28702
  return {
28694
28703
  ...rule,
28695
28704
  cacheable: rule.cacheable && !denied2,
@@ -28712,10 +28721,11 @@ function resolveWixCachePolicy(appName2, declared) {
28712
28721
  const legacy = CACHE_OVERRIDES[appName2] ?? [];
28713
28722
  const appLevel = [...own4, ...legacy];
28714
28723
  const defaults = declared?.platformDefaults === false ? [] : PLATFORM_DEFAULT_WIX_CACHE_RULES.filter((d2) => !appLevel.some((a2) => shadows(a2, d2)));
28715
- const denies = [
28716
- ...[...PLATFORM_DENY_PREFIXES, ...PERSONAL_DATA_PREFIXES].map((pathPrefix) => ({ method: null, pathPrefix, cacheable: false, ttl: 0, swr: 0, tag: null })),
28717
- ...PERSONAL_DATA_READS.map(([method, pathPrefix]) => ({ method, pathPrefix, cacheable: false, ttl: 0, swr: 0, tag: null }))
28718
- ];
28724
+ const origins = ["", ...new Set(appLevel.map((r2) => originOf(r2.pathPrefix)).filter((o2) => !!o2))];
28725
+ const denies = origins.flatMap((origin) => [
28726
+ ...[...PLATFORM_DENY_PREFIXES, ...PERSONAL_DATA_PREFIXES].map((p2) => ({ method: null, pathPrefix: origin + p2, cacheable: false, ttl: 0, swr: 0, tag: null })),
28727
+ ...PERSONAL_DATA_READS.map(([method, p2]) => ({ method, pathPrefix: origin + p2, cacheable: false, ttl: 0, swr: 0, tag: null }))
28728
+ ]);
28719
28729
  const rules = [...appLevel, ...defaults, ...denies].map((r2) => clampRule(r2, PLATFORM_DENY_PREFIXES, PLATFORM_MAX_TTL));
28720
28730
  return { rules, defaultCacheable: declared?.defaultCacheable ?? false };
28721
28731
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1369.0",
3
+ "version": "0.1370.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": [
@@ -71,5 +71,5 @@
71
71
  "artifactId": "himalaya-cli"
72
72
  }
73
73
  },
74
- "falconPackageHash": "fd3751d6f6d280437ca5e65dad0bcfc33119ae43eff7ee5ad3523d30"
74
+ "falconPackageHash": "378ec395c9fdaf3d52c7d6691d160b1d0f6f55614c524da29cf1a2cd"
75
75
  }