@timber-js/app 0.2.0-alpha.19 → 0.2.0-alpha.190
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 +8 -0
- package/agent-skill.md +344 -0
- package/dist/_chunks/actions-35jnMdeJ.js +318 -0
- package/dist/_chunks/actions-35jnMdeJ.js.map +1 -0
- package/dist/_chunks/als-registry-C6kcfprT.js +41 -0
- package/dist/_chunks/als-registry-C6kcfprT.js.map +1 -0
- package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
- package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
- package/dist/_chunks/base-path-DaQrzbez.js +80 -0
- package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js +86 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
- package/dist/_chunks/build-output-helper-C3DrfzZR.js +369 -0
- package/dist/_chunks/build-output-helper-C3DrfzZR.js.map +1 -0
- package/dist/_chunks/cache-api-DjNrIWRR.js +1196 -0
- package/dist/_chunks/cache-api-DjNrIWRR.js.map +1 -0
- package/dist/_chunks/cli-check-CpmN7Nh-.js +256 -0
- package/dist/_chunks/cli-check-CpmN7Nh-.js.map +1 -0
- package/dist/_chunks/cli-schema-sync-CGMp_Psg.js +298 -0
- package/dist/_chunks/cli-schema-sync-CGMp_Psg.js.map +1 -0
- package/dist/_chunks/cloudflare-CGP6BZKO.js +1284 -0
- package/dist/_chunks/cloudflare-CGP6BZKO.js.map +1 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
- package/dist/_chunks/convention-lint-kXsgc_-7.js +784 -0
- package/dist/_chunks/convention-lint-kXsgc_-7.js.map +1 -0
- package/dist/_chunks/dist-BA3u1z3W.js +423 -0
- package/dist/_chunks/dist-BA3u1z3W.js.map +1 -0
- package/dist/_chunks/error-boundary-D-ODYX41.js +353 -0
- package/dist/_chunks/error-boundary-D-ODYX41.js.map +1 -0
- package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
- package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
- package/dist/_chunks/file-cache-DmX7OqZP.js +454 -0
- package/dist/_chunks/file-cache-DmX7OqZP.js.map +1 -0
- package/dist/_chunks/format-CfwjgPz9.js +14 -0
- package/dist/_chunks/format-CfwjgPz9.js.map +1 -0
- package/dist/_chunks/fs-identity-D7vb6GdI.js +208 -0
- package/dist/_chunks/fs-identity-D7vb6GdI.js.map +1 -0
- package/dist/_chunks/href-validation-CMc5JRls.js +141 -0
- package/dist/_chunks/href-validation-CMc5JRls.js.map +1 -0
- package/dist/_chunks/json-lossy-check-ClNvBM_3.js +63 -0
- package/dist/_chunks/json-lossy-check-ClNvBM_3.js.map +1 -0
- package/dist/_chunks/logger-D8xJZXIN.js +1451 -0
- package/dist/_chunks/logger-D8xJZXIN.js.map +1 -0
- package/dist/_chunks/mdx-file-C005ay-P.js +25 -0
- package/dist/_chunks/mdx-file-C005ay-P.js.map +1 -0
- package/dist/_chunks/plugin-context-rCinWLiE.js +321 -0
- package/dist/_chunks/plugin-context-rCinWLiE.js.map +1 -0
- package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
- package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
- package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
- package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
- package/dist/_chunks/router-ref-DuYuV_0Q.js +28 -0
- package/dist/_chunks/router-ref-DuYuV_0Q.js.map +1 -0
- package/dist/_chunks/rsc-cache-key-DD0fl_-s.js +243 -0
- package/dist/_chunks/rsc-cache-key-DD0fl_-s.js.map +1 -0
- package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js +40 -0
- package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js.map +1 -0
- package/dist/_chunks/rsc-media-type-DRqE_lD_.js +46 -0
- package/dist/_chunks/rsc-media-type-DRqE_lD_.js.map +1 -0
- package/dist/_chunks/rsc-payload-path-B_LBodc2.js +48 -0
- package/dist/_chunks/rsc-payload-path-B_LBodc2.js.map +1 -0
- package/dist/_chunks/scanner-C8b0Gcw3.js +1564 -0
- package/dist/_chunks/scanner-C8b0Gcw3.js.map +1 -0
- package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
- package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
- package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
- package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
- package/dist/_chunks/segment-context-CjOlyB8Y.js +97 -0
- package/dist/_chunks/segment-context-CjOlyB8Y.js.map +1 -0
- package/dist/_chunks/segment-keys-BawYuNFO.js +307 -0
- package/dist/_chunks/segment-keys-BawYuNFO.js.map +1 -0
- package/dist/_chunks/sizeof-lXffQ1Vr.js +35 -0
- package/dist/_chunks/sizeof-lXffQ1Vr.js.map +1 -0
- package/dist/_chunks/slot-params-BCTmZkQB.js +76 -0
- package/dist/_chunks/slot-params-BCTmZkQB.js.map +1 -0
- package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-14MXm7Pj.js} +17 -2
- package/dist/_chunks/ssr-data-14MXm7Pj.js.map +1 -0
- package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
- package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
- package/dist/_chunks/use-segment-params-C4r4BD9T.js +398 -0
- package/dist/_chunks/use-segment-params-C4r4BD9T.js.map +1 -0
- package/dist/_chunks/walkers-RzN6AFjr.js +141 -0
- package/dist/_chunks/walkers-RzN6AFjr.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +72 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.d.ts +109 -0
- package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.js +73 -0
- package/dist/adapters/cloudflare-dev.js.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.js +124 -0
- package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +199 -21
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +2 -188
- package/dist/adapters/compress-module.d.ts +17 -4
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/fs-identity.d.ts +64 -0
- package/dist/adapters/fs-identity.d.ts.map +1 -0
- package/dist/adapters/nitro.d.ts +55 -3
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +287 -171
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +62 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/types.d.ts +28 -6
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cache/cache-api.d.ts +48 -0
- package/dist/cache/cache-api.d.ts.map +1 -0
- package/dist/cache/fast-hash.d.ts +5 -0
- package/dist/cache/fast-hash.d.ts.map +1 -1
- package/dist/cache/handler-store.d.ts +33 -0
- package/dist/cache/handler-store.d.ts.map +1 -0
- package/dist/cache/index.d.ts +31 -8
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +3 -326
- package/dist/cache/invalidation-epoch.d.ts +43 -0
- package/dist/cache/invalidation-epoch.d.ts.map +1 -0
- package/dist/cache/json-lossy-check.d.ts +11 -0
- package/dist/cache/json-lossy-check.d.ts.map +1 -0
- package/dist/cache/redis-handler.d.ts +140 -8
- package/dist/cache/redis-handler.d.ts.map +1 -1
- package/dist/cache/singleflight.d.ts +19 -2
- package/dist/cache/singleflight.d.ts.map +1 -1
- package/dist/cache/sizeof.d.ts +22 -0
- package/dist/cache/sizeof.d.ts.map +1 -0
- package/dist/cache/stable-stringify.d.ts +9 -0
- package/dist/cache/stable-stringify.d.ts.map +1 -1
- package/dist/cache/store.d.ts +53 -0
- package/dist/cache/store.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
- package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.js +29 -0
- package/dist/cache/stores/cloudflare-kv.js.map +1 -0
- package/dist/cache/stores/memory.d.ts +42 -0
- package/dist/cache/stores/memory.d.ts.map +1 -0
- package/dist/cache/stores/memory.js +90 -0
- package/dist/cache/stores/memory.js.map +1 -0
- package/dist/cache/stores/redis.d.ts +69 -0
- package/dist/cache/stores/redis.d.ts.map +1 -0
- package/dist/cache/stores/redis.js +35 -0
- package/dist/cache/stores/redis.js.map +1 -0
- package/dist/cache/stores/vercel.d.ts +36 -0
- package/dist/cache/stores/vercel.d.ts.map +1 -0
- package/dist/cache/stores/vercel.js +33 -0
- package/dist/cache/stores/vercel.js.map +1 -0
- package/dist/cache/tag-aware-handler.d.ts +52 -0
- package/dist/cache/tag-aware-handler.d.ts.map +1 -0
- package/dist/cache/timber-cache.d.ts +20 -10
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cdn/cloudflare-purge.d.ts +23 -0
- package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
- package/dist/cdn/cloudflare-purge.js +30 -0
- package/dist/cdn/cloudflare-purge.js.map +1 -0
- package/dist/cdn/fastly-purge.d.ts +25 -0
- package/dist/cdn/fastly-purge.d.ts.map +1 -0
- package/dist/cdn/fastly-purge.js +33 -0
- package/dist/cdn/fastly-purge.js.map +1 -0
- package/dist/cdn/headers.d.ts +97 -0
- package/dist/cdn/headers.d.ts.map +1 -0
- package/dist/cdn/index.d.ts +5 -0
- package/dist/cdn/index.d.ts.map +1 -0
- package/dist/cdn/index.js +94 -0
- package/dist/cdn/index.js.map +1 -0
- package/dist/cdn/purge-store.d.ts +23 -0
- package/dist/cdn/purge-store.d.ts.map +1 -0
- package/dist/cdn/workers-cache-purge.d.ts +16 -0
- package/dist/cdn/workers-cache-purge.d.ts.map +1 -0
- package/dist/cdn/workers-cache-purge.js +35 -0
- package/dist/cdn/workers-cache-purge.js.map +1 -0
- package/dist/cli-check.d.ts +153 -0
- package/dist/cli-check.d.ts.map +1 -0
- package/dist/cli-schema-sync.d.ts +59 -0
- package/dist/cli-schema-sync.d.ts.map +1 -0
- package/dist/cli.d.ts +66 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +151 -47
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +37 -1
- package/dist/client/browser-dev.d.ts.map +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
- package/dist/client/browser-entry/hmr.d.ts +21 -0
- package/dist/client/browser-entry/hmr.d.ts.map +1 -0
- package/dist/client/browser-entry/hydrate.d.ts +57 -0
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
- package/dist/client/browser-entry/index.d.ts +29 -0
- package/dist/client/browser-entry/index.d.ts.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +29 -0
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
- package/dist/client/browser-entry/router-init.d.ts +30 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -0
- package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
- package/dist/client/browser-entry/scroll.d.ts +28 -0
- package/dist/client/browser-entry/scroll.d.ts.map +1 -0
- package/dist/client/error-boundary.d.ts +19 -5
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -125
- package/dist/client/error-reconstituter.d.ts +61 -0
- package/dist/client/error-reconstituter.d.ts.map +1 -0
- package/dist/client/form.d.ts +16 -27
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/history.d.ts +29 -7
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +11 -24
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +186 -1134
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +20 -0
- package/dist/client/internal.d.ts.map +1 -0
- package/dist/client/internal.js +1624 -0
- package/dist/client/internal.js.map +1 -0
- package/dist/client/link.d.ts +63 -60
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/navigation-api.d.ts +121 -0
- package/dist/client/navigation-api.d.ts.map +1 -0
- package/dist/client/navigation-commit.d.ts +87 -0
- package/dist/client/navigation-commit.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +38 -20
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +159 -0
- package/dist/client/navigation-root.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts +1 -1
- package/dist/client/nuqs-adapter.d.ts.map +1 -1
- package/dist/client/params-context.d.ts +81 -0
- package/dist/client/params-context.d.ts.map +1 -0
- package/dist/client/router-effects.d.ts +129 -0
- package/dist/client/router-effects.d.ts.map +1 -0
- package/dist/client/router-lifecycle.d.ts +55 -0
- package/dist/client/router-lifecycle.d.ts.map +1 -0
- package/dist/client/router-pipeline.d.ts +84 -0
- package/dist/client/router-pipeline.d.ts.map +1 -0
- package/dist/client/router-ref.d.ts +2 -2
- package/dist/client/router-ref.d.ts.map +1 -1
- package/dist/client/router-skew.d.ts +21 -0
- package/dist/client/router-skew.d.ts.map +1 -0
- package/dist/client/router-types.d.ts +207 -0
- package/dist/client/router-types.d.ts.map +1 -0
- package/dist/client/router.d.ts +1 -97
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +113 -26
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +107 -25
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +57 -0
- package/dist/client/segment-outlet.d.ts.map +1 -0
- package/dist/client/segment-update-context.d.ts +21 -0
- package/dist/client/segment-update-context.d.ts.map +1 -0
- package/dist/client/shallow-url.d.ts +10 -0
- package/dist/client/shallow-url.d.ts.map +1 -0
- package/dist/client/slot-context.d.ts +31 -0
- package/dist/client/slot-context.d.ts.map +1 -0
- package/dist/client/slot-outlet.d.ts +16 -0
- package/dist/client/slot-outlet.d.ts.map +1 -0
- package/dist/client/slot-provider.d.ts +25 -0
- package/dist/client/slot-provider.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +19 -4
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/stale-client.d.ts +69 -0
- package/dist/client/stale-client.d.ts.map +1 -0
- package/dist/client/state.d.ts +11 -2
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/top-loader.d.ts +7 -6
- package/dist/client/top-loader.d.ts.map +1 -1
- package/dist/client/unload-guard.d.ts +5 -0
- package/dist/client/unload-guard.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts +12 -0
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-link-status.d.ts +5 -5
- package/dist/client/use-link-status.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts.map +1 -1
- package/dist/client/use-pending-navigation.d.ts +23 -0
- package/dist/client/use-pending-navigation.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +10 -4
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +2 -2
- package/dist/client/use-router.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts +12 -5
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +26 -14
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +69 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +76 -0
- package/dist/codec.js.map +1 -0
- package/dist/config-types.d.ts +284 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-validation.d.ts +51 -0
- package/dist/config-validation.d.ts.map +1 -0
- package/dist/content/index.d.ts +1 -10
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +0 -2
- package/dist/cookies/define-cookie.d.ts +58 -25
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.d.ts +2 -1
- package/dist/cookies/index.d.ts.map +1 -1
- package/dist/cookies/index.js +257 -36
- package/dist/cookies/index.js.map +1 -1
- package/dist/cookies/json-cookie.d.ts +64 -0
- package/dist/cookies/json-cookie.d.ts.map +1 -0
- package/dist/cookies/validation.d.ts +34 -0
- package/dist/cookies/validation.d.ts.map +1 -0
- package/dist/dev-tools/404-page.d.ts +50 -0
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/dev-tools/browser-logs.d.ts +40 -0
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/dev-tools/dev-page-shell.d.ts +78 -0
- package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
- package/dist/dev-tools/error-page.d.ts +32 -0
- package/dist/dev-tools/error-page.d.ts.map +1 -0
- package/dist/dev-tools/holding-server.d.ts +54 -0
- package/dist/dev-tools/holding-server.d.ts.map +1 -0
- package/dist/dev-tools/hydration-overlay.d.ts +11 -0
- package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
- package/dist/dev-tools/index.d.ts +31 -0
- package/dist/dev-tools/index.d.ts.map +1 -0
- package/dist/dev-tools/instrumentation.d.ts +59 -0
- package/dist/dev-tools/instrumentation.d.ts.map +1 -0
- package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
- package/dist/dev-tools/logger.d.ts.map +1 -0
- package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
- package/dist/dev-tools/logs.d.ts.map +1 -0
- package/dist/dev-tools/overlay.d.ts +91 -0
- package/dist/dev-tools/overlay.d.ts.map +1 -0
- package/dist/dev-tools/stack-classifier.d.ts +34 -0
- package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
- package/dist/dev-tools/terminal.d.ts +28 -0
- package/dist/dev-tools/terminal.d.ts.map +1 -0
- package/dist/fonts/ast-walk.d.ts +68 -0
- package/dist/fonts/ast-walk.d.ts.map +1 -0
- package/dist/fonts/ast.d.ts +110 -6
- package/dist/fonts/ast.d.ts.map +1 -1
- package/dist/fonts/bundle.d.ts +50 -0
- package/dist/fonts/bundle.d.ts.map +1 -0
- package/dist/fonts/dev-middleware.d.ts +22 -0
- package/dist/fonts/dev-middleware.d.ts.map +1 -0
- package/dist/fonts/fallbacks.d.ts +0 -7
- package/dist/fonts/fallbacks.d.ts.map +1 -1
- package/dist/fonts/google.d.ts +4 -2
- package/dist/fonts/google.d.ts.map +1 -1
- package/dist/fonts/local.d.ts +4 -4
- package/dist/fonts/local.d.ts.map +1 -1
- package/dist/fonts/paths.d.ts +43 -0
- package/dist/fonts/paths.d.ts.map +1 -0
- package/dist/fonts/pipeline.d.ts +177 -0
- package/dist/fonts/pipeline.d.ts.map +1 -0
- package/dist/fonts/transform.d.ts +82 -0
- package/dist/fonts/transform.d.ts.map +1 -0
- package/dist/fonts/types.d.ts +47 -1
- package/dist/fonts/types.d.ts.map +1 -1
- package/dist/fonts/virtual-modules.d.ts +77 -0
- package/dist/fonts/virtual-modules.d.ts.map +1 -0
- package/dist/index.d.ts +50 -181
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9805 -14134
- package/dist/index.js.map +1 -1
- package/dist/params/codec-registry.d.ts +26 -0
- package/dist/params/codec-registry.d.ts.map +1 -0
- package/dist/params/define-schema.d.ts +81 -0
- package/dist/params/define-schema.d.ts.map +1 -0
- package/dist/params/index.d.ts +5 -0
- package/dist/params/index.d.ts.map +1 -0
- package/dist/params/index.js +34 -0
- package/dist/params/index.js.map +1 -0
- package/dist/params/resolve-schema.d.ts +34 -0
- package/dist/params/resolve-schema.d.ts.map +1 -0
- package/dist/plugin-context.d.ts +276 -0
- package/dist/plugin-context.d.ts.map +1 -0
- package/dist/plugins/adapter-build.d.ts +21 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts +7 -3
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +47 -10
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/cache.d.ts +64 -0
- package/dist/plugins/cache.d.ts.map +1 -0
- package/dist/plugins/callsite-ast.d.ts +117 -0
- package/dist/plugins/callsite-ast.d.ts.map +1 -0
- package/dist/plugins/callsite-jsx.d.ts +35 -0
- package/dist/plugins/callsite-jsx.d.ts.map +1 -0
- package/dist/plugins/chunks.d.ts +11 -4
- package/dist/plugins/chunks.d.ts.map +1 -1
- package/dist/plugins/client-chunks.d.ts +40 -0
- package/dist/plugins/client-chunks.d.ts.map +1 -0
- package/dist/plugins/cloudflare-wasm.d.ts +21 -0
- package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
- package/dist/plugins/content.d.ts +1 -1
- package/dist/plugins/content.d.ts.map +1 -1
- package/dist/plugins/dev-server.d.ts +17 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts +28 -4
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts +16 -73
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/mdx.d.ts +1 -1
- package/dist/plugins/mdx.d.ts.map +1 -1
- package/dist/plugins/prebuilt-capture.d.ts +60 -0
- package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
- package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
- package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
- package/dist/plugins/prebuilt.d.ts +82 -0
- package/dist/plugins/prebuilt.d.ts.map +1 -0
- package/dist/plugins/prerender-sugar.d.ts +42 -0
- package/dist/plugins/prerender-sugar.d.ts.map +1 -0
- package/dist/plugins/request-dep/analysis.d.ts +106 -0
- package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
- package/dist/plugins/request-dep/index.d.ts +75 -0
- package/dist/plugins/request-dep/index.d.ts.map +1 -0
- package/dist/plugins/request-dep/origin.d.ts +61 -0
- package/dist/plugins/request-dep/origin.d.ts.map +1 -0
- package/dist/plugins/routing.d.ts +1 -1
- package/dist/plugins/routing.d.ts.map +1 -1
- package/dist/plugins/server-bundle.d.ts.map +1 -1
- package/dist/plugins/shims.d.ts +29 -5
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +218 -21
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-shared.d.ts +26 -0
- package/dist/routing/codegen-shared.d.ts.map +1 -0
- package/dist/routing/codegen-types.d.ts +61 -0
- package/dist/routing/codegen-types.d.ts.map +1 -0
- package/dist/routing/codegen-write.d.ts +51 -0
- package/dist/routing/codegen-write.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts +7 -2
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/collision-probe.d.ts +104 -0
- package/dist/routing/collision-probe.d.ts.map +1 -0
- package/dist/routing/collision-spaces.d.ts +26 -0
- package/dist/routing/collision-spaces.d.ts.map +1 -0
- package/dist/routing/convention-lint.d.ts +55 -0
- package/dist/routing/convention-lint.d.ts.map +1 -0
- package/dist/routing/export-detect.d.ts +72 -0
- package/dist/routing/export-detect.d.ts.map +1 -0
- package/dist/routing/file-cache.d.ts +8 -0
- package/dist/routing/file-cache.d.ts.map +1 -0
- package/dist/routing/index.d.ts +7 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +5 -2
- package/dist/routing/interception.d.ts +234 -10
- package/dist/routing/interception.d.ts.map +1 -1
- package/dist/routing/link-codegen.d.ts +105 -0
- package/dist/routing/link-codegen.d.ts.map +1 -0
- package/dist/routing/manifest-codegen.d.ts +26 -0
- package/dist/routing/manifest-codegen.d.ts.map +1 -0
- package/dist/routing/scanner.d.ts +1 -10
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/schema-validation.d.ts +35 -0
- package/dist/routing/schema-validation.d.ts.map +1 -0
- package/dist/routing/segment-classify.d.ts +114 -0
- package/dist/routing/segment-classify.d.ts.map +1 -0
- package/dist/routing/segment-codegen.d.ts +38 -0
- package/dist/routing/segment-codegen.d.ts.map +1 -0
- package/dist/routing/segment-keys.d.ts +117 -0
- package/dist/routing/segment-keys.d.ts.map +1 -0
- package/dist/routing/slot-placement.d.ts +48 -0
- package/dist/routing/slot-placement.d.ts.map +1 -0
- package/dist/routing/types.d.ts +74 -26
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +57 -0
- package/dist/routing/walkers.d.ts.map +1 -0
- package/dist/rsc-runtime/rsc.d.ts +1 -1
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/ssr.d.ts +12 -0
- package/dist/rsc-runtime/ssr.d.ts.map +1 -1
- package/dist/schema-bridge.d.ts +145 -0
- package/dist/schema-bridge.d.ts.map +1 -0
- package/dist/search-params/define.d.ts +262 -0
- package/dist/search-params/define.d.ts.map +1 -0
- package/dist/search-params/index.d.ts +3 -7
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +179 -360
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/parse-total.d.ts +81 -0
- package/dist/search-params/parse-total.d.ts.map +1 -0
- package/dist/search-params/serialize-equal.d.ts +9 -0
- package/dist/search-params/serialize-equal.d.ts.map +1 -0
- package/dist/search-params/wrappers.d.ts +76 -0
- package/dist/search-params/wrappers.d.ts.map +1 -0
- package/dist/server/access-gate.d.ts +26 -10
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +42 -7
- package/dist/server/action-client.d.ts.map +1 -1
- package/dist/server/action-encryption.d.ts +76 -0
- package/dist/server/action-encryption.d.ts.map +1 -0
- package/dist/server/action-handler.d.ts +35 -1
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +12 -33
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +110 -11
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/asset-headers.d.ts +8 -18
- package/dist/server/asset-headers.d.ts.map +1 -1
- package/dist/server/body-limits.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +25 -30
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/canonicalize.d.ts +10 -0
- package/dist/server/canonicalize.d.ts.map +1 -1
- package/dist/server/chain-url-parts.d.ts +81 -0
- package/dist/server/chain-url-parts.d.ts.map +1 -0
- package/dist/server/children-interception.d.ts +49 -0
- package/dist/server/children-interception.d.ts.map +1 -0
- package/dist/server/coalesce-tick.d.ts +40 -0
- package/dist/server/coalesce-tick.d.ts.map +1 -0
- package/dist/server/compress.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +170 -0
- package/dist/server/cookie-context.d.ts.map +1 -0
- package/dist/server/cookie-parsing.d.ts +65 -0
- package/dist/server/cookie-parsing.d.ts.map +1 -0
- package/dist/server/csrf.d.ts +3 -2
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/default-logger.d.ts +22 -0
- package/dist/server/default-logger.d.ts.map +1 -0
- package/dist/server/default-status-page.d.ts +45 -0
- package/dist/server/default-status-page.d.ts.map +1 -0
- package/dist/server/deny-boundary.d.ts +247 -0
- package/dist/server/deny-boundary.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts +16 -5
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/dev-source-map.d.ts +22 -0
- package/dist/server/dev-source-map.d.ts.map +1 -0
- package/dist/server/early-hints-sender.d.ts.map +1 -1
- package/dist/server/early-hints.d.ts +13 -11
- package/dist/server/early-hints.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +86 -10
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
- package/dist/server/fallback-error.d.ts +12 -7
- package/dist/server/fallback-error.d.ts.map +1 -1
- package/dist/server/flight-injection-state.d.ts +66 -0
- package/dist/server/flight-injection-state.d.ts.map +1 -0
- package/dist/server/flight-scripts.d.ts +42 -0
- package/dist/server/flight-scripts.d.ts.map +1 -0
- package/dist/server/form-data.d.ts +41 -0
- package/dist/server/form-data.d.ts.map +1 -1
- package/dist/server/head-response.d.ts +35 -0
- package/dist/server/head-response.d.ts.map +1 -0
- package/dist/server/html-injector-core.d.ts +242 -0
- package/dist/server/html-injector-core.d.ts.map +1 -0
- package/dist/server/html-injectors.d.ts +82 -41
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +10 -47
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +183 -2906
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +51 -0
- package/dist/server/internal.d.ts.map +1 -0
- package/dist/server/internal.js +4154 -0
- package/dist/server/internal.js.map +1 -0
- package/dist/server/logger.d.ts +39 -7
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/metadata-collector.d.ts +52 -0
- package/dist/server/metadata-collector.d.ts.map +1 -0
- package/dist/server/metadata-routes.d.ts +60 -11
- package/dist/server/metadata-routes.d.ts.map +1 -1
- package/dist/server/metadata.d.ts +8 -0
- package/dist/server/metadata.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +19 -4
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +119 -0
- package/dist/server/node-stream-transforms.d.ts.map +1 -0
- package/dist/server/param-coercion.d.ts +70 -0
- package/dist/server/param-coercion.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts +77 -0
- package/dist/server/pipeline-helpers.d.ts.map +1 -0
- package/dist/server/pipeline-interception.d.ts +59 -9
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-metadata.d.ts +6 -0
- package/dist/server/pipeline-metadata.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts +49 -0
- package/dist/server/pipeline-outcome.d.ts.map +1 -0
- package/dist/server/pipeline-phases.d.ts +59 -0
- package/dist/server/pipeline-phases.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts +151 -19
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/port-resolution.d.ts +117 -0
- package/dist/server/port-resolution.d.ts.map +1 -0
- package/dist/server/prebuilt/cache-key.d.ts +62 -0
- package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-state.d.ts +57 -0
- package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
- package/dist/server/prebuilt/key-discipline.d.ts +23 -0
- package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
- package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
- package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
- package/dist/server/prebuilt/overlay.d.ts +100 -0
- package/dist/server/prebuilt/overlay.d.ts.map +1 -0
- package/dist/server/prebuilt/payload-source.d.ts +78 -0
- package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
- package/dist/server/prebuilt/slots.d.ts +99 -0
- package/dist/server/prebuilt/slots.d.ts.map +1 -0
- package/dist/server/prebuilt/synthetic-store.d.ts +66 -0
- package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
- package/dist/server/prebuilt-builder.d.ts +120 -0
- package/dist/server/prebuilt-builder.d.ts.map +1 -0
- package/dist/server/prebuilt-runtime.d.ts +111 -0
- package/dist/server/prebuilt-runtime.d.ts.map +1 -0
- package/dist/server/primitives.d.ts +100 -44
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/publish-params.d.ts +33 -0
- package/dist/server/publish-params.d.ts.map +1 -0
- package/dist/server/render-timeout.d.ts +51 -0
- package/dist/server/render-timeout.d.ts.map +1 -0
- package/dist/server/render-utils.d.ts +25 -0
- package/dist/server/render-utils.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +109 -106
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-dep.d.ts +15 -0
- package/dist/server/request-dep.d.ts.map +1 -0
- package/dist/server/route-element-builder.d.ts +74 -27
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +38 -36
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-cache-key-guard.d.ts +78 -0
- package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts +12 -3
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/deny-fallback.d.ts +29 -0
- package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
- package/dist/server/rsc-entry/error-renderer.d.ts +38 -13
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +59 -42
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +39 -6
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +51 -0
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
- package/dist/server/rsc-entry/rsc-payload.d.ts +5 -6
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +40 -3
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +36 -4
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +89 -0
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
- package/dist/server/safe-load.d.ts +46 -0
- package/dist/server/safe-load.d.ts.map +1 -0
- package/dist/server/sensitive-fields.d.ts +74 -0
- package/dist/server/sensitive-fields.d.ts.map +1 -0
- package/dist/server/sitemap-generator.d.ts +129 -0
- package/dist/server/sitemap-generator.d.ts.map +1 -0
- package/dist/server/sitemap-handler.d.ts +22 -0
- package/dist/server/sitemap-handler.d.ts.map +1 -0
- package/dist/server/skippable-prefix.d.ts +26 -0
- package/dist/server/skippable-prefix.d.ts.map +1 -0
- package/dist/server/slot-interception.d.ts +80 -0
- package/dist/server/slot-interception.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +139 -5
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +138 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -0
- package/dist/server/ssr-entry.d.ts +1 -43
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +64 -21
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +61 -0
- package/dist/server/ssr-wrappers.d.ts.map +1 -0
- package/dist/server/state-tree-diff.d.ts +44 -9
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/static-generator.d.ts +112 -0
- package/dist/server/static-generator.d.ts.map +1 -0
- package/dist/server/static-not-found.d.ts +52 -0
- package/dist/server/static-not-found.d.ts.map +1 -0
- package/dist/server/status-code-resolver.d.ts +26 -15
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +47 -0
- package/dist/server/stream-utils.d.ts.map +1 -0
- package/dist/server/tracing.d.ts +44 -9
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +66 -42
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/tree-match.d.ts +49 -0
- package/dist/server/tree-match.d.ts.map +1 -0
- package/dist/server/types.d.ts +76 -6
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/element-type.d.ts +40 -0
- package/dist/server/utils/element-type.d.ts.map +1 -0
- package/dist/server/utils/escape-html.d.ts +14 -0
- package/dist/server/utils/escape-html.d.ts.map +1 -0
- package/dist/server/utils/mdx-file.d.ts +15 -0
- package/dist/server/utils/mdx-file.d.ts.map +1 -0
- package/dist/server/version-skew.d.ts +61 -0
- package/dist/server/version-skew.d.ts.map +1 -0
- package/dist/server/workers-cache-bridge.d.ts +26 -0
- package/dist/server/workers-cache-bridge.d.ts.map +1 -0
- package/dist/shared/als-slots.d.ts +41 -0
- package/dist/shared/als-slots.d.ts.map +1 -0
- package/dist/shared/base-path.d.ts +56 -0
- package/dist/shared/base-path.d.ts.map +1 -0
- package/dist/shared/href-validation.d.ts +49 -0
- package/dist/shared/href-validation.d.ts.map +1 -0
- package/dist/shared/merge-search-params.d.ts +22 -0
- package/dist/shared/merge-search-params.d.ts.map +1 -0
- package/dist/shared/param-value.d.ts +80 -0
- package/dist/shared/param-value.d.ts.map +1 -0
- package/dist/shared/payload-root.d.ts +108 -0
- package/dist/shared/payload-root.d.ts.map +1 -0
- package/dist/shared/redirect-type.d.ts +17 -0
- package/dist/shared/redirect-type.d.ts.map +1 -0
- package/dist/shared/rsc-cache-key.d.ts +163 -0
- package/dist/shared/rsc-cache-key.d.ts.map +1 -0
- package/dist/shared/rsc-error-envelope.d.ts +25 -0
- package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
- package/dist/shared/rsc-manifest.d.ts +28 -0
- package/dist/shared/rsc-manifest.d.ts.map +1 -0
- package/dist/shared/rsc-media-type.d.ts +40 -0
- package/dist/shared/rsc-media-type.d.ts.map +1 -0
- package/dist/shared/rsc-payload-path.d.ts +42 -0
- package/dist/shared/rsc-payload-path.d.ts.map +1 -0
- package/dist/shared/segment-info.d.ts +66 -0
- package/dist/shared/segment-info.d.ts.map +1 -0
- package/dist/shared/slot-params.d.ts +51 -0
- package/dist/shared/slot-params.d.ts.map +1 -0
- package/dist/shared/static-platform-files.d.ts +71 -0
- package/dist/shared/static-platform-files.d.ts.map +1 -0
- package/dist/shims/font-google.d.ts +1 -1
- package/dist/shims/font-google.d.ts.map +1 -1
- package/dist/shims/font-google.js +42 -0
- package/dist/shims/font-google.js.map +1 -0
- package/dist/shims/font-local.d.ts +26 -0
- package/dist/shims/font-local.d.ts.map +1 -0
- package/dist/shims/font-local.js +20 -0
- package/dist/shims/font-local.js.map +1 -0
- package/dist/shims/headers.d.ts +53 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/image.d.ts +120 -120
- package/dist/shims/image.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +25 -12
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +10 -5
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/state-machine.d.ts +80 -0
- package/dist/utils/state-machine.d.ts.map +1 -0
- package/docs/api/30-api-server.mdx +233 -0
- package/docs/api/31-api-client.mdx +163 -0
- package/docs/api/32-api-cache.mdx +311 -0
- package/docs/api/33-api-search-params.mdx +176 -0
- package/docs/api/34-api-config.mdx +325 -0
- package/docs/api/35-api-typescript.mdx +170 -0
- package/docs/api/36-cli.mdx +170 -0
- package/docs/learn/00-introduction.mdx +109 -0
- package/docs/learn/01-quick-start.mdx +94 -0
- package/docs/learn/02-pages-and-layouts.mdx +147 -0
- package/docs/learn/03-fetching-data.mdx +211 -0
- package/docs/learn/03b-access-control.mdx +130 -0
- package/docs/learn/04-loading-states.mdx +67 -0
- package/docs/learn/04b-the-flush-point.mdx +115 -0
- package/docs/learn/05-typed-params.mdx +275 -0
- package/docs/learn/06-forms-and-actions.mdx +146 -0
- package/docs/learn/07-typed-routes.mdx +132 -0
- package/docs/learn/08-streaming.mdx +146 -0
- package/docs/learn/09-caching.mdx +252 -0
- package/docs/learn/10-middleware.mdx +157 -0
- package/docs/learn/11-error-handling.mdx +173 -0
- package/docs/learn/12-client-navigation.mdx +176 -0
- package/docs/learn/13-configuration.mdx +166 -0
- package/docs/learn/14-deploying.mdx +287 -0
- package/docs/more/01-advanced-routing.mdx +343 -0
- package/docs/more/02-advanced-forms.mdx +137 -0
- package/docs/more/03-coming-from-nextjs.mdx +186 -0
- package/docs/more/04-metadata-and-fonts.mdx +193 -0
- package/docs/more/04b-mdx.mdx +209 -0
- package/docs/more/05-content-collections.mdx +90 -0
- package/docs/more/06-instrumentation.mdx +214 -0
- package/docs/more/07-security.mdx +129 -0
- package/docs/more/08-developer-experience.mdx +134 -0
- package/docs/more/40-why-timber.mdx +50 -0
- package/docs/more/41-timber-vs-nextjs.mdx +81 -0
- package/docs/more/42-timber-vs-others.mdx +68 -0
- package/docs/more/50-ai-agent-instructions.mdx +171 -0
- package/llms.txt +55 -0
- package/package.json +108 -26
- package/src/adapters/build-output-helper.ts +351 -0
- package/src/adapters/cloudflare-dev.ts +177 -0
- package/src/adapters/cloudflare-kv-cache.ts +204 -0
- package/src/adapters/cloudflare.ts +740 -129
- package/src/adapters/compress-module.ts +101 -88
- package/src/adapters/fs-identity.ts +156 -0
- package/src/adapters/nitro.ts +320 -120
- package/src/adapters/raw-imports.d.ts +5 -0
- package/src/adapters/shared.ts +274 -0
- package/src/adapters/types.ts +28 -7
- package/src/adapters/wrangler.d.ts +7 -0
- package/src/cache/cache-api.ts +107 -0
- package/src/cache/fast-hash.ts +5 -0
- package/src/cache/handler-store.ts +76 -0
- package/src/cache/index.ts +114 -21
- package/src/cache/invalidation-epoch.ts +93 -0
- package/src/cache/json-lossy-check.ts +75 -0
- package/src/cache/redis-handler.ts +197 -19
- package/src/cache/singleflight.ts +64 -6
- package/src/cache/sizeof.ts +33 -0
- package/src/cache/stable-stringify.ts +65 -2
- package/src/cache/store.ts +71 -0
- package/src/cache/stores/cloudflare-kv.ts +52 -0
- package/src/cache/stores/memory.ts +125 -0
- package/src/cache/stores/redis.ts +97 -0
- package/src/cache/stores/vercel.ts +59 -0
- package/src/cache/tag-aware-handler.ts +237 -0
- package/src/cache/timber-cache.ts +161 -36
- package/src/cdn/cloudflare-purge.ts +50 -0
- package/src/cdn/fastly-purge.ts +63 -0
- package/src/cdn/headers.ts +153 -0
- package/src/cdn/index.ts +17 -0
- package/src/cdn/purge-store.ts +34 -0
- package/src/cdn/workers-cache-purge.ts +30 -0
- package/src/cli-check.ts +458 -0
- package/src/cli-schema-sync.ts +401 -0
- package/src/cli.ts +221 -53
- package/src/client/browser-dev.ts +156 -1
- package/src/client/browser-entry/action-dispatch.ts +130 -0
- package/src/client/browser-entry/hmr.ts +70 -0
- package/src/client/browser-entry/hydrate.ts +198 -0
- package/src/client/browser-entry/index.ts +121 -0
- package/src/client/browser-entry/post-hydration.ts +122 -0
- package/src/client/browser-entry/router-init.ts +342 -0
- package/src/client/browser-entry/rsc-stream.ts +166 -0
- package/src/client/browser-entry/scroll.ts +50 -0
- package/src/client/error-boundary.tsx +210 -36
- package/src/client/error-reconstituter.tsx +79 -0
- package/src/client/form.tsx +31 -32
- package/src/client/history.ts +29 -7
- package/src/client/index.ts +78 -45
- package/src/client/internal.ts +59 -0
- package/src/client/link.tsx +397 -150
- package/src/client/navigation-api.ts +345 -0
- package/src/client/navigation-commit.ts +197 -0
- package/src/client/navigation-context.ts +43 -62
- package/src/client/navigation-root.tsx +580 -0
- package/src/client/nuqs-adapter.tsx +16 -3
- package/src/client/params-context.ts +192 -0
- package/src/client/router-effects.ts +231 -0
- package/src/client/router-lifecycle.ts +288 -0
- package/src/client/router-pipeline.ts +393 -0
- package/src/client/router-ref.ts +2 -2
- package/src/client/router-skew.ts +30 -0
- package/src/client/router-types.ts +230 -0
- package/src/client/router.ts +339 -410
- package/src/client/rsc-fetch.ts +530 -73
- package/src/client/segment-cache.ts +224 -38
- package/src/client/segment-outlet.tsx +141 -0
- package/src/client/segment-update-context.ts +42 -0
- package/src/client/shallow-url.ts +22 -0
- package/src/client/slot-context.ts +50 -0
- package/src/client/slot-outlet.tsx +22 -0
- package/src/client/slot-provider.tsx +32 -0
- package/src/client/ssr-data.ts +19 -5
- package/src/client/stale-client.ts +191 -0
- package/src/client/state.ts +16 -3
- package/src/client/top-loader.tsx +13 -10
- package/src/client/unload-guard.ts +34 -2
- package/src/client/use-cookie.ts +69 -17
- package/src/client/use-link-status.ts +7 -7
- package/src/client/use-pathname.ts +1 -0
- package/src/client/use-pending-navigation.ts +40 -0
- package/src/client/use-query-states.ts +206 -36
- package/src/client/use-router.ts +5 -2
- package/src/client/use-search-params.ts +31 -44
- package/src/client/{use-params.ts → use-segment-params.ts} +49 -23
- package/src/codec.ts +149 -0
- package/src/config-types.ts +282 -0
- package/src/config-validation.ts +330 -0
- package/src/content/index.ts +5 -13
- package/src/cookies/define-cookie.ts +222 -53
- package/src/cookies/index.ts +12 -1
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +192 -0
- package/src/dev-tools/404-page.ts +286 -0
- package/src/dev-tools/browser-logs.ts +55 -0
- package/src/dev-tools/dev-page-shell.ts +260 -0
- package/src/dev-tools/error-page.ts +331 -0
- package/src/dev-tools/holding-server.ts +187 -0
- package/src/dev-tools/hydration-overlay.ts +158 -0
- package/src/dev-tools/index.ts +83 -0
- package/src/dev-tools/instrumentation.ts +213 -0
- package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
- package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
- package/src/dev-tools/overlay.ts +469 -0
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/dev-tools/terminal.ts +182 -0
- package/src/fonts/ast-walk.ts +235 -0
- package/src/fonts/ast.ts +477 -126
- package/src/fonts/bundle.ts +138 -0
- package/src/fonts/dev-middleware.ts +85 -0
- package/src/fonts/fallbacks.ts +0 -23
- package/src/fonts/google.ts +100 -18
- package/src/fonts/local.ts +9 -8
- package/src/fonts/paths.ts +58 -0
- package/src/fonts/pipeline.ts +348 -0
- package/src/fonts/transform.ts +311 -0
- package/src/fonts/types.ts +52 -1
- package/src/fonts/virtual-modules.ts +179 -0
- package/src/index.ts +468 -353
- package/src/params/codec-registry.ts +34 -0
- package/src/params/define-schema.ts +115 -0
- package/src/params/index.ts +17 -0
- package/src/params/resolve-schema.ts +84 -0
- package/src/plugin-context.ts +503 -0
- package/src/plugins/adapter-build.ts +229 -7
- package/src/plugins/build-manifest.ts +201 -26
- package/src/plugins/build-report.ts +259 -47
- package/src/plugins/cache.ts +243 -0
- package/src/plugins/callsite-ast.ts +472 -0
- package/src/plugins/callsite-jsx.ts +243 -0
- package/src/plugins/chunks.ts +74 -5
- package/src/plugins/client-chunks.ts +185 -0
- package/src/plugins/cloudflare-wasm.ts +141 -0
- package/src/plugins/content.ts +1 -1
- package/src/plugins/dev-server.ts +284 -94
- package/src/plugins/entries.ts +138 -16
- package/src/plugins/fonts.ts +228 -660
- package/src/plugins/mdx.ts +47 -10
- package/src/plugins/prebuilt-capture.ts +217 -0
- package/src/plugins/prebuilt-options-analysis.ts +175 -0
- package/src/plugins/prebuilt.ts +655 -0
- package/src/plugins/prerender-sugar.ts +328 -0
- package/src/plugins/request-dep/analysis.ts +447 -0
- package/src/plugins/request-dep/index.ts +376 -0
- package/src/plugins/request-dep/origin.ts +310 -0
- package/src/plugins/routing.ts +268 -277
- package/src/plugins/server-bundle.ts +89 -12
- package/src/plugins/shims.ts +240 -64
- package/src/plugins/static-build.ts +704 -66
- package/src/routing/codegen-shared.ts +39 -0
- package/src/routing/codegen-types.ts +62 -0
- package/src/routing/codegen-write.ts +139 -0
- package/src/routing/codegen.ts +339 -231
- package/src/routing/collision-probe.ts +438 -0
- package/src/routing/collision-spaces.ts +281 -0
- package/src/routing/convention-lint.ts +493 -0
- package/src/routing/export-detect.ts +448 -0
- package/src/routing/file-cache.ts +23 -0
- package/src/routing/index.ts +10 -1
- package/src/routing/interception.ts +894 -67
- package/src/routing/link-codegen.ts +280 -0
- package/src/routing/manifest-codegen.ts +226 -0
- package/src/routing/scanner.ts +368 -218
- package/src/routing/schema-validation.ts +155 -0
- package/src/routing/segment-classify.ts +280 -0
- package/src/routing/segment-codegen.ts +98 -0
- package/src/routing/segment-keys.ts +183 -0
- package/src/routing/slot-placement.ts +97 -0
- package/src/routing/types.ts +75 -26
- package/src/routing/walkers.ts +98 -0
- package/src/rsc-runtime/rsc.ts +9 -0
- package/src/rsc-runtime/ssr.ts +50 -0
- package/src/rsc-runtime/vendor-types.d.ts +7 -0
- package/src/schema-bridge.ts +380 -0
- package/src/search-params/define.ts +677 -0
- package/src/search-params/index.ts +14 -20
- package/src/search-params/parse-total.ts +91 -0
- package/src/search-params/serialize-equal.ts +14 -0
- package/src/search-params/wrappers.ts +150 -0
- package/src/server/access-gate.tsx +121 -51
- package/src/server/action-client.ts +120 -29
- package/src/server/action-encryption.ts +144 -0
- package/src/server/action-handler.ts +127 -38
- package/src/server/actions.ts +54 -57
- package/src/server/als-registry.ts +154 -20
- package/src/server/asset-headers.ts +15 -37
- package/src/server/body-limits.ts +10 -2
- package/src/server/build-manifest.ts +33 -57
- package/src/server/canonicalize.ts +6 -3
- package/src/server/chain-url-parts.ts +162 -0
- package/src/server/children-interception.ts +115 -0
- package/src/server/coalesce-tick.ts +75 -0
- package/src/server/compress.ts +43 -8
- package/src/server/cookie-context.ts +484 -0
- package/src/server/cookie-parsing.ts +163 -0
- package/src/server/csrf.ts +39 -6
- package/src/server/default-logger.ts +99 -0
- package/src/server/default-status-page.ts +127 -0
- package/src/server/deny-boundary.ts +516 -0
- package/src/server/deny-renderer.ts +181 -101
- package/src/server/dev-source-map.ts +31 -0
- package/src/server/early-hints-sender.ts +3 -2
- package/src/server/early-hints.ts +37 -27
- package/src/server/error-boundary-wrapper.ts +170 -44
- package/src/server/fallback-error.ts +79 -102
- package/src/server/flight-injection-state.ts +113 -0
- package/src/server/flight-scripts.ts +62 -0
- package/src/server/form-data.ts +124 -12
- package/src/server/head-response.ts +54 -0
- package/src/server/html-injector-core.ts +495 -0
- package/src/server/html-injectors.ts +271 -254
- package/src/server/index.ts +29 -185
- package/src/server/internal.ts +181 -0
- package/src/server/logger.ts +72 -36
- package/src/server/metadata-collector.ts +115 -0
- package/src/server/metadata-routes.ts +205 -24
- package/src/server/metadata.ts +21 -0
- package/src/server/middleware-runner.ts +31 -4
- package/src/server/node-stream-transforms.ts +336 -0
- package/src/server/param-coercion.ts +189 -0
- package/src/server/pipeline-helpers.ts +159 -0
- package/src/server/pipeline-interception.ts +109 -33
- package/src/server/pipeline-metadata.ts +14 -0
- package/src/server/pipeline-outcome.ts +196 -0
- package/src/server/pipeline-phases.ts +597 -0
- package/src/server/pipeline.ts +321 -382
- package/src/server/port-resolution.ts +215 -0
- package/src/server/prebuilt/cache-key.ts +298 -0
- package/src/server/prebuilt/capture-state.ts +89 -0
- package/src/server/prebuilt/key-discipline.ts +53 -0
- package/src/server/prebuilt/manifest-tag-index.ts +46 -0
- package/src/server/prebuilt/overlay.ts +256 -0
- package/src/server/prebuilt/payload-source.ts +201 -0
- package/src/server/prebuilt/slots.ts +190 -0
- package/src/server/prebuilt/synthetic-store.ts +121 -0
- package/src/server/prebuilt-builder.ts +803 -0
- package/src/server/prebuilt-runtime.ts +815 -0
- package/src/server/primitives.ts +174 -90
- package/src/server/publish-params.ts +42 -0
- package/src/server/render-timeout.ts +108 -0
- package/src/server/render-utils.ts +31 -0
- package/src/server/request-context.ts +245 -333
- package/src/server/request-dep.ts +37 -0
- package/src/server/route-element-builder.ts +687 -307
- package/src/server/route-handler.ts +39 -12
- package/src/server/route-matcher.ts +162 -269
- package/src/server/rsc-cache-key-guard.ts +164 -0
- package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
- package/src/server/rsc-entry/api-handler.ts +67 -32
- package/src/server/rsc-entry/deny-fallback.ts +93 -0
- package/src/server/rsc-entry/error-renderer.ts +370 -94
- package/src/server/rsc-entry/helpers.ts +226 -95
- package/src/server/rsc-entry/index.ts +357 -330
- package/src/server/rsc-entry/render-route.ts +308 -0
- package/src/server/rsc-entry/revalidate-renderer.ts +350 -0
- package/src/server/rsc-entry/rsc-payload.ts +188 -55
- package/src/server/rsc-entry/rsc-stream.ts +122 -18
- package/src/server/rsc-entry/ssr-bridge.ts +18 -5
- package/src/server/rsc-entry/ssr-renderer.ts +299 -80
- package/src/server/rsc-entry/wrap-action-dispatch.ts +186 -0
- package/src/server/safe-load.ts +60 -0
- package/src/server/sensitive-fields.ts +230 -0
- package/src/server/server-only-guard-noop.js +3 -0
- package/src/server/sitemap-generator.ts +339 -0
- package/src/server/sitemap-handler.ts +157 -0
- package/src/server/skippable-prefix.ts +74 -0
- package/src/server/slot-interception.ts +168 -0
- package/src/server/slot-resolver.ts +677 -294
- package/src/server/ssr-bridge-types.ts +142 -0
- package/src/server/ssr-entry.ts +216 -78
- package/src/server/ssr-render.ts +345 -82
- package/src/server/ssr-wrappers.tsx +142 -0
- package/src/server/state-tree-diff.ts +85 -30
- package/src/server/static-generator.ts +715 -0
- package/src/server/static-not-found.ts +134 -0
- package/src/server/status-code-resolver.ts +107 -148
- package/src/server/stream-utils.ts +288 -0
- package/src/server/tracing.ts +126 -14
- package/src/server/tree-builder.ts +99 -168
- package/src/server/tree-match.ts +262 -0
- package/src/server/types.ts +83 -9
- package/src/server/utils/element-type.ts +72 -0
- package/src/server/utils/escape-html.ts +20 -0
- package/src/server/utils/mdx-file.ts +22 -0
- package/src/server/version-skew.ts +104 -0
- package/src/server/workers-cache-bridge.ts +33 -0
- package/src/shared/als-slots.ts +72 -0
- package/src/shared/base-path.ts +80 -0
- package/src/shared/href-validation.ts +159 -0
- package/src/shared/merge-search-params.ts +55 -0
- package/src/shared/param-value.ts +244 -0
- package/src/shared/payload-root.ts +151 -0
- package/src/shared/redirect-type.ts +17 -0
- package/src/shared/rsc-cache-key.ts +269 -0
- package/src/shared/rsc-error-envelope.ts +31 -0
- package/src/shared/rsc-manifest.ts +29 -0
- package/src/shared/rsc-media-type.ts +43 -0
- package/src/shared/rsc-payload-path.ts +45 -0
- package/src/shared/segment-info.ts +67 -0
- package/src/shared/slot-params.ts +111 -0
- package/src/shared/static-platform-files.ts +75 -0
- package/src/shims/font-google.ts +1 -1
- package/src/shims/font-local.ts +34 -0
- package/src/shims/headers.ts +122 -1
- package/src/shims/navigation-client.ts +36 -32
- package/src/shims/navigation.ts +10 -7
- package/src/utils/state-machine.ts +111 -0
- package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
- package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
- package/dist/_chunks/debug-B3Gypr3D.js +0 -108
- package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
- package/dist/_chunks/format-RyoGQL74.js +0 -164
- package/dist/_chunks/format-RyoGQL74.js.map +0 -1
- package/dist/_chunks/interception-BOoWmLUA.js +0 -676
- package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
- package/dist/_chunks/metadata-routes-Cjmvi3rQ.js +0 -153
- package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
- package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
- package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
- package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
- package/dist/_chunks/tracing-CemImE6h.js +0 -187
- package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
- package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
- package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
- package/dist/_chunks/use-query-states-D5KaffOK.js +0 -109
- package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
- package/dist/adapters/cloudflare.js.map +0 -1
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/register-cached-function.d.ts +0 -17
- package/dist/cache/register-cached-function.d.ts.map +0 -1
- package/dist/client/browser-entry.d.ts +0 -21
- package/dist/client/browser-entry.d.ts.map +0 -1
- package/dist/client/error-boundary.js.map +0 -1
- package/dist/client/head.d.ts +0 -16
- package/dist/client/head.d.ts.map +0 -1
- package/dist/client/link-status-provider.d.ts +0 -11
- package/dist/client/link-status-provider.d.ts.map +0 -1
- package/dist/client/segment-merger.d.ts +0 -119
- package/dist/client/segment-merger.d.ts.map +0 -1
- package/dist/client/stale-reload.d.ts +0 -44
- package/dist/client/stale-reload.d.ts.map +0 -1
- package/dist/client/transition-root.d.ts +0 -74
- package/dist/client/transition-root.d.ts.map +0 -1
- package/dist/client/use-navigation-pending.d.ts +0 -26
- package/dist/client/use-navigation-pending.d.ts.map +0 -1
- package/dist/client/use-params.d.ts.map +0 -1
- package/dist/plugins/cache-transform.d.ts +0 -36
- package/dist/plugins/cache-transform.d.ts.map +0 -1
- package/dist/plugins/dev-error-overlay.d.ts +0 -60
- package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
- package/dist/plugins/dev-logs.d.ts.map +0 -1
- package/dist/plugins/dynamic-transform.d.ts +0 -72
- package/dist/plugins/dynamic-transform.d.ts.map +0 -1
- package/dist/plugins/server-action-exports.d.ts +0 -26
- package/dist/plugins/server-action-exports.d.ts.map +0 -1
- package/dist/routing/status-file-lint.d.ts +0 -33
- package/dist/routing/status-file-lint.d.ts.map +0 -1
- package/dist/search-params/analyze.d.ts +0 -54
- package/dist/search-params/analyze.d.ts.map +0 -1
- package/dist/search-params/builtin-codecs.d.ts +0 -105
- package/dist/search-params/builtin-codecs.d.ts.map +0 -1
- package/dist/search-params/codecs.d.ts +0 -53
- package/dist/search-params/codecs.d.ts.map +0 -1
- package/dist/search-params/create.d.ts +0 -106
- package/dist/search-params/create.d.ts.map +0 -1
- package/dist/search-params/registry.d.ts +0 -20
- package/dist/search-params/registry.d.ts.map +0 -1
- package/dist/server/client-module-map.d.ts +0 -47
- package/dist/server/client-module-map.d.ts.map +0 -1
- package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
- package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
- package/dist/server/dev-logger.d.ts.map +0 -1
- package/dist/server/dev-span-processor.d.ts +0 -29
- package/dist/server/dev-span-processor.d.ts.map +0 -1
- package/dist/server/dev-warnings.d.ts +0 -129
- package/dist/server/dev-warnings.d.ts.map +0 -1
- package/dist/server/flush.d.ts +0 -74
- package/dist/server/flush.d.ts.map +0 -1
- package/dist/server/manifest-status-resolver.d.ts +0 -58
- package/dist/server/manifest-status-resolver.d.ts.map +0 -1
- package/dist/server/prerender.d.ts +0 -77
- package/dist/server/prerender.d.ts.map +0 -1
- package/dist/utils/directive-parser.d.ts +0 -70
- package/dist/utils/directive-parser.d.ts.map +0 -1
- package/src/cache/register-cached-function.ts +0 -103
- package/src/client/browser-entry.ts +0 -678
- package/src/client/head.ts +0 -61
- package/src/client/link-status-provider.tsx +0 -30
- package/src/client/segment-merger.ts +0 -339
- package/src/client/stale-reload.ts +0 -87
- package/src/client/transition-root.tsx +0 -166
- package/src/client/use-navigation-pending.ts +0 -38
- package/src/plugins/cache-transform.ts +0 -199
- package/src/plugins/dev-error-overlay.ts +0 -230
- package/src/plugins/dynamic-transform.ts +0 -161
- package/src/plugins/server-action-exports.ts +0 -220
- package/src/routing/status-file-lint.ts +0 -112
- package/src/search-params/analyze.ts +0 -192
- package/src/search-params/builtin-codecs.ts +0 -228
- package/src/search-params/codecs.ts +0 -153
- package/src/search-params/create.ts +0 -321
- package/src/search-params/registry.ts +0 -31
- package/src/server/client-module-map.ts +0 -58
- package/src/server/dev-fetch-instrumentation.ts +0 -96
- package/src/server/dev-span-processor.ts +0 -78
- package/src/server/dev-warnings.ts +0 -283
- package/src/server/flush.ts +0 -182
- package/src/server/manifest-status-resolver.ts +0 -215
- package/src/server/prerender.ts +0 -139
- package/src/utils/directive-parser.ts +0 -529
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { rm, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
//#region src/shared/static-platform-files.ts
|
|
5
|
+
/**
|
|
6
|
+
* Platform files the static build is allowed to overwrite in the output.
|
|
7
|
+
*
|
|
8
|
+
* The build merges two trees into the deployed directory — the client bundle
|
|
9
|
+
* (which carries everything the user put in `public/`) and the pre-rendered
|
|
10
|
+
* site. That merge otherwise refuses overlaps, because a silent overwrite
|
|
11
|
+
* leaves one of two artifacts deployed with nothing recording which
|
|
12
|
+
* (TIM-1266).
|
|
13
|
+
*
|
|
14
|
+
* These names are the exception, and only because the pre-rendered copy is
|
|
15
|
+
* *derived from* the one it replaces rather than competing with it:
|
|
16
|
+
* `plugins/static-build.ts` reads `public/_redirects` and writes the
|
|
17
|
+
* generated rules plus the user's, so the winner is a superset of the loser.
|
|
18
|
+
*
|
|
19
|
+
* That holds only for a file the current pass produced, which is why
|
|
20
|
+
* `cleanConditionalArtifacts` deletes a previous build's `_redirects` before
|
|
21
|
+
* generation: written only when a pass finds redirects, it would otherwise
|
|
22
|
+
* survive into a pass that produced nothing and claim an exemption it no
|
|
23
|
+
* longer earns.
|
|
24
|
+
*
|
|
25
|
+
* `_headers` is NOT here. It is not written into the pre-rendered tree at
|
|
26
|
+
* all — adapters generate it directly into the output, folding in the
|
|
27
|
+
* user's copy as they go (TIM-1326).
|
|
28
|
+
*
|
|
29
|
+
* Declared once so the code that performs the merge and the code that
|
|
30
|
+
* produces the merged file cannot disagree about which names are exempt.
|
|
31
|
+
*
|
|
32
|
+
* Isomorphic: no server, client, or build-time imports.
|
|
33
|
+
*/
|
|
34
|
+
/** Platform redirect rules (Cloudflare Pages, Netlify). See TIM-1245/TIM-1249. */
|
|
35
|
+
var REDIRECTS_FILE = "_redirects";
|
|
36
|
+
/** Platform header rules (Cloudflare Pages, Netlify). See TIM-1241/TIM-1326. */
|
|
37
|
+
var HEADERS_FILE = "_headers";
|
|
38
|
+
/**
|
|
39
|
+
* Where a user authors platform files. Stated once because two modules read
|
|
40
|
+
* from here — `plugins/static-build.ts` for `_redirects`, adapters for
|
|
41
|
+
* `_headers` — and they must look in the same place.
|
|
42
|
+
*
|
|
43
|
+
* Both read the **project source**, never the build output. The generated
|
|
44
|
+
* file lands under the same name in the output directory, so a reader aimed
|
|
45
|
+
* there would fold the previous build's generated rules back in and compound
|
|
46
|
+
* them on every rebuild.
|
|
47
|
+
*/
|
|
48
|
+
var USER_PLATFORM_DIR = "public";
|
|
49
|
+
/** Output-relative paths whose pre-rendered copy subsumes the `public/` one. */
|
|
50
|
+
var USER_MERGED_PLATFORM_FILES = [REDIRECTS_FILE];
|
|
51
|
+
/**
|
|
52
|
+
* Output paths the framework writes itself, which no route may claim.
|
|
53
|
+
*
|
|
54
|
+
* These are written outside the per-entry writer — `_redirects` after
|
|
55
|
+
* generation, `_headers` by the adapter after the copy — so the collision
|
|
56
|
+
* tracker never sees them and a route rendering to one of these paths is
|
|
57
|
+
* overwritten with nothing recording it.
|
|
58
|
+
*
|
|
59
|
+
* Reserved rather than tracked, because there is no version of "serve a route
|
|
60
|
+
* at `/_headers`" that works: Cloudflare Pages and Netlify read these two
|
|
61
|
+
* files themselves and never serve them, so the route is unservable however
|
|
62
|
+
* the conflict is resolved.
|
|
63
|
+
*
|
|
64
|
+
* That justification is per-file, not per-mechanism. `.nojekyll` is written
|
|
65
|
+
* the same way and is deliberately NOT here: only the `github-pages` target
|
|
66
|
+
* writes it, and everywhere else `/.nojekyll` is an ordinary servable path,
|
|
67
|
+
* so reserving it globally would refuse a valid Cloudflare site. Its write
|
|
68
|
+
* site skips the write when a file is already there instead — GitHub Pages
|
|
69
|
+
* only cares that the file exists.
|
|
70
|
+
*
|
|
71
|
+
* Same reasoning as the synthetic 404 entry using an internal urlPath so a
|
|
72
|
+
* real `/404` route cannot collide with `404.html`.
|
|
73
|
+
*/
|
|
74
|
+
var RESERVED_OUTPUT_PATHS = [REDIRECTS_FILE, HEADERS_FILE];
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/adapters/fs-identity.ts
|
|
77
|
+
/**
|
|
78
|
+
* What the output filesystem considers "the same file".
|
|
79
|
+
*
|
|
80
|
+
* Two build steps compare paths to decide whether two artifacts would land on
|
|
81
|
+
* one file — the render pass (`plugins/static-build.ts`) and the adapter's
|
|
82
|
+
* tree merge (`build-output-helper.ts`). Both are predicting a filesystem
|
|
83
|
+
* decision, so both ask the filesystem rather than comparing raw strings
|
|
84
|
+
* (TIM-1266).
|
|
85
|
+
*
|
|
86
|
+
* Two properties matter, and they are independent:
|
|
87
|
+
*
|
|
88
|
+
* - **Case folding.** macOS APFS and Windows NTFS fold by default, ext4 does
|
|
89
|
+
* not. Dynamic params `Foo` and `foo` are one file on a Mac and two on
|
|
90
|
+
* Linux CI.
|
|
91
|
+
* - **Unicode normalization.** APFS compares normalization-insensitively, so
|
|
92
|
+
* `café` spelled NFC (`é`) and NFD (`e` + combining acute) address one
|
|
93
|
+
* file. This holds even on a *case-sensitive* APFS volume, which is why it
|
|
94
|
+
* is probed separately rather than inferred from case folding.
|
|
95
|
+
*
|
|
96
|
+
* Probed rather than read off `process.platform`: a case-sensitive volume on
|
|
97
|
+
* macOS and a case-insensitive mount on Linux are both ordinary, and the
|
|
98
|
+
* answer that matters is the one for the directory being written.
|
|
99
|
+
*
|
|
100
|
+
* Leaf module — Node built-ins only. Deliberately not in `adapters/shared.ts`,
|
|
101
|
+
* which `server/asset-headers.ts` re-exports from and which therefore must
|
|
102
|
+
* stay free of `node:fs` for the Workers bundle.
|
|
103
|
+
*/
|
|
104
|
+
/** Every path comparison is exact — the conservative answer when unprobed. */
|
|
105
|
+
var EXACT_FS_IDENTITY = {
|
|
106
|
+
caseInsensitive: false,
|
|
107
|
+
normalizationInsensitive: false,
|
|
108
|
+
stripsTrailingDotsAndSpaces: false
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Probe `dir` by writing one file and asking for it under other spellings.
|
|
112
|
+
*
|
|
113
|
+
* Returns {@link EXACT_FS_IDENTITY} when the probe cannot run. That
|
|
114
|
+
* under-detects, but a directory this cannot write to is one the caller is
|
|
115
|
+
* about to fail on anyway, with a clearer error than a missed collision.
|
|
116
|
+
*/
|
|
117
|
+
async function detectFsIdentity(dir) {
|
|
118
|
+
const name = `.timber-probe-${randomUUID()}-café`;
|
|
119
|
+
const path = join(dir, name);
|
|
120
|
+
try {
|
|
121
|
+
await writeFile(path, "");
|
|
122
|
+
const [caseInsensitive, normalizationInsensitive, stripsTrailingDotsAndSpaces] = await Promise.all([
|
|
123
|
+
exists(join(dir, name.toUpperCase())),
|
|
124
|
+
exists(join(dir, name.normalize("NFD"))),
|
|
125
|
+
exists(join(dir, `${name}.`))
|
|
126
|
+
]);
|
|
127
|
+
return {
|
|
128
|
+
caseInsensitive,
|
|
129
|
+
normalizationInsensitive,
|
|
130
|
+
stripsTrailingDotsAndSpaces
|
|
131
|
+
};
|
|
132
|
+
} catch {
|
|
133
|
+
return EXACT_FS_IDENTITY;
|
|
134
|
+
} finally {
|
|
135
|
+
await rm(path, { force: true }).catch(() => {});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Fold a path to the identity the filesystem compares it under.
|
|
140
|
+
*
|
|
141
|
+
* Normalization first, then case: `toLowerCase()` operates per code point, so
|
|
142
|
+
* folding a decomposed string first would leave the combining marks in a
|
|
143
|
+
* different order than folding a precomposed one.
|
|
144
|
+
*
|
|
145
|
+
* An approximation of the filesystem's own algorithm — APFS and NTFS fold per
|
|
146
|
+
* their own Unicode tables, which `toLowerCase()` matches for everything short
|
|
147
|
+
* of the exotic. It errs toward *finding* a collision, and the cost of a false
|
|
148
|
+
* positive is a build error naming two routes rather than a silent overwrite.
|
|
149
|
+
*/
|
|
150
|
+
function fsKey(path, identity) {
|
|
151
|
+
let key = identity.caseInsensitive ? caseFold(path) : path;
|
|
152
|
+
if (identity.normalizationInsensitive) key = key.normalize("NFC");
|
|
153
|
+
if (identity.stripsTrailingDotsAndSpaces) key = key.split("/").map(stripTrailing).join("/");
|
|
154
|
+
return key;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Approximate Unicode case folding, which is what case-insensitive
|
|
158
|
+
* filesystems actually compare under.
|
|
159
|
+
*
|
|
160
|
+
* `toLowerCase()` is not it. Greek `σ` and final `ς` are both already
|
|
161
|
+
* lowercase and stay distinct under it, yet NTFS upcases both to `Σ` and APFS
|
|
162
|
+
* folds `ς` to `σ` — so two routes differing only in that letter are one file
|
|
163
|
+
* on both, and a lowercase key admitted them as two claims (TIM-1266).
|
|
164
|
+
* Uppercasing first collapses them.
|
|
165
|
+
*
|
|
166
|
+
* The residual is over-folding, in these cases and a few like them:
|
|
167
|
+
*
|
|
168
|
+
* | pair | folded together here | NTFS / APFS |
|
|
169
|
+
* | --------- | -------------------- | ----------------- |
|
|
170
|
+
* | `σ` / `ς` | yes | yes — the fix |
|
|
171
|
+
* | `ß` / `ss`| yes | no |
|
|
172
|
+
* | `ı` / `i` | yes | no |
|
|
173
|
+
* | `fi` / `fi`| yes | no |
|
|
174
|
+
*
|
|
175
|
+
* That direction is deliberate. Over-folding costs a build error naming two
|
|
176
|
+
* routes, which a developer fixes by renaming one; under-folding costs a
|
|
177
|
+
* payload silently overwritten by another route's, which nothing downstream
|
|
178
|
+
* can detect. An exact fold would need `Intl.Collator`, which compares but
|
|
179
|
+
* emits no sort key, so using it would turn a hash lookup into a pairwise
|
|
180
|
+
* scan over every claimed path.
|
|
181
|
+
*/
|
|
182
|
+
function caseFold(value) {
|
|
183
|
+
return value.toUpperCase().toLowerCase();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Drop trailing dots and spaces from one path segment, as Win32 does.
|
|
187
|
+
*
|
|
188
|
+
* A segment that is nothing but dots and spaces is left alone: `.` and `..`
|
|
189
|
+
* are traversal, which the caller rejects before reaching here, and emptying
|
|
190
|
+
* a segment would merge two unrelated paths rather than the aliases this
|
|
191
|
+
* models.
|
|
192
|
+
*/
|
|
193
|
+
function stripTrailing(segment) {
|
|
194
|
+
const stripped = segment.replace(/[. ]+$/, "");
|
|
195
|
+
return stripped === "" ? segment : stripped;
|
|
196
|
+
}
|
|
197
|
+
async function exists(path) {
|
|
198
|
+
try {
|
|
199
|
+
await stat(path);
|
|
200
|
+
return true;
|
|
201
|
+
} catch {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { REDIRECTS_FILE as a, USER_PLATFORM_DIR as c, HEADERS_FILE as i, detectFsIdentity as n, RESERVED_OUTPUT_PATHS as o, fsKey as r, USER_MERGED_PLATFORM_FILES as s, EXACT_FS_IDENTITY as t };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=fs-identity-D7vb6GdI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-identity-D7vb6GdI.js","names":[],"sources":["../../src/shared/static-platform-files.ts","../../src/adapters/fs-identity.ts"],"sourcesContent":["/**\n * Platform files the static build is allowed to overwrite in the output.\n *\n * The build merges two trees into the deployed directory — the client bundle\n * (which carries everything the user put in `public/`) and the pre-rendered\n * site. That merge otherwise refuses overlaps, because a silent overwrite\n * leaves one of two artifacts deployed with nothing recording which\n * (TIM-1266).\n *\n * These names are the exception, and only because the pre-rendered copy is\n * *derived from* the one it replaces rather than competing with it:\n * `plugins/static-build.ts` reads `public/_redirects` and writes the\n * generated rules plus the user's, so the winner is a superset of the loser.\n *\n * That holds only for a file the current pass produced, which is why\n * `cleanConditionalArtifacts` deletes a previous build's `_redirects` before\n * generation: written only when a pass finds redirects, it would otherwise\n * survive into a pass that produced nothing and claim an exemption it no\n * longer earns.\n *\n * `_headers` is NOT here. It is not written into the pre-rendered tree at\n * all — adapters generate it directly into the output, folding in the\n * user's copy as they go (TIM-1326).\n *\n * Declared once so the code that performs the merge and the code that\n * produces the merged file cannot disagree about which names are exempt.\n *\n * Isomorphic: no server, client, or build-time imports.\n */\n\n/** Platform redirect rules (Cloudflare Pages, Netlify). See TIM-1245/TIM-1249. */\nexport const REDIRECTS_FILE = '_redirects';\n\n/** Platform header rules (Cloudflare Pages, Netlify). See TIM-1241/TIM-1326. */\nexport const HEADERS_FILE = '_headers';\n\n/**\n * Where a user authors platform files. Stated once because two modules read\n * from here — `plugins/static-build.ts` for `_redirects`, adapters for\n * `_headers` — and they must look in the same place.\n *\n * Both read the **project source**, never the build output. The generated\n * file lands under the same name in the output directory, so a reader aimed\n * there would fold the previous build's generated rules back in and compound\n * them on every rebuild.\n */\nexport const USER_PLATFORM_DIR = 'public';\n\n/** Output-relative paths whose pre-rendered copy subsumes the `public/` one. */\nexport const USER_MERGED_PLATFORM_FILES: readonly string[] = [REDIRECTS_FILE];\n\n/**\n * Output paths the framework writes itself, which no route may claim.\n *\n * These are written outside the per-entry writer — `_redirects` after\n * generation, `_headers` by the adapter after the copy — so the collision\n * tracker never sees them and a route rendering to one of these paths is\n * overwritten with nothing recording it.\n *\n * Reserved rather than tracked, because there is no version of \"serve a route\n * at `/_headers`\" that works: Cloudflare Pages and Netlify read these two\n * files themselves and never serve them, so the route is unservable however\n * the conflict is resolved.\n *\n * That justification is per-file, not per-mechanism. `.nojekyll` is written\n * the same way and is deliberately NOT here: only the `github-pages` target\n * writes it, and everywhere else `/.nojekyll` is an ordinary servable path,\n * so reserving it globally would refuse a valid Cloudflare site. Its write\n * site skips the write when a file is already there instead — GitHub Pages\n * only cares that the file exists.\n *\n * Same reasoning as the synthetic 404 entry using an internal urlPath so a\n * real `/404` route cannot collide with `404.html`.\n */\nexport const RESERVED_OUTPUT_PATHS: readonly string[] = [REDIRECTS_FILE, HEADERS_FILE];\n","/**\n * What the output filesystem considers \"the same file\".\n *\n * Two build steps compare paths to decide whether two artifacts would land on\n * one file — the render pass (`plugins/static-build.ts`) and the adapter's\n * tree merge (`build-output-helper.ts`). Both are predicting a filesystem\n * decision, so both ask the filesystem rather than comparing raw strings\n * (TIM-1266).\n *\n * Two properties matter, and they are independent:\n *\n * - **Case folding.** macOS APFS and Windows NTFS fold by default, ext4 does\n * not. Dynamic params `Foo` and `foo` are one file on a Mac and two on\n * Linux CI.\n * - **Unicode normalization.** APFS compares normalization-insensitively, so\n * `café` spelled NFC (`é`) and NFD (`e` + combining acute) address one\n * file. This holds even on a *case-sensitive* APFS volume, which is why it\n * is probed separately rather than inferred from case folding.\n *\n * Probed rather than read off `process.platform`: a case-sensitive volume on\n * macOS and a case-insensitive mount on Linux are both ordinary, and the\n * answer that matters is the one for the directory being written.\n *\n * Leaf module — Node built-ins only. Deliberately not in `adapters/shared.ts`,\n * which `server/asset-headers.ts` re-exports from and which therefore must\n * stay free of `node:fs` for the Workers bundle.\n */\n\nimport { writeFile, stat, rm } from 'node:fs/promises';\nimport { randomUUID } from 'node:crypto';\nimport { join } from 'node:path';\n\n/** How the output filesystem decides that two paths name one file. */\nexport interface FsIdentity {\n /** `Foo` and `foo` are the same file. */\n caseInsensitive: boolean;\n /** Canonically equivalent Unicode spellings are the same file. */\n normalizationInsensitive: boolean;\n /**\n * Trailing dots and spaces are stripped from each segment, so `foo.` and\n * `foo` are the same file. Win32 does this in path resolution rather than\n * in the filesystem, which is why it is probed like the others.\n */\n stripsTrailingDotsAndSpaces: boolean;\n}\n\n/** Every path comparison is exact — the conservative answer when unprobed. */\nexport const EXACT_FS_IDENTITY: FsIdentity = {\n caseInsensitive: false,\n normalizationInsensitive: false,\n stripsTrailingDotsAndSpaces: false,\n};\n\n/**\n * Probe `dir` by writing one file and asking for it under other spellings.\n *\n * Returns {@link EXACT_FS_IDENTITY} when the probe cannot run. That\n * under-detects, but a directory this cannot write to is one the caller is\n * about to fail on anyway, with a clearer error than a missed collision.\n */\nexport async function detectFsIdentity(dir: string): Promise<FsIdentity> {\n // `café` — NFC, with a precomposed é. The UUID contributes the\n // hex letters the case probe needs.\n const name = `.timber-probe-${randomUUID()}-café`;\n const path = join(dir, name);\n\n try {\n await writeFile(path, '');\n const [caseInsensitive, normalizationInsensitive, stripsTrailingDotsAndSpaces] =\n await Promise.all([\n exists(join(dir, name.toUpperCase())),\n // NFD spells the same string as `e` + U+0301; a filesystem that\n // resolves it to the NFC file compares normalization-insensitively.\n exists(join(dir, name.normalize('NFD'))),\n // Win32 strips trailing dots and spaces during path resolution, so\n // asking for `name.` reaches `name`.\n exists(join(dir, `${name}.`)),\n ]);\n return { caseInsensitive, normalizationInsensitive, stripsTrailingDotsAndSpaces };\n } catch {\n return EXACT_FS_IDENTITY;\n } finally {\n await rm(path, { force: true }).catch(() => {});\n }\n}\n\n/**\n * Fold a path to the identity the filesystem compares it under.\n *\n * Normalization first, then case: `toLowerCase()` operates per code point, so\n * folding a decomposed string first would leave the combining marks in a\n * different order than folding a precomposed one.\n *\n * An approximation of the filesystem's own algorithm — APFS and NTFS fold per\n * their own Unicode tables, which `toLowerCase()` matches for everything short\n * of the exotic. It errs toward *finding* a collision, and the cost of a false\n * positive is a build error naming two routes rather than a silent overwrite.\n */\nexport function fsKey(path: string, identity: FsIdentity): string {\n let key = identity.caseInsensitive ? caseFold(path) : path;\n if (identity.normalizationInsensitive) key = key.normalize('NFC');\n if (identity.stripsTrailingDotsAndSpaces) key = key.split('/').map(stripTrailing).join('/');\n return key;\n}\n\n/**\n * Approximate Unicode case folding, which is what case-insensitive\n * filesystems actually compare under.\n *\n * `toLowerCase()` is not it. Greek `σ` and final `ς` are both already\n * lowercase and stay distinct under it, yet NTFS upcases both to `Σ` and APFS\n * folds `ς` to `σ` — so two routes differing only in that letter are one file\n * on both, and a lowercase key admitted them as two claims (TIM-1266).\n * Uppercasing first collapses them.\n *\n * The residual is over-folding, in these cases and a few like them:\n *\n * | pair | folded together here | NTFS / APFS |\n * | --------- | -------------------- | ----------------- |\n * | `σ` / `ς` | yes | yes — the fix |\n * | `ß` / `ss`| yes | no |\n * | `ı` / `i` | yes | no |\n * | `fi` / `fi`| yes | no |\n *\n * That direction is deliberate. Over-folding costs a build error naming two\n * routes, which a developer fixes by renaming one; under-folding costs a\n * payload silently overwritten by another route's, which nothing downstream\n * can detect. An exact fold would need `Intl.Collator`, which compares but\n * emits no sort key, so using it would turn a hash lookup into a pairwise\n * scan over every claimed path.\n */\nfunction caseFold(value: string): string {\n return value.toUpperCase().toLowerCase();\n}\n\n/**\n * Drop trailing dots and spaces from one path segment, as Win32 does.\n *\n * A segment that is nothing but dots and spaces is left alone: `.` and `..`\n * are traversal, which the caller rejects before reaching here, and emptying\n * a segment would merge two unrelated paths rather than the aliases this\n * models.\n */\nfunction stripTrailing(segment: string): string {\n const stripped = segment.replace(/[. ]+$/, '');\n return stripped === '' ? segment : stripped;\n}\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,oBAAoB;;AAGjC,IAAa,6BAAgD,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;AAyB5E,IAAa,wBAA2C,CAAC,gBAAgB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3BrF,IAAa,oBAAgC;CAC3C,iBAAiB;CACjB,0BAA0B;CAC1B,6BAA6B;AAC/B;;;;;;;;AASA,eAAsB,iBAAiB,KAAkC;CAGvE,MAAM,OAAO,iBAAiB,WAAW,EAAE;CAC3C,MAAM,OAAO,KAAK,KAAK,IAAI;CAE3B,IAAI;EACF,MAAM,UAAU,MAAM,EAAE;EACxB,MAAM,CAAC,iBAAiB,0BAA0B,+BAChD,MAAM,QAAQ,IAAI;GAChB,OAAO,KAAK,KAAK,KAAK,YAAY,CAAC,CAAC;GAGpC,OAAO,KAAK,KAAK,KAAK,UAAU,KAAK,CAAC,CAAC;GAGvC,OAAO,KAAK,KAAK,GAAG,KAAK,EAAE,CAAC;EAC9B,CAAC;EACH,OAAO;GAAE;GAAiB;GAA0B;EAA4B;CAClF,QAAQ;EACN,OAAO;CACT,UAAU;EACR,MAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;CAChD;AACF;;;;;;;;;;;;;AAcA,SAAgB,MAAM,MAAc,UAA8B;CAChE,IAAI,MAAM,SAAS,kBAAkB,SAAS,IAAI,IAAI;CACtD,IAAI,SAAS,0BAA0B,MAAM,IAAI,UAAU,KAAK;CAChE,IAAI,SAAS,6BAA6B,MAAM,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,KAAK,GAAG;CAC1F,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,SAAS,OAAuB;CACvC,OAAO,MAAM,YAAY,CAAC,CAAC,YAAY;AACzC;;;;;;;;;AAUA,SAAS,cAAc,SAAyB;CAC9C,MAAM,WAAW,QAAQ,QAAQ,UAAU,EAAE;CAC7C,OAAO,aAAa,KAAK,UAAU;AACrC;AAEA,eAAe,OAAO,MAAgC;CACpD,IAAI;EACF,MAAM,KAAK,IAAI;EACf,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//#region src/shared/merge-search-params.ts
|
|
2
|
+
/**
|
|
3
|
+
* Shared utility for merging preserved search params into a target URL.
|
|
4
|
+
*
|
|
5
|
+
* Used by both <Link> (client) and redirect() (server). Extracted to a shared
|
|
6
|
+
* module to avoid importing client code ('use client') from server modules.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Merge preserved search params from the current URL into a target href.
|
|
10
|
+
*
|
|
11
|
+
* When `preserve` is `true`, all current search params are merged.
|
|
12
|
+
* When `preserve` is a `string[]`, only the named params are merged.
|
|
13
|
+
*
|
|
14
|
+
* The target href's own search params take precedence — preserved params
|
|
15
|
+
* are only added if the target doesn't already define them.
|
|
16
|
+
*
|
|
17
|
+
* @param targetHref - The resolved target href (may already contain query string)
|
|
18
|
+
* @param currentSearch - The current URL's search string (e.g. "?private=access&page=2")
|
|
19
|
+
* @param preserve - `true` to preserve all, or `string[]` to preserve specific params
|
|
20
|
+
* @returns The target href with preserved search params merged in
|
|
21
|
+
*/
|
|
22
|
+
function mergePreservedSearchParams(targetHref, currentSearch, preserve) {
|
|
23
|
+
const currentParams = new URLSearchParams(currentSearch);
|
|
24
|
+
if (currentParams.size === 0) return targetHref;
|
|
25
|
+
const hashIdx = targetHref.indexOf("#");
|
|
26
|
+
const hrefWithoutHash = hashIdx >= 0 ? targetHref.slice(0, hashIdx) : targetHref;
|
|
27
|
+
const hash = hashIdx >= 0 ? targetHref.slice(hashIdx) : "";
|
|
28
|
+
const qIdx = hrefWithoutHash.indexOf("?");
|
|
29
|
+
const targetPath = qIdx >= 0 ? hrefWithoutHash.slice(0, qIdx) : hrefWithoutHash;
|
|
30
|
+
const targetParams = new URLSearchParams(qIdx >= 0 ? hrefWithoutHash.slice(qIdx + 1) : "");
|
|
31
|
+
const merged = new URLSearchParams(targetParams);
|
|
32
|
+
for (const [key, value] of currentParams) if (!targetParams.has(key)) {
|
|
33
|
+
if (preserve === true || preserve.includes(key)) merged.append(key, value);
|
|
34
|
+
}
|
|
35
|
+
const qs = merged.toString();
|
|
36
|
+
return (qs ? `${targetPath}?${qs}` : targetPath) + hash;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/shared/href-validation.ts
|
|
40
|
+
/**
|
|
41
|
+
* Shared href/URL validation for all navigation sinks.
|
|
42
|
+
*
|
|
43
|
+
* Used by <Link>, useRouter().push/replace, and redirectExternal().
|
|
44
|
+
* Single source of truth for dangerous-scheme detection — prevents
|
|
45
|
+
* control-character smuggling that bypasses naive regex checks.
|
|
46
|
+
*
|
|
47
|
+
* See design/13-security.md §"Link scheme injection" (test #9)
|
|
48
|
+
* and design/07-routing.md §"<Link> Scheme Validation".
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* All C0 control characters (U+0000–U+001F) that browsers strip during
|
|
52
|
+
* URL preprocessing. Browsers and `new URL()` strip the full C0 range,
|
|
53
|
+
* not just tab/LF/CR — so we must match that behavior to prevent
|
|
54
|
+
* bypass vectors like `\x00javascript:alert(1)`.
|
|
55
|
+
*/
|
|
56
|
+
var CONTROL_CHARS_RE = /[\x00-\x1f]/g;
|
|
57
|
+
var DANGEROUS_SCHEMES = /* @__PURE__ */ new Set([
|
|
58
|
+
"javascript:",
|
|
59
|
+
"data:",
|
|
60
|
+
"vbscript:"
|
|
61
|
+
]);
|
|
62
|
+
/**
|
|
63
|
+
* Strip C0 control chars and leading whitespace, then extract the scheme.
|
|
64
|
+
* Returns the lowercase scheme (e.g. "javascript:") or null if no scheme.
|
|
65
|
+
*/
|
|
66
|
+
function extractScheme(href) {
|
|
67
|
+
const cleaned = href.replace(CONTROL_CHARS_RE, "").trimStart();
|
|
68
|
+
const match = /^([a-z][a-z0-9+.-]*:)/i.exec(cleaned);
|
|
69
|
+
return match ? match[1].toLowerCase() : null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Validate an href for navigation sinks (<Link>, useRouter, etc.).
|
|
73
|
+
*
|
|
74
|
+
* Rejects dangerous schemes (javascript:, data:, vbscript:) even when
|
|
75
|
+
* control characters are embedded to bypass naive regex checks.
|
|
76
|
+
* Also rejects protocol-relative URLs (//evil.com).
|
|
77
|
+
*
|
|
78
|
+
* Throws on rejection. Safe hrefs pass through silently.
|
|
79
|
+
*/
|
|
80
|
+
function validateNavigationHref(href) {
|
|
81
|
+
if (href.replace(CONTROL_CHARS_RE, "").trimStart().replaceAll("\\", "/").startsWith("//")) throw new Error(`Navigation received a protocol-relative or backslash-prefixed URL: "${href}". Use an absolute URL with an explicit scheme or a relative path.`);
|
|
82
|
+
const scheme = extractScheme(href);
|
|
83
|
+
if (scheme && DANGEROUS_SCHEMES.has(scheme)) throw new Error(`Navigation received a dangerous href: "${href}". javascript:, data:, and vbscript: URLs are not allowed.`);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Check if an href is internal (same-origin navigation) or external.
|
|
87
|
+
*
|
|
88
|
+
* Strips control characters before checking so that "java\tscript:" is
|
|
89
|
+
* correctly identified as having a scheme (and thus not internal).
|
|
90
|
+
*/
|
|
91
|
+
function isInternalHref(href) {
|
|
92
|
+
const cleaned = href.replace(CONTROL_CHARS_RE, "").trimStart().replaceAll("\\", "/");
|
|
93
|
+
if (cleaned.startsWith("//")) return false;
|
|
94
|
+
if (cleaned.startsWith("/") || cleaned.startsWith("#") || cleaned.startsWith("?")) return true;
|
|
95
|
+
if (extractScheme(href)) return false;
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
/** Pattern matching absolute URLs: any scheme (http:, javascript:, …) or protocol-relative // */
|
|
99
|
+
var ABSOLUTE_URL_RE = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/)/;
|
|
100
|
+
/**
|
|
101
|
+
* Assert that a redirect target is a relative path — rejects absolute and
|
|
102
|
+
* protocol-relative URLs. Used by both the server `redirect()` primitive and
|
|
103
|
+
* the client next/navigation shim so they enforce identical semantics.
|
|
104
|
+
*
|
|
105
|
+
* Normalizes for validation only: strips C0 controls, trims, then replaces
|
|
106
|
+
* backslashes with forward slashes. Browsers normalize \ → / during URL
|
|
107
|
+
* resolution, so "/\evil.com" becomes "//evil.com" (protocol-relative open
|
|
108
|
+
* redirect). See design/13-security.md tests #8, #8a–#8c.
|
|
109
|
+
*/
|
|
110
|
+
function assertRelativeRedirectPath(path) {
|
|
111
|
+
const cleaned = path.replace(CONTROL_CHARS_RE, "").trimStart().replaceAll("\\", "/");
|
|
112
|
+
if (ABSOLUTE_URL_RE.test(cleaned)) throw new Error(`redirect() only accepts relative URLs. Got absolute URL: "${path}". Use redirectExternal(url, allowList) for external redirects.`);
|
|
113
|
+
if (/[\x00-\x1f]/.test(path)) throw new Error("redirect() received a path containing control characters (U+0000–U+001F). Sanitize user input before passing it to redirect().");
|
|
114
|
+
}
|
|
115
|
+
var SAFE_REDIRECT_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
116
|
+
/**
|
|
117
|
+
* Validate and canonicalize an external redirect URL.
|
|
118
|
+
*
|
|
119
|
+
* Requires http: or https: scheme and checks origin against an allow-list.
|
|
120
|
+
* Returns the parsed canonical URL string (from URL.href) to prevent
|
|
121
|
+
* raw user input from reaching the Location header.
|
|
122
|
+
*
|
|
123
|
+
* @throws On invalid URL, dangerous scheme, or origin not in allow-list.
|
|
124
|
+
*/
|
|
125
|
+
function validateExternalRedirectUrl(url, allowList) {
|
|
126
|
+
const cleaned = url.replace(CONTROL_CHARS_RE, "").trimStart();
|
|
127
|
+
if (cleaned.startsWith("//")) throw new Error(`redirectExternal() received a protocol-relative URL: "${url}". Use an absolute URL with http: or https: scheme.`);
|
|
128
|
+
let parsed;
|
|
129
|
+
try {
|
|
130
|
+
parsed = new URL(cleaned);
|
|
131
|
+
} catch {
|
|
132
|
+
throw new Error(`redirectExternal() received an invalid URL: "${url}"`);
|
|
133
|
+
}
|
|
134
|
+
if (!SAFE_REDIRECT_SCHEMES.has(parsed.protocol)) throw new Error(`redirectExternal() received a non-http(s) URL: "${url}". Only http: and https: schemes are allowed for external redirects.`);
|
|
135
|
+
if (!allowList.includes(parsed.origin)) throw new Error(`redirectExternal() target "${parsed.origin}" is not in the allow-list. Allowed: [${allowList.join(", ")}]`);
|
|
136
|
+
return parsed.href;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { mergePreservedSearchParams as a, validateNavigationHref as i, isInternalHref as n, validateExternalRedirectUrl as r, assertRelativeRedirectPath as t };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=href-validation-CMc5JRls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"href-validation-CMc5JRls.js","names":[],"sources":["../../src/shared/merge-search-params.ts","../../src/shared/href-validation.ts"],"sourcesContent":["/**\n * Shared utility for merging preserved search params into a target URL.\n *\n * Used by both <Link> (client) and redirect() (server). Extracted to a shared\n * module to avoid importing client code ('use client') from server modules.\n */\n\n/**\n * Merge preserved search params from the current URL into a target href.\n *\n * When `preserve` is `true`, all current search params are merged.\n * When `preserve` is a `string[]`, only the named params are merged.\n *\n * The target href's own search params take precedence — preserved params\n * are only added if the target doesn't already define them.\n *\n * @param targetHref - The resolved target href (may already contain query string)\n * @param currentSearch - The current URL's search string (e.g. \"?private=access&page=2\")\n * @param preserve - `true` to preserve all, or `string[]` to preserve specific params\n * @returns The target href with preserved search params merged in\n */\nexport function mergePreservedSearchParams(\n targetHref: string,\n currentSearch: string,\n preserve: true | string[]\n): string {\n const currentParams = new URLSearchParams(currentSearch);\n if (currentParams.size === 0) return targetHref;\n\n // Split hash fragment from target before processing query params.\n // Hash must come after query string: /path?query=value#hash\n const hashIdx = targetHref.indexOf('#');\n const hrefWithoutHash = hashIdx >= 0 ? targetHref.slice(0, hashIdx) : targetHref;\n const hash = hashIdx >= 0 ? targetHref.slice(hashIdx) : '';\n\n // Split target into path and existing query\n const qIdx = hrefWithoutHash.indexOf('?');\n const targetPath = qIdx >= 0 ? hrefWithoutHash.slice(0, qIdx) : hrefWithoutHash;\n const targetParams = new URLSearchParams(qIdx >= 0 ? hrefWithoutHash.slice(qIdx + 1) : '');\n\n // Collect params to preserve (that aren't already in the target)\n const merged = new URLSearchParams(targetParams);\n for (const [key, value] of currentParams) {\n // Only preserve if: (a) not already in target, and (b) included in preserve list\n if (!targetParams.has(key)) {\n if (preserve === true || preserve.includes(key)) {\n merged.append(key, value);\n }\n }\n }\n\n const qs = merged.toString();\n const pathWithQuery = qs ? `${targetPath}?${qs}` : targetPath;\n return pathWithQuery + hash;\n}\n","/**\n * Shared href/URL validation for all navigation sinks.\n *\n * Used by <Link>, useRouter().push/replace, and redirectExternal().\n * Single source of truth for dangerous-scheme detection — prevents\n * control-character smuggling that bypasses naive regex checks.\n *\n * See design/13-security.md §\"Link scheme injection\" (test #9)\n * and design/07-routing.md §\"<Link> Scheme Validation\".\n */\n\n/**\n * All C0 control characters (U+0000–U+001F) that browsers strip during\n * URL preprocessing. Browsers and `new URL()` strip the full C0 range,\n * not just tab/LF/CR — so we must match that behavior to prevent\n * bypass vectors like `\\x00javascript:alert(1)`.\n */\n// eslint-disable-next-line no-control-regex -- intentional: must match all C0 controls to prevent bypass\nconst CONTROL_CHARS_RE = /[\\x00-\\x1f]/g;\n\nconst DANGEROUS_SCHEMES = new Set(['javascript:', 'data:', 'vbscript:']);\n\n/**\n * Strip C0 control chars and leading whitespace, then extract the scheme.\n * Returns the lowercase scheme (e.g. \"javascript:\") or null if no scheme.\n */\nfunction extractScheme(href: string): string | null {\n const cleaned = href.replace(CONTROL_CHARS_RE, '').trimStart();\n const match = /^([a-z][a-z0-9+.-]*:)/i.exec(cleaned);\n return match ? match[1].toLowerCase() : null;\n}\n\n/**\n * Validate an href for navigation sinks (<Link>, useRouter, etc.).\n *\n * Rejects dangerous schemes (javascript:, data:, vbscript:) even when\n * control characters are embedded to bypass naive regex checks.\n * Also rejects protocol-relative URLs (//evil.com).\n *\n * Throws on rejection. Safe hrefs pass through silently.\n */\nexport function validateNavigationHref(href: string): void {\n // Normalize for validation: strip C0 controls, trim, then replace backslashes\n // with forward slashes. Browsers normalize \\ → / during URL resolution, so\n // \"/\\evil.com\" becomes \"//evil.com\" (protocol-relative open redirect).\n const cleaned = href.replace(CONTROL_CHARS_RE, '').trimStart().replaceAll('\\\\', '/');\n\n // Protocol-relative URLs can redirect to attacker-controlled origins\n if (cleaned.startsWith('//')) {\n throw new Error(\n `Navigation received a protocol-relative or backslash-prefixed URL: \"${href}\". ` +\n 'Use an absolute URL with an explicit scheme or a relative path.'\n );\n }\n\n const scheme = extractScheme(href);\n if (scheme && DANGEROUS_SCHEMES.has(scheme)) {\n throw new Error(\n `Navigation received a dangerous href: \"${href}\". ` +\n 'javascript:, data:, and vbscript: URLs are not allowed.'\n );\n }\n}\n\n/**\n * Check if an href is internal (same-origin navigation) or external.\n *\n * Strips control characters before checking so that \"java\\tscript:\" is\n * correctly identified as having a scheme (and thus not internal).\n */\nexport function isInternalHref(href: string): boolean {\n const cleaned = href.replace(CONTROL_CHARS_RE, '').trimStart().replaceAll('\\\\', '/');\n\n if (cleaned.startsWith('//')) return false;\n if (cleaned.startsWith('/') || cleaned.startsWith('#') || cleaned.startsWith('?')) return true;\n\n const scheme = extractScheme(href);\n if (scheme) return false;\n\n return true;\n}\n\n/** Pattern matching absolute URLs: any scheme (http:, javascript:, …) or protocol-relative // */\nconst ABSOLUTE_URL_RE = /^(?:[a-zA-Z][a-zA-Z\\d+\\-.]*:|\\/\\/)/;\n\n/**\n * Assert that a redirect target is a relative path — rejects absolute and\n * protocol-relative URLs. Used by both the server `redirect()` primitive and\n * the client next/navigation shim so they enforce identical semantics.\n *\n * Normalizes for validation only: strips C0 controls, trims, then replaces\n * backslashes with forward slashes. Browsers normalize \\ → / during URL\n * resolution, so \"/\\evil.com\" becomes \"//evil.com\" (protocol-relative open\n * redirect). See design/13-security.md tests #8, #8a–#8c.\n */\nexport function assertRelativeRedirectPath(path: string): void {\n const cleaned = path.replace(CONTROL_CHARS_RE, '').trimStart().replaceAll('\\\\', '/');\n\n if (ABSOLUTE_URL_RE.test(cleaned)) {\n throw new Error(\n `redirect() only accepts relative URLs. Got absolute URL: \"${path}\". ` +\n 'Use redirectExternal(url, allowList) for external redirects.'\n );\n }\n\n // eslint-disable-next-line no-control-regex -- intentional: must match C0 controls\n if (/[\\x00-\\x1f]/.test(path)) {\n throw new Error(\n `redirect() received a path containing control characters (U+0000–U+001F). ` +\n 'Sanitize user input before passing it to redirect().'\n );\n }\n}\n\nconst SAFE_REDIRECT_SCHEMES = new Set(['http:', 'https:']);\n\n/**\n * Validate and canonicalize an external redirect URL.\n *\n * Requires http: or https: scheme and checks origin against an allow-list.\n * Returns the parsed canonical URL string (from URL.href) to prevent\n * raw user input from reaching the Location header.\n *\n * @throws On invalid URL, dangerous scheme, or origin not in allow-list.\n */\nexport function validateExternalRedirectUrl(url: string, allowList: string[]): string {\n // Strip control chars before parsing to prevent scheme smuggling\n const cleaned = url.replace(CONTROL_CHARS_RE, '').trimStart();\n\n if (cleaned.startsWith('//')) {\n throw new Error(\n `redirectExternal() received a protocol-relative URL: \"${url}\". ` +\n 'Use an absolute URL with http: or https: scheme.'\n );\n }\n\n let parsed: URL;\n try {\n parsed = new URL(cleaned);\n } catch {\n throw new Error(`redirectExternal() received an invalid URL: \"${url}\"`);\n }\n\n if (!SAFE_REDIRECT_SCHEMES.has(parsed.protocol)) {\n throw new Error(\n `redirectExternal() received a non-http(s) URL: \"${url}\". ` +\n 'Only http: and https: schemes are allowed for external redirects.'\n );\n }\n\n if (!allowList.includes(parsed.origin)) {\n throw new Error(\n `redirectExternal() target \"${parsed.origin}\" is not in the allow-list. ` +\n `Allowed: [${allowList.join(', ')}]`\n );\n }\n\n return parsed.href;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,2BACd,YACA,eACA,UACQ;CACR,MAAM,gBAAgB,IAAI,gBAAgB,aAAa;CACvD,IAAI,cAAc,SAAS,GAAG,OAAO;CAIrC,MAAM,UAAU,WAAW,QAAQ,GAAG;CACtC,MAAM,kBAAkB,WAAW,IAAI,WAAW,MAAM,GAAG,OAAO,IAAI;CACtE,MAAM,OAAO,WAAW,IAAI,WAAW,MAAM,OAAO,IAAI;CAGxD,MAAM,OAAO,gBAAgB,QAAQ,GAAG;CACxC,MAAM,aAAa,QAAQ,IAAI,gBAAgB,MAAM,GAAG,IAAI,IAAI;CAChE,MAAM,eAAe,IAAI,gBAAgB,QAAQ,IAAI,gBAAgB,MAAM,OAAO,CAAC,IAAI,EAAE;CAGzF,MAAM,SAAS,IAAI,gBAAgB,YAAY;CAC/C,KAAK,MAAM,CAAC,KAAK,UAAU,eAEzB,IAAI,CAAC,aAAa,IAAI,GAAG;MACnB,aAAa,QAAQ,SAAS,SAAS,GAAG,GAC5C,OAAO,OAAO,KAAK,KAAK;CAAA;CAK9B,MAAM,KAAK,OAAO,SAAS;CAE3B,QADsB,KAAK,GAAG,WAAW,GAAG,OAAO,cAC5B;AACzB;;;;;;;;;;;;;;;;;;;ACpCA,IAAM,mBAAmB;AAEzB,IAAM,oCAAoB,IAAI,IAAI;CAAC;CAAe;CAAS;AAAW,CAAC;;;;;AAMvE,SAAS,cAAc,MAA6B;CAClD,MAAM,UAAU,KAAK,QAAQ,kBAAkB,EAAE,CAAC,CAAC,UAAU;CAC7D,MAAM,QAAQ,yBAAyB,KAAK,OAAO;CACnD,OAAO,QAAQ,MAAM,EAAE,CAAC,YAAY,IAAI;AAC1C;;;;;;;;;;AAWA,SAAgB,uBAAuB,MAAoB;CAOzD,IAHgB,KAAK,QAAQ,kBAAkB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,MAAM,GAG5E,CAAA,CAAQ,WAAW,IAAI,GACzB,MAAM,IAAI,MACR,uEAAuE,KAAK,mEAE9E;CAGF,MAAM,SAAS,cAAc,IAAI;CACjC,IAAI,UAAU,kBAAkB,IAAI,MAAM,GACxC,MAAM,IAAI,MACR,0CAA0C,KAAK,2DAEjD;AAEJ;;;;;;;AAQA,SAAgB,eAAe,MAAuB;CACpD,MAAM,UAAU,KAAK,QAAQ,kBAAkB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,MAAM,GAAG;CAEnF,IAAI,QAAQ,WAAW,IAAI,GAAG,OAAO;CACrC,IAAI,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,GAAG,OAAO;CAG1F,IADe,cAAc,IACzB,GAAQ,OAAO;CAEnB,OAAO;AACT;;AAGA,IAAM,kBAAkB;;;;;;;;;;;AAYxB,SAAgB,2BAA2B,MAAoB;CAC7D,MAAM,UAAU,KAAK,QAAQ,kBAAkB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,MAAM,GAAG;CAEnF,IAAI,gBAAgB,KAAK,OAAO,GAC9B,MAAM,IAAI,MACR,6DAA6D,KAAK,gEAEpE;CAIF,IAAI,cAAc,KAAK,IAAI,GACzB,MAAM,IAAI,MACR,gIAEF;AAEJ;AAEA,IAAM,wCAAwB,IAAI,IAAI,CAAC,SAAS,QAAQ,CAAC;;;;;;;;;;AAWzD,SAAgB,4BAA4B,KAAa,WAA6B;CAEpF,MAAM,UAAU,IAAI,QAAQ,kBAAkB,EAAE,CAAC,CAAC,UAAU;CAE5D,IAAI,QAAQ,WAAW,IAAI,GACzB,MAAM,IAAI,MACR,yDAAyD,IAAI,oDAE/D;CAGF,IAAI;CACJ,IAAI;EACF,SAAS,IAAI,IAAI,OAAO;CAC1B,QAAQ;EACN,MAAM,IAAI,MAAM,gDAAgD,IAAI,EAAE;CACxE;CAEA,IAAI,CAAC,sBAAsB,IAAI,OAAO,QAAQ,GAC5C,MAAM,IAAI,MACR,mDAAmD,IAAI,qEAEzD;CAGF,IAAI,CAAC,UAAU,SAAS,OAAO,MAAM,GACnC,MAAM,IAAI,MACR,8BAA8B,OAAO,OAAO,wCAC7B,UAAU,KAAK,IAAI,EAAE,EACtC;CAGF,OAAO,OAAO;AAChB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/cache/json-lossy-check.ts
|
|
2
|
+
var LOSSY_TYPES = [
|
|
3
|
+
"Date",
|
|
4
|
+
"Map",
|
|
5
|
+
"Set",
|
|
6
|
+
"BigInt"
|
|
7
|
+
];
|
|
8
|
+
var hasWarned = false;
|
|
9
|
+
/**
|
|
10
|
+
* Dev-mode warning when a cache value contains types that lose fidelity
|
|
11
|
+
* through JSON round-trip. Only runs in development — no-op in production.
|
|
12
|
+
*
|
|
13
|
+
* Detects: Date (→ ISO string), Map/Set (→ {}), BigInt (→ throws).
|
|
14
|
+
* Emits once per process to avoid log spam.
|
|
15
|
+
*/
|
|
16
|
+
function warnLossyJsonValue(value, cacheKey) {
|
|
17
|
+
if (hasWarned) return;
|
|
18
|
+
if (process.env.NODE_ENV === "production") return;
|
|
19
|
+
const lossy = findLossyTypes(value, /* @__PURE__ */ new Set(), 0);
|
|
20
|
+
if (lossy.size === 0) return;
|
|
21
|
+
hasWarned = true;
|
|
22
|
+
const types = [...lossy].join(", ");
|
|
23
|
+
console.warn(`[timber] cache value for key "${cacheKey}" contains ${types} — these types lose fidelity through JSON serialization in Redis/KV cache handlers. Date becomes an ISO string, Map/Set become {}, BigInt throws. The MemoryCacheHandler preserves them. Consider transforming values to JSON-safe types before caching, or use MemoryCacheHandler for values that require type preservation.`);
|
|
24
|
+
}
|
|
25
|
+
function findLossyTypes(value, seen, depth) {
|
|
26
|
+
const lossy = /* @__PURE__ */ new Set();
|
|
27
|
+
if (depth > 8 || value === null || value === void 0) return lossy;
|
|
28
|
+
if (typeof value === "bigint") {
|
|
29
|
+
lossy.add("BigInt");
|
|
30
|
+
return lossy;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value !== "object" && typeof value !== "function") return lossy;
|
|
33
|
+
if (seen.has(value)) return lossy;
|
|
34
|
+
seen.add(value);
|
|
35
|
+
if (value instanceof Date) {
|
|
36
|
+
lossy.add("Date");
|
|
37
|
+
return lossy;
|
|
38
|
+
}
|
|
39
|
+
if (value instanceof Map) {
|
|
40
|
+
lossy.add("Map");
|
|
41
|
+
return lossy;
|
|
42
|
+
}
|
|
43
|
+
if (value instanceof Set) {
|
|
44
|
+
lossy.add("Set");
|
|
45
|
+
return lossy;
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
for (const item of value) {
|
|
49
|
+
for (const t of findLossyTypes(item, seen, depth + 1)) lossy.add(t);
|
|
50
|
+
if (lossy.size === LOSSY_TYPES.length) return lossy;
|
|
51
|
+
}
|
|
52
|
+
return lossy;
|
|
53
|
+
}
|
|
54
|
+
for (const k of Object.keys(value)) {
|
|
55
|
+
for (const t of findLossyTypes(value[k], seen, depth + 1)) lossy.add(t);
|
|
56
|
+
if (lossy.size === LOSSY_TYPES.length) return lossy;
|
|
57
|
+
}
|
|
58
|
+
return lossy;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { warnLossyJsonValue as t };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=json-lossy-check-ClNvBM_3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-lossy-check-ClNvBM_3.js","names":[],"sources":["../../src/cache/json-lossy-check.ts"],"sourcesContent":["const LOSSY_TYPES = ['Date', 'Map', 'Set', 'BigInt'] as const;\n\nlet hasWarned = false;\n\n/**\n * Dev-mode warning when a cache value contains types that lose fidelity\n * through JSON round-trip. Only runs in development — no-op in production.\n *\n * Detects: Date (→ ISO string), Map/Set (→ {}), BigInt (→ throws).\n * Emits once per process to avoid log spam.\n */\nexport function warnLossyJsonValue(value: unknown, cacheKey: string): void {\n if (hasWarned) return;\n if (process.env.NODE_ENV === 'production') return;\n\n const lossy = findLossyTypes(value, new Set(), 0);\n if (lossy.size === 0) return;\n\n hasWarned = true;\n const types = [...lossy].join(', ');\n console.warn(\n `[timber] cache value for key \"${cacheKey}\" contains ${types} — ` +\n 'these types lose fidelity through JSON serialization in Redis/KV cache handlers. ' +\n 'Date becomes an ISO string, Map/Set become {}, BigInt throws. ' +\n 'The MemoryCacheHandler preserves them. Consider transforming values ' +\n 'to JSON-safe types before caching, or use MemoryCacheHandler for ' +\n 'values that require type preservation.'\n );\n}\n\nfunction findLossyTypes(value: unknown, seen: Set<unknown>, depth: number): Set<string> {\n const lossy = new Set<string>();\n if (depth > 8 || value === null || value === undefined) return lossy;\n if (typeof value === 'bigint') {\n lossy.add('BigInt');\n return lossy;\n }\n if (typeof value !== 'object' && typeof value !== 'function') return lossy;\n if (seen.has(value)) return lossy;\n seen.add(value);\n\n if (value instanceof Date) {\n lossy.add('Date');\n return lossy;\n }\n if (value instanceof Map) {\n lossy.add('Map');\n return lossy;\n }\n if (value instanceof Set) {\n lossy.add('Set');\n return lossy;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n for (const t of findLossyTypes(item, seen, depth + 1)) lossy.add(t);\n if (lossy.size === LOSSY_TYPES.length) return lossy;\n }\n return lossy;\n }\n\n for (const k of Object.keys(value as Record<string, unknown>)) {\n for (const t of findLossyTypes((value as Record<string, unknown>)[k], seen, depth + 1)) {\n lossy.add(t);\n }\n if (lossy.size === LOSSY_TYPES.length) return lossy;\n }\n return lossy;\n}\n\n/** Reset warning state — for tests only. */\nexport function _resetLossyWarning(): void {\n hasWarned = false;\n}\n"],"mappings":";AAAA,IAAM,cAAc;CAAC;CAAQ;CAAO;CAAO;AAAQ;AAEnD,IAAI,YAAY;;;;;;;;AAShB,SAAgB,mBAAmB,OAAgB,UAAwB;CACzE,IAAI,WAAW;CACf,IAAA,QAAA,IAAA,aAA6B,cAAc;CAE3C,MAAM,QAAQ,eAAe,uBAAO,IAAI,IAAI,GAAG,CAAC;CAChD,IAAI,MAAM,SAAS,GAAG;CAEtB,YAAY;CACZ,MAAM,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,IAAI;CAClC,QAAQ,KACN,iCAAiC,SAAS,aAAa,MAAM,8TAM/D;AACF;AAEA,SAAS,eAAe,OAAgB,MAAoB,OAA4B;CACtF,MAAM,wBAAQ,IAAI,IAAY;CAC9B,IAAI,QAAQ,KAAK,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAC/D,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,IAAI,QAAQ;EAClB,OAAO;CACT;CACA,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAAY,OAAO;CACrE,IAAI,KAAK,IAAI,KAAK,GAAG,OAAO;CAC5B,KAAK,IAAI,KAAK;CAEd,IAAI,iBAAiB,MAAM;EACzB,MAAM,IAAI,MAAM;EAChB,OAAO;CACT;CACA,IAAI,iBAAiB,KAAK;EACxB,MAAM,IAAI,KAAK;EACf,OAAO;CACT;CACA,IAAI,iBAAiB,KAAK;EACxB,MAAM,IAAI,KAAK;EACf,OAAO;CACT;CAEA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,KAAK,MAAM,QAAQ,OAAO;GACxB,KAAK,MAAM,KAAK,eAAe,MAAM,MAAM,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC;GAClE,IAAI,MAAM,SAAS,YAAY,QAAQ,OAAO;EAChD;EACA,OAAO;CACT;CAEA,KAAK,MAAM,KAAK,OAAO,KAAK,KAAgC,GAAG;EAC7D,KAAK,MAAM,KAAK,eAAgB,MAAkC,IAAI,MAAM,QAAQ,CAAC,GACnF,MAAM,IAAI,CAAC;EAEb,IAAI,MAAM,SAAS,YAAY,QAAQ,OAAO;CAChD;CACA,OAAO;AACT"}
|