@timber-js/app 0.2.0-alpha.97 → 0.2.0-alpha.99
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/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/{define-Itxvcd7F.js → define-B-Q_UMOD.js} +19 -23
- package/dist/_chunks/define-B-Q_UMOD.js.map +1 -0
- package/dist/_chunks/{define-C77ScO0m.js → define-CfBPoJb0.js} +24 -7
- 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-CYBGxKtc.js → format-Bcn-Iv1x.js} +1 -1
- package/dist/_chunks/{format-CYBGxKtc.js.map → format-Bcn-Iv1x.js.map} +1 -1
- 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-DS3eKNmf.js → metadata-routes-BU684ls2.js} +1 -1
- package/dist/_chunks/{metadata-routes-DS3eKNmf.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-C3xl_vfb.js → schema-bridge-Cxu4l-7p.js} +1 -1
- package/dist/_chunks/{schema-bridge-C3xl_vfb.js.map → schema-bridge-Cxu4l-7p.js.map} +1 -1
- package/dist/_chunks/segment-classify-BjfuctV2.js +137 -0
- package/dist/_chunks/segment-classify-BjfuctV2.js.map +1 -0
- package/dist/_chunks/{segment-context-fHFLF1PE.js → segment-context-Dx_OizxD.js} +1 -1
- package/dist/_chunks/{segment-context-fHFLF1PE.js.map → segment-context-Dx_OizxD.js.map} +1 -1
- package/dist/_chunks/{router-ref-C8OCm7g7.js → ssr-data-B4CdH7rE.js} +2 -26
- package/dist/_chunks/ssr-data-B4CdH7rE.js.map +1 -0
- package/dist/_chunks/{stale-reload-BX5gL1r-.js → stale-reload-Bab885FO.js} +1 -1
- package/dist/_chunks/{stale-reload-BX5gL1r-.js.map → stale-reload-Bab885FO.js.map} +1 -1
- 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-BiV5GJgm.js → use-query-states-B2XTqxDR.js} +3 -19
- package/dist/_chunks/use-query-states-B2XTqxDR.js.map +1 -0
- package/dist/_chunks/{use-params-IOPu7E8t.js → use-segment-params-BkpKAQ7D.js} +9 -95
- package/dist/_chunks/use-segment-params-BkpKAQ7D.js.map +1 -0
- package/dist/_chunks/{interception-BbqMCVXa.js → walkers-Tg0Alwcg.js} +66 -87
- package/dist/_chunks/walkers-Tg0Alwcg.js.map +1 -0
- package/dist/_chunks/{dev-warnings-DpGRGoDi.js → warnings-Cg47l5sk.js} +3 -3
- 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.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +8 -28
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +63 -31
- 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/index.js +9 -2
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/client/error-boundary.js +2 -1
- package/dist/client/error-boundary.js.map +1 -1
- package/dist/client/form.d.ts +10 -24
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -5
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +41 -91
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +2 -1
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +81 -7
- package/dist/client/internal.js.map +1 -1
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/state.d.ts +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-params.d.ts → use-segment-params.d.ts} +1 -1
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +1 -1
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +2 -2
- package/dist/config-types.d.ts +28 -0
- package/dist/config-types.d.ts.map +1 -1
- package/dist/cookies/define-cookie.d.ts +87 -35
- 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 +48 -2
- package/dist/cookies/index.js.map +1 -0
- 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/{plugins/dev-404-page.d.ts → dev-tools/404-page.d.ts} +9 -19
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/{plugins/dev-browser-logs.d.ts → dev-tools/browser-logs.d.ts} +1 -1
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/{plugins/dev-error-page.d.ts → dev-tools/error-page.d.ts} +2 -2
- package/dist/dev-tools/error-page.d.ts.map +1 -0
- package/dist/{server/dev-holding-server.d.ts → dev-tools/holding-server.d.ts} +5 -3
- 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} +1 -1
- package/dist/dev-tools/logs.d.ts.map +1 -0
- package/dist/{plugins/dev-error-overlay.d.ts → dev-tools/overlay.d.ts} +3 -12
- 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/{plugins/dev-terminal-error.d.ts → dev-tools/terminal.d.ts} +2 -2
- package/dist/dev-tools/terminal.d.ts.map +1 -0
- package/dist/{server/dev-warnings.d.ts → dev-tools/warnings.d.ts} +1 -1
- package/dist/dev-tools/warnings.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +285 -133
- package/dist/index.js.map +1 -1
- package/dist/plugin-context.d.ts +1 -1
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +6 -4
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/routing/convention-lint.d.ts.map +1 -1
- package/dist/routing/index.d.ts +5 -3
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +3 -3
- package/dist/routing/scanner.d.ts +1 -10
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/segment-classify.d.ts +37 -8
- package/dist/routing/segment-classify.d.ts.map +1 -1
- package/dist/routing/status-file-lint.d.ts.map +1 -1
- package/dist/routing/types.d.ts +63 -23
- 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/search-params/define.d.ts +25 -7
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.js +5 -3
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/wrappers.d.ts +2 -2
- package/dist/search-params/wrappers.d.ts.map +1 -1
- package/dist/segment-params/define.d.ts +23 -6
- package/dist/segment-params/define.d.ts.map +1 -1
- package/dist/segment-params/index.js +1 -1
- package/dist/server/access-gate.d.ts +4 -3
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-handler.d.ts +15 -6
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +5 -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/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/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/early-hints-sender.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 +59 -59
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +5 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +4 -149
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +6 -4
- package/dist/server/internal.d.ts.map +1 -1
- package/dist/server/internal.js +852 -852
- package/dist/server/internal.js.map +1 -1
- package/dist/server/logger.d.ts +14 -0
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +17 -0
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +46 -49
- package/dist/server/node-stream-transforms.d.ts.map +1 -1
- 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-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 +51 -32
- 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/request-context.d.ts +22 -159
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +20 -47
- 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/helpers.d.ts +1 -1
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- 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/wrap-action-dispatch.d.ts +119 -0
- package/dist/server/rsc-entry/wrap-action-dispatch.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/tracing.d.ts +1 -1
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +45 -16
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/types.d.ts +48 -0
- 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/shims/headers.d.ts +2 -2
- 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 +9 -4
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/directive-parser.d.ts +0 -45
- package/dist/utils/directive-parser.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/build-output-helper.ts +77 -0
- package/src/adapters/cloudflare.ts +10 -50
- package/src/adapters/nitro.ts +66 -50
- package/src/adapters/shared.ts +40 -0
- package/src/cache/timber-cache.ts +3 -2
- package/src/client/form.tsx +17 -25
- package/src/client/index.ts +16 -9
- package/src/client/internal.ts +3 -2
- package/src/client/router.ts +1 -1
- package/src/client/rsc-fetch.ts +15 -0
- package/src/client/state.ts +2 -2
- package/src/client/use-cookie.ts +29 -0
- package/src/codec.ts +3 -7
- package/src/config-types.ts +28 -0
- package/src/cookies/define-cookie.ts +271 -78
- package/src/cookies/index.ts +11 -8
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +134 -0
- package/src/{plugins/dev-404-page.ts → dev-tools/404-page.ts} +17 -48
- package/src/{plugins/dev-error-page.ts → dev-tools/error-page.ts} +5 -32
- package/src/{server/dev-holding-server.ts → dev-tools/holding-server.ts} +4 -2
- 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} +2 -2
- package/src/{plugins/dev-error-overlay.ts → dev-tools/overlay.ts} +5 -23
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/{plugins/dev-terminal-error.ts → dev-tools/terminal.ts} +4 -38
- package/src/{server/dev-warnings.ts → dev-tools/warnings.ts} +1 -1
- package/src/index.ts +95 -34
- package/src/plugin-context.ts +1 -1
- package/src/plugins/adapter-build.ts +3 -1
- package/src/plugins/build-report.ts +13 -22
- package/src/plugins/dev-server.ts +3 -3
- package/src/plugins/routing.ts +14 -12
- package/src/plugins/shims.ts +1 -1
- package/src/plugins/static-build.ts +1 -1
- package/src/routing/codegen.ts +1 -1
- package/src/routing/convention-lint.ts +9 -8
- package/src/routing/index.ts +5 -3
- package/src/routing/interception.ts +1 -1
- package/src/routing/scanner.ts +22 -95
- package/src/routing/segment-classify.ts +107 -8
- package/src/routing/status-file-lint.ts +7 -5
- package/src/routing/types.ts +63 -23
- package/src/routing/walkers.ts +90 -0
- package/src/search-params/define.ts +71 -15
- package/src/search-params/wrappers.ts +9 -2
- package/src/segment-params/define.ts +66 -13
- package/src/server/access-gate.tsx +9 -8
- package/src/server/action-handler.ts +34 -38
- package/src/server/als-registry.ts +5 -5
- package/src/server/asset-headers.ts +8 -34
- package/src/server/cookie-context.ts +468 -0
- package/src/server/cookie-parsing.ts +135 -0
- package/src/server/{deny-page-resolver.ts → deny-boundary.ts} +78 -14
- package/src/server/deny-renderer.ts +7 -12
- package/src/server/early-hints-sender.ts +3 -2
- package/src/server/fallback-error.ts +2 -2
- package/src/server/html-injector-core.ts +403 -0
- package/src/server/html-injectors.ts +158 -297
- package/src/server/index.ts +13 -14
- package/src/server/internal.ts +10 -3
- package/src/server/logger.ts +23 -0
- package/src/server/middleware-runner.ts +44 -0
- package/src/server/node-stream-transforms.ts +108 -248
- package/src/server/param-coercion.ts +76 -0
- package/src/server/pipeline-helpers.ts +204 -0
- package/src/server/pipeline-outcome.ts +167 -0
- package/src/server/pipeline-phases.ts +409 -0
- package/src/server/pipeline.ts +70 -540
- package/src/server/port-resolution.ts +215 -0
- package/src/server/request-context.ts +46 -451
- package/src/server/route-element-builder.ts +8 -4
- package/src/server/route-matcher.ts +28 -60
- package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
- package/src/server/rsc-entry/api-handler.ts +2 -2
- package/src/server/rsc-entry/error-renderer.ts +2 -2
- package/src/server/rsc-entry/helpers.ts +2 -7
- package/src/server/rsc-entry/index.ts +81 -366
- package/src/server/rsc-entry/render-route.ts +304 -0
- package/src/server/rsc-entry/rsc-payload.ts +1 -1
- package/src/server/rsc-entry/ssr-renderer.ts +2 -2
- package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
- package/src/server/sitemap-generator.ts +1 -1
- package/src/server/slot-resolver.ts +1 -1
- package/src/server/ssr-entry.ts +1 -1
- package/src/server/state-tree-diff.ts +4 -1
- package/src/server/status-code-resolver.ts +112 -128
- package/src/server/tracing.ts +3 -3
- package/src/server/tree-builder.ts +134 -56
- package/src/server/types.ts +52 -0
- package/src/server/utils/escape-html.ts +20 -0
- package/src/shims/headers.ts +3 -3
- package/src/shims/navigation-client.ts +4 -3
- package/src/shims/navigation.ts +9 -7
- package/src/utils/directive-parser.ts +0 -392
- package/dist/_chunks/actions-DLnUaR65.js +0 -421
- package/dist/_chunks/actions-DLnUaR65.js.map +0 -1
- package/dist/_chunks/als-registry-HS0LGUl2.js +0 -41
- package/dist/_chunks/als-registry-HS0LGUl2.js.map +0 -1
- package/dist/_chunks/debug-ECi_61pb.js +0 -108
- package/dist/_chunks/debug-ECi_61pb.js.map +0 -1
- package/dist/_chunks/define-C77ScO0m.js.map +0 -1
- package/dist/_chunks/define-Itxvcd7F.js.map +0 -1
- package/dist/_chunks/define-cookie-BowvzoP0.js +0 -94
- package/dist/_chunks/define-cookie-BowvzoP0.js.map +0 -1
- package/dist/_chunks/dev-warnings-DpGRGoDi.js.map +0 -1
- package/dist/_chunks/interception-BbqMCVXa.js.map +0 -1
- package/dist/_chunks/merge-search-params-Cm_KIWDX.js +0 -41
- package/dist/_chunks/merge-search-params-Cm_KIWDX.js.map +0 -1
- package/dist/_chunks/request-context-CK5tZqIP.js +0 -478
- package/dist/_chunks/request-context-CK5tZqIP.js.map +0 -1
- package/dist/_chunks/router-ref-C8OCm7g7.js.map +0 -1
- package/dist/_chunks/segment-classify-BDNn6EzD.js +0 -65
- package/dist/_chunks/segment-classify-BDNn6EzD.js.map +0 -1
- package/dist/_chunks/tracing-CCYbKn5n.js +0 -238
- package/dist/_chunks/tracing-CCYbKn5n.js.map +0 -1
- package/dist/_chunks/use-params-IOPu7E8t.js.map +0 -1
- package/dist/_chunks/use-query-states-BiV5GJgm.js.map +0 -1
- package/dist/client/use-params.d.ts.map +0 -1
- package/dist/plugins/dev-404-page.d.ts.map +0 -1
- package/dist/plugins/dev-browser-logs.d.ts.map +0 -1
- package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
- package/dist/plugins/dev-error-page.d.ts.map +0 -1
- package/dist/plugins/dev-logs.d.ts.map +0 -1
- package/dist/plugins/dev-terminal-error.d.ts.map +0 -1
- package/dist/server/deny-page-resolver.d.ts +0 -52
- package/dist/server/deny-page-resolver.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-holding-server.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/page-deny-boundary.d.ts +0 -31
- package/dist/server/page-deny-boundary.d.ts.map +0 -1
- 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/page-deny-boundary.tsx +0 -56
- /package/src/client/{use-params.ts → use-segment-params.ts} +0 -0
- /package/src/{plugins/dev-browser-logs.ts → dev-tools/browser-logs.ts} +0 -0
- /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
package/dist/server/logger.d.ts
CHANGED
|
@@ -102,4 +102,18 @@ export declare function logSwrRefetchFailed(data: {
|
|
|
102
102
|
export declare function logCacheMiss(data: {
|
|
103
103
|
cacheKey: string;
|
|
104
104
|
}): void;
|
|
105
|
+
/**
|
|
106
|
+
* Log an intentionally swallowed error. Provides observability into catch
|
|
107
|
+
* blocks that are deliberately empty — the error is consumed, never rethrown.
|
|
108
|
+
*
|
|
109
|
+
* Default level: `warn` in dev (so the overlay surfaces patterns), `debug`
|
|
110
|
+
* in production (low noise unless TIMBER_DEBUG is set). Pass `opts.level`
|
|
111
|
+
* to override.
|
|
112
|
+
*
|
|
113
|
+
* **Infallible** — swallow() itself never throws, even if the logger is
|
|
114
|
+
* broken. A thrown swallow would turn a benign catch into a crash.
|
|
115
|
+
*/
|
|
116
|
+
export declare function swallow(err: unknown, reason: string, opts?: {
|
|
117
|
+
level?: 'debug' | 'warn';
|
|
118
|
+
}): void;
|
|
105
119
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/server/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/server/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,M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gB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,CAO/F"}
|
|
@@ -33,4 +33,21 @@ export declare function runMiddleware(middlewareFn: MiddlewareFn, ctx: Middlewar
|
|
|
33
33
|
* @returns A Response if any middleware short-circuited, or undefined to continue
|
|
34
34
|
*/
|
|
35
35
|
export declare function runMiddlewareChain(chain: MiddlewareFn[], ctx: MiddlewareContext): Promise<Response | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Mark a request so the pipeline skips its middleware phase.
|
|
38
|
+
*
|
|
39
|
+
* Used by `wrap-action-dispatch.ts` for the no-JS form-rerender path.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare function markRequestBypassMiddleware(req: Request): void;
|
|
44
|
+
/**
|
|
45
|
+
* Check whether a request was marked to bypass middleware.
|
|
46
|
+
*
|
|
47
|
+
* Called by `handleRequest` in pipeline-phases.ts before invoking the
|
|
48
|
+
* middleware phase. Returns false for any request not explicitly marked.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare function shouldBypassMiddleware(req: Request): boolean;
|
|
36
53
|
//# sourceMappingURL=middleware-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-runner.d.ts","sourceRoot":"","sources":["../../src/server/middleware-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAM/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,EAAE,EACrB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAQ/B"}
|
|
1
|
+
{"version":3,"file":"middleware-runner.d.ts","sourceRoot":"","sources":["../../src/server/middleware-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAM/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,EAAE,EACrB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAQ/B;AAuBD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE5D"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js native stream transforms for SSR HTML post-processing.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* streams
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* Node.js `Transform` wrappers around the pure helpers in
|
|
5
|
+
* `html-injector-core.ts`. Used on Node.js / Bun where C++-backed
|
|
6
|
+
* native streams are significantly faster than the JS-implemented
|
|
7
|
+
* Web Streams. The Web `TransformStream` equivalents live in
|
|
8
|
+
* `html-injectors.ts` and wrap the same core — keep the two files
|
|
9
|
+
* byte-for-byte equivalent in behavior. If you fix a streaming bug
|
|
10
|
+
* here, it almost certainly belongs in the core (`html-injector-core.ts`),
|
|
11
|
+
* not in this wrapper.
|
|
11
12
|
*
|
|
12
13
|
* Architecture:
|
|
13
14
|
* renderToPipeableStream → pipe(errorHandler) → pipe(headInjector)
|
|
@@ -17,9 +18,7 @@
|
|
|
17
18
|
* Readable.toWeb() conversion for the Response body.
|
|
18
19
|
*/
|
|
19
20
|
import { Transform } from 'node:stream';
|
|
20
|
-
|
|
21
|
-
* Options for the Node.js buffered transform.
|
|
22
|
-
*/
|
|
21
|
+
import { SUFFIX_BYTES } from './html-injector-core.js';
|
|
23
22
|
export interface NodeBufferedTransformOptions {
|
|
24
23
|
/**
|
|
25
24
|
* Flush synchronously once the buffer reaches this many bytes.
|
|
@@ -29,67 +28,65 @@ export interface NodeBufferedTransformOptions {
|
|
|
29
28
|
readonly maxBufferByteLength?: number;
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
|
-
* Node.js Transform that buffers incoming chunks and coalesces them
|
|
31
|
+
* Node.js `Transform` that buffers incoming chunks and coalesces them
|
|
33
32
|
* within a single event loop tick.
|
|
34
33
|
*
|
|
35
|
-
* Equivalent to createBufferedTransformStream
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* could see chunk boundaries in the middle of HTML tags or attributes.
|
|
34
|
+
* Equivalent to `createBufferedTransformStream` in `html-injectors.ts` —
|
|
35
|
+
* the actual buffer math lives in `BufferAggregator`. This wrapper only
|
|
36
|
+
* owns the `setImmediate` scheduling and the push to the Node `Transform`.
|
|
39
37
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* **Not a polling loop.** Uses a single-shot `setImmediate` per flush
|
|
44
|
-
* cycle — no recursive scheduling, no busy-wait. See design/02 §"No Polling".
|
|
45
|
-
*
|
|
46
|
-
* Inspired by Next.js `createBufferedTransformStream`.
|
|
38
|
+
* **Not a polling loop.** Single-shot `setImmediate` per flush cycle —
|
|
39
|
+
* no recursive scheduling. See design/02 §"No Polling".
|
|
47
40
|
*/
|
|
48
41
|
export declare function createNodeBufferedTransform(options?: NodeBufferedTransformOptions): Transform;
|
|
49
42
|
/**
|
|
50
|
-
* Node.js Transform that moves `</body></html>` to the end of the stream.
|
|
43
|
+
* Node.js `Transform` that moves `</body></html>` to the end of the stream.
|
|
51
44
|
*
|
|
52
|
-
* Equivalent to createMoveSuffixStream
|
|
53
|
-
*
|
|
54
|
-
*
|
|
45
|
+
* Equivalent to `createMoveSuffixStream` in `html-injectors.ts`. Strips
|
|
46
|
+
* the suffix on first sight and re-emits it from `flush()`. If the
|
|
47
|
+
* suffix never appeared in the input, it is appended anyway so output
|
|
48
|
+
* is well-formed.
|
|
55
49
|
*/
|
|
56
50
|
export declare function createNodeMoveSuffixTransform(): Transform;
|
|
51
|
+
export { SUFFIX_BYTES };
|
|
57
52
|
/**
|
|
58
|
-
* Node.js Transform that injects HTML content before
|
|
53
|
+
* Node.js `Transform` that injects HTML content before `</head>`.
|
|
59
54
|
*
|
|
60
|
-
* Equivalent to injectHead
|
|
55
|
+
* Equivalent to `injectHead` in `html-injectors.ts`. Streams chunks
|
|
61
56
|
* through immediately, keeping only a small trailing buffer to handle
|
|
62
|
-
*
|
|
57
|
+
* `</head>` split across chunk boundaries.
|
|
63
58
|
*/
|
|
64
59
|
export declare function createNodeHeadInjector(headHtml: string): Transform;
|
|
65
|
-
/**
|
|
66
|
-
* Node.js Transform that merges RSC script tags into the HTML stream.
|
|
67
|
-
*
|
|
68
|
-
* Reads RSC chunks from the provided ReadableStream and injects them
|
|
69
|
-
* as `<script>` tags between HTML chunks. Scripts are buffered in
|
|
70
|
-
* pending[] and only drained from transform() (after a complete HTML
|
|
71
|
-
* chunk) or flush() — never pushed directly from the pull loop.
|
|
72
|
-
*
|
|
73
|
-
* Suffix stripping (</body></html>) is handled upstream by
|
|
74
|
-
* createNodeMoveSuffixTransform. This transform only interleaves
|
|
75
|
-
* RSC scripts at safe chunk boundaries.
|
|
76
|
-
*
|
|
77
|
-
* The RSC stream is a Web ReadableStream (from the tee'd RSC Flight
|
|
78
|
-
* stream). We read from it using the Web API — this is the one bridge
|
|
79
|
-
* point between Web Streams and Node.js streams in the pipeline.
|
|
80
|
-
*/
|
|
81
60
|
/**
|
|
82
61
|
* Options for the Node.js flight injector.
|
|
83
62
|
*/
|
|
84
63
|
export interface NodeFlightInjectorOptions {
|
|
85
64
|
/**
|
|
86
|
-
* Timeout in milliseconds for individual RSC stream reads.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
65
|
+
* Timeout in milliseconds for individual RSC stream reads. If a single
|
|
66
|
+
* `rscReader.read()` call does not resolve within this duration, the
|
|
67
|
+
* read is aborted and the stream errors with a `RenderTimeoutError`.
|
|
68
|
+
* Default: 30000 (30s).
|
|
90
69
|
*/
|
|
91
70
|
renderTimeoutMs?: number;
|
|
92
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Node.js `Transform` that merges RSC script tags into the HTML stream.
|
|
74
|
+
*
|
|
75
|
+
* Equivalent to `createFlightInjectionTransform` in `html-injectors.ts`.
|
|
76
|
+
* The state machine, pending queue, and pull loop all live in
|
|
77
|
+
* `FlightInjectorCore` — this wrapper only shuffles bytes between the
|
|
78
|
+
* core and the Node `Transform.push()` API.
|
|
79
|
+
*
|
|
80
|
+
* Suffix stripping (`</body></html>`) is handled upstream by
|
|
81
|
+
* `createNodeMoveSuffixTransform`. RSC scripts are buffered in
|
|
82
|
+
* `core.pending[]` and only drained from `transform()` (after a complete
|
|
83
|
+
* HTML chunk) or `flush()` — never mid-tag. See design/02
|
|
84
|
+
* §"Scripts at Chunk Boundaries Only".
|
|
85
|
+
*
|
|
86
|
+
* The RSC stream is a Web `ReadableStream` (from the tee'd RSC Flight
|
|
87
|
+
* stream). The core reads from it using the Web API — this is the one
|
|
88
|
+
* bridge point between Web Streams and Node.js streams in the pipeline.
|
|
89
|
+
*/
|
|
93
90
|
export declare function createNodeFlightInjector(rscStream: ReadableStream<Uint8Array> | undefined, options?: NodeFlightInjectorOptions): Transform;
|
|
94
91
|
/**
|
|
95
92
|
* Node.js Transform that catches post-shell streaming errors.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-stream-transforms.d.ts","sourceRoot":"","sources":["../../src/server/node-stream-transforms.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node-stream-transforms.d.ts","sourceRoot":"","sources":["../../src/server/node-stream-transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAGL,YAAY,EAOb,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,4BAAiC,GAAG,SAAS,CAsCjG;AAID;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,IAAI,SAAS,CAoBzD;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC;AAIxB;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CA2BlE;AAID;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,SAAS,EACjD,OAAO,CAAC,EAAE,yBAAyB,GAClC,SAAS,CA6DX;AAOD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAwBtE;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,OAAO,GACvB,SAAS,GAAG,IAAI,CA8BlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segment param coercion — runs the matched route's `params.ts` codecs
|
|
3
|
+
* over the raw matcher output before middleware and rendering.
|
|
4
|
+
*
|
|
5
|
+
* Lifted out of `pipeline-phases.ts` (TIM-853) so the coercer can be
|
|
6
|
+
* imported directly by other entry points (the action-dispatch wrapper,
|
|
7
|
+
* the revalidation renderer in `rsc-entry/index.ts`) without pulling
|
|
8
|
+
* the entire pipeline phase module along with it.
|
|
9
|
+
*
|
|
10
|
+
* The function throws `ParamCoercionError` from `route-element-builder.ts`
|
|
11
|
+
* on any codec failure; the pipeline catches that and dispatches to the
|
|
12
|
+
* 404 page. See design/07-routing.md §"Where Coercion Runs".
|
|
13
|
+
*/
|
|
14
|
+
import type { RouteMatch } from './pipeline.js';
|
|
15
|
+
/**
|
|
16
|
+
* Run segment param coercion on the matched route's segments.
|
|
17
|
+
*
|
|
18
|
+
* Loads params.ts modules from segments that have them, extracts the
|
|
19
|
+
* segmentParams definition, and coerces raw string params through codecs.
|
|
20
|
+
* Throws ParamCoercionError if any codec fails (→ 404).
|
|
21
|
+
*
|
|
22
|
+
* This runs BEFORE middleware, so ctx.segmentParams is already typed.
|
|
23
|
+
* See design/07-routing.md §"Where Coercion Runs"
|
|
24
|
+
*/
|
|
25
|
+
export declare function coerceSegmentParams(match: RouteMatch): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=param-coercion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param-coercion.d.ts","sourceRoot":"","sources":["../../src/server/param-coercion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C1E"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline helpers — small utility functions used by `pipeline.ts` and
|
|
3
|
+
* `pipeline-phases.ts`. Lifted out of `pipeline.ts` to keep that file
|
|
4
|
+
* focused on the request handler entry point.
|
|
5
|
+
*
|
|
6
|
+
* Each helper is intentionally a free function with no closure capture, so
|
|
7
|
+
* it can be unit-tested in isolation.
|
|
8
|
+
*
|
|
9
|
+
* See design/07-routing.md §"Request Lifecycle".
|
|
10
|
+
*/
|
|
11
|
+
import type { ProxyExport } from './proxy.js';
|
|
12
|
+
import { RedirectSignal } from './primitives.js';
|
|
13
|
+
import type { ProxyConfig } from './pipeline.js';
|
|
14
|
+
/**
|
|
15
|
+
* Deep-walk a value returned by a segment param codec, producing a
|
|
16
|
+
* sanitized copy where every plain object is null-prototype and
|
|
17
|
+
* dangerous keys (__proto__, constructor, prototype) are stripped at
|
|
18
|
+
* every depth.
|
|
19
|
+
*
|
|
20
|
+
* Non-plain objects (Date, Map, class instances, etc.) are returned
|
|
21
|
+
* as-is — they cannot be poisoned by `{...x}` spread and may carry
|
|
22
|
+
* author-intended prototype methods.
|
|
23
|
+
*
|
|
24
|
+
* Arrays are walked element-wise.
|
|
25
|
+
*
|
|
26
|
+
* Performance: URL params are bounded by URL length (~8 KB). Realistic
|
|
27
|
+
* trees are <1 KB. The recursive walk is sub-microsecond.
|
|
28
|
+
*
|
|
29
|
+
* See TIM-655, TIM-855, TIM-873, design/13-security.md
|
|
30
|
+
*/
|
|
31
|
+
export declare function sanitizeParamValue(value: unknown): unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Resolver closure produced once at pipeline construction. The lazy variant
|
|
34
|
+
* still calls `loader()` per-request (HMR relies on re-importing), but the
|
|
35
|
+
* choice of which branch to take is made once, not on every request.
|
|
36
|
+
*/
|
|
37
|
+
export type ProxyResolver = () => ProxyExport | Promise<ProxyExport>;
|
|
38
|
+
/**
|
|
39
|
+
* Build a proxy resolver closure from the declared source. Called exactly
|
|
40
|
+
* once at `createPipeline` setup time, so the hot path sees only the branch
|
|
41
|
+
* that corresponds to this pipeline's configured variant.
|
|
42
|
+
*
|
|
43
|
+
* Returns `null` when the app has no proxy.ts — the hot path short-circuits
|
|
44
|
+
* around `runProxyPhase` entirely in that case.
|
|
45
|
+
*
|
|
46
|
+
* Accepts the sugar form (a bare `ProxyExport` — function or function array)
|
|
47
|
+
* and normalises it to the static variant. Functions and arrays are
|
|
48
|
+
* structurally distinct from the tagged `{ kind: 'lazy', loader }` object,
|
|
49
|
+
* so discrimination is unambiguous.
|
|
50
|
+
*/
|
|
51
|
+
export declare function makeProxyResolver(proxy: ProxyConfig | ProxyExport | undefined): ProxyResolver | null;
|
|
52
|
+
/**
|
|
53
|
+
* Apply all Set-Cookie headers from the cookie jar to a Headers object.
|
|
54
|
+
* Each cookie gets its own Set-Cookie header per RFC 6265 §4.1.
|
|
55
|
+
*/
|
|
56
|
+
export declare function applyCookieJar(headers: Headers): void;
|
|
57
|
+
/**
|
|
58
|
+
* Merge framework-managed response headers onto a terminal response without
|
|
59
|
+
* overwriting headers the terminal response already set itself.
|
|
60
|
+
*/
|
|
61
|
+
export declare function mergeMissingHeaders(target: Headers, source: Headers): void;
|
|
62
|
+
/**
|
|
63
|
+
* Clone a Response into a fresh one whose header bag is guaranteed mutable.
|
|
64
|
+
*
|
|
65
|
+
* `Response.redirect()` and some platform-level passthrough responses (notably
|
|
66
|
+
* on Cloudflare Workers) return objects with frozen header bags. Calling
|
|
67
|
+
* `.set()` or `.append()` on them throws `TypeError: immutable`, which the
|
|
68
|
+
* pipeline can hit when it appends Set-Cookie or Server-Timing entries.
|
|
69
|
+
*
|
|
70
|
+
* The pipeline calls this at the producer sites where user-controlled
|
|
71
|
+
* responses enter the framework — `outcomeToResponse` for all phase outcomes,
|
|
72
|
+
* and `handleRequest` for metadata-route and auto-sitemap user handlers — so
|
|
73
|
+
* downstream code can write headers without runtime feature-detection.
|
|
74
|
+
*
|
|
75
|
+
* The clone is unconditional. This is a deliberate trade: we avoid a
|
|
76
|
+
* try/catch + thrown `TypeError` on every request (the previous probe-based
|
|
77
|
+
* approach paid that cost on the hot path) and accept one cheap Response
|
|
78
|
+
* rewrap at the framework boundary instead.
|
|
79
|
+
*/
|
|
80
|
+
export declare function cloneWithMutableHeaders(response: Response): Response;
|
|
81
|
+
/**
|
|
82
|
+
* Build a redirect Response from a RedirectSignal.
|
|
83
|
+
*
|
|
84
|
+
* For RSC payload requests (client navigation), returns 204 + X-Timber-Redirect
|
|
85
|
+
* so the client router can perform a soft SPA redirect. A raw 302 would be
|
|
86
|
+
* turned into an opaque redirect by fetch({redirect:'manual'}), crashing
|
|
87
|
+
* createFromFetch. See design/19-client-navigation.md.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildRedirectResponse(signal: RedirectSignal, req: Request, headers: Headers): Response;
|
|
90
|
+
/**
|
|
91
|
+
* Fire the user's onRequestError hook with request context.
|
|
92
|
+
* Extracts request info from the Request object and calls the instrumentation hook.
|
|
93
|
+
*/
|
|
94
|
+
export declare function fireOnRequestError(error: unknown, req: Request, phase: 'proxy' | 'handler' | 'render' | 'action' | 'route'): Promise<void>;
|
|
95
|
+
//# sourceMappingURL=pipeline-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAWjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmB1D;AAID;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErE;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,GAC3C,aAAa,GAAG,IAAI,CAatB;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAO1E;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAMpE;AAID;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACf,QAAQ,CAQV;AAID;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GACzD,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline outcome translator — converts a `PhaseOutcome` (the value
|
|
3
|
+
* each phase function returns) into a final `Response`.
|
|
4
|
+
*
|
|
5
|
+
* Lifted out of `pipeline-phases.ts` (TIM-853) so the per-phase try /
|
|
6
|
+
* catch logic and the terminal Response-building logic each live in
|
|
7
|
+
* their own file. The phases produce values; this module is the single
|
|
8
|
+
* source of truth for how those values become wire responses.
|
|
9
|
+
*
|
|
10
|
+
* See design/07-routing.md §"Request Lifecycle".
|
|
11
|
+
*/
|
|
12
|
+
import { RedirectSignal, DenySignal } from './primitives.js';
|
|
13
|
+
import type { PipelineConfig, RouteMatch } from './pipeline.js';
|
|
14
|
+
export type PhaseName = 'proxy' | 'middleware' | 'render';
|
|
15
|
+
export type PhaseOutcome = {
|
|
16
|
+
kind: 'response';
|
|
17
|
+
phase: PhaseName;
|
|
18
|
+
response: Response;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'redirect';
|
|
21
|
+
phase: PhaseName;
|
|
22
|
+
signal: RedirectSignal;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'deny';
|
|
25
|
+
phase: PhaseName;
|
|
26
|
+
signal: DenySignal;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'error';
|
|
29
|
+
phase: PhaseName;
|
|
30
|
+
error: unknown;
|
|
31
|
+
};
|
|
32
|
+
export interface OutcomeContext {
|
|
33
|
+
req: Request;
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
responseHeaders?: Headers;
|
|
37
|
+
match?: RouteMatch;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Terminal outcome handler — converts a `PhaseOutcome` into a final
|
|
41
|
+
* `Response`, applying cookies, building redirects, rendering deny pages
|
|
42
|
+
* and fallback error pages, and firing instrumentation hooks.
|
|
43
|
+
*
|
|
44
|
+
* This is the single source of truth for how phase outputs become wire
|
|
45
|
+
* responses; the per-phase try/catch blocks now produce values, not
|
|
46
|
+
* Responses, so the conversion logic lives in exactly one place.
|
|
47
|
+
*/
|
|
48
|
+
export declare function outcomeToResponse(config: PipelineConfig, outcome: PhaseOutcome, ctx: OutcomeContext): Promise<Response>;
|
|
49
|
+
//# sourceMappingURL=pipeline-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-outcome.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAID;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,QAAQ,CAAC,CAwGnB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline phase functions — module-level free functions that take their
|
|
3
|
+
* dependencies as explicit parameters. Each phase returns a `PhaseOutcome`
|
|
4
|
+
* (a discriminated union over response / redirect / deny / error) defined
|
|
5
|
+
* in `pipeline-outcome.ts`. The terminal `outcomeToResponse` (also in
|
|
6
|
+
* `pipeline-outcome.ts`) translates outcomes into Responses.
|
|
7
|
+
*
|
|
8
|
+
* Lifted out of `createPipeline` so each phase can be unit-tested in
|
|
9
|
+
* isolation. The lift is mechanical — these functions used to be closures
|
|
10
|
+
* over `config`; they now take `config` as an explicit parameter.
|
|
11
|
+
*
|
|
12
|
+
* See design/07-routing.md §"Request Lifecycle", design/02-rendering-pipeline.md §"Request Flow".
|
|
13
|
+
*/
|
|
14
|
+
import { type ProxyResolver } from './pipeline-helpers.js';
|
|
15
|
+
import { type PhaseOutcome } from './pipeline-outcome.js';
|
|
16
|
+
import type { InterceptionContext, PipelineConfig, RouteMatch } from './pipeline.js';
|
|
17
|
+
interface RenderContext {
|
|
18
|
+
canonicalPathname: string;
|
|
19
|
+
interception?: InterceptionContext;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run the proxy.ts phase. Calls user proxy code and uses `handleRequest` as
|
|
23
|
+
* the inner `next()` continuation. The proxy resolver was picked at pipeline
|
|
24
|
+
* construction time so the hot path sees no per-request branching on the
|
|
25
|
+
* `ProxyConfig` discriminant.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runProxyPhase(config: PipelineConfig, getProxy: ProxyResolver, req: Request, method: string, path: string): Promise<PhaseOutcome>;
|
|
28
|
+
/**
|
|
29
|
+
* Run the middleware chain phase. If the chain short-circuits with a Response,
|
|
30
|
+
* returns it as a 'response' outcome. Otherwise applies the request header
|
|
31
|
+
* overlay and falls through to the render phase.
|
|
32
|
+
*/
|
|
33
|
+
export declare function runMiddlewarePhase(config: PipelineConfig, req: Request, match: RouteMatch, responseHeaders: Headers, requestHeaderOverlay: Headers, renderContext: RenderContext): Promise<PhaseOutcome>;
|
|
34
|
+
/**
|
|
35
|
+
* Run the render phase. Wraps the configured renderer in a span and a
|
|
36
|
+
* timing scope, and translates thrown signals into outcome variants.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runRenderPhase(config: PipelineConfig, req: Request, match: RouteMatch, responseHeaders: Headers, requestHeaderOverlay: Headers, { canonicalPathname, interception }: RenderContext): Promise<PhaseOutcome>;
|
|
39
|
+
/**
|
|
40
|
+
* Process a single request from canonicalization through phase dispatch.
|
|
41
|
+
*
|
|
42
|
+
* Stages: canonicalize → metadata routes → auto-sitemap → version skew →
|
|
43
|
+
* route match → interception → early hints → param coercion → middleware →
|
|
44
|
+
* render → outcome translation. Pre-routing short-circuits return Responses
|
|
45
|
+
* directly; post-match dispatch goes through `outcomeToResponse`.
|
|
46
|
+
*
|
|
47
|
+
* Used both as the top-level entry (when no proxy.ts is configured) and as
|
|
48
|
+
* the `next()` continuation passed to `runProxy()`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function handleRequest(config: PipelineConfig, req: Request, method: string, path: string): Promise<Response>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=pipeline-phases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-phases.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmBH,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEpG,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIrF,UAAU,aAAa;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAID;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC,CAavB;AAID;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,oBAAoB,EAAE,OAAO,EAC7B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,YAAY,CAAC,CA6DvB;AAID;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,oBAAoB,EAAE,OAAO,EAC7B,EAAE,iBAAiB,EAAE,YAAY,EAAE,EAAE,aAAa,GACjD,OAAO,CAAC,YAAY,CAAC,CAkBvB;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CAgNnB"}
|
|
@@ -4,30 +4,32 @@
|
|
|
4
4
|
* Pipeline stages (in order):
|
|
5
5
|
* proxy.ts → canonicalize → route match → 103 Early Hints → middleware.ts → render
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* The phase functions live in `pipeline-phases.ts` so each phase can be
|
|
8
|
+
* tested in isolation. The terminal `outcomeToResponse` translator and
|
|
9
|
+
* stateless helpers live in `pipeline-phases.ts` and `pipeline-helpers.ts`
|
|
10
|
+
* respectively. This file owns only the public type surface and the
|
|
11
|
+
* `createPipeline` entry point: trace ID setup, request-context ALS,
|
|
12
|
+
* Server-Timing wrapping, and the activeRequests counter.
|
|
9
13
|
*
|
|
10
14
|
* See design/07-routing.md §"Request Lifecycle", design/02-rendering-pipeline.md §"Request Flow",
|
|
11
15
|
* and design/17-logging.md §"Production Logging"
|
|
12
16
|
*/
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
17
|
+
import type { ProxyExport } from './proxy.js';
|
|
18
|
+
import type { MiddlewareFn } from './middleware-runner.js';
|
|
15
19
|
import { DenySignal } from './primitives.js';
|
|
16
|
-
import type {
|
|
20
|
+
import type { ManifestSegmentNode } from './route-matcher.js';
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Result of matching a canonical pathname against the route tree.
|
|
19
23
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* `segments` is the runtime (`ManifestFile`-specialized) shape — the same
|
|
25
|
+
* nodes carried in the virtual route manifest. TIM-863 unified this: the
|
|
26
|
+
* matcher produces `ManifestSegmentNode[]` directly and every consumer
|
|
27
|
+
* (render, slots, params coercion, early hints, deny fallback) sees the
|
|
28
|
+
* same structural type with no `as unknown as` laundering.
|
|
25
29
|
*/
|
|
26
|
-
export declare function safeMerge(target: Record<string, unknown>, source: Record<string, unknown>): void;
|
|
27
|
-
/** Result of matching a canonical pathname against the route tree. */
|
|
28
30
|
export interface RouteMatch {
|
|
29
31
|
/** The matched segment chain from root to leaf. */
|
|
30
|
-
segments:
|
|
32
|
+
segments: ManifestSegmentNode[];
|
|
31
33
|
/** Extracted segment params (catch-all segments produce string[]). */
|
|
32
34
|
segmentParams: Record<string, string | string[]>;
|
|
33
35
|
/** Middleware chain from the segment tree, ordered root-to-leaf. */
|
|
@@ -46,13 +48,37 @@ export interface InterceptionContext {
|
|
|
46
48
|
export type RouteRenderer = (req: Request, match: RouteMatch, responseHeaders: Headers, requestHeaderOverlay: Headers, interception?: InterceptionContext) => Response | Promise<Response>;
|
|
47
49
|
/** Function that sends 103 Early Hints for a matched route. */
|
|
48
50
|
export type EarlyHintsEmitter = (match: RouteMatch, req: Request, responseHeaders: Headers) => void | Promise<void>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Proxy source — a tagged union so the choice between "already-resolved
|
|
53
|
+
* export" and "lazy HMR-friendly loader" is encoded in the type, not
|
|
54
|
+
* inferred per-request.
|
|
55
|
+
*
|
|
56
|
+
* - `static` — the proxy export is already resolved (production, tests).
|
|
57
|
+
* - `lazy` — a loader is called per-request for HMR freshness (dev).
|
|
58
|
+
*
|
|
59
|
+
* `PipelineConfig.proxy` also accepts a bare `ProxyExport` (a function or
|
|
60
|
+
* function array) as shorthand for the static variant — convenient for tests
|
|
61
|
+
* that construct a `createPipeline` config inline. Omit the field entirely
|
|
62
|
+
* when the app has no `proxy.ts`.
|
|
63
|
+
*
|
|
64
|
+
* See design/07-routing.md §"proxy.ts — Global Middleware".
|
|
65
|
+
*/
|
|
66
|
+
export type ProxyConfig = {
|
|
67
|
+
kind: 'static';
|
|
68
|
+
export: ProxyExport;
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'lazy';
|
|
71
|
+
loader: () => Promise<{
|
|
54
72
|
default: ProxyExport;
|
|
55
73
|
}>;
|
|
74
|
+
};
|
|
75
|
+
export interface PipelineConfig {
|
|
76
|
+
/**
|
|
77
|
+
* proxy.ts source. Undefined if the app has no proxy.ts. Accepts either a
|
|
78
|
+
* tagged `ProxyConfig` (canonical) or a bare `ProxyExport` as sugar for the
|
|
79
|
+
* static variant.
|
|
80
|
+
*/
|
|
81
|
+
proxy?: ProxyConfig | ProxyExport;
|
|
56
82
|
/** Route matcher — resolves a canonical pathname to a RouteMatch. */
|
|
57
83
|
matchRoute: RouteMatcher;
|
|
58
84
|
/** Metadata route matcher — resolves metadata route pathnames (sitemap.xml, robots.txt, etc.) */
|
|
@@ -130,22 +156,15 @@ export interface PipelineConfig {
|
|
|
130
156
|
*/
|
|
131
157
|
match?: RouteMatch) => Response | Promise<Response>;
|
|
132
158
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Run segment param coercion on the matched route's segments.
|
|
135
|
-
*
|
|
136
|
-
* Loads params.ts modules from segments that have them, extracts the
|
|
137
|
-
* segmentParams definition, and coerces raw string params through codecs.
|
|
138
|
-
* Throws ParamCoercionError if any codec fails (→ 404).
|
|
139
|
-
*
|
|
140
|
-
* This runs BEFORE middleware, so ctx.segmentParams is already typed.
|
|
141
|
-
* See design/07-routing.md §"Where Coercion Runs"
|
|
142
|
-
*/
|
|
143
|
-
export declare function coerceSegmentParams(match: RouteMatch): Promise<void>;
|
|
144
159
|
/**
|
|
145
160
|
* Create the request handler from a pipeline configuration.
|
|
146
161
|
*
|
|
147
|
-
* Returns a function that processes an incoming Request through all pipeline
|
|
148
|
-
* and produces a Response. This is the top-level entry point for the
|
|
162
|
+
* Returns a function that processes an incoming Request through all pipeline
|
|
163
|
+
* stages and produces a Response. This is the top-level entry point for the
|
|
164
|
+
* server. The body is intentionally small — phase logic lives in
|
|
165
|
+
* `pipeline-phases.ts`. This function only owns the per-request setup that
|
|
166
|
+
* has to wrap the entire dispatch: trace ID, request context ALS, span
|
|
167
|
+
* scope, Server-Timing header emission, and the active-request counter.
|
|
149
168
|
*/
|
|
150
169
|
export declare function createPipeline(config: PipelineConfig): (req: Request) => Promise<Response>;
|
|
151
170
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/server/pipeline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/server/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAY3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAO9D;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU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