@ultimat3/render 22.3.1 → 22.3.3

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/package.json +6 -6
  2. package/src/registry.ts +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/render",
3
- "version": "22.3.1",
3
+ "version": "22.3.3",
4
4
  "description": "The route primitive and the five render modes: static, isr, ssr, stream, spa.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,11 +36,11 @@
36
36
  "test": "bun test"
37
37
  },
38
38
  "dependencies": {
39
- "@ultimat3/cache": "22.3.1",
40
- "@ultimat3/core": "22.3.1",
41
- "@ultimat3/http": "22.3.1",
42
- "@ultimat3/i18n": "22.3.1",
43
- "@ultimat3/seo": "22.3.1",
39
+ "@ultimat3/cache": "22.3.3",
40
+ "@ultimat3/core": "22.3.3",
41
+ "@ultimat3/http": "22.3.3",
42
+ "@ultimat3/i18n": "22.3.3",
43
+ "@ultimat3/seo": "22.3.3",
44
44
  "sass": "1.104.0"
45
45
  }
46
46
  }
package/src/registry.ts CHANGED
@@ -68,7 +68,19 @@ export interface RouteDescriptor {
68
68
  readonly prerenderable: boolean;
69
69
  readonly dynamic: boolean;
70
70
  readonly hasPolicy: boolean;
71
+ /**
72
+ * The document is rendered FOR someone: a `policy`, a `stream` (always `private, no-store`), or a
73
+ * declared `cache` of `no-store` / `private`. `sw.js` never caches one (`@ultimat3/pwa`'s
74
+ * `strategyFor`): a per-member page kept for offline answered the previous member's data on a
75
+ * shared device after sign-out.
76
+ */
77
+ readonly personal: boolean;
71
78
  readonly islands: readonly string[];
79
+ /**
80
+ * Each island's `src`, relative to `file`, in `islands` order — what the island bundle resolves
81
+ * to a chunk URL, so `sw.js` precaches only the chunks a precached page boots.
82
+ */
83
+ readonly islandSources: readonly string[];
72
84
  readonly budgetJs: string | null;
73
85
  readonly budgetLcp: number | null;
74
86
  }
@@ -361,12 +373,22 @@ function buildDescriptors(): RouteDescriptor[] {
361
373
  prerenderable: entry.config.prerender !== undefined,
362
374
  dynamic: entry.pattern.keys.length > 0,
363
375
  hasPolicy: entry.config.policy !== undefined,
376
+ personal: isPersonal(entry.config),
364
377
  islands: entry.islands,
378
+ islandSources: entry.config.islands.map((spec) => spec.src),
365
379
  budgetJs: entry.config.budget.js ?? null,
366
380
  budgetLcp: entry.config.budget.lcp ?? null,
367
381
  }));
368
382
  }
369
383
 
384
+ /** See `RouteDescriptor.personal`. */
385
+ function isPersonal(config: RouteConfig): boolean {
386
+ if (config.policy !== undefined || config.render === 'stream') return true;
387
+ const cache = config.cache;
388
+ if (cache === undefined) return false;
389
+ return cache === 'no-store' || cache.mode === 'no-store' || cache.mode === 'private';
390
+ }
391
+
370
392
  /**
371
393
  * `undefined` for a malformed percent-escape. A pathname is whatever the client typed, and
372
394
  * `decodeURIComponent('%zz')` throws a bare `URIError` — no code, no fix line — where a router