@softistx/alxia-react-router 0.0.0-stage → 0.83.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/LICENSE +21 -0
- package/README.md +2085 -2
- package/dist/api-keys/api-keys.d.ts +93 -0
- package/dist/api-keys/api-keys.d.ts.map +1 -0
- package/dist/api-keys/index.d.ts +9 -0
- package/dist/api-keys/index.d.ts.map +1 -0
- package/dist/api-keys/index.js +66 -0
- package/dist/api-keys/index.js.map +10 -0
- package/dist/assets.d.ts +14 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/chunks/index-0786n4qe.js +25 -0
- package/dist/chunks/index-0786n4qe.js.map +10 -0
- package/dist/chunks/index-1nw5yeek.js +169 -0
- package/dist/chunks/index-1nw5yeek.js.map +11 -0
- 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-6jf7zpxz.js +119 -0
- package/dist/chunks/index-6jf7zpxz.js.map +11 -0
- package/dist/chunks/index-8as4j8m3.js +340 -0
- package/dist/chunks/index-8as4j8m3.js.map +16 -0
- package/dist/chunks/index-9xv2a8et.js +108 -0
- package/dist/chunks/index-9xv2a8et.js.map +11 -0
- package/dist/chunks/index-ajtvyq35.js +16 -0
- package/dist/chunks/index-ajtvyq35.js.map +10 -0
- package/dist/chunks/index-c55hxgr5.js +124 -0
- package/dist/chunks/index-c55hxgr5.js.map +14 -0
- package/dist/chunks/index-d42p3mdp.js +19 -0
- package/dist/chunks/index-d42p3mdp.js.map +10 -0
- package/dist/chunks/index-gac44rs5.js +42 -0
- package/dist/chunks/index-gac44rs5.js.map +11 -0
- package/dist/chunks/index-j4ktpcke.js +62 -0
- package/dist/chunks/index-j4ktpcke.js.map +10 -0
- package/dist/chunks/index-mscfme4r.js +12 -0
- package/dist/chunks/index-mscfme4r.js.map +10 -0
- package/dist/chunks/index-pghmb2dm.js +30 -0
- package/dist/chunks/index-pghmb2dm.js.map +10 -0
- package/dist/chunks/index-rfr02vg4.js +40 -0
- package/dist/chunks/index-rfr02vg4.js.map +10 -0
- package/dist/chunks/index-sfhshxqz.js +31 -0
- package/dist/chunks/index-sfhshxqz.js.map +10 -0
- package/dist/chunks/index-skwypsjz.js +357 -0
- package/dist/chunks/index-skwypsjz.js.map +12 -0
- package/dist/chunks/index-sxh06ged.js +118 -0
- package/dist/chunks/index-sxh06ged.js.map +11 -0
- package/dist/chunks/index-t2ph23wk.js +96 -0
- package/dist/chunks/index-t2ph23wk.js.map +13 -0
- package/dist/chunks/index-thyabr5n.js +19 -0
- package/dist/chunks/index-thyabr5n.js.map +10 -0
- package/dist/chunks/index-tx36swjx.js +134 -0
- package/dist/chunks/index-tx36swjx.js.map +11 -0
- package/dist/chunks/index-v2z5k640.js +54 -0
- package/dist/chunks/index-v2z5k640.js.map +11 -0
- package/dist/chunks/index-vr82typq.js +23 -0
- package/dist/chunks/index-vr82typq.js.map +11 -0
- package/dist/chunks/index-whj6h5eg.js +9 -0
- package/dist/chunks/index-whj6h5eg.js.map +10 -0
- package/dist/chunks/index-wyypkfdv.js +130 -0
- package/dist/chunks/index-wyypkfdv.js.map +13 -0
- package/dist/chunks/index-xd5aqy3g.js +90 -0
- package/dist/chunks/index-xd5aqy3g.js.map +10 -0
- package/dist/chunks/index-zdbqzcjp.js +97 -0
- package/dist/chunks/index-zdbqzcjp.js.map +12 -0
- package/dist/chunks/index-zyg8amjc.js +23 -0
- package/dist/chunks/index-zyg8amjc.js.map +10 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +215 -0
- package/dist/cli/index.js.map +13 -0
- package/dist/cli/main.d.ts +13 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/reveal.d.ts +18 -0
- package/dist/cli/reveal.d.ts.map +1 -0
- package/dist/cli/template.d.ts +8 -0
- package/dist/cli/template.d.ts.map +1 -0
- package/dist/context.d.ts +104 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/document/index.d.ts +11 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +19 -0
- package/dist/document/index.js.map +9 -0
- package/dist/document/inline-script.d.ts +27 -0
- package/dist/document/inline-script.d.ts.map +1 -0
- package/dist/document/language-store.d.ts +8 -0
- package/dist/document/language-store.d.ts.map +1 -0
- package/dist/document/nonce.d.ts +34 -0
- package/dist/document/nonce.d.ts.map +1 -0
- package/dist/document/page-language.d.ts +39 -0
- package/dist/document/page-language.d.ts.map +1 -0
- package/dist/document/text-direction.d.ts +10 -0
- package/dist/document/text-direction.d.ts.map +1 -0
- package/dist/entry/abort.d.ts +21 -0
- package/dist/entry/abort.d.ts.map +1 -0
- package/dist/entry/create-entry.d.ts +41 -0
- package/dist/entry/create-entry.d.ts.map +1 -0
- package/dist/entry/index.d.ts +8 -0
- package/dist/entry/index.d.ts.map +1 -0
- package/dist/entry/index.js +154 -0
- package/dist/entry/index.js.map +13 -0
- package/dist/entry/root-data.d.ts +27 -0
- package/dist/entry/root-data.d.ts.map +1 -0
- package/dist/entry/whole-page.d.ts +10 -0
- package/dist/entry/whole-page.d.ts.map +1 -0
- package/dist/errors/api-error.d.ts +117 -0
- package/dist/errors/api-error.d.ts.map +1 -0
- package/dist/errors/api-errors.d.ts +122 -0
- package/dist/errors/api-errors.d.ts.map +1 -0
- package/dist/errors/call-failure.d.ts +45 -0
- package/dist/errors/call-failure.d.ts.map +1 -0
- package/dist/errors/catalogue-check.d.ts +24 -0
- package/dist/errors/catalogue-check.d.ts.map +1 -0
- package/dist/errors/catalogue-read.d.ts +33 -0
- package/dist/errors/catalogue-read.d.ts.map +1 -0
- package/dist/errors/catalogue.d.ts +59 -0
- package/dist/errors/catalogue.d.ts.map +1 -0
- package/dist/errors/code-resolver.d.ts +44 -0
- package/dist/errors/code-resolver.d.ts.map +1 -0
- package/dist/errors/cross-site.d.ts +8 -0
- package/dist/errors/cross-site.d.ts.map +1 -0
- package/dist/errors/describe-refusal.d.ts +6 -0
- package/dist/errors/describe-refusal.d.ts.map +1 -0
- package/dist/errors/describe.d.ts +3 -0
- package/dist/errors/describe.d.ts.map +1 -0
- package/dist/errors/fetcher-result.d.ts +33 -0
- package/dist/errors/fetcher-result.d.ts.map +1 -0
- package/dist/errors/field-placement.d.ts +12 -0
- package/dist/errors/field-placement.d.ts.map +1 -0
- package/dist/errors/form-errors.d.ts +8 -0
- package/dist/errors/form-errors.d.ts.map +1 -0
- package/dist/errors/form-refusal.d.ts +25 -0
- package/dist/errors/form-refusal.d.ts.map +1 -0
- package/dist/errors/index.d.ts +21 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +588 -0
- package/dist/errors/index.js.map +26 -0
- package/dist/errors/json-actions.d.ts +38 -0
- package/dist/errors/json-actions.d.ts.map +1 -0
- package/dist/errors/log.d.ts +8 -0
- package/dist/errors/log.d.ts.map +1 -0
- package/dist/errors/message-values.d.ts +11 -0
- package/dist/errors/message-values.d.ts.map +1 -0
- package/dist/errors/messages.d.ts +63 -0
- package/dist/errors/messages.d.ts.map +1 -0
- package/dist/errors/page-path.d.ts +9 -0
- package/dist/errors/page-path.d.ts.map +1 -0
- package/dist/errors/problem-error.d.ts +50 -0
- package/dist/errors/problem-error.d.ts.map +1 -0
- package/dist/errors/provider.d.ts +20 -0
- package/dist/errors/provider.d.ts.map +1 -0
- package/dist/errors/request-id.d.ts +5 -0
- package/dist/errors/request-id.d.ts.map +1 -0
- package/dist/errors/route-error.d.ts +33 -0
- package/dist/errors/route-error.d.ts.map +1 -0
- package/dist/errors/route-refusal.d.ts +20 -0
- package/dist/errors/route-refusal.d.ts.map +1 -0
- package/dist/errors/same-site.d.ts +49 -0
- package/dist/errors/same-site.d.ts.map +1 -0
- package/dist/errors/section-action.d.ts +46 -0
- package/dist/errors/section-action.d.ts.map +1 -0
- package/dist/errors/standard-schema.d.ts +34 -0
- package/dist/errors/standard-schema.d.ts.map +1 -0
- package/dist/errors/submit-form.d.ts +16 -0
- package/dist/errors/submit-form.d.ts.map +1 -0
- package/dist/errors/upstream-headers.d.ts +18 -0
- package/dist/errors/upstream-headers.d.ts.map +1 -0
- package/dist/errors/use-json-fetcher.d.ts +18 -0
- package/dist/errors/use-json-fetcher.d.ts.map +1 -0
- package/dist/fetcher/auth-refusal.d.ts +29 -0
- package/dist/fetcher/auth-refusal.d.ts.map +1 -0
- package/dist/fetcher/index.d.ts +20 -0
- package/dist/fetcher/index.d.ts.map +1 -0
- package/dist/fetcher/index.js +392 -0
- package/dist/fetcher/index.js.map +21 -0
- package/dist/fetcher/section-form.d.ts +24 -0
- package/dist/fetcher/section-form.d.ts.map +1 -0
- package/dist/fetcher/section-reload.d.ts +17 -0
- package/dist/fetcher/section-reload.d.ts.map +1 -0
- package/dist/fetcher/section-save.d.ts +29 -0
- package/dist/fetcher/section-save.d.ts.map +1 -0
- package/dist/fetcher/use-debounced-fetcher.d.ts +57 -0
- package/dist/fetcher/use-debounced-fetcher.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-answer.d.ts +16 -0
- package/dist/fetcher/use-fetcher-answer.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-done.d.ts +15 -0
- package/dist/fetcher/use-fetcher-done.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-promise.d.ts +48 -0
- package/dist/fetcher/use-fetcher-promise.d.ts.map +1 -0
- package/dist/fetcher/use-form-refusal.d.ts +20 -0
- package/dist/fetcher/use-form-refusal.d.ts.map +1 -0
- package/dist/fetcher/use-revalidate-on-focus.d.ts +20 -0
- package/dist/fetcher/use-revalidate-on-focus.d.ts.map +1 -0
- package/dist/fetcher/use-row-save.d.ts +32 -0
- package/dist/fetcher/use-row-save.d.ts.map +1 -0
- package/dist/fetcher/use-section-save.d.ts +46 -0
- package/dist/fetcher/use-section-save.d.ts.map +1 -0
- package/dist/fetcher/use-visible-interval.d.ts +24 -0
- package/dist/fetcher/use-visible-interval.d.ts.map +1 -0
- package/dist/fetcher/use-visible-revalidation.d.ts +10 -0
- package/dist/fetcher/use-visible-revalidation.d.ts.map +1 -0
- package/dist/health.d.ts +21 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/help/check/check.d.ts +35 -0
- package/dist/help/check/check.d.ts.map +1 -0
- package/dist/help/check/index.d.ts +8 -0
- package/dist/help/check/index.d.ts.map +1 -0
- package/dist/help/check/index.js +17 -0
- package/dist/help/check/index.js.map +9 -0
- package/dist/help/check/routes.d.ts +22 -0
- package/dist/help/check/routes.d.ts.map +1 -0
- package/dist/help/guide.d.ts +33 -0
- package/dist/help/guide.d.ts.map +1 -0
- package/dist/help/index.d.ts +16 -0
- package/dist/help/index.d.ts.map +1 -0
- package/dist/help/index.js +192 -0
- package/dist/help/index.js.map +14 -0
- package/dist/help/load.d.ts +39 -0
- package/dist/help/load.d.ts.map +1 -0
- package/dist/help/panel.d.ts +69 -0
- package/dist/help/panel.d.ts.map +1 -0
- package/dist/help/parse-flow.d.ts +27 -0
- package/dist/help/parse-flow.d.ts.map +1 -0
- package/dist/help/react.d.ts +12 -0
- package/dist/help/react.d.ts.map +1 -0
- package/dist/help/resolve.d.ts +24 -0
- package/dist/help/resolve.d.ts.map +1 -0
- package/dist/help/types.d.ts +50 -0
- package/dist/help/types.d.ts.map +1 -0
- package/dist/help/yaml.d.ts +18 -0
- package/dist/help/yaml.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +14 -0
- package/dist/link/index.d.ts +7 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +16 -0
- package/dist/link/index.js.map +10 -0
- package/dist/link/router-link.d.ts +27 -0
- package/dist/link/router-link.d.ts.map +1 -0
- package/dist/lists/connection-page.d.ts +50 -0
- package/dist/lists/connection-page.d.ts.map +1 -0
- package/dist/lists/index.d.ts +13 -0
- package/dist/lists/index.d.ts.map +1 -0
- package/dist/lists/index.js +205 -0
- package/dist/lists/index.js.map +15 -0
- package/dist/lists/newest-first.d.ts +5 -0
- package/dist/lists/newest-first.d.ts.map +1 -0
- package/dist/lists/nodes-of.d.ts +21 -0
- package/dist/lists/nodes-of.d.ts.map +1 -0
- package/dist/lists/or-failed.d.ts +19 -0
- package/dist/lists/or-failed.d.ts.map +1 -0
- package/dist/lists/use-paged-rows.d.ts +40 -0
- package/dist/lists/use-paged-rows.d.ts.map +1 -0
- package/dist/lists/use-same-route-loading.d.ts +8 -0
- package/dist/lists/use-same-route-loading.d.ts.map +1 -0
- package/dist/lists/use-search-change.d.ts +20 -0
- package/dist/lists/use-search-change.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +105 -0
- package/dist/mcp/index.js.map +11 -0
- package/dist/mcp/mcp-relay.d.ts +58 -0
- package/dist/mcp/mcp-relay.d.ts.map +1 -0
- package/dist/mcp/relay.d.ts +38 -0
- package/dist/mcp/relay.d.ts.map +1 -0
- package/dist/media/client/error.d.ts +29 -0
- package/dist/media/client/error.d.ts.map +1 -0
- package/dist/media/client/index.d.ts +8 -0
- package/dist/media/client/index.d.ts.map +1 -0
- package/dist/media/client/index.js +133 -0
- package/dist/media/client/index.js.map +11 -0
- package/dist/media/client/upload.d.ts +32 -0
- package/dist/media/client/upload.d.ts.map +1 -0
- package/dist/media/forward.d.ts +14 -0
- package/dist/media/forward.d.ts.map +1 -0
- package/dist/media/headers.d.ts +11 -0
- package/dist/media/headers.d.ts.map +1 -0
- package/dist/media/index.d.ts +9 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +396 -0
- package/dist/media/index.js.map +16 -0
- package/dist/media/options.d.ts +114 -0
- package/dist/media/options.d.ts.map +1 -0
- package/dist/media/path.d.ts +12 -0
- package/dist/media/path.d.ts.map +1 -0
- package/dist/media/read.d.ts +11 -0
- package/dist/media/read.d.ts.map +1 -0
- package/dist/media/refusal.d.ts +11 -0
- package/dist/media/refusal.d.ts.map +1 -0
- package/dist/media/respond.d.ts +8 -0
- package/dist/media/respond.d.ts.map +1 -0
- package/dist/media/write.d.ts +13 -0
- package/dist/media/write.d.ts.map +1 -0
- package/dist/navigation/index.d.ts +9 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +48 -0
- package/dist/navigation/index.js.map +11 -0
- package/dist/navigation/use-focus-on-navigate.d.ts +16 -0
- package/dist/navigation/use-focus-on-navigate.d.ts.map +1 -0
- package/dist/navigation/use-route-transition.d.ts +19 -0
- package/dist/navigation/use-route-transition.d.ts.map +1 -0
- package/dist/nonce.d.ts +16 -0
- package/dist/nonce.d.ts.map +1 -0
- package/dist/oauth/answer.d.ts +33 -0
- package/dist/oauth/answer.d.ts.map +1 -0
- package/dist/oauth/binding.d.ts +43 -0
- package/dist/oauth/binding.d.ts.map +1 -0
- package/dist/oauth/consent.d.ts +134 -0
- package/dist/oauth/consent.d.ts.map +1 -0
- package/dist/oauth/grants.d.ts +88 -0
- package/dist/oauth/grants.d.ts.map +1 -0
- package/dist/oauth/index.d.ts +16 -0
- package/dist/oauth/index.d.ts.map +1 -0
- package/dist/oauth/index.js +207 -0
- package/dist/oauth/index.js.map +12 -0
- package/dist/oauth/model.d.ts +13 -0
- package/dist/oauth/model.d.ts.map +1 -0
- package/dist/oauth/react/index.d.ts +7 -0
- package/dist/oauth/react/index.d.ts.map +1 -0
- package/dist/oauth/react/index.js +99 -0
- package/dist/oauth/react/index.js.map +10 -0
- package/dist/oauth/react/use-consent.d.ts +52 -0
- package/dist/oauth/react/use-consent.d.ts.map +1 -0
- package/dist/oidc/dpop.d.ts +80 -0
- package/dist/oidc/dpop.d.ts.map +1 -0
- package/dist/oidc/errors.d.ts +16 -0
- package/dist/oidc/errors.d.ts.map +1 -0
- package/dist/oidc/flow.d.ts +59 -0
- package/dist/oidc/flow.d.ts.map +1 -0
- package/dist/oidc/index.d.ts +11 -0
- package/dist/oidc/index.d.ts.map +1 -0
- package/dist/oidc/index.js +742 -0
- package/dist/oidc/index.js.map +15 -0
- package/dist/oidc/oidc.d.ts +132 -0
- package/dist/oidc/oidc.d.ts.map +1 -0
- package/dist/oidc/revoke.d.ts +28 -0
- package/dist/oidc/revoke.d.ts.map +1 -0
- package/dist/oidc/seal.d.ts +20 -0
- package/dist/oidc/seal.d.ts.map +1 -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 +16 -0
- package/dist/pwa/index.d.ts.map +1 -0
- package/dist/pwa/index.js +110 -0
- package/dist/pwa/index.js.map +12 -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/font-precache.d.ts +15 -0
- package/dist/pwa/model/font-precache.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/theme-color.d.ts +20 -0
- package/dist/pwa/model/theme-color.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/react-router.d.ts +68 -0
- package/dist/react-router.d.ts.map +1 -0
- package/dist/server.d.ts +127 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/session/codes.d.ts +9 -0
- package/dist/session/codes.d.ts.map +1 -0
- package/dist/session/cookies.d.ts +128 -0
- package/dist/session/cookies.d.ts.map +1 -0
- package/dist/session/flow-types.d.ts +235 -0
- package/dist/session/flow-types.d.ts.map +1 -0
- package/dist/session/guard.d.ts +10 -0
- package/dist/session/guard.d.ts.map +1 -0
- package/dist/session/index.d.ts +22 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +1090 -0
- package/dist/session/index.js.map +27 -0
- package/dist/session/land.d.ts +28 -0
- package/dist/session/land.d.ts.map +1 -0
- package/dist/session/link-json.d.ts +22 -0
- package/dist/session/link-json.d.ts.map +1 -0
- package/dist/session/link-land.d.ts +20 -0
- package/dist/session/link-land.d.ts.map +1 -0
- package/dist/session/link-token.d.ts +24 -0
- package/dist/session/link-token.d.ts.map +1 -0
- package/dist/session/link-types.d.ts +142 -0
- package/dist/session/link-types.d.ts.map +1 -0
- package/dist/session/links.d.ts +14 -0
- package/dist/session/links.d.ts.map +1 -0
- package/dist/session/model/index.d.ts +8 -0
- package/dist/session/model/index.d.ts.map +1 -0
- package/dist/session/model/index.js +35 -0
- package/dist/session/model/index.js.map +9 -0
- package/dist/session/model/link-post.d.ts +35 -0
- package/dist/session/model/link-post.d.ts.map +1 -0
- package/dist/session/model/paths.d.ts +24 -0
- package/dist/session/model/paths.d.ts.map +1 -0
- package/dist/session/model/safe-next.d.ts +15 -0
- package/dist/session/model/safe-next.d.ts.map +1 -0
- package/dist/session/model/second-factor.d.ts +16 -0
- package/dist/session/model/second-factor.d.ts.map +1 -0
- package/dist/session/model/site-path.d.ts +10 -0
- package/dist/session/model/site-path.d.ts.map +1 -0
- package/dist/session/model/step-up-answers.d.ts +45 -0
- package/dist/session/model/step-up-answers.d.ts.map +1 -0
- package/dist/session/model/step-up-props.d.ts +22 -0
- package/dist/session/model/step-up-props.d.ts.map +1 -0
- package/dist/session/model/step-up.d.ts +48 -0
- package/dist/session/model/step-up.d.ts.map +1 -0
- package/dist/session/react/index.d.ts +13 -0
- package/dist/session/react/index.d.ts.map +1 -0
- package/dist/session/react/index.js +196 -0
- package/dist/session/react/index.js.map +14 -0
- package/dist/session/react/step-up/answers.d.ts +9 -0
- package/dist/session/react/step-up/answers.d.ts.map +1 -0
- package/dist/session/react/step-up/dialog-props.d.ts +27 -0
- package/dist/session/react/step-up/dialog-props.d.ts.map +1 -0
- package/dist/session/react/step-up/index.d.ts +7 -0
- package/dist/session/react/step-up/index.d.ts.map +1 -0
- package/dist/session/react/step-up/pending-runs.d.ts +21 -0
- package/dist/session/react/step-up/pending-runs.d.ts.map +1 -0
- package/dist/session/react/step-up/phase.d.ts +8 -0
- package/dist/session/react/step-up/phase.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up-replay.d.ts +59 -0
- package/dist/session/react/step-up/use-step-up-replay.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up-runner.d.ts +70 -0
- package/dist/session/react/step-up/use-step-up-runner.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up.d.ts +51 -0
- package/dist/session/react/step-up/use-step-up.d.ts.map +1 -0
- package/dist/session/react/use-code-field.d.ts +37 -0
- package/dist/session/react/use-code-field.d.ts.map +1 -0
- package/dist/session/react/use-link-fragment.d.ts +22 -0
- package/dist/session/react/use-link-fragment.d.ts.map +1 -0
- package/dist/session/react/use-link-param.d.ts +26 -0
- package/dist/session/react/use-link-param.d.ts.map +1 -0
- package/dist/session/react/use-link-post.d.ts +39 -0
- package/dist/session/react/use-link-post.d.ts.map +1 -0
- package/dist/session/react/use-sign-out.d.ts +46 -0
- package/dist/session/react/use-sign-out.d.ts.map +1 -0
- package/dist/session/second-factor.d.ts +22 -0
- package/dist/session/second-factor.d.ts.map +1 -0
- package/dist/session/serialize.d.ts +42 -0
- package/dist/session/serialize.d.ts.map +1 -0
- package/dist/session/sign-in.d.ts +19 -0
- package/dist/session/sign-in.d.ts.map +1 -0
- package/dist/session/signed.d.ts +44 -0
- package/dist/session/signed.d.ts.map +1 -0
- package/dist/session/social-flow.d.ts +22 -0
- package/dist/session/social-flow.d.ts.map +1 -0
- package/dist/session/social-land.d.ts +31 -0
- package/dist/session/social-land.d.ts.map +1 -0
- package/dist/session/social-types.d.ts +136 -0
- package/dist/session/social-types.d.ts.map +1 -0
- package/dist/session/social.d.ts +32 -0
- package/dist/session/social.d.ts.map +1 -0
- package/dist/session/step-up-codes.d.ts +9 -0
- package/dist/session/step-up-codes.d.ts.map +1 -0
- package/dist/session/step-up-signed-out.d.ts +21 -0
- package/dist/session/step-up-signed-out.d.ts.map +1 -0
- package/dist/session/step-up-types.d.ts +127 -0
- package/dist/session/step-up-types.d.ts.map +1 -0
- package/dist/session/step-up.d.ts +17 -0
- package/dist/session/step-up.d.ts.map +1 -0
- package/dist/session/step.d.ts +22 -0
- package/dist/session/step.d.ts.map +1 -0
- package/dist/session/throttle.d.ts +73 -0
- package/dist/session/throttle.d.ts.map +1 -0
- package/dist/session/timed-wait.d.ts +4 -0
- package/dist/session/timed-wait.d.ts.map +1 -0
- package/dist/session/viewer.d.ts +34 -0
- package/dist/session/viewer.d.ts.map +1 -0
- 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 +359 -0
- package/dist/subscription/index.js.map +14 -0
- package/dist/subscription/proxy.d.ts +54 -0
- package/dist/subscription/proxy.d.ts.map +1 -0
- package/dist/subscription/react/backoff.d.ts +8 -0
- package/dist/subscription/react/backoff.d.ts.map +1 -0
- package/dist/subscription/react/classify.d.ts +15 -0
- package/dist/subscription/react/classify.d.ts.map +1 -0
- package/dist/subscription/react/controller.d.ts +40 -0
- package/dist/subscription/react/controller.d.ts.map +1 -0
- package/dist/subscription/react/fake-timers.d.ts +8 -0
- package/dist/subscription/react/fake-timers.d.ts.map +1 -0
- package/dist/subscription/react/index.d.ts +15 -0
- package/dist/subscription/react/index.d.ts.map +1 -0
- package/dist/subscription/react/index.js +227 -0
- package/dist/subscription/react/index.js.map +17 -0
- package/dist/subscription/react/reconnect.d.ts +9 -0
- package/dist/subscription/react/reconnect.d.ts.map +1 -0
- package/dist/subscription/react/scheduler.d.ts +13 -0
- package/dist/subscription/react/scheduler.d.ts.map +1 -0
- package/dist/subscription/react/timers.d.ts +7 -0
- package/dist/subscription/react/timers.d.ts.map +1 -0
- package/dist/subscription/react/use-live-subscription.d.ts +36 -0
- package/dist/subscription/react/use-live-subscription.d.ts.map +1 -0
- package/dist/subscription/react/versions.d.ts +6 -0
- package/dist/subscription/react/versions.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/bun.d.ts +21 -0
- package/dist/vite/bun.d.ts.map +1 -0
- package/dist/vite/bundle.d.ts +33 -0
- package/dist/vite/bundle.d.ts.map +1 -0
- package/dist/vite/compress.d.ts +18 -0
- package/dist/vite/compress.d.ts.map +1 -0
- package/dist/vite/config.d.ts +33 -0
- package/dist/vite/config.d.ts.map +1 -0
- package/dist/vite/dev.d.ts +28 -0
- package/dist/vite/dev.d.ts.map +1 -0
- package/dist/vite/entry.d.ts +20 -0
- package/dist/vite/entry.d.ts.map +1 -0
- package/dist/vite/hosts.d.ts +16 -0
- package/dist/vite/hosts.d.ts.map +1 -0
- package/dist/vite/index.d.ts +68 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +635 -0
- package/dist/vite/index.js.map +22 -0
- package/dist/vite/inline.d.ts +18 -0
- package/dist/vite/inline.d.ts.map +1 -0
- package/dist/vite/node.d.ts +16 -0
- package/dist/vite/node.d.ts.map +1 -0
- package/dist/vite/preview.d.ts +8 -0
- package/dist/vite/preview.d.ts.map +1 -0
- package/dist/vite/runtime.d.ts +8 -0
- package/dist/vite/runtime.d.ts.map +1 -0
- package/dist/vite/socket.d.ts +75 -0
- package/dist/vite/socket.d.ts.map +1 -0
- package/dist/vite/worker.d.ts +16 -0
- package/dist/vite/worker.d.ts.map +1 -0
- package/dist/with-alxia.d.ts +36 -0
- package/dist/with-alxia.d.ts.map +1 -0
- package/docs/README.md +42 -0
- package/docs/guide/api-keys.md +216 -0
- package/docs/guide/beside-the-pages.md +201 -0
- package/docs/guide/csp-nonce.md +166 -0
- package/docs/guide/customising-the-server.md +324 -0
- package/docs/guide/deploying.md +102 -0
- package/docs/guide/document.md +334 -0
- package/docs/guide/errors.md +1147 -0
- package/docs/guide/fetcher.md +355 -0
- package/docs/guide/getting-started.md +112 -0
- package/docs/guide/help.md +325 -0
- package/docs/guide/how-it-works.md +274 -0
- package/docs/guide/link.md +32 -0
- package/docs/guide/lists.md +225 -0
- package/docs/guide/mcp.md +173 -0
- package/docs/guide/media.md +273 -0
- package/docs/guide/navigation.md +52 -0
- package/docs/guide/oauth.md +342 -0
- package/docs/guide/oidc.md +262 -0
- package/docs/guide/openapi.md +51 -0
- package/docs/guide/pwa.md +670 -0
- package/docs/guide/session.md +2105 -0
- package/docs/guide/subscriptions.md +211 -0
- package/docs/guide/testing.md +42 -0
- package/docs/guide/typing-the-loaders.md +311 -0
- package/docs/guide.md +82 -0
- package/docs/roadmap.md +474 -0
- package/docs/troubleshooting.md +3837 -0
- package/package.json +301 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-service-worker.d.ts","sourceRoot":"","sources":["../../../src/pwa/react/use-service-worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,MAAM,WAAW,oBAAoB;IACpC;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAkBpE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type UpdateNotice, type UpdateNoticeStore } from '../model/update-notice';
|
|
2
|
+
/**
|
|
3
|
+
* The page's one notice, which `useServiceWorker` offers and
|
|
4
|
+
* `useUpdateNotice` reads. It lives here, not in `/pwa`, so that the model a
|
|
5
|
+
* worker bundle imports makes nothing at load.
|
|
6
|
+
*/
|
|
7
|
+
export declare const updateNotice: UpdateNoticeStore;
|
|
8
|
+
/**
|
|
9
|
+
* The update notice to show: a new version waits and "Later" was not asked.
|
|
10
|
+
* None on the server. `notice` is the page's `updateNotice` unless the app
|
|
11
|
+
* made a store of its own.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useUpdateNotice(notice?: UpdateNoticeStore): UpdateNotice | undefined;
|
|
14
|
+
//# sourceMappingURL=use-update-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-update-notice.d.ts","sourceRoot":"","sources":["../../../src/pwa/react/use-update-notice.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAoD,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,MAAM,GAAE,iBAAgC,GACtC,YAAY,GAAG,SAAS,CAM1B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@softistx/alxia-react-router/pwa/server`: the server's side of an installable
|
|
3
|
+
* app, `noCache` for the worker's script. `@softistx/alxia` is its only import,
|
|
4
|
+
* so keep it out of the page and the worker.
|
|
5
|
+
*/
|
|
6
|
+
export { noCache, revalidated, WORKER_POLICY } from './no-cache';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pwa/server/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/pwa/server/no-cache.ts
|
|
2
|
+
import { defineMiddleware, withHeaders } from "@softistx/alxia";
|
|
3
|
+
var WORKER_POLICY = "default-src 'none'; connect-src 'self'";
|
|
4
|
+
function revalidated(response, policy = WORKER_POLICY) {
|
|
5
|
+
return withHeaders(response, (headers) => {
|
|
6
|
+
headers.set("cache-control", "no-cache");
|
|
7
|
+
headers.set("content-security-policy", policy);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
var noCache = defineMiddleware(async (_ctx, next) => revalidated(await next()));
|
|
11
|
+
export {
|
|
12
|
+
WORKER_POLICY,
|
|
13
|
+
noCache,
|
|
14
|
+
revalidated
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//# debugId=6376A357B67DFC7164756E2164756E21
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/pwa/server/no-cache.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { defineMiddleware, withHeaders } from '@softistx/alxia';\n\n/**\n * The service worker's own policy: a worker takes the policy its script\n * came with, not the pages'. It runs no other script and fetches this site\n * only (the precache, navigations); its routes never fetch another origin.\n */\nexport const WORKER_POLICY = \"default-src 'none'; connect-src 'self'\";\n\n/**\n * The worker's script with `Cache-Control: no-cache`: the client's\n * top-level files are served for an hour, and the worker's script must be\n * revalidated on every update check, or an update waits that long. And with\n * the worker's policy (`WORKER_POLICY`, or your own `policy`), which no\n * other static file needs: none of them is a document but an offline page,\n * which carries its own in a `<meta>`.\n */\nexport function revalidated(\n\tresponse: Response,\n\tpolicy: string = WORKER_POLICY,\n): Response {\n\treturn withHeaders(response, (headers) => {\n\t\theaders.set('cache-control', 'no-cache');\n\t\theaders.set('content-security-policy', policy);\n\t});\n}\n\n/**\n * For `use(SERVICE_WORKER_URL, noCache)` in `createServer({ beforeAll })`,\n * before the client's files: they answer without calling `next` for a\n * middleware declared after them.\n */\nexport const noCache = defineMiddleware(async (_ctx, next) =>\n\trevalidated(await next()),\n);\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA;AAOO,IAAM,gBAAgB;AAUtB,SAAS,WAAW,CAC1B,UACA,SAAiB,eACN;AAAA,EACX,OAAO,YAAY,UAAU,CAAC,YAAY;AAAA,IACzC,QAAQ,IAAI,iBAAiB,UAAU;AAAA,IACvC,QAAQ,IAAI,2BAA2B,MAAM;AAAA,GAC7C;AAAA;AAQK,IAAM,UAAU,iBAAiB,OAAO,MAAM,SACpD,YAAY,MAAM,KAAK,CAAC,CACzB;",
|
|
8
|
+
"debugId": "6376A357B67DFC7164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The service worker's own policy: a worker takes the policy its script
|
|
3
|
+
* came with, not the pages'. It runs no other script and fetches this site
|
|
4
|
+
* only (the precache, navigations); its routes never fetch another origin.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WORKER_POLICY = "default-src 'none'; connect-src 'self'";
|
|
7
|
+
/**
|
|
8
|
+
* The worker's script with `Cache-Control: no-cache`: the client's
|
|
9
|
+
* top-level files are served for an hour, and the worker's script must be
|
|
10
|
+
* revalidated on every update check, or an update waits that long. And with
|
|
11
|
+
* the worker's policy (`WORKER_POLICY`, or your own `policy`), which no
|
|
12
|
+
* other static file needs: none of them is a document but an offline page,
|
|
13
|
+
* which carries its own in a `<meta>`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function revalidated(response: Response, policy?: string): Response;
|
|
16
|
+
/**
|
|
17
|
+
* For `use(SERVICE_WORKER_URL, noCache)` in `createServer({ beforeAll })`,
|
|
18
|
+
* before the client's files: they answer without calling `next` for a
|
|
19
|
+
* middleware declared after them.
|
|
20
|
+
*/
|
|
21
|
+
export declare const noCache: NoInfer<import("@softistx/alxia").Middleware<import("@softistx/alxia").Empty, Promise<Response>>>;
|
|
22
|
+
//# sourceMappingURL=no-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-cache.d.ts","sourceRoot":"","sources":["../../../src/pwa/server/no-cache.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa,2CAA2C,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAC1B,QAAQ,EAAE,QAAQ,EAClB,MAAM,GAAE,MAAsB,GAC5B,QAAQ,CAKV;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,mGAEnB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@softistx/alxia-react-router/pwa/worker`: the service worker on Workbox. Import it
|
|
3
|
+
* from a service worker bundle alone, never from a page. The six `workbox-*`
|
|
4
|
+
* packages (`core`, `expiration`, `navigation-preload`, `precaching`,
|
|
5
|
+
* `routing`, `strategies`, optional peers) are its only package imports.
|
|
6
|
+
*/
|
|
7
|
+
export type { ExpirationOptions, WorkerOptions } from './plan';
|
|
8
|
+
export { startWorker } from './start-worker';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pwa/worker/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cachingFor2,
|
|
3
|
+
isStorable2
|
|
4
|
+
} from "../../chunks/index-zdbqzcjp.js";
|
|
5
|
+
import {
|
|
6
|
+
injectedPrecache
|
|
7
|
+
} from "../../chunks/index-59vhfj6n.js";
|
|
8
|
+
import {
|
|
9
|
+
SKIP_WAITING2
|
|
10
|
+
} from "../../chunks/index-rfr02vg4.js";
|
|
11
|
+
|
|
12
|
+
// src/pwa/worker/start-worker.ts
|
|
13
|
+
import {
|
|
14
|
+
clientsClaim,
|
|
15
|
+
setCacheNameDetails
|
|
16
|
+
} from "workbox-core";
|
|
17
|
+
import { ExpirationPlugin } from "workbox-expiration";
|
|
18
|
+
import * as navigationPreload from "workbox-navigation-preload";
|
|
19
|
+
import { matchPrecache, precacheAndRoute } from "workbox-precaching";
|
|
20
|
+
import { registerRoute } from "workbox-routing";
|
|
21
|
+
import {
|
|
22
|
+
CacheFirst,
|
|
23
|
+
NetworkOnly,
|
|
24
|
+
StaleWhileRevalidate
|
|
25
|
+
} from "workbox-strategies";
|
|
26
|
+
|
|
27
|
+
// src/pwa/worker/plan.ts
|
|
28
|
+
var THIRTY_DAYS = 30 * 24 * 60 * 60;
|
|
29
|
+
function workerPlan(options, injected) {
|
|
30
|
+
const { contract } = options;
|
|
31
|
+
if (!contract) {
|
|
32
|
+
throw new TypeError("startWorker(): contract is required: pass defineWorkerContract({ cachePrefix }) from @softistx/alxia-react-router/pwa.");
|
|
33
|
+
}
|
|
34
|
+
const precache = options.precache ?? injected;
|
|
35
|
+
if (!precache) {
|
|
36
|
+
throw new Error("startWorker(): no precache list. Build this worker with alxia() from @softistx/alxia-react-router/vite (app/service-worker.ts) or buildWorker() from @softistx/alxia-react-router/pwa/build, which write it in.");
|
|
37
|
+
}
|
|
38
|
+
const offlineUrl = contract.offlineUrl;
|
|
39
|
+
const hasOffline = precache.some((entry) => entry.url.split("?")[0] === offlineUrl);
|
|
40
|
+
return {
|
|
41
|
+
cacheNameDetails: {
|
|
42
|
+
prefix: contract.cachePrefix,
|
|
43
|
+
precache: "precache",
|
|
44
|
+
suffix: contract.cacheVersion
|
|
45
|
+
},
|
|
46
|
+
precache,
|
|
47
|
+
routes: [
|
|
48
|
+
{
|
|
49
|
+
caching: "navigation",
|
|
50
|
+
strategy: "network-only",
|
|
51
|
+
fallback: hasOffline ? offlineUrl : undefined
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
caching: "immutable",
|
|
55
|
+
strategy: "cache-first",
|
|
56
|
+
cacheName: contract.cacheNames.assets,
|
|
57
|
+
expiration: { maxEntries: 200, ...options.assets }
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
caching: "static",
|
|
61
|
+
strategy: "stale-while-revalidate",
|
|
62
|
+
cacheName: contract.cacheNames.static,
|
|
63
|
+
expiration: {
|
|
64
|
+
maxEntries: 100,
|
|
65
|
+
maxAgeSeconds: THIRTY_DAYS,
|
|
66
|
+
...options.static
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
navigationPreload: options.navigationPreload ?? true
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function matcher(caching, origin, options) {
|
|
74
|
+
return ({ request }) => cachingFor2(request, origin(), {
|
|
75
|
+
...options.caching,
|
|
76
|
+
contract: options.contract
|
|
77
|
+
}) === caching;
|
|
78
|
+
}
|
|
79
|
+
var storableOnly = {
|
|
80
|
+
async cacheWillUpdate({
|
|
81
|
+
response
|
|
82
|
+
}) {
|
|
83
|
+
return isStorable2(response) ? response : null;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function isSkipWaiting(data) {
|
|
87
|
+
return data?.type === SKIP_WAITING2;
|
|
88
|
+
}
|
|
89
|
+
async function deleteObsoleteCaches(contract, storage) {
|
|
90
|
+
const names = await storage.keys();
|
|
91
|
+
await Promise.all(contract.obsoleteCaches(names).map((name) => storage.delete(name)));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/pwa/worker/scope.ts
|
|
95
|
+
var workerScope = () => globalThis;
|
|
96
|
+
|
|
97
|
+
// src/pwa/worker/start-worker.ts
|
|
98
|
+
function startWorker(options) {
|
|
99
|
+
const plan = workerPlan(options, injectedPrecache());
|
|
100
|
+
const scope = workerScope();
|
|
101
|
+
const { contract } = options;
|
|
102
|
+
setCacheNameDetails(plan.cacheNameDetails);
|
|
103
|
+
precacheAndRoute([...plan.precache], {
|
|
104
|
+
cleanURLs: false,
|
|
105
|
+
directoryIndex: ""
|
|
106
|
+
});
|
|
107
|
+
if (plan.navigationPreload)
|
|
108
|
+
navigationPreload.enable();
|
|
109
|
+
for (const route of plan.routes) {
|
|
110
|
+
const match = matcher(route.caching, () => scope.location.origin, options);
|
|
111
|
+
if (route.strategy === "network-only") {
|
|
112
|
+
const { fallback } = route;
|
|
113
|
+
registerRoute(match, new NetworkOnly({
|
|
114
|
+
plugins: fallback ? [{ handlerDidError: async () => matchPrecache(fallback) }] : []
|
|
115
|
+
}));
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const Strategy = route.strategy === "cache-first" ? CacheFirst : StaleWhileRevalidate;
|
|
119
|
+
registerRoute(match, new Strategy({
|
|
120
|
+
cacheName: route.cacheName,
|
|
121
|
+
plugins: [
|
|
122
|
+
storableOnly,
|
|
123
|
+
new ExpirationPlugin({
|
|
124
|
+
...route.expiration,
|
|
125
|
+
purgeOnQuotaError: true
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
clientsClaim();
|
|
131
|
+
scope.addEventListener("activate", (event) => {
|
|
132
|
+
event.waitUntil(deleteObsoleteCaches(contract, caches));
|
|
133
|
+
});
|
|
134
|
+
scope.addEventListener("message", (event) => {
|
|
135
|
+
if (isSkipWaiting(event.data))
|
|
136
|
+
scope.skipWaiting();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
startWorker
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
//# debugId=FF479B2F3DE7DA7364756E2164756E21
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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 @softistx/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 @softistx/alxia-react-router/vite (app/service-worker.ts) or buildWorker() from @softistx/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,IAAI,UACT,wHACD;AAAA,EACD;AAAA,EACA,MAAM,WAAW,QAAQ,YAAY;AAAA,EACrC,IAAI,CAAC,UAAU;AAAA,IACd,MAAM,IAAI,MACT,iNACD;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,UAAU;AAAA,QACV,WAAW,SAAS,WAAW;AAAA,QAC/B,YAAY,EAAE,YAAY,QAAQ,QAAQ,OAAO;AAAA,MAClD;AAAA,MACA;AAAA,QACC,SAAS;AAAA,QACT,UAAU;AAAA,QACV,WAAW,SAAS,WAAW;AAAA,QAC/B,YAAY;AAAA,UACX,YAAY;AAAA,UACZ,eAAe;AAAA,aACZ,QAAQ;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,IACA,mBAAmB,QAAQ,qBAAqB;AAAA,EACjD;AAAA;AAIM,SAAS,OAAO,CACtB,SACA,QACA,SAC4C;AAAA,EAC5C,OAAO,GAAG,cACT,YAAW,SAAS,OAAO,GAAG;AAAA,OAC1B,QAAQ;AAAA,IACX,UAAU,QAAQ;AAAA,EACnB,CAAC,MAAM;AAAA;AAIF,IAAM,eAAe;AAAA,QACrB,eAAe;AAAA,IACpB;AAAA,KAG4B;AAAA,IAC5B,OAAO,YAAW,QAAQ,IAAI,WAAW;AAAA;AAE3C;AAEO,SAAS,aAAa,CAAC,MAAwB;AAAA,EACrD,OAAQ,MAAgD,SAAS;AAAA;AAI3D,eAAe,oBAAoB,CACzC,UACA,SACgB;AAAA,EAChB,MAAM,QAAQ,MAAM,QAAQ,KAAK;AAAA,EACjC,MAAM,QAAQ,IACb,SAAS,eAAe,KAAK,EAAE,IAAI,CAAC,SAAS,QAAQ,OAAO,IAAI,CAAC,CAClE;AAAA;;;ACpIM,IAAM,cAAc,MAC1B;;;AFoBM,SAAS,WAAW,CAAC,SAA8B;AAAA,EACzD,MAAM,OAAO,WAAW,SAAS,iBAAiB,CAAC;AAAA,EACnD,MAAM,QAAQ,YAAY;AAAA,EAC1B,QAAQ,aAAa;AAAA,EACrB,oBAAoB,KAAK,gBAAgB;AAAA,EACzC,iBAAiB,CAAC,GAAG,KAAK,QAAQ,GAAG;AAAA,IACpC,WAAW;AAAA,IACX,gBAAgB;AAAA,EACjB,CAAC;AAAA,EACD,IAAI,KAAK;AAAA,IAAqC,yBAAO;AAAA,EAErD,WAAW,SAAS,KAAK,QAAQ;AAAA,IAChC,MAAM,QAAQ,QAAQ,MAAM,SAAS,MAAM,MAAM,SAAS,QAAQ,OAAO;AAAA,IACzE,IAAI,MAAM,aAAa,gBAAgB;AAAA,MACtC,QAAQ,aAAa;AAAA,MACrB,cACC,OACA,IAAI,YAAY;AAAA,QACf,SAAS,WACN,CAAC,EAAE,iBAAiB,YAAY,cAAc,QAAQ,EAAE,CAAC,IACzD,CAAC;AAAA,MACL,CAAC,CACF;AAAA,MACA;AAAA,IACD;AAAA,IACA,MAAM,WACL,MAAM,aAAa,gBAAgB,aAAa;AAAA,IACjD,cACC,OACA,IAAI,SAAS;AAAA,MACZ,WAAW,MAAM;AAAA,MACjB,SAAS;AAAA,QACR;AAAA,QACA,IAAI,iBAAiB;AAAA,aACjB,MAAM;AAAA,UACT,mBAAmB;AAAA,QACpB,CAAC;AAAA,MACF;AAAA,IACD,CAAC,CACF;AAAA,EACD;AAAA,EAEA,aAAa;AAAA,EACb,MAAM,iBAAiB,YAAY,CAAC,UAAU;AAAA,IAC7C,MAAM,UAAU,qBAAqB,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": "FF479B2F3DE7DA7364756E2164756E21",
|
|
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,aAAa;IAC7B,uEAAuE;IACvE,QAAQ,EAAE,cAAc,CAAC;IACzB,8GAA8G;IAC9G,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAC3C,mEAAmE;IACnE,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,+FAA+F;IAC/F,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CACpC;AAED,MAAM,MAAM,WAAW,GACpB;IACA,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GACD;IACA,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,iBAAiB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD,GACD;IACA,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEL,MAAM,WAAW,UAAU;IAC1B,gBAAgB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IACnC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;CAC3B;AAID,kFAAkF;AAClF,wBAAgB,UAAU,CACzB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,GAC5C,UAAU,CAiDZ;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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type Alxia, type AnyAlxia, type BaseContext, type MaybePromise, type RouteDefinition } from '@softistx/alxia';
|
|
2
|
+
import { RouterContextProvider, type ServerBuild } from 'react-router';
|
|
3
|
+
export interface ReactRouterOptions<Ctx> {
|
|
4
|
+
/**
|
|
5
|
+
* React Router's server build: the module itself, or a function that
|
|
6
|
+
* returns it — `() => import('virtual:react-router/server-build')` in a
|
|
7
|
+
* server entry Vite builds, `() => import('./build/server/index.js')`
|
|
8
|
+
* beside a build. A function is called on every request in
|
|
9
|
+
* `development`, so an edit is picked up, and once in `production`.
|
|
10
|
+
*/
|
|
11
|
+
readonly build: ServerBuild | (() => MaybePromise<ServerBuild>);
|
|
12
|
+
/** React Router's server mode: `production` by default. */
|
|
13
|
+
readonly mode?: 'development' | 'production';
|
|
14
|
+
/**
|
|
15
|
+
* Sets the app's own keys on React Router's context provider, from the
|
|
16
|
+
* context alxia's middlewares built. `ctx` is typed by the app at the point of
|
|
17
|
+
* `app.plugin`: reading what nothing before it adds is a compile error.
|
|
18
|
+
* `alxiaContext` is always set, whether or not this is given.
|
|
19
|
+
*/
|
|
20
|
+
readonly getLoadContext?: (ctx: BaseContext & Ctx, context: RouterContextProvider) => MaybePromise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* The client build's folder, `build/client`: a path or a `file:` URL.
|
|
23
|
+
* Its `assets/` is served immutable, and every other top-level file or
|
|
24
|
+
* folder — the copies of `public/` — with an hour's cache, before the
|
|
25
|
+
* catch-all. Ignored in `development`, where Vite serves them.
|
|
26
|
+
*/
|
|
27
|
+
readonly client?: string | URL;
|
|
28
|
+
/**
|
|
29
|
+
* Serves the `.br` and `.gz` copies `alxia()` writes beside the client
|
|
30
|
+
* build's files to a browser that accepts them, with `Vary:
|
|
31
|
+
* Accept-Encoding`: `true` by default. `false` serves the files as they
|
|
32
|
+
* are.
|
|
33
|
+
*/
|
|
34
|
+
readonly precompressed?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether `reactRouter()` declared this route: the catch-all, or one of the
|
|
38
|
+
* client build's files. For `@softistx/alxia-openapi`'s `matchesSpec`, whose
|
|
39
|
+
* `exclude` leaves them out, so the app's routes are checked against the
|
|
40
|
+
* operations of its OpenAPI document and its pages are not.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* matchesSpec(app, operations, { exclude: isReactRouterRoute });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function isReactRouterRoute(route: RouteDefinition): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* A React Router framework app, server rendered on `app`: `GET`, `POST`,
|
|
49
|
+
* `PUT`, `PATCH` and `DELETE` at `/*`, behind every middleware declared on `app`
|
|
50
|
+
* before it. Each loader, action and middleware reads what those added
|
|
51
|
+
* through `alxiaOf<App>(context)`. The app's own routes — an `/api`
|
|
52
|
+
* — answer their paths, declared before it or after; the client build's
|
|
53
|
+
* files are served when `client` is given.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* const app = base.plugin((app) =>
|
|
57
|
+
* reactRouter(app, { build: () => import('./build/server/index.js'), client: 'build/client' }),
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function reactRouter<Ctx extends object, Prefix extends string>(app: Alxia<Ctx, Prefix>, options: ReactRouterOptions<Ctx>): Alxia<Ctx, Prefix>;
|
|
62
|
+
/**
|
|
63
|
+
* Declares the client build's files on `app`, marked for
|
|
64
|
+
* `isReactRouterRoute`: what `reactRouter()` does with `client`, apart, so
|
|
65
|
+
* that `createServer()` serves them before the middlewares of `configure`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function declareClient(app: AnyAlxia, client: string | URL, precompressed?: boolean): void;
|
|
68
|
+
//# sourceMappingURL=react-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-router.d.ts","sourceRoot":"","sources":["../src/react-router.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,KAAK,eAAe,EAEpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGN,qBAAqB,EACrB,KAAK,WAAW,EAChB,MAAM,cAAc,CAAC;AAItB,MAAM,WAAW,kBAAkB,CAAC,GAAG;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,CAAC,MAAM,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC;IAChE,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CACzB,GAAG,EAAE,WAAW,GAAG,GAAG,EACtB,OAAO,EAAE,qBAAqB,KAC1B,YAAY,CAAC,IAAI,CAAC,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CACjC;AAQD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAElE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,EACpE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,EACvB,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAC9B,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CA0BpB;AAiBD;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,MAAM,GAAG,GAAG,EACpB,aAAa,UAAO,GAClB,IAAI,CAIN"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createServer()`: the alxia server of a React Router app, as
|
|
3
|
+
* `@softistx/alxia-react-router/vite` builds it. The plugin hands it React Router's
|
|
4
|
+
* build, the mode and the client folder; the app's own `app/server.ts`
|
|
5
|
+
* customises the rest, or is not written at all.
|
|
6
|
+
*/
|
|
7
|
+
import { type Alxia, type AnyAlxia, type ContextOf, type Empty, type ListenOptions, type MaybePromise, type ProxyTrust } from '@softistx/alxia';
|
|
8
|
+
import type { RouterContextProvider, ServerBuild } from 'react-router';
|
|
9
|
+
import { type ServerHealth } from './health';
|
|
10
|
+
/** An app as `alxia()` makes it: what `beforeAll`, or `configure`, receives. */
|
|
11
|
+
export type FreshApp = Alxia<Empty, ''>;
|
|
12
|
+
/**
|
|
13
|
+
* What the Vite plugin hands the server, and a test passes to `create`:
|
|
14
|
+
* React Router's server build, its mode, and the client build's folder.
|
|
15
|
+
*/
|
|
16
|
+
export interface ServerWiring {
|
|
17
|
+
/**
|
|
18
|
+
* React Router's server build, or a function that returns it: called on
|
|
19
|
+
* every request in `development`, once in `production`.
|
|
20
|
+
*/
|
|
21
|
+
readonly build: ServerBuild | (() => MaybePromise<ServerBuild>);
|
|
22
|
+
/** `development` under `react-router dev`, `production` in a build, and by default. */
|
|
23
|
+
readonly mode?: 'development' | 'production';
|
|
24
|
+
/** The client build's folder, a path or a `file:` URL: served in `production`. */
|
|
25
|
+
readonly client?: string | URL | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface ServerOptions<Before extends AnyAlxia, App extends AnyAlxia> {
|
|
28
|
+
/**
|
|
29
|
+
* A health probe, declared before everything else: before `beforeAll`,
|
|
30
|
+
* the client's files and every middleware, so it needs no session, sets
|
|
31
|
+
* no cookie and renders nothing: `@softistx/alxia`'s `health()` in text,
|
|
32
|
+
* liveness alone (no `/ready`). `GET` answers `200` `ok` as `text/plain`,
|
|
33
|
+
* or `503` `unavailable` when `check` fails, always with
|
|
34
|
+
* `cache-control: no-store`. A path, or `{ path, check }`.
|
|
35
|
+
*/
|
|
36
|
+
readonly health?: `/${string}` | ServerHealth;
|
|
37
|
+
/**
|
|
38
|
+
* Runs first, on a new app: what is declared here runs before the
|
|
39
|
+
* client's files too — a guard, a rate limit, a logger that should see
|
|
40
|
+
* every request. Returns the app, so its types flow to `configure`.
|
|
41
|
+
*/
|
|
42
|
+
readonly beforeAll?: (app: FreshApp) => Before;
|
|
43
|
+
/**
|
|
44
|
+
* The app the pages run behind: its middlewares, its plugins, its `/api`.
|
|
45
|
+
* Declared after the client's files and before the catch-all. Returns
|
|
46
|
+
* the app: what it builds is what the loaders read through `alxiaOf`.
|
|
47
|
+
*/
|
|
48
|
+
readonly configure?: (app: Before) => App;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the app's own keys on React Router's context provider, `ctx`
|
|
51
|
+
* typed by `configure`'s app. `alxiaContext` is always set.
|
|
52
|
+
*/
|
|
53
|
+
readonly getLoadContext?: (ctx: ContextOf<App>, context: RouterContextProvider) => MaybePromise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* The proxies in front of the app, `trustProxy({ trusted })` from
|
|
56
|
+
* `@softistx/alxia`: `alxia({ proxy })`'s option, so `ctx.ip` is the
|
|
57
|
+
* client's and React Router's `request.url` the URL it asked for.
|
|
58
|
+
*/
|
|
59
|
+
readonly proxy?: ProxyTrust;
|
|
60
|
+
/** Overrides the plugin's server build: rarely wanted. */
|
|
61
|
+
readonly build?: ServerWiring['build'];
|
|
62
|
+
/** Overrides the plugin's mode, `development` in dev and `production` in a build. */
|
|
63
|
+
readonly mode?: 'development' | 'production';
|
|
64
|
+
/**
|
|
65
|
+
* Overrides the plugin's client folder, `build/client` beside the built
|
|
66
|
+
* server. `false` serves none of it: declare the files yourself, in
|
|
67
|
+
* `beforeAll` or `configure`.
|
|
68
|
+
*/
|
|
69
|
+
readonly client?: string | URL | false;
|
|
70
|
+
/**
|
|
71
|
+
* Serves the client's `.br` and `.gz` copies, which `alxia()` writes at
|
|
72
|
+
* build time, to a browser that accepts them: `true` by default.
|
|
73
|
+
* `false` serves the files as they are.
|
|
74
|
+
*/
|
|
75
|
+
readonly precompressed?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* `listen`'s options for `bun build/server/index.js` — `shutdownTimeout`,
|
|
78
|
+
* `signals` among them; a `port` or `hostname` here wins over `PORT` (3000)
|
|
79
|
+
* and `HOST` (`0.0.0.0`) from the environment.
|
|
80
|
+
*/
|
|
81
|
+
readonly listen?: ListenOptions;
|
|
82
|
+
/**
|
|
83
|
+
* Called once the built server listens and its `SIGINT` and `SIGTERM` handlers are in place.
|
|
84
|
+
* Prints `alxia listening on <url>` by default, and in dev the route
|
|
85
|
+
* table (`alxia({ dev })`). An `onListen` in `listen` wins over it.
|
|
86
|
+
*/
|
|
87
|
+
readonly onListen?: (server: Bun.Server<unknown>) => void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The server `createServer()` describes, made into an app by the Vite
|
|
91
|
+
* plugin, by a test, or by a server file of your own.
|
|
92
|
+
*/
|
|
93
|
+
export interface ReactRouterServer<App extends AnyAlxia> {
|
|
94
|
+
/**
|
|
95
|
+
* The app, serving React Router's build: `build/server/index.js`'s
|
|
96
|
+
* default export. A test drives it with `app.request`.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* const app = server.create({ build: await import('./build/server/index.js') });
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
create(wiring: ServerWiring): App;
|
|
103
|
+
/**
|
|
104
|
+
* Listens with `app`, on `listen`, `PORT` and `HOST`, and shuts it down
|
|
105
|
+
* gracefully on `SIGINT` or `SIGTERM`, as `@softistx/alxia`'s `listen` does:
|
|
106
|
+
* the requests in flight finish within `shutdownTimeout`, its `onStop`
|
|
107
|
+
* hooks run, and the process exits. What `bun build/server/index.js` runs.
|
|
108
|
+
*/
|
|
109
|
+
start(app: App): Bun.Server<unknown>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The alxia server of a React Router app, for `app/server.ts`. Every option
|
|
113
|
+
* is optional: the Vite plugin wires React Router's build, the mode and the
|
|
114
|
+
* client folder, and without the file uses `createServer()` as it is.
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* const server = createServer({
|
|
118
|
+
* configure: (app) => app.use(logger()).get('/api/health', ({ reply }) => reply.ok({ ok: true })),
|
|
119
|
+
* });
|
|
120
|
+
* export default server;
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* The request runs through `beforeAll`, the client's files, `configure`,
|
|
124
|
+
* then the pages.
|
|
125
|
+
*/
|
|
126
|
+
export declare function createServer<Before extends AnyAlxia = FreshApp, App extends AnyAlxia = Before>(options?: ServerOptions<Before, App>): ReactRouterServer<App>;
|
|
127
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EAEb,KAAK,SAAS,EACd,KAAK,KAAK,EAEV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAG5D,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,CAAC,MAAM,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC;IAChE,uFAAuF;IACvF,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IAC7C,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,QAAQ,EAAE,GAAG,SAAS,QAAQ;IAC3E;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,MAAM,EAAE,GAAG,YAAY,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,MAAM,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CACzB,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EACnB,OAAO,EAAE,qBAAqB,KAC1B,YAAY,CAAC,IAAI,CAAC,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,qFAAqF;IACrF,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,GAAG,SAAS,QAAQ;IACtD;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC;IAClC;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC3B,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAClC,GAAG,SAAS,QAAQ,GAAG,MAAM,EAC5B,OAAO,GAAE,aAAa,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAsDlE"}
|