vinext 0.0.30 → 0.0.31
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/README.md +12 -6
- package/dist/build/prerender.d.ts +188 -0
- package/dist/build/prerender.js +675 -0
- package/dist/build/prerender.js.map +1 -0
- package/dist/build/report.d.ts +45 -46
- package/dist/build/report.js +247 -276
- package/dist/build/report.js.map +1 -1
- package/dist/build/run-prerender.d.ts +62 -0
- package/dist/build/run-prerender.js +183 -0
- package/dist/build/run-prerender.js.map +1 -0
- package/dist/build/server-manifest.d.ts +19 -0
- package/dist/build/server-manifest.js +29 -0
- package/dist/build/server-manifest.js.map +1 -0
- package/dist/build/static-export.d.ts +51 -66
- package/dist/build/static-export.js +51 -545
- package/dist/build/static-export.js.map +1 -1
- package/dist/check.d.ts +26 -24
- package/dist/check.js +591 -571
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +1 -15
- package/dist/cli.js +430 -491
- package/dist/cli.js.map +1 -1
- package/dist/client/entry.d.ts +1 -2
- package/dist/client/entry.js +49 -62
- package/dist/client/entry.js.map +1 -1
- package/dist/client/validate-module-path.d.ts +4 -1
- package/dist/client/validate-module-path.js +23 -28
- package/dist/client/validate-module-path.js.map +1 -1
- package/dist/client/vinext-next-data.d.ts +15 -20
- package/dist/client/vinext-next-data.js +0 -1
- package/dist/cloudflare/index.d.ts +3 -8
- package/dist/cloudflare/index.js +3 -8
- package/dist/cloudflare/kv-cache-handler.d.ts +95 -105
- package/dist/cloudflare/kv-cache-handler.js +354 -380
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/cloudflare/tpr.d.ts +36 -34
- package/dist/cloudflare/tpr.js +460 -603
- package/dist/cloudflare/tpr.js.map +1 -1
- package/dist/config/config-matchers.d.ts +31 -40
- package/dist/config/config-matchers.js +727 -936
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/dotenv.d.ts +18 -11
- package/dist/config/dotenv.js +79 -84
- package/dist/config/dotenv.js.map +1 -1
- package/dist/config/next-config.d.ts +156 -146
- package/dist/config/next-config.js +374 -464
- package/dist/config/next-config.js.map +1 -1
- package/dist/deploy.d.ts +87 -96
- package/dist/deploy.js +490 -628
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-browser-entry.d.ts +4 -1
- package/dist/entries/app-browser-entry.js +12 -8
- package/dist/entries/app-browser-entry.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +33 -20
- package/dist/entries/app-rsc-entry.js +442 -211
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-ssr-entry.d.ts +9 -1
- package/dist/entries/app-ssr-entry.js +61 -28
- package/dist/entries/app-ssr-entry.js.map +1 -1
- package/dist/entries/pages-client-entry.d.ts +6 -2
- package/dist/entries/pages-client-entry.js +30 -33
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-entry-helpers.d.ts +5 -1
- package/dist/entries/pages-entry-helpers.js +17 -14
- package/dist/entries/pages-entry-helpers.js.map +1 -1
- package/dist/entries/pages-server-entry.d.ts +6 -2
- package/dist/entries/pages-server-entry.js +84 -113
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/index.d.ts +82 -62
- package/dist/index.js +2172 -3133
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +40 -37
- package/dist/init.js +201 -258
- package/dist/init.js.map +1 -1
- package/dist/plugins/async-hooks-stub.d.ts +7 -3
- package/dist/plugins/async-hooks-stub.js +39 -42
- package/dist/plugins/async-hooks-stub.js.map +1 -1
- package/dist/plugins/client-reference-dedup.d.ts +7 -3
- package/dist/plugins/client-reference-dedup.js +63 -88
- package/dist/plugins/client-reference-dedup.js.map +1 -1
- package/dist/routing/app-router.d.ts +100 -96
- package/dist/routing/app-router.js +560 -670
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.d.ts +18 -15
- package/dist/routing/file-matcher.js +65 -65
- package/dist/routing/file-matcher.js.map +1 -1
- package/dist/routing/pages-router.d.ts +23 -24
- package/dist/routing/pages-router.js +147 -172
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/route-trie.d.ts +23 -20
- package/dist/routing/route-trie.js +131 -151
- package/dist/routing/route-trie.js.map +1 -1
- package/dist/routing/route-validation.d.ts +5 -2
- package/dist/routing/route-validation.js +98 -130
- package/dist/routing/route-validation.js.map +1 -1
- package/dist/routing/utils.d.ts +10 -7
- package/dist/routing/utils.js +75 -111
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/api-handler.d.ts +8 -13
- package/dist/server/api-handler.js +161 -193
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-router-entry.d.ts +6 -16
- package/dist/server/app-router-entry.js +26 -54
- package/dist/server/app-router-entry.js.map +1 -1
- package/dist/server/dev-module-runner.d.ts +11 -64
- package/dist/server/dev-module-runner.js +89 -101
- package/dist/server/dev-module-runner.js.map +1 -1
- package/dist/server/dev-origin-check.d.ts +12 -10
- package/dist/server/dev-origin-check.js +98 -108
- package/dist/server/dev-origin-check.js.map +1 -1
- package/dist/server/dev-server.d.ts +17 -14
- package/dist/server/dev-server.js +542 -869
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/html.d.ts +4 -1
- package/dist/server/html.js +25 -26
- package/dist/server/html.js.map +1 -1
- package/dist/server/image-optimization.d.ts +31 -28
- package/dist/server/image-optimization.js +181 -210
- package/dist/server/image-optimization.js.map +1 -1
- package/dist/server/instrumentation.d.ts +25 -22
- package/dist/server/instrumentation.js +110 -122
- package/dist/server/instrumentation.js.map +1 -1
- package/dist/server/isr-cache.d.ts +16 -26
- package/dist/server/isr-cache.js +106 -128
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/metadata-routes.d.ts +85 -88
- package/dist/server/metadata-routes.js +270 -317
- package/dist/server/metadata-routes.js.map +1 -1
- package/dist/server/middleware-codegen.d.ts +7 -4
- package/dist/server/middleware-codegen.js +61 -61
- package/dist/server/middleware-codegen.js.map +1 -1
- package/dist/server/middleware-request-headers.d.ts +8 -6
- package/dist/server/middleware-request-headers.js +47 -65
- package/dist/server/middleware-request-headers.js.map +1 -1
- package/dist/server/middleware.d.ts +31 -47
- package/dist/server/middleware.js +273 -404
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/normalize-path.d.ts +4 -1
- package/dist/server/normalize-path.js +33 -47
- package/dist/server/normalize-path.js.map +1 -1
- package/dist/server/pages-i18n.d.ts +38 -30
- package/dist/server/pages-i18n.js +112 -139
- package/dist/server/pages-i18n.js.map +1 -1
- package/dist/server/prod-server.d.ts +19 -31
- package/dist/server/prod-server.js +714 -945
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-log.d.ts +18 -12
- package/dist/server/request-log.js +45 -52
- package/dist/server/request-log.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +9 -17
- package/dist/server/request-pipeline.js +133 -184
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/server/worker-utils.d.ts +4 -1
- package/dist/server/worker-utils.js +31 -37
- package/dist/server/worker-utils.js.map +1 -1
- package/dist/shims/amp.d.ts +5 -2
- package/dist/shims/amp.js +19 -15
- package/dist/shims/amp.js.map +1 -1
- package/dist/shims/app.d.ts +8 -10
- package/dist/shims/app.js +0 -1
- package/dist/shims/cache-runtime.d.ts +20 -45
- package/dist/shims/cache-runtime.js +271 -422
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +130 -121
- package/dist/shims/cache.js +339 -427
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/client-only.d.ts +1 -18
- package/dist/shims/client-only.js +0 -17
- package/dist/shims/compat-router.d.ts +4 -1
- package/dist/shims/compat-router.js +23 -19
- package/dist/shims/compat-router.js.map +1 -1
- package/dist/shims/config.d.ts +7 -5
- package/dist/shims/config.js +16 -23
- package/dist/shims/config.js.map +1 -1
- package/dist/shims/constants.d.ts +119 -118
- package/dist/shims/constants.js +159 -164
- package/dist/shims/constants.js.map +1 -1
- package/dist/shims/document.d.ts +20 -16
- package/dist/shims/document.js +41 -22
- package/dist/shims/document.js.map +1 -1
- package/dist/shims/dynamic.d.ts +13 -22
- package/dist/shims/dynamic.js +122 -136
- package/dist/shims/dynamic.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +22 -15
- package/dist/shims/error-boundary.js +81 -79
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/error.d.ts +11 -12
- package/dist/shims/error.js +35 -39
- package/dist/shims/error.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +16 -14
- package/dist/shims/fetch-cache.js +437 -645
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/font-google-base.d.ts +28 -26
- package/dist/shims/font-google-base.js +238 -325
- package/dist/shims/font-google-base.js.map +1 -1
- package/dist/shims/font-google.d.ts +3 -3
- package/dist/shims/font-google.generated.d.ts +1928 -1924
- package/dist/shims/font-google.generated.js +1928 -2133
- package/dist/shims/font-google.generated.js.map +1 -1
- package/dist/shims/font-google.js +3 -3
- package/dist/shims/font-local.d.ts +28 -26
- package/dist/shims/font-local.js +204 -260
- package/dist/shims/font-local.js.map +1 -1
- package/dist/shims/form.d.ts +13 -27
- package/dist/shims/form.js +128 -180
- package/dist/shims/form.js.map +1 -1
- package/dist/shims/head-state.d.ts +8 -13
- package/dist/shims/head-state.js +25 -42
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/head.d.ts +16 -20
- package/dist/shims/head.js +172 -250
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/headers.d.ts +84 -78
- package/dist/shims/headers.js +447 -575
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/i18n-context.d.ts +16 -20
- package/dist/shims/i18n-context.js +35 -48
- package/dist/shims/i18n-context.js.map +1 -1
- package/dist/shims/i18n-state.d.ts +8 -14
- package/dist/shims/i18n-state.js +34 -42
- package/dist/shims/i18n-state.js.map +1 -1
- package/dist/shims/image-config.d.ts +11 -8
- package/dist/shims/image-config.js +50 -83
- package/dist/shims/image-config.js.map +1 -1
- package/dist/shims/image.d.ts +37 -46
- package/dist/shims/image.js +283 -308
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/api-utils.d.ts +7 -4
- package/dist/shims/internal/api-utils.js +0 -6
- package/dist/shims/internal/app-router-context.d.ts +22 -17
- package/dist/shims/internal/app-router-context.js +17 -13
- package/dist/shims/internal/app-router-context.js.map +1 -1
- package/dist/shims/internal/cookies.d.ts +2 -9
- package/dist/shims/internal/cookies.js +2 -9
- package/dist/shims/internal/parse-cookie-header.d.ts +4 -1
- package/dist/shims/internal/parse-cookie-header.js +29 -29
- package/dist/shims/internal/parse-cookie-header.js.map +1 -1
- package/dist/shims/internal/router-context.d.ts +6 -1
- package/dist/shims/internal/router-context.js +11 -7
- package/dist/shims/internal/router-context.js.map +1 -1
- package/dist/shims/internal/utils.d.ts +40 -37
- package/dist/shims/internal/utils.js +24 -30
- package/dist/shims/internal/utils.js.map +1 -1
- package/dist/shims/internal/work-unit-async-storage.d.ts +6 -10
- package/dist/shims/internal/work-unit-async-storage.js +14 -11
- package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
- package/dist/shims/layout-segment-context.d.ts +11 -14
- package/dist/shims/layout-segment-context.js +24 -23
- package/dist/shims/layout-segment-context.js.map +1 -1
- package/dist/shims/legacy-image.d.ts +39 -46
- package/dist/shims/legacy-image.js +47 -42
- package/dist/shims/legacy-image.js.map +1 -1
- package/dist/shims/link.d.ts +32 -36
- package/dist/shims/link.js +255 -391
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +210 -202
- package/dist/shims/metadata.js +545 -546
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation-state.d.ts +10 -18
- package/dist/shims/navigation-state.js +66 -74
- package/dist/shims/navigation-state.js.map +1 -1
- package/dist/shims/navigation.d.ts +59 -63
- package/dist/shims/navigation.js +505 -704
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/og.d.ts +2 -20
- package/dist/shims/og.js +2 -19
- package/dist/shims/readonly-url-search-params.d.ts +8 -5
- package/dist/shims/readonly-url-search-params.js +26 -22
- package/dist/shims/readonly-url-search-params.js.map +1 -1
- package/dist/shims/request-context.d.ts +8 -5
- package/dist/shims/request-context.js +50 -60
- package/dist/shims/request-context.js.map +1 -1
- package/dist/shims/request-state-types.d.ts +11 -11
- package/dist/shims/request-state-types.js +0 -1
- package/dist/shims/router-state.d.ts +13 -10
- package/dist/shims/router-state.js +34 -43
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.d.ts +81 -85
- package/dist/shims/router.js +506 -628
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script.d.ts +39 -48
- package/dist/shims/script.js +107 -160
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server-only.d.ts +1 -19
- package/dist/shims/server-only.js +0 -18
- package/dist/shims/server.d.ts +175 -164
- package/dist/shims/server.js +462 -478
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +20 -20
- package/dist/shims/unified-request-context.js +81 -99
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/url-safety.d.ts +4 -1
- package/dist/shims/url-safety.js +15 -11
- package/dist/shims/url-safety.js.map +1 -1
- package/dist/shims/url-utils.d.ts +8 -5
- package/dist/shims/url-utils.js +62 -93
- package/dist/shims/url-utils.js.map +1 -1
- package/dist/shims/web-vitals.d.ts +10 -8
- package/dist/shims/web-vitals.js +9 -15
- package/dist/shims/web-vitals.js.map +1 -1
- package/dist/utils/base-path.d.ts +5 -2
- package/dist/utils/base-path.js +21 -19
- package/dist/utils/base-path.js.map +1 -1
- package/dist/utils/domain-locale.d.ts +17 -9
- package/dist/utils/domain-locale.js +36 -56
- package/dist/utils/domain-locale.js.map +1 -1
- package/dist/utils/hash.d.ts +4 -1
- package/dist/utils/hash.js +19 -17
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/manifest-paths.d.ts +6 -3
- package/dist/utils/manifest-paths.js +15 -16
- package/dist/utils/manifest-paths.js.map +1 -1
- package/dist/utils/project.d.ts +13 -11
- package/dist/utils/project.js +169 -216
- package/dist/utils/project.js.map +1 -1
- package/dist/utils/query.d.ts +8 -6
- package/dist/utils/query.js +57 -67
- package/dist/utils/query.js.map +1 -1
- package/package.json +10 -9
- package/dist/build/report.d.ts.map +0 -1
- package/dist/build/static-export.d.ts.map +0 -1
- package/dist/check.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/client/entry.d.ts.map +0 -1
- package/dist/client/validate-module-path.d.ts.map +0 -1
- package/dist/client/vinext-next-data.d.ts.map +0 -1
- package/dist/client/vinext-next-data.js.map +0 -1
- package/dist/cloudflare/index.d.ts.map +0 -1
- package/dist/cloudflare/index.js.map +0 -1
- package/dist/cloudflare/kv-cache-handler.d.ts.map +0 -1
- package/dist/cloudflare/tpr.d.ts.map +0 -1
- package/dist/config/config-matchers.d.ts.map +0 -1
- package/dist/config/dotenv.d.ts.map +0 -1
- package/dist/config/next-config.d.ts.map +0 -1
- package/dist/deploy.d.ts.map +0 -1
- package/dist/entries/app-browser-entry.d.ts.map +0 -1
- package/dist/entries/app-rsc-entry.d.ts.map +0 -1
- package/dist/entries/app-ssr-entry.d.ts.map +0 -1
- package/dist/entries/pages-client-entry.d.ts.map +0 -1
- package/dist/entries/pages-entry-helpers.d.ts.map +0 -1
- package/dist/entries/pages-server-entry.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init.d.ts.map +0 -1
- package/dist/plugins/async-hooks-stub.d.ts.map +0 -1
- package/dist/plugins/client-reference-dedup.d.ts.map +0 -1
- package/dist/routing/app-router.d.ts.map +0 -1
- package/dist/routing/file-matcher.d.ts.map +0 -1
- package/dist/routing/pages-router.d.ts.map +0 -1
- package/dist/routing/route-trie.d.ts.map +0 -1
- package/dist/routing/route-validation.d.ts.map +0 -1
- package/dist/routing/utils.d.ts.map +0 -1
- package/dist/server/api-handler.d.ts.map +0 -1
- package/dist/server/app-router-entry.d.ts.map +0 -1
- package/dist/server/dev-module-runner.d.ts.map +0 -1
- package/dist/server/dev-origin-check.d.ts.map +0 -1
- package/dist/server/dev-server.d.ts.map +0 -1
- package/dist/server/html.d.ts.map +0 -1
- package/dist/server/image-optimization.d.ts.map +0 -1
- package/dist/server/instrumentation.d.ts.map +0 -1
- package/dist/server/isr-cache.d.ts.map +0 -1
- package/dist/server/metadata-routes.d.ts.map +0 -1
- package/dist/server/middleware-codegen.d.ts.map +0 -1
- package/dist/server/middleware-request-headers.d.ts.map +0 -1
- package/dist/server/middleware.d.ts.map +0 -1
- package/dist/server/normalize-path.d.ts.map +0 -1
- package/dist/server/pages-i18n.d.ts.map +0 -1
- package/dist/server/prod-server.d.ts.map +0 -1
- package/dist/server/request-log.d.ts.map +0 -1
- package/dist/server/request-pipeline.d.ts.map +0 -1
- package/dist/server/worker-utils.d.ts.map +0 -1
- package/dist/shims/amp.d.ts.map +0 -1
- package/dist/shims/app.d.ts.map +0 -1
- package/dist/shims/app.js.map +0 -1
- package/dist/shims/cache-runtime.d.ts.map +0 -1
- package/dist/shims/cache.d.ts.map +0 -1
- package/dist/shims/client-only.d.ts.map +0 -1
- package/dist/shims/client-only.js.map +0 -1
- package/dist/shims/compat-router.d.ts.map +0 -1
- package/dist/shims/config.d.ts.map +0 -1
- package/dist/shims/constants.d.ts.map +0 -1
- package/dist/shims/document.d.ts.map +0 -1
- package/dist/shims/dynamic.d.ts.map +0 -1
- package/dist/shims/error-boundary.d.ts.map +0 -1
- package/dist/shims/error.d.ts.map +0 -1
- package/dist/shims/fetch-cache.d.ts.map +0 -1
- package/dist/shims/font-google-base.d.ts.map +0 -1
- package/dist/shims/font-google.d.ts.map +0 -1
- package/dist/shims/font-google.generated.d.ts.map +0 -1
- package/dist/shims/font-google.js.map +0 -1
- package/dist/shims/font-local.d.ts.map +0 -1
- package/dist/shims/form.d.ts.map +0 -1
- package/dist/shims/head-state.d.ts.map +0 -1
- package/dist/shims/head.d.ts.map +0 -1
- package/dist/shims/headers.d.ts.map +0 -1
- package/dist/shims/i18n-context.d.ts.map +0 -1
- package/dist/shims/i18n-state.d.ts.map +0 -1
- package/dist/shims/image-config.d.ts.map +0 -1
- package/dist/shims/image.d.ts.map +0 -1
- package/dist/shims/internal/api-utils.d.ts.map +0 -1
- package/dist/shims/internal/api-utils.js.map +0 -1
- package/dist/shims/internal/app-router-context.d.ts.map +0 -1
- package/dist/shims/internal/cookies.d.ts.map +0 -1
- package/dist/shims/internal/cookies.js.map +0 -1
- package/dist/shims/internal/parse-cookie-header.d.ts.map +0 -1
- package/dist/shims/internal/router-context.d.ts.map +0 -1
- package/dist/shims/internal/utils.d.ts.map +0 -1
- package/dist/shims/internal/work-unit-async-storage.d.ts.map +0 -1
- package/dist/shims/layout-segment-context.d.ts.map +0 -1
- package/dist/shims/legacy-image.d.ts.map +0 -1
- package/dist/shims/link.d.ts.map +0 -1
- package/dist/shims/metadata.d.ts.map +0 -1
- package/dist/shims/navigation-state.d.ts.map +0 -1
- package/dist/shims/navigation.d.ts.map +0 -1
- package/dist/shims/og.d.ts.map +0 -1
- package/dist/shims/og.js.map +0 -1
- package/dist/shims/readonly-url-search-params.d.ts.map +0 -1
- package/dist/shims/request-context.d.ts.map +0 -1
- package/dist/shims/request-state-types.d.ts.map +0 -1
- package/dist/shims/request-state-types.js.map +0 -1
- package/dist/shims/router-state.d.ts.map +0 -1
- package/dist/shims/router.d.ts.map +0 -1
- package/dist/shims/script.d.ts.map +0 -1
- package/dist/shims/server-only.d.ts.map +0 -1
- package/dist/shims/server-only.js.map +0 -1
- package/dist/shims/server.d.ts.map +0 -1
- package/dist/shims/unified-request-context.d.ts.map +0 -1
- package/dist/shims/url-safety.d.ts.map +0 -1
- package/dist/shims/url-utils.d.ts.map +0 -1
- package/dist/shims/web-vitals.d.ts.map +0 -1
- package/dist/utils/base-path.d.ts.map +0 -1
- package/dist/utils/domain-locale.d.ts.map +0 -1
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/manifest-paths.d.ts.map +0 -1
- package/dist/utils/project.d.ts.map +0 -1
- package/dist/utils/query.d.ts.map +0 -1
package/dist/shims/server.js
CHANGED
|
@@ -1,497 +1,481 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* next/server shim
|
|
3
|
-
*
|
|
4
|
-
* Provides NextRequest, NextResponse, and related types that work with
|
|
5
|
-
* standard Web APIs (Request/Response). This means they work on Node,
|
|
6
|
-
* Cloudflare Workers, Deno, and any WinterCG-compatible runtime.
|
|
7
|
-
*
|
|
8
|
-
* This is a pragmatic subset — we implement the most commonly used APIs
|
|
9
|
-
* rather than bug-for-bug parity with Next.js internals.
|
|
10
|
-
*/
|
|
11
1
|
import { encodeMiddlewareRequestHeaders } from "../server/middleware-request-headers.js";
|
|
12
2
|
import { parseCookieHeader } from "./internal/parse-cookie-header.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
super(input, init);
|
|
35
|
-
}
|
|
36
|
-
const url = typeof input === "string"
|
|
37
|
-
? new URL(input, "http://localhost")
|
|
38
|
-
: input instanceof URL
|
|
39
|
-
? input
|
|
40
|
-
: new URL(input.url, "http://localhost");
|
|
41
|
-
this._nextUrl = new NextURL(url);
|
|
42
|
-
this._cookies = new RequestCookies(this.headers);
|
|
43
|
-
}
|
|
44
|
-
get nextUrl() {
|
|
45
|
-
return this._nextUrl;
|
|
46
|
-
}
|
|
47
|
-
get cookies() {
|
|
48
|
-
return this._cookies;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Client IP address. Prefers Cloudflare's trusted CF-Connecting-IP header
|
|
52
|
-
* over the spoofable X-Forwarded-For. Returns undefined if unavailable.
|
|
53
|
-
*/
|
|
54
|
-
get ip() {
|
|
55
|
-
return (this.headers.get("cf-connecting-ip") ??
|
|
56
|
-
this.headers.get("x-real-ip") ??
|
|
57
|
-
this.headers.get("x-forwarded-for")?.split(",")[0]?.trim() ??
|
|
58
|
-
undefined);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Geolocation data. Platform-dependent (e.g., Cloudflare, Vercel).
|
|
62
|
-
* Returns undefined if not available.
|
|
63
|
-
*/
|
|
64
|
-
get geo() {
|
|
65
|
-
// Check Cloudflare-style headers, Vercel-style headers
|
|
66
|
-
const country = this.headers.get("cf-ipcountry") ?? this.headers.get("x-vercel-ip-country") ?? undefined;
|
|
67
|
-
if (!country)
|
|
68
|
-
return undefined;
|
|
69
|
-
return {
|
|
70
|
-
country,
|
|
71
|
-
city: this.headers.get("cf-ipcity") ?? this.headers.get("x-vercel-ip-city") ?? undefined,
|
|
72
|
-
region: this.headers.get("cf-region") ??
|
|
73
|
-
this.headers.get("x-vercel-ip-country-region") ??
|
|
74
|
-
undefined,
|
|
75
|
-
latitude: this.headers.get("cf-iplatitude") ?? this.headers.get("x-vercel-ip-latitude") ?? undefined,
|
|
76
|
-
longitude: this.headers.get("cf-iplongitude") ??
|
|
77
|
-
this.headers.get("x-vercel-ip-longitude") ??
|
|
78
|
-
undefined,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* The build ID of the Next.js application.
|
|
83
|
-
* Delegates to `nextUrl.buildId` to match Next.js API surface.
|
|
84
|
-
* Can be used in middleware to detect deployment skew between client and server.
|
|
85
|
-
*/
|
|
86
|
-
get buildId() {
|
|
87
|
-
return this._nextUrl.buildId;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
|
-
// NextResponse
|
|
92
|
-
// ---------------------------------------------------------------------------
|
|
93
|
-
export class NextResponse extends Response {
|
|
94
|
-
_cookies;
|
|
95
|
-
constructor(body, init) {
|
|
96
|
-
super(body, init);
|
|
97
|
-
this._cookies = new ResponseCookies(this.headers);
|
|
98
|
-
}
|
|
99
|
-
get cookies() {
|
|
100
|
-
return this._cookies;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Create a JSON response.
|
|
104
|
-
*/
|
|
105
|
-
static json(body, init) {
|
|
106
|
-
const headers = new Headers(init?.headers);
|
|
107
|
-
if (!headers.has("content-type")) {
|
|
108
|
-
headers.set("content-type", "application/json");
|
|
109
|
-
}
|
|
110
|
-
return new NextResponse(JSON.stringify(body), {
|
|
111
|
-
...init,
|
|
112
|
-
headers,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Create a redirect response.
|
|
117
|
-
*/
|
|
118
|
-
static redirect(url, init) {
|
|
119
|
-
const status = typeof init === "number" ? init : (init?.status ?? 307);
|
|
120
|
-
const destination = typeof url === "string" ? url : url.toString();
|
|
121
|
-
const headers = new Headers(typeof init === "object" ? init?.headers : undefined);
|
|
122
|
-
headers.set("Location", destination);
|
|
123
|
-
return new NextResponse(null, { status, headers });
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Create a rewrite response (middleware pattern).
|
|
127
|
-
* Sets the x-middleware-rewrite header.
|
|
128
|
-
*/
|
|
129
|
-
static rewrite(destination, init) {
|
|
130
|
-
const url = typeof destination === "string" ? destination : destination.toString();
|
|
131
|
-
const headers = new Headers(init?.headers);
|
|
132
|
-
headers.set("x-middleware-rewrite", url);
|
|
133
|
-
if (init?.request?.headers) {
|
|
134
|
-
encodeMiddlewareRequestHeaders(headers, init.request.headers);
|
|
135
|
-
}
|
|
136
|
-
return new NextResponse(null, { ...init, headers });
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Continue to the next handler (middleware pattern).
|
|
140
|
-
* Sets the x-middleware-next header.
|
|
141
|
-
*/
|
|
142
|
-
static next(init) {
|
|
143
|
-
const headers = new Headers(init?.headers);
|
|
144
|
-
headers.set("x-middleware-next", "1");
|
|
145
|
-
if (init?.request?.headers) {
|
|
146
|
-
encodeMiddlewareRequestHeaders(headers, init.request.headers);
|
|
147
|
-
}
|
|
148
|
-
return new NextResponse(null, { ...init, headers });
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// ---------------------------------------------------------------------------
|
|
152
|
-
// NextURL — lightweight URL wrapper with pathname helpers
|
|
153
|
-
// ---------------------------------------------------------------------------
|
|
154
|
-
export class NextURL {
|
|
155
|
-
_url;
|
|
156
|
-
constructor(input, base) {
|
|
157
|
-
this._url = new URL(input.toString(), base);
|
|
158
|
-
}
|
|
159
|
-
get href() {
|
|
160
|
-
return this._url.href;
|
|
161
|
-
}
|
|
162
|
-
set href(value) {
|
|
163
|
-
this._url.href = value;
|
|
164
|
-
}
|
|
165
|
-
get origin() {
|
|
166
|
-
return this._url.origin;
|
|
167
|
-
}
|
|
168
|
-
get protocol() {
|
|
169
|
-
return this._url.protocol;
|
|
170
|
-
}
|
|
171
|
-
set protocol(value) {
|
|
172
|
-
this._url.protocol = value;
|
|
173
|
-
}
|
|
174
|
-
get username() {
|
|
175
|
-
return this._url.username;
|
|
176
|
-
}
|
|
177
|
-
set username(value) {
|
|
178
|
-
this._url.username = value;
|
|
179
|
-
}
|
|
180
|
-
get password() {
|
|
181
|
-
return this._url.password;
|
|
182
|
-
}
|
|
183
|
-
set password(value) {
|
|
184
|
-
this._url.password = value;
|
|
185
|
-
}
|
|
186
|
-
get host() {
|
|
187
|
-
return this._url.host;
|
|
188
|
-
}
|
|
189
|
-
set host(value) {
|
|
190
|
-
this._url.host = value;
|
|
191
|
-
}
|
|
192
|
-
get hostname() {
|
|
193
|
-
return this._url.hostname;
|
|
194
|
-
}
|
|
195
|
-
set hostname(value) {
|
|
196
|
-
this._url.hostname = value;
|
|
197
|
-
}
|
|
198
|
-
get port() {
|
|
199
|
-
return this._url.port;
|
|
200
|
-
}
|
|
201
|
-
set port(value) {
|
|
202
|
-
this._url.port = value;
|
|
203
|
-
}
|
|
204
|
-
get pathname() {
|
|
205
|
-
return this._url.pathname;
|
|
206
|
-
}
|
|
207
|
-
set pathname(value) {
|
|
208
|
-
this._url.pathname = value;
|
|
209
|
-
}
|
|
210
|
-
get search() {
|
|
211
|
-
return this._url.search;
|
|
212
|
-
}
|
|
213
|
-
set search(value) {
|
|
214
|
-
this._url.search = value;
|
|
215
|
-
}
|
|
216
|
-
get searchParams() {
|
|
217
|
-
return this._url.searchParams;
|
|
218
|
-
}
|
|
219
|
-
get hash() {
|
|
220
|
-
return this._url.hash;
|
|
221
|
-
}
|
|
222
|
-
set hash(value) {
|
|
223
|
-
this._url.hash = value;
|
|
224
|
-
}
|
|
225
|
-
clone() {
|
|
226
|
-
return new NextURL(this._url.href);
|
|
227
|
-
}
|
|
228
|
-
toString() {
|
|
229
|
-
return this._url.toString();
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* The build ID of the Next.js application.
|
|
233
|
-
* Set from `generateBuildId` in next.config.js, or a random UUID if not configured.
|
|
234
|
-
* Can be used in middleware to detect deployment skew between client and server.
|
|
235
|
-
* Matches the Next.js API: `request.nextUrl.buildId`.
|
|
236
|
-
*/
|
|
237
|
-
get buildId() {
|
|
238
|
-
return process.env.__VINEXT_BUILD_ID ?? undefined;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
export class RequestCookies {
|
|
242
|
-
_headers;
|
|
243
|
-
_parsed;
|
|
244
|
-
constructor(headers) {
|
|
245
|
-
this._headers = headers;
|
|
246
|
-
this._parsed = parseCookieHeader(headers.get("cookie") ?? "");
|
|
247
|
-
}
|
|
248
|
-
get(name) {
|
|
249
|
-
const value = this._parsed.get(name);
|
|
250
|
-
return value !== undefined ? { name, value } : undefined;
|
|
251
|
-
}
|
|
252
|
-
getAll(nameOrOptions) {
|
|
253
|
-
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions?.name;
|
|
254
|
-
return [...this._parsed.entries()]
|
|
255
|
-
.filter(([cookieName]) => name === undefined || cookieName === name)
|
|
256
|
-
.map(([cookieName, value]) => ({ name: cookieName, value }));
|
|
257
|
-
}
|
|
258
|
-
has(name) {
|
|
259
|
-
return this._parsed.has(name);
|
|
260
|
-
}
|
|
261
|
-
set(nameOrOptions, value) {
|
|
262
|
-
let cookieName;
|
|
263
|
-
let cookieValue;
|
|
264
|
-
if (typeof nameOrOptions === "string") {
|
|
265
|
-
cookieName = nameOrOptions;
|
|
266
|
-
cookieValue = value ?? "";
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
cookieName = nameOrOptions.name;
|
|
270
|
-
cookieValue = nameOrOptions.value;
|
|
271
|
-
}
|
|
272
|
-
this._parsed.set(cookieName, cookieValue);
|
|
273
|
-
this._syncHeader();
|
|
274
|
-
return this;
|
|
275
|
-
}
|
|
276
|
-
delete(names) {
|
|
277
|
-
if (Array.isArray(names)) {
|
|
278
|
-
const results = names.map((name) => this._parsed.delete(name));
|
|
279
|
-
this._syncHeader();
|
|
280
|
-
return results;
|
|
281
|
-
}
|
|
282
|
-
const result = this._parsed.delete(names);
|
|
283
|
-
this._syncHeader();
|
|
284
|
-
return result;
|
|
285
|
-
}
|
|
286
|
-
clear() {
|
|
287
|
-
this._parsed.clear();
|
|
288
|
-
this._syncHeader();
|
|
289
|
-
return this;
|
|
290
|
-
}
|
|
291
|
-
get size() {
|
|
292
|
-
return this._parsed.size;
|
|
293
|
-
}
|
|
294
|
-
toString() {
|
|
295
|
-
return this._serialize();
|
|
296
|
-
}
|
|
297
|
-
_serialize() {
|
|
298
|
-
return [...this._parsed.entries()].map(([n, v]) => `${n}=${encodeURIComponent(v)}`).join("; ");
|
|
299
|
-
}
|
|
300
|
-
_syncHeader() {
|
|
301
|
-
if (this._parsed.size === 0) {
|
|
302
|
-
this._headers.delete("cookie");
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
this._headers.set("cookie", this._serialize());
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
[Symbol.iterator]() {
|
|
309
|
-
const entries = this.getAll().map((c) => [c.name, c]);
|
|
310
|
-
return entries[Symbol.iterator]();
|
|
311
|
-
}
|
|
3
|
+
import { getRequestExecutionContext } from "./request-context.js";
|
|
4
|
+
//#region src/shims/server.ts
|
|
5
|
+
/**
|
|
6
|
+
* next/server shim
|
|
7
|
+
*
|
|
8
|
+
* Provides NextRequest, NextResponse, and related types that work with
|
|
9
|
+
* standard Web APIs (Request/Response). This means they work on Node,
|
|
10
|
+
* Cloudflare Workers, Deno, and any WinterCG-compatible runtime.
|
|
11
|
+
*
|
|
12
|
+
* This is a pragmatic subset — we implement the most commonly used APIs
|
|
13
|
+
* rather than bug-for-bug parity with Next.js internals.
|
|
14
|
+
*/
|
|
15
|
+
const _USE_CACHE_ALS_KEY = Symbol.for("vinext.cacheRuntime.contextAls");
|
|
16
|
+
const _UNSTABLE_CACHE_ALS_KEY = Symbol.for("vinext.unstableCache.als");
|
|
17
|
+
const _g = globalThis;
|
|
18
|
+
function _throwIfInsideCacheScope(apiName) {
|
|
19
|
+
if (_g[_USE_CACHE_ALS_KEY]?.getStore() != null) throw new Error(`\`${apiName}\` cannot be called inside "use cache". If you need this data inside a cached function, call \`${apiName}\` outside and pass the required data as an argument.`);
|
|
20
|
+
if (_g[_UNSTABLE_CACHE_ALS_KEY]?.getStore() === true) throw new Error(`\`${apiName}\` cannot be called inside a function cached with \`unstable_cache()\`. If you need this data inside a cached function, call \`${apiName}\` outside and pass the required data as an argument.`);
|
|
312
21
|
}
|
|
22
|
+
var NextRequest = class extends Request {
|
|
23
|
+
_nextUrl;
|
|
24
|
+
_cookies;
|
|
25
|
+
constructor(input, init) {
|
|
26
|
+
if (input instanceof Request) {
|
|
27
|
+
const req = input;
|
|
28
|
+
super(req.url, {
|
|
29
|
+
method: req.method,
|
|
30
|
+
headers: req.headers,
|
|
31
|
+
body: req.body,
|
|
32
|
+
duplex: req.body ? "half" : void 0,
|
|
33
|
+
...init
|
|
34
|
+
});
|
|
35
|
+
} else super(input, init);
|
|
36
|
+
this._nextUrl = new NextURL(typeof input === "string" ? new URL(input, "http://localhost") : input instanceof URL ? input : new URL(input.url, "http://localhost"));
|
|
37
|
+
this._cookies = new RequestCookies(this.headers);
|
|
38
|
+
}
|
|
39
|
+
get nextUrl() {
|
|
40
|
+
return this._nextUrl;
|
|
41
|
+
}
|
|
42
|
+
get cookies() {
|
|
43
|
+
return this._cookies;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Client IP address. Prefers Cloudflare's trusted CF-Connecting-IP header
|
|
47
|
+
* over the spoofable X-Forwarded-For. Returns undefined if unavailable.
|
|
48
|
+
*/
|
|
49
|
+
get ip() {
|
|
50
|
+
return this.headers.get("cf-connecting-ip") ?? this.headers.get("x-real-ip") ?? this.headers.get("x-forwarded-for")?.split(",")[0]?.trim() ?? void 0;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Geolocation data. Platform-dependent (e.g., Cloudflare, Vercel).
|
|
54
|
+
* Returns undefined if not available.
|
|
55
|
+
*/
|
|
56
|
+
get geo() {
|
|
57
|
+
const country = this.headers.get("cf-ipcountry") ?? this.headers.get("x-vercel-ip-country") ?? void 0;
|
|
58
|
+
if (!country) return void 0;
|
|
59
|
+
return {
|
|
60
|
+
country,
|
|
61
|
+
city: this.headers.get("cf-ipcity") ?? this.headers.get("x-vercel-ip-city") ?? void 0,
|
|
62
|
+
region: this.headers.get("cf-region") ?? this.headers.get("x-vercel-ip-country-region") ?? void 0,
|
|
63
|
+
latitude: this.headers.get("cf-iplatitude") ?? this.headers.get("x-vercel-ip-latitude") ?? void 0,
|
|
64
|
+
longitude: this.headers.get("cf-iplongitude") ?? this.headers.get("x-vercel-ip-longitude") ?? void 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The build ID of the Next.js application.
|
|
69
|
+
* Delegates to `nextUrl.buildId` to match Next.js API surface.
|
|
70
|
+
* Can be used in middleware to detect deployment skew between client and server.
|
|
71
|
+
*/
|
|
72
|
+
get buildId() {
|
|
73
|
+
return this._nextUrl.buildId;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var NextResponse = class NextResponse extends Response {
|
|
77
|
+
_cookies;
|
|
78
|
+
constructor(body, init) {
|
|
79
|
+
super(body, init);
|
|
80
|
+
this._cookies = new ResponseCookies(this.headers);
|
|
81
|
+
}
|
|
82
|
+
get cookies() {
|
|
83
|
+
return this._cookies;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a JSON response.
|
|
87
|
+
*/
|
|
88
|
+
static json(body, init) {
|
|
89
|
+
const headers = new Headers(init?.headers);
|
|
90
|
+
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
91
|
+
return new NextResponse(JSON.stringify(body), {
|
|
92
|
+
...init,
|
|
93
|
+
headers
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a redirect response.
|
|
98
|
+
*/
|
|
99
|
+
static redirect(url, init) {
|
|
100
|
+
const status = typeof init === "number" ? init : init?.status ?? 307;
|
|
101
|
+
const destination = typeof url === "string" ? url : url.toString();
|
|
102
|
+
const headers = new Headers(typeof init === "object" ? init?.headers : void 0);
|
|
103
|
+
headers.set("Location", destination);
|
|
104
|
+
return new NextResponse(null, {
|
|
105
|
+
status,
|
|
106
|
+
headers
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create a rewrite response (middleware pattern).
|
|
111
|
+
* Sets the x-middleware-rewrite header.
|
|
112
|
+
*/
|
|
113
|
+
static rewrite(destination, init) {
|
|
114
|
+
const url = typeof destination === "string" ? destination : destination.toString();
|
|
115
|
+
const headers = new Headers(init?.headers);
|
|
116
|
+
headers.set("x-middleware-rewrite", url);
|
|
117
|
+
if (init?.request?.headers) encodeMiddlewareRequestHeaders(headers, init.request.headers);
|
|
118
|
+
return new NextResponse(null, {
|
|
119
|
+
...init,
|
|
120
|
+
headers
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Continue to the next handler (middleware pattern).
|
|
125
|
+
* Sets the x-middleware-next header.
|
|
126
|
+
*/
|
|
127
|
+
static next(init) {
|
|
128
|
+
const headers = new Headers(init?.headers);
|
|
129
|
+
headers.set("x-middleware-next", "1");
|
|
130
|
+
if (init?.request?.headers) encodeMiddlewareRequestHeaders(headers, init.request.headers);
|
|
131
|
+
return new NextResponse(null, {
|
|
132
|
+
...init,
|
|
133
|
+
headers
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
var NextURL = class NextURL {
|
|
138
|
+
_url;
|
|
139
|
+
constructor(input, base) {
|
|
140
|
+
this._url = new URL(input.toString(), base);
|
|
141
|
+
}
|
|
142
|
+
get href() {
|
|
143
|
+
return this._url.href;
|
|
144
|
+
}
|
|
145
|
+
set href(value) {
|
|
146
|
+
this._url.href = value;
|
|
147
|
+
}
|
|
148
|
+
get origin() {
|
|
149
|
+
return this._url.origin;
|
|
150
|
+
}
|
|
151
|
+
get protocol() {
|
|
152
|
+
return this._url.protocol;
|
|
153
|
+
}
|
|
154
|
+
set protocol(value) {
|
|
155
|
+
this._url.protocol = value;
|
|
156
|
+
}
|
|
157
|
+
get username() {
|
|
158
|
+
return this._url.username;
|
|
159
|
+
}
|
|
160
|
+
set username(value) {
|
|
161
|
+
this._url.username = value;
|
|
162
|
+
}
|
|
163
|
+
get password() {
|
|
164
|
+
return this._url.password;
|
|
165
|
+
}
|
|
166
|
+
set password(value) {
|
|
167
|
+
this._url.password = value;
|
|
168
|
+
}
|
|
169
|
+
get host() {
|
|
170
|
+
return this._url.host;
|
|
171
|
+
}
|
|
172
|
+
set host(value) {
|
|
173
|
+
this._url.host = value;
|
|
174
|
+
}
|
|
175
|
+
get hostname() {
|
|
176
|
+
return this._url.hostname;
|
|
177
|
+
}
|
|
178
|
+
set hostname(value) {
|
|
179
|
+
this._url.hostname = value;
|
|
180
|
+
}
|
|
181
|
+
get port() {
|
|
182
|
+
return this._url.port;
|
|
183
|
+
}
|
|
184
|
+
set port(value) {
|
|
185
|
+
this._url.port = value;
|
|
186
|
+
}
|
|
187
|
+
get pathname() {
|
|
188
|
+
return this._url.pathname;
|
|
189
|
+
}
|
|
190
|
+
set pathname(value) {
|
|
191
|
+
this._url.pathname = value;
|
|
192
|
+
}
|
|
193
|
+
get search() {
|
|
194
|
+
return this._url.search;
|
|
195
|
+
}
|
|
196
|
+
set search(value) {
|
|
197
|
+
this._url.search = value;
|
|
198
|
+
}
|
|
199
|
+
get searchParams() {
|
|
200
|
+
return this._url.searchParams;
|
|
201
|
+
}
|
|
202
|
+
get hash() {
|
|
203
|
+
return this._url.hash;
|
|
204
|
+
}
|
|
205
|
+
set hash(value) {
|
|
206
|
+
this._url.hash = value;
|
|
207
|
+
}
|
|
208
|
+
clone() {
|
|
209
|
+
return new NextURL(this._url.href);
|
|
210
|
+
}
|
|
211
|
+
toString() {
|
|
212
|
+
return this._url.toString();
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The build ID of the Next.js application.
|
|
216
|
+
* Set from `generateBuildId` in next.config.js, or a random UUID if not configured.
|
|
217
|
+
* Can be used in middleware to detect deployment skew between client and server.
|
|
218
|
+
* Matches the Next.js API: `request.nextUrl.buildId`.
|
|
219
|
+
*/
|
|
220
|
+
get buildId() {
|
|
221
|
+
return process.env.__VINEXT_BUILD_ID ?? void 0;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
var RequestCookies = class {
|
|
225
|
+
_headers;
|
|
226
|
+
_parsed;
|
|
227
|
+
constructor(headers) {
|
|
228
|
+
this._headers = headers;
|
|
229
|
+
this._parsed = parseCookieHeader(headers.get("cookie") ?? "");
|
|
230
|
+
}
|
|
231
|
+
get(name) {
|
|
232
|
+
const value = this._parsed.get(name);
|
|
233
|
+
return value !== void 0 ? {
|
|
234
|
+
name,
|
|
235
|
+
value
|
|
236
|
+
} : void 0;
|
|
237
|
+
}
|
|
238
|
+
getAll(nameOrOptions) {
|
|
239
|
+
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions?.name;
|
|
240
|
+
return [...this._parsed.entries()].filter(([cookieName]) => name === void 0 || cookieName === name).map(([cookieName, value]) => ({
|
|
241
|
+
name: cookieName,
|
|
242
|
+
value
|
|
243
|
+
}));
|
|
244
|
+
}
|
|
245
|
+
has(name) {
|
|
246
|
+
return this._parsed.has(name);
|
|
247
|
+
}
|
|
248
|
+
set(nameOrOptions, value) {
|
|
249
|
+
let cookieName;
|
|
250
|
+
let cookieValue;
|
|
251
|
+
if (typeof nameOrOptions === "string") {
|
|
252
|
+
cookieName = nameOrOptions;
|
|
253
|
+
cookieValue = value ?? "";
|
|
254
|
+
} else {
|
|
255
|
+
cookieName = nameOrOptions.name;
|
|
256
|
+
cookieValue = nameOrOptions.value;
|
|
257
|
+
}
|
|
258
|
+
this._parsed.set(cookieName, cookieValue);
|
|
259
|
+
this._syncHeader();
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
delete(names) {
|
|
263
|
+
if (Array.isArray(names)) {
|
|
264
|
+
const results = names.map((name) => this._parsed.delete(name));
|
|
265
|
+
this._syncHeader();
|
|
266
|
+
return results;
|
|
267
|
+
}
|
|
268
|
+
const result = this._parsed.delete(names);
|
|
269
|
+
this._syncHeader();
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
clear() {
|
|
273
|
+
this._parsed.clear();
|
|
274
|
+
this._syncHeader();
|
|
275
|
+
return this;
|
|
276
|
+
}
|
|
277
|
+
get size() {
|
|
278
|
+
return this._parsed.size;
|
|
279
|
+
}
|
|
280
|
+
toString() {
|
|
281
|
+
return this._serialize();
|
|
282
|
+
}
|
|
283
|
+
_serialize() {
|
|
284
|
+
return [...this._parsed.entries()].map(([n, v]) => `${n}=${encodeURIComponent(v)}`).join("; ");
|
|
285
|
+
}
|
|
286
|
+
_syncHeader() {
|
|
287
|
+
if (this._parsed.size === 0) this._headers.delete("cookie");
|
|
288
|
+
else this._headers.set("cookie", this._serialize());
|
|
289
|
+
}
|
|
290
|
+
[Symbol.iterator]() {
|
|
291
|
+
return this.getAll().map((c) => [c.name, c])[Symbol.iterator]();
|
|
292
|
+
}
|
|
293
|
+
};
|
|
313
294
|
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
295
|
+
* RFC 6265 §4.1.1: cookie-name is a token (RFC 2616 §2.2).
|
|
296
|
+
* Allowed: any visible ASCII (0x21-0x7E) except separators: ()<>@,;:\"/[]?={}
|
|
297
|
+
*/
|
|
317
298
|
const VALID_COOKIE_NAME_RE = /^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]+$/;
|
|
318
299
|
function validateCookieName(name) {
|
|
319
|
-
|
|
320
|
-
throw new Error(`Invalid cookie name: ${JSON.stringify(name)}`);
|
|
321
|
-
}
|
|
300
|
+
if (!name || !VALID_COOKIE_NAME_RE.test(name)) throw new Error(`Invalid cookie name: ${JSON.stringify(name)}`);
|
|
322
301
|
}
|
|
323
302
|
function validateCookieAttributeValue(value, attributeName) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
export class ResponseCookies {
|
|
332
|
-
_headers;
|
|
333
|
-
constructor(headers) {
|
|
334
|
-
this._headers = headers;
|
|
335
|
-
}
|
|
336
|
-
set(name, value, options) {
|
|
337
|
-
validateCookieName(name);
|
|
338
|
-
const parts = [`${name}=${encodeURIComponent(value)}`];
|
|
339
|
-
if (options?.path) {
|
|
340
|
-
validateCookieAttributeValue(options.path, "Path");
|
|
341
|
-
parts.push(`Path=${options.path}`);
|
|
342
|
-
}
|
|
343
|
-
if (options?.domain) {
|
|
344
|
-
validateCookieAttributeValue(options.domain, "Domain");
|
|
345
|
-
parts.push(`Domain=${options.domain}`);
|
|
346
|
-
}
|
|
347
|
-
if (options?.maxAge !== undefined)
|
|
348
|
-
parts.push(`Max-Age=${options.maxAge}`);
|
|
349
|
-
if (options?.expires)
|
|
350
|
-
parts.push(`Expires=${options.expires.toUTCString()}`);
|
|
351
|
-
if (options?.httpOnly)
|
|
352
|
-
parts.push("HttpOnly");
|
|
353
|
-
if (options?.secure)
|
|
354
|
-
parts.push("Secure");
|
|
355
|
-
if (options?.sameSite)
|
|
356
|
-
parts.push(`SameSite=${options.sameSite}`);
|
|
357
|
-
this._headers.append("Set-Cookie", parts.join("; "));
|
|
358
|
-
return this;
|
|
359
|
-
}
|
|
360
|
-
get(name) {
|
|
361
|
-
for (const header of this._headers.getSetCookie()) {
|
|
362
|
-
const eq = header.indexOf("=");
|
|
363
|
-
if (eq === -1)
|
|
364
|
-
continue;
|
|
365
|
-
const cookieName = header.slice(0, eq);
|
|
366
|
-
if (cookieName === name) {
|
|
367
|
-
const semi = header.indexOf(";", eq);
|
|
368
|
-
const raw = header.slice(eq + 1, semi === -1 ? undefined : semi);
|
|
369
|
-
let value;
|
|
370
|
-
try {
|
|
371
|
-
value = decodeURIComponent(raw);
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
value = raw;
|
|
375
|
-
}
|
|
376
|
-
return { name, value };
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
return undefined;
|
|
380
|
-
}
|
|
381
|
-
getAll() {
|
|
382
|
-
const entries = [];
|
|
383
|
-
for (const header of this._headers.getSetCookie()) {
|
|
384
|
-
const eq = header.indexOf("=");
|
|
385
|
-
if (eq === -1)
|
|
386
|
-
continue;
|
|
387
|
-
const cookieName = header.slice(0, eq);
|
|
388
|
-
const semi = header.indexOf(";", eq);
|
|
389
|
-
const raw = header.slice(eq + 1, semi === -1 ? undefined : semi);
|
|
390
|
-
let value;
|
|
391
|
-
try {
|
|
392
|
-
value = decodeURIComponent(raw);
|
|
393
|
-
}
|
|
394
|
-
catch {
|
|
395
|
-
value = raw;
|
|
396
|
-
}
|
|
397
|
-
entries.push({ name: cookieName, value });
|
|
398
|
-
}
|
|
399
|
-
return entries;
|
|
400
|
-
}
|
|
401
|
-
delete(name) {
|
|
402
|
-
this.set(name, "", { maxAge: 0, path: "/" });
|
|
403
|
-
return this;
|
|
404
|
-
}
|
|
405
|
-
[Symbol.iterator]() {
|
|
406
|
-
const entries = [];
|
|
407
|
-
for (const header of this._headers.getSetCookie()) {
|
|
408
|
-
const eq = header.indexOf("=");
|
|
409
|
-
if (eq === -1)
|
|
410
|
-
continue;
|
|
411
|
-
const cookieName = header.slice(0, eq);
|
|
412
|
-
const semi = header.indexOf(";", eq);
|
|
413
|
-
const raw = header.slice(eq + 1, semi === -1 ? undefined : semi);
|
|
414
|
-
let value;
|
|
415
|
-
try {
|
|
416
|
-
value = decodeURIComponent(raw);
|
|
417
|
-
}
|
|
418
|
-
catch {
|
|
419
|
-
value = raw;
|
|
420
|
-
}
|
|
421
|
-
entries.push([cookieName, { name: cookieName, value }]);
|
|
422
|
-
}
|
|
423
|
-
return entries[Symbol.iterator]();
|
|
424
|
-
}
|
|
303
|
+
for (let i = 0; i < value.length; i++) {
|
|
304
|
+
const code = value.charCodeAt(i);
|
|
305
|
+
if (code <= 31 || code === 127 || value[i] === ";") throw new Error(`Invalid cookie ${attributeName} value: ${JSON.stringify(value)}`);
|
|
306
|
+
}
|
|
425
307
|
}
|
|
308
|
+
var ResponseCookies = class {
|
|
309
|
+
_headers;
|
|
310
|
+
constructor(headers) {
|
|
311
|
+
this._headers = headers;
|
|
312
|
+
}
|
|
313
|
+
set(name, value, options) {
|
|
314
|
+
validateCookieName(name);
|
|
315
|
+
const parts = [`${name}=${encodeURIComponent(value)}`];
|
|
316
|
+
if (options?.path) {
|
|
317
|
+
validateCookieAttributeValue(options.path, "Path");
|
|
318
|
+
parts.push(`Path=${options.path}`);
|
|
319
|
+
}
|
|
320
|
+
if (options?.domain) {
|
|
321
|
+
validateCookieAttributeValue(options.domain, "Domain");
|
|
322
|
+
parts.push(`Domain=${options.domain}`);
|
|
323
|
+
}
|
|
324
|
+
if (options?.maxAge !== void 0) parts.push(`Max-Age=${options.maxAge}`);
|
|
325
|
+
if (options?.expires) parts.push(`Expires=${options.expires.toUTCString()}`);
|
|
326
|
+
if (options?.httpOnly) parts.push("HttpOnly");
|
|
327
|
+
if (options?.secure) parts.push("Secure");
|
|
328
|
+
if (options?.sameSite) parts.push(`SameSite=${options.sameSite}`);
|
|
329
|
+
this._headers.append("Set-Cookie", parts.join("; "));
|
|
330
|
+
return this;
|
|
331
|
+
}
|
|
332
|
+
get(name) {
|
|
333
|
+
for (const header of this._headers.getSetCookie()) {
|
|
334
|
+
const eq = header.indexOf("=");
|
|
335
|
+
if (eq === -1) continue;
|
|
336
|
+
if (header.slice(0, eq) === name) {
|
|
337
|
+
const semi = header.indexOf(";", eq);
|
|
338
|
+
const raw = header.slice(eq + 1, semi === -1 ? void 0 : semi);
|
|
339
|
+
let value;
|
|
340
|
+
try {
|
|
341
|
+
value = decodeURIComponent(raw);
|
|
342
|
+
} catch {
|
|
343
|
+
value = raw;
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
name,
|
|
347
|
+
value
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
has(name) {
|
|
353
|
+
return this.get(name) !== void 0;
|
|
354
|
+
}
|
|
355
|
+
getAll() {
|
|
356
|
+
const entries = [];
|
|
357
|
+
for (const header of this._headers.getSetCookie()) {
|
|
358
|
+
const eq = header.indexOf("=");
|
|
359
|
+
if (eq === -1) continue;
|
|
360
|
+
const cookieName = header.slice(0, eq);
|
|
361
|
+
const semi = header.indexOf(";", eq);
|
|
362
|
+
const raw = header.slice(eq + 1, semi === -1 ? void 0 : semi);
|
|
363
|
+
let value;
|
|
364
|
+
try {
|
|
365
|
+
value = decodeURIComponent(raw);
|
|
366
|
+
} catch {
|
|
367
|
+
value = raw;
|
|
368
|
+
}
|
|
369
|
+
entries.push({
|
|
370
|
+
name: cookieName,
|
|
371
|
+
value
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
return entries;
|
|
375
|
+
}
|
|
376
|
+
delete(name) {
|
|
377
|
+
this.set(name, "", {
|
|
378
|
+
maxAge: 0,
|
|
379
|
+
path: "/"
|
|
380
|
+
});
|
|
381
|
+
return this;
|
|
382
|
+
}
|
|
383
|
+
[Symbol.iterator]() {
|
|
384
|
+
const entries = [];
|
|
385
|
+
for (const header of this._headers.getSetCookie()) {
|
|
386
|
+
const eq = header.indexOf("=");
|
|
387
|
+
if (eq === -1) continue;
|
|
388
|
+
const cookieName = header.slice(0, eq);
|
|
389
|
+
const semi = header.indexOf(";", eq);
|
|
390
|
+
const raw = header.slice(eq + 1, semi === -1 ? void 0 : semi);
|
|
391
|
+
let value;
|
|
392
|
+
try {
|
|
393
|
+
value = decodeURIComponent(raw);
|
|
394
|
+
} catch {
|
|
395
|
+
value = raw;
|
|
396
|
+
}
|
|
397
|
+
entries.push([cookieName, {
|
|
398
|
+
name: cookieName,
|
|
399
|
+
value
|
|
400
|
+
}]);
|
|
401
|
+
}
|
|
402
|
+
return entries[Symbol.iterator]();
|
|
403
|
+
}
|
|
404
|
+
};
|
|
426
405
|
/**
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
// ---------------------------------------------------------------------------
|
|
445
|
-
// Utility exports
|
|
446
|
-
// ---------------------------------------------------------------------------
|
|
406
|
+
* Minimal NextFetchEvent — extends FetchEvent where available,
|
|
407
|
+
* otherwise provides the waitUntil pattern standalone.
|
|
408
|
+
*/
|
|
409
|
+
var NextFetchEvent = class {
|
|
410
|
+
sourcePage;
|
|
411
|
+
_waitUntilPromises = [];
|
|
412
|
+
constructor(params) {
|
|
413
|
+
this.sourcePage = params.page;
|
|
414
|
+
}
|
|
415
|
+
waitUntil(promise) {
|
|
416
|
+
this._waitUntilPromises.push(promise);
|
|
417
|
+
}
|
|
418
|
+
/** Drain all waitUntil promises. Returns a single promise that settles when all are done. */
|
|
419
|
+
drainWaitUntil() {
|
|
420
|
+
return Promise.allSettled(this._waitUntilPromises);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
447
423
|
/**
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
424
|
+
* Parse user agent string. Minimal implementation — for full UA parsing,
|
|
425
|
+
* apps should use a dedicated library like `ua-parser-js`.
|
|
426
|
+
*/
|
|
427
|
+
function userAgentFromString(ua) {
|
|
428
|
+
const input = ua ?? "";
|
|
429
|
+
return {
|
|
430
|
+
isBot: /bot|crawler|spider|crawling/i.test(input),
|
|
431
|
+
ua: input,
|
|
432
|
+
browser: {},
|
|
433
|
+
device: {},
|
|
434
|
+
engine: {},
|
|
435
|
+
os: {},
|
|
436
|
+
cpu: {}
|
|
437
|
+
};
|
|
462
438
|
}
|
|
463
|
-
|
|
464
|
-
|
|
439
|
+
function userAgent({ headers }) {
|
|
440
|
+
return userAgentFromString(headers.get("user-agent") ?? void 0);
|
|
465
441
|
}
|
|
466
442
|
/**
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
443
|
+
* after() — schedule work after the response is sent.
|
|
444
|
+
*
|
|
445
|
+
* Uses the platform's `waitUntil` (via the per-request ExecutionContext) when
|
|
446
|
+
* available so the task survives past the response on Cloudflare Workers.
|
|
447
|
+
* Falls back to a fire-and-forget microtask on runtimes without an execution
|
|
448
|
+
* context (e.g. Node.js dev server).
|
|
449
|
+
*
|
|
450
|
+
* Throws when called inside a cached scope — request-specific
|
|
451
|
+
* side-effects must not leak into cached results.
|
|
452
|
+
*/
|
|
453
|
+
function after(task) {
|
|
454
|
+
_throwIfInsideCacheScope("after()");
|
|
455
|
+
const guarded = (typeof task === "function" ? Promise.resolve().then(task) : task).catch((err) => {
|
|
456
|
+
console.error("[vinext] after() task failed:", err);
|
|
457
|
+
});
|
|
458
|
+
getRequestExecutionContext()?.waitUntil(guarded);
|
|
476
459
|
}
|
|
477
460
|
/**
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
461
|
+
* connection() — signals that the response requires a live connection
|
|
462
|
+
* (not a static/cached response). Opts the page out of ISR caching
|
|
463
|
+
* and sets Cache-Control: no-store on the response.
|
|
464
|
+
*/
|
|
465
|
+
async function connection() {
|
|
466
|
+
const { markDynamicUsage, throwIfInsideCacheScope } = await import("./headers.js");
|
|
467
|
+
throwIfInsideCacheScope("connection()");
|
|
468
|
+
markDynamicUsage();
|
|
486
469
|
}
|
|
487
470
|
/**
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
471
|
+
* URLPattern re-export — used in middleware for route matching.
|
|
472
|
+
* Available natively in Node 20+, Cloudflare Workers, Deno.
|
|
473
|
+
* Falls back to urlpattern-polyfill if the global is not available.
|
|
474
|
+
*/
|
|
475
|
+
const URLPattern = globalThis.URLPattern ?? (() => {
|
|
476
|
+
throw new Error("URLPattern is not available in this runtime. Install the `urlpattern-polyfill` package or upgrade to Node 20+.");
|
|
477
|
+
});
|
|
478
|
+
//#endregion
|
|
479
|
+
export { NextFetchEvent, NextRequest, NextResponse, NextURL, RequestCookies, ResponseCookies, URLPattern, after, connection, userAgent, userAgentFromString };
|
|
480
|
+
|
|
497
481
|
//# sourceMappingURL=server.js.map
|