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/url-utils.js
CHANGED
|
@@ -1,105 +1,74 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared URL utilities for same-origin detection.
|
|
3
|
-
*
|
|
4
|
-
* Used by link.tsx, navigation.ts, and router.ts to normalize
|
|
5
|
-
* same-origin absolute URLs to local paths for client-side navigation.
|
|
6
|
-
*/
|
|
7
1
|
import { hasBasePath, stripBasePath } from "../utils/base-path.js";
|
|
2
|
+
//#region src/shims/url-utils.ts
|
|
3
|
+
/**
|
|
4
|
+
* Shared URL utilities for same-origin detection.
|
|
5
|
+
*
|
|
6
|
+
* Used by link.tsx, navigation.ts, and router.ts to normalize
|
|
7
|
+
* same-origin absolute URLs to local paths for client-side navigation.
|
|
8
|
+
*/
|
|
8
9
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
// not a valid absolute URL — ignore
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
10
|
+
* If `url` is an absolute same-origin URL, return the local path
|
|
11
|
+
* (pathname + search + hash). Returns null for truly external URLs
|
|
12
|
+
* or on the server (where origin is unknown).
|
|
13
|
+
*/
|
|
14
|
+
function toSameOriginPath(url) {
|
|
15
|
+
if (typeof window === "undefined") return null;
|
|
16
|
+
try {
|
|
17
|
+
const parsed = url.startsWith("//") ? new URL(url, window.location.origin) : new URL(url);
|
|
18
|
+
if (parsed.origin === window.location.origin) return parsed.pathname + parsed.search + parsed.hash;
|
|
19
|
+
} catch {}
|
|
20
|
+
return null;
|
|
26
21
|
}
|
|
27
22
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return pathname + parsed.search + parsed.hash;
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return localPath;
|
|
46
|
-
}
|
|
23
|
+
* If `url` is an absolute same-origin URL, return the app-relative path
|
|
24
|
+
* (basePath stripped from the pathname, if configured). Returns null for
|
|
25
|
+
* truly external URLs or on the server.
|
|
26
|
+
*/
|
|
27
|
+
function toSameOriginAppPath(url, basePath) {
|
|
28
|
+
const localPath = toSameOriginPath(url);
|
|
29
|
+
if (localPath == null || !basePath) return localPath;
|
|
30
|
+
try {
|
|
31
|
+
const parsed = new URL(localPath, "http://vinext.local");
|
|
32
|
+
if (!hasBasePath(parsed.pathname, basePath)) return null;
|
|
33
|
+
return stripBasePath(parsed.pathname, basePath) + parsed.search + parsed.hash;
|
|
34
|
+
} catch {
|
|
35
|
+
return localPath;
|
|
36
|
+
}
|
|
47
37
|
}
|
|
48
38
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
path.startsWith("http://") ||
|
|
55
|
-
path.startsWith("https://") ||
|
|
56
|
-
path.startsWith("//")) {
|
|
57
|
-
return path;
|
|
58
|
-
}
|
|
59
|
-
return basePath + path;
|
|
39
|
+
* Prepend basePath to a local path for browser URLs / fetches.
|
|
40
|
+
*/
|
|
41
|
+
function withBasePath(path, basePath) {
|
|
42
|
+
if (!basePath || !path.startsWith("/") || path.startsWith("http://") || path.startsWith("https://") || path.startsWith("//")) return path;
|
|
43
|
+
return basePath + path;
|
|
60
44
|
}
|
|
61
45
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const resolved = new URL(href, base);
|
|
77
|
-
const pathname = basePath && resolved.pathname === basePath
|
|
78
|
-
? ""
|
|
79
|
-
: basePath
|
|
80
|
-
? stripBasePath(resolved.pathname, basePath)
|
|
81
|
-
: resolved.pathname;
|
|
82
|
-
return pathname + resolved.search + resolved.hash;
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return href;
|
|
86
|
-
}
|
|
46
|
+
* Resolve a potentially relative href against the current URL.
|
|
47
|
+
* Handles: "#hash", "?query", "?query#hash", and relative paths.
|
|
48
|
+
*/
|
|
49
|
+
function resolveRelativeHref(href, currentUrl, basePath = "") {
|
|
50
|
+
const base = currentUrl ?? (typeof window !== "undefined" ? window.location.href : void 0);
|
|
51
|
+
if (!base) return href;
|
|
52
|
+
if (href.startsWith("/") || href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//")) return href;
|
|
53
|
+
try {
|
|
54
|
+
const resolved = new URL(href, base);
|
|
55
|
+
return (basePath && resolved.pathname === basePath ? "" : basePath ? stripBasePath(resolved.pathname, basePath) : resolved.pathname) + resolved.search + resolved.hash;
|
|
56
|
+
} catch {
|
|
57
|
+
return href;
|
|
58
|
+
}
|
|
87
59
|
}
|
|
88
60
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return basePath;
|
|
99
|
-
}
|
|
100
|
-
if (resolved.startsWith("?") || resolved.startsWith("#")) {
|
|
101
|
-
return basePath + resolved;
|
|
102
|
-
}
|
|
103
|
-
return withBasePath(resolved, basePath);
|
|
61
|
+
* Convert a local navigation target into the browser URL that should be used
|
|
62
|
+
* for history entries, fetches, and onNavigate callbacks.
|
|
63
|
+
*/
|
|
64
|
+
function toBrowserNavigationHref(href, currentUrl, basePath = "") {
|
|
65
|
+
const resolved = resolveRelativeHref(href, currentUrl, basePath);
|
|
66
|
+
if (!basePath) return withBasePath(resolved, basePath);
|
|
67
|
+
if (resolved === "") return basePath;
|
|
68
|
+
if (resolved.startsWith("?") || resolved.startsWith("#")) return basePath + resolved;
|
|
69
|
+
return withBasePath(resolved, basePath);
|
|
104
70
|
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { resolveRelativeHref, toBrowserNavigationHref, toSameOriginAppPath, toSameOriginPath, withBasePath };
|
|
73
|
+
|
|
105
74
|
//# sourceMappingURL=url-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-utils.js","
|
|
1
|
+
{"version":3,"file":"url-utils.js","names":[],"sources":["../../src/shims/url-utils.ts"],"sourcesContent":["/**\n * Shared URL utilities for same-origin detection.\n *\n * Used by link.tsx, navigation.ts, and router.ts to normalize\n * same-origin absolute URLs to local paths for client-side navigation.\n */\nimport { hasBasePath, stripBasePath } from \"../utils/base-path.js\";\n\n/**\n * If `url` is an absolute same-origin URL, return the local path\n * (pathname + search + hash). Returns null for truly external URLs\n * or on the server (where origin is unknown).\n */\nexport function toSameOriginPath(url: string): string | null {\n if (typeof window === \"undefined\") return null;\n try {\n const parsed = url.startsWith(\"//\") ? new URL(url, window.location.origin) : new URL(url);\n if (parsed.origin === window.location.origin) {\n return parsed.pathname + parsed.search + parsed.hash;\n }\n } catch {\n // not a valid absolute URL — ignore\n }\n return null;\n}\n\n/**\n * If `url` is an absolute same-origin URL, return the app-relative path\n * (basePath stripped from the pathname, if configured). Returns null for\n * truly external URLs or on the server.\n */\nexport function toSameOriginAppPath(url: string, basePath: string): string | null {\n const localPath = toSameOriginPath(url);\n if (localPath == null || !basePath) return localPath;\n\n try {\n const parsed = new URL(localPath, \"http://vinext.local\");\n if (!hasBasePath(parsed.pathname, basePath)) {\n return null;\n }\n const pathname = stripBasePath(parsed.pathname, basePath);\n return pathname + parsed.search + parsed.hash;\n } catch {\n return localPath;\n }\n}\n\n/**\n * Prepend basePath to a local path for browser URLs / fetches.\n */\nexport function withBasePath(path: string, basePath: string): string {\n if (\n !basePath ||\n !path.startsWith(\"/\") ||\n path.startsWith(\"http://\") ||\n path.startsWith(\"https://\") ||\n path.startsWith(\"//\")\n ) {\n return path;\n }\n\n return basePath + path;\n}\n\n/**\n * Resolve a potentially relative href against the current URL.\n * Handles: \"#hash\", \"?query\", \"?query#hash\", and relative paths.\n */\nexport function resolveRelativeHref(href: string, currentUrl?: string, basePath = \"\"): string {\n const base = currentUrl ?? (typeof window !== \"undefined\" ? window.location.href : undefined);\n\n if (!base) return href;\n\n if (\n href.startsWith(\"/\") ||\n href.startsWith(\"http://\") ||\n href.startsWith(\"https://\") ||\n href.startsWith(\"//\")\n ) {\n return href;\n }\n\n try {\n const resolved = new URL(href, base);\n const pathname =\n basePath && resolved.pathname === basePath\n ? \"\"\n : basePath\n ? stripBasePath(resolved.pathname, basePath)\n : resolved.pathname;\n return pathname + resolved.search + resolved.hash;\n } catch {\n return href;\n }\n}\n\n/**\n * Convert a local navigation target into the browser URL that should be used\n * for history entries, fetches, and onNavigate callbacks.\n */\nexport function toBrowserNavigationHref(href: string, currentUrl?: string, basePath = \"\"): string {\n const resolved = resolveRelativeHref(href, currentUrl, basePath);\n\n if (!basePath) {\n return withBasePath(resolved, basePath);\n }\n\n if (resolved === \"\") {\n return basePath;\n }\n\n if (resolved.startsWith(\"?\") || resolved.startsWith(\"#\")) {\n return basePath + resolved;\n }\n\n return withBasePath(resolved, basePath);\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,iBAAiB,KAA4B;AAC3D,KAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,KAAI;EACF,MAAM,SAAS,IAAI,WAAW,KAAK,GAAG,IAAI,IAAI,KAAK,OAAO,SAAS,OAAO,GAAG,IAAI,IAAI,IAAI;AACzF,MAAI,OAAO,WAAW,OAAO,SAAS,OACpC,QAAO,OAAO,WAAW,OAAO,SAAS,OAAO;SAE5C;AAGR,QAAO;;;;;;;AAQT,SAAgB,oBAAoB,KAAa,UAAiC;CAChF,MAAM,YAAY,iBAAiB,IAAI;AACvC,KAAI,aAAa,QAAQ,CAAC,SAAU,QAAO;AAE3C,KAAI;EACF,MAAM,SAAS,IAAI,IAAI,WAAW,sBAAsB;AACxD,MAAI,CAAC,YAAY,OAAO,UAAU,SAAS,CACzC,QAAO;AAGT,SADiB,cAAc,OAAO,UAAU,SAAS,GACvC,OAAO,SAAS,OAAO;SACnC;AACN,SAAO;;;;;;AAOX,SAAgB,aAAa,MAAc,UAA0B;AACnE,KACE,CAAC,YACD,CAAC,KAAK,WAAW,IAAI,IACrB,KAAK,WAAW,UAAU,IAC1B,KAAK,WAAW,WAAW,IAC3B,KAAK,WAAW,KAAK,CAErB,QAAO;AAGT,QAAO,WAAW;;;;;;AAOpB,SAAgB,oBAAoB,MAAc,YAAqB,WAAW,IAAY;CAC5F,MAAM,OAAO,eAAe,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,KAAA;AAEnF,KAAI,CAAC,KAAM,QAAO;AAElB,KACE,KAAK,WAAW,IAAI,IACpB,KAAK,WAAW,UAAU,IAC1B,KAAK,WAAW,WAAW,IAC3B,KAAK,WAAW,KAAK,CAErB,QAAO;AAGT,KAAI;EACF,MAAM,WAAW,IAAI,IAAI,MAAM,KAAK;AAOpC,UALE,YAAY,SAAS,aAAa,WAC9B,KACA,WACE,cAAc,SAAS,UAAU,SAAS,GAC1C,SAAS,YACC,SAAS,SAAS,SAAS;SACvC;AACN,SAAO;;;;;;;AAQX,SAAgB,wBAAwB,MAAc,YAAqB,WAAW,IAAY;CAChG,MAAM,WAAW,oBAAoB,MAAM,YAAY,SAAS;AAEhE,KAAI,CAAC,SACH,QAAO,aAAa,UAAU,SAAS;AAGzC,KAAI,aAAa,GACf,QAAO;AAGT,KAAI,SAAS,WAAW,IAAI,IAAI,SAAS,WAAW,IAAI,CACtD,QAAO,WAAW;AAGpB,QAAO,aAAa,UAAU,SAAS"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/shims/web-vitals.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* next/web-vitals shim
|
|
3
4
|
*
|
|
@@ -6,12 +7,12 @@
|
|
|
6
7
|
* Apps can use the web-vitals library directly instead.
|
|
7
8
|
*/
|
|
8
9
|
interface WebVitalsMetric {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
value: number;
|
|
13
|
+
rating?: "good" | "needs-improvement" | "poor";
|
|
14
|
+
delta: number;
|
|
15
|
+
navigationType?: "navigate" | "reload" | "back-forward" | "prerender";
|
|
15
16
|
}
|
|
16
17
|
type ReportWebVitalsCallback = (metric: WebVitalsMetric) => void;
|
|
17
18
|
/**
|
|
@@ -19,6 +20,7 @@ type ReportWebVitalsCallback = (metric: WebVitalsMetric) => void;
|
|
|
19
20
|
* No-op in our implementation — use the `web-vitals` library directly
|
|
20
21
|
* for production metrics collection.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
declare function useReportWebVitals(_callback: ReportWebVitalsCallback): void;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { type ReportWebVitalsCallback, type WebVitalsMetric, useReportWebVitals };
|
|
24
26
|
//# sourceMappingURL=web-vitals.d.ts.map
|
package/dist/shims/web-vitals.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
+
//#region src/shims/web-vitals.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* No-op in our implementation — use the `web-vitals` library directly
|
|
11
|
-
* for production metrics collection.
|
|
12
|
-
*/
|
|
13
|
-
export function useReportWebVitals(_callback) {
|
|
14
|
-
// No-op — apps should use the web-vitals library directly
|
|
15
|
-
// or their own analytics integration.
|
|
16
|
-
}
|
|
3
|
+
* Register a callback to receive Core Web Vitals metrics.
|
|
4
|
+
* No-op in our implementation — use the `web-vitals` library directly
|
|
5
|
+
* for production metrics collection.
|
|
6
|
+
*/
|
|
7
|
+
function useReportWebVitals(_callback) {}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useReportWebVitals };
|
|
10
|
+
|
|
17
11
|
//# sourceMappingURL=web-vitals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-vitals.js","
|
|
1
|
+
{"version":3,"file":"web-vitals.js","names":[],"sources":["../../src/shims/web-vitals.ts"],"sourcesContent":["/**\n * next/web-vitals shim\n *\n * Provides useReportWebVitals() — a no-op hook for compatibility.\n * In real Next.js, this sends Core Web Vitals to an analytics endpoint.\n * Apps can use the web-vitals library directly instead.\n */\n\ninterface WebVitalsMetric {\n id: string;\n name: string;\n value: number;\n rating?: \"good\" | \"needs-improvement\" | \"poor\";\n delta: number;\n navigationType?: \"navigate\" | \"reload\" | \"back-forward\" | \"prerender\";\n}\n\ntype ReportWebVitalsCallback = (metric: WebVitalsMetric) => void;\n\n/**\n * Register a callback to receive Core Web Vitals metrics.\n * No-op in our implementation — use the `web-vitals` library directly\n * for production metrics collection.\n */\nexport function useReportWebVitals(_callback: ReportWebVitalsCallback): void {\n // No-op — apps should use the web-vitals library directly\n // or their own analytics integration.\n}\n\nexport type { WebVitalsMetric, ReportWebVitalsCallback };\n"],"mappings":";;;;;;AAwBA,SAAgB,mBAAmB,WAA0C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/utils/base-path.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Shared basePath helpers.
|
|
3
4
|
*
|
|
@@ -8,10 +9,12 @@
|
|
|
8
9
|
/**
|
|
9
10
|
* Check whether a pathname is inside the configured basePath.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
declare function hasBasePath(pathname: string, basePath: string): boolean;
|
|
12
13
|
/**
|
|
13
14
|
* Strip the basePath prefix from a pathname when it matches on a segment
|
|
14
15
|
* boundary. Returns the original pathname when it is outside the basePath.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
declare function stripBasePath(pathname: string, basePath: string): string;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { hasBasePath, stripBasePath };
|
|
17
20
|
//# sourceMappingURL=base-path.d.ts.map
|
package/dist/utils/base-path.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
+
//#region src/utils/base-path.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
* Shared basePath helpers.
|
|
4
|
+
*
|
|
5
|
+
* Next.js only treats a pathname as being under basePath when it is an exact
|
|
6
|
+
* match ("/app") or starts with the basePath followed by a path separator
|
|
7
|
+
* ("/app/..."). Prefix-only matches like "/application" must be left intact.
|
|
8
|
+
*/
|
|
8
9
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return pathname === basePath || pathname.startsWith(basePath + "/");
|
|
10
|
+
* Check whether a pathname is inside the configured basePath.
|
|
11
|
+
*/
|
|
12
|
+
function hasBasePath(pathname, basePath) {
|
|
13
|
+
if (!basePath) return false;
|
|
14
|
+
return pathname === basePath || pathname.startsWith(basePath + "/");
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return pathname.slice(basePath.length) || "/";
|
|
17
|
+
* Strip the basePath prefix from a pathname when it matches on a segment
|
|
18
|
+
* boundary. Returns the original pathname when it is outside the basePath.
|
|
19
|
+
*/
|
|
20
|
+
function stripBasePath(pathname, basePath) {
|
|
21
|
+
if (!hasBasePath(pathname, basePath)) return pathname;
|
|
22
|
+
return pathname.slice(basePath.length) || "/";
|
|
24
23
|
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { hasBasePath, stripBasePath };
|
|
26
|
+
|
|
25
27
|
//# sourceMappingURL=base-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-path.js","
|
|
1
|
+
{"version":3,"file":"base-path.js","names":[],"sources":["../../src/utils/base-path.ts"],"sourcesContent":["/**\n * Shared basePath helpers.\n *\n * Next.js only treats a pathname as being under basePath when it is an exact\n * match (\"/app\") or starts with the basePath followed by a path separator\n * (\"/app/...\"). Prefix-only matches like \"/application\" must be left intact.\n */\n\n/**\n * Check whether a pathname is inside the configured basePath.\n */\nexport function hasBasePath(pathname: string, basePath: string): boolean {\n if (!basePath) return false;\n return pathname === basePath || pathname.startsWith(basePath + \"/\");\n}\n\n/**\n * Strip the basePath prefix from a pathname when it matches on a segment\n * boundary. Returns the original pathname when it is outside the basePath.\n */\nexport function stripBasePath(pathname: string, basePath: string): string {\n if (!hasBasePath(pathname, basePath)) return pathname;\n return pathname.slice(basePath.length) || \"/\";\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,YAAY,UAAkB,UAA2B;AACvE,KAAI,CAAC,SAAU,QAAO;AACtB,QAAO,aAAa,YAAY,SAAS,WAAW,WAAW,IAAI;;;;;;AAOrE,SAAgB,cAAc,UAAkB,UAA0B;AACxE,KAAI,CAAC,YAAY,UAAU,SAAS,CAAE,QAAO;AAC7C,QAAO,SAAS,MAAM,SAAS,OAAO,IAAI"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { NextI18nConfig } from "../config/next-config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/domain-locale.d.ts
|
|
4
|
+
type DomainLocale = NonNullable<NextI18nConfig["domains"]>[number];
|
|
5
|
+
declare function normalizeDomainHostname(hostname: string | null | undefined): string | undefined;
|
|
4
6
|
/**
|
|
5
7
|
* Match a configured domain either by hostname or locale.
|
|
6
8
|
* When both are provided, the checks intentionally use OR semantics so the
|
|
@@ -8,11 +10,17 @@ export declare function normalizeDomainHostname(hostname: string | null | undefi
|
|
|
8
10
|
* If both are passed, the first domain matching either input wins, so callers
|
|
9
11
|
* should pass hostname or detectedLocale, not both.
|
|
10
12
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
declare function detectDomainLocale(domainItems?: readonly DomainLocale[], hostname?: string, detectedLocale?: string): DomainLocale | undefined;
|
|
14
|
+
declare function addLocalePrefix(path: string, locale: string, localeDefault: string): string;
|
|
15
|
+
declare function getDomainLocaleUrl(url: string, locale: string, {
|
|
16
|
+
basePath,
|
|
17
|
+
currentHostname,
|
|
18
|
+
domainItems
|
|
19
|
+
}: {
|
|
20
|
+
basePath?: string;
|
|
21
|
+
currentHostname?: string | null;
|
|
22
|
+
domainItems?: readonly DomainLocale[];
|
|
17
23
|
}): string | undefined;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { DomainLocale, addLocalePrefix, detectDomainLocale, getDomainLocaleUrl, normalizeDomainHostname };
|
|
18
26
|
//# sourceMappingURL=domain-locale.d.ts.map
|
|
@@ -1,64 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/utils/domain-locale.ts
|
|
2
|
+
function normalizeDomainHostname(hostname) {
|
|
3
|
+
if (!hostname) return void 0;
|
|
4
|
+
return hostname.split(",", 1)[0]?.trim().split(":", 1)[0]?.toLowerCase() || void 0;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const item of domainItems) {
|
|
19
|
-
const domainHostname = normalizeDomainHostname(item.domain);
|
|
20
|
-
if (normalizedHostname === domainHostname ||
|
|
21
|
-
normalizedLocale === item.defaultLocale.toLowerCase() ||
|
|
22
|
-
item.locales?.some((locale) => locale.toLowerCase() === normalizedLocale)) {
|
|
23
|
-
return item;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
7
|
+
* Match a configured domain either by hostname or locale.
|
|
8
|
+
* When both are provided, the checks intentionally use OR semantics so the
|
|
9
|
+
* same helper can cover Next.js's hostname lookup and preferred-locale lookup.
|
|
10
|
+
* If both are passed, the first domain matching either input wins, so callers
|
|
11
|
+
* should pass hostname or detectedLocale, not both.
|
|
12
|
+
*/
|
|
13
|
+
function detectDomainLocale(domainItems, hostname, detectedLocale) {
|
|
14
|
+
if (!domainItems?.length) return void 0;
|
|
15
|
+
const normalizedHostname = normalizeDomainHostname(hostname);
|
|
16
|
+
const normalizedLocale = detectedLocale?.toLowerCase();
|
|
17
|
+
for (const item of domainItems) if (normalizedHostname === normalizeDomainHostname(item.domain) || normalizedLocale === item.defaultLocale.toLowerCase() || item.locales?.some((locale) => locale.toLowerCase() === normalizedLocale)) return item;
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (normalizedPathname === localePrefix || normalizedPathname.startsWith(`${localePrefix}/`)) {
|
|
37
|
-
return path.startsWith("/") ? path : pathWithLeadingSlash;
|
|
38
|
-
}
|
|
39
|
-
return `/${locale}${pathWithLeadingSlash}`;
|
|
19
|
+
function addLocalePrefix(path, locale, localeDefault) {
|
|
20
|
+
const normalizedLocale = locale.toLowerCase();
|
|
21
|
+
if (normalizedLocale === localeDefault.toLowerCase()) return path;
|
|
22
|
+
const pathWithLeadingSlash = path.startsWith("/") ? path : `/${path}`;
|
|
23
|
+
const normalizedPathname = (pathWithLeadingSlash.split(/[?#]/, 1)[0] ?? pathWithLeadingSlash).toLowerCase();
|
|
24
|
+
const localePrefix = `/${normalizedLocale}`;
|
|
25
|
+
if (normalizedPathname === localePrefix || normalizedPathname.startsWith(`${localePrefix}/`)) return path.startsWith("/") ? path : pathWithLeadingSlash;
|
|
26
|
+
return `/${locale}${pathWithLeadingSlash}`;
|
|
40
27
|
}
|
|
41
28
|
function withBasePath(path, basePath = "") {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return basePath + path;
|
|
29
|
+
if (!basePath) return path;
|
|
30
|
+
return basePath + path;
|
|
45
31
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (currentDomain &&
|
|
55
|
-
normalizeDomainHostname(currentDomain.domain) === normalizeDomainHostname(targetDomain.domain)) {
|
|
56
|
-
// Same-domain switches fall back to the caller's standard locale-prefix
|
|
57
|
-
// logic. This relies on __VINEXT_DEFAULT_LOCALE__ matching the current
|
|
58
|
-
// domain's defaultLocale, which the server entry keeps in sync.
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const scheme = `http${targetDomain.http ? "" : "s"}://`;
|
|
62
|
-
return `${scheme}${targetDomain.domain}${withBasePath(localizedPath, basePath)}`;
|
|
32
|
+
function getDomainLocaleUrl(url, locale, { basePath, currentHostname, domainItems }) {
|
|
33
|
+
if (!domainItems?.length) return void 0;
|
|
34
|
+
const targetDomain = detectDomainLocale(domainItems, void 0, locale);
|
|
35
|
+
if (!targetDomain) return void 0;
|
|
36
|
+
const currentDomain = detectDomainLocale(domainItems, currentHostname ?? void 0);
|
|
37
|
+
const localizedPath = addLocalePrefix(url, locale, targetDomain.defaultLocale);
|
|
38
|
+
if (currentDomain && normalizeDomainHostname(currentDomain.domain) === normalizeDomainHostname(targetDomain.domain)) return;
|
|
39
|
+
return `${`http${targetDomain.http ? "" : "s"}://`}${targetDomain.domain}${withBasePath(localizedPath, basePath)}`;
|
|
63
40
|
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { addLocalePrefix, detectDomainLocale, getDomainLocaleUrl, normalizeDomainHostname };
|
|
43
|
+
|
|
64
44
|
//# sourceMappingURL=domain-locale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-locale.js","
|
|
1
|
+
{"version":3,"file":"domain-locale.js","names":[],"sources":["../../src/utils/domain-locale.ts"],"sourcesContent":["import type { NextI18nConfig } from \"../config/next-config.js\";\n\nexport type DomainLocale = NonNullable<NextI18nConfig[\"domains\"]>[number];\n\nexport function normalizeDomainHostname(hostname: string | null | undefined): string | undefined {\n if (!hostname) return undefined;\n return hostname.split(\",\", 1)[0]?.trim().split(\":\", 1)[0]?.toLowerCase() || undefined;\n}\n\n/**\n * Match a configured domain either by hostname or locale.\n * When both are provided, the checks intentionally use OR semantics so the\n * same helper can cover Next.js's hostname lookup and preferred-locale lookup.\n * If both are passed, the first domain matching either input wins, so callers\n * should pass hostname or detectedLocale, not both.\n */\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string,\n): DomainLocale | undefined {\n if (!domainItems?.length) return undefined;\n\n const normalizedHostname = normalizeDomainHostname(hostname);\n const normalizedLocale = detectedLocale?.toLowerCase();\n\n for (const item of domainItems) {\n const domainHostname = normalizeDomainHostname(item.domain);\n if (\n normalizedHostname === domainHostname ||\n normalizedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === normalizedLocale)\n ) {\n return item;\n }\n }\n\n return undefined;\n}\n\nexport function addLocalePrefix(path: string, locale: string, localeDefault: string): string {\n const normalizedLocale = locale.toLowerCase();\n if (normalizedLocale === localeDefault.toLowerCase()) return path;\n\n const pathWithLeadingSlash = path.startsWith(\"/\") ? path : `/${path}`;\n const pathname = pathWithLeadingSlash.split(/[?#]/, 1)[0] ?? pathWithLeadingSlash;\n const normalizedPathname = pathname.toLowerCase();\n const localePrefix = `/${normalizedLocale}`;\n\n if (normalizedPathname === localePrefix || normalizedPathname.startsWith(`${localePrefix}/`)) {\n return path.startsWith(\"/\") ? path : pathWithLeadingSlash;\n }\n\n return `/${locale}${pathWithLeadingSlash}`;\n}\n\nfunction withBasePath(path: string, basePath = \"\"): string {\n if (!basePath) return path;\n return basePath + path;\n}\n\nexport function getDomainLocaleUrl(\n url: string,\n locale: string,\n {\n basePath,\n currentHostname,\n domainItems,\n }: {\n basePath?: string;\n currentHostname?: string | null;\n domainItems?: readonly DomainLocale[];\n },\n): string | undefined {\n if (!domainItems?.length) return undefined;\n\n const targetDomain = detectDomainLocale(domainItems, undefined, locale);\n if (!targetDomain) return undefined;\n\n const currentDomain = detectDomainLocale(domainItems, currentHostname ?? undefined);\n const localizedPath = addLocalePrefix(url, locale, targetDomain.defaultLocale);\n\n if (\n currentDomain &&\n normalizeDomainHostname(currentDomain.domain) === normalizeDomainHostname(targetDomain.domain)\n ) {\n // Same-domain switches fall back to the caller's standard locale-prefix\n // logic. This relies on __VINEXT_DEFAULT_LOCALE__ matching the current\n // domain's defaultLocale, which the server entry keeps in sync.\n return undefined;\n }\n\n const scheme = `http${targetDomain.http ? \"\" : \"s\"}://`;\n return `${scheme}${targetDomain.domain}${withBasePath(localizedPath, basePath)}`;\n}\n"],"mappings":";AAIA,SAAgB,wBAAwB,UAAyD;AAC/F,KAAI,CAAC,SAAU,QAAO,KAAA;AACtB,QAAO,SAAS,MAAM,KAAK,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC,IAAI,aAAa,IAAI,KAAA;;;;;;;;;AAU9E,SAAgB,mBACd,aACA,UACA,gBAC0B;AAC1B,KAAI,CAAC,aAAa,OAAQ,QAAO,KAAA;CAEjC,MAAM,qBAAqB,wBAAwB,SAAS;CAC5D,MAAM,mBAAmB,gBAAgB,aAAa;AAEtD,MAAK,MAAM,QAAQ,YAEjB,KACE,uBAFqB,wBAAwB,KAAK,OAAO,IAGzD,qBAAqB,KAAK,cAAc,aAAa,IACrD,KAAK,SAAS,MAAM,WAAW,OAAO,aAAa,KAAK,iBAAiB,CAEzE,QAAO;;AAOb,SAAgB,gBAAgB,MAAc,QAAgB,eAA+B;CAC3F,MAAM,mBAAmB,OAAO,aAAa;AAC7C,KAAI,qBAAqB,cAAc,aAAa,CAAE,QAAO;CAE7D,MAAM,uBAAuB,KAAK,WAAW,IAAI,GAAG,OAAO,IAAI;CAE/D,MAAM,sBADW,qBAAqB,MAAM,QAAQ,EAAE,CAAC,MAAM,sBACzB,aAAa;CACjD,MAAM,eAAe,IAAI;AAEzB,KAAI,uBAAuB,gBAAgB,mBAAmB,WAAW,GAAG,aAAa,GAAG,CAC1F,QAAO,KAAK,WAAW,IAAI,GAAG,OAAO;AAGvC,QAAO,IAAI,SAAS;;AAGtB,SAAS,aAAa,MAAc,WAAW,IAAY;AACzD,KAAI,CAAC,SAAU,QAAO;AACtB,QAAO,WAAW;;AAGpB,SAAgB,mBACd,KACA,QACA,EACE,UACA,iBACA,eAMkB;AACpB,KAAI,CAAC,aAAa,OAAQ,QAAO,KAAA;CAEjC,MAAM,eAAe,mBAAmB,aAAa,KAAA,GAAW,OAAO;AACvE,KAAI,CAAC,aAAc,QAAO,KAAA;CAE1B,MAAM,gBAAgB,mBAAmB,aAAa,mBAAmB,KAAA,EAAU;CACnF,MAAM,gBAAgB,gBAAgB,KAAK,QAAQ,aAAa,cAAc;AAE9E,KACE,iBACA,wBAAwB,cAAc,OAAO,KAAK,wBAAwB,aAAa,OAAO,CAK9F;AAIF,QAAO,GADQ,OAAO,aAAa,OAAO,KAAK,IAAI,OAChC,aAAa,SAAS,aAAa,eAAe,SAAS"}
|
package/dist/utils/hash.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
//#region src/utils/hash.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* FNV-1a hash producing a 64-bit result (two 32-bit rounds with different seeds).
|
|
3
4
|
* Used for deterministic key generation where collisions must be rare.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
declare function fnv1a64(input: string): string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { fnv1a64 };
|
|
6
9
|
//# sourceMappingURL=hash.d.ts.map
|
package/dist/utils/hash.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
//#region src/utils/hash.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return h1.toString(36) + h2.toString(36);
|
|
3
|
+
* FNV-1a hash producing a 64-bit result (two 32-bit rounds with different seeds).
|
|
4
|
+
* Used for deterministic key generation where collisions must be rare.
|
|
5
|
+
*/
|
|
6
|
+
function fnv1a64(input) {
|
|
7
|
+
let h1 = 2166136261;
|
|
8
|
+
for (let i = 0; i < input.length; i++) {
|
|
9
|
+
h1 ^= input.charCodeAt(i);
|
|
10
|
+
h1 = h1 * 16777619 >>> 0;
|
|
11
|
+
}
|
|
12
|
+
let h2 = 84696351;
|
|
13
|
+
for (let i = 0; i < input.length; i++) {
|
|
14
|
+
h2 ^= input.charCodeAt(i);
|
|
15
|
+
h2 = h2 * 16777619 >>> 0;
|
|
16
|
+
}
|
|
17
|
+
return h1.toString(36) + h2.toString(36);
|
|
19
18
|
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { fnv1a64 };
|
|
21
|
+
|
|
20
22
|
//# sourceMappingURL=hash.js.map
|
package/dist/utils/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","
|
|
1
|
+
{"version":3,"file":"hash.js","names":[],"sources":["../../src/utils/hash.ts"],"sourcesContent":["/**\n * FNV-1a hash producing a 64-bit result (two 32-bit rounds with different seeds).\n * Used for deterministic key generation where collisions must be rare.\n */\nexport function fnv1a64(input: string): string {\n // First 32-bit round with standard FNV offset basis\n let h1 = 0x811c9dc5;\n for (let i = 0; i < input.length; i++) {\n h1 ^= input.charCodeAt(i);\n h1 = (h1 * 0x01000193) >>> 0;\n }\n // Second 32-bit round with different seed\n let h2 = 0x050c5d1f;\n for (let i = 0; i < input.length; i++) {\n h2 ^= input.charCodeAt(i);\n h2 = (h2 * 0x01000193) >>> 0;\n }\n return h1.toString(36) + h2.toString(36);\n}\n"],"mappings":";;;;;AAIA,SAAgB,QAAQ,OAAuB;CAE7C,IAAI,KAAK;AACT,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,QAAM,MAAM,WAAW,EAAE;AACzB,OAAM,KAAK,aAAgB;;CAG7B,IAAI,KAAK;AACT,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,QAAM,MAAM,WAAW,EAAE;AACzB,OAAM,KAAK,aAAgB;;AAE7B,QAAO,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,GAAG"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/utils/manifest-paths.d.ts
|
|
2
|
+
declare function normalizeManifestFile(file: string): string;
|
|
3
|
+
declare function manifestFileWithBase(file: string, base: string): string;
|
|
4
|
+
declare function manifestFilesWithBase(files: string[], base: string): string[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { manifestFileWithBase, manifestFilesWithBase, normalizeManifestFile };
|
|
4
7
|
//# sourceMappingURL=manifest-paths.d.ts.map
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/manifest-paths.ts
|
|
2
|
+
function normalizeManifestFile(file) {
|
|
3
|
+
return file.startsWith("/") ? file.slice(1) : file;
|
|
3
4
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (!normalizedBase)
|
|
12
|
-
return normalizedFile;
|
|
13
|
-
if (normalizedFile.startsWith(normalizedBase + "/"))
|
|
14
|
-
return normalizedFile;
|
|
15
|
-
return normalizedBase + "/" + normalizedFile;
|
|
5
|
+
function manifestFileWithBase(file, base) {
|
|
6
|
+
const normalizedFile = normalizeManifestFile(file);
|
|
7
|
+
if (!base || base === "/") return normalizedFile;
|
|
8
|
+
const normalizedBase = normalizeManifestFile(base).replace(/\/+$/, "");
|
|
9
|
+
if (!normalizedBase) return normalizedFile;
|
|
10
|
+
if (normalizedFile.startsWith(normalizedBase + "/")) return normalizedFile;
|
|
11
|
+
return normalizedBase + "/" + normalizedFile;
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
function manifestFilesWithBase(files, base) {
|
|
14
|
+
return files.map((file) => manifestFileWithBase(file, base));
|
|
19
15
|
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { manifestFileWithBase, manifestFilesWithBase, normalizeManifestFile };
|
|
18
|
+
|
|
20
19
|
//# sourceMappingURL=manifest-paths.js.map
|