@alxia/react-router 0.17.0 → 0.19.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/README.md +45 -1
- package/dist/chunks/index-3jfeew2y.js.map +1 -1
- package/dist/chunks/index-6jf7zpxz.js.map +1 -1
- package/dist/chunks/index-9xv2a8et.js.map +1 -1
- package/dist/chunks/{index-c3k47yw7.js → index-a45b1582.js} +7 -6
- package/dist/chunks/{index-c3k47yw7.js.map → index-a45b1582.js.map} +3 -3
- package/dist/chunks/index-kfekhvgr.js.map +1 -1
- package/dist/chunks/index-mscfme4r.js +12 -0
- package/dist/chunks/index-mscfme4r.js.map +10 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/entry/index.js.map +1 -1
- package/dist/errors/cross-site.d.ts +8 -0
- package/dist/errors/cross-site.d.ts.map +1 -0
- package/dist/errors/index.js +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/same-site.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pwa/index.js.map +1 -1
- package/dist/pwa/worker/index.js.map +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/index.js.map +1 -1
- package/dist/session/react/index.js +17 -6
- package/dist/session/react/index.js.map +3 -3
- package/dist/session/react/use-link-param.d.ts +12 -2
- package/dist/session/react/use-link-param.d.ts.map +1 -1
- package/dist/subscription/documents.d.ts +3 -0
- package/dist/subscription/documents.d.ts.map +1 -0
- package/dist/subscription/index.d.ts +7 -0
- package/dist/subscription/index.d.ts.map +1 -0
- package/dist/subscription/index.js +360 -0
- package/dist/subscription/index.js.map +14 -0
- package/dist/subscription/proxy.d.ts +40 -0
- package/dist/subscription/proxy.d.ts.map +1 -0
- package/dist/subscription/read.d.ts +17 -0
- package/dist/subscription/read.d.ts.map +1 -0
- package/dist/subscription/refusal.d.ts +11 -0
- package/dist/subscription/refusal.d.ts.map +1 -0
- package/dist/subscription/relay.d.ts +16 -0
- package/dist/subscription/relay.d.ts.map +1 -0
- package/dist/vite/index.js.map +1 -1
- package/docs/README.md +2 -1
- package/docs/guide/session.md +18 -1
- package/docs/guide/subscriptions.md +126 -0
- package/docs/roadmap.md +10 -2
- package/docs/troubleshooting.md +109 -0
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -983,6 +983,42 @@ on the form. `stepUpSteps` asks for a code before a sensitive action, and
|
|
|
983
983
|
[session guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide/session.md)
|
|
984
984
|
has a complete sign-in route and the rest.
|
|
985
985
|
|
|
986
|
+
## A GraphQL subscription for the browser
|
|
987
|
+
|
|
988
|
+
`@alxia/react-router/subscription` exposes subscriptions of your API to the
|
|
989
|
+
browser through a resource route, without giving it the token or a way to
|
|
990
|
+
write its own document. `allow` maps each operation name to the document the
|
|
991
|
+
server sends for it; the client names an operation and sends variables, and
|
|
992
|
+
its own `query` and `extensions` are ignored. The bearer comes from the
|
|
993
|
+
session, both methods refuse a cross-site request, a heartbeat keeps the
|
|
994
|
+
stream open, the browser leaving aborts the upstream request, and an upstream
|
|
995
|
+
429 is passed on with its `retryAfter`. It speaks GraphQL over SSE in distinct
|
|
996
|
+
connections mode, so `graphql-sse` works against it. It imports nothing and adds no peer.
|
|
997
|
+
|
|
998
|
+
```ts
|
|
999
|
+
// app/routes/events.ts
|
|
1000
|
+
import { createSubscriptionProxy } from '@alxia/react-router/subscription';
|
|
1001
|
+
import { print } from 'graphql';
|
|
1002
|
+
import { RoomEventsDocument } from '../generated/graphql';
|
|
1003
|
+
import { cookies } from '../session.server';
|
|
1004
|
+
|
|
1005
|
+
const events = createSubscriptionProxy({
|
|
1006
|
+
endpoint: 'https://api.example.com/graphql',
|
|
1007
|
+
allow: { RoomEvents: print(RoomEventsDocument) },
|
|
1008
|
+
getToken: (request) => cookies.token(request),
|
|
1009
|
+
headers: (request) => ({
|
|
1010
|
+
'x-forwarded-for': request.headers.get('x-forwarded-for'),
|
|
1011
|
+
'accept-language': request.headers.get('accept-language'),
|
|
1012
|
+
}),
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
export const loader = events.loader; // GET
|
|
1016
|
+
export const action = events.action; // POST
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
See the [subscription guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide/subscriptions.md)
|
|
1020
|
+
for the rules, the options and the errors.
|
|
1021
|
+
|
|
986
1022
|
## Traps
|
|
987
1023
|
|
|
988
1024
|
- **A context key made in `app/` reaches the loaders only through the
|
|
@@ -1144,7 +1180,7 @@ From `@alxia/react-router/session/react` (`react` and `react-router` are its onl
|
|
|
1144
1180
|
| --- | --- |
|
|
1145
1181
|
| `useSignOut({ action?, before? })` | `{ signOut, busy }`: posts `{}` as JSON to `action` (default `/sign-out`) after `before()`, whose failure never keeps the user signed in; `busy` until the navigation ends |
|
|
1146
1182
|
| `SIGN_OUT_PATH`, `SignOutOptions`, `signOutAfter(before, submit)` | `/sign-out`, the options, and the step `useSignOut` is built on |
|
|
1147
|
-
| `useLinkParam(name, { drop? }?)`, `LinkParamOptions` | a mail link's query parameter, read once (`null` when absent or empty); `drop: true` removes it from the address bar with `history.replaceState` |
|
|
1183
|
+
| `useLinkParam(name, { drop?, live? }?)`, `LinkParamOptions` | a mail link's query parameter, read once (`null` when absent or empty); `drop: true` removes it from the address bar with `history.replaceState`; `live: true` follows the URL, for a parameter a redirect adds to the same mounted route |
|
|
1148
1184
|
| `useCodeField(schema, refusal)`, `CodeField`, `CodeSchema` | a one-code field with no form library: `{ code, setCode, ref, error, check() }` over a synchronous Standard Schema; each new `refusal` object clears the refused code and focuses the input |
|
|
1149
1185
|
| `useOnRefusal(refusal, handler)` | the core under it, for any form library: `handler` runs once per new refusal, not for one present at mount |
|
|
1150
1186
|
|
|
@@ -1152,6 +1188,7 @@ From `@alxia/react-router/session/react` (`react` and `react-router` are its onl
|
|
|
1152
1188
|
import { useLinkParam, useSignOut } from '@alxia/react-router/session/react';
|
|
1153
1189
|
|
|
1154
1190
|
const token = useLinkParam('token', { drop: true });
|
|
1191
|
+
const linked = useLinkParam('state', { live: true }); // follows a redirect to this same route
|
|
1155
1192
|
const { signOut, busy } = useSignOut();
|
|
1156
1193
|
```
|
|
1157
1194
|
|
|
@@ -1186,6 +1223,12 @@ From `@alxia/react-router/entry`:
|
|
|
1186
1223
|
| `createEntry({ streamTimeout?, nonce?, isBot?, onError? })`, `EntryOptions`, `Entry` | `/entry`: `{ handleRequest, streamTimeout }` (`Entry`), `entry.server.tsx` for Bun on the web stream renderer |
|
|
1187
1224
|
| `handleRequest`, `streamTimeout`, `HandleRequest` | `/entry`: the default entry (`createEntry()`), its `5_000` and the type of `handleRequest` (assignable to React Router's `ServerEntryModule['default']`) |
|
|
1188
1225
|
|
|
1226
|
+
From `@alxia/react-router/subscription` (no import, no peer):
|
|
1227
|
+
|
|
1228
|
+
| export | |
|
|
1229
|
+
| --- | --- |
|
|
1230
|
+
| `createSubscriptionProxy({ endpoint, allow, getToken, headers?, origin?, heartbeatMs?, fetch? })`, `SubscriptionProxy`, `SubscriptionProxyOptions` | a resource route's `loader` (GET) and `action` (POST) relaying GraphQL subscriptions over SSE (graphql-sse's distinct connections mode). `allow` is `{ [operationName]: document }`: the proxy sends its own document, the client's `query` and `extensions` are ignored and an unknown name is a 403. Both methods refuse a cross-site request (403) and a POST that is not JSON (415); 401 without a token; 400 for a malformed or oversize request (body 64 KiB, query string and variables 16 KiB); the bearer and `headers` upstream, a heartbeat comment every `heartbeatMs` (15000), the upstream aborted with the client, a pulled relay with a 1 MiB cap per event, an upstream 429 passed on with `Retry-After` and `retryAfter`, 502 for an upstream failure |
|
|
1231
|
+
|
|
1189
1232
|
The `alxia-react-router` bin, run with `bunx`:
|
|
1190
1233
|
|
|
1191
1234
|
| command | |
|
|
@@ -1204,6 +1247,7 @@ The `alxia-react-router` bin, run with `bunx`:
|
|
|
1204
1247
|
- [Installable and offline](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide/pwa.md): what the subpaths hold, the worker's contract, the worker, what it caches, the offline page, building the worker with `alxia()` or `buildWorker`, the hooks in React, registering the worker and offering an update, serving the worker's script, the web app manifest, and clearing at sign-out.
|
|
1205
1248
|
- [An API's refusals](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide/errors.md): what `/errors` holds, recognising an API error, the request id, the page a request is for, the catalogue store, the form checks in the API's words, the provider, wording a refusal, loaders and the error page, actions, JSON actions and CSRF, and keeping the catalogue fresh.
|
|
1206
1249
|
- [A BFF session](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide/session.md): redirects that stay on the site, the cookies, the sign-in route, the second factor, the viewer and sign-out, the step-up, and the pages a mail's link opens.
|
|
1250
|
+
- [Subscriptions for a BFF](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide/subscriptions.md): exposing a GraphQL subscription to the browser through a resource route: the allow-list, the session's bearer, the headers, the heartbeat, abort and rate limits.
|
|
1207
1251
|
- [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/troubleshooting.md): each message, and the traps that print none.
|
|
1208
1252
|
- [Roadmap](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/roadmap.md): what is coming, and what is not planned.
|
|
1209
1253
|
- [Example](https://github.com/softistx/alxia/tree/develop/examples/react-router): the official template, these four changes, then an `app/server.ts` with a session, an `/api`, secure headers with a nonce and a streamed page.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"import type { StepUpVia } from './second-factor';\nimport type {\n\tStepUpConfirmAnswer,\n\tStepUpError,\n\tStepUpRequestAnswer,\n} from './step-up-answers';\n\n/** Where a step-up is. */\nexport type StepUpPhase =\n\t| 'idle'\n\t| 'requesting'\n\t| 'code'\n\t| 'confirming'\n\t| 'done';\n\nexport interface StepUpState {\n\treadonly phase: StepUpPhase;\n\t/** How the challenge held (or the last one) is confirmed. */\n\treadonly via?: StepUpVia | undefined;\n\t/** The challenge held. A secret: never in a URL, a log or loader data. */\n\treadonly challenge?: string | undefined;\n\t/** The tries the last refused code left. */\n\treadonly attemptsLeft?: number | undefined;\n\t/** No try left on an app or recovery code: wait, asking again would fail too. */\n\treadonly locked: boolean;\n\treadonly error?: StepUpError | undefined;\n\t/** The last refusal worded for the page, until the next step or the release. */\n\treadonly message?: string | undefined;\n\t/** The seconds a throttled request asks to wait before asking again. */\n\treadonly retryAfter?: number | undefined;\n\t/** A request or a code is in flight. */\n\treadonly pending: boolean;\n\t/** The last request replaced a challenge that was held. */\n\treadonly resent: boolean;\n}\n\nexport type StepUpAction =\n\t| { readonly type: 'start' }\n\t| { readonly type: 'requested'; readonly answer: StepUpRequestAnswer }\n\t| { readonly type: 'submit' }\n\t| { readonly type: 'confirmed'; readonly answer: StepUpConfirmAnswer }\n\t| { readonly type: 'release' };\n\nexport const INITIAL_STEP_UP: StepUpState = {\n\tphase: 'idle',\n\tlocked: false,\n\tpending: false,\n\tresent: false,\n};\n\nfunction requested(\n\tstate: StepUpState,\n\tanswer: StepUpRequestAnswer,\n): StepUpState {\n\tif (!answer.ok) {\n\t\t// A resend refused leaves the code form up, and says why in it.\n\t\treturn {\n\t\t\t...state,\n\t\t\tphase: state.challenge ? 'code' : 'idle',\n\t\t\terror: answer.error,\n\t\t\tmessage: answer.message,\n\t\t\tretryAfter: answer.retryAfter,\n\t\t\tpending: false,\n\t\t\tresent: false,\n\t\t};\n\t}\n\treturn {\n\t\tphase: 'code',\n\t\tvia: answer.via,\n\t\tchallenge: answer.challenge,\n\t\tlocked: false,\n\t\tpending: false,\n\t\tresent: state.challenge !== undefined,\n\t};\n}\n\n/** A refused code. At 0 tries left a mailed code is over (ask again), an app or recovery code is locked (wait). */\nfunction refused(\n\tstate: StepUpState,\n\tanswer: Extract<StepUpConfirmAnswer, { ok: false }>,\n): StepUpState {\n\tconst none = answer.attemptsLeft === 0;\n\tconst over = answer.error === 'expired' || (none && state.via === 'email');\n\tif (over) {\n\t\treturn {\n\t\t\tphase: 'idle',\n\t\t\t...(state.via ? { via: state.via } : {}),\n\t\t\tlocked: false,\n\t\t\terror: 'expired',\n\t\t\tmessage: answer.message,\n\t\t\tpending: false,\n\t\t\tresent: false,\n\t\t};\n\t}\n\tif (answer.error === 'throttled') {\n\t\t// Asking too often spends nothing: the challenge and its tries stay.\n\t\treturn {\n\t\t\t...state,\n\t\t\tphase: 'code',\n\t\t\terror: 'throttled',\n\t\t\tmessage: answer.message,\n\t\t\tretryAfter: answer.retryAfter,\n\t\t\tpending: false,\n\t\t\tresent: false,\n\t\t};\n\t}\n\treturn {\n\t\t...state,\n\t\tphase: 'code',\n\t\terror: answer.error,\n\t\tmessage: answer.message,\n\t\tretryAfter: undefined,\n\t\tattemptsLeft: answer.attemptsLeft,\n\t\tlocked: answer.locked || none,\n\t\tpending: false,\n\t\tresent: false,\n\t};\n}\n\n/**\n * The step-up's transitions, pure. `start` (a request in flight) forgets the\n * last error but keeps a challenge held, so a refused \"Resend code\" leaves\n * the code form up; a refusal keeps its `message` (and a throttle its\n * `retryAfter`) until the next step; a granted request replaces the challenge; a code accepted\n * spends it; an expired or spent one leaves \"ask again\"; at 0 tries left a\n * mailed code is `expired` and an app or recovery code is `locked`.\n */\nexport function stepUpReducer(\n\tstate: StepUpState,\n\taction: StepUpAction,\n): StepUpState {\n\tswitch (action.type) {\n\t\tcase 'start':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tphase: state.challenge ? 'code' : 'requesting',\n\t\t\t\terror: undefined,\n\t\t\t\tmessage: undefined,\n\t\t\t\tretryAfter: undefined,\n\t\t\t\tpending: true,\n\t\t\t\tresent: false,\n\t\t\t};\n\t\tcase 'requested':\n\t\t\treturn requested(state, action.answer);\n\t\tcase 'submit':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tphase: 'confirming',\n\t\t\t\terror: undefined,\n\t\t\t\tmessage: undefined,\n\t\t\t\tretryAfter: undefined,\n\t\t\t\tpending: true,\n\t\t\t};\n\t\tcase 'confirmed':\n\t\t\treturn action.answer.ok\n\t\t\t\t? {\n\t\t\t\t\t\tphase: 'done',\n\t\t\t\t\t\t...(state.via ? { via: state.via } : {}),\n\t\t\t\t\t\tlocked: false,\n\t\t\t\t\t\tpending: false,\n\t\t\t\t\t\tresent: false,\n\t\t\t\t\t}\n\t\t\t\t: refused(state, action.answer);\n\t\tcase 'release':\n\t\t\treturn INITIAL_STEP_UP;\n\t}\n}\n",
|
|
10
10
|
"import type { StepUpVia } from './second-factor';\nimport type { StepUpState } from './step-up';\nimport type { StepUpError } from './step-up-answers';\n\n/**\n * The props of `@nxgt/material`'s `VerificationCode` and `StepUpDialog` that\n * the state decides. The state's `message` is not one: the dialog words its\n * own texts from `error`, `attemptsLeft`, `locked` and `retryAfter`. The callbacks (`onSubmit`, `onResend`) are the app's.\n */\nexport interface StepUpProps {\n\treadonly via?: StepUpVia;\n\treadonly attemptsLeft?: number;\n\treadonly locked: boolean;\n\treadonly error?: StepUpError;\n\t/** The seconds to wait when `error` is `throttled` and the API said how long. */\n\treadonly retryAfter?: number;\n\treadonly pending: boolean;\n\treadonly resent: boolean;\n}\n\n/** The state as the dialog's props: `{ ...stepUpProps(state), onSubmit, onResend }`. */\nexport function stepUpProps(state: StepUpState): StepUpProps {\n\treturn {\n\t\t...(state.via ? { via: state.via } : {}),\n\t\t...(state.attemptsLeft === undefined\n\t\t\t? {}\n\t\t\t: { attemptsLeft: state.attemptsLeft }),\n\t\tlocked: state.locked,\n\t\t...(state.error ? { error: state.error } : {}),\n\t\t...(state.retryAfter === undefined ? {} : { retryAfter: state.retryAfter }),\n\t\tpending: state.pending,\n\t\tresent: state.resent,\n\t};\n}\n"
|
|
11
11
|
],
|
|
12
|
-
"mappings": ";AACO,IAAM,QAAO;AAGpB,IAAM,OAAO;AAaN,SAAS,SAAQ,CAAC,OAA0C;AAAA,EAClE,IAAI,CAAC,SAAS,MAAM,SAAS;AAAA,IAAM,OAAO;AAAA,EAC1C,IAAI,CAAC,MAAM,WAAW,GAAG,KAAK,MAAM,WAAW,IAAI;AAAA,IAAG,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AAQ;AAAA,MACT,IACC,QAAQ,OAAO,OAAO,MAAM;AAAA,IAChC,KAAK;AAAA,MACJ,OAAO;AAAA;AAAA;;AC/IH,SAAS,YAAW,CAAC,OAAiC;AAAA,EAC5D,OAAO;AAAA,OACF,MAAM,MAAM,EAAE,KAAK,MAAM,IAAI,IAAI,CAAC;AAAA,OAClC,MAAM,iBAAiB,YACxB,CAAC,IACD,EAAE,cAAc,MAAM,aAAa;AAAA,IACtC,QAAQ,MAAM;AAAA,OACV,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;AAAA,OACxC,MAAM,eAAe,YAAY,CAAC,IAAI,EAAE,YAAY,MAAM,WAAW;AAAA,IACzE,SAAS,MAAM;AAAA,IACf,QAAQ,MAAM;AAAA,EACf;AAAA;",
|
|
13
13
|
"debugId": "E77CC5BBAAF44F7C64756E2164756E21",
|
|
14
14
|
"names": []
|
|
15
15
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"import { existsSync } from 'node:fs';\nimport { readdir, readFile, stat } from 'node:fs/promises';\nimport { basename, dirname, join, resolve, sep } from 'node:path';\nimport type { PrecacheEntry } from '../model/precache-list';\nimport {\n\tOFFLINE_URL,\n\tSERVICE_WORKER_URL,\n\ttype WorkerContract,\n} from '../model/worker-contract';\nimport { PRECACHE_DEFINE } from '../worker/injected';\nimport { browserManifestFile, revisionOf, workerPrecache } from './precache';\n\nexport interface BuildWorkerOptions {\n\t/**\n\t * The worker's source, relative to `root`: `app/service-worker.ts`. Named\n\t * `file`, not `entry`: `reveal` reads `alxia({ entry })`.\n\t */\n\tfile: string;\n\t/** `process.cwd()` by default. */\n\troot?: string;\n\t/** The client build, relative to `root`: `build/client` by default. */\n\tclient?: string;\n\t/** Where the worker is written and which offline page is precached. */\n\tcontract?: Pick<WorkerContract, 'serviceWorkerUrl' | 'offlineUrl'>;\n\t/** Precache the offline page, which must then exist. `true` by default. */\n\toffline?: boolean;\n\t/** More files of `assets/` to precache, such as fonts: the app's regex. */\n\tprecacheAssets?: RegExp;\n\t/** `true` by default. */\n\tminify?: boolean;\n}\n\nexport interface WorkerBuild {\n\t/** The absolute path of the worker written. */\n\tfile: string;\n\tprecache: PrecacheEntry[];\n\t/** The precached files' size, before compression. */\n\tprecacheBytes: number;\n\t/** The worker's own size. */\n\tbytes: number;\n}\n\n/** Not `requireBun` of `vite/`: `/pwa/build` imports Node's built-ins only. */\nexport function assertBun(\n\tonBun = (globalThis as { Bun?: unknown }).Bun !== undefined,\n): void {\n\tif (onBun) return;\n\tthrow new Error(\n\t\t'buildWorker() runs on Bun: it is running on Node. Run it with bun, or run react-router build with bun --bun.',\n\t);\n}\n\n/**\n * The file a root-relative URL names inside `client`. It fails closed: a URL\n * that is absolute, protocol-relative, not rooted at `/`, or that resolves to\n * `client` itself or outside it, is refused.\n */\nfunction urlInClient(client: string, url: string): string {\n\tconst path = join(client, url);\n\tif (\n\t\t!url.startsWith('/') ||\n\t\t/^[a-z][a-z0-9+.-]*:|^\\/\\//i.test(url) ||\n\t\t!path.startsWith(client + sep) ||\n\t\tpath.endsWith(sep)\n\t) {\n\t\tthrow new Error(`buildWorker(): ${url} is outside ${client}.`);\n\t}\n\treturn path;\n}\n\n/**\n * Bundles the worker (Workbox included) into the client build, after\n * `react-router build`, with the precache list written in: the offline page\n * by its content, every route's code and `precacheAssets`. A new build\n * changes the list, so the worker's bytes, so the browser installs it.\n * Runs on Bun; the only imports of this module are Node's built-ins.\n */\nexport async function buildWorker(\n\toptions: BuildWorkerOptions,\n): Promise<WorkerBuild> {\n\tassertBun();\n\tconst root = resolve(options.root ?? process.cwd());\n\tconst client = resolve(root, options.client ?? 'build/client');\n\tconst source = resolve(root, options.file);\n\tconst workerUrl = options.contract?.serviceWorkerUrl ?? SERVICE_WORKER_URL;\n\tconst offlineUrl = options.contract?.offlineUrl ?? OFFLINE_URL;\n\tif (!existsSync(source)) {\n\t\tthrow new Error(`buildWorker(): ${options.file} does not exist.`);\n\t}\n\tconst assets = join(client, 'assets');\n\tconst files = await readdir(assets).catch(() => []);\n\tconst manifest = browserManifestFile(files);\n\tlet offline: PrecacheEntry | undefined;\n\tif (options.offline !== false) {\n\t\tconst page = urlInClient(client, offlineUrl);\n\t\tif (!existsSync(page)) {\n\t\t\tthrow new Error(\n\t\t\t\t`buildWorker(): ${options.client ?? 'build/client'}${offlineUrl} does not exist. Add public${offlineUrl}, or pass offline: false (\\`worker: { offline: false }\\` in alxia()), or pass the app's contract (\\`worker: { contract }\\` in alxia()).`,\n\t\t\t);\n\t\t}\n\t\toffline = { url: offlineUrl, revision: revisionOf(await readFile(page)) };\n\t}\n\tconst precache = workerPrecache({\n\t\tmanifestSource: await readFile(join(assets, manifest), 'utf8'),\n\t\tassetFiles: files,\n\t\toffline,\n\t\tinclude: options.precacheAssets,\n\t});\n\tconst out = urlInClient(client, workerUrl);\n\tconst result = await Bun.build({\n\t\tentrypoints: [source],\n\t\toutdir: dirname(out),\n\t\tnaming: basename(out),\n\t\ttarget: 'browser',\n\t\tformat: 'iife',\n\t\tminify: options.minify ?? true,\n\t\tdefine: {\n\t\t\t// Workbox's production build: no logging, no dev assertions.\n\t\t\t'process.env.NODE_ENV': '\"production\"',\n\t\t\t[PRECACHE_DEFINE]: JSON.stringify(precache),\n\t\t},\n\t}).catch((error: unknown) => {\n\t\tconst detail =\n\t\t\terror instanceof AggregateError\n\t\t\t\t? error.errors.map(String).join('\\n')\n\t\t\t\t: String(error);\n\t\tthrow new Error(`buildWorker(): Bun.build failed:\\n${detail}`);\n\t});\n\tif (!result.success) {\n\t\tthrow new Error(\n\t\t\t`buildWorker(): Bun.build failed:\\n${result.logs.map(String).join('\\n')}`,\n\t\t);\n\t}\n\tlet precacheBytes = 0;\n\tfor (const { url } of precache) {\n\t\tprecacheBytes += (await stat(join(client, url))).size;\n\t}\n\treturn {\n\t\tfile: out,\n\t\tprecache,\n\t\tprecacheBytes,\n\t\tbytes: (await stat(out)).size,\n\t};\n}\n",
|
|
6
6
|
"import { createHash } from 'node:crypto';\nimport {\n\tassetPrecache,\n\ttype PrecacheEntry,\n\tparseBrowserManifest,\n\tprecacheList,\n} from '../model/precache-list';\n\n/** The one React Router browser manifest among the names in build/client/assets. */\nexport function browserManifestFile(files: readonly string[]): string {\n\tconst found = files.filter((file) => /^manifest-[\\w-]+\\.js$/.test(file));\n\tconst [only] = found;\n\tif (found.length !== 1 || only === undefined) {\n\t\tthrow new Error(\n\t\t\t`buildWorker(): expected one React Router browser manifest, build/client/assets/manifest-*.js, found ${found.length}. Run react-router build first.`,\n\t\t);\n\t}\n\treturn only;\n}\n\n/** A file's revision: the first 16 hex characters of its sha256. */\nexport function revisionOf(bytes: Uint8Array): string {\n\treturn createHash('sha256').update(bytes).digest('hex').slice(0, 16);\n}\n\n/**\n * The worker's precache list: the offline page (revisioned by its content),\n * every route's code, then the asset files `include` matches. Each URL once,\n * the first kept.\n */\nexport function workerPrecache(input: {\n\tmanifestSource: string;\n\tassetFiles: readonly string[];\n\toffline?: PrecacheEntry | undefined;\n\tinclude?: RegExp | undefined;\n}): PrecacheEntry[] {\n\tconst all = [\n\t\t...(input.offline ? [input.offline] : []),\n\t\t...precacheList(parseBrowserManifest(input.manifestSource)),\n\t\t...(input.include ? assetPrecache(input.assetFiles, input.include) : []),\n\t];\n\tconst seen = new Set<string>();\n\treturn all.filter(({ url }) => !seen.has(url) && seen.add(url));\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AACA;AACA;;;ACFA;AASO,SAAS,mBAAmB,CAAC,OAAkC;AAAA,EACrE,MAAM,QAAQ,MAAM,OAAO,CAAC,SAAS,wBAAwB,KAAK,IAAI,CAAC;AAAA,EACvE,OAAO,QAAQ;AAAA,EACf,IAAI,MAAM,WAAW,KAAK,SAAS,WAAW;AAAA,IAC7C,MAAM,IAAI,MACT,uGAAuG,MAAM,uCAC9G;AAAA,EACD;AAAA,EACA,OAAO;AAAA;AAID,SAAS,UAAU,CAAC,OAA2B;AA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AAAA,CAAI,IAClC,OAAO,KAAK;AAAA,IAChB,MAAM,IAAI,MAAM;AAAA,EAAqC,QAAQ;AAAA,GAC7D;AAAA,EACD,IAAI,CAAC,OAAO,SAAS;AAAA,IACpB,MAAM,IAAI,MACT;AAAA,EAAqC,OAAO,KAAK,IAAI,MAAM,EAAE,KAAK;AAAA,CAAI,GACvE;AAAA,EACD;AAAA,EACA,IAAI,gBAAgB;AAAA,EACpB,aAAa,SAAS,UAAU;AAAA,IAC/B,kBAAkB,MAAM,KAAK,KAAK,QAAQ,GAAG,CAAC,GAAG;AAAA,EAClD;AAAA,EACA,OAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,QAAQ,MAAM,KAAK,GAAG,GAAG;AAAA,EAC1B;AAAA;",
|
|
9
9
|
"debugId": "705C996D7C991BF164756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"import { SERVICE_WORKER_URL, SKIP_WAITING } from './worker-contract';\n\n/** What the registration reads of `navigator.serviceWorker`. */\nexport type ServiceWorkerContainerLike = Pick<\n\tServiceWorkerContainer,\n\t'controller' | 'addEventListener' | 'register'\n>;\n\n/**\n * Calls `onWaiting` with each new version that finished installing while an\n * older one controls the page: the one waiting now, and each found later.\n * A first install controls nothing yet, so it offers nothing.\n */\nexport function watchForUpdates(\n\tregistration: ServiceWorkerRegistration,\n\tcontainer: Pick<ServiceWorkerContainerLike, 'controller'>,\n\tonWaiting: (worker: ServiceWorker) => void,\n): void {\n\tconst offer = (worker: ServiceWorker | null) => {\n\t\tif (worker && container.controller) onWaiting(worker);\n\t};\n\toffer(registration.waiting);\n\tregistration.addEventListener('updatefound', () => {\n\t\tconst installing = registration.installing;\n\t\tinstalling?.addEventListener('statechange', () => {\n\t\t\tif (installing.state === 'installed') offer(installing);\n\t\t});\n\t});\n}\n\n/** Moves this page onto a waiting worker: `apply(worker)`. */\nexport type ApplyUpdate = (\n\tworker: Pick<ServiceWorker, 'postMessage' | 'state'>,\n) => void;\n\n/**\n * The one update path of a page, created once: `apply(worker)` activates\n * the waiting worker and reloads once, when it takes control, so the page\n * runs the version its assets came from.\n *\n * - Several tabs: another tab may have activated the worker already. Its\n * `controllerchange` reached this page before anyone asked, so this page\n * did not reload (a form may be half filled); its \"Reload\" then reloads\n * at once, the worker being active.\n * - Clicked twice, or a `controllerchange` after a direct reload: one\n * reload, never two.\n */\nexport function createUpdater(\n\tcontainer: Pick<\n\t\tServiceWorkerContainerLike,\n\t\t'controller' | 'addEventListener'\n\t>,\n\treload: () => void = () => window.location.reload(),\n): ApplyUpdate {\n\tlet requested = false;\n\tlet reloaded = false;\n\tconst reloadOnce = () => {\n\t\tif (reloaded) return;\n\t\treloaded = true;\n\t\treload();\n\t};\n\tcontainer.addEventListener('controllerchange', () => {\n\t\tif (requested) reloadOnce();\n\t});\n\treturn (worker) => {\n\t\tconst active =\n\t\t\tworker.state === 'activating' ||\n\t\t\tworker.state === 'activated' ||\n\t\t\tcontainer.controller === worker;\n\t\tif (active) return reloadOnce();\n\t\trequested = true;\n\t\tworker.postMessage({ type: SKIP_WAITING });\n\t};\n}\n\n/** Runs `run` once the page has loaded: registering never competes with it. */\nexport function afterLoad(run: () => void): void {\n\tif (document.readyState === 'complete') run();\n\telse window.addEventListener('load', run, { once: true });\n}\n\nexport interface RegisterOptions {\n\t/** The worker's path. `SERVICE_WORKER_URL` by default. */\n\turl?: string;\n\t/** The scope it controls. `'/'` by default. */\n\tscope?: string;\n}\n\nlet updater: ApplyUpdate | undefined;\n\n/**\n * Registers the worker and watches for updates, handing each waiting worker\n * to `onWaiting` with the page's one `apply` (`createUpdater`, made on the\n * first call: one per page). A tab coming back to the foreground checks for\n * an update, as a long-lived page otherwise would only on its next full load.\n */\nexport async function registerServiceWorker(\n\tcontainer: ServiceWorkerContainerLike,\n\tonWaiting: (worker: ServiceWorker, apply: ApplyUpdate) => void,\n\toptions: RegisterOptions = {},\n): Promise<ServiceWorkerRegistration> {\n\tupdater ??= createUpdater(container);\n\tconst apply = updater;\n\tconst registration = await container.register(\n\t\toptions.url ?? SERVICE_WORKER_URL,\n\t\t{ scope: options.scope ?? '/' },\n\t);\n\twatchForUpdates(registration, container, (worker) =>\n\t\tonWaiting(worker, apply),\n\t);\n\tdocument.addEventListener('visibilitychange', () => {\n\t\tif (document.visibilityState === 'visible')\n\t\t\tregistration.update().catch(() => {\n\t\t\t\t// Offline, or the server is down: the next check will tell.\n\t\t\t});\n\t});\n\treturn registration;\n}\n",
|
|
6
6
|
"/**\n * The session's \"Later\": the notice stays hidden until the next visit.\n * `sessionStorage` is per origin, so one key serves every app; a second\n * argument of `createUpdateNotice` names another.\n */\nexport const UPDATE_LATER_KEY = 'alxia.update-later';\n\n/** The part of `Storage` the notice reads and writes. */\nexport type NoticeStorage = {\n\tgetItem(key: string): string | null;\n\tsetItem(key: string, value: string): void;\n};\n\n/** What the notice offers while a new version waits. */\nexport type UpdateNotice = {\n\t/** Moves the page onto the new version: the worker's `apply`. */\n\treload: () => void;\n\t/** Hides the notice until the next visit (the tab's session). */\n\tlater: () => void;\n};\n\n/** What `createUpdateNotice` returns: the shape `useSyncExternalStore` takes. */\nexport interface UpdateNoticeStore {\n\t/** A new version waits: `apply` moves the page onto it. */\n\toffer(apply: () => void): void;\n\t/** The notice to show, if any (the same object until it changes). */\n\tcurrent(): UpdateNotice | undefined;\n\t/** Calls `listener` on each change; returns the function that stops it. */\n\tsubscribe(listener: () => void): () => void;\n}\n\n/**\n * The update notice's state: offered by the worker's registration, read by\n * the banners, hidden for the session by \"Later\". `storage` is the session's\n * (`sessionStorage`), which may be missing or throw (private mode, blocked\n * storage): the notice then hides for this page only. It is a function so\n * that nothing reads the global at load.\n */\nexport function createUpdateNotice(\n\tstorage: () => NoticeStorage | undefined,\n\tkey: string = UPDATE_LATER_KEY,\n): UpdateNoticeStore {\n\tlet reload: (() => void) | undefined;\n\tlet laterThisPage = false;\n\tlet notice: UpdateNotice | undefined;\n\tconst listeners = new Set<() => void>();\n\n\tconst later = () => {\n\t\tlaterThisPage = true;\n\t\ttry {\n\t\t\tstorage()?.setItem(key, '1');\n\t\t} catch {\n\t\t\t// No storage: hidden for this page only.\n\t\t}\n\t\trefresh();\n\t};\n\tconst laterAsked = () => {\n\t\tif (laterThisPage) return true;\n\t\ttry {\n\t\t\treturn storage()?.getItem(key) === '1';\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t};\n\tfunction refresh() {\n\t\tnotice = reload && !laterAsked() ? { reload, later } : undefined;\n\t\tfor (const listener of listeners) listener();\n\t}\n\n\treturn {\n\t\toffer(apply) {\n\t\t\treload = apply;\n\t\t\trefresh();\n\t\t},\n\t\tcurrent: () => notice,\n\t\tsubscribe(listener) {\n\t\t\tlisteners.add(listener);\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener);\n\t\t\t};\n\t\t},\n\t};\n}\n\n/** `sessionStorage`, or nothing where there is none (the server). */\nexport const sessionStore = (): NoticeStorage | undefined =>\n\ttypeof sessionStorage === 'undefined' ? undefined : sessionStorage;\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;AAaO,SAAS,gBAAe,CAC9B,cACA,WACA,WACO;AAAA,EACP,MAAM,QAAQ,CAAC,WAAiC;AAAA,IAC/C,IAAI,UAAU,UAAU;AAAA,MAAY,UAAU,MAAM;AAAA;AAAA,EAErD,MAAM,aAAa,OAAO;AAAA,EAC1B,aAAa,iBAAiB,eAAe,MAAM;AAAA,IAClD,MAAM,aAAa,aAAa;AAAA,IAChC,YAAY,iBAAiB,eAAe,MAAM;AAAA,MACjD,IAAI,WAAW,UAAU;AAAA,QAAa,MAAM,UAAU;AAAA,KACtD;AAAA,GACD;AAAA;AAoBK,SAAS,cAAa,CAC5B,WAIA,SAAqB,MAAM,OAAO,SAAS,OAAO,GACpC;AAAA,EACd,IAAI,YAAY;AAAA,EAChB,IAAI,WAAW;AAAA,EACf,MAAM,aAAa,MAAM;AAAA,IACx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AA,MACP,OAAO;AAAA;AAAA;AAAA,EAGT,SAAS,OAAO,GAAG;AAAA,IAClB,SAAS,UAAU,CAAC,WAAW,IAAI,EAAE,QAAQ,MAAM,IAAI;AAAA,IACvD,WAAW,YAAY;AAAA,MAAW,SAAS;AAAA;AAAA,EAG5C,OAAO;AAAA,IACN,KAAK,CAAC,OAAO;AAAA,MACZ,SAAS;AAAA,MACT,QAAQ;AAAA;AAAA,IAET,SAAS,MAAM;AAAA,IACf,SAAS,CAAC,UAAU;AAAA,MACnB,UAAU,IAAI,QAAQ;AAAA,MACtB,OAAO,MAAM;AAAA,QACZ,UAAU,OAAO,QAAQ;AAAA;AAAA;AAAA,EAG5B;AAAA;AAIM,IAAM,gBAAe,MAC3B,OAAO,mBAAmB,cAAc,YAAY;",
|
|
9
9
|
"debugId": "824F7298E795FD3C64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isCrossSite
|
|
3
|
+
} from "./index-mscfme4r.js";
|
|
4
|
+
|
|
1
5
|
// src/errors/api-error.ts
|
|
2
6
|
var isNamed = (error, name) => error instanceof Error && error.name === name;
|
|
3
7
|
function isApiErrorLike2(error) {
|
|
@@ -96,10 +100,7 @@ import { data as data2 } from "react-router";
|
|
|
96
100
|
function siteCheck(origin) {
|
|
97
101
|
return (request) => {
|
|
98
102
|
const set = typeof origin === "function" ? origin() : origin;
|
|
99
|
-
|
|
100
|
-
const from = request.headers.get("origin");
|
|
101
|
-
const site = request.headers.get("sec-fetch-site");
|
|
102
|
-
if (from && from !== own || site && site !== "same-origin" && site !== "none") {
|
|
103
|
+
if (isCrossSite(request, set)) {
|
|
103
104
|
throw data2("Cross-site request refused", { status: 403 });
|
|
104
105
|
}
|
|
105
106
|
};
|
|
@@ -120,5 +121,5 @@ function refuseCrossSite(actions, request) {
|
|
|
120
121
|
|
|
121
122
|
export { isApiErrorLike2, waitMinutes2, retryAfterOf, attemptsLeftOf2, valuesOf, isStatusError, isUnavailableError, REQUEST_ID_HEADER2, requestIdOf2, routeError2, errorRequestId2, nextOf2, siteCheck, rememberSiteCheck, hasSiteCheck, refuseCrossSite };
|
|
122
123
|
|
|
123
|
-
//# debugId=
|
|
124
|
-
//# sourceMappingURL=index-
|
|
124
|
+
//# debugId=C600B9B93DFE7DF164756E2164756E21
|
|
125
|
+
//# sourceMappingURL=index-a45b1582.js.map
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"import { data } from 'react-router';\nimport { isApiErrorLike } from './api-error';\nimport { requestIdOf } from './request-id';\n\n/** The statuses an error page words: unauthenticated, forbidden, missing, unavailable. */\nconst ROUTED: ReadonlySet<number> = new Set([401, 403, 404, 503]);\n\n/**\n * What a route error of the API carries to the error page: the API's code\n * and message when it gave a code, and the `X-Request-Id` of the call as the\n * support reference (`errorRequestId`).\n */\nexport type RouteErrorData = {\n\tcode?: string | undefined;\n\tmessage?: string | undefined;\n\trequestId?: string | undefined;\n};\n\nexport interface RouteErrorOptions {\n\t/** The statuses that become a route error of their own; 401, 403, 404 and 503 by default. */\n\tstatuses?: ReadonlySet<number>;\n}\n\n/**\n * What a loader throws for an error from the API: an `ApiError` whose\n * status is routed (401, 403, 404 or 503) becomes a route error response of\n * that status, which the root `ErrorBoundary` renders as its page, with the\n * call's request id when the API gave one. A thrown routed `Response` that\n * carries a request id becomes one too (a bare `Response` hands the browser\n * its body only). Any other `ApiError` that has a request id becomes a 500\n * with just that id, so the generic error page can show it. Anything else\n * is returned as it is.\n */\nexport function routeError(\n\terror: unknown,\n\t{ statuses = ROUTED }: RouteErrorOptions = {},\n): unknown {\n\tif (isApiErrorLike(error)) {\n\t\tconst { requestId } = error;\n\t\tif (statuses.has(error.status)) {\n\t\t\treturn data<RouteErrorData>(\n\t\t\t\t{ code: error.code, message: error.message, requestId },\n\t\t\t\t{ status: error.status },\n\t\t\t);\n\t\t}\n\t\treturn requestId\n\t\t\t? data<RouteErrorData>({ requestId }, { status: 500 })\n\t\t\t: error;\n\t}\n\tif (error instanceof Response && statuses.has(error.status)) {\n\t\tconst requestId = requestIdOf(error);\n\t\tif (requestId) {\n\t\t\treturn data<RouteErrorData>({ requestId }, { status: error.status });\n\t\t}\n\t}\n\treturn error;\n}\n\n/**\n * The support reference an error page shows: the API's `X-Request-Id` a\n * route error carries (`routeError`), if it carries one.\n */\nexport function errorRequestId(error: unknown): string | undefined {\n\tif (typeof error !== 'object' || error === null) return undefined;\n\tconst { data: body } = error as { data?: unknown };\n\tif (typeof body !== 'object' || body === null) return undefined;\n\tconst { requestId } = body as { requestId?: unknown };\n\treturn typeof requestId === 'string' && requestId ? requestId : undefined;\n}\n",
|
|
7
7
|
"/** The header an API echoes on every response: the id its logs carry. */\nexport const REQUEST_ID_HEADER = 'x-request-id';\n\n/** The request id a response carries, if the API sent one. */\nexport function requestIdOf(response: Response): string | undefined {\n\treturn response.headers.get(REQUEST_ID_HEADER) || undefined;\n}\n",
|
|
8
8
|
"/**\n * The page a request is for, as `next` carries it back after sign-in: its\n * path and search, without React Router's single-fetch details. A client\n * navigation's `request.url` is `/todos/demo/list.data?q=a&_routes=…`\n * (`/_.data` for `/`, `?index` for an index action), as the server\n * runtime's own `normalizeUrl` strips them.\n */\nexport function nextOf(url: string): string {\n\tconst { pathname, searchParams } = new URL(url);\n\tconst trimmed = pathname.endsWith('/_.data')\n\t\t? pathname.slice(0, -'_.data'.length)\n\t\t: pathname.replace(/\\.data$/, '');\n\t// `new URL('http://h/\\\\evil.com')` has the path `//evil.com`: never let a\n\t// `next` start with two slashes, which a redirect reads as another site.\n\tconst path = trimmed.replace(/^\\/{2,}/, '/');\n\tconst params = new URLSearchParams(searchParams);\n\tparams.delete('_routes');\n\t// An empty `index` names the index route; a valued one is the page's own.\n\tfor (const value of params.getAll('index')) {\n\t\tif (!value) params.delete('index', value);\n\t}\n\tconst search = params.toString();\n\treturn search ? `${path}?${search}` : path;\n}\n",
|
|
9
|
-
"import { data } from 'react-router';\n\n/** Refuses a request from another site with a 403; reads headers only. */\nexport type SiteCheck = (request: Request) => void;\n\n/**\n * The same-site rule of `readJson`: an `Origin` that is not the app's own, or\n * a `Sec-Fetch-Site` that is neither `same-origin` nor `none`, is a 403.\n * `origin` is the app's configured origin (or a getter), else the request's.\n */\nexport function siteCheck(\n\torigin?: string | (() => string | undefined) | undefined,\n): SiteCheck {\n\treturn (request) => {\n\t\tconst set = typeof origin === 'function' ? origin() : origin;\n\t\
|
|
9
|
+
"import { data } from 'react-router';\nimport { isCrossSite } from './cross-site';\n\n/** Refuses a request from another site with a 403; reads headers only. */\nexport type SiteCheck = (request: Request) => void;\n\n/**\n * The same-site rule of `readJson`: an `Origin` that is not the app's own, or\n * a `Sec-Fetch-Site` that is neither `same-origin` nor `none`, is a 403.\n * `origin` is the app's configured origin (or a getter), else the request's.\n */\nexport function siteCheck(\n\torigin?: string | (() => string | undefined) | undefined,\n): SiteCheck {\n\treturn (request) => {\n\t\tconst set = typeof origin === 'function' ? origin() : origin;\n\t\tif (isCrossSite(request, set)) {\n\t\t\tthrow data('Cross-site request refused', { status: 403 });\n\t\t}\n\t};\n}\n\n/**\n * Where a `jsonActions` instance keeps its site check: an enumerable property\n * under a registered symbol, so it survives `{ ...json }` and a second copy of\n * the package. Not public.\n */\nexport const SITE_CHECK = Symbol.for('@alxia/react-router:site-check@1');\n\n/** Puts the check on a `jsonActions` instance. */\nexport function rememberSiteCheck(actions: object, check: SiteCheck): void {\n\tObject.defineProperty(actions, SITE_CHECK, {\n\t\tvalue: check,\n\t\tenumerable: true,\n\t\twritable: false,\n\t});\n}\n\n/** Whether `actions` carries a site check, as every `jsonActions()` instance does. */\nexport const hasSiteCheck = (actions: object): boolean =>\n\ttypeof (actions as Record<symbol, unknown>)[SITE_CHECK] === 'function';\n\n/**\n * Refuses a cross-site request with the rule of the `jsonActions` instance\n * (its configured origin, read at each request); an object without a check\n * gets the request's own origin. It reads headers only, never the body.\n */\nexport function refuseCrossSite(actions: object, request: Request): void {\n\tconst check = (actions as Record<symbol, unknown>)[SITE_CHECK];\n\t(typeof check === 'function' ? (check as SiteCheck) : siteCheck())(request);\n}\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": "
|
|
12
|
-
"debugId": "
|
|
11
|
+
"mappings": ";;;;;AA+DO,IAAM,UAAU,CAAC,OAAgB,SACvC,iBAAiB,SAAS,MAAM,SAAS;AAQnC,SAAS,eAAc,CAAC,OAAuC;AAAA,EACrE,OACC,QAAQ,OAAO,UAAU,KACzB,MAAM,QAAS,MAA+B,MAAM,KACpD,OAAQ,MAA+B,WAAW;AAAA;AAS7C,SAAS,YAAW,CAC1B,YACS;AAAA,EACT,MAAM,UAAU,YAAY,QAAQ,WAAW,YAAY;AAAA,EAC3D,IAAI,YAAY;AAAA,IAAW,OAAO,KAAK,IAAI,GAAG,OAAO,OAAO,KAAK,CAAC;AAAA,EAClE,MAAM,UAAU,YAAY,QAAQ,cAAc,YAAY;AAAA,EAC9D,OAAO,KAAK,IAAI,GAAG,KAAK,KAAK,OAAO,OAAO,IAAI,EAAE,KAAK,CAAC;AAAA;AAGxD,IAAM,kBAAkB;AAGxB,SAAS,SAAS,CAAC,OAAoC;AAAA,EACtD,MAAM,UACL,OAAO,UAAU,YAAY,gBAAgB,KAAK,MAAM,KAAK,CAAC,IAC3D,OAAO,MAAM,KAAK,CAAC,IACnB;AAAA,EACJ,OAAO,OAAO,YAAY,YAAY,OAAO,SAAS,OAAO,KAAK,WAAW,IAC1E,KAAK,IAAI,iBAAiB,KAAK,KAAK,OAAO,CAAC,IAAI,IAChD;AAAA;AAUG,SAAS,YAAY,CAAC,OAAyC;AAAA,EACrE,MAAM,aAAa,MAAM,OAAO,IAAI;AAAA,EACpC,OACC,UAAU,YAAY,QAAQ,UAAU,KACxC,UAAU,YAAY,UAAU;AAAA;AAU3B,SAAS,eAAc,CAAC,OAAyC;AAAA,EACvE,MAAM,aAAa,MAAM,OAAO,IAAI;AAAA,EACpC,WAAW,SAAS;AAAA,IACnB,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AC1C,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,EACX,CAAC;AAAA;AAIK,IAAM,eAAe,CAAC,YAC5B,OAAQ,QAAoC,gBAAgB;AAOtD,SAAS,eAAe,CAAC,SAAiB,SAAwB;AAAA,EACxE,MAAM,QAAS,QAAoC;AAAA,GAClD,OAAO,UAAU,aAAc,QAAsB,UAAU,GAAG,OAAO;AAAA;",
|
|
12
|
+
"debugId": "C600B9B93DFE7DF164756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * The source of the module the plugin serves in dev and builds as\n * `build/server/index.js`: the server, made into the app with React\n * Router's build, and in a build listening when run.\n */\n\nexport const NAME = 'alxia-react-router';\n\n/** React Router's server build, as its Vite plugin serves it. */\nconst SERVER_BUILD = 'virtual:react-router/server-build';\n\n/** The input when the plugin is disabled: React Router's build alone. */\nexport const PASS_THROUGH = `export * from '${SERVER_BUILD}';\\n`;\n\nexport interface EntryOptions {\n\t/** The server file, absolute, or `undefined` for `createServer()` as it is. */\n\treadonly file: string | undefined;\n\t/** How an error names the file: relative to Vite's root. */\n\treadonly label: string;\n\t/** Under `react-router dev`: the build on every request, no client, no listening. */\n\treadonly dev: boolean;\n\t/** The client build, relative to the built file: `../client`. */\n\treadonly client: string | undefined;\n}\n\nexport function serverEntry({\n\tfile,\n\tlabel,\n\tdev,\n\tclient,\n}: EntryOptions): string {\n\tconst lines = ['// Written by @alxia/react-router/vite.'];\n\tif (file === undefined) {\n\t\tlines.push(\n\t\t\t\"import { createServer } from '@alxia/react-router';\",\n\t\t\t'const server = createServer();',\n\t\t);\n\t} else {\n\t\tlines.push(\n\t\t\t`import server from ${JSON.stringify(file)};`,\n\t\t\t\"if (typeof server?.create !== 'function' || typeof server.start !== 'function') {\",\n\t\t\t`\\tthrow new TypeError(${JSON.stringify(\n\t\t\t\t`${NAME}: ${label} must export createServer() from @alxia/react-router as its default export: export default createServer({ … }).`,\n\t\t\t)});`,\n\t\t\t'}',\n\t\t);\n\t}\n\tif (dev) {\n\t\tlines.push(\n\t\t\t'export default server.create({',\n\t\t\t`\\tbuild: () => import('${SERVER_BUILD}'),`,\n\t\t\t\"\\tmode: 'development',\",\n\t\t\t'});',\n\t\t);\n\t} else {\n\t\tlines.push(\n\t\t\t`import * as build from '${SERVER_BUILD}';`,\n\t\t\t// What a server build exports, beside the app: React Router reads it\n\t\t\t// back to prerender. The server file's other exports stay out of it.\n\t\t\t`export * from '${SERVER_BUILD}';`,\n\t\t\t'const app = server.create({',\n\t\t\t'\\tbuild,',\n\t\t\t\"\\tmode: 'production',\",\n\t\t\t`\\tclient: new URL(${JSON.stringify(client ?? '../client')}, import.meta.url),`,\n\t\t\t'});',\n\t\t\t'export default app;',\n\t\t\t// Run, not imported: prerendering, or a test, imports it.\n\t\t\t'if (import.meta.main) server.start(app);',\n\t\t);\n\t}\n\treturn `${lines.join('\\n')}\\n`;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AAMO,IAAM,OAAO;AAGpB,IAAM,eAAe;AAGd,IAAM,eAAe,kBAAkB;AAAA;AAavC,SAAS,WAAW;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACwB;AAAA,EACxB,MAAM,QAAQ,CAAC,yCAAyC;AAAA,EACxD,IAAI,SAAS,WAAW;AAAA,IACvB,MAAM,KACL,uDACA,gCACD;AAAA,EACD,
|
|
7
|
+
"mappings": ";AAMO,IAAM,OAAO;AAGpB,IAAM,eAAe;AAGd,IAAM,eAAe,kBAAkB;AAAA;AAavC,SAAS,WAAW;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACwB;AAAA,EACxB,MAAM,QAAQ,CAAC,yCAAyC;AAAA,EACxD,IAAI,SAAS,WAAW;AAAA,IACvB,MAAM,KACL,uDACA,gCACD;AAAA,EACD,EAAE,KAAK;AAAA,IACN,MAAM,KACL,sBAAsB,KAAK,UAAU,IAAI,MACzC,qFACA,wBAAyB,KAAK,UAC7B,GAAG,SAAS,sHACb,OACA,GACD;AAAA;AAAA,EAED,IAAI,KAAK;AAAA,IACR,MAAM,KACL,kCACA,yBAA0B,mBAC1B,0BACA,KACD;AAAA,EACD,EAAE,KAAK;AAAA,IACN,MAAM,KACL,2BAA2B,kBAG3B,kBAAkB,kBAClB,+BACA,YACA,yBACA,oBAAqB,KAAK,UAAU,UAAU,WAAW,wBACzD,OACA,uBAEA,0CACD;AAAA;AAAA,EAED,OAAO,GAAG,MAAM,KAAK;AAAA,CAAI;AAAA;AAAA;",
|
|
8
8
|
"debugId": "F6C7E7A2AF20914E64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/errors/cross-site.ts
|
|
2
|
+
function isCrossSite(request, origin) {
|
|
3
|
+
const own = origin ?? new URL(request.url).origin;
|
|
4
|
+
const from = request.headers.get("origin");
|
|
5
|
+
const site = request.headers.get("sec-fetch-site");
|
|
6
|
+
return Boolean(from && from !== own || site && site !== "same-origin" && site !== "none");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { isCrossSite };
|
|
10
|
+
|
|
11
|
+
//# debugId=58B4D73CADC8EFA564756E2164756E21
|
|
12
|
+
//# sourceMappingURL=index-mscfme4r.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/errors/cross-site.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Whether a request comes from another site: an `Origin` that is not\n * `origin` (the app's own, else the request's), or a `Sec-Fetch-Site` that is\n * neither `same-origin` nor `none`. It reads headers only and imports nothing,\n * so `/subscription` can share it with `/errors` and stay import-free.\n */\nexport function isCrossSite(request: Request, origin?: string): boolean {\n\tconst own = origin ?? new URL(request.url).origin;\n\tconst from = request.headers.get('origin');\n\tconst site = request.headers.get('sec-fetch-site');\n\treturn Boolean(\n\t\t(from && from !== own) ||\n\t\t\t(site && site !== 'same-origin' && site !== 'none'),\n\t);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAMO,SAAS,WAAW,CAAC,SAAkB,QAA0B;AAAA,EACvE,MAAM,MAAM,UAAU,IAAI,IAAI,QAAQ,GAAG,EAAE;AAAA,EAC3C,MAAM,OAAO,QAAQ,QAAQ,IAAI,QAAQ;AAAA,EACzC,MAAM,OAAO,QAAQ,QAAQ,IAAI,gBAAgB;AAAA,EACjD,OAAO,QACL,QAAQ,SAAS,OAChB,QAAQ,SAAS,iBAAiB,SAAS,MAC9C;AAAA;",
|
|
8
|
+
"debugId": "58B4D73CADC8EFA564756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/cli/index.js.map
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"/**\n * The `alxia-react-router` command: its arguments, what it prints, and its\n * exit code. `index.ts` runs it on the process's own.\n */\nimport { NAME } from '../vite/entry';\nimport { reveal } from './reveal';\n\nexport const USAGE = `Usage: ${NAME} <command> [options]\n\nCommands:\n reveal [--force] Write the server alxia() runs by default to app/server.ts,\n or to alxia({ entry })'s file, to customise it. --force\n overwrites a file already there.\n\nOptions:\n --help Show this help.`;\n\n/** Where the command prints: the process's streams, or a spec's. */\nexport interface Output {\n\treadonly out: (line: string) => void;\n\treadonly err: (line: string) => void;\n}\n\n/** Runs the command in `root`; resolves to the process's exit code. */\nexport async function main(\n\targs: readonly string[],\n\troot: string,\n\toutput: Output,\n): Promise<number> {\n\tconst [command, ...options] = args;\n\tif (command === undefined) {\n\t\toutput.err(USAGE);\n\t\treturn 1;\n\t}\n\tif (command === '--help' || command === '-h') {\n\t\toutput.out(USAGE);\n\t\treturn 0;\n\t}\n\tif (command !== 'reveal') {\n\t\toutput.err(`${NAME}: unknown command ${command}.\\n\\n${USAGE}`);\n\t\treturn 1;\n\t}\n\tif (options.includes('--help') || options.includes('-h')) {\n\t\toutput.out(USAGE);\n\t\treturn 0;\n\t}\n\tconst unknown = options.find((option) => option !== '--force');\n\tif (unknown !== undefined) {\n\t\toutput.err(`${NAME}: unknown option ${unknown} for reveal.\\n\\n${USAGE}`);\n\t\treturn 1;\n\t}\n\ttry {\n\t\tconst result = await reveal(root, options.includes('--force'));\n\t\tif ('exists' in result) {\n\t\t\toutput.err(\n\t\t\t\t`${NAME}: ${result.exists} already exists, and reveal leaves it as it is. Run ${NAME} reveal --force to overwrite it.`,\n\t\t\t);\n\t\t\treturn 1;\n\t\t}\n\t\toutput.out(\n\t\t\t`${NAME}: wrote ${result.written}, the server alxia() runs by default.\\nNext: uncomment configure in ${result.written} to add the app's middlewares and /api; bun run dev picks it up.`,\n\t\t);\n\t\treturn 0;\n\t} catch (error) {\n\t\toutput.err(error instanceof Error ? error.message : String(error));\n\t\treturn 1;\n\t}\n}\n",
|
|
8
8
|
"#!/usr/bin/env bun\n/**\n * `alxia-react-router`, the package's bin: `bunx alxia-react-router reveal`\n * writes the default server into the app, to customise it.\n */\nimport { main } from './main';\n\nprocess.exitCode = await main(process.argv.slice(2), process.cwd(), {\n\tout: (line) => console.log(line),\n\terr: (line) => console.error(line),\n});\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": ";;;;;;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADU3B,IAAM,aAAa,CAAC,OAAO,QAAQ,QAAQ,OAAO,QAAQ,MAAM;AAGhE,SAAS,UAAU,CAAC,MAAc,MAAkC;AAAA,EACnE,OAAO,WAAW,IAAI,CAAC,cA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AAM,KAAK,QAAQ,KAAK,MAAM,CAAC,GAAG,QAAQ,IAAI,GAAG;AAAA,EACnE,KAAK,CAAC,SAAS,QAAQ,IAAI,IAAI;AAAA,EAC/B,KAAK,CAAC,SAAS,QAAQ,MAAM,IAAI;AAClC,CAAC;",
|
|
11
11
|
"debugId": "8582AE498438642864756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
package/dist/entry/index.js.map
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"/** The render's abort timer: one per response, cleared when the response is over. */\nexport interface Deadline {\n\treadonly signal: AbortSignal;\n\t/** Stops the timer. Calling it again does nothing. */\n\treadonly clear: () => void;\n}\n\n/** A signal aborted after `ms`, with the means to stop the timer. */\nexport function deadline(ms: number): Deadline {\n\tconst controller = new AbortController();\n\tconst timer = setTimeout(() => controller.abort(), ms);\n\treturn { signal: controller.signal, clear: () => clearTimeout(timer) };\n}\n\n/**\n * The same bytes in a new stream that calls `done` when the body ends,\n * fails or is cancelled (the client went away), so no timer outlives the\n * response. React's `allReady` is not carried over: await it first.\n */\nexport function untilDone(\n\tbody: ReadableStream<Uint8Array>,\n\tdone: () => void,\n): ReadableStream<Uint8Array> {\n\tconst reader = body.getReader();\n\treturn new ReadableStream<Uint8Array>({\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tconst chunk = await reader.read();\n\t\t\t\tif (chunk.done) {\n\t\t\t\t\tdone();\n\t\t\t\t\tcontroller.close();\n\t\t\t\t} else {\n\t\t\t\t\tcontroller.enqueue(chunk.value);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tdone();\n\t\t\t\tcontroller.error(error);\n\t\t\t}\n\t\t},\n\t\tasync cancel(reason) {\n\t\t\tdone();\n\t\t\tawait reader.cancel(reason);\n\t\t},\n\t});\n}\n\n/**\n * Gives up on a render that will not be served: stops its timer and cancels\n * the body, which aborts React's work. A cancel that itself fails is ignored,\n * so the error that got us here is the one the caller rethrows.\n */\nexport async function abandon(\n\tlimit: Pick<Deadline, 'clear'>,\n\tbody: Pick<ReadableStream, 'cancel'> | undefined,\n): Promise<void> {\n\tlimit.clear();\n\tawait body?.cancel().catch(() => {});\n}\n",
|
|
7
7
|
"type IsBot = (userAgent: string) => boolean;\n\nlet loaded: Promise<IsBot> | undefined;\n\n/**\n * `isbot`, imported on the first bot check that needs it and kept: an\n * optional peer, so an app that gives `isBot` never loads it. A failed import\n * is not kept, so a later request tries again.\n */\nfunction defaultIsBot(): Promise<IsBot> {\n\tloaded ??= import('isbot').then(\n\t\t(module) => module.isbot,\n\t\t(error: unknown) => {\n\t\t\tloaded = undefined;\n\t\t\tthrow error;\n\t\t},\n\t);\n\treturn loaded;\n}\n\n/**\n * Whether the response waits for the whole page instead of streaming the\n * shell: a bot (`isBot`, `isbot` by default, imported only then) gets\n * complete HTML to index, and SPA mode renders the one shell the build\n * prerenders.\n */\nexport async function wantsWholePage(\n\trequest: Request,\n\tisSpaMode: boolean,\n\tisBot?: IsBot,\n): Promise<boolean> {\n\tif (isSpaMode) return true;\n\tconst agent = request.headers.get('user-agent');\n\tif (agent === null) return false;\n\treturn (isBot ?? (await defaultIsBot()))(agent);\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;AAAA;AACA;AAAA;AAAA;AAIA;AAAA;AAAA;;;ACGO,SAAS,QAAQ,CAAC,IAAsB;AAAA,EAC9C,MAAM,aAAa,IAAI;AAAA,EACvB,MAAM,QAAQ,WAAW,MAAM,WAAW,MAAM,GAAG,EAAE;AAAA,EACrD,OAAO,EAAE,QAAQ,WAAW,QAAQ,OAAO,MAAM,aAAa,KAAK,EAAE;AAAA;AAQ/D,SAAS,SAAS,CACxB,MACA,MAC6B;AAAA,EAC7B,MAAM,SAAS,KAAK,UAAU;AAAA,EAC9B,OAAO,IAAI,eAA2B;AAAA,
|
|
9
|
+
"mappings": ";;;;;;;;AAAA;AACA;AAAA;AAAA;AAIA;AAAA;AAAA;;;ACGO,SAAS,QAAQ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D;AAAA,QACA,SAAS;AAAA,MACV,CAAC;AAAA,MACA,OAAO,OAAO;AAAA,MAEf,MAAM,QAAQ,OAAO,IAAI;AAAA,MACzB,MAAM;AAAA;AAAA;AAAA,EAGR,OAAO,EAAE,eAAe,eAAe,QAAQ;AAAA;AAGhD,IAAM,WAAW,YAAY;AAGtB,IAAM,gBAA+B,SAAS;",
|
|
10
10
|
"debugId": "EB32BB9D687DF8D664756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a request comes from another site: an `Origin` that is not
|
|
3
|
+
* `origin` (the app's own, else the request's), or a `Sec-Fetch-Site` that is
|
|
4
|
+
* neither `same-origin` nor `none`. It reads headers only and imports nothing,
|
|
5
|
+
* so `/subscription` can share it with `/errors` and stay import-free.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isCrossSite(request: Request, origin?: string): boolean;
|
|
8
|
+
//# sourceMappingURL=cross-site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-site.d.ts","sourceRoot":"","sources":["../../src/errors/cross-site.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAQtE"}
|
package/dist/errors/index.js
CHANGED
package/dist/errors/index.js.map
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"import type { ReactNode } from 'react';\nimport type { ApiMessages, CatalogueMessages } from './messages';\n\nexport interface ApiMessagesProviderProps<L extends string> {\n\t/** The store `apiCodeResolver` reads. */\n\tmessages: ApiMessages<L>;\n\t/** The messages the root's data carries, by language. */\n\tvalue: Readonly<Record<L, CatalogueMessages>> | undefined;\n\tchildren: ReactNode;\n}\n\n/**\n * Fills the browser's catalogue with the messages the root's data carries\n * (the few its forms word), before the children render: `apiCodeResolver`\n * reads them synchronously. A server render writes nothing: the server's\n * store holds the whole, fresher catalogue, and a render's data may be older\n * than it. It is a plain function (no JSX, no React runtime): use it as\n * `ApiMessagesProvider({ messages, value, children })` from a component, or\n * as an element's type.\n */\nexport function ApiMessagesProvider<L extends string>({\n\tmessages,\n\tvalue,\n\tchildren,\n}: ApiMessagesProviderProps<L>): ReactNode {\n\tconst inBrowser =\n\t\ttypeof (globalThis as { document?: unknown }).document !== 'undefined';\n\tif (value && inBrowser) {\n\t\tfor (const [language, held] of Object.entries<CatalogueMessages>(value)) {\n\t\t\tmessages.add(language as L, held);\n\t\t}\n\t}\n\treturn children;\n}\n",
|
|
20
20
|
"import { type FetcherWithComponents, useFetcher } from 'react-router';\n\n/** What a fetcher can post as JSON. */\nexport type JsonBody = Parameters<FetcherWithComponents<unknown>['submit']>[0];\n\n/**\n * A fetcher posting JSON to its page's action (which reads it with\n * `readJson`, and answers `fetcherResult` or the like): `post` sends a\n * body, `busy` while it is in flight. `key` shares the fetcher between the\n * form that posts and the component that reads the answer; `action` posts to\n * another route's action instead (a resource route's, such as a\n * `notifications/poll`). `post` takes the target of one call as its second\n * argument (a list's rows each post to their own record's action).\n */\nexport function useJsonFetcher<Action, Body extends JsonBody = JsonBody>(\n\tkey?: string,\n\taction?: string,\n): {\n\tfetcher: ReturnType<typeof useFetcher<Action>>;\n\tpost(body: Body, to?: string): Promise<void>;\n\tbusy: boolean;\n} {\n\tconst fetcher = useFetcher<Action>(key ? { key } : undefined);\n\tconst post = (body: Body, to = action) =>\n\t\tfetcher.submit(body, {\n\t\t\tmethod: 'post',\n\t\t\tencType: 'application/json',\n\t\t\t...(to ? { action: to } : {}),\n\t\t});\n\treturn { fetcher, post, busy: fetcher.state !== 'idle' };\n}\n"
|
|
21
21
|
],
|
|
22
|
-
"mappings": ";;;;;;;;;;;;;;;;AAgBO,IAAM,WAAW;AA8BxB,SAAS,UAAU,CAAC,OAAsB;AAAA,EACzC,MAAM,OAAQ,MAAM,QAA2C;AAAA,EAC/D,OAA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ClC,MAAM,QAAQ,UAAU,UAAU,IAAI;AAAA,MACtC,OAAO,QAAQ,YAAY,OAAO,QAAQ,QAAQ,IAAI;AAAA;AAAA,EAExD;AAAA;;AC3GM,SAAS,mBAAqC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,GAC0C;AAAA,EAC1C,MAAM,YACL,OAAQ,WAAsC,aAAa;AAAA,EAC5D,IAAI,SAAS,WAAW;AAAA,IACvB,YAAY,UAAU,SAAS,OAAO,QAA2B,KAAK,GAAG;AAAA,MACxE,SAAS,IAAI,UAAe,IAAI;AAAA,IACjC;AAAA,EACD;AAAA,EACA,OAAO;AAAA;;AChCR;AAcO,SAAS,cAAwD,CACvE,KACA,QAKC;AAAA,EACD,MAAM,UAAU,WAAmB,MAAM,EAAE,IAAI,IAAI,SAAS;AAAA,EAC5D,MAAM,OAAO,CAAC,MAAY,KAAK,WAC9B,QAAQ,OAAO,MAAM;AAAA,IACpB,QAAQ;AAAA,IACR,SAAS;AAAA,OACL,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;AAAA,EAC5B,CAAC;AAAA,EACF,OAAO,EAAE,SAAS,MAAM,MAAM,QAAQ,UAAU,OAAO;AAAA;",
|
|
23
23
|
"debugId": "0489566B0456068164756E2164756E21",
|
|
24
24
|
"names": []
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"same-site.d.ts","sourceRoot":"","sources":["../../src/errors/same-site.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"same-site.d.ts","sourceRoot":"","sources":["../../src/errors/same-site.ts"],"names":[],"mappings":"AAGA,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,GACtD,SAAS,CAOX;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,eAAiD,CAAC;AAEzE,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAMzE;AAED,sFAAsF;AACtF,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,OACwB,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAGvE"}
|
package/dist/index.js.map
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"/**\n * `createServer()`: the alxia server of a React Router app, as\n * `@alxia/react-router/vite` builds it. The plugin hands it React Router's\n * build, the mode and the client folder; the app's own `app/server.ts`\n * customises the rest, or is not written at all.\n */\nimport {\n\ttype Alxia,\n\ttype AnyAlxia,\n\talxia,\n\ttype ContextOf,\n\ttype Empty,\n\ttype ListenInfo,\n\ttype ListenOptions,\n\ttype MaybePromise,\n\ttype ProxyTrust,\n} from '@alxia/core';\nimport type { RouterContextProvider, ServerBuild } from 'react-router';\nimport { declareClient, reactRouter } from './react-router';\n\n/** An app as `alxia()` makes it: what `beforeAll`, or `configure`, receives. */\nexport type FreshApp = Alxia<Empty, ''>;\n\n/**\n * What the Vite plugin hands the server, and a test passes to `create`:\n * React Router's server build, its mode, and the client build's folder.\n */\nexport interface ServerWiring {\n\t/**\n\t * React Router's server build, or a function that returns it: called on\n\t * every request in `development`, once in `production`.\n\t */\n\treadonly build: ServerBuild | (() => MaybePromise<ServerBuild>);\n\t/** `development` under `react-router dev`, `production` in a build, and by default. */\n\treadonly mode?: 'development' | 'production';\n\t/** The client build's folder, a path or a `file:` URL: served in `production`. */\n\treadonly client?: string | URL | undefined;\n}\n\nexport interface ServerOptions<Before extends AnyAlxia, App extends AnyAlxia> {\n\t/**\n\t * Runs first, on a new app: what is declared here runs before the\n\t * client's files too — a guard, a rate limit, a logger that should see\n\t * every request. Returns the app, so its types flow to `configure`.\n\t */\n\treadonly beforeAll?: (app: FreshApp) => Before;\n\t/**\n\t * The app the pages run behind: its middlewares, its plugins, its `/api`.\n\t * Declared after the client's files and before the catch-all. Returns\n\t * the app: what it builds is what the loaders read through `alxiaOf`.\n\t */\n\treadonly configure?: (app: Before) => App;\n\t/**\n\t * Sets the app's own keys on React Router's context provider, `ctx`\n\t * typed by `configure`'s app. `alxiaContext` is always set.\n\t */\n\treadonly getLoadContext?: (\n\t\tctx: ContextOf<App>,\n\t\tcontext: RouterContextProvider,\n\t) => MaybePromise<void>;\n\t/**\n\t * The proxies in front of the app, `trustProxy({ trusted })` from\n\t * `@alxia/core`: `alxia({ proxy })`'s option, so `ctx.ip` is the\n\t * client's and React Router's `request.url` the URL it asked for.\n\t */\n\treadonly proxy?: ProxyTrust;\n\t/** Overrides the plugin's server build: rarely wanted. */\n\treadonly build?: ServerWiring['build'];\n\t/** Overrides the plugin's mode, `development` in dev and `production` in a build. */\n\treadonly mode?: 'development' | 'production';\n\t/**\n\t * Overrides the plugin's client folder, `build/client` beside the built\n\t * server. `false` serves none of it: declare the files yourself, in\n\t * `beforeAll` or `configure`.\n\t */\n\treadonly client?: string | URL | false;\n\t/**\n\t * `listen`'s options for `bun build/server/index.js` — `shutdownTimeout`,\n\t * `signals` among them; a `port` or `hostname` here wins over `PORT` (3000)\n\t * and `HOST` (`0.0.0.0`) from the environment.\n\t */\n\treadonly listen?: ListenOptions;\n\t/**\n\t * Called once the built server listens and its `SIGINT` and `SIGTERM` handlers are in place.\n\t * Prints `alxia listening on <url>` by default, and in dev the route\n\t * table (`alxia({ dev })`). An `onListen` in `listen` wins over it.\n\t */\n\treadonly onListen?: (server: Bun.Server<unknown>) => void;\n}\n\n/**\n * The server `createServer()` describes, made into an app by the Vite\n * plugin, by a test, or by a server file of your own.\n */\nexport interface ReactRouterServer<App extends AnyAlxia> {\n\t/**\n\t * The app, serving React Router's build: `build/server/index.js`'s\n\t * default export. A test drives it with `app.request`.\n\t *\n\t * ```ts\n\t * const app = server.create({ build: await import('./build/server/index.js') });\n\t * ```\n\t */\n\tcreate(wiring: ServerWiring): App;\n\t/**\n\t * Listens with `app`, on `listen`, `PORT` and `HOST`, and shuts it down\n\t * gracefully on `SIGINT` or `SIGTERM`, as `@alxia/core`'s `listen` does:\n\t * the requests in flight finish within `shutdownTimeout`, its `onStop`\n\t * hooks run, and the process exits. What `bun build/server/index.js` runs.\n\t */\n\tstart(app: App): Bun.Server<unknown>;\n}\n\n/**\n * The alxia server of a React Router app, for `app/server.ts`. Every option\n * is optional: the Vite plugin wires React Router's build, the mode and the\n * client folder, and without the file uses `createServer()` as it is.\n *\n * ```ts\n * const server = createServer({\n * configure: (app) => app.use(logger()).get('/api/health', ({ reply }) => reply.ok({ ok: true })),\n * });\n * export default server;\n * ```\n *\n * The request runs through `beforeAll`, the client's files, `configure`,\n * then the pages.\n */\nexport function createServer<\n\tBefore extends AnyAlxia = FreshApp,\n\tApp extends AnyAlxia = Before,\n>(options: ServerOptions<Before, App> = {}): ReactRouterServer<App> {\n\treturn {\n\t\tcreate(wiring) {\n\t\t\tconst mode = options.mode ?? wiring.mode ?? 'production';\n\t\t\tconst client =\n\t\t\t\toptions.client === false\n\t\t\t\t\t? undefined\n\t\t\t\t\t: (options.client ?? wiring.client);\n\t\t\t// The app helps the developer in React Router's dev alone: a production\n\t\t\t// build is never in dev, whatever NODE_ENV says.\n\t\t\tconst fresh = alxia({\n\t\t\t\tdev: mode === 'development',\n\t\t\t\t...(options.proxy === undefined ? {} : { proxy: options.proxy }),\n\t\t\t});\n\t\t\t// Without beforeAll or configure, Before and App are their defaults,\n\t\t\t// the app passed through: a type argument given by hand is believed.\n\t\t\tconst before = (options.beforeAll?.(fresh) ?? fresh) as Before;\n\t\t\tif (client !== undefined && mode === 'production') {\n\t\t\t\tdeclareClient(before, client);\n\t\t\t}\n\t\t\tconst app = (options.configure?.(before) ?? before) as App;\n\t\t\tconst getLoadContext = options.getLoadContext;\n\t\t\treactRouter(app, {\n\t\t\t\tbuild: options.build ?? wiring.build,\n\t\t\t\tmode,\n\t\t\t\t...(getLoadContext === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tgetLoadContext: (ctx, context) =>\n\t\t\t\t\t\t\t\tgetLoadContext(ctx as ContextOf<App>, context),\n\t\t\t\t\t\t}),\n\t\t\t});\n\t\t\treturn app;\n\t\t},\n\t\tstart(app) {\n\t\t\tconst own = options.listen?.onListen;\n\t\t\t// `listen` shuts the app down on SIGINT and SIGTERM — readiness 503,\n\t\t\t// the requests in flight drained, the onStop hooks, then the exit —\n\t\t\t// with its handlers in place before it tells onListen: a supervisor\n\t\t\t// may signal as soon as it reads that the server listens.\n\t\t\treturn app.listen({\n\t\t\t\tport: Number(process.env['PORT'] || 3000),\n\t\t\t\thostname: process.env['HOST'] || '0.0.0.0',\n\t\t\t\t...options.listen,\n\t\t\t\tonListen: (info) => {\n\t\t\t\t\tif (own !== undefined) own(info);\n\t\t\t\t\telse if (options.onListen !== undefined) {\n\t\t\t\t\t\toptions.onListen(info.server);\n\t\t\t\t\t} else announce(info);\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** In dev, the route table `listen` prints; else one line. */\nfunction announce({ dev, table, url }: ListenInfo): void {\n\tconsole.log(dev ? table : `alxia listening on ${url}`);\n}\n",
|
|
8
8
|
"/**\n * `withAlxia(fn)`: a loader, an action or a middleware handed the alxia\n * context as `alxia`, typed even under the generated `Route.*Args`.\n */\nimport type { AnyAlxia } from '@alxia/core';\nimport {\n\ttype AlxiaContextOf,\n\talxiaOf,\n\ttype ProviderLike,\n\ttype RegisteredApp,\n} from './context';\nimport type { ReactRouterServer } from './server';\n\n/**\n * What `withAlxia` adds to React Router's arguments: `alxia`, what\n * `alxiaOf<App>(context)` returns. Typed by `Register` by default; name a\n * server, `AlxiaArgs<typeof server>`, as `alxiaOf<typeof server>` does.\n */\nexport interface AlxiaArgs<\n\tApp extends AnyAlxia | ReactRouterServer<AnyAlxia> = RegisteredApp,\n> {\n\treadonly alxia: AlxiaContextOf<App>;\n}\n\n/**\n * A loader, an action or a middleware given `alxia`, the alxia context, beside\n * React Router's arguments. Annotate the parameter as the generated arguments\n * and `AlxiaArgs`:\n *\n * ```ts\n * export const loader = withAlxia(({ alxia, params }: Route.LoaderArgs & AlxiaArgs) => {\n * return { name: alxia.user?.name ?? null, id: params.id };\n * });\n * ```\n *\n * It returns a function of React Router's arguments alone (`Args` without\n * `alxia`), with `fn`'s return type, so `useLoaderData<typeof loader>` and `Route.ComponentProps` read what\n * `fn` returns. A middleware's `next` is passed on. Throws `alxiaOf`'s error\n * on a request that did not come through `reactRouter()`.\n */\nexport function withAlxia<\n\t// `unknown`, not `AlxiaArgs<AnyAlxia>`, whose `alxia` is `any`: an `fn`\n\t// left unannotated reads nothing of it.\n\tArgs extends { readonly alxia: unknown; readonly context: ProviderLike },\n\tRest extends unknown[],\n\tResult,\n>(\n\tfn: (args: Args, ...rest: Rest) => Result,\n): (args: Omit<Args, 'alxia'>, ...rest: Rest) => Result {\n\treturn (args, ...rest) =>\n\t\tfn({ ...args, alxia: alxiaOf(args.context) } as unknown as Args, ...rest);\n}\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": ";;;;;;AAAA;AACA;AAAA;AAAA;AASA;AAAA;AAAA;AAAA;;;ACLA;AACA;AAGO,IAAM,YAAY;AAElB,IAAM,UAAU;AAQhB,SAAS,WAAW,CAAC,KAAc,QAAsB;AAAA,EAC/D,IAAI,CAAC,YAAY,MAAM,GAAG;AAAA,IACzB,MAAM,IAAI,UACT,4BAA4B,mFAC7B;AAAA,EACD;AAAA,EACA,WAAW,QAAQ,YAAY,MAAM,EAAE,KAAK,GAAG;AAAA,IAC9C,IAAI,KAAK,WAAW,GAAG;AAAA,MAAG;AAAA,IAC1B,MAAM,OAAO,KAAK,QAAQ,IAAI;AAAA,IAC9B,MAAM,eAAe,SAAS,WAAW,YAAY;AAAA,IAGrD,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AAAA,MAC7B;AAAA,MACA,MAAM,MAAO,QAAQ,YAAY,MAAM,KAAK;AAAA,MAC5C,MAAM,iBAAiB,QAAQ;AAAA,MAC/B,YAAY,KAAK;AAAA,QAChB,OAAO,QAAQ,SAAS,OAAO;AAAA,QAC/B;AAAA,WACI,mBAAmB,YACpB,CAAC,IACD;AAAA,UACA,gBAAgB,CAAC,KAAK,YACrB,eAAe,KAAuB,OAAO;AAAA,QAC/C;AAAA,MACH,CAAC;AAAA,MACD,OAAO;AAAA;AAAA,IAER,KAAK,CAAC,KAAK;AAAA,MACV,MAAM,MAAM,QAAQ,QAAQ;AAAA,MAK5B,OAAO,IAAI,OAAO;AAAA,QACjB,MAAM,OAAO,QAAQ,IAAI,WAAW,IAAI;AAAA,QACxC,UAAU,QAAQ,IAAI,WAAW;AAAA,WAC9B,QAAQ;AAAA,QACX,UAAU,CAAC,SAAS;AAAA,UACnB,IAAI,QAAQ;AAAA,YAAW,IAAI,IAAI;AAAA,UAC/B,KAAK,IAAI,QAAQ,aAAa,WAAW;AAAA,YACxC,QAAQ,SAAS,KAAK,MAAM;AAAA,UAC7B,EAAE;AAAA,YAAK,SAAS,IAAI;AAAA;AAAA,MAEtB,CAAC;AAAA;AAAA,EAEH;AAAA;AAID,SAAS,QAAQ,GAAG,KAAK,OAAO,OAAyB;AAAA,EACxD,QAAQ,IAAI,MAAM,QAAQ,sBAAsB,KAAK;AAAA;;ACpJ/C,SAAS,SAMf,CACA,IACuD;AAAA,EACvD,OAAO,CAAC,SAAS,SAChB,GAAG,KAAK,MAAM,OAAO,SAAQ,KAAK,OAAO,EAAE,GAAsB,GAAG,IAAI;AAAA;",
|
|
11
11
|
"debugId": "121DFAE14BF4BF9464756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
package/dist/pwa/index.js.map
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { WorkerContract } from './worker-contract';\n\n/**\n * Deletes every cache the service worker filled, but the offline page.\n * For sign-out: what the caches hold is static and public by design, and\n * clearing them leaves nothing behind anyway. Safe where Cache Storage does\n * not exist (server, old browsers).\n */\nexport async function clearAppCaches(\n\tcontract: Pick<WorkerContract, 'clearableCaches'>,\n): Promise<void> {\n\tif (typeof caches === 'undefined') return;\n\tconst names = contract.clearableCaches(await caches.keys());\n\tawait Promise.all(names.map((name) => caches.delete(name)));\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,eAAe,cAAc,CACnC,UACgB;AAAA,EAChB,IAAI,OAAO,WAAW;AAAA,IAAa;AAAA,EACnC,MAAM,QAAQ,SAAS,gBAAgB,MAAM,OAAO,KAAK,CAAC;AAAA,EAC1D,MAAM,QAAQ,IAAI,MAAM,IAAI,CAAC,SAAS,OAAO,OAAO,IAAI,CAAC,CAAC;AAAA;",
|
|
8
8
|
"debugId": "C1B759B24638FB8364756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"import {\n\ttype Caching,\n\ttype CachingOptions,\n\tcachingFor,\n\ttype RequestFacts,\n} from '../model/caching';\nimport type { PrecacheEntry } from '../model/precache-list';\nimport { isStorable } from '../model/storable';\nimport { SKIP_WAITING, type WorkerContract } from '../model/worker-contract';\n\n/** How many files, and for how long, a runtime cache keeps. */\nexport interface ExpirationOptions {\n\tmaxEntries?: number;\n\tmaxAgeSeconds?: number;\n}\n\nexport interface WorkerOptions {\n\t/** The app's contract: cache names, offline page, the worker's URL. */\n\tcontract: WorkerContract;\n\t/** What `cachingFor` reads besides the contract: `never`, `immutable`, `manifestPath`, `serviceWorkerUrl`. */\n\tcaching?: Omit<CachingOptions, 'contract'>;\n\t/** The hashed bundles' cache. `{ maxEntries: 200 }` by default. */\n\tassets?: ExpirationOptions;\n\t/** The other static files' cache. `{ maxEntries: 100, maxAgeSeconds: 30 days }` by default. */\n\tstatic?: ExpirationOptions;\n\t/** Start the worker alongside a page load. `true` by default. */\n\tnavigationPreload?: boolean;\n\t/** The precache list. By default the one the build wrote into the worker. */\n\tprecache?: readonly PrecacheEntry[];\n}\n\nexport type WorkerRoute =\n\t| {\n\t\t\tcaching: 'navigation';\n\t\t\tstrategy: 'network-only';\n\t\t\tfallback: string | undefined;\n\t }\n\t| {\n\t\t\tcaching: 'immutable';\n\t\t\tstrategy: 'cache-first';\n\t\t\tcacheName: string;\n\t\t\texpiration: ExpirationOptions & { maxEntries: number };\n\t }\n\t| {\n\t\t\tcaching: 'static';\n\t\t\tstrategy: 'stale-while-revalidate';\n\t\t\tcacheName: string;\n\t\t\texpiration: ExpirationOptions;\n\t };\n\nexport interface WorkerPlan {\n\tcacheNameDetails: { prefix: string; precache: 'precache'; suffix: string };\n\tprecache: readonly PrecacheEntry[];\n\troutes: readonly WorkerRoute[];\n\tnavigationPreload: boolean;\n}\n\nconst THIRTY_DAYS = 30 * 24 * 60 * 60;\n\n/** What the worker does, decided without Workbox so that it is tested as data. */\nexport function workerPlan(\n\toptions: WorkerOptions,\n\tinjected: readonly PrecacheEntry[] | undefined,\n): WorkerPlan {\n\tconst { contract } = options;\n\tif (!contract) {\n\t\tthrow new TypeError(\n\t\t\t'startWorker(): contract is required: pass defineWorkerContract({ cachePrefix }) from @alxia/react-router/pwa.',\n\t\t);\n\t}\n\tconst precache = options.precache ?? injected;\n\tif (!precache) {\n\t\tthrow new Error(\n\t\t\t'startWorker(): no precache list. Build this worker with alxia() from @alxia/react-router/vite (app/service-worker.ts) or buildWorker() from @alxia/react-router/pwa/build, which write it in.',\n\t\t);\n\t}\n\tconst offlineUrl = contract.offlineUrl;\n\tconst hasOffline = precache.some(\n\t\t(entry) => entry.url.split('?')[0] === offlineUrl,\n\t);\n\treturn {\n\t\tcacheNameDetails: {\n\t\t\tprefix: contract.cachePrefix,\n\t\t\tprecache: 'precache',\n\t\t\tsuffix: contract.cacheVersion,\n\t\t},\n\t\tprecache,\n\t\troutes: [\n\t\t\t{\n\t\t\t\tcaching: 'navigation',\n\t\t\t\tstrategy: 'network-only',\n\t\t\t\tfallback: hasOffline ? offlineUrl : undefined,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcaching: 'immutable',\n\t\t\t\tstrategy: 'cache-first',\n\t\t\t\tcacheName: contract.cacheNames.assets,\n\t\t\t\texpiration: { maxEntries: 200, ...options.assets },\n\t\t\t},\n\t\t\t{\n\t\t\t\tcaching: 'static',\n\t\t\t\tstrategy: 'stale-while-revalidate',\n\t\t\t\tcacheName: contract.cacheNames.static,\n\t\t\t\texpiration: {\n\t\t\t\t\tmaxEntries: 100,\n\t\t\t\t\tmaxAgeSeconds: THIRTY_DAYS,\n\t\t\t\t\t...options.static,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tnavigationPreload: options.navigationPreload ?? true,\n\t};\n}\n\n/** Whether a request is answered the way `caching` says. */\nexport function matcher(\n\tcaching: Caching,\n\torigin: () => string,\n\toptions: WorkerOptions,\n): (o: { request: RequestFacts }) => boolean {\n\treturn ({ request }) =>\n\t\tcachingFor(request, origin(), {\n\t\t\t...options.caching,\n\t\t\tcontract: options.contract,\n\t\t}) === caching;\n}\n\n/** Stores only what `isStorable` accepts: a public, same-origin 200. */\nexport const storableOnly = {\n\tasync cacheWillUpdate({\n\t\tresponse,\n\t}: {\n\t\tresponse: Response;\n\t}): Promise<Response | null> {\n\t\treturn isStorable(response) ? response : null;\n\t},\n};\n\nexport function isSkipWaiting(data: unknown): boolean {\n\treturn (data as { type?: unknown } | null | undefined)?.type === SKIP_WAITING;\n}\n\n/** Deletes the caches an earlier version of the contract owned. */\nexport async function deleteObsoleteCaches(\n\tcontract: Pick<WorkerContract, 'obsoleteCaches'>,\n\tstorage: Pick<CacheStorage, 'keys' | 'delete'>,\n): Promise<void> {\n\tconst names = await storage.keys();\n\tawait Promise.all(\n\t\tcontract.obsoleteCaches(names).map((name) => storage.delete(name)),\n\t);\n}\n",
|
|
7
7
|
"/**\n * The part of the service worker's global scope that `startWorker` reads,\n * declared here so no WebWorker-only type reaches the package's declarations\n * (the DOM lib has no `ServiceWorkerGlobalScope`).\n */\nexport interface WorkerScope {\n\treadonly location: { readonly origin: string };\n\tskipWaiting(): Promise<void>;\n\taddEventListener(\n\t\ttype: 'activate' | 'message',\n\t\tlistener: (event: {\n\t\t\tdata?: unknown;\n\t\t\twaitUntil(promise: Promise<unknown>): void;\n\t\t}) => void,\n\t): void;\n}\n\n/** The worker's scope. Called only inside `startWorker`, never at module load. */\nexport const workerScope = (): WorkerScope =>\n\tglobalThis as unknown as WorkerScope;\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;;;ACgDA,IAAM,cAAc,KAAK,KAAK,KAAK;AAG5B,SAAS,UAAU,CACzB,SACA,UACa;AAAA,EACb,QAAQ,aAAa;AAAA,EACrB,IAAI,CAAC,UAAU;AAAA,IACd,MAAM,IAAI,UACT,+GACD;AAAA,EACD;AAAA,EACA,MAAM,WAAW,QAAQ,YAAY;AAAA,EACrC,IAAI,CAAC,UAAU;AAAA,IACd,MAAM,IAAI,MACT,+LACD;AAAA,EACD;AAAA,EACA,MAAM,aAAa,SAAS;AAAA,EAC5B,MAAM,aAAa,SAAS,KAC3B,CAAC,UAAU,MAAM,IAAI,MAAM,GAAG,EAAE,OAAO,UACxC;AAAA,EACA,OAAO;AAAA,IACN,kBAAkB;AAAA,MACjB,QAAQ,SAAS;AAAA,MACjB,UAAU;AAAA,MACV,QAAQ,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,MACP;AAAA,QACC,SAAS;AAAA,QACT,UAAU;AAAA,QACV,UAAU,aAAa,aAAa;AAAA,MACrC;AAAA,MACA;AAAA,QACC,SAAS;AAAA,QACT,UA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