@ultimat3/pwa 31.39.0 → 31.40.1
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/CLAUDE.md +1 -1
- package/package.json +6 -6
- package/src/route-rules.ts +4 -20
package/CLAUDE.md
CHANGED
|
@@ -26,7 +26,7 @@ role's boot loads, `@ultimat3/mcp/schema`'s shape; `serve-graph.test.ts` exempts
|
|
|
26
26
|
| Worker update | `self.skipWaiting()` in `install`, `As of 22.3.2` — worker-side, because the browsers that must converge run a 22.3.1 worker and register script that never post `skip-waiting`. Safe for an open tab: the worker routes no chunk. Never a reload — the next navigation is fresh. The `skip-waiting` message stays. |
|
|
27
27
|
| Navigation preload | enabled on `activate`; every emitted strategy reaches the network through `net(req,pre)` (`NETWORK_SOURCE`), never a bare `fetch`, so a navigation is answered by `event.preloadResponse`. The preload carries no build id: `seenBuild` reads skew off the ANSWER. `fromNetwork` is the exported mirror. `service-worker-preload.test.ts` executes it. |
|
|
28
28
|
| Install fill | `PRECACHE_CONCURRENCY` (4) in flight, never `Promise.all` over the manifest: it runs on the first visit against the connection the first click needs. Still one entry per failure. An answer stamped with another build's core `BUILD_ID_HEADER` is not stored (an old pod mid-rollout); an unstamped one is. |
|
|
29
|
-
| Rule patterns | built from the DECODED route path, matched against the PERCENT-ENCODED `url.pathname`: a literal segment
|
|
29
|
+
| Rule patterns | built from the DECODED route path, matched against the PERCENT-ENCODED `url.pathname`: a literal segment is `@ultimat3/core`'s `literalSegmentPattern` — render's compiler too, never a local one. Raw or escaped, either hex case, so `/a\|b` owns `canonicalPath`'s `/a%7Cb` (the WHATWG-serializer copy here missed it until 31.40). A catch-all is `(?:/.*)?`, so `/docs/*path` owns `/docs`. `route-rules.test.ts`; the e2e drives both in Chrome. |
|
|
30
30
|
| Runtime assets | `ServiceWorkerConfig.runtimeAssets` prefixes (`/islands/`) are `cache-first` runtime rules AHEAD of every page rule (`assetRules`, `route-rules.ts`), and go to the network as the browser asked — no build-id header, because a classic script is a `no-cors` request whose headers a worker may not extend. The precache names only what a precached page boots (the CLI chooses: `sw-precache-plan.ts`); all 43 islands (~1 MB) were precached on a first anonymous visit until 22.3.3. |
|
|
31
31
|
| Precached assets | answered from the precache AHEAD of every rule (`precached-asset-source.ts`): first when revision = url, else network first. No rule read them before, `As of 2026-11`: offline documents rendered unstyled. |
|
|
32
32
|
| Pages cache | ≤ `PAGES_CACHE_MAX` (50) documents per cache, oldest written evicted (`putPage`). |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/pwa",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.40.1",
|
|
4
4
|
"description": "Generated service worker, web manifest, icons, push and version-skew handling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"test": "bun test"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ultimat3/action": "31.
|
|
49
|
-
"@ultimat3/core": "31.
|
|
50
|
-
"@ultimat3/i18n": "31.
|
|
51
|
-
"@ultimat3/policy": "31.
|
|
52
|
-
"@ultimat3/schema": "31.
|
|
48
|
+
"@ultimat3/action": "31.40.1",
|
|
49
|
+
"@ultimat3/core": "31.40.1",
|
|
50
|
+
"@ultimat3/i18n": "31.40.1",
|
|
51
|
+
"@ultimat3/policy": "31.40.1",
|
|
52
|
+
"@ultimat3/schema": "31.40.1"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/route-rules.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* that are no route: content-addressed chunks, cached the first time a page asks for one.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { routeRank } from '@ultimat3/core';
|
|
7
|
+
import { literalSegmentPattern, routeRank } from '@ultimat3/core';
|
|
8
8
|
import { SwScopeInvalidError } from './errors';
|
|
9
9
|
import type { PersonalPages } from './pages-cache-source';
|
|
10
10
|
import type { PwaRoute, StrategyName } from './strategies';
|
|
@@ -78,28 +78,12 @@ function cacheFor(route: PwaRoute, strategy: StrategyName): 'precache' | 'runtim
|
|
|
78
78
|
|
|
79
79
|
const escapeRegex = (text: string): string => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
80
80
|
|
|
81
|
-
/**
|
|
82
|
-
* A literal segment as the browser's `url.pathname` spells it — the WHATWG serializer itself, so a
|
|
83
|
-
* route path (the DECODED directory name) matches the PERCENT-ENCODED pathname `ruleFor` tests:
|
|
84
|
-
* `/precios-españa` and `/a b` were never handled. Not `encodeURI`, which also escapes `|`, `[`,
|
|
85
|
-
* `^` and `%` where a browser leaves them literal. A `%XX` escape matches either hex case, as a
|
|
86
|
-
* hand-typed link may carry one.
|
|
87
|
-
*/
|
|
88
|
-
function literal(segment: string): string {
|
|
89
|
-
const url = new URL('https://x.invalid/');
|
|
90
|
-
url.pathname = `/${segment}`;
|
|
91
|
-
return escapeRegex(url.pathname.slice(1)).replace(
|
|
92
|
-
/%([0-9A-Fa-f]{2})/g,
|
|
93
|
-
(_, hex: string) =>
|
|
94
|
-
`%${[...hex].map((c) => (/[A-Fa-f]/.test(c) ? `[${c.toUpperCase()}${c.toLowerCase()}]` : c)).join('')}`,
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
81
|
/**
|
|
99
82
|
* A trailing slash is dropped before the pattern is built, because the pattern allows one anyway:
|
|
100
83
|
* a locale's home is spelled `/en/`, and `^/en//?$` matched `/en/` and missed `/en`. A catch-all
|
|
101
84
|
* takes its leading slash with it, `(?:/.*)?`, so `/docs/*path` matches the bare `/docs` that
|
|
102
|
-
* `@ultimat3/render`'s static export writes for an empty `path`.
|
|
85
|
+
* `@ultimat3/render`'s static export writes for an empty `path`. A literal segment is core's
|
|
86
|
+
* `literalSegmentPattern` — the request router's spellings, the same regex `compilePattern` builds.
|
|
103
87
|
*/
|
|
104
88
|
function toPattern(path: string): string {
|
|
105
89
|
const segments = segmentsOf(path);
|
|
@@ -108,7 +92,7 @@ function toPattern(path: string): string {
|
|
|
108
92
|
.map((segment) => {
|
|
109
93
|
if (segment.startsWith(':')) return '/[^/]+';
|
|
110
94
|
if (segment.startsWith('*')) return '(?:/.*)?';
|
|
111
|
-
return `/${
|
|
95
|
+
return `/${literalSegmentPattern(segment)}`;
|
|
112
96
|
})
|
|
113
97
|
.join('');
|
|
114
98
|
return `^${body}/?$`;
|