@ultimat3/pwa 18.0.0 → 19.1.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/CLAUDE.md +2 -2
- package/README.md +7 -4
- package/package.json +3 -3
- package/src/service-worker.ts +7 -5
package/CLAUDE.md
CHANGED
|
@@ -12,8 +12,8 @@ Tier 4. May import tiers 0–3: `core`, `schema`, `i18n`, `money`, `time`, `cach
|
|
|
12
12
|
| `sw.js` | generated, never hand-written, never committed. No file in this package is a SW. |
|
|
13
13
|
| Determinism | no `Date.now()`, no randomness, sort every collection. Same input → same bytes. `subscriptionState` took `now = Date.now()` and was the one exception; it takes a `Clock` `As of 2026-08-23`, so a frozen clock freezes this package too. |
|
|
14
14
|
| Rule ORDER | most specific first, then the path. `ruleFor` in the emitted worker returns the FIRST pattern that matches and has no notion of specificity, so the sort IS the routing decision. Alphabetical, `:` (0x3A) and `*` (0x2A) sort before every letter: `/posts/:id` shadowed `/posts/new`, and one `/*` catch-all shadowed the whole table — every `PRECACHE_MANIFEST` entry downloaded at install and never looked up, and a cacheable route served `network-only`, which offline is the `/offline` document. Weights are `@ultimat3/render`'s `compilePattern` (literal 100, `:param` 10, `*` 1), **duplicated** because both packages are tier 4; a wildcard sorts last outright, because a sum over segments cannot say that `/` (0 segments) outranks `/*rest` (1). The shared home is `@ultimat3/core`'s `route-vocabulary.ts`. |
|
|
15
|
-
| A generated header | names something that regenerates the file. `sw.js`
|
|
16
|
-
| What is WIRED, and what is not | `generateWebManifest`, `renderThemeColorMeta`, `planIcons`, `appleTouchLinks` and `BuiltinImagePipeline`
|
|
15
|
+
| A generated header | names something that regenerates the file. `sw.js` says `regenerate: x build`, and `As of 2026-08` a build really writes it (#390); it named the CALL for as long as none did. |
|
|
16
|
+
| What is WIRED, and what is not | **every generator here has a caller, `As of 2026-08`.** `generateWebManifest`, `renderThemeColorMeta`, `planIcons`, `appleTouchLinks` and `BuiltinImagePipeline` through `pwa-artifacts.ts` / `dev-assets.ts` (#362); `generateServiceWorker` — and with it `buildPrecacheManifest`, `offlineFallbackSource`, `backgroundSyncSource` and `pushSource` — through `sw-artifacts.ts` (#390). So `x dev`, the container and the static export emit `manifest.webmanifest`, `sw.js` and `x-sw-register.js` alike. The worker half landed a release later because a bad `sw.js` is sticky: it waited on a real browser check (`packages/cli/e2e/service-worker.e2e.test.ts`), which nothing in the gate could run until #400. **`pwa.push` is the one capability still unwired** — the generator emits a push handler only when a VAPID key comes with it and there is no `pwa.vapid` config key, so `x build` reports it as a `serviceWorkerWarnings` entry rather than dropping it in silence. |
|
|
17
17
|
| Route input | `PwaRoute` is a **structural** view of render's `RouteDescriptor`. Never import render. |
|
|
18
18
|
| Strategy choice | derived from render mode via `MODE_STRATEGY`. Per-route override only. |
|
|
19
19
|
| Precache revision | content hash. Never the build id — that re-downloads everything per deploy. |
|
package/README.md
CHANGED
|
@@ -109,10 +109,13 @@ capability nothing implements.
|
|
|
109
109
|
- **`WebManifestInput` is not the `pwa` block of `app.config.ts`.** It was called `PwaConfig` and
|
|
110
110
|
said it was, while `@ultimat3/core` exported a different type of that name that really is the
|
|
111
111
|
block. An app writes `name` and `colors`; every other member is a caller's.
|
|
112
|
-
- **The service worker
|
|
113
|
-
`buildPrecacheManifest`, `offlineFallbackSource`, `backgroundSyncSource` and
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
- **The service worker has a build behind it, `As of 2026-08`.** `generateServiceWorker` — and
|
|
113
|
+
through it `buildPrecacheManifest`, `offlineFallbackSource`, `backgroundSyncSource` and
|
|
114
|
+
`pushSource` — is called by `packages/cli/src/sw-artifacts.ts`, so `x dev`, the container and the
|
|
115
|
+
static export all emit `sw.js` and `x-sw-register.js`
|
|
116
|
+
([#390](https://github.com/developerz-ai/ultimate/issues/390)). It landed a release after the
|
|
117
|
+
manifest half because a bad `sw.js` is sticky: it waited on a real browser check
|
|
118
|
+
(`packages/cli/e2e/service-worker.e2e.test.ts`), which the tree could not run until #400.
|
|
116
119
|
- **Precache revisions are content hashes, never the build id.** Keying on the build id
|
|
117
120
|
re-downloads every asset on every deploy.
|
|
118
121
|
- **The mutation queue lives in `@ultimat3/realtime`, not here** (SRP). This package owns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/pwa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"description": "Generated service worker, web manifest, icons, push and version-skew handling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ultimat3/core": "
|
|
35
|
-
"@ultimat3/seo": "
|
|
34
|
+
"@ultimat3/core": "19.1.0",
|
|
35
|
+
"@ultimat3/seo": "19.1.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/service-worker.ts
CHANGED
|
@@ -227,13 +227,15 @@ export function generateServiceWorker(
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
function header(buildId: string): string {
|
|
230
|
-
// `
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
//
|
|
230
|
+
// `x build`, `As of 2026-08-27`, and it took until then to become true. This said
|
|
231
|
+
// `generateServiceWorker(routes, config, buildId) from @ultimat3/pwa` — the CALL rather than a
|
|
232
|
+
// command — because nothing in the tree called it: `x build` emitted no service worker, so the
|
|
233
|
+
// line would have sent whoever found this file in a diff to a command that left it exactly as
|
|
234
|
+
// they found it. `packages/cli/src/sw-artifacts.ts` is the caller now (#390), and `x build`
|
|
235
|
+
// regenerates this file the way the comment always meant to say.
|
|
234
236
|
return `// GENERATED by @ultimat3/pwa from the route table — do not edit.
|
|
235
237
|
// build: ${buildId}
|
|
236
|
-
// regenerate:
|
|
238
|
+
// regenerate: x build`;
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
function constants(
|