@timber-js/app 0.2.0-alpha.1 → 0.2.0-alpha.100
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/dist/_chunks/actions-CQ8Z8VGL.js +1061 -0
- package/dist/_chunks/actions-CQ8Z8VGL.js.map +1 -0
- package/dist/_chunks/build-output-helper-DXnW0qjz.js +61 -0
- package/dist/_chunks/build-output-helper-DXnW0qjz.js.map +1 -0
- package/dist/_chunks/chunk-BYIpzuS7.js +39 -0
- package/dist/_chunks/define-B-Q_UMOD.js +195 -0
- package/dist/_chunks/define-B-Q_UMOD.js.map +1 -0
- package/dist/_chunks/define-CfBPoJb0.js +123 -0
- package/dist/_chunks/define-CfBPoJb0.js.map +1 -0
- package/dist/_chunks/define-cookie-BjpIt4UC.js +194 -0
- package/dist/_chunks/define-cookie-BjpIt4UC.js.map +1 -0
- package/dist/_chunks/format-Bcn-Iv1x.js +14 -0
- package/dist/_chunks/format-Bcn-Iv1x.js.map +1 -0
- package/dist/_chunks/handler-store-B-lqaGyh.js +54 -0
- package/dist/_chunks/handler-store-B-lqaGyh.js.map +1 -0
- package/dist/_chunks/logger-0m8MsKdc.js +291 -0
- package/dist/_chunks/logger-0m8MsKdc.js.map +1 -0
- package/dist/_chunks/merge-search-params-BphMdht_.js +122 -0
- package/dist/_chunks/merge-search-params-BphMdht_.js.map +1 -0
- package/dist/_chunks/{metadata-routes-CQCnF4VK.js → metadata-routes-BU684ls2.js} +1 -1
- package/dist/_chunks/{metadata-routes-CQCnF4VK.js.map → metadata-routes-BU684ls2.js.map} +1 -1
- package/dist/_chunks/navigation-root-BCYczjml.js +96 -0
- package/dist/_chunks/navigation-root-BCYczjml.js.map +1 -0
- package/dist/_chunks/registry-I2ss-lvy.js +20 -0
- package/dist/_chunks/registry-I2ss-lvy.js.map +1 -0
- package/dist/_chunks/router-ref-h3-UaCQv.js +28 -0
- package/dist/_chunks/router-ref-h3-UaCQv.js.map +1 -0
- package/dist/_chunks/schema-bridge-Cxu4l-7p.js +86 -0
- package/dist/_chunks/schema-bridge-Cxu4l-7p.js.map +1 -0
- package/dist/_chunks/segment-classify-BjfuctV2.js +137 -0
- package/dist/_chunks/segment-classify-BjfuctV2.js.map +1 -0
- package/dist/_chunks/segment-context-Dx_OizxD.js +34 -0
- package/dist/_chunks/segment-context-Dx_OizxD.js.map +1 -0
- package/dist/_chunks/{ssr-data-DLnbYpj1.js → ssr-data-B4CdH7rE.js} +1 -1
- package/dist/_chunks/ssr-data-B4CdH7rE.js.map +1 -0
- package/dist/_chunks/stale-reload-Bab885FO.js +64 -0
- package/dist/_chunks/stale-reload-Bab885FO.js.map +1 -0
- package/dist/_chunks/tracing-C8V-YGsP.js +329 -0
- package/dist/_chunks/tracing-C8V-YGsP.js.map +1 -0
- package/dist/_chunks/{use-query-states-DAhgj8Gx.js → use-query-states-B2XTqxDR.js} +7 -20
- package/dist/_chunks/use-query-states-B2XTqxDR.js.map +1 -0
- package/dist/_chunks/use-segment-params-BkpKAQ7D.js +185 -0
- package/dist/_chunks/use-segment-params-BkpKAQ7D.js.map +1 -0
- package/dist/_chunks/walkers-Tg0Alwcg.js +850 -0
- package/dist/_chunks/walkers-Tg0Alwcg.js.map +1 -0
- package/dist/_chunks/{format-DNt20Kt8.js → warnings-Cg47l5sk.js} +7 -45
- package/dist/_chunks/warnings-Cg47l5sk.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +28 -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 +64 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.js +95 -0
- package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +148 -12
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +142 -38
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/nitro.d.ts +17 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +143 -45
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +16 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/cache/cache-api.d.ts +24 -0
- package/dist/cache/cache-api.d.ts.map +1 -0
- package/dist/cache/fast-hash.d.ts +22 -0
- package/dist/cache/fast-hash.d.ts.map +1 -0
- package/dist/cache/handler-store.d.ts +31 -0
- package/dist/cache/handler-store.d.ts.map +1 -0
- package/dist/cache/index.d.ts +23 -7
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +195 -84
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/singleflight.d.ts +18 -1
- 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/timber-cache.d.ts +1 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cli.d.ts +6 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -3
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +34 -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 +46 -0
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
- package/dist/client/browser-entry/index.d.ts +30 -0
- package/dist/client/browser-entry/index.d.ts.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +26 -0
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
- package/dist/client/browser-entry/router-init.d.ts +23 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -0
- package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
- package/dist/client/browser-entry/scroll.d.ts +19 -0
- package/dist/client/browser-entry/scroll.d.ts.map +1 -0
- package/dist/client/error-boundary.d.ts +12 -5
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +26 -5
- package/dist/client/error-boundary.js.map +1 -1
- package/dist/client/error-reconstituter.d.ts +54 -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 +19 -4
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +9 -24
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +312 -1109
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +19 -0
- package/dist/client/internal.d.ts.map +1 -0
- package/dist/client/internal.js +964 -0
- package/dist/client/internal.js.map +1 -0
- package/dist/client/link-pending-store.d.ts +63 -0
- package/dist/client/link-pending-store.d.ts.map +1 -0
- package/dist/client/link.d.ts +73 -63
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/nav-link-store.d.ts +36 -0
- package/dist/client/nav-link-store.d.ts.map +1 -0
- package/dist/client/navigation-api-types.d.ts +90 -0
- package/dist/client/navigation-api-types.d.ts.map +1 -0
- package/dist/client/navigation-api.d.ts +115 -0
- package/dist/client/navigation-api.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +22 -5
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/{transition-root.d.ts → navigation-root.d.ts} +42 -8
- package/dist/client/navigation-root.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts.map +1 -1
- package/dist/client/router-ref.d.ts +1 -1
- package/dist/client/router.d.ts +70 -4
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +38 -3
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +1 -1
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-context.d.ts +1 -1
- package/dist/client/segment-context.d.ts.map +1 -1
- package/dist/client/segment-merger.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +63 -0
- package/dist/client/segment-outlet.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +13 -4
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/stale-reload.d.ts +15 -0
- package/dist/client/stale-reload.d.ts.map +1 -1
- package/dist/client/state.d.ts +1 -1
- package/dist/client/top-loader.d.ts +5 -5
- package/dist/client/top-loader.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts +8 -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-navigation-pending.d.ts → use-pending-navigation.d.ts} +4 -4
- package/dist/client/use-pending-navigation.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +1 -1
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +1 -1
- package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +7 -5
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +33 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +2 -0
- package/dist/config-types.d.ts +294 -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 +98 -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 +36 -72
- 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 +46 -0
- package/dist/cookies/validation.d.ts.map +1 -0
- package/dist/dev-tools/404-page.d.ts +46 -0
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/dev-tools/browser-logs.d.ts +84 -0
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/dev-tools/error-page.d.ts +58 -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/index.d.ts +31 -0
- package/dist/dev-tools/index.d.ts.map +1 -0
- package/dist/{server/dev-span-processor.d.ts → dev-tools/instrumentation.d.ts} +26 -6
- 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} +2 -2
- 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/{server/dev-warnings.d.ts → dev-tools/warnings.d.ts} +2 -22
- package/dist/dev-tools/warnings.d.ts.map +1 -0
- package/dist/fonts/bundle.d.ts +48 -0
- package/dist/fonts/bundle.d.ts.map +1 -0
- package/dist/fonts/css.d.ts +1 -0
- package/dist/fonts/css.d.ts.map +1 -1
- package/dist/fonts/dev-middleware.d.ts +22 -0
- package/dist/fonts/dev-middleware.d.ts.map +1 -0
- package/dist/fonts/local.d.ts +4 -2
- package/dist/fonts/local.d.ts.map +1 -1
- package/dist/fonts/pipeline.d.ts +167 -0
- package/dist/fonts/pipeline.d.ts.map +1 -0
- package/dist/fonts/transform.d.ts +64 -0
- package/dist/fonts/transform.d.ts.map +1 -0
- package/dist/fonts/types.d.ts +45 -1
- package/dist/fonts/types.d.ts.map +1 -1
- package/dist/fonts/virtual-modules.d.ts +103 -0
- package/dist/fonts/virtual-modules.d.ts.map +1 -0
- package/dist/index.d.ts +46 -152
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14702 -12350
- package/dist/index.js.map +1 -1
- package/dist/plugin-context.d.ts +107 -0
- package/dist/plugin-context.d.ts.map +1 -0
- package/dist/plugins/adapter-build.d.ts +1 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts +2 -2
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +16 -4
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/chunks.d.ts +9 -1
- package/dist/plugins/chunks.d.ts.map +1 -1
- package/dist/plugins/client-chunks.d.ts +32 -0
- package/dist/plugins/client-chunks.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 +1 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts +8 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts +17 -65
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/mdx.d.ts +7 -1
- package/dist/plugins/mdx.d.ts.map +1 -1
- 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 +6 -5
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +4 -4
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-shared.d.ts +55 -0
- package/dist/routing/codegen-shared.d.ts.map +1 -0
- package/dist/routing/codegen-types.d.ts +52 -0
- package/dist/routing/codegen-types.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts +2 -2
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/convention-lint.d.ts +41 -0
- package/dist/routing/convention-lint.d.ts.map +1 -0
- package/dist/routing/index.d.ts +5 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +3 -2
- package/dist/routing/link-codegen.d.ts +90 -0
- package/dist/routing/link-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/segment-classify.d.ts +75 -0
- package/dist/routing/segment-classify.d.ts.map +1 -0
- package/dist/routing/status-file-lint.d.ts +2 -1
- package/dist/routing/status-file-lint.d.ts.map +1 -1
- package/dist/routing/types.d.ts +77 -25
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +51 -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 +76 -0
- package/dist/schema-bridge.d.ts.map +1 -0
- package/dist/search-params/define.d.ts +157 -0
- package/dist/search-params/define.d.ts.map +1 -0
- package/dist/search-params/index.d.ts +4 -7
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +34 -441
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/registry.d.ts +2 -2
- package/dist/search-params/registry.d.ts.map +1 -1
- package/dist/search-params/wrappers.d.ts +53 -0
- package/dist/search-params/wrappers.d.ts.map +1 -0
- package/dist/segment-params/define.d.ts +95 -0
- package/dist/segment-params/define.d.ts.map +1 -0
- package/dist/segment-params/index.d.ts +3 -0
- package/dist/segment-params/index.d.ts.map +1 -0
- package/dist/segment-params/index.js +2 -0
- package/dist/server/access-gate.d.ts +8 -3
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +41 -6
- 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 +3 -6
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +33 -5
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/asset-headers.d.ts +1 -15
- package/dist/server/asset-headers.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +2 -2
- package/dist/server/build-manifest.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 +51 -0
- package/dist/server/cookie-parsing.d.ts.map +1 -0
- package/dist/server/debug.d.ts +82 -0
- package/dist/server/debug.d.ts.map +1 -0
- package/dist/server/default-logger.d.ts +22 -0
- package/dist/server/default-logger.d.ts.map +1 -0
- package/dist/server/deny-boundary.d.ts +90 -0
- package/dist/server/deny-boundary.d.ts.map +1 -0
- 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 -5
- package/dist/server/early-hints.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +7 -1
- 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/flush.d.ts.map +1 -1
- package/dist/server/form-data.d.ts +29 -0
- package/dist/server/form-data.d.ts.map +1 -1
- package/dist/server/html-injector-core.d.ts +212 -0
- package/dist/server/html-injector-core.d.ts.map +1 -0
- package/dist/server/html-injectors.d.ts +81 -41
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +9 -46
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +158 -2899
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +48 -0
- package/dist/server/internal.d.ts.map +1 -0
- package/dist/server/internal.js +2900 -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/middleware-runner.d.ts +36 -4
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +110 -0
- package/dist/server/node-stream-transforms.d.ts.map +1 -0
- package/dist/server/param-coercion.d.ts +26 -0
- package/dist/server/param-coercion.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts +95 -0
- package/dist/server/pipeline-helpers.d.ts.map +1 -0
- package/dist/server/pipeline-interception.d.ts +1 -1
- 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 +52 -0
- package/dist/server/pipeline-phases.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts +93 -23
- 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/primitives.d.ts +69 -18
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/render-timeout.d.ts +51 -0
- package/dist/server/render-timeout.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +41 -109
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +27 -1
- 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 +21 -34
- package/dist/server/route-matcher.d.ts.map +1 -1
- 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 +2 -2
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +49 -6
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +20 -3
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +50 -0
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
- package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +20 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +19 -4
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +119 -0
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
- package/dist/server/rsc-prop-warnings.d.ts.map +1 -1
- 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/slot-resolver.d.ts +1 -1
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts +23 -0
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +39 -21
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +50 -0
- package/dist/server/ssr-wrappers.d.ts.map +1 -0
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/status-code-resolver.d.ts +16 -11
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +36 -0
- package/dist/server/stream-utils.d.ts.map +1 -0
- package/dist/server/tracing.d.ts +15 -5
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +62 -30
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/types.d.ts +49 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/escape-html.d.ts +14 -0
- package/dist/server/utils/escape-html.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/waituntil-bridge.d.ts.map +1 -1
- package/dist/shared/merge-search-params.d.ts +22 -0
- package/dist/shared/merge-search-params.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 +2 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +3 -1
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +11 -5
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/directive-parser.d.ts +1 -43
- package/dist/utils/directive-parser.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/package.json +56 -22
- package/src/adapters/build-output-helper.ts +77 -0
- package/src/adapters/cloudflare-dev.ts +177 -0
- package/src/adapters/cloudflare-kv-cache.ts +142 -0
- package/src/adapters/cloudflare.ts +350 -76
- package/src/adapters/compress-module.ts +24 -4
- package/src/adapters/nitro.ts +148 -60
- package/src/adapters/shared.ts +40 -0
- package/src/adapters/wrangler.d.ts +7 -0
- package/src/cache/cache-api.ts +38 -0
- package/src/cache/fast-hash.ts +34 -0
- package/src/cache/handler-store.ts +68 -0
- package/src/cache/index.ts +81 -18
- package/src/cache/singleflight.ts +62 -4
- package/src/cache/sizeof.ts +31 -0
- package/src/cache/timber-cache.ts +41 -29
- package/src/cli.ts +16 -6
- package/src/client/browser-dev.ts +153 -1
- package/src/client/browser-entry/action-dispatch.ts +116 -0
- package/src/client/browser-entry/hmr.ts +81 -0
- package/src/client/browser-entry/hydrate.ts +145 -0
- package/src/client/browser-entry/index.ts +143 -0
- package/src/client/browser-entry/post-hydration.ts +119 -0
- package/src/client/browser-entry/router-init.ts +193 -0
- package/src/client/browser-entry/rsc-stream.ts +157 -0
- package/src/client/browser-entry/scroll.ts +27 -0
- package/src/client/error-boundary.tsx +97 -20
- package/src/client/error-reconstituter.tsx +65 -0
- package/src/client/form.tsx +31 -32
- package/src/client/history.ts +26 -4
- package/src/client/index.ts +77 -43
- package/src/client/internal.ts +58 -0
- package/src/client/link-pending-store.ts +111 -0
- package/src/client/link.tsx +432 -140
- package/src/client/nav-link-store.ts +47 -0
- package/src/client/navigation-api-types.ts +112 -0
- package/src/client/navigation-api.ts +332 -0
- package/src/client/navigation-context.ts +83 -18
- package/src/client/navigation-root.tsx +342 -0
- package/src/client/nuqs-adapter.tsx +16 -3
- package/src/client/router-ref.ts +1 -1
- package/src/client/router.ts +303 -78
- package/src/client/rsc-fetch.ts +112 -8
- package/src/client/segment-cache.ts +1 -1
- package/src/client/segment-context.ts +6 -1
- package/src/client/segment-merger.ts +2 -8
- package/src/client/segment-outlet.tsx +86 -0
- package/src/client/ssr-data.ts +13 -5
- package/src/client/stale-reload.ts +74 -7
- package/src/client/state.ts +2 -2
- package/src/client/top-loader.tsx +41 -25
- package/src/client/use-cookie.ts +29 -0
- package/src/client/use-link-status.ts +7 -7
- package/src/client/{use-navigation-pending.ts → use-pending-navigation.ts} +6 -6
- package/src/client/use-query-states.ts +9 -3
- package/src/client/use-router.ts +1 -1
- package/src/client/{use-params.ts → use-segment-params.ts} +7 -5
- package/src/codec.ts +45 -0
- package/src/config-types.ts +292 -0
- package/src/config-validation.ts +303 -0
- package/src/content/index.ts +5 -13
- package/src/cookies/define-cookie.ts +301 -55
- package/src/cookies/index.ts +12 -1
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +134 -0
- package/src/dev-tools/404-page.ts +387 -0
- package/src/dev-tools/browser-logs.ts +288 -0
- package/src/dev-tools/error-page.ts +509 -0
- package/src/dev-tools/holding-server.ts +187 -0
- package/src/dev-tools/index.ts +90 -0
- package/src/dev-tools/instrumentation.ts +176 -0
- package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +3 -3
- package/src/dev-tools/overlay.ts +456 -0
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/dev-tools/terminal.ts +183 -0
- package/src/{server/dev-warnings.ts → dev-tools/warnings.ts} +6 -50
- package/src/fonts/bundle.ts +142 -0
- package/src/fonts/css.ts +2 -1
- package/src/fonts/dev-middleware.ts +74 -0
- package/src/fonts/local.ts +7 -3
- package/src/fonts/pipeline.ts +314 -0
- package/src/fonts/transform.ts +406 -0
- package/src/fonts/types.ts +50 -1
- package/src/fonts/virtual-modules.ts +227 -0
- package/src/index.ts +376 -315
- package/src/plugin-context.ts +240 -0
- package/src/plugins/adapter-build.ts +12 -4
- package/src/plugins/build-manifest.ts +13 -2
- package/src/plugins/build-report.ts +32 -21
- package/src/plugins/chunks.ts +9 -1
- package/src/plugins/client-chunks.ts +65 -0
- package/src/plugins/content.ts +1 -1
- package/src/plugins/dev-server.ts +154 -21
- package/src/plugins/entries.ts +119 -12
- package/src/plugins/fonts.ts +177 -524
- package/src/plugins/mdx.ts +52 -15
- package/src/plugins/routing.ts +225 -41
- package/src/plugins/server-action-exports.ts +1 -1
- package/src/plugins/server-bundle.ts +36 -1
- package/src/plugins/shims.ts +136 -35
- package/src/plugins/static-build.ts +17 -11
- package/src/routing/codegen-shared.ts +98 -0
- package/src/routing/codegen-types.ts +53 -0
- package/src/routing/codegen.ts +143 -176
- package/src/routing/convention-lint.ts +357 -0
- package/src/routing/index.ts +5 -1
- package/src/routing/interception.ts +1 -1
- package/src/routing/link-codegen.ts +294 -0
- package/src/routing/scanner.ts +107 -110
- package/src/routing/segment-classify.ts +188 -0
- package/src/routing/status-file-lint.ts +10 -7
- package/src/routing/types.ts +78 -25
- package/src/routing/walkers.ts +90 -0
- package/src/rsc-runtime/rsc.ts +2 -0
- package/src/rsc-runtime/ssr.ts +50 -0
- package/src/rsc-runtime/vendor-types.d.ts +7 -0
- package/src/{search-params/codecs.ts → schema-bridge.ts} +57 -20
- package/src/search-params/define.ts +538 -0
- package/src/search-params/index.ts +14 -20
- package/src/search-params/registry.ts +2 -2
- package/src/search-params/wrappers.ts +92 -0
- package/src/segment-params/define.ts +332 -0
- package/src/segment-params/index.ts +9 -0
- package/src/server/access-gate.tsx +79 -36
- package/src/server/action-client.ts +103 -20
- package/src/server/action-encryption.ts +144 -0
- package/src/server/action-handler.ts +112 -14
- package/src/server/actions.ts +10 -9
- package/src/server/als-registry.ts +35 -7
- package/src/server/asset-headers.ts +8 -34
- package/src/server/build-manifest.ts +10 -4
- package/src/server/compress.ts +25 -7
- package/src/server/cookie-context.ts +468 -0
- package/src/server/cookie-parsing.ts +135 -0
- package/src/server/debug.ts +137 -0
- package/src/server/default-logger.ts +99 -0
- package/src/server/deny-boundary.ts +218 -0
- package/src/server/deny-renderer.ts +33 -51
- package/src/server/dev-source-map.ts +31 -0
- package/src/server/early-hints-sender.ts +3 -2
- package/src/server/early-hints.ts +36 -15
- package/src/server/error-boundary-wrapper.ts +74 -22
- package/src/server/fallback-error.ts +74 -102
- package/src/server/flight-injection-state.ts +113 -0
- package/src/server/flight-scripts.ts +62 -0
- package/src/server/flush.ts +2 -1
- package/src/server/form-data.ts +76 -0
- package/src/server/html-injector-core.ts +403 -0
- package/src/server/html-injectors.ts +244 -223
- package/src/server/index.ts +31 -184
- package/src/server/internal.ts +176 -0
- package/src/server/logger.ts +67 -35
- package/src/server/middleware-runner.ts +75 -4
- package/src/server/node-stream-transforms.ts +369 -0
- package/src/server/param-coercion.ts +76 -0
- package/src/server/pipeline-helpers.ts +204 -0
- package/src/server/pipeline-interception.ts +17 -16
- package/src/server/pipeline-metadata.ts +13 -0
- package/src/server/pipeline-outcome.ts +167 -0
- package/src/server/pipeline-phases.ts +409 -0
- package/src/server/pipeline.ts +128 -387
- package/src/server/port-resolution.ts +215 -0
- package/src/server/primitives.ts +113 -29
- package/src/server/render-timeout.ts +108 -0
- package/src/server/request-context.ts +94 -337
- package/src/server/route-element-builder.ts +289 -198
- package/src/server/route-handler.ts +24 -4
- package/src/server/route-matcher.ts +44 -65
- package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
- package/src/server/rsc-entry/api-handler.ts +16 -17
- package/src/server/rsc-entry/error-renderer.ts +305 -89
- package/src/server/rsc-entry/helpers.ts +136 -12
- package/src/server/rsc-entry/index.ts +330 -312
- package/src/server/rsc-entry/render-route.ts +304 -0
- package/src/server/rsc-entry/rsc-payload.ts +100 -18
- package/src/server/rsc-entry/rsc-stream.ts +90 -17
- package/src/server/rsc-entry/ssr-bridge.ts +14 -5
- package/src/server/rsc-entry/ssr-renderer.ts +177 -37
- package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
- package/src/server/rsc-prop-warnings.ts +3 -1
- package/src/server/safe-load.ts +60 -0
- package/src/server/sensitive-fields.ts +230 -0
- package/src/server/sitemap-generator.ts +338 -0
- package/src/server/sitemap-handler.ts +126 -0
- package/src/server/slot-resolver.ts +245 -230
- package/src/server/ssr-entry.ts +215 -32
- package/src/server/ssr-render.ts +289 -67
- package/src/server/ssr-wrappers.tsx +139 -0
- package/src/server/state-tree-diff.ts +4 -1
- package/src/server/status-code-resolver.ts +112 -128
- package/src/server/stream-utils.ts +213 -0
- package/src/server/tracing.ts +44 -10
- package/src/server/tree-builder.ts +202 -90
- package/src/server/types.ts +55 -6
- package/src/server/utils/escape-html.ts +20 -0
- package/src/server/version-skew.ts +104 -0
- package/src/server/waituntil-bridge.ts +4 -1
- package/src/shared/merge-search-params.ts +55 -0
- package/src/shims/font-google.ts +1 -1
- package/src/shims/font-local.ts +34 -0
- package/src/shims/headers.ts +5 -1
- package/src/shims/navigation-client.ts +4 -3
- package/src/shims/navigation.ts +14 -7
- package/src/utils/directive-parser.ts +1 -390
- package/src/utils/state-machine.ts +111 -0
- package/dist/_chunks/als-registry-k-AtAQ9R.js +0 -41
- package/dist/_chunks/als-registry-k-AtAQ9R.js.map +0 -1
- package/dist/_chunks/format-DNt20Kt8.js.map +0 -1
- package/dist/_chunks/interception-DGDIjDbR.js +0 -676
- package/dist/_chunks/interception-DGDIjDbR.js.map +0 -1
- package/dist/_chunks/request-context-CRj2Zh1E.js +0 -329
- package/dist/_chunks/request-context-CRj2Zh1E.js.map +0 -1
- package/dist/_chunks/ssr-data-DLnbYpj1.js.map +0 -1
- package/dist/_chunks/tracing-DF0G3FB7.js +0 -173
- package/dist/_chunks/tracing-DF0G3FB7.js.map +0 -1
- package/dist/_chunks/use-cookie-dDbpCTx-.js +0 -91
- package/dist/_chunks/use-cookie-dDbpCTx-.js.map +0 -1
- package/dist/_chunks/use-query-states-DAhgj8Gx.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 -22
- package/dist/client/browser-entry.d.ts.map +0 -1
- package/dist/client/browser-links.d.ts +0 -32
- package/dist/client/browser-links.d.ts.map +0 -1
- package/dist/client/link-navigate-interceptor.d.ts +0 -28
- package/dist/client/link-navigate-interceptor.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/transition-root.d.ts.map +0 -1
- 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/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/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.map +0 -1
- package/dist/server/dev-warnings.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/src/cache/register-cached-function.ts +0 -99
- package/src/client/browser-entry.ts +0 -686
- package/src/client/browser-links.ts +0 -90
- package/src/client/link-navigate-interceptor.tsx +0 -62
- package/src/client/link-status-provider.tsx +0 -30
- package/src/client/transition-root.tsx +0 -160
- 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/search-params/analyze.ts +0 -192
- package/src/search-params/builtin-codecs.ts +0 -228
- package/src/search-params/create.ts +0 -321
- package/src/server/dev-fetch-instrumentation.ts +0 -96
- package/src/server/dev-span-processor.ts +0 -78
- package/src/server/manifest-status-resolver.ts +0 -215
- package/src/server/prerender.ts +0 -139
- /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
import { r as DEFAULT_PAGE_EXTENSIONS, t as classifySegment } from "./segment-classify-BjfuctV2.js";
|
|
2
|
+
import { a as isDynamicMetadataExtension, n as classifyMetadataRoute } from "./metadata-routes-BU684ls2.js";
|
|
3
|
+
import { h as swallow } from "./logger-0m8MsKdc.js";
|
|
4
|
+
import { basename, extname, join, posix, relative } from "node:path";
|
|
5
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
6
|
+
//#region src/routing/scanner.ts
|
|
7
|
+
/**
|
|
8
|
+
* Route discovery scanner.
|
|
9
|
+
*
|
|
10
|
+
* Pure function: (appDir, config) → RouteTree
|
|
11
|
+
*
|
|
12
|
+
* Scans the app/ directory and builds a segment tree recognizing all
|
|
13
|
+
* timber.js file conventions. Does NOT handle request matching — this
|
|
14
|
+
* is discovery only.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Pattern matching encoded path delimiters that must be rejected during route discovery.
|
|
18
|
+
* %2F / %2f (forward slash) and %5C / %5c (backslash) can cause route collisions
|
|
19
|
+
* when decoded. See design/13-security.md §"Encoded separators rejected".
|
|
20
|
+
*/
|
|
21
|
+
var ENCODED_SEPARATOR_PATTERN = /%(?:2[fF]|5[cC])/;
|
|
22
|
+
/**
|
|
23
|
+
* Pattern matching encoded null bytes (%00) that must be rejected.
|
|
24
|
+
* See design/13-security.md §"Null bytes rejected".
|
|
25
|
+
*/
|
|
26
|
+
var ENCODED_NULL_PATTERN = /%00/;
|
|
27
|
+
/**
|
|
28
|
+
* File convention names that use pageExtensions (can be .tsx, .ts, .jsx, .js, .mdx, etc.)
|
|
29
|
+
*/
|
|
30
|
+
var PAGE_EXT_CONVENTIONS = new Set([
|
|
31
|
+
"page",
|
|
32
|
+
"layout",
|
|
33
|
+
"error",
|
|
34
|
+
"default",
|
|
35
|
+
"denied"
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* Legacy compat status-code files.
|
|
39
|
+
* Maps legacy file name → HTTP status code for the fallback chain.
|
|
40
|
+
* See design/10-error-handling.md §"Fallback Chain".
|
|
41
|
+
*/
|
|
42
|
+
var LEGACY_STATUS_FILES = {
|
|
43
|
+
"not-found": 404,
|
|
44
|
+
"forbidden": 403,
|
|
45
|
+
"unauthorized": 401
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* File convention names that are always .ts/.tsx (never .mdx etc.)
|
|
49
|
+
*/
|
|
50
|
+
var FIXED_CONVENTIONS = new Set([
|
|
51
|
+
"middleware",
|
|
52
|
+
"access",
|
|
53
|
+
"route",
|
|
54
|
+
"params"
|
|
55
|
+
]);
|
|
56
|
+
/**
|
|
57
|
+
* Status-code file patterns:
|
|
58
|
+
* - Exact 3-digit codes: 401.tsx, 429.tsx, 503.tsx
|
|
59
|
+
* - Category catch-alls: 4xx.tsx, 5xx.tsx
|
|
60
|
+
*/
|
|
61
|
+
var STATUS_CODE_PATTERN = /^(\d{3}|[45]xx)$/;
|
|
62
|
+
/**
|
|
63
|
+
* Scan the app/ directory and build the route tree.
|
|
64
|
+
*
|
|
65
|
+
* @param appDir - Absolute path to the app/ directory
|
|
66
|
+
* @param config - Scanner configuration
|
|
67
|
+
* @returns The complete route tree
|
|
68
|
+
*/
|
|
69
|
+
function scanRoutes(appDir, config = {}) {
|
|
70
|
+
const pageExtensions = config.pageExtensions ?? DEFAULT_PAGE_EXTENSIONS;
|
|
71
|
+
const extSet = new Set(pageExtensions);
|
|
72
|
+
const tree = { root: createSegmentNode("", "static", "/") };
|
|
73
|
+
const proxyFile = findFixedFile(appDir, "proxy");
|
|
74
|
+
if (proxyFile) tree.proxy = proxyFile;
|
|
75
|
+
const globalErrorFile = findPageExtFile(appDir, "global-error", extSet);
|
|
76
|
+
if (globalErrorFile) tree.globalError = globalErrorFile;
|
|
77
|
+
scanSegmentFiles(appDir, tree.root, extSet);
|
|
78
|
+
scanChildren(appDir, tree.root, extSet);
|
|
79
|
+
validateRouteGroupCollisions(tree.root);
|
|
80
|
+
validateDuplicateParamNames(tree.root);
|
|
81
|
+
return tree;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create an empty segment node.
|
|
85
|
+
*/
|
|
86
|
+
function createSegmentNode(segmentName, segmentType, urlPath, paramName, interceptionMarker, interceptedSegmentName) {
|
|
87
|
+
return {
|
|
88
|
+
segmentName,
|
|
89
|
+
segmentType,
|
|
90
|
+
urlPath,
|
|
91
|
+
paramName,
|
|
92
|
+
interceptionMarker,
|
|
93
|
+
interceptedSegmentName,
|
|
94
|
+
children: [],
|
|
95
|
+
slots: {}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Compute the URL path for a child segment given its parent's URL path.
|
|
100
|
+
* Route groups, slots, and intercepting routes do NOT add URL depth.
|
|
101
|
+
*/
|
|
102
|
+
function computeUrlPath(parentUrlPath, dirName, segmentType) {
|
|
103
|
+
if (segmentType === "group" || segmentType === "slot" || segmentType === "intercepting") return parentUrlPath;
|
|
104
|
+
return `${parentUrlPath === "/" ? "" : parentUrlPath}/${dirName}`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Scan a directory for file conventions and populate the segment node.
|
|
108
|
+
*/
|
|
109
|
+
function scanSegmentFiles(dirPath, node, extSet) {
|
|
110
|
+
let entries;
|
|
111
|
+
try {
|
|
112
|
+
entries = readdirSync(dirPath);
|
|
113
|
+
} catch (err) {
|
|
114
|
+
swallow(err, `scanSegmentFiles: unreadable directory ${dirPath}`, { level: "warn" });
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
for (const entry of entries) {
|
|
118
|
+
const fullPath = join(dirPath, entry);
|
|
119
|
+
try {
|
|
120
|
+
if (statSync(fullPath).isDirectory()) continue;
|
|
121
|
+
} catch {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const ext = extname(entry).slice(1);
|
|
125
|
+
const name = basename(entry, `.${ext}`);
|
|
126
|
+
if (PAGE_EXT_CONVENTIONS.has(name) && extSet.has(ext)) {
|
|
127
|
+
const file = {
|
|
128
|
+
filePath: fullPath,
|
|
129
|
+
extension: ext
|
|
130
|
+
};
|
|
131
|
+
switch (name) {
|
|
132
|
+
case "page":
|
|
133
|
+
node.page = file;
|
|
134
|
+
break;
|
|
135
|
+
case "layout":
|
|
136
|
+
node.layout = file;
|
|
137
|
+
break;
|
|
138
|
+
case "error":
|
|
139
|
+
node.error = file;
|
|
140
|
+
break;
|
|
141
|
+
case "default":
|
|
142
|
+
node.default = file;
|
|
143
|
+
break;
|
|
144
|
+
case "denied":
|
|
145
|
+
node.denied = file;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (FIXED_CONVENTIONS.has(name) && /\.?[jt]sx?$/.test(ext)) {
|
|
151
|
+
const file = {
|
|
152
|
+
filePath: fullPath,
|
|
153
|
+
extension: ext
|
|
154
|
+
};
|
|
155
|
+
switch (name) {
|
|
156
|
+
case "middleware":
|
|
157
|
+
node.middleware = file;
|
|
158
|
+
break;
|
|
159
|
+
case "access":
|
|
160
|
+
node.access = file;
|
|
161
|
+
break;
|
|
162
|
+
case "route":
|
|
163
|
+
node.route = file;
|
|
164
|
+
break;
|
|
165
|
+
case "params":
|
|
166
|
+
node.params = file;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (STATUS_CODE_PATTERN.test(name) && ext === "json") {
|
|
172
|
+
if (!node.jsonStatusFiles) node.jsonStatusFiles = {};
|
|
173
|
+
node.jsonStatusFiles[name] = {
|
|
174
|
+
filePath: fullPath,
|
|
175
|
+
extension: ext
|
|
176
|
+
};
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (STATUS_CODE_PATTERN.test(name) && extSet.has(ext)) {
|
|
180
|
+
if (!node.statusFiles) node.statusFiles = {};
|
|
181
|
+
node.statusFiles[name] = {
|
|
182
|
+
filePath: fullPath,
|
|
183
|
+
extension: ext
|
|
184
|
+
};
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (name in LEGACY_STATUS_FILES && extSet.has(ext)) {
|
|
188
|
+
if (!node.legacyStatusFiles) node.legacyStatusFiles = {};
|
|
189
|
+
node.legacyStatusFiles[name] = {
|
|
190
|
+
filePath: fullPath,
|
|
191
|
+
extension: ext
|
|
192
|
+
};
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (classifyMetadataRoute(entry)) {
|
|
196
|
+
if (!node.metadataRoutes) node.metadataRoutes = {};
|
|
197
|
+
const existing = node.metadataRoutes[name];
|
|
198
|
+
if (existing) {
|
|
199
|
+
const existingIsDynamic = isDynamicMetadataExtension(name, existing.extension);
|
|
200
|
+
if (isDynamicMetadataExtension(name, ext) || !existingIsDynamic) node.metadataRoutes[name] = {
|
|
201
|
+
filePath: fullPath,
|
|
202
|
+
extension: ext
|
|
203
|
+
};
|
|
204
|
+
} else node.metadataRoutes[name] = {
|
|
205
|
+
filePath: fullPath,
|
|
206
|
+
extension: ext
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (node.route && node.page) throw new Error(`Build error: route.ts and page.* cannot coexist in the same segment.\n route.ts: ${node.route.filePath}\n page: ${node.page.filePath}\nA URL is either an API endpoint or a rendered page, not both.`);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Recursively scan child directories and build the segment tree.
|
|
214
|
+
*/
|
|
215
|
+
function scanChildren(dirPath, parentNode, extSet) {
|
|
216
|
+
let entries;
|
|
217
|
+
try {
|
|
218
|
+
entries = readdirSync(dirPath);
|
|
219
|
+
} catch (err) {
|
|
220
|
+
swallow(err, `scanChildren: unreadable directory ${dirPath}`, { level: "warn" });
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
for (const entry of entries) {
|
|
224
|
+
const fullPath = join(dirPath, entry);
|
|
225
|
+
try {
|
|
226
|
+
if (!statSync(fullPath).isDirectory()) continue;
|
|
227
|
+
} catch {
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (ENCODED_SEPARATOR_PATTERN.test(entry)) throw new Error(`Build error: directory name contains an encoded path delimiter (%%2F or %%5C).\n Directory: ${fullPath}\nEncoded separators in directory names cause route collisions when decoded. Rename the directory to remove the encoded delimiter.`);
|
|
231
|
+
if (ENCODED_NULL_PATTERN.test(entry)) throw new Error(`Build error: directory name contains an encoded null byte (%%00).\n Directory: ${fullPath}\nEncoded null bytes in directory names are not allowed. Rename the directory to remove the null byte encoding.`);
|
|
232
|
+
const { type, paramName, interceptionMarker, interceptedSegmentName } = classifySegment(entry);
|
|
233
|
+
if (type === "private") continue;
|
|
234
|
+
const childNode = createSegmentNode(entry, type, computeUrlPath(parentNode.urlPath, entry, type), paramName, interceptionMarker, interceptedSegmentName);
|
|
235
|
+
scanSegmentFiles(fullPath, childNode, extSet);
|
|
236
|
+
scanChildren(fullPath, childNode, extSet);
|
|
237
|
+
if (type === "slot") {
|
|
238
|
+
const slotName = entry.slice(1);
|
|
239
|
+
parentNode.slots[slotName] = childNode;
|
|
240
|
+
} else parentNode.children.push(childNode);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Validate that route groups don't produce conflicting pages/routes at the same URL path.
|
|
245
|
+
*
|
|
246
|
+
* Two route groups like (auth)/login/page.tsx and (marketing)/login/page.tsx both claim
|
|
247
|
+
* /login — the scanner must detect and reject this at build time.
|
|
248
|
+
*
|
|
249
|
+
* Parallel slots are excluded from collision detection — they intentionally coexist at
|
|
250
|
+
* the same URL path as their parent (that's the whole point of parallel routes).
|
|
251
|
+
*/
|
|
252
|
+
function validateRouteGroupCollisions(root) {
|
|
253
|
+
collectRoutableLeaves(root, /* @__PURE__ */ new Map(), "", false);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Walk the segment tree and collect all routable leaves (page or route files),
|
|
257
|
+
* throwing on collision. Slots are tracked in their own collision space since
|
|
258
|
+
* they are parallel routes that intentionally share URL paths with their parent.
|
|
259
|
+
*/
|
|
260
|
+
function collectRoutableLeaves(node, seen, segmentPath, insideSlot) {
|
|
261
|
+
const currentPath = segmentPath ? `${segmentPath}/${node.segmentName}` : node.segmentName || "(root)";
|
|
262
|
+
if (!insideSlot) {
|
|
263
|
+
const routableFile = node.page ?? node.route;
|
|
264
|
+
if (routableFile) {
|
|
265
|
+
const existing = seen.get(node.urlPath);
|
|
266
|
+
if (existing) throw new Error(`Build error: route collision — multiple route groups produce a page/route at the same URL path.\n URL path: ${node.urlPath}\n File 1: ${existing.filePath} (via ${existing.segmentPath})\n File 2: ${routableFile.filePath} (via ${currentPath})\nEach URL path must map to exactly one page or route handler. Rename or move one of the conflicting files.`);
|
|
267
|
+
seen.set(node.urlPath, {
|
|
268
|
+
filePath: routableFile.filePath,
|
|
269
|
+
segmentPath: currentPath
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
for (const child of node.children) collectRoutableLeaves(child, seen, currentPath, insideSlot);
|
|
274
|
+
for (const slotNode of Object.values(node.slots)) collectRoutableLeaves(slotNode, seen, currentPath, true);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Validate that no route chain contains duplicate dynamic param names.
|
|
278
|
+
*
|
|
279
|
+
* Example violation:
|
|
280
|
+
* app/[id]/items/[id]/page.tsx — 'id' appears twice in the ancestor chain.
|
|
281
|
+
*
|
|
282
|
+
* Route groups are transparent — params accumulate through them.
|
|
283
|
+
* Slots are independent — duplicate detection does NOT cross slot boundaries.
|
|
284
|
+
*
|
|
285
|
+
* See design/07-routing.md §"Duplicate Param Name Detection"
|
|
286
|
+
*/
|
|
287
|
+
function validateDuplicateParamNames(root) {
|
|
288
|
+
walkForDuplicateParams(root, /* @__PURE__ */ new Map());
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Recursively walk the segment tree, tracking seen param names → segment paths.
|
|
292
|
+
* Throws on the first duplicate found.
|
|
293
|
+
*/
|
|
294
|
+
function walkForDuplicateParams(node, seen) {
|
|
295
|
+
if (node.paramName) {
|
|
296
|
+
const existing = seen.get(node.paramName);
|
|
297
|
+
if (existing) throw new Error(`[timber] Duplicate param name '${node.paramName}' in route chain.\n First defined at: ${existing}\n Duplicate at: ${node.urlPath || "/"}\n Rename one of the segments to avoid ambiguity.`);
|
|
298
|
+
seen = new Map(seen);
|
|
299
|
+
seen.set(node.paramName, node.urlPath || "/");
|
|
300
|
+
}
|
|
301
|
+
for (const child of node.children) walkForDuplicateParams(child, seen);
|
|
302
|
+
for (const slotNode of Object.values(node.slots)) walkForDuplicateParams(slotNode, new Map(seen));
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Find a fixed-extension file (proxy.ts) in a directory.
|
|
306
|
+
*/
|
|
307
|
+
function findFixedFile(dirPath, name) {
|
|
308
|
+
for (const ext of ["ts", "tsx"]) {
|
|
309
|
+
const fullPath = join(dirPath, `${name}.${ext}`);
|
|
310
|
+
try {
|
|
311
|
+
if (statSync(fullPath).isFile()) return {
|
|
312
|
+
filePath: fullPath,
|
|
313
|
+
extension: ext
|
|
314
|
+
};
|
|
315
|
+
} catch {}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Find a file using the configured page extensions (tsx, ts, jsx, js, mdx, etc.).
|
|
320
|
+
* Used for app-root conventions like global-error that aren't per-segment.
|
|
321
|
+
*/
|
|
322
|
+
function findPageExtFile(dirPath, name, extSet) {
|
|
323
|
+
for (const ext of extSet) {
|
|
324
|
+
const fullPath = join(dirPath, `${name}.${ext}`);
|
|
325
|
+
try {
|
|
326
|
+
if (statSync(fullPath).isFile()) return {
|
|
327
|
+
filePath: fullPath,
|
|
328
|
+
extension: ext
|
|
329
|
+
};
|
|
330
|
+
} catch {}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/routing/codegen-shared.ts
|
|
335
|
+
/**
|
|
336
|
+
* Shared codegen helpers — import-path computation, codec chain type
|
|
337
|
+
* builder, and searchParams type formatter.
|
|
338
|
+
*
|
|
339
|
+
* Extracted from `codegen.ts` so `link-codegen.ts` can use the same
|
|
340
|
+
* helpers without a cyclic import.
|
|
341
|
+
*/
|
|
342
|
+
/**
|
|
343
|
+
* Compute a relative import specifier for a codec/page file, stripping
|
|
344
|
+
* the .ts/.tsx extension and resolving against the codegen output dir.
|
|
345
|
+
*/
|
|
346
|
+
function codecImportPath(codecFilePath, importBase) {
|
|
347
|
+
const absPath = codecFilePath.replace(/\.(ts|tsx)$/, "");
|
|
348
|
+
if (importBase) return "./" + relative(importBase, absPath).replace(/\\/g, "/");
|
|
349
|
+
return "./" + posix.basename(absPath);
|
|
350
|
+
}
|
|
351
|
+
/** Name of the shared helper type emitted at the top of the .d.ts. */
|
|
352
|
+
var RESOLVE_SEGMENT_FIELD_TYPE_NAME = "_TimberResolveSegmentField";
|
|
353
|
+
/**
|
|
354
|
+
* Helper type emitted once at the top of the generated `.d.ts` and
|
|
355
|
+
* referenced by every codec-chain conditional. Without this shared
|
|
356
|
+
* helper, the inline expansion would duplicate the fallback branch on
|
|
357
|
+
* every step and grow O(2^N) in chain depth (a single deep nested route
|
|
358
|
+
* could blow up the file size and TS performance). With the helper,
|
|
359
|
+
* each step reuses the named type and growth is O(N).
|
|
360
|
+
*
|
|
361
|
+
* The helper is a 2-arg conditional: given a typeof import expression
|
|
362
|
+
* (`Def`), a key (`K`), and a fallback (`F`), it returns `T[K]` if
|
|
363
|
+
* `Def extends ParamsDefinition<T>` and `K extends keyof T`, otherwise
|
|
364
|
+
* `F`. The codec chain composes calls to this helper.
|
|
365
|
+
*/
|
|
366
|
+
function emitResolveSegmentFieldHelper() {
|
|
367
|
+
return [
|
|
368
|
+
`type ${RESOLVE_SEGMENT_FIELD_TYPE_NAME}<Def, K extends string, F> =`,
|
|
369
|
+
` Def extends import('@timber-js/app/segment-params').ParamsDefinition<infer T>`,
|
|
370
|
+
` ? K extends keyof T ? T[K] : F`,
|
|
371
|
+
` : F;`
|
|
372
|
+
].join("\n");
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Build a TypeScript type expression that resolves a single param's
|
|
376
|
+
* codec by walking a chain of params.ts files in priority order.
|
|
377
|
+
*
|
|
378
|
+
* Each entry in the chain emits one application of the shared
|
|
379
|
+
* `_TimberResolveSegmentField` helper type. Composing N applications
|
|
380
|
+
* grows linearly with chain depth (O(N) characters), unlike an inline
|
|
381
|
+
* conditional that would duplicate the fallback in each branch and
|
|
382
|
+
* grow O(2^N).
|
|
383
|
+
*
|
|
384
|
+
* The closest match (position 0 in the chain) is checked first; if its
|
|
385
|
+
* `segmentParams` definition declares the key, its inferred type wins.
|
|
386
|
+
* Otherwise we fall through to the next entry, and finally to the
|
|
387
|
+
* provided fallback. See TIM-834.
|
|
388
|
+
*/
|
|
389
|
+
function buildCodecChainType(p, importBase, fallback) {
|
|
390
|
+
const files = p.codecFilePaths;
|
|
391
|
+
if (!files || files.length === 0) return fallback;
|
|
392
|
+
const key = JSON.stringify(p.name);
|
|
393
|
+
let inner = fallback;
|
|
394
|
+
for (let i = files.length - 1; i >= 0; i--) inner = `${RESOLVE_SEGMENT_FIELD_TYPE_NAME}<(typeof import('${codecImportPath(files[i], importBase)}'))['segmentParams'], ${key}, ${inner}>`;
|
|
395
|
+
return inner;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Format the searchParams type for a route entry.
|
|
399
|
+
*
|
|
400
|
+
* When a page.tsx (or params.ts) exports searchParams, we reference its
|
|
401
|
+
* inferred type via an import type. The import path is relative to
|
|
402
|
+
* `importBase` (the directory where the .d.ts will be written). When
|
|
403
|
+
* importBase is undefined, falls back to a bare relative path.
|
|
404
|
+
*/
|
|
405
|
+
function formatSearchParamsType(route, importBase) {
|
|
406
|
+
if (route.hasSearchParams && route.searchParamsPagePath) return `(typeof import('${codecImportPath(route.searchParamsPagePath, importBase)}'))['searchParams'] extends import('@timber-js/app/search-params').SearchParamsDefinition<infer T> ? T : never`;
|
|
407
|
+
return "{}";
|
|
408
|
+
}
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/routing/link-codegen.ts
|
|
411
|
+
/** Shared Link base-props type literal used in every emitted call signature. */
|
|
412
|
+
var LINK_BASE_PROPS_TYPE = "Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & { prefetch?: boolean; scroll?: boolean; preserveSearchParams?: true | string[]; onNavigate?: import('./client/link.js').OnNavigateHandler; children?: import('react').ReactNode }";
|
|
413
|
+
/**
|
|
414
|
+
* Build a TypeScript template literal pattern for a dynamic route.
|
|
415
|
+
* e.g. '/products/[id]' → '/products/${string}'
|
|
416
|
+
* '/blog/[...slug]' → '/blog/${string}'
|
|
417
|
+
* '/docs/[[...path]]' → '/docs/${string}' (also matches /docs)
|
|
418
|
+
* '/[org]/[repo]' → '/${string}/${string}'
|
|
419
|
+
*/
|
|
420
|
+
function buildResolvedPattern(route) {
|
|
421
|
+
return route.urlPath.split("/").map((part) => {
|
|
422
|
+
if (part.startsWith("[[...") && part.endsWith("]]")) return "${string}";
|
|
423
|
+
if (part.startsWith("[...") && part.endsWith("]")) return "${string}";
|
|
424
|
+
if (part.startsWith("[") && part.endsWith("]")) return "${string}";
|
|
425
|
+
return part;
|
|
426
|
+
}).join("/");
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Format the segmentParams type for Link overloads.
|
|
430
|
+
*
|
|
431
|
+
* Link params accept `string | number` for single dynamic segments
|
|
432
|
+
* (convenience — values are stringified at runtime). Catch-all and
|
|
433
|
+
* optional catch-all remain `string[]` / `string[] | undefined`.
|
|
434
|
+
*
|
|
435
|
+
* When the segment's params chain (TIM-834) declares a typed codec, the
|
|
436
|
+
* inferred type from the codec wins via a nested conditional.
|
|
437
|
+
*/
|
|
438
|
+
function formatLinkParamsType(params, importBase) {
|
|
439
|
+
if (params.length === 0) return "{}";
|
|
440
|
+
return `{ ${params.map((p) => {
|
|
441
|
+
const codecType = buildCodecChainType(p, importBase, p.type === "string" ? "string | number" : p.type);
|
|
442
|
+
return `${p.name}: ${codecType}`;
|
|
443
|
+
}).join("; ")} }`;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Catch-all call signatures for `<Link>` — external hrefs and computed
|
|
447
|
+
* `string` variables. Emitted from codegen in a SEPARATE
|
|
448
|
+
* `declare module` block (declared AFTER the per-route block) so the TS
|
|
449
|
+
* "later overload set ordered first" rule places these catch-all
|
|
450
|
+
* signatures ahead of per-route in resolution order, leaving per-route
|
|
451
|
+
* as the final overload whose error message is reported on failure.
|
|
452
|
+
*
|
|
453
|
+
* The conditional `string extends H ? ... : never` protection preserves
|
|
454
|
+
* TIM-624's guarantee that unknown internal path literals don't match
|
|
455
|
+
* the catch-all — typos like `<Link href="/typo" />` still error.
|
|
456
|
+
*/
|
|
457
|
+
function formatLinkCatchAllOverloads() {
|
|
458
|
+
const lines = [];
|
|
459
|
+
const baseProps = LINK_BASE_PROPS_TYPE;
|
|
460
|
+
const catchAllSearchParams = "{ definition: SearchParamsDefinition<Record<string, unknown>>; values: Record<string, unknown> } | Record<string, unknown>";
|
|
461
|
+
const externalHref = "`http://${string}` | `https://${string}` | `mailto:${string}` | `tel:${string}` | `ftp://${string}` | `//${string}` | `#${string}` | `?${string}`";
|
|
462
|
+
lines.push(" // Typed Link overloads — catch-all (block 2 / emitted second)");
|
|
463
|
+
lines.push(" interface LinkFunction {");
|
|
464
|
+
lines.push(` (props: ${baseProps} & {`);
|
|
465
|
+
lines.push(` href: ${externalHref}`);
|
|
466
|
+
lines.push(` segmentParams?: Record<string, unknown>`);
|
|
467
|
+
lines.push(` searchParams?: ${catchAllSearchParams}`);
|
|
468
|
+
lines.push(` }): import('react').JSX.Element`);
|
|
469
|
+
lines.push(` <H extends string>(`);
|
|
470
|
+
lines.push(` props: ${baseProps} & {`);
|
|
471
|
+
lines.push(` href: string extends H ? H : never`);
|
|
472
|
+
lines.push(` segmentParams?: Record<string, string | number | string[]>`);
|
|
473
|
+
lines.push(` searchParams?: ${catchAllSearchParams}`);
|
|
474
|
+
lines.push(` }`);
|
|
475
|
+
lines.push(` ): import('react').JSX.Element`);
|
|
476
|
+
lines.push(" }");
|
|
477
|
+
return lines;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Generate typed per-route Link call signatures via LinkFunction
|
|
481
|
+
* interface merging.
|
|
482
|
+
*
|
|
483
|
+
* TIM-835: This emits a SINGLE call signature whose props is a
|
|
484
|
+
* discriminated union keyed on `href`. TypeScript narrows the union by
|
|
485
|
+
* the literal `href` at the call site, then checks the rest of the
|
|
486
|
+
* props against the matched variant. When `segmentParams` or
|
|
487
|
+
* `searchParams` is wrong, TS reports the error against the matched
|
|
488
|
+
* variant — naming the user's actual `href` and the offending field.
|
|
489
|
+
*
|
|
490
|
+
* Before TIM-835, this function emitted N separate per-route overloads
|
|
491
|
+
* (one per route, sometimes two for dynamic routes). When ALL overloads
|
|
492
|
+
* failed, TS would pick an arbitrary failed overload (heuristically the
|
|
493
|
+
* "last tried") to render the diagnostic, often pointing at a route
|
|
494
|
+
* completely unrelated to the one the user wrote. The discriminated
|
|
495
|
+
* union sidesteps overload-resolution heuristics entirely.
|
|
496
|
+
*
|
|
497
|
+
* Open property shapes (`Record<string, unknown>` instead of `never`)
|
|
498
|
+
* for `segmentParams` on routes that don't declare them keep generic
|
|
499
|
+
* `LinkProps`-spreading wrappers compiling. (Aligned with TIM-833.)
|
|
500
|
+
*
|
|
501
|
+
* TIM-832: this function still emits the per-route block FIRST and the
|
|
502
|
+
* catch-all block follows, so per-route remains the LAST overload set in
|
|
503
|
+
* resolution order — the one TS reports against on failure. With a
|
|
504
|
+
* discriminated union there is only one call signature in this block,
|
|
505
|
+
* so the resolved-template-vs-pattern ordering reduces to placing the
|
|
506
|
+
* pattern variant before the resolved-template variant inside the union.
|
|
507
|
+
*/
|
|
508
|
+
function formatTypedLinkOverloads(routes, importBase) {
|
|
509
|
+
const lines = [];
|
|
510
|
+
const baseProps = LINK_BASE_PROPS_TYPE;
|
|
511
|
+
const variants = [];
|
|
512
|
+
for (const route of routes) {
|
|
513
|
+
const hasDynamicParams = route.params.length > 0;
|
|
514
|
+
const paramsProp = hasDynamicParams ? `segmentParams: ${formatLinkParamsType(route.params, importBase)}` : "segmentParams?: Record<string, unknown>";
|
|
515
|
+
const searchParamsType = route.hasSearchParams ? formatSearchParamsType(route, importBase) : null;
|
|
516
|
+
const patternSearchParamsProp = searchParamsType ? `searchParams?: Partial<${searchParamsType}>` : "searchParams?: Record<string, unknown>";
|
|
517
|
+
variants.push(`${baseProps} & { href: '${route.urlPath}'; ${paramsProp}; ${patternSearchParamsProp} }`);
|
|
518
|
+
if (hasDynamicParams) {
|
|
519
|
+
const templatePattern = buildResolvedPattern(route);
|
|
520
|
+
if (templatePattern) {
|
|
521
|
+
const resolvedSearchParamsProp = searchParamsType ? `searchParams?: { definition: SearchParamsDefinition<${searchParamsType}>; values: Partial<${searchParamsType}> }` : "searchParams?: Record<string, unknown>";
|
|
522
|
+
variants.push(`${baseProps} & { href: \`${templatePattern}\`; segmentParams?: Record<string, never>; ${resolvedSearchParamsProp} }`);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
lines.push(" interface LinkFunction {");
|
|
527
|
+
if (variants.length === 0) {
|
|
528
|
+
lines.push(" }");
|
|
529
|
+
return lines;
|
|
530
|
+
}
|
|
531
|
+
lines.push(" (");
|
|
532
|
+
lines.push(" props:");
|
|
533
|
+
for (const variant of variants) lines.push(` | (${variant})`);
|
|
534
|
+
lines.push(` ): import('react').JSX.Element`);
|
|
535
|
+
lines.push(" }");
|
|
536
|
+
return lines;
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/routing/codegen.ts
|
|
540
|
+
/**
|
|
541
|
+
* Route map codegen.
|
|
542
|
+
*
|
|
543
|
+
* Walks the scanned RouteTree and generates a TypeScript declaration file
|
|
544
|
+
* mapping every route to its params and searchParams shapes.
|
|
545
|
+
*
|
|
546
|
+
* This runs at build time and in dev (regenerated on file changes).
|
|
547
|
+
* No runtime overhead — purely static type generation.
|
|
548
|
+
*/
|
|
549
|
+
/**
|
|
550
|
+
* Generate a TypeScript declaration file string from a scanned route tree.
|
|
551
|
+
*
|
|
552
|
+
* The output is a `declare module '@timber-js/app'` block containing the Routes
|
|
553
|
+
* interface that maps every route path to its params and searchParams shape.
|
|
554
|
+
*/
|
|
555
|
+
function generateRouteMap(tree, options = {}) {
|
|
556
|
+
const routes = [];
|
|
557
|
+
collectRoutes(tree.root, [], [], routes);
|
|
558
|
+
routes.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
|
|
559
|
+
return formatDeclarationFile(routes, options.outputDir ?? options.appDir);
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Recursively walk the segment tree and collect route entries.
|
|
563
|
+
*
|
|
564
|
+
* A route entry is created for any segment that has a `page` or `route` file.
|
|
565
|
+
* Params accumulate from ancestor dynamic segments.
|
|
566
|
+
*/
|
|
567
|
+
function collectRoutes(node, ancestorParams, ancestorParamsFiles, routes) {
|
|
568
|
+
const ownParamsFile = node.params && fileHasExport(node.params.filePath, "segmentParams") ? node.params.filePath : void 0;
|
|
569
|
+
const params = [...ancestorParams];
|
|
570
|
+
if (node.paramName) {
|
|
571
|
+
const legacyFallback = ownParamsFile ? void 0 : findLegacyParamsExport(node);
|
|
572
|
+
params.push({
|
|
573
|
+
name: node.paramName,
|
|
574
|
+
type: paramTypeForSegment(node.segmentType),
|
|
575
|
+
legacyCodecFilePath: legacyFallback
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
const nextAncestorFiles = ownParamsFile ? [...ancestorParamsFiles, ownParamsFile] : ancestorParamsFiles;
|
|
579
|
+
const isPage = !!node.page;
|
|
580
|
+
const isApiRoute = !!node.route;
|
|
581
|
+
if (isPage || isApiRoute) {
|
|
582
|
+
const leafFirstChain = nextAncestorFiles.length > 0 ? [...nextAncestorFiles].reverse() : [];
|
|
583
|
+
const resolvedParams = params.map((p) => {
|
|
584
|
+
const codecFilePaths = leafFirstChain.length > 0 ? leafFirstChain : p.legacyCodecFilePath ? [p.legacyCodecFilePath] : void 0;
|
|
585
|
+
return {
|
|
586
|
+
name: p.name,
|
|
587
|
+
type: p.type,
|
|
588
|
+
codecFilePaths
|
|
589
|
+
};
|
|
590
|
+
});
|
|
591
|
+
const entry = {
|
|
592
|
+
urlPath: node.urlPath,
|
|
593
|
+
params: resolvedParams,
|
|
594
|
+
hasSearchParams: false,
|
|
595
|
+
isApiRoute
|
|
596
|
+
};
|
|
597
|
+
if (isPage) {
|
|
598
|
+
if (node.params && fileHasExport(node.params.filePath, "searchParams")) {
|
|
599
|
+
entry.hasSearchParams = true;
|
|
600
|
+
entry.searchParamsPagePath = node.params.filePath;
|
|
601
|
+
} else if (node.page && fileHasExport(node.page.filePath, "searchParams")) {
|
|
602
|
+
entry.hasSearchParams = true;
|
|
603
|
+
entry.searchParamsPagePath = node.page.filePath;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
routes.push(entry);
|
|
607
|
+
}
|
|
608
|
+
for (const child of node.children) collectRoutes(child, params, nextAncestorFiles, routes);
|
|
609
|
+
for (const slot of Object.values(node.slots)) collectRoutes(slot, params, nextAncestorFiles, routes);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Determine the TypeScript type for a segment's param.
|
|
613
|
+
*/
|
|
614
|
+
function paramTypeForSegment(segmentType) {
|
|
615
|
+
switch (segmentType) {
|
|
616
|
+
case "catch-all": return "string[]";
|
|
617
|
+
case "optional-catch-all": return "string[] | undefined";
|
|
618
|
+
default: return "string";
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Check if a file exports a specific named export.
|
|
623
|
+
*
|
|
624
|
+
* Uses a lightweight regex check — not full AST parsing. The actual type
|
|
625
|
+
* extraction happens via the TypeScript compiler in the generated .d.ts.
|
|
626
|
+
*/
|
|
627
|
+
function fileHasExport(filePath, exportName) {
|
|
628
|
+
if (!existsSync(filePath)) return false;
|
|
629
|
+
try {
|
|
630
|
+
const content = readFileSync(filePath, "utf-8");
|
|
631
|
+
const e = exportName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
632
|
+
return new RegExp(`export\\s+(const|let|var)\\s+${e}\\b`).test(content) || new RegExp(`export\\s*\\{[^}]*\\b${e}\\b[^}]*\\}`).test(content);
|
|
633
|
+
} catch {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Find a legacy `segmentParams` export on layout.tsx or page.tsx.
|
|
639
|
+
*
|
|
640
|
+
* Backward-compat shim: TIM-508 made params.ts the canonical location
|
|
641
|
+
* for `segmentParams`. Layout/page exports are still accepted for the
|
|
642
|
+
* OWN segment only (not inherited by descendants — see TIM-834).
|
|
643
|
+
*/
|
|
644
|
+
function findLegacyParamsExport(node) {
|
|
645
|
+
if (node.layout && fileHasExport(node.layout.filePath, "segmentParams")) return node.layout.filePath;
|
|
646
|
+
if (node.page && fileHasExport(node.page.filePath, "segmentParams")) return node.page.filePath;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Format the collected routes into a TypeScript declaration file.
|
|
650
|
+
*/
|
|
651
|
+
function formatDeclarationFile(routes, importBase) {
|
|
652
|
+
const lines = [];
|
|
653
|
+
lines.push("// This file is auto-generated by timber.js route map codegen.");
|
|
654
|
+
lines.push("// Do not edit manually. Regenerated on build and in dev mode.");
|
|
655
|
+
lines.push("");
|
|
656
|
+
lines.push("export {};");
|
|
657
|
+
lines.push("");
|
|
658
|
+
lines.push(emitResolveSegmentFieldHelper());
|
|
659
|
+
lines.push("");
|
|
660
|
+
lines.push("declare module '@timber-js/app' {");
|
|
661
|
+
lines.push(" interface Routes {");
|
|
662
|
+
for (const route of routes) {
|
|
663
|
+
const paramsType = formatParamsType(route.params, importBase);
|
|
664
|
+
const searchParamsType = formatSearchParamsType(route, importBase);
|
|
665
|
+
lines.push(` '${route.urlPath}': {`);
|
|
666
|
+
lines.push(` segmentParams: ${paramsType}`);
|
|
667
|
+
lines.push(` searchParams: ${searchParamsType}`);
|
|
668
|
+
lines.push(` }`);
|
|
669
|
+
}
|
|
670
|
+
lines.push(" }");
|
|
671
|
+
lines.push("}");
|
|
672
|
+
lines.push("");
|
|
673
|
+
const pageRoutes = routes.filter((r) => !r.isApiRoute);
|
|
674
|
+
const dynamicRoutes = routes.filter((r) => r.params.length > 0);
|
|
675
|
+
if (dynamicRoutes.length > 0 || pageRoutes.length > 0) {
|
|
676
|
+
lines.push("declare module '@timber-js/app/client' {");
|
|
677
|
+
lines.push(" import type { SearchParamsDefinition, SetParams, QueryStatesOptions, SearchParamCodec } from '@timber-js/app/search-params'");
|
|
678
|
+
lines.push("");
|
|
679
|
+
if (dynamicRoutes.length > 0) {
|
|
680
|
+
for (const route of dynamicRoutes) {
|
|
681
|
+
const paramsType = formatParamsType(route.params, importBase);
|
|
682
|
+
lines.push(` export function useSegmentParams(route: '${route.urlPath}'): ${paramsType}`);
|
|
683
|
+
}
|
|
684
|
+
lines.push(" export function useSegmentParams(): Record<string, string | string[]>");
|
|
685
|
+
lines.push("");
|
|
686
|
+
}
|
|
687
|
+
if (pageRoutes.length > 0) {
|
|
688
|
+
lines.push(...formatUseQueryStatesOverloads(pageRoutes, importBase));
|
|
689
|
+
lines.push("");
|
|
690
|
+
}
|
|
691
|
+
if (pageRoutes.length > 0) {
|
|
692
|
+
lines.push(" // Typed Link overloads — per-route (block 1 / emitted first)");
|
|
693
|
+
lines.push(...formatTypedLinkOverloads(pageRoutes, importBase));
|
|
694
|
+
lines.push("");
|
|
695
|
+
}
|
|
696
|
+
lines.push("}");
|
|
697
|
+
lines.push("");
|
|
698
|
+
}
|
|
699
|
+
lines.push("declare module '@timber-js/app/client' {");
|
|
700
|
+
lines.push(" import type { SearchParamsDefinition } from '@timber-js/app/search-params'");
|
|
701
|
+
lines.push("");
|
|
702
|
+
lines.push(...formatLinkCatchAllOverloads());
|
|
703
|
+
lines.push("}");
|
|
704
|
+
lines.push("");
|
|
705
|
+
return lines.join("\n");
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Format the params type for a route entry.
|
|
709
|
+
*/
|
|
710
|
+
function formatParamsType(params, importBase) {
|
|
711
|
+
if (params.length === 0) return "{}";
|
|
712
|
+
return `{ ${params.map((p) => {
|
|
713
|
+
const codecType = buildCodecChainType(p, importBase, p.type);
|
|
714
|
+
return `${p.name}: ${codecType}`;
|
|
715
|
+
}).join("; ")} }`;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Generate useQueryStates overloads.
|
|
719
|
+
*
|
|
720
|
+
* For each page route:
|
|
721
|
+
* - Routes with search-params.ts get a typed overload returning the inferred T
|
|
722
|
+
* - Routes without search-params.ts get an overload returning [{}, SetParams<{}>]
|
|
723
|
+
*
|
|
724
|
+
* A fallback overload for standalone codecs (existing API) is emitted last.
|
|
725
|
+
*/
|
|
726
|
+
function formatUseQueryStatesOverloads(routes, importBase) {
|
|
727
|
+
const lines = [];
|
|
728
|
+
for (const route of routes) {
|
|
729
|
+
const searchParamsType = route.hasSearchParams ? formatSearchParamsType(route, importBase) : "{}";
|
|
730
|
+
lines.push(` export function useQueryStates<R extends '${route.urlPath}'>(route: R, options?: QueryStatesOptions): [${searchParamsType}, SetParams<${searchParamsType}>]`);
|
|
731
|
+
}
|
|
732
|
+
lines.push(" export function useQueryStates<T extends Record<string, unknown>>(codecs: { [K in keyof T]: SearchParamCodec<T[K]> }, options?: QueryStatesOptions): [T, SetParams<T>]");
|
|
733
|
+
return lines;
|
|
734
|
+
}
|
|
735
|
+
//#endregion
|
|
736
|
+
//#region src/routing/interception.ts
|
|
737
|
+
/**
|
|
738
|
+
* Collect all interception rewrite rules from the route tree.
|
|
739
|
+
*
|
|
740
|
+
* Walks the tree recursively. For each intercepting segment, computes the
|
|
741
|
+
* intercepted URL based on the marker and the segment's position.
|
|
742
|
+
*/
|
|
743
|
+
function collectInterceptionRewrites(root) {
|
|
744
|
+
const rewrites = [];
|
|
745
|
+
walkForInterceptions(root, [root], rewrites);
|
|
746
|
+
return rewrites;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Recursively walk the segment tree to find intercepting routes.
|
|
750
|
+
*/
|
|
751
|
+
function walkForInterceptions(node, ancestors, rewrites) {
|
|
752
|
+
for (const child of node.children) if (child.segmentType === "intercepting" && child.interceptionMarker) collectFromInterceptingNode(child, ancestors, rewrites);
|
|
753
|
+
else walkForInterceptions(child, [...ancestors, child], rewrites);
|
|
754
|
+
for (const slot of Object.values(node.slots)) walkForInterceptions(slot, ancestors, rewrites);
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* For an intercepting segment, find all leaf pages in its sub-tree and
|
|
758
|
+
* generate rewrite rules for each.
|
|
759
|
+
*/
|
|
760
|
+
function collectFromInterceptingNode(interceptingNode, ancestors, rewrites) {
|
|
761
|
+
const marker = interceptingNode.interceptionMarker;
|
|
762
|
+
const segmentName = interceptingNode.interceptedSegmentName;
|
|
763
|
+
const parentUrlPath = ancestors[ancestors.length - 1].urlPath;
|
|
764
|
+
const interceptedBase = computeInterceptedBase(parentUrlPath, marker);
|
|
765
|
+
collectLeavesWithRewrites(interceptingNode, interceptedBase === "/" ? `/${segmentName}` : `${interceptedBase}/${segmentName}`, parentUrlPath, [...ancestors, interceptingNode], rewrites);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Recursively find leaf pages in an intercepting sub-tree and generate
|
|
769
|
+
* rewrite rules for each.
|
|
770
|
+
*/
|
|
771
|
+
function collectLeavesWithRewrites(node, interceptedUrlPath, interceptingPrefix, segmentPath, rewrites) {
|
|
772
|
+
if (node.page) rewrites.push({
|
|
773
|
+
interceptedPattern: interceptedUrlPath,
|
|
774
|
+
interceptingPrefix,
|
|
775
|
+
segmentPath: [...segmentPath]
|
|
776
|
+
});
|
|
777
|
+
for (const child of node.children) collectLeavesWithRewrites(child, child.segmentType === "group" ? interceptedUrlPath : `${interceptedUrlPath}/${child.segmentName}`, interceptingPrefix, [...segmentPath, child], rewrites);
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Compute the base URL that an intercepting route intercepts, given the
|
|
781
|
+
* parent's URL path and the interception marker.
|
|
782
|
+
*
|
|
783
|
+
* - (.) — same level: parent's URL path
|
|
784
|
+
* - (..) — one level up: parent's parent URL path
|
|
785
|
+
* - (...) — root level: /
|
|
786
|
+
* - (..)(..) — two levels up: parent's grandparent URL path
|
|
787
|
+
*
|
|
788
|
+
* Level counting operates on URL path segments, NOT filesystem directories.
|
|
789
|
+
* Route groups and parallel slots are already excluded from urlPath (they
|
|
790
|
+
* don't add URL depth), so (..) correctly climbs visible segments. This
|
|
791
|
+
* avoids the Vinext bug where path.dirname() on filesystem paths would
|
|
792
|
+
* waste climbs on invisible route groups.
|
|
793
|
+
*/
|
|
794
|
+
function computeInterceptedBase(parentUrlPath, marker) {
|
|
795
|
+
switch (marker) {
|
|
796
|
+
case "(.)": return parentUrlPath;
|
|
797
|
+
case "(..)": {
|
|
798
|
+
const parts = parentUrlPath.split("/").filter(Boolean);
|
|
799
|
+
parts.pop();
|
|
800
|
+
return parts.length === 0 ? "/" : `/${parts.join("/")}`;
|
|
801
|
+
}
|
|
802
|
+
case "(...)": return "/";
|
|
803
|
+
case "(..)(..)": {
|
|
804
|
+
const parts = parentUrlPath.split("/").filter(Boolean);
|
|
805
|
+
parts.pop();
|
|
806
|
+
parts.pop();
|
|
807
|
+
return parts.length === 0 ? "/" : `/${parts.join("/")}`;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
//#endregion
|
|
812
|
+
//#region src/routing/walkers.ts
|
|
813
|
+
/**
|
|
814
|
+
* Walk a segment tree and collect every leaf with a `page` or `route`
|
|
815
|
+
* handler. Generic over `TFile` so it works on both the build-time
|
|
816
|
+
* scanner output and the runtime manifest tree.
|
|
817
|
+
*
|
|
818
|
+
* - Pages and route handlers at the same URL produce two distinct
|
|
819
|
+
* entries (the build report deduplicates by URL afterward).
|
|
820
|
+
* - Parallel slots are skipped unless `includeSlots: true` (slots
|
|
821
|
+
* share their parent's URL and are not addressable on their own).
|
|
822
|
+
* - Result is sorted by `urlPath` for deterministic output.
|
|
823
|
+
*/
|
|
824
|
+
function collectLeafRoutes(root, options = {}) {
|
|
825
|
+
const { includeSlots = false } = options;
|
|
826
|
+
const result = [];
|
|
827
|
+
walk(root, [], result, includeSlots);
|
|
828
|
+
result.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
|
|
829
|
+
return result;
|
|
830
|
+
}
|
|
831
|
+
function walk(node, chain, result, includeSlots) {
|
|
832
|
+
const currentChain = [...chain, node];
|
|
833
|
+
const path = node.urlPath || "/";
|
|
834
|
+
if (node.page) result.push({
|
|
835
|
+
urlPath: path,
|
|
836
|
+
segments: currentChain,
|
|
837
|
+
page: node.page
|
|
838
|
+
});
|
|
839
|
+
if (node.route) result.push({
|
|
840
|
+
urlPath: path,
|
|
841
|
+
segments: currentChain,
|
|
842
|
+
route: node.route
|
|
843
|
+
});
|
|
844
|
+
for (const child of node.children) walk(child, currentChain, result, includeSlots);
|
|
845
|
+
if (includeSlots) for (const slotNode of Object.values(node.slots)) walk(slotNode, currentChain, result, includeSlots);
|
|
846
|
+
}
|
|
847
|
+
//#endregion
|
|
848
|
+
export { scanRoutes as i, collectInterceptionRewrites as n, generateRouteMap as r, collectLeafRoutes as t };
|
|
849
|
+
|
|
850
|
+
//# sourceMappingURL=walkers-Tg0Alwcg.js.map
|