@alxia/react-router 0.8.1 → 0.10.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 +222 -10
- package/dist/chunks/index-59vhfj6n.js +10 -0
- package/dist/chunks/index-59vhfj6n.js.map +10 -0
- package/dist/chunks/index-5gqcpyyg.js +34 -0
- package/dist/chunks/index-5gqcpyyg.js.map +10 -0
- package/dist/chunks/index-9xv2a8et.js +108 -0
- package/dist/chunks/index-9xv2a8et.js.map +11 -0
- package/dist/chunks/index-mppz0806.js +119 -0
- package/dist/chunks/index-mppz0806.js.map +11 -0
- package/dist/chunks/index-rfr02vg4.js +40 -0
- package/dist/chunks/index-rfr02vg4.js.map +10 -0
- package/dist/chunks/index-zdbqzcjp.js +97 -0
- package/dist/chunks/index-zdbqzcjp.js.map +12 -0
- package/dist/pwa/build/build-worker.d.ts +41 -0
- package/dist/pwa/build/build-worker.d.ts.map +1 -0
- package/dist/pwa/build/index.d.ts +9 -0
- package/dist/pwa/build/index.d.ts.map +1 -0
- package/dist/pwa/build/index.js +9 -0
- package/dist/pwa/build/index.js.map +9 -0
- package/dist/pwa/build/precache.d.ts +17 -0
- package/dist/pwa/build/precache.d.ts.map +1 -0
- package/dist/pwa/index.d.ts +14 -0
- package/dist/pwa/index.d.ts.map +1 -0
- package/dist/pwa/index.js +65 -0
- package/dist/pwa/index.js.map +10 -0
- package/dist/pwa/model/caching.d.ts +46 -0
- package/dist/pwa/model/caching.d.ts.map +1 -0
- package/dist/pwa/model/clear-app-caches.d.ts +9 -0
- package/dist/pwa/model/clear-app-caches.d.ts.map +1 -0
- package/dist/pwa/model/manifest.d.ts +80 -0
- package/dist/pwa/model/manifest.d.ts.map +1 -0
- package/dist/pwa/model/precache-list.d.ts +40 -0
- package/dist/pwa/model/precache-list.d.ts.map +1 -0
- package/dist/pwa/model/registration.d.ts +39 -0
- package/dist/pwa/model/registration.d.ts.map +1 -0
- package/dist/pwa/model/start-service-worker.d.ts +24 -0
- package/dist/pwa/model/start-service-worker.d.ts.map +1 -0
- package/dist/pwa/model/storable.d.ts +8 -0
- package/dist/pwa/model/storable.d.ts.map +1 -0
- package/dist/pwa/model/update-notice.d.ts +38 -0
- package/dist/pwa/model/update-notice.d.ts.map +1 -0
- package/dist/pwa/model/worker-contract.d.ts +61 -0
- package/dist/pwa/model/worker-contract.d.ts.map +1 -0
- package/dist/pwa/react/index.d.ts +9 -0
- package/dist/pwa/react/index.d.ts.map +1 -0
- package/dist/pwa/react/index.js +75 -0
- package/dist/pwa/react/index.js.map +13 -0
- package/dist/pwa/react/use-online.d.ts +6 -0
- package/dist/pwa/react/use-online.d.ts.map +1 -0
- package/dist/pwa/react/use-service-worker.d.ts +33 -0
- package/dist/pwa/react/use-service-worker.d.ts.map +1 -0
- package/dist/pwa/react/use-update-notice.d.ts +14 -0
- package/dist/pwa/react/use-update-notice.d.ts.map +1 -0
- package/dist/pwa/server/index.d.ts +7 -0
- package/dist/pwa/server/index.d.ts.map +1 -0
- package/dist/pwa/server/index.js +18 -0
- package/dist/pwa/server/index.js.map +10 -0
- package/dist/pwa/server/no-cache.d.ts +22 -0
- package/dist/pwa/server/no-cache.d.ts.map +1 -0
- package/dist/pwa/worker/index.d.ts +9 -0
- package/dist/pwa/worker/index.d.ts.map +1 -0
- package/dist/pwa/worker/index.js +144 -0
- package/dist/pwa/worker/index.js.map +12 -0
- package/dist/pwa/worker/injected.d.ts +15 -0
- package/dist/pwa/worker/injected.d.ts.map +1 -0
- package/dist/pwa/worker/plan.d.ts +65 -0
- package/dist/pwa/worker/plan.d.ts.map +1 -0
- package/dist/pwa/worker/scope.d.ts +18 -0
- package/dist/pwa/worker/scope.d.ts.map +1 -0
- package/dist/pwa/worker/start-worker.d.ts +17 -0
- package/dist/pwa/worker/start-worker.d.ts.map +1 -0
- package/dist/vite/index.d.ts +10 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +49 -3
- package/dist/vite/index.js.map +6 -5
- package/dist/vite/runtime.d.ts +1 -1
- package/dist/vite/runtime.d.ts.map +1 -1
- package/dist/vite/worker.d.ts +16 -0
- package/dist/vite/worker.d.ts.map +1 -0
- package/docs/README.md +12 -3
- package/docs/guide/beside-the-pages.md +178 -0
- package/docs/guide/csp-nonce.md +100 -0
- package/docs/guide/customising-the-server.md +292 -0
- package/docs/guide/deploying.md +99 -0
- package/docs/guide/getting-started.md +112 -0
- package/docs/guide/how-it-works.md +268 -0
- package/docs/guide/openapi.md +51 -0
- package/docs/guide/pwa.md +636 -0
- package/docs/guide/testing.md +42 -0
- package/docs/guide/typing-the-loaders.md +311 -0
- package/docs/guide.md +27 -1391
- package/docs/roadmap.md +39 -1
- package/docs/troubleshooting.md +402 -11
- package/package.json +70 -6
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/pwa/worker/start-worker.ts", "../src/pwa/worker/plan.ts", "../src/pwa/worker/scope.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n\tclientsClaim,\n\tsetCacheNameDetails,\n\ttype WorkboxPlugin,\n} from 'workbox-core';\nimport { ExpirationPlugin } from 'workbox-expiration';\nimport * as navigationPreload from 'workbox-navigation-preload';\nimport { matchPrecache, precacheAndRoute } from 'workbox-precaching';\nimport { registerRoute } from 'workbox-routing';\nimport {\n\tCacheFirst,\n\tNetworkOnly,\n\tStaleWhileRevalidate,\n} from 'workbox-strategies';\nimport { injectedPrecache } from './injected';\nimport {\n\tdeleteObsoleteCaches,\n\tisSkipWaiting,\n\tmatcher,\n\tstorableOnly,\n\ttype WorkerOptions,\n\tworkerPlan,\n} from './plan';\nimport { workerScope } from './scope';\n\n/**\n * Starts the service worker on Workbox. Call it once, from the worker's entry.\n *\n * - The precache route is registered first: a precached URL is answered from\n * the precache before any route below. Exact URLs only (`cleanURLs: false`,\n * no directory index), so a page load still goes to the network.\n * - A navigation is never stored: with navigation preload the browser starts\n * the request alongside the worker, and `NetworkOnly` answers with it. The\n * offline page answers only when the network fails, never for an HTTP error.\n * - Hashed bundles are cache-first, other static files stale-while-revalidate;\n * both store only what `isStorable` accepts.\n * - A first install controls the open pages at once; an update waits until\n * the page posts `SKIP_WAITING`.\n */\nexport function startWorker(options: WorkerOptions): void {\n\tconst plan = workerPlan(options, injectedPrecache());\n\tconst scope = workerScope();\n\tconst { contract } = options;\n\tsetCacheNameDetails(plan.cacheNameDetails);\n\tprecacheAndRoute([...plan.precache], {\n\t\tcleanURLs: false,\n\t\tdirectoryIndex: '',\n\t});\n\tif (plan.navigationPreload) navigationPreload.enable();\n\n\tfor (const route of plan.routes) {\n\t\tconst match = matcher(route.caching, () => scope.location.origin, options);\n\t\tif (route.strategy === 'network-only') {\n\t\t\tconst { fallback } = route;\n\t\t\tregisterRoute(\n\t\t\t\tmatch,\n\t\t\t\tnew NetworkOnly({\n\t\t\t\t\tplugins: fallback\n\t\t\t\t\t\t? [{ handlerDidError: async () => matchPrecache(fallback) }]\n\t\t\t\t\t\t: [],\n\t\t\t\t}),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tconst Strategy =\n\t\t\troute.strategy === 'cache-first' ? CacheFirst : StaleWhileRevalidate;\n\t\tregisterRoute(\n\t\t\tmatch,\n\t\t\tnew Strategy({\n\t\t\t\tcacheName: route.cacheName,\n\t\t\t\tplugins: [\n\t\t\t\t\tstorableOnly,\n\t\t\t\t\tnew ExpirationPlugin({\n\t\t\t\t\t\t...route.expiration,\n\t\t\t\t\t\tpurgeOnQuotaError: true,\n\t\t\t\t\t}) as WorkboxPlugin, // ExpirationPlugin's optional hooks are not exact-optional under exactOptionalPropertyTypes; this states it is a plugin.\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t}\n\n\tclientsClaim();\n\tscope.addEventListener('activate', (event) => {\n\t\tevent.waitUntil(deleteObsoleteCaches(contract, caches));\n\t});\n\tscope.addEventListener('message', (event) => {\n\t\tif (isSkipWaiting(event.data)) void scope.skipWaiting();\n\t});\n}\n",
|
|
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
|
+
"/**\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
|
+
],
|
|
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,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UAAU,MAAM,CAAC;AAAA,GACtD;AAAA,EACD,MAAM,iBAAiB,WAAW,CAAC,UAAU;AAAA,IAC5C,IAAI,cAAc,MAAM,IAAI;AAAA,MAAQ,MAAM,YAAY;AAAA,GACtD;AAAA;",
|
|
10
|
+
"debugId": "52EB15D1D020B66D64756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The define key the build sets: the worker's precache list, as JSON. */
|
|
2
|
+
export declare const PRECACHE_DEFINE = "globalThis.__ALXIA_PRECACHE__";
|
|
3
|
+
/** One file the worker precaches: its URL and a revision (`null` when hashed in the name). */
|
|
4
|
+
type Entry = {
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly revision: string | null;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The precache list the build wrote into this worker, or `undefined` when the
|
|
10
|
+
* worker did not go through the build. Read through `globalThis`, so a missing
|
|
11
|
+
* define is `undefined`, never a `ReferenceError`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function injectedPrecache(): readonly Entry[] | undefined;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=injected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injected.d.ts","sourceRoot":"","sources":["../../../src/pwa/worker/injected.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,eAAO,MAAM,eAAe,kCAAkC,CAAC;AAE/D,8FAA8F;AAC9F,KAAK,KAAK,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,KAAK,EAAE,GAAG,SAAS,CAG/D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Caching, type CachingOptions, type RequestFacts } from '../model/caching';
|
|
2
|
+
import type { PrecacheEntry } from '../model/precache-list';
|
|
3
|
+
import { type WorkerContract } from '../model/worker-contract';
|
|
4
|
+
/** How many files, and for how long, a runtime cache keeps. */
|
|
5
|
+
export interface ExpirationOptions {
|
|
6
|
+
maxEntries?: number;
|
|
7
|
+
maxAgeSeconds?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkerOptions {
|
|
10
|
+
/** The app's contract: cache names, offline page, the worker's URL. */
|
|
11
|
+
contract: WorkerContract;
|
|
12
|
+
/** What `cachingFor` reads besides the contract: `never`, `immutable`, `manifestPath`, `serviceWorkerUrl`. */
|
|
13
|
+
caching?: Omit<CachingOptions, 'contract'>;
|
|
14
|
+
/** The hashed bundles' cache. `{ maxEntries: 200 }` by default. */
|
|
15
|
+
assets?: ExpirationOptions;
|
|
16
|
+
/** The other static files' cache. `{ maxEntries: 100, maxAgeSeconds: 30 days }` by default. */
|
|
17
|
+
static?: ExpirationOptions;
|
|
18
|
+
/** Start the worker alongside a page load. `true` by default. */
|
|
19
|
+
navigationPreload?: boolean;
|
|
20
|
+
/** The precache list. By default the one the build wrote into the worker. */
|
|
21
|
+
precache?: readonly PrecacheEntry[];
|
|
22
|
+
}
|
|
23
|
+
export type WorkerRoute = {
|
|
24
|
+
caching: 'navigation';
|
|
25
|
+
strategy: 'network-only';
|
|
26
|
+
fallback: string | undefined;
|
|
27
|
+
} | {
|
|
28
|
+
caching: 'immutable';
|
|
29
|
+
strategy: 'cache-first';
|
|
30
|
+
cacheName: string;
|
|
31
|
+
expiration: ExpirationOptions & {
|
|
32
|
+
maxEntries: number;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
caching: 'static';
|
|
36
|
+
strategy: 'stale-while-revalidate';
|
|
37
|
+
cacheName: string;
|
|
38
|
+
expiration: ExpirationOptions;
|
|
39
|
+
};
|
|
40
|
+
export interface WorkerPlan {
|
|
41
|
+
cacheNameDetails: {
|
|
42
|
+
prefix: string;
|
|
43
|
+
precache: 'precache';
|
|
44
|
+
suffix: string;
|
|
45
|
+
};
|
|
46
|
+
precache: readonly PrecacheEntry[];
|
|
47
|
+
routes: readonly WorkerRoute[];
|
|
48
|
+
navigationPreload: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** What the worker does, decided without Workbox so that it is tested as data. */
|
|
51
|
+
export declare function workerPlan(options: WorkerOptions, injected: readonly PrecacheEntry[] | undefined): WorkerPlan;
|
|
52
|
+
/** Whether a request is answered the way `caching` says. */
|
|
53
|
+
export declare function matcher(caching: Caching, origin: () => string, options: WorkerOptions): (o: {
|
|
54
|
+
request: RequestFacts;
|
|
55
|
+
}) => boolean;
|
|
56
|
+
/** Stores only what `isStorable` accepts: a public, same-origin 200. */
|
|
57
|
+
export declare const storableOnly: {
|
|
58
|
+
cacheWillUpdate({ response, }: {
|
|
59
|
+
response: Response;
|
|
60
|
+
}): Promise<Response | null>;
|
|
61
|
+
};
|
|
62
|
+
export declare function isSkipWaiting(data: unknown): boolean;
|
|
63
|
+
/** Deletes the caches an earlier version of the contract owned. */
|
|
64
|
+
export declare function deleteObsoleteCaches(contract: Pick<WorkerContract, 'obsoleteCaches'>, storage: Pick<CacheStorage, 'keys' | 'delete'>): Promise<void>;
|
|
65
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/pwa/worker/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,cAAc,EAEnB,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE7E,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,a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;AAED,4DAA4D;AAC5D,wBAAgB,OAAO,CACtB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,MAAM,EACpB,OAAO,EAAE,aAAa,GACpB,CAAC,CAAC,EAAE;IAAE,OAAO,EAAE,YAAY,CAAA;CAAE,KAAK,OAAO,CAM3C;AAED,wEAAwE;AACxE,eAAO,MAAM,YAAY;mCAGrB;QACF,QAAQ,EAAE,QAAQ,CAAC;KACnB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAG5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED,mEAAmE;AACnE,wBAAsB,oBAAoB,CACzC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAChD,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of the service worker's global scope that `startWorker` reads,
|
|
3
|
+
* declared here so no WebWorker-only type reaches the package's declarations
|
|
4
|
+
* (the DOM lib has no `ServiceWorkerGlobalScope`).
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkerScope {
|
|
7
|
+
readonly location: {
|
|
8
|
+
readonly origin: string;
|
|
9
|
+
};
|
|
10
|
+
skipWaiting(): Promise<void>;
|
|
11
|
+
addEventListener(type: 'activate' | 'message', listener: (event: {
|
|
12
|
+
data?: unknown;
|
|
13
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
14
|
+
}) => void): void;
|
|
15
|
+
}
|
|
16
|
+
/** The worker's scope. Called only inside `startWorker`, never at module load. */
|
|
17
|
+
export declare const workerScope: () => WorkerScope;
|
|
18
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/pwa/worker/scope.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,gBAAgB,CACf,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE;QACjB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;KAC3C,KAAK,IAAI,GACR,IAAI,CAAC;CACR;AAED,kFAAkF;AAClF,eAAO,MAAM,WAAW,QAAO,WACM,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type WorkerOptions } from './plan';
|
|
2
|
+
/**
|
|
3
|
+
* Starts the service worker on Workbox. Call it once, from the worker's entry.
|
|
4
|
+
*
|
|
5
|
+
* - The precache route is registered first: a precached URL is answered from
|
|
6
|
+
* the precache before any route below. Exact URLs only (`cleanURLs: false`,
|
|
7
|
+
* no directory index), so a page load still goes to the network.
|
|
8
|
+
* - A navigation is never stored: with navigation preload the browser starts
|
|
9
|
+
* the request alongside the worker, and `NetworkOnly` answers with it. The
|
|
10
|
+
* offline page answers only when the network fails, never for an HTTP error.
|
|
11
|
+
* - Hashed bundles are cache-first, other static files stale-while-revalidate;
|
|
12
|
+
* both store only what `isStorable` accepts.
|
|
13
|
+
* - A first install controls the open pages at once; an update waits until
|
|
14
|
+
* the page posts `SKIP_WAITING`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function startWorker(options: WorkerOptions): void;
|
|
17
|
+
//# sourceMappingURL=start-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-worker.d.ts","sourceRoot":"","sources":["../../../src/pwa/worker/start-worker.ts"],"names":[],"mappings":"AAeA,OAAO,EAKN,KAAK,aAAa,EAElB,MAAM,QAAQ,CAAC;AAGhB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAiDxD"}
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
+
import { type AlxiaWorkerOptions } from './worker';
|
|
3
|
+
export type { AlxiaWorkerOptions } from './worker';
|
|
2
4
|
export interface AlxiaOptions {
|
|
3
5
|
/**
|
|
4
6
|
* The server file, relative to Vite's root: a module whose default export
|
|
@@ -7,6 +9,14 @@ export interface AlxiaOptions {
|
|
|
7
9
|
* otherwise `createServer()` with no options.
|
|
8
10
|
*/
|
|
9
11
|
readonly entry?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The service worker, bundled into `build/client/service-worker.js` after
|
|
14
|
+
* `react-router build`, with its precache list: a file relative to Vite's
|
|
15
|
+
* root, or options (`file`, `contract`, `offline`, `precacheAssets`,
|
|
16
|
+
* `minify`). By default `app/service-worker.ts` when it exists, and
|
|
17
|
+
* nothing without it; `false` builds none. Needs Bun.
|
|
18
|
+
*/
|
|
19
|
+
readonly worker?: false | string | AlxiaWorkerOptions;
|
|
10
20
|
}
|
|
11
21
|
/**
|
|
12
22
|
* The Vite plugin that makes alxia the server of a React Router app,
|
package/dist/vite/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAenD,OAAO,EAAE,KAAK,kBAAkB,EAAkB,MAAM,UAAU,CAAC;AAEnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,kBAAkB,CAAC;CACtD;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,CAyExD"}
|
package/dist/vite/index.js
CHANGED
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
PASS_THROUGH,
|
|
4
4
|
serverEntry
|
|
5
5
|
} from "../chunks/index-kfekhvgr.js";
|
|
6
|
+
import {
|
|
7
|
+
buildWorker2
|
|
8
|
+
} from "../chunks/index-mppz0806.js";
|
|
6
9
|
|
|
7
10
|
// src/vite/index.ts
|
|
8
11
|
import { relative as relative3 } from "node:path";
|
|
@@ -368,10 +371,46 @@ function servePreview(server) {
|
|
|
368
371
|
}
|
|
369
372
|
|
|
370
373
|
// src/vite/runtime.ts
|
|
371
|
-
function requireBun(command, hint = `bun --bun ${command}`, onBun = globalThis.Bun !== undefined) {
|
|
374
|
+
function requireBun(command, hint = `bun --bun ${command}`, onBun = globalThis.Bun !== undefined, reason = "and alxia's server runs on Bun") {
|
|
372
375
|
if (onBun)
|
|
373
376
|
return;
|
|
374
|
-
throw new Error(`${NAME}: ${command} is running on Node,
|
|
377
|
+
throw new Error(`${NAME}: ${command} is running on Node, ${reason}. Add a bunfig.toml beside package.json with "[run]" and "bun = true", so bun run starts it on Bun, or run it as ${hint}.`);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/vite/worker.ts
|
|
381
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
382
|
+
import { basename, isAbsolute as isAbsolute2, join as join2, resolve as resolve2 } from "node:path";
|
|
383
|
+
function workerFile(option, config) {
|
|
384
|
+
if (option === false)
|
|
385
|
+
return;
|
|
386
|
+
const named = typeof option === "string" ? option : option?.file;
|
|
387
|
+
if (named !== undefined) {
|
|
388
|
+
const file = isAbsolute2(named) ? named : resolve2(config.root, named);
|
|
389
|
+
if (!existsSync3(file)) {
|
|
390
|
+
throw new Error(`${NAME}: the worker ${named} does not exist. Create it, or leave worker out to build app/service-worker.ts when it exists.`);
|
|
391
|
+
}
|
|
392
|
+
return file;
|
|
393
|
+
}
|
|
394
|
+
const file = join2(contextOf(config).appDirectory, "service-worker.ts");
|
|
395
|
+
return existsSync3(file) ? file : undefined;
|
|
396
|
+
}
|
|
397
|
+
var MB = (bytes) => (bytes / 1024 / 1024).toFixed(2);
|
|
398
|
+
var KB = (bytes) => (bytes / 1024).toFixed(1);
|
|
399
|
+
async function buildAppWorker(config, option) {
|
|
400
|
+
const file = workerFile(option, config);
|
|
401
|
+
if (file === undefined)
|
|
402
|
+
return;
|
|
403
|
+
requireBun("react-router build with a service worker", "bun --bun react-router build", undefined, "and the worker is bundled by Bun.build");
|
|
404
|
+
const rest = typeof option === "object" ? option : {};
|
|
405
|
+
const built = await buildWorker2({
|
|
406
|
+
...rest,
|
|
407
|
+
file,
|
|
408
|
+
root: config.root,
|
|
409
|
+
client: join2(contextOf(config).buildDirectory, "client")
|
|
410
|
+
}).catch((error) => {
|
|
411
|
+
throw new Error(`${NAME}: ${error.message}`, { cause: error });
|
|
412
|
+
});
|
|
413
|
+
config.logger.info(`✓ ${basename(built.file)}: ${built.precache.length} files precached (${MB(built.precacheBytes)} MB), worker ${KB(built.bytes)} kB`);
|
|
375
414
|
}
|
|
376
415
|
|
|
377
416
|
// src/vite/index.ts
|
|
@@ -431,6 +470,13 @@ function alxia(options = {}) {
|
|
|
431
470
|
client: dev ? undefined : clientPath(config)
|
|
432
471
|
});
|
|
433
472
|
},
|
|
473
|
+
buildApp: {
|
|
474
|
+
order: "post",
|
|
475
|
+
async handler() {
|
|
476
|
+
if (config !== undefined)
|
|
477
|
+
await buildAppWorker(config, options.worker);
|
|
478
|
+
}
|
|
479
|
+
},
|
|
434
480
|
configureServer(server) {
|
|
435
481
|
if (!enabled)
|
|
436
482
|
return;
|
|
@@ -449,5 +495,5 @@ export {
|
|
|
449
495
|
alxia
|
|
450
496
|
};
|
|
451
497
|
|
|
452
|
-
//# debugId=
|
|
498
|
+
//# debugId=E568F7B467DCB4A364756E2164756E21
|
|
453
499
|
//# sourceMappingURL=index.js.map
|
package/dist/vite/index.js.map
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/vite/index.ts", "../src/vite/bun.ts", "../src/vite/bundle.ts", "../src/vite/config.ts", "../src/vite/node.ts", "../src/vite/socket.ts", "../src/vite/dev.ts", "../src/vite/preview.ts", "../src/vite/runtime.ts"],
|
|
3
|
+
"sources": ["../src/vite/index.ts", "../src/vite/bun.ts", "../src/vite/bundle.ts", "../src/vite/config.ts", "../src/vite/node.ts", "../src/vite/socket.ts", "../src/vite/dev.ts", "../src/vite/preview.ts", "../src/vite/runtime.ts", "../src/vite/worker.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * `@alxia/react-router/vite`: `alxia()`, the Vite plugin that makes alxia\n * the server of a React Router app, under `react-router dev` and in\n * `react-router build`, with or without an `app/server.ts`.\n */\nimport { relative } from 'node:path';\n// Types only: the plugin runs on whichever Vite the app has, never on a\n// copy of this package's own.\nimport type { Plugin, ResolvedConfig } from 'vite';\nimport { ssrEnvironment } from './bundle';\nimport {\n\tclientPath,\n\tcontextOf,\n\tDEFAULT,\n\tisChildCompiler,\n\tSERVER,\n\tserverBuildOptions,\n\tserverFile,\n} from './config';\nimport { serveDev } from './dev';\nimport { NAME, PASS_THROUGH, serverEntry } from './entry';\nimport { servePreview } from './preview';\nimport { requireBun } from './runtime';\n\nexport interface AlxiaOptions {\n\t/**\n\t * The server file, relative to Vite's root: a module whose default export\n\t * is `createServer()` from `@alxia/react-router`. By default `server.ts`\n\t * in React Router's app directory, `app/server.ts`, when it exists, and\n\t * otherwise `createServer()` with no options.\n\t */\n\treadonly entry?: string;\n}\n\nconst RESOLVED_SERVER = `\\0${SERVER}`;\nconst RESOLVED_DEFAULT = `\\0${DEFAULT}`;\n\n/**\n * Whether there is a server to be: not in the Vite server React Router\n * compiles route modules in, nor in a single-page app. Throws when the\n * server build would be split in several.\n */\nfunction servesApp(resolved: ResolvedConfig): boolean {\n\t// React Router compiles route modules in a Vite server of its own,\n\t// with every plugin but its own: there is nothing to serve there.\n\tif (isChildCompiler(resolved)) return false;\n\tconst rr = contextOf(resolved);\n\t// A single-page app has no server to be.\n\tif (rr.ssr && rr.serverBundles !== undefined) {\n\t\tthrow new Error(\n\t\t\t`${NAME}: serverBundles splits React Router's server build in several, and alxia serves one. Remove serverBundles from react-router.config.ts.`,\n\t\t);\n\t}\n\treturn rr.ssr;\n}\n\n/**\n * The Vite plugin that makes alxia the server of a React Router app,\n * anywhere in `plugins`:\n *\n * ```ts\n * export default defineConfig({ plugins: [alxia(), reactRouter()] });\n * ```\n *\n * - **`react-router dev`**: every request Vite does not answer itself —\n * pages, data, `/api` — goes to the server, loaded through Vite's SSR\n * runner. HMR, an edit to the server, the app's own context keys and\n * its WebSocket routes work, with no restart.\n * - **`react-router build`**: `build/server/index.js` is the server, with\n * React Router's build inside it. `bun build/server/index.js` listens on\n * `PORT` (3000) and `HOST` (`0.0.0.0`); importing it starts nothing.\n * - **`vite preview`**: every request goes to that built server, as it\n * would answer it; so does React Router's prerendering.\n * - **Built for Bun**: the `ssr` environment resolves packages with the\n * `bun` export condition, leaves `bun` and `bun:*` external, and targets\n * `esnext` unless the app set a target. What the app set is kept.\n * - **Self-contained**: `react-router build` bundles every package into\n * `build/server/index.js` (`ssr.noExternal: true`), so `build/` runs with\n * no `node_modules`. `ssr.external` keeps the packages it names external,\n * and `ssr.external: true` all of them.\n *\n * The server is `app/server.ts`'s default export, `createServer()` from\n * `@alxia/react-router`, or without that file `createServer()` as it is.\n */\nexport function alxia(options: AlxiaOptions = {}): Plugin {\n\tlet config: ResolvedConfig | undefined;\n\tlet enabled = true;\n\n\treturn {\n\t\tname: NAME,\n\t\t// Before React Router's plugin, wherever it is listed: its config reads\n\t\t// the server build's input from this one's, and its dev middleware,\n\t\t// which would render the pages without alxia, comes after this one's.\n\t\tenforce: 'pre',\n\t\tconfig(_config, env) {\n\t\t\tif (env.command !== 'build') return;\n\t\t\t// Vite 7's types know neither `rolldownVersion` nor `rolldownOptions`.\n\t\t\tconst meta = this.meta as { readonly rolldownVersion?: string };\n\t\t\tconst bundler = serverBuildOptions(meta.rolldownVersion !== undefined);\n\t\t\treturn { environments: { ssr: { build: bundler as never } } };\n\t\t},\n\t\tconfigEnvironment(name, options, env) {\n\t\t\t// After every config hook, React Router's included: the server\n\t\t\t// environment as the app and the plugins left it, built for Bun.\n\t\t\t// An app that chose `ssr.target: 'webworker'` keeps Vite's own.\n\t\t\tif (name !== 'ssr' || env.isSsrTargetWebworker === true) return;\n\t\t\treturn ssrEnvironment(options, env.command);\n\t\t},\n\t\tconfigResolved(resolved) {\n\t\t\tconfig = resolved;\n\t\t\tenabled = servesApp(resolved);\n\t\t},\n\t\tresolveId(id) {\n\t\t\tif (id === SERVER) return RESOLVED_SERVER;\n\t\t\tif (id === DEFAULT) return RESOLVED_DEFAULT;\n\t\t\treturn undefined;\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== RESOLVED_SERVER && id !== RESOLVED_DEFAULT) return;\n\t\t\tif (config === undefined) return;\n\t\t\t// Disabled, a single-page app: React Router still builds its server\n\t\t\t// build, to render index.html, from this input.\n\t\t\tif (!enabled) return PASS_THROUGH;\n\t\t\tconst dev = config.command === 'serve';\n\t\t\tconst file =\n\t\t\t\tid === RESOLVED_DEFAULT ? undefined : serverFile(options.entry, config);\n\t\t\treturn serverEntry({\n\t\t\t\tfile,\n\t\t\t\tlabel: file === undefined ? '' : relative(config.root, file),\n\t\t\t\tdev,\n\t\t\t\tclient: dev ? undefined : clientPath(config),\n\t\t\t});\n\t\t},\n\t\tconfigureServer(server) {\n\t\t\tif (!enabled) return;\n\t\t\trequireBun('react-router dev');\n\t\t\treturn serveDev(server, options.entry);\n\t\t},\n\t\tconfigurePreviewServer(server) {\n\t\t\tif (!enabled) return;\n\t\t\t// React Router prerenders through a preview server of its own,\n\t\t\t// resolved as `serve` too: the message cannot tell the two apart.\n\t\t\trequireBun(\n\t\t\t\t'vite preview, or a react-router build that prerenders,',\n\t\t\t\t'bun --bun vite preview or bun --bun react-router build',\n\t\t\t);\n\t\t\t// Before Vite's own files: the built server answers every request.\n\t\t\tservePreview(server);\n\t\t},\n\t};\n}\n",
|
|
5
|
+
"/**\n * `@alxia/react-router/vite`: `alxia()`, the Vite plugin that makes alxia\n * the server of a React Router app, under `react-router dev` and in\n * `react-router build`, with or without an `app/server.ts`.\n */\nimport { relative } from 'node:path';\n// Types only: the plugin runs on whichever Vite the app has, never on a\n// copy of this package's own.\nimport type { Plugin, ResolvedConfig } from 'vite';\nimport { ssrEnvironment } from './bundle';\nimport {\n\tclientPath,\n\tcontextOf,\n\tDEFAULT,\n\tisChildCompiler,\n\tSERVER,\n\tserverBuildOptions,\n\tserverFile,\n} from './config';\nimport { serveDev } from './dev';\nimport { NAME, PASS_THROUGH, serverEntry } from './entry';\nimport { servePreview } from './preview';\nimport { requireBun } from './runtime';\nimport { type AlxiaWorkerOptions, buildAppWorker } from './worker';\n\nexport type { AlxiaWorkerOptions } from './worker';\n\nexport interface AlxiaOptions {\n\t/**\n\t * The server file, relative to Vite's root: a module whose default export\n\t * is `createServer()` from `@alxia/react-router`. By default `server.ts`\n\t * in React Router's app directory, `app/server.ts`, when it exists, and\n\t * otherwise `createServer()` with no options.\n\t */\n\treadonly entry?: string;\n\t/**\n\t * The service worker, bundled into `build/client/service-worker.js` after\n\t * `react-router build`, with its precache list: a file relative to Vite's\n\t * root, or options (`file`, `contract`, `offline`, `precacheAssets`,\n\t * `minify`). By default `app/service-worker.ts` when it exists, and\n\t * nothing without it; `false` builds none. Needs Bun.\n\t */\n\treadonly worker?: false | string | AlxiaWorkerOptions;\n}\n\nconst RESOLVED_SERVER = `\\0${SERVER}`;\nconst RESOLVED_DEFAULT = `\\0${DEFAULT}`;\n\n/**\n * Whether there is a server to be: not in the Vite server React Router\n * compiles route modules in, nor in a single-page app. Throws when the\n * server build would be split in several.\n */\nfunction servesApp(resolved: ResolvedConfig): boolean {\n\t// React Router compiles route modules in a Vite server of its own,\n\t// with every plugin but its own: there is nothing to serve there.\n\tif (isChildCompiler(resolved)) return false;\n\tconst rr = contextOf(resolved);\n\t// A single-page app has no server to be.\n\tif (rr.ssr && rr.serverBundles !== undefined) {\n\t\tthrow new Error(\n\t\t\t`${NAME}: serverBundles splits React Router's server build in several, and alxia serves one. Remove serverBundles from react-router.config.ts.`,\n\t\t);\n\t}\n\treturn rr.ssr;\n}\n\n/**\n * The Vite plugin that makes alxia the server of a React Router app,\n * anywhere in `plugins`:\n *\n * ```ts\n * export default defineConfig({ plugins: [alxia(), reactRouter()] });\n * ```\n *\n * - **`react-router dev`**: every request Vite does not answer itself —\n * pages, data, `/api` — goes to the server, loaded through Vite's SSR\n * runner. HMR, an edit to the server, the app's own context keys and\n * its WebSocket routes work, with no restart.\n * - **`react-router build`**: `build/server/index.js` is the server, with\n * React Router's build inside it. `bun build/server/index.js` listens on\n * `PORT` (3000) and `HOST` (`0.0.0.0`); importing it starts nothing.\n * - **`vite preview`**: every request goes to that built server, as it\n * would answer it; so does React Router's prerendering.\n * - **Built for Bun**: the `ssr` environment resolves packages with the\n * `bun` export condition, leaves `bun` and `bun:*` external, and targets\n * `esnext` unless the app set a target. What the app set is kept.\n * - **Self-contained**: `react-router build` bundles every package into\n * `build/server/index.js` (`ssr.noExternal: true`), so `build/` runs with\n * no `node_modules`. `ssr.external` keeps the packages it names external,\n * and `ssr.external: true` all of them.\n *\n * The server is `app/server.ts`'s default export, `createServer()` from\n * `@alxia/react-router`, or without that file `createServer()` as it is.\n */\nexport function alxia(options: AlxiaOptions = {}): Plugin {\n\tlet config: ResolvedConfig | undefined;\n\tlet enabled = true;\n\n\treturn {\n\t\tname: NAME,\n\t\t// Before React Router's plugin, wherever it is listed: its config reads\n\t\t// the server build's input from this one's, and its dev middleware,\n\t\t// which would render the pages without alxia, comes after this one's.\n\t\tenforce: 'pre',\n\t\tconfig(_config, env) {\n\t\t\tif (env.command !== 'build') return;\n\t\t\t// Vite 7's types know neither `rolldownVersion` nor `rolldownOptions`.\n\t\t\tconst meta = this.meta as { readonly rolldownVersion?: string };\n\t\t\tconst bundler = serverBuildOptions(meta.rolldownVersion !== undefined);\n\t\t\treturn { environments: { ssr: { build: bundler as never } } };\n\t\t},\n\t\tconfigEnvironment(name, options, env) {\n\t\t\t// After every config hook, React Router's included: the server\n\t\t\t// environment as the app and the plugins left it, built for Bun.\n\t\t\t// An app that chose `ssr.target: 'webworker'` keeps Vite's own.\n\t\t\tif (name !== 'ssr' || env.isSsrTargetWebworker === true) return;\n\t\t\treturn ssrEnvironment(options, env.command);\n\t\t},\n\t\tconfigResolved(resolved) {\n\t\t\tconfig = resolved;\n\t\t\tenabled = servesApp(resolved);\n\t\t},\n\t\tresolveId(id) {\n\t\t\tif (id === SERVER) return RESOLVED_SERVER;\n\t\t\tif (id === DEFAULT) return RESOLVED_DEFAULT;\n\t\t\treturn undefined;\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== RESOLVED_SERVER && id !== RESOLVED_DEFAULT) return;\n\t\t\tif (config === undefined) return;\n\t\t\t// Disabled, a single-page app: React Router still builds its server\n\t\t\t// build, to render index.html, from this input.\n\t\t\tif (!enabled) return PASS_THROUGH;\n\t\t\tconst dev = config.command === 'serve';\n\t\t\tconst file =\n\t\t\t\tid === RESOLVED_DEFAULT ? undefined : serverFile(options.entry, config);\n\t\t\treturn serverEntry({\n\t\t\t\tfile,\n\t\t\t\tlabel: file === undefined ? '' : relative(config.root, file),\n\t\t\t\tdev,\n\t\t\t\tclient: dev ? undefined : clientPath(config),\n\t\t\t});\n\t\t},\n\t\tbuildApp: {\n\t\t\t// After React Router's builder: its client build, the one the worker reads.\n\t\t\torder: 'post',\n\t\t\tasync handler() {\n\t\t\t\tif (config !== undefined) await buildAppWorker(config, options.worker);\n\t\t\t},\n\t\t},\n\t\tconfigureServer(server) {\n\t\t\tif (!enabled) return;\n\t\t\trequireBun('react-router dev');\n\t\t\treturn serveDev(server, options.entry);\n\t\t},\n\t\tconfigurePreviewServer(server) {\n\t\t\tif (!enabled) return;\n\t\t\t// React Router prerenders through a preview server of its own,\n\t\t\t// resolved as `serve` too: the message cannot tell the two apart.\n\t\t\trequireBun(\n\t\t\t\t'vite preview, or a react-router build that prerenders,',\n\t\t\t\t'bun --bun vite preview or bun --bun react-router build',\n\t\t\t);\n\t\t\t// Before Vite's own files: the built server answers every request.\n\t\t\tservePreview(server);\n\t\t},\n\t};\n}\n",
|
|
6
6
|
"/**\n * The server build, for Bun: what the plugin adds to Vite's `ssr`\n * environment so that `build/server/index.js` is built for the runtime\n * that runs it, and so is the module the dev server loads.\n */\nimport { builtinModules } from 'node:module';\nimport type { EnvironmentOptions } from 'vite';\n\n/** The export condition Bun resolves a package by, and the plugin adds. */\nconst BUN_CONDITION = 'bun';\n\n/**\n * Vite's own builtins for a server environment (its `nodeLikeBuiltins`),\n * which it uses when the config names none: Node's modules, `node:*` and\n * `bun:*`. Bare `bun` is among Node's modules only when Vite runs on Bun.\n */\nconst VITE_BUILTINS: readonly (string | RegExp)[] = [\n\t...builtinModules.filter((id) => !id.includes(':')),\n\t/^node:/,\n\t/^bun:/,\n];\n\n/**\n * Vite's default conditions for a server environment, and for its\n * externals, which it uses when the config names none. React Router's\n * plugin always names them; these are for a config where nothing did.\n */\nconst VITE_CONDITIONS = ['module', 'node', 'development|production'];\nconst VITE_EXTERNAL_CONDITIONS = ['node', 'module-sync'];\n\n/** Bun's own modules, which no bundler should try to resolve: `bun` and `bun:*`. */\nconst BUN_BUILTINS: readonly (string | RegExp)[] = [BUN_CONDITION, /^bun:/];\n\n/**\n * What to merge into `present` so that it holds `wanted`: Vite replaces its\n * default with any value set, so an unset option gets the default too.\n * Strings compare by value, patterns by source.\n */\nfunction adding<T extends string | RegExp>(\n\tpresent: readonly T[] | undefined,\n\tfallback: readonly T[],\n\twanted: readonly T[],\n): T[] {\n\tconst list = present ?? fallback;\n\tconst has = (item: T) =>\n\t\tlist.some((other) =>\n\t\t\ttypeof item === 'string'\n\t\t\t\t? other === item\n\t\t\t\t: other instanceof RegExp && other.source === item.source,\n\t\t);\n\treturn [\n\t\t...(present === undefined ? fallback : []),\n\t\t...wanted.filter((item) => !has(item)),\n\t];\n}\n\n/**\n * What the plugin adds to the `ssr` environment, given its options as the\n * config and every plugin's `config` hook left them. Vite merges the\n * result into them, concatenating arrays, so what the app set is kept:\n *\n * - `resolve.conditions` and `resolve.externalConditions` gain `bun`, so a\n * package that exports a `bun` variant is bundled, and checked, as Bun\n * would load it. Which variant wins stays the package's own order.\n * - `resolve.builtins` gains `bun` and `bun:*`: left external, whichever\n * runtime runs Vite. Vite's own builtins are kept when the app names none.\n * - `build.target` is `esnext`, Bun's, unless the app set one, at the top\n * level or on the environment.\n *\n * `ssr.target` stays `node`: Bun runs Node's modules, and `webworker`\n * would bundle every dependency with the browser's conditions. An app that\n * sets `webworker` itself gets none of this: the plugin leaves that\n * environment to Vite's own defaults.\n */\nexport function bunEnvironment(\n\toptions: EnvironmentOptions,\n): EnvironmentOptions {\n\tconst resolve = options.resolve ?? {};\n\tconst added: EnvironmentOptions = {\n\t\tresolve: {\n\t\t\tconditions: adding(resolve.conditions, VITE_CONDITIONS, [BUN_CONDITION]),\n\t\t\texternalConditions: adding(\n\t\t\t\tresolve.externalConditions,\n\t\t\t\tVITE_EXTERNAL_CONDITIONS,\n\t\t\t\t[BUN_CONDITION],\n\t\t\t),\n\t\t\tbuiltins: adding(resolve.builtins, VITE_BUILTINS, BUN_BUILTINS),\n\t\t},\n\t};\n\tif (options.build?.target === undefined) {\n\t\tadded.build = { target: 'esnext' };\n\t}\n\treturn added;\n}\n",
|
|
7
7
|
"/**\n * The server build, self-contained: every dependency bundled into\n * `build/server/index.js`, so that running it needs `build/` and Bun, and\n * no `node_modules`. A Docker image's final stage copies `build/` alone.\n */\nimport type { EnvironmentOptions } from 'vite';\nimport { bunEnvironment } from './bun';\n\n/**\n * What the plugin adds to the `ssr` environment under `react-router build`,\n * given its options as the config and the plugins left them:\n * `resolve.noExternal: true`, every package bundled. Never in dev, where\n * Vite's SSR runner loads the packages from `node_modules`.\n *\n * What the app set wins:\n *\n * - `ssr.external: ['sharp']`, or the same on `environments.ssr.resolve`,\n * keeps those packages external, imported from `node_modules` at\n * runtime: Vite reads `external` before `noExternal`. Bun's own modules,\n * `bun` and `bun:*`, and Node's are builtins, external whatever this says.\n * - `ssr.external: true` keeps every package external, Vite's own default:\n * the plugin adds nothing then.\n * - `ssr.noExternal`, a list, is a subset of everything: it changes nothing.\n *\n * React Router's own plugin reads `noExternal: true` and adds no externals\n * of its own; it runs after this one, which is `enforce: 'pre'`.\n */\nexport function bundledEnvironment(\n\toptions: EnvironmentOptions,\n): EnvironmentOptions | undefined {\n\tif (options.resolve?.external === true) return undefined;\n\treturn { resolve: { noExternal: true } };\n}\n\n/**\n * Everything the plugin adds to the `ssr` environment: built for Bun under\n * either command, and self-contained under `build` alone. In dev, Vite's\n * SSR runner loads the packages from `node_modules`.\n */\nexport function ssrEnvironment(\n\toptions: EnvironmentOptions,\n\tcommand: 'build' | 'serve',\n): EnvironmentOptions {\n\tconst added = bunEnvironment(options);\n\tconst bundled = command === 'build' ? bundledEnvironment(options) : undefined;\n\tif (bundled === undefined) return added;\n\treturn { ...added, resolve: { ...added.resolve, ...bundled.resolve } };\n}\n",
|
|
8
8
|
"/**\n * What the plugin reads of Vite's and React Router's config: the server\n * file, the client folder, and the server build's bundler options.\n */\nimport { existsSync } from 'node:fs';\nimport { dirname, isAbsolute, join, relative, resolve } from 'node:path';\nimport type { ResolvedConfig } from 'vite';\nimport { NAME } from './entry';\n\n/** The server build's input, and in dev the module the requests go to. */\nexport const SERVER = 'virtual:alxia-react-router/server';\n/** The same, when there is no server file: `createServer()` as it is. */\nexport const DEFAULT = `${SERVER}-default`;\n\n/** What the plugin reads of React Router's own config. */\nexport interface ReactRouterConfig {\n\treadonly appDirectory: string;\n\treadonly buildDirectory: string;\n\treadonly serverBuildFile: string;\n\treadonly ssr: boolean;\n\treadonly serverBundles?: unknown;\n}\n\n/** React Router's config, which its plugin puts on Vite's. */\nexport function contextOf(config: object): ReactRouterConfig {\n\tconst context = (\n\t\tconfig as {\n\t\t\treadonly __reactRouterPluginContext?: {\n\t\t\t\treadonly reactRouterConfig: ReactRouterConfig;\n\t\t\t};\n\t\t}\n\t).__reactRouterPluginContext;\n\tif (context === undefined) {\n\t\tthrow new Error(\n\t\t\t`${NAME}: React Router's Vite plugin is not in this config. Add reactRouter() from @react-router/dev/vite beside alxia() in vite.config.ts.`,\n\t\t);\n\t}\n\treturn context.reactRouterConfig;\n}\n\n/** React Router's child compiler: a Vite server without its plugin, cached apart. */\nexport function isChildCompiler(config: ResolvedConfig): boolean {\n\treturn (\n\t\t(config as { readonly __reactRouterPluginContext?: unknown })\n\t\t\t.__reactRouterPluginContext === undefined &&\n\t\tconfig.cacheDir.endsWith('.vite-child-compiler')\n\t);\n}\n\n/**\n * The server file: `entry`, which must exist, or `app/server.ts` when it\n * does, or `undefined` for the default server.\n */\nexport function serverFile(\n\tentry: string | undefined,\n\tconfig: ResolvedConfig,\n): string | undefined {\n\tif (entry !== undefined) {\n\t\tconst file = isAbsolute(entry) ? entry : resolve(config.root, entry);\n\t\tif (!existsSync(file)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${NAME}: the entry ${entry} does not exist. Create it, or leave entry out to use app/server.ts, or the default server without it.`,\n\t\t\t);\n\t\t}\n\t\treturn file;\n\t}\n\tconst file = join(contextOf(config).appDirectory, 'server.ts');\n\treturn existsSync(file) ? file : undefined;\n}\n\n/** The built server, absolute: `build/server/index.js`. */\nexport function serverBuildPath(config: ResolvedConfig): string {\n\tconst rr = contextOf(config);\n\tconst outDir = resolve(\n\t\tconfig.root,\n\t\tconfig.environments['ssr']?.build.outDir ??\n\t\t\tjoin(rr.buildDirectory, 'server'),\n\t);\n\treturn join(outDir, rr.serverBuildFile);\n}\n\n/** `build/client`, relative to the built `build/server/index.js`. */\nexport function clientPath(config: ResolvedConfig): string {\n\tconst built = dirname(serverBuildPath(config));\n\tconst path = relative(\n\t\tbuilt,\n\t\tjoin(contextOf(config).buildDirectory, 'client'),\n\t);\n\treturn path.startsWith('.') ? path : `./${path}`;\n}\n\n/**\n * The ssr build's options: one file, `build/server/index.js`, the server\n * and React Router's build together. Rolldown, under Vite 8, names the\n * option otherwise.\n */\nexport function serverBuildOptions(rolldown: boolean): object {\n\treturn rolldown\n\t\t? {\n\t\t\t\trolldownOptions: {\n\t\t\t\t\tinput: SERVER,\n\t\t\t\t\toutput: { codeSplitting: false },\n\t\t\t\t},\n\t\t\t}\n\t\t: {\n\t\t\t\trollupOptions: {\n\t\t\t\t\tinput: SERVER,\n\t\t\t\t\toutput: { inlineDynamicImports: true },\n\t\t\t\t},\n\t\t\t};\n}\n",
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
"/**\n * Under `react-router dev` and `vite preview`: the app's WebSocket routes. Vite's server is a\n * `node:http` one, and an alxia socket is `Bun.serve`'s upgrade, so each\n * upgrade Vite leaves is relayed, bytes as they come, to a `Bun.serve` of\n * the app's own on a loopback port: its middlewares, its validation, its socket\n * handlers, exactly as `listen` runs them.\n */\nimport type { IncomingMessage } from 'node:http';\nimport { connect, type Socket } from 'node:net';\nimport type { DevApp } from './dev';\nimport { NAME } from './entry';\n\n/** The subprotocols of Vite's own socket, the HMR one and its ping: Vite answers them. */\nconst VITE = new Set(['vite-hmr', 'vite-ping']);\n\n/** Whether the upgrade asks for Vite's own socket. */\nexport function isVites(req: Pick<IncomingMessage, 'headers'>): boolean {\n\tconst protocols = req.headers['sec-websocket-protocol'];\n\tif (protocols === undefined) return false;\n\treturn protocols.split(',').some((protocol) => VITE.has(protocol.trim()));\n}\n\n/** One entry of Vite's `server.proxy`, as far as its sockets go. */\ntype ProxyEntry = string | { readonly ws?: boolean; readonly target?: unknown };\n\n/**\n * Whether Vite's `server.proxy` relays this upgrade itself: an entry whose\n * context matches the URL, as Vite matches it (`^…` a RegExp, otherwise a\n * prefix), and that proxies sockets (`ws: true`, or a `ws:`/`wss:` target).\n */\nexport function isProxied(\n\turl: string,\n\tproxy: Readonly<Record<string, ProxyEntry>> | undefined,\n): boolean {\n\tfor (const [context, entry] of Object.entries(proxy ?? {})) {\n\t\tconst matches =\n\t\t\t(context.startsWith('^') && new RegExp(context).test(url)) ||\n\t\t\turl.startsWith(context);\n\t\tif (!matches) continue;\n\t\tconst options = typeof entry === 'string' ? { target: entry } : entry;\n\t\tconst target = String(options.target ?? '');\n\t\tif (\n\t\t\toptions.ws === true ||\n\t\t\ttarget.startsWith('ws:') ||\n\t\t\ttarget.startsWith('wss:')\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/** The request line and headers of `req`, as they came: what the side server reads. */\nexport function head(\n\treq: Pick<IncomingMessage, 'method' | 'url' | 'rawHeaders'>,\n): string {\n\tconst lines = [`${req.method ?? 'GET'} ${req.url ?? '/'} HTTP/1.1`];\n\tconst raw = req.rawHeaders;\n\tfor (let i = 0; i + 1 < raw.length; i += 2) {\n\t\tlines.push(`${raw[i]}: ${raw[i + 1]}`);\n\t}\n\treturn `${lines.join('\\r\\n')}\\r\\n\\r\\n`;\n}\n\n/** The side servers: the current app's, and those an edit retired, until their sockets close. */\nexport interface Sides {\n\tcurrent:\n\t\t| { readonly app: DevApp; readonly side: Bun.Server<unknown> }\n\t\t| undefined;\n\treadonly retired: Set<Bun.Server<unknown>>;\n}\n\n/**\n * The side server of `app`, started on its first upgrade. A new app, an\n * edit's, retires the previous one: no new connection, and the sockets open\n * on it stay, with the handlers they opened with, until they close.\n */\nexport function sideFor(sides: Sides, app: DevApp): Bun.Server<unknown> {\n\tif (sides.current?.app === app) return sides.current.side;\n\tconst side = Bun.serve({\n\t\tport: 0,\n\t\thostname: '127.0.0.1',\n\t\tfetch: (request, bun) => app.fetch(request, bun),\n\t\twebsocket: app.websocket,\n\t} as Bun.Serve.Options<never>) as Bun.Server<unknown>;\n\tconst old = sides.current?.side;\n\tif (old !== undefined) {\n\t\tsides.retired.add(old);\n\t\tvoid old.stop().then(() => sides.retired.delete(old));\n\t}\n\tsides.current = { app, side };\n\treturn side;\n}\n\n/** Stops every side server, open sockets and all: Vite's server closed. */\nexport function closeAll(sides: Sides): void {\n\tfor (const side of [...sides.retired, sides.current?.side]) {\n\t\tvoid side?.stop(true);\n\t}\n\tsides.current = undefined;\n\tsides.retired.clear();\n}\n\n/** Relays the upgrade on `socket` to the side server on `port`, both ways. */\nfunction relay(\n\treq: IncomingMessage,\n\tsocket: Socket,\n\tbytes: Buffer,\n\tport: number,\n): void {\n\tconst upstream = connect(port, '127.0.0.1', () => {\n\t\tupstream.write(head(req));\n\t\tif (bytes.length > 0) upstream.write(bytes);\n\t\tupstream.pipe(socket);\n\t\tsocket.pipe(upstream);\n\t});\n\tupstream.on('error', () => socket.destroy());\n\tupstream.on('close', () => socket.destroy());\n\tsocket.on('close', () => upstream.destroy());\n}\n\n/** The side server of an app, which its sockets are open on: what `bridgeSockets` returns. */\nexport type SideOf = (app: DevApp) => Bun.Server<unknown> | undefined;\n\n/** What the relay listens to on Vite's HTTP server, HTTP/1 or HTTP/2 alike. */\ninterface Upgrades {\n\ton(\n\t\tevent: 'upgrade',\n\t\tlistener: (req: IncomingMessage, socket: Socket, bytes: Buffer) => void,\n\t): unknown;\n\tonce(event: 'close', listener: () => void): unknown;\n}\n\n/** What the relay needs of the server it listens on: Vite's dev server or its preview. */\nexport interface Bridge {\n\t/** Vite's `server.proxy` (or `preview.proxy`): the upgrades it relays are its own. */\n\treadonly proxy: Readonly<Record<string, ProxyEntry>> | undefined;\n\t/** The app, as it is now. */\n\treadonly load: () => Promise<DevApp>;\n\t/** Where an upgrade that failed is printed: Vite's logger. */\n\treadonly logger: { error(message: string): void };\n\t/** Maps an error's stack to the source, as Vite's `ssrFixStacktrace` does. */\n\treadonly fix?: (error: Error) => void;\n}\n\n/** An upgrade the app could not take: reported, and a 500 to the client. */\nfunction refuse(bridge: Bridge, socket: Socket, error: unknown): void {\n\tif (error instanceof Error) bridge.fix?.(error);\n\tbridge.logger.error(\n\t\t`${NAME}: a WebSocket upgrade failed: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}`,\n\t);\n\tif (socket.writable) {\n\t\tsocket.end(\n\t\t\t'HTTP/1.1 500 Internal Server Error\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n',\n\t\t);\n\t}\n}\n\n/**\n * Relays the app's upgrades on Vite's HTTP server to a side server of the\n * app. Vite's own socket and the sockets its proxy relays are left to\n * Vite. Without an HTTP server (Vite's middleware mode), there is nothing\n * to listen on.\n *\n * Returns the side server of an app, for its HTTP requests' `ctx.server`:\n * the server its sockets are open on, so that a `publish` from a loader or\n * an action reaches them. `undefined` in middleware mode, and once Vite's\n * server closed.\n */\nexport function bridgeSockets(http: Upgrades | null, bridge: Bridge): SideOf {\n\tif (http === null) return () => undefined;\n\tconst sides: Sides = { current: undefined, retired: new Set() };\n\tlet closed = false;\n\thttp.on('upgrade', (req: IncomingMessage, socket: Socket, bytes: Buffer) => {\n\t\tif (isVites(req) || isProxied(req.url ?? '/', bridge.proxy)) return;\n\t\tsocket.on('error', () => socket.destroy());\n\t\tbridge\n\t\t\t.load()\n\t\t\t.then((app) => {\n\t\t\t\tif (socket.destroyed) return;\n\t\t\t\trelay(req, socket, bytes, sideFor(sides, app).port as number);\n\t\t\t})\n\t\t\t.catch((error: unknown) => refuse(bridge, socket, error));\n\t});\n\thttp.once('close', () => {\n\t\tclosed = true;\n\t\tcloseAll(sides);\n\t});\n\treturn (app) => (closed ? undefined : sideFor(sides, app));\n}\n",
|
|
11
11
|
"/**\n * Under `react-router dev`: a request Vite left, answered by the server,\n * loaded through the ssr environment's module runner.\n */\nimport type { ViteDevServer } from 'vite';\nimport { DEFAULT, SERVER, serverFile } from './config';\nimport { NAME } from './entry';\nimport { send, toRequest } from './node';\nimport { bridgeSockets, type SideOf } from './socket';\n\n/** What the dev server module exports: the alxia app, as `server.create` made it. */\nexport interface DevApp {\n\tfetch(request: Request, server?: Bun.Server<unknown>): Promise<Response>;\n\treadonly websocket: Bun.WebSocketHandler<never>;\n}\n\n/**\n * The app, as the server file is now: the runner keeps the module until an\n * edit invalidates it, so an edit is a new app.\n */\nexport async function loadApp(\n\tserver: ViteDevServer,\n\tentry: string | undefined,\n): Promise<DevApp> {\n\t// Duck-typed rather than Vite's `isRunnableDevEnvironment`: the app's\n\t// Vite may be another copy than the one this package would import.\n\tconst runner = (\n\t\tserver.environments.ssr as\n\t\t\t| { readonly runner?: { readonly import?: unknown } }\n\t\t\t| undefined\n\t)?.runner;\n\tif (typeof runner?.import !== 'function') {\n\t\tthrow new Error(\n\t\t\t`${NAME}: Vite's ssr environment does not run modules in this process, so the server cannot be loaded.`,\n\t\t);\n\t}\n\t// Chosen on each request: a server file created or deleted while the\n\t// dev server runs is used from the next one.\n\tconst id = serverFile(entry, server.config) === undefined ? DEFAULT : SERVER;\n\tconst module = (await (runner.import as (id: string) => Promise<unknown>)(\n\t\tid,\n\t)) as { readonly default: DevApp };\n\treturn module.default;\n}\n\n/**\n * One request Vite left, answered by the app as the server file is now,\n * given the side server its sockets are open on as `ctx.server`.\n */\nexport async function serveFromEntry(\n\tserver: ViteDevServer,\n\tentry: string | undefined,\n\tsideOf: SideOf,\n\treq: Parameters<typeof toRequest>[0],\n\tres: Parameters<typeof toRequest>[1],\n): Promise<void> {\n\tconst app = await loadApp(server, entry);\n\tawait send(res, await app.fetch(toRequest(req, res), sideOf(app)));\n}\n\n/**\n * `react-router dev`: the app's sockets on Vite's server now, and, returned\n * for after Vite's own middlewares, every request Vite leaves to the app.\n */\nexport function serveDev(\n\tserver: ViteDevServer,\n\tentry: string | undefined,\n): () => void {\n\tconst sideOf = bridgeSockets(server.httpServer, {\n\t\tproxy: server.config.server.proxy,\n\t\tload: () => loadApp(server, entry),\n\t\tlogger: server.config.logger,\n\t\tfix: (error) => server.ssrFixStacktrace(error),\n\t});\n\treturn () => {\n\t\tserver.middlewares.use((req, res, next) => {\n\t\t\tserveFromEntry(server, entry, sideOf, req, res).catch(\n\t\t\t\t(error: unknown) => {\n\t\t\t\t\tif (error instanceof Error) server.ssrFixStacktrace(error);\n\t\t\t\t\tnext(error);\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\t};\n}\n",
|
|
12
12
|
"/**\n * Under `vite preview`, and React Router's prerendering, which runs on it:\n * every request goes to the built server, `build/server/index.js`'s\n * default export, as `bun build/server/index.js` would answer it — its\n * middlewares, its `/api`, the client's files and the pages.\n */\nimport { existsSync } from 'node:fs';\nimport { relative } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { PreviewServer } from 'vite';\nimport { serverBuildPath } from './config';\nimport type { DevApp } from './dev';\nimport { NAME } from './entry';\nimport { send, toRequest } from './node';\nimport { bridgeSockets } from './socket';\n\n/** What the built server's default export is: the alxia app. */\ninterface Fetcher {\n\tfetch(\n\t\trequest: Request,\n\t\tserver?: Bun.Server<unknown>,\n\t): Response | Promise<Response>;\n}\n\n/** The built server's app, or an error saying why there is none. */\nasync function load(file: string, label: string): Promise<Fetcher> {\n\tif (!existsSync(file)) {\n\t\tthrow new Error(\n\t\t\t`${NAME}: ${label} does not exist. Run react-router build before vite preview.`,\n\t\t);\n\t}\n\tconst module = (await import(pathToFileURL(file).href)) as {\n\t\treadonly default?: Partial<Fetcher>;\n\t};\n\tif (typeof module.default?.fetch !== 'function') {\n\t\tthrow new Error(\n\t\t\t`${NAME}: ${label} is not alxia's server: its default export has no fetch. Build it with alxia() in vite.config.ts's plugins, then run vite preview again.`,\n\t\t);\n\t}\n\treturn module.default as Fetcher;\n}\n\n/**\n * Hands every request to the built server, before Vite's own files: the\n * app serves `build/client` itself, with its middlewares and cache headers. Its\n * WebSocket routes connect too, relayed as under `react-router dev`.\n */\nexport function servePreview(server: PreviewServer): void {\n\tconst file = serverBuildPath(server.config);\n\tconst label = relative(server.config.root, file);\n\t// Loaded on the first request, as `bun build/server/index.js` would be\n\t// at startup; a failed load is tried again on the next, after a build.\n\tlet app: Promise<Fetcher> | undefined;\n\tconst current = (): Promise<Fetcher> => {\n\t\tapp ??= load(file, label);\n\t\treturn app;\n\t};\n\tconst sideOf = bridgeSockets(server.httpServer, {\n\t\tproxy: server.config.preview.proxy,\n\t\t// The built server's default export is the alxia app, `websocket` and all.\n\t\tload: () =>\n\t\t\tcurrent().catch((error: unknown) => {\n\t\t\t\tapp = undefined;\n\t\t\t\tthrow error;\n\t\t\t}) as Promise<DevApp>,\n\t\tlogger: server.config.logger,\n\t});\n\tserver.middlewares.use((req, res, next) => {\n\t\tcurrent().then(\n\t\t\tasync (loaded) => {\n\t\t\t\ttry {\n\t\t\t\t\t// The side server its sockets are open on, as `ctx.server`:\n\t\t\t\t\t// the built app, `websocket` and all, as `load` above reads it.\n\t\t\t\t\tconst side = sideOf(loaded as DevApp);\n\t\t\t\t\tawait send(res, await loaded.fetch(toRequest(req, res), side));\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Mid-body, the response has started: end it rather than answer twice.\n\t\t\t\t\tif (res.headersSent) res.destroy(error as Error);\n\t\t\t\t\telse next(error);\n\t\t\t\t}\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tapp = undefined;\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tserver.config.logger.error(message);\n\t\t\t\tres.statusCode = 500;\n\t\t\t\tres.setHeader('content-type', 'text/plain; charset=utf-8');\n\t\t\t\tres.end(message);\n\t\t\t},\n\t\t);\n\t});\n}\n",
|
|
13
|
-
"import { NAME } from './entry';\n\n/**\n * Refuses, with what to do, a dev or preview server running on Node. The\n * React Router CLI's `#!/usr/bin/env node` runs it on Node whenever a node\n * is installed, even from `bun run dev`, and alxia's server then fails on\n * its first request with `ReferenceError: Bun is not defined`.\n */\nexport function requireBun(\n\tcommand: string,\n\thint = `bun --bun ${command}`,\n\tonBun = (globalThis as { Bun?: unknown }).Bun !== undefined,\n): void {\n\tif (onBun) return;\n\tthrow new Error(\n\t\t`${NAME}: ${command} is running on Node,
|
|
13
|
+
"import { NAME } from './entry';\n\n/**\n * Refuses, with what to do, a dev or preview server running on Node. The\n * React Router CLI's `#!/usr/bin/env node` runs it on Node whenever a node\n * is installed, even from `bun run dev`, and alxia's server then fails on\n * its first request with `ReferenceError: Bun is not defined`.\n */\nexport function requireBun(\n\tcommand: string,\n\thint = `bun --bun ${command}`,\n\tonBun = (globalThis as { Bun?: unknown }).Bun !== undefined,\n\treason = \"and alxia's server runs on Bun\",\n): void {\n\tif (onBun) return;\n\tthrow new Error(\n\t\t`${NAME}: ${command} is running on Node, ${reason}. Add a bunfig.toml beside package.json with \"[run]\" and \"bun = true\", so bun run starts it on Bun, or run it as ${hint}.`,\n\t);\n}\n",
|
|
14
|
+
"/**\n * The service worker, built by `alxia()` once React Router has built the\n * client: `app/service-worker.ts` is the opt-in, as `app/server.ts` is.\n */\nimport { existsSync } from 'node:fs';\nimport { basename, isAbsolute, join, resolve } from 'node:path';\nimport type { ResolvedConfig } from 'vite';\nimport { type BuildWorkerOptions, buildWorker } from '../pwa/build';\nimport { contextOf } from './config';\nimport { NAME } from './entry';\nimport type { AlxiaOptions } from './index';\nimport { requireBun } from './runtime';\n\n/** `buildWorker()`'s options but where: the plugin knows the root, the client build and, by default, the file. */\nexport type AlxiaWorkerOptions = Omit<\n\tBuildWorkerOptions,\n\t'root' | 'client' | 'file'\n> & { readonly file?: string };\n\n/**\n * The worker's source, absolute, or `undefined` when there is none to\n * build: `worker: false`, or no `app/service-worker.ts` and no named file.\n * Throws when a named file does not exist.\n */\nexport function workerFile(\n\toption: AlxiaOptions['worker'],\n\tconfig: ResolvedConfig,\n): string | undefined {\n\tif (option === false) return undefined;\n\tconst named = typeof option === 'string' ? option : option?.file;\n\tif (named !== undefined) {\n\t\tconst file = isAbsolute(named) ? named : resolve(config.root, named);\n\t\tif (!existsSync(file)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${NAME}: the worker ${named} does not exist. Create it, or leave worker out to build app/service-worker.ts when it exists.`,\n\t\t\t);\n\t\t}\n\t\treturn file;\n\t}\n\tconst file = join(contextOf(config).appDirectory, 'service-worker.ts');\n\treturn existsSync(file) ? file : undefined;\n}\n\nconst MB = (bytes: number) => (bytes / 1024 / 1024).toFixed(2);\nconst KB = (bytes: number) => (bytes / 1024).toFixed(1);\n\n/** Builds the worker into `build/client`, if the app has one. */\nexport async function buildAppWorker(\n\tconfig: ResolvedConfig,\n\toption: AlxiaOptions['worker'],\n): Promise<void> {\n\tconst file = workerFile(option, config);\n\tif (file === undefined) return;\n\trequireBun(\n\t\t'react-router build with a service worker',\n\t\t'bun --bun react-router build',\n\t\tundefined,\n\t\t'and the worker is bundled by Bun.build',\n\t);\n\tconst rest = typeof option === 'object' ? option : {};\n\tconst built = await buildWorker({\n\t\t...rest,\n\t\tfile,\n\t\troot: config.root,\n\t\tclient: join(contextOf(config).buildDirectory, 'client'),\n\t}).catch((error: unknown) => {\n\t\tthrow new Error(`${NAME}: ${(error as Error).message}`, { cause: error });\n\t});\n\tconfig.logger.info(\n\t\t`✓ ${basename(built.file)}: ${built.precache.length} files precached (${MB(built.precacheBytes)} MB), worker ${KB(built.bytes)} kB`,\n\t);\n}\n"
|
|
14
15
|
],
|
|
15
|
-
"mappings": ";;;;;;;AAKA,qBAAS;;;ACAT;AAIA,IAAM,gBAAgB;AAOtB,IAAM,gBAA8C;AAAA,EACnD,GAAG,eAAe,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,CAAC;AAAA,EAClD;AAAA,E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vite/runtime.d.ts
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* is installed, even from `bun run dev`, and alxia's server then fails on
|
|
5
5
|
* its first request with `ReferenceError: Bun is not defined`.
|
|
6
6
|
*/
|
|
7
|
-
export declare function requireBun(command: string, hint?: string, onBun?: boolean): void;
|
|
7
|
+
export declare function requireBun(command: string, hint?: string, onBun?: boolean, reason?: string): void;
|
|
8
8
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/vite/runtime.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,SAAyB,EAC7B,KAAK,UAAsD,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/vite/runtime.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,SAAyB,EAC7B,KAAK,UAAsD,EAC3D,MAAM,SAAmC,GACvC,IAAI,CAKN"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ResolvedConfig } from 'vite';
|
|
2
|
+
import { type BuildWorkerOptions } from '../pwa/build';
|
|
3
|
+
import type { AlxiaOptions } from './index';
|
|
4
|
+
/** `buildWorker()`'s options but where: the plugin knows the root, the client build and, by default, the file. */
|
|
5
|
+
export type AlxiaWorkerOptions = Omit<BuildWorkerOptions, 'root' | 'client' | 'file'> & {
|
|
6
|
+
readonly file?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The worker's source, absolute, or `undefined` when there is none to
|
|
10
|
+
* build: `worker: false`, or no `app/service-worker.ts` and no named file.
|
|
11
|
+
* Throws when a named file does not exist.
|
|
12
|
+
*/
|
|
13
|
+
export declare function workerFile(option: AlxiaOptions['worker'], config: ResolvedConfig): string | undefined;
|
|
14
|
+
/** Builds the worker into `build/client`, if the app has one. */
|
|
15
|
+
export declare function buildAppWorker(config: ResolvedConfig, option: AlxiaOptions['worker']): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/vite/worker.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,cAAc,CAAC;AAGpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,kHAAkH;AAClH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACpC,kBAAkB,EAClB,MAAM,GAAG,QAAQ,GAAG,MAAM,CAC1B,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,EAC9B,MAAM,EAAE,cAAc,GACpB,MAAM,GAAG,SAAS,CAcpB;AAKD,iEAAiE;AACjE,wBAAsB,cAAc,CACnC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
package/docs/README.md
CHANGED
|
@@ -2,12 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
The [package README](../README.md) is the short version. This folder is
|
|
4
4
|
the long one: the setup, the Vite plugin and its default server, the build for Bun,
|
|
5
|
-
customising the server, the typed context, the client's files,
|
|
6
|
-
do with each message.
|
|
5
|
+
customising the server, the typed context, the client's files, making the app
|
|
6
|
+
installable and usable offline, and what to do with each message.
|
|
7
7
|
|
|
8
8
|
| Page | Read it when |
|
|
9
9
|
| --- | --- |
|
|
10
|
-
| [
|
|
10
|
+
| [Getting started](guide/getting-started.md) | starting a new app with `bun create @alxia --template react-router`, adding alxia to the official template or an existing app, or revealing the default server with `bunx alxia-react-router reveal` |
|
|
11
|
+
| [How it works](guide/how-it-works.md) | what happens in dev, in a build and under `vite preview` (and what prerendering serves), and what the plugin sets so the server is built for Bun |
|
|
12
|
+
| [Customising the server](guide/customising-the-server.md) | changing the default server with `createServer()`, or leaving it: another entry, overriding the wiring, a server of your own |
|
|
13
|
+
| [Typing the loaders](guide/typing-the-loaders.md) | typing the loaders with `Register` or a type argument, and the app's own context keys |
|
|
14
|
+
| [A CSP nonce](guide/csp-nonce.md) | a Content-Security-Policy without `'unsafe-inline'`: giving the inline scripts React Router renders a per-request nonce |
|
|
15
|
+
| [Beside the pages](guide/beside-the-pages.md) | the middlewares that run around the pages, routes beside them, WebSockets in dev, in preview and in the build, and the client's files |
|
|
16
|
+
| [OpenAPI](guide/openapi.md) | writing the API of an app that serves pages spec first: binding its routes to the generated operations, and checking them with `matchesSpec` |
|
|
17
|
+
| [Testing](guide/testing.md) | making the app in process with `server.create(wiring)` from a build, and testing it without a server |
|
|
18
|
+
| [Deploying](guide/deploying.md) | running the build with `bun build/server/index.js`, and the Docker image |
|
|
19
|
+
| [Installable and offline](guide/pwa.md) | making the app installable and usable offline: the subpaths of `@alxia/react-router/pwa`, the service worker (`startWorker`, `/pwa/worker`), its build by `alxia()` or `buildWorker` (`/pwa/build`), its contract and cache names, which requests the worker caches and which responses it stores, the precache list read from a build, or clearing the caches at sign-out |
|
|
11
20
|
| [Troubleshooting](troubleshooting.md) | something went wrong and you have the message, or a page streams, hydrates or reads its context unlike you expected |
|
|
12
21
|
| [Roadmap](roadmap.md) | wondering what is coming, and what is not planned |
|
|
13
22
|
|