@softistx/alxia-react-router 0.0.0-stage → 0.83.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,324 @@
|
|
|
1
|
+
# Customising the server
|
|
2
|
+
|
|
3
|
+
This page covers changing the default server with `createServer()`, and the
|
|
4
|
+
escape hatches for leaving it: another entry, overriding the wiring, or a
|
|
5
|
+
server of your own.
|
|
6
|
+
|
|
7
|
+
Write `app/server.ts`, with `createServer()` as its default export, or let
|
|
8
|
+
the package's bin write it for you.
|
|
9
|
+
|
|
10
|
+
## Revealing the default server
|
|
11
|
+
|
|
12
|
+
From the app's root, once `@softistx/alxia-react-router` is installed:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
bunx alxia-react-router reveal
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
alxia-react-router: wrote app/server.ts, the server alxia() runs by default.
|
|
20
|
+
Next: uncomment configure in app/server.ts to add the app's middlewares and /api; bun run dev picks it up.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The file is the server the plugin runs without one, `createServer()`, so
|
|
24
|
+
the app answers as before. It holds `beforeAll`, `configure` and
|
|
25
|
+
`getLoadContext`, commented, each of which compiles once uncommented
|
|
26
|
+
(`getLoadContext`'s key is yours to make, below), and the `Register`
|
|
27
|
+
declaration that types the loaders:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// app/server.ts, as reveal writes it, less its comments
|
|
31
|
+
import { createServer } from '@softistx/alxia-react-router';
|
|
32
|
+
// import { userAgentContext } from './context';
|
|
33
|
+
|
|
34
|
+
const server = createServer({
|
|
35
|
+
// beforeAll: (app) => app,
|
|
36
|
+
// configure: (app) => app.get('/api/health', ({ reply }) => reply.ok({ ok: true })),
|
|
37
|
+
// getLoadContext: (ctx, context) => {
|
|
38
|
+
// context.set(userAgentContext, ctx.request.headers.get('user-agent'));
|
|
39
|
+
// },
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default server;
|
|
43
|
+
|
|
44
|
+
declare module '@softistx/alxia-react-router' {
|
|
45
|
+
interface Register {
|
|
46
|
+
server: typeof server;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`getLoadContext`'s example sets a key of the app's own, imported from
|
|
52
|
+
`app/context.ts`. Make it there before uncommenting both lines:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// app/context.ts
|
|
56
|
+
import { createContext } from 'react-router';
|
|
57
|
+
|
|
58
|
+
export const userAgentContext = createContext<string | null>(null);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- **Where it writes**: the `entry` that `alxia({ entry: '…' })` names in
|
|
62
|
+
`vite.config.ts`, or `server.ts` in React Router's `appDirectory`
|
|
63
|
+
(`app/` unless `react-router.config.ts` names another). It reads both as
|
|
64
|
+
string literals, past comments. A computed one is refused, since
|
|
65
|
+
reveal would write a file the plugin does not load: give it as a
|
|
66
|
+
literal.
|
|
67
|
+
- **It never overwrites**: a file already there is left as it is, and the
|
|
68
|
+
command exits 1. `bunx alxia-react-router reveal --force` overwrites it.
|
|
69
|
+
- **Bun only**: the bin starts with `#!/usr/bin/env bun`, so no Node is
|
|
70
|
+
needed.
|
|
71
|
+
|
|
72
|
+
React Router's own rendering entries, `app/entry.server.tsx` and
|
|
73
|
+
`app/entry.client.tsx`, are revealed by React Router:
|
|
74
|
+
`bunx react-router reveal`.
|
|
75
|
+
|
|
76
|
+
## By hand
|
|
77
|
+
|
|
78
|
+
The example uses `@softistx/alxia-logger` and `@softistx/alxia-compress`
|
|
79
|
+
(`bun add @softistx/alxia-logger @softistx/alxia-compress`); any middleware works the same way.
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// app/server.ts
|
|
83
|
+
import { compress } from '@softistx/alxia-compress';
|
|
84
|
+
import { logger } from '@softistx/alxia-logger';
|
|
85
|
+
import { createServer } from '@softistx/alxia-react-router';
|
|
86
|
+
|
|
87
|
+
const server = createServer({
|
|
88
|
+
configure: (app) =>
|
|
89
|
+
app
|
|
90
|
+
.use(logger())
|
|
91
|
+
.use(compress())
|
|
92
|
+
.get('/api/health', ({ reply }) => reply.ok({ ok: true }))
|
|
93
|
+
.derive(({ request }) => {
|
|
94
|
+
const name = request.headers.get('x-user');
|
|
95
|
+
return { user: name === null ? null : { name } };
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export default server;
|
|
100
|
+
|
|
101
|
+
declare module '@softistx/alxia-react-router' {
|
|
102
|
+
interface Register {
|
|
103
|
+
server: typeof server;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Every option is optional:
|
|
109
|
+
|
|
110
|
+
| option | what it does |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `configure(app)` | the app the pages run behind: its middlewares and `/api`. It returns the app, and what it builds is what the loaders read |
|
|
113
|
+
| `health` | `'/health'` or `{ path?, check?, timeout? }`: a liveness probe declared before everything else; see [A health probe](#a-health-probe) |
|
|
114
|
+
| `beforeAll(app)` | runs first, on a new app. What it declares applies to the client's files too: a rate limit, a guard on everything, a logger that should see every asset. It returns the app, which `configure` then receives |
|
|
115
|
+
| `getLoadContext(ctx, context)` | sets the app's own keys on React Router's provider, `ctx` typed by `configure`'s app |
|
|
116
|
+
| `build`, `mode`, `client` | override what the plugin wires; see [Escape hatches](#escape-hatches) |
|
|
117
|
+
| `precompressed` | `false` serves the client's files as they are, without their `.br` and `.gz` copies; see [Compressed](beside-the-pages.md#compressed) |
|
|
118
|
+
| `listen` | `listen`'s options for `bun build/server/index.js`: `port`, `hostname`, `idleTimeout`, `maxRequestBodySize`, `tls`, `onListen`. A `port` or `hostname` given here wins over `PORT` and `HOST`; an `onListen` here, told `@softistx/alxia`'s `ListenInfo` — `url`, `routes`, `table`, `dev` — wins over the option below |
|
|
119
|
+
| `onListen(server)` | called once the built server listens and its `SIGINT` and `SIGTERM` handlers are in place, in place of the `alxia listening on …` line (and, in dev, of the route table); a signal sent from then on runs the `onStop` hooks |
|
|
120
|
+
|
|
121
|
+
A request goes through four layers, in order:
|
|
122
|
+
|
|
123
|
+
1. what `beforeAll` declared;
|
|
124
|
+
2. the client's files, `build/client`, in a build;
|
|
125
|
+
3. what `configure` declared;
|
|
126
|
+
4. the pages: `GET`, `POST`, `PUT`, `PATCH` and `DELETE` at `/*`.
|
|
127
|
+
|
|
128
|
+
A middleware given to `use` runs on every route declared after it, and on a
|
|
129
|
+
request no route matches. So a session or a guard in `configure` runs around
|
|
130
|
+
every page and its data. It does not run around what is declared before it:
|
|
131
|
+
the client's files, which sit between `beforeAll` and `configure`. What must
|
|
132
|
+
see every request, the client's files included, goes in `beforeAll`: the
|
|
133
|
+
logger, `@softistx/alxia-cors`, `@softistx/alxia-compress`, and the security headers of the
|
|
134
|
+
assets (`secureHeaders` without a policy and without cache headers). The
|
|
135
|
+
headers of the pages, the CSP with a nonce and `no-store`, go in `configure`
|
|
136
|
+
with `pageHeaders`: see
|
|
137
|
+
[the headers recipe](csp-nonce.md#1-the-headers-in-appserverts).
|
|
138
|
+
|
|
139
|
+
A guard on the app answers a request no route matches too: an anonymous request to a missing path
|
|
140
|
+
gets the 401, not the 404. Scope it with a path, `use('/app', guard)`
|
|
141
|
+
(a guard that adds nothing to the context: `bearer` and `session` add `user`),
|
|
142
|
+
to guard only some pages.
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
// app/server.ts: a guard on everything, the assets included
|
|
146
|
+
import { createServer } from '@softistx/alxia-react-router';
|
|
147
|
+
|
|
148
|
+
export default createServer({
|
|
149
|
+
beforeAll: (app) =>
|
|
150
|
+
app.derive(({ request, reply }) =>
|
|
151
|
+
request.headers.get('authorization') === `Bearer ${process.env['TOKEN']}`
|
|
152
|
+
? {}
|
|
153
|
+
: reply(401, { error: 'unauthorized' }),
|
|
154
|
+
),
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`configure` and `beforeAll` must return the app; one that returns nothing
|
|
159
|
+
is a compile error. A middleware that needs something an earlier one
|
|
160
|
+
derived is typed by the app it is given, as anywhere in alxia.
|
|
161
|
+
|
|
162
|
+
## A health probe
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
createServer({ health: { path: '/health', check: () => db.ping() } });
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`GET /health` answers `200` `ok` as `text/plain` with `cache-control:
|
|
169
|
+
no-store`, or `503` `unavailable` when `check` returns `false`, throws,
|
|
170
|
+
rejects or outlasts `timeout` (1 000 ms by default); `undefined` or no
|
|
171
|
+
return value counts as healthy, and the error is not logged. It is declared
|
|
172
|
+
before `beforeAll`, the client's files and every middleware, so it renders
|
|
173
|
+
nothing, reads no session and sets no cookie. It is liveness only: it is
|
|
174
|
+
`@softistx/alxia`'s `health()` with `format: 'text'` and `ready: false`, and, as
|
|
175
|
+
that one, left out by `matchesSpec`. For `/ready` and its checks mount
|
|
176
|
+
`health()` yourself in `beforeAll`, on another `path`: it declares `/health`
|
|
177
|
+
too, and the app refuses a route declared twice.
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
createServer({
|
|
181
|
+
health: '/health',
|
|
182
|
+
beforeAll: (app) => app.plugin(health({ path: '/live' })), // `health` from @softistx/alxia
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Behind a proxy
|
|
187
|
+
|
|
188
|
+
A proxy or a load balancer that terminates TLS asks the server over plain
|
|
189
|
+
HTTP, at an address of its own, so React Router's `request.url` reads
|
|
190
|
+
`http://10.0.0.5:3000/…`. Name the proxies with `proxy`, `@softistx/alxia`'s
|
|
191
|
+
`trustProxy`:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
// app/server.ts
|
|
195
|
+
import { trustProxy } from '@softistx/alxia';
|
|
196
|
+
import { createServer } from '@softistx/alxia-react-router';
|
|
197
|
+
|
|
198
|
+
export default createServer({
|
|
199
|
+
proxy: trustProxy({ trusted: ['10.0.0.0/8'], untrusted: 'refuse' }),
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
// app/routes/login.tsx
|
|
205
|
+
import type { LoaderFunctionArgs } from 'react-router';
|
|
206
|
+
|
|
207
|
+
export function loader({ request }: LoaderFunctionArgs) {
|
|
208
|
+
// https://example.com/auth/callback behind the proxy
|
|
209
|
+
return { callback: new URL('/auth/callback', request.url).href };
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Every request through the catch-all is handed to React Router at
|
|
214
|
+
`originalUrl(ctx)`: the scheme and host the trusted proxy wrote in
|
|
215
|
+
`X-Forwarded-Proto` and `X-Forwarded-Host` (or `Forwarded`, with
|
|
216
|
+
`header: 'forwarded'`), each checked, and the request's own for any it did
|
|
217
|
+
not. A direct client's forwarded headers are ignored, or, with
|
|
218
|
+
`untrusted: 'refuse'`, answered 403 before the pages. `ctx.url` and what
|
|
219
|
+
alxia's middlewares read stay the request as it reached the server. With a
|
|
220
|
+
server of your own, give `alxia({ proxy })` the same option. See
|
|
221
|
+
[Behind a proxy](https://github.com/softistx/alxia/blob/develop/packages/core/docs/guide/serving.md#behind-a-proxy-proxy)
|
|
222
|
+
for what is believed and what is valid.
|
|
223
|
+
|
|
224
|
+
## Escape hatches
|
|
225
|
+
|
|
226
|
+
### Another server file
|
|
227
|
+
|
|
228
|
+
`alxia({ entry })` names the server file, relative to Vite's root, in
|
|
229
|
+
place of `app/server.ts`:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
// vite.config.ts
|
|
233
|
+
import { alxia } from '@softistx/alxia-react-router/vite';
|
|
234
|
+
import { reactRouter } from '@react-router/dev/vite';
|
|
235
|
+
import { defineConfig } from 'vite';
|
|
236
|
+
|
|
237
|
+
export default defineConfig({
|
|
238
|
+
plugins: [reactRouter(), alxia({ entry: 'server/main.ts' })],
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
A missing `entry` is an error, where a missing `app/server.ts` falls back
|
|
243
|
+
to the default server.
|
|
244
|
+
|
|
245
|
+
### Overriding the wiring
|
|
246
|
+
|
|
247
|
+
`build`, `mode` and `client` override what the plugin passes:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
// app/server.ts: the client's files with headers of your own
|
|
251
|
+
import { createServer } from '@softistx/alxia-react-router';
|
|
252
|
+
|
|
253
|
+
export default createServer({
|
|
254
|
+
client: false,
|
|
255
|
+
beforeAll: (app) =>
|
|
256
|
+
app.static('/assets', 'build/client/assets', {
|
|
257
|
+
cacheControl: 'public, max-age=31536000, immutable',
|
|
258
|
+
precompressed: ['br'],
|
|
259
|
+
}),
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
- **`client: false`** serves none of `build/client`: declare the files
|
|
264
|
+
yourself, in `beforeAll` or `configure`. A relative path there is
|
|
265
|
+
resolved against the process's working directory, the project's when it
|
|
266
|
+
runs `bun run start`.
|
|
267
|
+
- **`client`**, a path or a `file:` URL, serves another folder in its
|
|
268
|
+
place.
|
|
269
|
+
- **`mode`** forces React Router's server mode. `development` makes React
|
|
270
|
+
Router send its errors' stacks, and asks `build` for the build on every
|
|
271
|
+
request.
|
|
272
|
+
- **`build`**, a `ServerBuild` or a function returning one, replaces React
|
|
273
|
+
Router's build: rarely wanted.
|
|
274
|
+
|
|
275
|
+
### A server of your own, without the plugin
|
|
276
|
+
|
|
277
|
+
`reactRouter(app, options)` is the catch-all itself, for a server that
|
|
278
|
+
imports the build. Without the plugin, the dev server is React Router's
|
|
279
|
+
own, and the loaders get no alxia context in dev.
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
// server.ts, beside build/
|
|
283
|
+
import { alxia } from '@softistx/alxia';
|
|
284
|
+
import { logger } from '@softistx/alxia-logger';
|
|
285
|
+
import { reactRouter } from '@softistx/alxia-react-router';
|
|
286
|
+
import type { ServerBuild } from 'react-router';
|
|
287
|
+
|
|
288
|
+
export const base = alxia()
|
|
289
|
+
.use(logger())
|
|
290
|
+
.get('/api/health', ({ reply }) => reply.ok({ ok: true }));
|
|
291
|
+
|
|
292
|
+
/** What the loaders read: alxiaOf<Base>(context). */
|
|
293
|
+
export type Base = typeof base;
|
|
294
|
+
|
|
295
|
+
const app = base.plugin((app) =>
|
|
296
|
+
reactRouter(app, {
|
|
297
|
+
build: () =>
|
|
298
|
+
import(new URL('./build/server/index.js', import.meta.url).href) as Promise<ServerBuild>,
|
|
299
|
+
client: new URL('./build/client', import.meta.url),
|
|
300
|
+
}),
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
app.listen({ port: Number(process.env['PORT'] ?? 3000) });
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
```sh
|
|
307
|
+
bun run build && bun server.ts
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
| option | |
|
|
311
|
+
| --- | --- |
|
|
312
|
+
| `build` | a `ServerBuild`, loaded at startup; or a function returning one, called on the first request in `production`, again after a failed load, and on **every** request in `development` |
|
|
313
|
+
| `mode` | React Router's server mode, `production` by default |
|
|
314
|
+
| `getLoadContext(ctx, context)` | as `createServer`'s |
|
|
315
|
+
| `client` | the client build's folder, a path or a `file:` URL, served before the catch-all in `production` |
|
|
316
|
+
| `precompressed` | `true` by default: serves the client's `.br` and `.gz` copies to a browser that accepts them; `false` serves the files as they are |
|
|
317
|
+
|
|
318
|
+
`reactRouter()` goes through `app.plugin`, as `@softistx/alxia-graphql`'s `graphql(app, …)`
|
|
319
|
+
does: that is how it knows the app's context type. A `HEAD` is handed to
|
|
320
|
+
React Router as a `GET`, since React Router answers a `HEAD` of its own
|
|
321
|
+
with no headers at all; the core then drops the body. In a monorepo where
|
|
322
|
+
this package is linked rather than installed, add
|
|
323
|
+
`ssr: { external: ['@softistx/alxia-react-router'] }` to `vite.config.ts`: see
|
|
324
|
+
[the troubleshooting entry](../troubleshooting.md#alxiaof-this-request-has-no-alxia-context-).
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Deploying
|
|
2
|
+
|
|
3
|
+
This page covers running the build with Bun, and the Docker image.
|
|
4
|
+
|
|
5
|
+
Run `bun run build`, then `bun build/server/index.js`. The build is
|
|
6
|
+
[self-contained](how-it-works.md#self-contained): `build/` is all the server needs, with
|
|
7
|
+
no `node_modules`, unless the app keeps a package external with
|
|
8
|
+
`ssr.external`.
|
|
9
|
+
|
|
10
|
+
## Docker
|
|
11
|
+
|
|
12
|
+
The `react-router` template of
|
|
13
|
+
[`@softistx/alxia-create`](https://github.com/softistx/alxia/tree/develop/packages/create)
|
|
14
|
+
and the [example](https://github.com/softistx/alxia/tree/develop/examples/react-router)
|
|
15
|
+
ship this `Dockerfile`, on Bun's official images: built on `oven/bun:1`,
|
|
16
|
+
Debian's, and run on `oven/bun:1-alpine`, about 130 MB. For an app started from
|
|
17
|
+
`create-react-router`, it replaces the template's, which builds and runs
|
|
18
|
+
on Node:
|
|
19
|
+
|
|
20
|
+
```dockerfile
|
|
21
|
+
# Bun builds the app, and the image holds build/ alone: alxia's plugin
|
|
22
|
+
# bundles every dependency into build/server/index.js, alxia's server, which
|
|
23
|
+
# runs on Bun with no node_modules. Pinned to Bun 1, the major alxia
|
|
24
|
+
# supports.
|
|
25
|
+
|
|
26
|
+
# Every dependency, then react-router build: build/client and
|
|
27
|
+
# build/server/index.js.
|
|
28
|
+
FROM oven/bun:1 AS build
|
|
29
|
+
WORKDIR /app
|
|
30
|
+
COPY package.json bun.lock* bunfig.toml* ./
|
|
31
|
+
RUN bun install --frozen-lockfile
|
|
32
|
+
COPY . .
|
|
33
|
+
RUN bun run build
|
|
34
|
+
|
|
35
|
+
# The build, run as Bun's own non-root user with the start script's
|
|
36
|
+
# command, and --no-install: with no node_modules, Bun would otherwise
|
|
37
|
+
# fetch a package the build left out from the registry at startup,
|
|
38
|
+
# where this fails.
|
|
39
|
+
# The server listens on PORT (3000) and HOST (0.0.0.0). On Alpine, about
|
|
40
|
+
# 200 MB lighter: build/ is JavaScript, which runs the same on musl. A
|
|
41
|
+
# native addon built for glibc alone needs oven/bun:1 here.
|
|
42
|
+
FROM oven/bun:1-alpine
|
|
43
|
+
WORKDIR /app
|
|
44
|
+
ENV NODE_ENV=production
|
|
45
|
+
COPY --from=build /app/build ./build
|
|
46
|
+
USER bun
|
|
47
|
+
EXPOSE 3000
|
|
48
|
+
CMD ["bun", "--no-install", "build/server/index.js"]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
docker build -t my-app .
|
|
53
|
+
docker run -p 3000:3000 my-app
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Keep the template's `.dockerignore` beside it: `node_modules`, `build` and
|
|
57
|
+
`.react-router` stay out of the context, so the image installs and builds
|
|
58
|
+
its own. The `bunfig.toml` goes in, and `bun run build` runs React
|
|
59
|
+
Router's CLI on Bun, as it does outside Docker. The image's command is
|
|
60
|
+
`start`'s, run directly, so the platform's `SIGTERM` reaches the server,
|
|
61
|
+
with `--no-install`: a package missing from `build/` then fails at
|
|
62
|
+
startup, where Bun would otherwise fetch it from npm.
|
|
63
|
+
|
|
64
|
+
- **Commit `bun.lock`.** The installs are `--frozen-lockfile`: the image
|
|
65
|
+
gets the versions you tested, and a `package.json` changed without a
|
|
66
|
+
`bun install` fails the build
|
|
67
|
+
([troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/troubleshooting.md#error-lockfile-had-changes-but-lockfile-is-frozen)).
|
|
68
|
+
- **The final stage is Alpine's**, musl where the build stage has glibc.
|
|
69
|
+
`build/` is JavaScript, which runs the same on both. A native addon
|
|
70
|
+
kept external and built for glibc alone does not load there: put the
|
|
71
|
+
final stage back on `oven/bun:1`
|
|
72
|
+
([`@softistx/alxia-create`'s troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/create/docs/troubleshooting.md#error--is-linked-against-glibc-dt_needed-libmso6-but-this-bun-build-uses-musl)).
|
|
73
|
+
- **The server runs as `bun`**, a user with no write access to `/app`.
|
|
74
|
+
Write files to a volume the user owns
|
|
75
|
+
([troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/troubleshooting.md#eacces-permission-denied-open-app)).
|
|
76
|
+
- **The image holds `build/` alone**, no `node_modules`: the build is
|
|
77
|
+
[self-contained](how-it-works.md#self-contained). An app that keeps a package external
|
|
78
|
+
with `ssr.external` copies the production dependencies too, from a
|
|
79
|
+
stage of their own:
|
|
80
|
+
|
|
81
|
+
```dockerfile
|
|
82
|
+
# Before the build stage: the production dependencies alone.
|
|
83
|
+
FROM oven/bun:1 AS production-dependencies
|
|
84
|
+
WORKDIR /app
|
|
85
|
+
COPY package.json bun.lock* bunfig.toml* ./
|
|
86
|
+
RUN bun install --frozen-lockfile --production
|
|
87
|
+
|
|
88
|
+
# In the final stage, beside build/.
|
|
89
|
+
COPY --from=production-dependencies /app/node_modules ./node_modules
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Without it, the container stops at startup with
|
|
93
|
+
`Cannot find package '…'`
|
|
94
|
+
([troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/troubleshooting.md#error-cannot-find-package--from-appbuildserverindexjs)).
|
|
95
|
+
|
|
96
|
+
`PORT` and `HOST` set where the server listens. The platform's `SIGTERM`
|
|
97
|
+
stops it once the requests in flight are answered, within
|
|
98
|
+
`shutdownTimeout`, and runs the app's `onStop` hooks. The short route to a liveness probe is
|
|
99
|
+
`createServer({ health: '/health' })`, declared before every middleware;
|
|
100
|
+
give the platform a readiness probe with `@softistx/alxia`'s `health()`, mounted
|
|
101
|
+
in `beforeAll` on another `path` (`health({ path: '/live' })`: it declares
|
|
102
|
+
`/health` too, which the option already took).
|