@inlang/paraglide-js 2.23.1 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundler-plugins/esbuild.d.ts +0 -1
- package/dist/bundler-plugins/esbuild.js.map +1 -1
- package/dist/bundler-plugins/index.d.ts +0 -1
- package/dist/bundler-plugins/index.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/constants.d.ts +0 -1
- package/dist/bundler-plugins/per-locale-build/constants.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/index.d.ts +0 -1
- package/dist/bundler-plugins/per-locale-build/index.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts +0 -1
- package/dist/bundler-plugins/per-locale-build/locale-id.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/types.d.ts +0 -1
- package/dist/bundler-plugins/per-locale-build/types.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts +0 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.js +12 -7
- package/dist/bundler-plugins/per-locale-build/vite-environments.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts +0 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -1
- package/dist/bundler-plugins/rolldown.d.ts +0 -1
- package/dist/bundler-plugins/rolldown.js.map +1 -1
- package/dist/bundler-plugins/rollup.d.ts +0 -1
- package/dist/bundler-plugins/rollup.js.map +1 -1
- package/dist/bundler-plugins/rspack.d.ts +0 -1
- package/dist/bundler-plugins/rspack.js.map +1 -1
- package/dist/bundler-plugins/unplugin.d.ts +0 -1
- package/dist/bundler-plugins/unplugin.js +134 -4
- package/dist/bundler-plugins/unplugin.js.map +1 -1
- package/dist/bundler-plugins/unplugin.test.d.ts +0 -1
- package/dist/bundler-plugins/unplugin.test.js +77 -0
- package/dist/bundler-plugins/unplugin.test.js.map +1 -1
- package/dist/bundler-plugins/vite.d.ts +0 -1
- package/dist/bundler-plugins/vite.js.map +1 -1
- package/dist/bundler-plugins/vite.test.d.ts +0 -1
- package/dist/bundler-plugins/vite.test.js.map +1 -1
- package/dist/bundler-plugins/webpack.d.ts +0 -1
- package/dist/bundler-plugins/webpack.js.map +1 -1
- package/dist/cli/commands/compile/command.d.ts +0 -1
- package/dist/cli/commands/compile/command.js +8 -1
- package/dist/cli/commands/compile/command.js.map +1 -1
- package/dist/cli/commands/compile/command.test.d.ts +0 -1
- package/dist/cli/commands/compile/command.test.js +45 -0
- package/dist/cli/commands/compile/command.test.js.map +1 -1
- package/dist/cli/commands/init/command.d.ts +0 -1
- package/dist/cli/commands/init/command.js.map +1 -1
- package/dist/cli/defaults.d.ts +0 -1
- package/dist/cli/defaults.js.map +1 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/steps/add-vite-plugin.d.ts +0 -1
- package/dist/cli/steps/add-vite-plugin.js.map +1 -1
- package/dist/cli/steps/add-vite-plugin.test.d.ts +0 -1
- package/dist/cli/steps/add-vite-plugin.test.js.map +1 -1
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts +0 -1
- package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -1
- package/dist/cli/steps/detect-bundler.d.ts +0 -1
- package/dist/cli/steps/detect-bundler.js.map +1 -1
- package/dist/cli/steps/detect-bundler.test.d.ts +0 -1
- package/dist/cli/steps/detect-bundler.test.js.map +1 -1
- package/dist/cli/steps/initialize-inlang-project.d.ts +0 -1
- package/dist/cli/steps/initialize-inlang-project.js.map +1 -1
- package/dist/cli/steps/maybe-add-machine-translation.d.ts +0 -1
- package/dist/cli/steps/maybe-add-machine-translation.js.map +1 -1
- package/dist/cli/steps/maybe-add-sherlock.d.ts +0 -1
- package/dist/cli/steps/maybe-add-sherlock.js.map +1 -1
- package/dist/cli/steps/prompt-for-outdir.d.ts +0 -1
- package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
- package/dist/cli/steps/update-package-json.d.ts +0 -1
- package/dist/cli/steps/update-package-json.js.map +1 -1
- package/dist/cli/steps/update-ts-config.d.ts +0 -1
- package/dist/cli/steps/update-ts-config.js.map +1 -1
- package/dist/cli/steps/update-ts-config.test.d.ts +0 -1
- package/dist/cli/steps/update-ts-config.test.js.map +1 -1
- package/dist/cli/utils.d.ts +0 -1
- package/dist/cli/utils.js.map +1 -1
- package/dist/compiler/compile-annotation.d.ts +0 -1
- package/dist/compiler/compile-annotation.js.map +1 -1
- package/dist/compiler/compile-bundle.d.ts +0 -1
- package/dist/compiler/compile-bundle.js.map +1 -1
- package/dist/compiler/compile-bundle.test.d.ts +0 -1
- package/dist/compiler/compile-bundle.test.js.map +1 -1
- package/dist/compiler/compile-local-variable.d.ts +0 -1
- package/dist/compiler/compile-local-variable.js.map +1 -1
- package/dist/compiler/compile-local-variable.test.d.ts +0 -1
- package/dist/compiler/compile-local-variable.test.js.map +1 -1
- package/dist/compiler/compile-message.d.ts +0 -1
- package/dist/compiler/compile-message.js.map +1 -1
- package/dist/compiler/compile-message.test.d.ts +0 -1
- package/dist/compiler/compile-message.test.js.map +1 -1
- package/dist/compiler/compile-pattern.d.ts +0 -1
- package/dist/compiler/compile-pattern.js.map +1 -1
- package/dist/compiler/compile-pattern.test.d.ts +0 -1
- package/dist/compiler/compile-pattern.test.js.map +1 -1
- package/dist/compiler/compile-project.d.ts +0 -1
- package/dist/compiler/compile-project.js.map +1 -1
- package/dist/compiler/compile-project.test.d.ts +0 -1
- package/dist/compiler/compile-project.test.js.map +1 -1
- package/dist/compiler/compile.bench.d.ts +0 -1
- package/dist/compiler/compile.bench.js.map +1 -1
- package/dist/compiler/compile.d.ts +0 -1
- package/dist/compiler/compile.js +0 -15
- package/dist/compiler/compile.js.map +1 -1
- package/dist/compiler/compile.test.d.ts +0 -1
- package/dist/compiler/compile.test.js +0 -52
- package/dist/compiler/compile.test.js.map +1 -1
- package/dist/compiler/compiler-options.d.ts +8 -1
- package/dist/compiler/compiler-options.js.map +1 -1
- package/dist/compiler/create-paraglide.d.ts +0 -1
- package/dist/compiler/create-paraglide.js.map +1 -1
- package/dist/compiler/create-paraglide.test.d.ts +0 -1
- package/dist/compiler/create-paraglide.test.js.map +1 -1
- package/dist/compiler/create-readme.d.ts +0 -1
- package/dist/compiler/create-readme.js.map +1 -1
- package/dist/compiler/emit-ts-declarations.d.ts +0 -1
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts +0 -1
- package/dist/compiler/emit-ts-declarations.interop.test.js.map +1 -1
- package/dist/compiler/emit-ts-declarations.js.map +1 -1
- package/dist/compiler/emit-ts-declarations.test.d.ts +0 -1
- package/dist/compiler/emit-ts-declarations.test.js.map +1 -1
- package/dist/compiler/index.d.ts +0 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/jsdoc-types.d.ts +0 -1
- package/dist/compiler/jsdoc-types.js.map +1 -1
- package/dist/compiler/jsdoc-types.test.d.ts +0 -1
- package/dist/compiler/jsdoc-types.test.js.map +1 -1
- package/dist/compiler/match-literals.d.ts +0 -1
- package/dist/compiler/match-literals.js.map +1 -1
- package/dist/compiler/output-structure/locale-modules.d.ts +0 -1
- package/dist/compiler/output-structure/locale-modules.js.map +1 -1
- package/dist/compiler/output-structure/locale-modules.test.d.ts +0 -1
- package/dist/compiler/output-structure/locale-modules.test.js.map +1 -1
- package/dist/compiler/output-structure/message-modules.d.ts +0 -1
- package/dist/compiler/output-structure/message-modules.js.map +1 -1
- package/dist/compiler/output-structure/message-modules.test.d.ts +0 -1
- package/dist/compiler/output-structure/message-modules.test.js.map +1 -1
- package/dist/compiler/per-locale-build.d.ts +0 -1
- package/dist/compiler/per-locale-build.js.map +1 -1
- package/dist/compiler/registry.d.ts +0 -1
- package/dist/compiler/registry.js.map +1 -1
- package/dist/compiler/resolve-tsc-js-path.d.ts +0 -1
- package/dist/compiler/resolve-tsc-js-path.js.map +1 -1
- package/dist/compiler/runtime/check-locale.d.ts +0 -1
- package/dist/compiler/runtime/check-locale.js.map +1 -1
- package/dist/compiler/runtime/check-locale.test.d.ts +0 -1
- package/dist/compiler/runtime/check-locale.test.js.map +1 -1
- package/dist/compiler/runtime/create-runtime.d.ts +1 -1
- package/dist/compiler/runtime/create-runtime.js +11 -0
- package/dist/compiler/runtime/create-runtime.js.map +1 -1
- package/dist/compiler/runtime/exec-url-pattern.d.ts +9 -0
- package/dist/compiler/runtime/exec-url-pattern.js +31 -0
- package/dist/compiler/runtime/exec-url-pattern.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-header.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-header.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-header.test.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-header.test.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.test.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.test.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-request.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request.test.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-request.test.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-url.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-url.js +8 -3
- package/dist/compiler/runtime/extract-locale-from-url.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-url.test.d.ts +0 -1
- package/dist/compiler/runtime/extract-locale-from-url.test.js.map +1 -1
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts +0 -1
- package/dist/compiler/runtime/generate-static-localized-urls.js +12 -6
- package/dist/compiler/runtime/generate-static-localized-urls.js.map +1 -1
- package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts +0 -1
- package/dist/compiler/runtime/generate-static-localized-urls.test.js +46 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.js.map +1 -1
- package/dist/compiler/runtime/get-locale.d.ts +0 -1
- package/dist/compiler/runtime/get-locale.js.map +1 -1
- package/dist/compiler/runtime/get-locale.test.d.ts +0 -1
- package/dist/compiler/runtime/get-locale.test.js.map +1 -1
- package/dist/compiler/runtime/get-text-direction.d.ts +0 -1
- package/dist/compiler/runtime/get-text-direction.js.map +1 -1
- package/dist/compiler/runtime/get-text-direction.test.d.ts +0 -1
- package/dist/compiler/runtime/get-text-direction.test.js.map +1 -1
- package/dist/compiler/runtime/get-url-origin.d.ts +0 -1
- package/dist/compiler/runtime/get-url-origin.js.map +1 -1
- package/dist/compiler/runtime/get-url-origin.test.d.ts +0 -1
- package/dist/compiler/runtime/get-url-origin.test.js.map +1 -1
- package/dist/compiler/runtime/localize-href.bench.d.ts +1 -0
- package/dist/compiler/runtime/localize-href.bench.js +77 -0
- package/dist/compiler/runtime/localize-href.bench.js.map +1 -0
- package/dist/compiler/runtime/localize-href.d.ts +0 -1
- package/dist/compiler/runtime/localize-href.js.map +1 -1
- package/dist/compiler/runtime/localize-href.test.d.ts +0 -1
- package/dist/compiler/runtime/localize-href.test.js +43 -0
- package/dist/compiler/runtime/localize-href.test.js.map +1 -1
- package/dist/compiler/runtime/localize-url.d.ts +14 -1
- package/dist/compiler/runtime/localize-url.js +376 -18
- package/dist/compiler/runtime/localize-url.js.map +1 -1
- package/dist/compiler/runtime/localize-url.test.d.ts +0 -1
- package/dist/compiler/runtime/localize-url.test.js +163 -0
- package/dist/compiler/runtime/localize-url.test.js.map +1 -1
- package/dist/compiler/runtime/normalize-trailing-slash.d.ts +10 -0
- package/dist/compiler/runtime/normalize-trailing-slash.js +23 -0
- package/dist/compiler/runtime/normalize-trailing-slash.js.map +1 -0
- package/dist/compiler/runtime/route-strategy.d.ts +0 -1
- package/dist/compiler/runtime/route-strategy.js +4 -2
- package/dist/compiler/runtime/route-strategy.js.map +1 -1
- package/dist/compiler/runtime/set-locale.d.ts +0 -1
- package/dist/compiler/runtime/set-locale.js.map +1 -1
- package/dist/compiler/runtime/set-locale.test.d.ts +0 -1
- package/dist/compiler/runtime/set-locale.test.js.map +1 -1
- package/dist/compiler/runtime/should-redirect.d.ts +0 -1
- package/dist/compiler/runtime/should-redirect.js +4 -1
- package/dist/compiler/runtime/should-redirect.js.map +1 -1
- package/dist/compiler/runtime/should-redirect.test.d.ts +0 -1
- package/dist/compiler/runtime/should-redirect.test.js +30 -2
- package/dist/compiler/runtime/should-redirect.test.js.map +1 -1
- package/dist/compiler/runtime/strategy.d.ts +0 -1
- package/dist/compiler/runtime/strategy.js.map +1 -1
- package/dist/compiler/runtime/strategy.test.d.ts +0 -1
- package/dist/compiler/runtime/strategy.test.js.map +1 -1
- package/dist/compiler/runtime/track-message-call.d.ts +0 -1
- package/dist/compiler/runtime/track-message-call.js.map +1 -1
- package/dist/compiler/runtime/track-message-call.test.d.ts +0 -1
- package/dist/compiler/runtime/track-message-call.test.js.map +1 -1
- package/dist/compiler/runtime/type-definitions.d.ts +0 -1
- package/dist/compiler/runtime/type-definitions.js.map +1 -1
- package/dist/compiler/runtime/type.d.ts +1 -1
- package/dist/compiler/runtime/type.js.map +1 -1
- package/dist/compiler/runtime/type.test.d.ts +0 -1
- package/dist/compiler/runtime/type.test.js.map +1 -1
- package/dist/compiler/runtime/variables.d.ts +6 -1
- package/dist/compiler/runtime/variables.js +6 -0
- package/dist/compiler/runtime/variables.js.map +1 -1
- package/dist/compiler/safe-module-id.d.ts +0 -1
- package/dist/compiler/safe-module-id.js.map +1 -1
- package/dist/compiler/safe-module-id.test.d.ts +0 -1
- package/dist/compiler/safe-module-id.test.js.map +1 -1
- package/dist/compiler/seed-previous-compilation.d.ts +0 -1
- package/dist/compiler/seed-previous-compilation.js.map +1 -1
- package/dist/compiler/server/create-server-file.d.ts +0 -1
- package/dist/compiler/server/create-server-file.js.map +1 -1
- package/dist/compiler/server/create-server-file.test.d.ts +0 -1
- package/dist/compiler/server/create-server-file.test.js.map +1 -1
- package/dist/compiler/server/middleware.d.ts +0 -1
- package/dist/compiler/server/middleware.js +6 -2
- package/dist/compiler/server/middleware.js.map +1 -1
- package/dist/compiler/server/middleware.test.d.ts +0 -1
- package/dist/compiler/server/middleware.test.js +34 -0
- package/dist/compiler/server/middleware.test.js.map +1 -1
- package/dist/compiler/server/type.d.ts +0 -1
- package/dist/compiler/server/type.js.map +1 -1
- package/dist/compiler/types.d.ts +0 -1
- package/dist/compiler/types.js.map +1 -1
- package/dist/compiler/variable-access.d.ts +0 -1
- package/dist/compiler/variable-access.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +9 -0
- package/dist/index.test.js.map +1 -0
- package/dist/services/codegen/escape.d.ts +0 -1
- package/dist/services/codegen/escape.js.map +1 -1
- package/dist/services/codegen/quotes.d.ts +0 -1
- package/dist/services/codegen/quotes.js.map +1 -1
- package/dist/services/env-variables/create-index-file.d.ts +0 -1
- package/dist/services/env-variables/create-index-file.js.map +1 -1
- package/dist/services/env-variables/index.d.ts +0 -1
- package/dist/services/env-variables/index.js +1 -1
- package/dist/services/env-variables/index.js.map +1 -1
- package/dist/services/environment/package.d.ts +0 -1
- package/dist/services/environment/package.js.map +1 -1
- package/dist/services/environment/package.test.d.ts +0 -1
- package/dist/services/environment/package.test.js.map +1 -1
- package/dist/services/error-handling.d.ts +0 -1
- package/dist/services/error-handling.js.map +1 -1
- package/dist/services/error-handling.test.d.ts +0 -1
- package/dist/services/error-handling.test.js.map +1 -1
- package/dist/services/file-handling/exists.d.ts +0 -1
- package/dist/services/file-handling/exists.js.map +1 -1
- package/dist/services/file-handling/exists.test.d.ts +0 -1
- package/dist/services/file-handling/exists.test.js.map +1 -1
- package/dist/services/file-handling/types.d.ts +0 -1
- package/dist/services/file-handling/types.js.map +1 -1
- package/dist/services/file-handling/write-output.bench.d.ts +1 -0
- package/dist/services/file-handling/write-output.bench.js +24 -0
- package/dist/services/file-handling/write-output.bench.js.map +1 -0
- package/dist/services/file-handling/write-output.d.ts +0 -1
- package/dist/services/file-handling/write-output.js +16 -20
- package/dist/services/file-handling/write-output.js.map +1 -1
- package/dist/services/file-handling/write-output.test.d.ts +0 -1
- package/dist/services/file-handling/write-output.test.js +27 -0
- package/dist/services/file-handling/write-output.test.js.map +1 -1
- package/dist/services/file-watching/tracked-fs.d.ts +0 -1
- package/dist/services/file-watching/tracked-fs.js.map +1 -1
- package/dist/services/file-watching/tracked-fs.test.d.ts +0 -1
- package/dist/services/file-watching/tracked-fs.test.js.map +1 -1
- package/dist/services/logger/index.d.ts +0 -1
- package/dist/services/logger/index.js.map +1 -1
- package/dist/services/lookup.d.ts +0 -1
- package/dist/services/lookup.js.map +1 -1
- package/dist/urlpattern-polyfill/index.d.ts +0 -1
- package/dist/urlpattern-polyfill/index.js.map +1 -1
- package/dist/utilities/detect-json-formatting.d.ts +0 -1
- package/dist/utilities/detect-json-formatting.js.map +1 -1
- package/dist/utilities/node-normalize-path.d.ts +0 -1
- package/dist/utilities/node-normalize-path.js.map +1 -1
- package/package.json +2 -2
- package/dist/bundler-plugins/esbuild.d.ts.map +0 -1
- package/dist/bundler-plugins/index.d.ts.map +0 -1
- package/dist/bundler-plugins/per-locale-build/constants.d.ts.map +0 -1
- package/dist/bundler-plugins/per-locale-build/index.d.ts.map +0 -1
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts.map +0 -1
- package/dist/bundler-plugins/per-locale-build/types.d.ts.map +0 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts.map +0 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts.map +0 -1
- package/dist/bundler-plugins/rolldown.d.ts.map +0 -1
- package/dist/bundler-plugins/rollup.d.ts.map +0 -1
- package/dist/bundler-plugins/rspack.d.ts.map +0 -1
- package/dist/bundler-plugins/unplugin.d.ts.map +0 -1
- package/dist/bundler-plugins/unplugin.test.d.ts.map +0 -1
- package/dist/bundler-plugins/vite.d.ts.map +0 -1
- package/dist/bundler-plugins/vite.test.d.ts.map +0 -1
- package/dist/bundler-plugins/webpack.d.ts.map +0 -1
- package/dist/cli/commands/compile/command.d.ts.map +0 -1
- package/dist/cli/commands/compile/command.test.d.ts.map +0 -1
- package/dist/cli/commands/init/command.d.ts.map +0 -1
- package/dist/cli/defaults.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/steps/add-vite-plugin.d.ts.map +0 -1
- package/dist/cli/steps/add-vite-plugin.test.d.ts.map +0 -1
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +0 -1
- package/dist/cli/steps/detect-bundler.d.ts.map +0 -1
- package/dist/cli/steps/detect-bundler.test.d.ts.map +0 -1
- package/dist/cli/steps/initialize-inlang-project.d.ts.map +0 -1
- package/dist/cli/steps/maybe-add-machine-translation.d.ts.map +0 -1
- package/dist/cli/steps/maybe-add-sherlock.d.ts.map +0 -1
- package/dist/cli/steps/prompt-for-outdir.d.ts.map +0 -1
- package/dist/cli/steps/update-package-json.d.ts.map +0 -1
- package/dist/cli/steps/update-ts-config.d.ts.map +0 -1
- package/dist/cli/steps/update-ts-config.test.d.ts.map +0 -1
- package/dist/cli/utils.d.ts.map +0 -1
- package/dist/compiler/compile-annotation.d.ts.map +0 -1
- package/dist/compiler/compile-bundle.d.ts.map +0 -1
- package/dist/compiler/compile-bundle.test.d.ts.map +0 -1
- package/dist/compiler/compile-local-variable.d.ts.map +0 -1
- package/dist/compiler/compile-local-variable.test.d.ts.map +0 -1
- package/dist/compiler/compile-message.d.ts.map +0 -1
- package/dist/compiler/compile-message.test.d.ts.map +0 -1
- package/dist/compiler/compile-pattern.d.ts.map +0 -1
- package/dist/compiler/compile-pattern.test.d.ts.map +0 -1
- package/dist/compiler/compile-project.d.ts.map +0 -1
- package/dist/compiler/compile-project.test.d.ts.map +0 -1
- package/dist/compiler/compile.bench.d.ts.map +0 -1
- package/dist/compiler/compile.d.ts.map +0 -1
- package/dist/compiler/compile.test.d.ts.map +0 -1
- package/dist/compiler/compiler-options.d.ts.map +0 -1
- package/dist/compiler/create-paraglide.d.ts.map +0 -1
- package/dist/compiler/create-paraglide.test.d.ts.map +0 -1
- package/dist/compiler/create-readme.d.ts.map +0 -1
- package/dist/compiler/emit-ts-declarations.d.ts.map +0 -1
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts.map +0 -1
- package/dist/compiler/emit-ts-declarations.test.d.ts.map +0 -1
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/jsdoc-types.d.ts.map +0 -1
- package/dist/compiler/jsdoc-types.test.d.ts.map +0 -1
- package/dist/compiler/match-literals.d.ts.map +0 -1
- package/dist/compiler/output-structure/locale-modules.d.ts.map +0 -1
- package/dist/compiler/output-structure/locale-modules.test.d.ts.map +0 -1
- package/dist/compiler/output-structure/message-modules.d.ts.map +0 -1
- package/dist/compiler/output-structure/message-modules.test.d.ts.map +0 -1
- package/dist/compiler/per-locale-build.d.ts.map +0 -1
- package/dist/compiler/registry.d.ts.map +0 -1
- package/dist/compiler/resolve-tsc-js-path.d.ts.map +0 -1
- package/dist/compiler/runtime/check-locale.d.ts.map +0 -1
- package/dist/compiler/runtime/check-locale.test.d.ts.map +0 -1
- package/dist/compiler/runtime/create-runtime.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-header.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-header.test.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-request.test.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-url.d.ts.map +0 -1
- package/dist/compiler/runtime/extract-locale-from-url.test.d.ts.map +0 -1
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +0 -1
- package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts.map +0 -1
- package/dist/compiler/runtime/get-locale.d.ts.map +0 -1
- package/dist/compiler/runtime/get-locale.test.d.ts.map +0 -1
- package/dist/compiler/runtime/get-text-direction.d.ts.map +0 -1
- package/dist/compiler/runtime/get-text-direction.test.d.ts.map +0 -1
- package/dist/compiler/runtime/get-url-origin.d.ts.map +0 -1
- package/dist/compiler/runtime/get-url-origin.test.d.ts.map +0 -1
- package/dist/compiler/runtime/localize-href.d.ts.map +0 -1
- package/dist/compiler/runtime/localize-href.test.d.ts.map +0 -1
- package/dist/compiler/runtime/localize-url.d.ts.map +0 -1
- package/dist/compiler/runtime/localize-url.test.d.ts.map +0 -1
- package/dist/compiler/runtime/route-strategy.d.ts.map +0 -1
- package/dist/compiler/runtime/set-locale.d.ts.map +0 -1
- package/dist/compiler/runtime/set-locale.test.d.ts.map +0 -1
- package/dist/compiler/runtime/should-redirect.d.ts.map +0 -1
- package/dist/compiler/runtime/should-redirect.test.d.ts.map +0 -1
- package/dist/compiler/runtime/strategy.d.ts.map +0 -1
- package/dist/compiler/runtime/strategy.test.d.ts.map +0 -1
- package/dist/compiler/runtime/track-message-call.d.ts.map +0 -1
- package/dist/compiler/runtime/track-message-call.test.d.ts.map +0 -1
- package/dist/compiler/runtime/type-definitions.d.ts.map +0 -1
- package/dist/compiler/runtime/type.d.ts.map +0 -1
- package/dist/compiler/runtime/type.test.d.ts.map +0 -1
- package/dist/compiler/runtime/variables.d.ts.map +0 -1
- package/dist/compiler/safe-module-id.d.ts.map +0 -1
- package/dist/compiler/safe-module-id.test.d.ts.map +0 -1
- package/dist/compiler/seed-previous-compilation.d.ts.map +0 -1
- package/dist/compiler/server/create-server-file.d.ts.map +0 -1
- package/dist/compiler/server/create-server-file.test.d.ts.map +0 -1
- package/dist/compiler/server/middleware.d.ts.map +0 -1
- package/dist/compiler/server/middleware.test.d.ts.map +0 -1
- package/dist/compiler/server/type.d.ts.map +0 -1
- package/dist/compiler/types.d.ts.map +0 -1
- package/dist/compiler/variable-access.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/services/account/index.d.ts +0 -15
- package/dist/services/account/index.d.ts.map +0 -1
- package/dist/services/account/index.js +0 -43
- package/dist/services/account/index.js.map +0 -1
- package/dist/services/codegen/escape.d.ts.map +0 -1
- package/dist/services/codegen/quotes.d.ts.map +0 -1
- package/dist/services/env-variables/create-index-file.d.ts.map +0 -1
- package/dist/services/env-variables/index.d.ts.map +0 -1
- package/dist/services/environment/package.d.ts.map +0 -1
- package/dist/services/environment/package.test.d.ts.map +0 -1
- package/dist/services/error-handling.d.ts.map +0 -1
- package/dist/services/error-handling.test.d.ts.map +0 -1
- package/dist/services/file-handling/exists.d.ts.map +0 -1
- package/dist/services/file-handling/exists.test.d.ts.map +0 -1
- package/dist/services/file-handling/types.d.ts.map +0 -1
- package/dist/services/file-handling/write-output.d.ts.map +0 -1
- package/dist/services/file-handling/write-output.test.d.ts.map +0 -1
- package/dist/services/file-watching/tracked-fs.d.ts.map +0 -1
- package/dist/services/file-watching/tracked-fs.test.d.ts.map +0 -1
- package/dist/services/logger/index.d.ts.map +0 -1
- package/dist/services/lookup.d.ts.map +0 -1
- package/dist/urlpattern-polyfill/index.d.ts.map +0 -1
- package/dist/utilities/detect-json-formatting.d.ts.map +0 -1
- package/dist/utilities/node-normalize-path.d.ts.map +0 -1
|
@@ -2,7 +2,9 @@ import { extractLocaleFromUrl } from "./extract-locale-from-url.js";
|
|
|
2
2
|
import { getLocale } from "./get-locale.js";
|
|
3
3
|
import { getUrlOrigin } from "./get-url-origin.js";
|
|
4
4
|
import { assertIsLocale, toLocale } from "./check-locale.js";
|
|
5
|
-
import { baseLocale, TREE_SHAKE_DEFAULT_URL_PATTERN_USED, urlPatterns, } from "./variables.js";
|
|
5
|
+
import { baseLocale, TREE_SHAKE_DEFAULT_URL_PATTERN_USED, trailingSlash, urlPatterns, } from "./variables.js";
|
|
6
|
+
import { normalizeTrailingSlash } from "./normalize-trailing-slash.js";
|
|
7
|
+
import { execUrlPattern } from "./exec-url-pattern.js";
|
|
6
8
|
/**
|
|
7
9
|
* Lower-level URL localization function, primarily used in server contexts.
|
|
8
10
|
*
|
|
@@ -54,12 +56,24 @@ export function localizeUrl(url, options) {
|
|
|
54
56
|
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
55
57
|
return localizeUrlDefaultPattern(url, targetLocale);
|
|
56
58
|
}
|
|
57
|
-
const
|
|
59
|
+
const originalUrl = typeof url === "string" ? new URL(url) : url;
|
|
60
|
+
const urlObj = trailingSlash === undefined
|
|
61
|
+
? originalUrl
|
|
62
|
+
: normalizeTrailingSlash(new URL(originalUrl));
|
|
58
63
|
// Iterate over URL patterns
|
|
59
64
|
for (const element of urlPatterns) {
|
|
65
|
+
// Most applications use a locale prefix (and sometimes a fixed domain)
|
|
66
|
+
// with a trailing catch-all path. Those routes do not need URLPattern's
|
|
67
|
+
// parser or matcher on every call. Keep the generic matcher below as the
|
|
68
|
+
// fallback for every other URLPattern shape. This stays inside the outer
|
|
69
|
+
// loop so specific patterns retain precedence over a later catch-all.
|
|
70
|
+
const fastPathLocalized = localizeUrlFastPath(urlObj, targetLocale, element);
|
|
71
|
+
if (fastPathLocalized !== undefined) {
|
|
72
|
+
return fastPathLocalized;
|
|
73
|
+
}
|
|
60
74
|
// match localized patterns
|
|
61
75
|
for (const [, localizedPattern] of element.localized) {
|
|
62
|
-
const match =
|
|
76
|
+
const match = execUrlPattern(getUrlPattern(localizedPattern, urlObj), urlObj);
|
|
63
77
|
if (!match) {
|
|
64
78
|
continue;
|
|
65
79
|
}
|
|
@@ -68,19 +82,19 @@ export function localizeUrl(url, options) {
|
|
|
68
82
|
continue;
|
|
69
83
|
}
|
|
70
84
|
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
71
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
85
|
+
return normalizeTrailingSlash(fillMissingUrlParts(localizedUrl, match));
|
|
72
86
|
}
|
|
73
|
-
const unlocalizedMatch =
|
|
87
|
+
const unlocalizedMatch = execUrlPattern(getUrlPattern(element.pattern, urlObj), urlObj);
|
|
74
88
|
if (unlocalizedMatch) {
|
|
75
89
|
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
76
90
|
if (targetPattern) {
|
|
77
91
|
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
78
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
92
|
+
return normalizeTrailingSlash(fillMissingUrlParts(localizedUrl, unlocalizedMatch));
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
}
|
|
82
96
|
// If no match found, return the original URL
|
|
83
|
-
return
|
|
97
|
+
return originalUrl;
|
|
84
98
|
}
|
|
85
99
|
/**
|
|
86
100
|
* https://github.com/opral/inlang-paraglide-js/issues/381
|
|
@@ -90,11 +104,11 @@ export function localizeUrl(url, options) {
|
|
|
90
104
|
* @returns {URL}
|
|
91
105
|
*/
|
|
92
106
|
function localizeUrlDefaultPattern(url, locale) {
|
|
93
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
107
|
+
const urlObj = normalizeTrailingSlash(typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url));
|
|
94
108
|
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
95
109
|
// If current locale matches target locale, no change needed
|
|
96
110
|
if (currentLocale === locale) {
|
|
97
|
-
return urlObj;
|
|
111
|
+
return normalizeTrailingSlash(urlObj);
|
|
98
112
|
}
|
|
99
113
|
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
100
114
|
// If current path starts with a locale, remove it
|
|
@@ -109,7 +123,7 @@ function localizeUrlDefaultPattern(url, locale) {
|
|
|
109
123
|
// For other locales, add prefix
|
|
110
124
|
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
111
125
|
}
|
|
112
|
-
return urlObj;
|
|
126
|
+
return normalizeTrailingSlash(urlObj);
|
|
113
127
|
}
|
|
114
128
|
/**
|
|
115
129
|
* Low-level URL de-localization function, primarily used in server contexts.
|
|
@@ -154,28 +168,35 @@ export function deLocalizeUrl(url) {
|
|
|
154
168
|
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
155
169
|
return deLocalizeUrlDefaultPattern(url);
|
|
156
170
|
}
|
|
157
|
-
const
|
|
171
|
+
const originalUrl = typeof url === "string" ? new URL(url) : url;
|
|
172
|
+
const urlObj = trailingSlash === undefined
|
|
173
|
+
? originalUrl
|
|
174
|
+
: normalizeTrailingSlash(new URL(originalUrl));
|
|
158
175
|
// Iterate over URL patterns
|
|
159
176
|
for (const element of urlPatterns) {
|
|
177
|
+
const fastPathDeLocalized = deLocalizeUrlFastPath(urlObj, element);
|
|
178
|
+
if (fastPathDeLocalized !== undefined) {
|
|
179
|
+
return fastPathDeLocalized;
|
|
180
|
+
}
|
|
160
181
|
// Iterate over localized versions
|
|
161
182
|
for (const [, localizedPattern] of element.localized) {
|
|
162
|
-
const match =
|
|
183
|
+
const match = execUrlPattern(getUrlPattern(localizedPattern, urlObj), urlObj);
|
|
163
184
|
if (match) {
|
|
164
185
|
// Convert localized URL back to the base pattern
|
|
165
186
|
const groups = aggregateGroups(match);
|
|
166
187
|
const baseUrl = fillPattern(element.pattern, groups, urlObj.origin);
|
|
167
|
-
return fillMissingUrlParts(baseUrl, match);
|
|
188
|
+
return normalizeTrailingSlash(fillMissingUrlParts(baseUrl, match));
|
|
168
189
|
}
|
|
169
190
|
}
|
|
170
191
|
// match unlocalized pattern
|
|
171
|
-
const unlocalizedMatch =
|
|
192
|
+
const unlocalizedMatch = execUrlPattern(getUrlPattern(element.pattern, urlObj), urlObj);
|
|
172
193
|
if (unlocalizedMatch) {
|
|
173
194
|
const baseUrl = fillPattern(element.pattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
174
|
-
return fillMissingUrlParts(baseUrl, unlocalizedMatch);
|
|
195
|
+
return normalizeTrailingSlash(fillMissingUrlParts(baseUrl, unlocalizedMatch));
|
|
175
196
|
}
|
|
176
197
|
}
|
|
177
198
|
// no match found return the original url
|
|
178
|
-
return
|
|
199
|
+
return originalUrl;
|
|
179
200
|
}
|
|
180
201
|
/**
|
|
181
202
|
* De-localizes a URL using the default pattern (/:locale/*)
|
|
@@ -183,13 +204,13 @@ export function deLocalizeUrl(url) {
|
|
|
183
204
|
* @returns {URL}
|
|
184
205
|
*/
|
|
185
206
|
function deLocalizeUrlDefaultPattern(url) {
|
|
186
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
207
|
+
const urlObj = normalizeTrailingSlash(typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url));
|
|
187
208
|
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
188
209
|
// If first segment is a locale, remove it
|
|
189
210
|
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
190
211
|
urlObj.pathname = "/" + pathSegments.slice(1).join("/");
|
|
191
212
|
}
|
|
192
|
-
return urlObj;
|
|
213
|
+
return normalizeTrailingSlash(urlObj);
|
|
193
214
|
}
|
|
194
215
|
/**
|
|
195
216
|
* Takes matches of implicit wildcards in the UrlPattern (when a part is missing
|
|
@@ -314,4 +335,341 @@ export function aggregateGroups(match) {
|
|
|
314
335
|
...match.username.groups,
|
|
315
336
|
};
|
|
316
337
|
}
|
|
338
|
+
/** @type {Map<string, URLPattern>} */
|
|
339
|
+
const urlPatternCache = new Map();
|
|
340
|
+
const URL_PATTERN_CACHE_LIMIT = 128;
|
|
341
|
+
const ABSOLUTE_URL_PATTERN = /^(?:[A-Za-z][A-Za-z\d+.-]*|:[A-Za-z][A-Za-z\d_-]*):\/\//;
|
|
342
|
+
/**
|
|
343
|
+
* URLPattern's base URL affects relative patterns. Absolute patterns only
|
|
344
|
+
* depend on the pattern itself, while root-relative patterns also depend on
|
|
345
|
+
* the URL origin. Other relative patterns are deliberately not cached because
|
|
346
|
+
* their semantics depend on the complete base URL.
|
|
347
|
+
*
|
|
348
|
+
* @param {string} pattern
|
|
349
|
+
* @param {URL} url
|
|
350
|
+
* @returns {URLPattern}
|
|
351
|
+
*/
|
|
352
|
+
function getUrlPattern(pattern, url) {
|
|
353
|
+
const isAbsolutePattern = ABSOLUTE_URL_PATTERN.test(pattern);
|
|
354
|
+
const isRootRelativePattern = pattern.startsWith("/");
|
|
355
|
+
if (!isAbsolutePattern && !isRootRelativePattern) {
|
|
356
|
+
return new URLPattern(pattern, url.href);
|
|
357
|
+
}
|
|
358
|
+
const key = isAbsolutePattern
|
|
359
|
+
? pattern
|
|
360
|
+
: JSON.stringify([url.origin, pattern]);
|
|
361
|
+
const cached = urlPatternCache.get(key);
|
|
362
|
+
if (cached !== undefined) {
|
|
363
|
+
// Refresh the entry so frequently used patterns stay in the bounded cache.
|
|
364
|
+
urlPatternCache.delete(key);
|
|
365
|
+
urlPatternCache.set(key, cached);
|
|
366
|
+
return cached;
|
|
367
|
+
}
|
|
368
|
+
const compiled = new URLPattern(pattern, url.href);
|
|
369
|
+
if (urlPatternCache.size >= URL_PATTERN_CACHE_LIMIT) {
|
|
370
|
+
const oldestKey = urlPatternCache.keys().next().value;
|
|
371
|
+
if (oldestKey !== undefined)
|
|
372
|
+
urlPatternCache.delete(oldestKey);
|
|
373
|
+
}
|
|
374
|
+
urlPatternCache.set(key, compiled);
|
|
375
|
+
return compiled;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A small, deliberately conservative subset of URLPattern routing.
|
|
379
|
+
*
|
|
380
|
+
* The compiler emits routes such as `/:path(.*)?`, `/de/:path*`, or
|
|
381
|
+
* `https://example.com/:path*`. For those routes matching is equivalent to a
|
|
382
|
+
* pathname prefix check and (optionally) an origin check. Everything that has
|
|
383
|
+
* a dynamic host, a custom path regexp, or another URLPattern modifier keeps
|
|
384
|
+
* using the generic implementation above.
|
|
385
|
+
*
|
|
386
|
+
* @typedef {{
|
|
387
|
+
* protocol: string | undefined;
|
|
388
|
+
* hostname: string | undefined;
|
|
389
|
+
* port: string | undefined;
|
|
390
|
+
* pathnamePrefix: string;
|
|
391
|
+
* pathMode: "segments" | "catch-all-optional" | "catch-all-required";
|
|
392
|
+
* }} FastPathPattern
|
|
393
|
+
* @typedef {{
|
|
394
|
+
* base: FastPathPattern;
|
|
395
|
+
* localized: Array<{ locale: string; pattern: FastPathPattern }>;
|
|
396
|
+
* }} FastPathRoute
|
|
397
|
+
*/
|
|
398
|
+
/** @type {WeakMap<object, FastPathRoute | null>} */
|
|
399
|
+
const fastPathRouteCache = new WeakMap();
|
|
400
|
+
/**
|
|
401
|
+
* @param {URL} urlObj
|
|
402
|
+
* @param {string} targetLocale
|
|
403
|
+
* @param {{ pattern: string; localized: Array<[string, string]> }} element
|
|
404
|
+
* @returns {URL | undefined}
|
|
405
|
+
*/
|
|
406
|
+
function localizeUrlFastPath(urlObj, targetLocale, element) {
|
|
407
|
+
const route = getFastPathRoute(element);
|
|
408
|
+
if (route === null)
|
|
409
|
+
return undefined;
|
|
410
|
+
// Preserve URLPattern's ordering: localized patterns are checked before
|
|
411
|
+
// the unlocalized pattern, and the first matching pattern wins.
|
|
412
|
+
for (const localized of route.localized) {
|
|
413
|
+
const suffix = matchFastPathPattern(localized.pattern, urlObj);
|
|
414
|
+
if (suffix === undefined)
|
|
415
|
+
continue;
|
|
416
|
+
const target = route.localized.find((candidate) => candidate.locale === targetLocale)?.pattern;
|
|
417
|
+
if (target === undefined)
|
|
418
|
+
continue;
|
|
419
|
+
return applyFastPathPattern(target, suffix, urlObj);
|
|
420
|
+
}
|
|
421
|
+
const suffix = matchFastPathPattern(route.base, urlObj);
|
|
422
|
+
if (suffix !== undefined) {
|
|
423
|
+
const target = route.localized.find((candidate) => candidate.locale === targetLocale)?.pattern;
|
|
424
|
+
if (target !== undefined) {
|
|
425
|
+
return applyFastPathPattern(target, suffix, urlObj);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return undefined;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @param {URL} urlObj
|
|
432
|
+
* @param {{ pattern: string; localized: Array<[string, string]> }} element
|
|
433
|
+
* @returns {URL | undefined}
|
|
434
|
+
*/
|
|
435
|
+
function deLocalizeUrlFastPath(urlObj, element) {
|
|
436
|
+
const route = getFastPathRoute(element);
|
|
437
|
+
if (route === null)
|
|
438
|
+
return undefined;
|
|
439
|
+
for (const localized of route.localized) {
|
|
440
|
+
const suffix = matchFastPathPattern(localized.pattern, urlObj);
|
|
441
|
+
if (suffix !== undefined) {
|
|
442
|
+
return applyFastPathPattern(route.base, suffix, urlObj);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const suffix = matchFastPathPattern(route.base, urlObj);
|
|
446
|
+
if (suffix !== undefined) {
|
|
447
|
+
return applyFastPathPattern(route.base, suffix, urlObj);
|
|
448
|
+
}
|
|
449
|
+
return undefined;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* @param {{ pattern: string; localized: Array<[string, string]> }} element
|
|
453
|
+
* @returns {FastPathRoute | null}
|
|
454
|
+
*/
|
|
455
|
+
function getFastPathRoute(element) {
|
|
456
|
+
const cached = fastPathRouteCache.get(element);
|
|
457
|
+
if (cached !== undefined)
|
|
458
|
+
return cached;
|
|
459
|
+
const base = parseFastPathPattern(element.pattern);
|
|
460
|
+
if (base === undefined) {
|
|
461
|
+
fastPathRouteCache.set(element, null);
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
const localized = [];
|
|
465
|
+
for (const [locale, pattern] of element.localized) {
|
|
466
|
+
const parsed = parseFastPathPattern(pattern);
|
|
467
|
+
if (parsed === undefined || parsed.pathMode !== base.pathMode) {
|
|
468
|
+
fastPathRouteCache.set(element, null);
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
localized.push({ locale, pattern: parsed });
|
|
472
|
+
}
|
|
473
|
+
const route = { base, localized };
|
|
474
|
+
fastPathRouteCache.set(element, route);
|
|
475
|
+
return route;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Parse only catch-all path patterns. In particular, do not treat `:path(.)?`
|
|
479
|
+
* as a catch-all: URLPattern's `(.)` means exactly one character and cannot be
|
|
480
|
+
* represented by this prefix matcher without changing routing semantics.
|
|
481
|
+
*
|
|
482
|
+
* @param {string} pattern
|
|
483
|
+
* @returns {FastPathPattern | undefined}
|
|
484
|
+
*/
|
|
485
|
+
function parseFastPathPattern(pattern) {
|
|
486
|
+
const wildcard = pattern.match(/\/:path(?:\(\.\*\)(?:\?)?|\*)$/);
|
|
487
|
+
if (wildcard === null || wildcard.index === undefined)
|
|
488
|
+
return undefined;
|
|
489
|
+
const prefix = pattern.slice(0, wildcard.index);
|
|
490
|
+
const originAndPath = parseFastPathOriginAndPath(prefix);
|
|
491
|
+
if (originAndPath === undefined)
|
|
492
|
+
return undefined;
|
|
493
|
+
const pathMode = wildcard[0].endsWith("*")
|
|
494
|
+
? "segments"
|
|
495
|
+
: wildcard[0].endsWith("?")
|
|
496
|
+
? "catch-all-optional"
|
|
497
|
+
: "catch-all-required";
|
|
498
|
+
return { ...originAndPath, pathMode };
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @param {string} prefix
|
|
502
|
+
* @returns {FastPathPattern | undefined}
|
|
503
|
+
*/
|
|
504
|
+
function parseFastPathOriginAndPath(prefix) {
|
|
505
|
+
if (prefix === "" || prefix.startsWith("/")) {
|
|
506
|
+
if (hasUrlPatternSyntax(prefix))
|
|
507
|
+
return undefined;
|
|
508
|
+
return {
|
|
509
|
+
protocol: undefined,
|
|
510
|
+
hostname: undefined,
|
|
511
|
+
port: undefined,
|
|
512
|
+
pathnamePrefix: normalizePathPrefix(prefix),
|
|
513
|
+
pathMode: "catch-all-optional",
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
// A `:protocol://host` pattern is common in generated configurations. The
|
|
517
|
+
// protocol is intentionally left unconstrained, just like URLPattern.
|
|
518
|
+
const dynamicProtocol = prefix.match(/^:protocol:\/\/([^/]+)(\/.*)?$/);
|
|
519
|
+
const staticOrigin = prefix.match(/^([A-Za-z][A-Za-z\d+.-]*):\/\/([^/]+)(\/.*)?$/);
|
|
520
|
+
if (dynamicProtocol !== null) {
|
|
521
|
+
const dynamicHost = dynamicProtocol[1] ?? "";
|
|
522
|
+
const hostMatch = dynamicHost.match(/^([^:(){}?*+]+)(?::(\d+))?$/);
|
|
523
|
+
if (hostMatch === null ||
|
|
524
|
+
(dynamicProtocol[2] !== undefined &&
|
|
525
|
+
hasUrlPatternSyntax(dynamicProtocol[2]))) {
|
|
526
|
+
return undefined;
|
|
527
|
+
}
|
|
528
|
+
return {
|
|
529
|
+
protocol: undefined,
|
|
530
|
+
hostname: (hostMatch[1] ?? "").toLowerCase(),
|
|
531
|
+
port: hostMatch[2],
|
|
532
|
+
pathnamePrefix: normalizePathPrefix(dynamicProtocol[2] ?? ""),
|
|
533
|
+
pathMode: "catch-all-optional",
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
if (staticOrigin === null)
|
|
537
|
+
return undefined;
|
|
538
|
+
const host = staticOrigin[2] ?? "";
|
|
539
|
+
const pathname = staticOrigin[3];
|
|
540
|
+
const hostMatch = host.match(/^([^:(){}?*+]+)(?::(\d+))?$/);
|
|
541
|
+
if (hostMatch === null ||
|
|
542
|
+
(pathname !== undefined && hasUrlPatternSyntax(pathname))) {
|
|
543
|
+
return undefined;
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
protocol: `${staticOrigin[1]}:`,
|
|
547
|
+
hostname: (hostMatch[1] ?? "").toLowerCase(),
|
|
548
|
+
port: normalizePatternPort(hostMatch[2], `${staticOrigin[1]}:`),
|
|
549
|
+
pathnamePrefix: normalizePathPrefix(pathname ?? ""),
|
|
550
|
+
pathMode: "catch-all-optional",
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* @param {string | undefined} port
|
|
555
|
+
* @param {string} protocol
|
|
556
|
+
* @returns {string | undefined}
|
|
557
|
+
*/
|
|
558
|
+
function normalizePatternPort(port, protocol) {
|
|
559
|
+
if (port === "80" && protocol === "http:")
|
|
560
|
+
return "";
|
|
561
|
+
if (port === "443" && protocol === "https:")
|
|
562
|
+
return "";
|
|
563
|
+
return port;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* @param {string} value
|
|
567
|
+
* @returns {boolean}
|
|
568
|
+
*/
|
|
569
|
+
function hasUrlPatternSyntax(value) {
|
|
570
|
+
return /[:(){}?*+]/.test(value);
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* @param {string} pathname
|
|
574
|
+
* @returns {string}
|
|
575
|
+
*/
|
|
576
|
+
function normalizePathPrefix(pathname) {
|
|
577
|
+
if (pathname === "" || pathname === "/")
|
|
578
|
+
return "/";
|
|
579
|
+
return pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* @param {FastPathPattern} pattern
|
|
583
|
+
* @param {URL} urlObj
|
|
584
|
+
* @returns {string | undefined}
|
|
585
|
+
*/
|
|
586
|
+
function matchFastPathPattern(pattern, urlObj) {
|
|
587
|
+
if (pattern.protocol !== undefined && pattern.protocol !== urlObj.protocol) {
|
|
588
|
+
return undefined;
|
|
589
|
+
}
|
|
590
|
+
if (pattern.hostname !== undefined &&
|
|
591
|
+
pattern.hostname !== urlObj.hostname.toLowerCase()) {
|
|
592
|
+
return undefined;
|
|
593
|
+
}
|
|
594
|
+
if (pattern.hostname !== undefined) {
|
|
595
|
+
const expectedPort = pattern.port ?? defaultPortForProtocol(pattern.protocol ?? urlObj.protocol);
|
|
596
|
+
if (expectedPort !== urlObj.port)
|
|
597
|
+
return undefined;
|
|
598
|
+
}
|
|
599
|
+
const prefix = pattern.pathnamePrefix;
|
|
600
|
+
if (prefix === "/") {
|
|
601
|
+
if (urlObj.pathname.startsWith("//"))
|
|
602
|
+
return undefined;
|
|
603
|
+
if (pattern.pathMode === "segments") {
|
|
604
|
+
return isNonEmptyPathSegments(urlObj.pathname)
|
|
605
|
+
? urlObj.pathname
|
|
606
|
+
: undefined;
|
|
607
|
+
}
|
|
608
|
+
return urlObj.pathname;
|
|
609
|
+
}
|
|
610
|
+
if (urlObj.pathname === prefix) {
|
|
611
|
+
return pattern.pathMode === "catch-all-required" ? undefined : "";
|
|
612
|
+
}
|
|
613
|
+
if (urlObj.pathname.startsWith(`${prefix}/`)) {
|
|
614
|
+
const suffix = urlObj.pathname.slice(prefix.length);
|
|
615
|
+
if (suffix.startsWith("//"))
|
|
616
|
+
return undefined;
|
|
617
|
+
if (pattern.pathMode === "segments" &&
|
|
618
|
+
!isNonEmptyPathSegments(suffix)) {
|
|
619
|
+
return undefined;
|
|
620
|
+
}
|
|
621
|
+
return suffix;
|
|
622
|
+
}
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* @param {string} pathname
|
|
627
|
+
* @returns {boolean}
|
|
628
|
+
*/
|
|
629
|
+
function isNonEmptyPathSegments(pathname) {
|
|
630
|
+
return pathname.length > 1 && !pathname.endsWith("/") && !pathname.includes("//");
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* URLPattern treats the default port as empty in URL instances.
|
|
634
|
+
*
|
|
635
|
+
* @param {string} protocol
|
|
636
|
+
* @returns {string}
|
|
637
|
+
*/
|
|
638
|
+
function defaultPortForProtocol(protocol) {
|
|
639
|
+
if (protocol === "http:")
|
|
640
|
+
return "";
|
|
641
|
+
if (protocol === "https:")
|
|
642
|
+
return "";
|
|
643
|
+
return "";
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* @param {FastPathPattern} pattern
|
|
647
|
+
* @param {string} suffix
|
|
648
|
+
* @param {URL} source
|
|
649
|
+
* @returns {URL}
|
|
650
|
+
*/
|
|
651
|
+
function applyFastPathPattern(pattern, suffix, source) {
|
|
652
|
+
const localized = new URL(source.href);
|
|
653
|
+
if (pattern.protocol !== undefined)
|
|
654
|
+
localized.protocol = pattern.protocol;
|
|
655
|
+
if (pattern.hostname !== undefined) {
|
|
656
|
+
localized.hostname = pattern.hostname;
|
|
657
|
+
localized.port =
|
|
658
|
+
pattern.port ?? defaultPortForProtocol(localized.protocol);
|
|
659
|
+
}
|
|
660
|
+
localized.pathname = joinFastPathPrefix(pattern.pathnamePrefix, suffix);
|
|
661
|
+
return localized;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* @param {string} prefix
|
|
665
|
+
* @param {string} suffix
|
|
666
|
+
* @returns {string}
|
|
667
|
+
*/
|
|
668
|
+
function joinFastPathPrefix(prefix, suffix) {
|
|
669
|
+
if (prefix === "/")
|
|
670
|
+
return suffix === "" ? "/" : suffix;
|
|
671
|
+
if (suffix === "")
|
|
672
|
+
return prefix;
|
|
673
|
+
return `${prefix}${suffix.startsWith("/") ? suffix : `/${suffix}`}`;
|
|
674
|
+
}
|
|
317
675
|
//# sourceMappingURL=localize-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize-url.js","sourceRoot":"","s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oB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM;IACpD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;QAAE,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC1E,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACtC,SAAS,CAAC,IAAI;YACb,OAAO,CAAC,IAAI,IAAI,sBAAsB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IACD,SAAS,CAAC,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,MAAM,EAAE,MAAM;IACzC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IACxD,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,EAAE,CAAC;AACrE,CAAC","sourcesContent":["import { extractLocaleFromUrl } from \"./extract-locale-from-url.js\";\nimport { getLocale } from \"./get-locale.js\";\nimport { getUrlOrigin } from \"./get-url-origin.js\";\nimport { assertIsLocale, toLocale } from \"./check-locale.js\";\nimport {\n\tbaseLocale,\n\tTREE_SHAKE_DEFAULT_URL_PATTERN_USED,\n\ttrailingSlash,\n\turlPatterns,\n} from \"./variables.js\";\nimport { normalizeTrailingSlash } from \"./normalize-trailing-slash.js\";\nimport { execUrlPattern } from \"./exec-url-pattern.js\";\n\n/**\n * Lower-level URL localization function, primarily used in server contexts.\n *\n * This function is designed for server-side usage where you need precise control\n * over URL localization, such as in middleware or request handlers. It works with\n * URL objects and always returns absolute URLs.\n *\n * For client-side UI components, use `localizeHref()` instead, which provides\n * a more convenient API with relative paths and automatic locale detection.\n *\n * @see https://paraglidejs.com/i18n-routing\n *\n * @example\n * ```typescript\n * // Server middleware example\n * app.use((req, res, next) => {\n * const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);\n * const localized = localizeUrl(url, { locale: \"de\" });\n *\n * if (localized.href !== url.href) {\n * return res.redirect(localized.href);\n * }\n * next();\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using with URL patterns\n * const url = new URL(\"https://example.com/about\");\n * localizeUrl(url, { locale: \"de\" });\n * // => URL(\"https://example.com/de/about\")\n *\n * // Using with domain-based localization\n * const url = new URL(\"https://example.com/store\");\n * localizeUrl(url, { locale: \"de\" });\n * // => URL(\"https://de.example.com/store\")\n * ```\n *\n * @param {string | URL} url - The URL to localize. If string, must be absolute.\n * @param {object} [options] - Options for localization\n * @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale()\n * @returns {URL} The localized URL, always absolute\n */\nexport function localizeUrl(url, options) {\n\tconst targetLocale = options?.locale\n\t\t? assertIsLocale(options?.locale)\n\t\t: getLocale();\n\n\tif (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {\n\t\treturn localizeUrlDefaultPattern(url, targetLocale);\n\t}\n\n\tconst originalUrl = typeof url === \"string\" ? new URL(url) : url;\n\tconst urlObj =\n\t\ttrailingSlash === undefined\n\t\t\t? originalUrl\n\t\t\t: normalizeTrailingSlash(new URL(originalUrl));\n\n\t// Iterate over URL patterns\n\tfor (const element of urlPatterns) {\n\t\t// Most applications use a locale prefix (and sometimes a fixed domain)\n\t\t// with a trailing catch-all path. Those routes do not need URLPattern's\n\t\t// parser or matcher on every call. Keep the generic matcher below as the\n\t\t// fallback for every other URLPattern shape. This stays inside the outer\n\t\t// loop so specific patterns retain precedence over a later catch-all.\n\t\tconst fastPathLocalized = localizeUrlFastPath(\n\t\t\turlObj,\n\t\t\ttargetLocale,\n\t\t\telement\n\t\t);\n\t\tif (fastPathLocalized !== undefined) {\n\t\t\treturn fastPathLocalized;\n\t\t}\n\n\t\t// match localized patterns\n\t\tfor (const [, localizedPattern] of element.localized) {\n\t\t\tconst match = execUrlPattern(\n\t\t\t\tgetUrlPattern(localizedPattern, urlObj),\n\t\t\t\turlObj\n\t\t\t);\n\n\t\t\tif (!match) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst targetPattern = element.localized.find(\n\t\t\t\t([locale]) => locale === targetLocale\n\t\t\t)?.[1];\n\n\t\t\tif (!targetPattern) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst localizedUrl = fillPattern(\n\t\t\t\ttargetPattern,\n\t\t\t\taggregateGroups(match),\n\t\t\t\turlObj.origin\n\t\t\t);\n\t\t\treturn normalizeTrailingSlash(fillMissingUrlParts(localizedUrl, match));\n\t\t}\n\t\tconst unlocalizedMatch = execUrlPattern(\n\t\t\tgetUrlPattern(element.pattern, urlObj),\n\t\t\turlObj\n\t\t);\n\t\tif (unlocalizedMatch) {\n\t\t\tconst targetPattern = element.localized.find(\n\t\t\t\t([locale]) => locale === targetLocale\n\t\t\t)?.[1];\n\t\t\tif (targetPattern) {\n\t\t\t\tconst localizedUrl = fillPattern(\n\t\t\t\t\ttargetPattern,\n\t\t\t\t\taggregateGroups(unlocalizedMatch),\n\t\t\t\t\turlObj.origin\n\t\t\t\t);\n\t\t\t\treturn normalizeTrailingSlash(\n\t\t\t\t\tfillMissingUrlParts(localizedUrl, unlocalizedMatch)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\t// If no match found, return the original URL\n\treturn originalUrl;\n}\n\n/**\n * https://github.com/opral/inlang-paraglide-js/issues/381\n *\n * @param {string | URL} url\n * @param {Locale} locale\n * @returns {URL}\n */\nfunction localizeUrlDefaultPattern(url, locale) {\n\tconst urlObj = normalizeTrailingSlash(\n\t\ttypeof url === \"string\" ? new URL(url, getUrlOrigin()) : new URL(url)\n\t);\n\n\tconst currentLocale = extractLocaleFromUrl(urlObj);\n\n\t// If current locale matches target locale, no change needed\n\tif (currentLocale === locale) {\n\t\treturn normalizeTrailingSlash(urlObj);\n\t}\n\n\tconst pathSegments = urlObj.pathname.split(\"/\").filter(Boolean);\n\n\t// If current path starts with a locale, remove it\n\tif (pathSegments.length > 0 && toLocale(pathSegments[0])) {\n\t\tpathSegments.shift();\n\t}\n\n\t// For base locale, don't add prefix\n\tif (locale === baseLocale) {\n\t\turlObj.pathname = \"/\" + pathSegments.join(\"/\");\n\t} else {\n\t\t// For other locales, add prefix\n\t\turlObj.pathname = \"/\" + locale + \"/\" + pathSegments.join(\"/\");\n\t}\n\n\treturn normalizeTrailingSlash(urlObj);\n}\n\n/**\n * Low-level URL de-localization function, primarily used in server contexts.\n *\n * This function is designed for server-side usage where you need precise control\n * over URL de-localization, such as in middleware or request handlers. It works with\n * URL objects and always returns absolute URLs.\n *\n * For client-side UI components, use `deLocalizeHref()` instead, which provides\n * a more convenient API with relative paths.\n *\n * @see https://paraglidejs.com/i18n-routing\n *\n * @example\n * ```typescript\n * // Server middleware example\n * app.use((req, res, next) => {\n * const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);\n * const baseUrl = deLocalizeUrl(url);\n *\n * // Store the base URL for later use\n * req.baseUrl = baseUrl;\n * next();\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using with URL patterns\n * const url = new URL(\"https://example.com/de/about\");\n * deLocalizeUrl(url); // => URL(\"https://example.com/about\")\n *\n * // Using with domain-based localization\n * const url = new URL(\"https://de.example.com/store\");\n * deLocalizeUrl(url); // => URL(\"https://example.com/store\")\n * ```\n *\n * @param {string | URL} url - The URL to de-localize. If string, must be absolute.\n * @returns {URL} The de-localized URL, always absolute\n */\nexport function deLocalizeUrl(url) {\n\tif (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {\n\t\treturn deLocalizeUrlDefaultPattern(url);\n\t}\n\n\tconst originalUrl = typeof url === \"string\" ? new URL(url) : url;\n\tconst urlObj =\n\t\ttrailingSlash === undefined\n\t\t\t? originalUrl\n\t\t\t: normalizeTrailingSlash(new URL(originalUrl));\n\n\t// Iterate over URL patterns\n\tfor (const element of urlPatterns) {\n\t\tconst fastPathDeLocalized = deLocalizeUrlFastPath(urlObj, element);\n\t\tif (fastPathDeLocalized !== undefined) {\n\t\t\treturn fastPathDeLocalized;\n\t\t}\n\n\t\t// Iterate over localized versions\n\t\tfor (const [, localizedPattern] of element.localized) {\n\t\t\tconst match = execUrlPattern(\n\t\t\t\tgetUrlPattern(localizedPattern, urlObj),\n\t\t\t\turlObj\n\t\t\t);\n\n\t\t\tif (match) {\n\t\t\t\t// Convert localized URL back to the base pattern\n\t\t\t\tconst groups = aggregateGroups(match);\n\n\t\t\t\tconst baseUrl = fillPattern(element.pattern, groups, urlObj.origin);\n\t\t\t\treturn normalizeTrailingSlash(fillMissingUrlParts(baseUrl, match));\n\t\t\t}\n\t\t}\n\t\t// match unlocalized pattern\n\t\tconst unlocalizedMatch = execUrlPattern(\n\t\t\tgetUrlPattern(element.pattern, urlObj),\n\t\t\turlObj\n\t\t);\n\t\tif (unlocalizedMatch) {\n\t\t\tconst baseUrl = fillPattern(\n\t\t\t\telement.pattern,\n\t\t\t\taggregateGroups(unlocalizedMatch),\n\t\t\t\turlObj.origin\n\t\t\t);\n\t\t\treturn normalizeTrailingSlash(\n\t\t\t\tfillMissingUrlParts(baseUrl, unlocalizedMatch)\n\t\t\t);\n\t\t}\n\t}\n\t// no match found return the original url\n\treturn originalUrl;\n}\n\n/**\n * De-localizes a URL using the default pattern (/:locale/*)\n * @param {string|URL} url\n * @returns {URL}\n */\nfunction deLocalizeUrlDefaultPattern(url) {\n\tconst urlObj = normalizeTrailingSlash(\n\t\ttypeof url === \"string\" ? new URL(url, getUrlOrigin()) : new URL(url)\n\t);\n\tconst pathSegments = urlObj.pathname.split(\"/\").filter(Boolean);\n\n\t// If first segment is a locale, remove it\n\tif (pathSegments.length > 0 && toLocale(pathSegments[0])) {\n\t\turlObj.pathname = \"/\" + pathSegments.slice(1).join(\"/\");\n\t}\n\n\treturn normalizeTrailingSlash(urlObj);\n}\n\n/**\n * Takes matches of implicit wildcards in the UrlPattern (when a part is missing\n * it is equal to '*') and adds them back to the result of fillPattern.\n *\n * At least protocol and hostname are required to create a valid URL inside fillPattern.\n *\n * @param {URL} url\n * @param {any} match\n * @returns {URL}\n */\nfunction fillMissingUrlParts(url, match) {\n\tif (match.protocol.groups[\"0\"]) {\n\t\turl.protocol = match.protocol.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.hostname.groups[\"0\"]) {\n\t\turl.hostname = match.hostname.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.username.groups[\"0\"]) {\n\t\turl.username = match.username.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.password.groups[\"0\"]) {\n\t\turl.password = match.password.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.port.groups[\"0\"]) {\n\t\turl.port = match.port.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.pathname.groups[\"0\"]) {\n\t\turl.pathname = match.pathname.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.search.groups[\"0\"]) {\n\t\turl.search = match.search.groups[\"0\"] ?? \"\";\n\t}\n\tif (match.hash.groups[\"0\"]) {\n\t\turl.hash = match.hash.groups[\"0\"] ?? \"\";\n\t}\n\n\treturn url;\n}\n\n/**\n * Fills a URL pattern with values for named groups, supporting all URLPattern-style modifiers.\n *\n * This function will eventually be replaced by https://github.com/whatwg/urlpattern/issues/73\n *\n * Matches:\n * - :name -> Simple\n * - :name? -> Optional\n * - :name+ -> One or more\n * - :name* -> Zero or more\n * - :name(...) -> Regex group\n * - {text} -> Group delimiter\n * - {text}? -> Optional group delimiter\n *\n * If the value is `null`, the segment is removed.\n *\n * @param {string} pattern - The URL pattern containing named groups.\n * @param {Record<string, string | null | undefined>} values - Object of values for named groups.\n * @param {string} origin - Base URL to use for URL construction.\n * @returns {URL} - The constructed URL with named groups filled.\n */\nfunction fillPattern(pattern, values, origin) {\n\t// Pre-process the pattern to handle explicit port numbers\n\t// This detects patterns like \"http://localhost:5173\" and protects the port number\n\t// from being interpreted as a parameter\n\tlet processedPattern = pattern.replace(\n\t\t/(https?:\\/\\/[^:/]+):(\\d+)(\\/|$)/g,\n\t\t(_, protocol, port, slash) => {\n\t\t\t// Replace \":5173\" with \"#PORT-5173#\" to protect it from parameter replacement\n\t\t\treturn `${protocol}#PORT-${port}#${slash}`;\n\t\t}\n\t);\n\n\t// First, handle group delimiters with curly braces\n\tlet processedGroupDelimiters = processedPattern.replace(\n\t\t/\\{([^{}]*)\\}([?+*]?)/g,\n\t\t(_, content, modifier) => {\n\t\t\t// For optional group delimiters\n\t\t\tif (modifier === \"?\") {\n\t\t\t\t// For optional groups, we'll include the content\n\t\t\t\treturn content;\n\t\t\t}\n\t\t\t// For non-optional group delimiters, always include the content\n\t\t\treturn content;\n\t\t}\n\t);\n\n\t// Then handle named groups\n\tlet filled = processedGroupDelimiters.replace(\n\t\t/(\\/?):([a-zA-Z0-9_]+)(\\([^)]*\\))?([?+*]?)/g,\n\t\t(_, slash, name, __, modifier) => {\n\t\t\tconst value = values[name];\n\n\t\t\tif (value === null) {\n\t\t\t\t// If value is null, remove the entire segment including the preceding slash\n\t\t\t\treturn \"\";\n\t\t\t}\n\n\t\t\tif (modifier === \"?\") {\n\t\t\t\t// Optional segment\n\t\t\t\treturn value !== undefined ? `${slash}${value}` : \"\";\n\t\t\t}\n\n\t\t\tif (modifier === \"+\" || modifier === \"*\") {\n\t\t\t\t// Repeatable segments\n\t\t\t\tif (value === undefined && modifier === \"+\") {\n\t\t\t\t\tthrow new Error(`Missing value for \"${name}\" (one or more required)`);\n\t\t\t\t}\n\t\t\t\treturn value ? `${slash}${value}` : \"\";\n\t\t\t}\n\n\t\t\t// Simple named group (no modifier)\n\t\t\tif (value === undefined) {\n\t\t\t\tthrow new Error(`Missing value for \"${name}\"`);\n\t\t\t}\n\n\t\t\treturn `${slash}${value}`;\n\t\t}\n\t);\n\n\t// Restore port numbers\n\tfilled = filled.replace(/#PORT-(\\d+)#/g, \":$1\");\n\n\treturn new URL(filled, origin);\n}\n\n/**\n * Aggregates named groups from various parts of the URLPattern match result.\n *\n *\n * @param {any} match - The URLPattern match result object.\n * @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.\n */\nexport function aggregateGroups(match) {\n\treturn {\n\t\t...match.hash.groups,\n\t\t...match.hostname.groups,\n\t\t...match.password.groups,\n\t\t...match.pathname.groups,\n\t\t...match.port.groups,\n\t\t...match.protocol.groups,\n\t\t...match.search.groups,\n\t\t...match.username.groups,\n\t};\n}\n\n/** @type {Map<string, URLPattern>} */\nconst urlPatternCache = new Map();\n\nconst URL_PATTERN_CACHE_LIMIT = 128;\nconst ABSOLUTE_URL_PATTERN = /^(?:[A-Za-z][A-Za-z\\d+.-]*|:[A-Za-z][A-Za-z\\d_-]*):\\/\\//;\n\n/**\n * URLPattern's base URL affects relative patterns. Absolute patterns only\n * depend on the pattern itself, while root-relative patterns also depend on\n * the URL origin. Other relative patterns are deliberately not cached because\n * their semantics depend on the complete base URL.\n *\n * @param {string} pattern\n * @param {URL} url\n * @returns {URLPattern}\n */\nfunction getUrlPattern(pattern, url) {\n\tconst isAbsolutePattern = ABSOLUTE_URL_PATTERN.test(pattern);\n\tconst isRootRelativePattern = pattern.startsWith(\"/\");\n\tif (!isAbsolutePattern && !isRootRelativePattern) {\n\t\treturn new URLPattern(pattern, url.href);\n\t}\n\n\tconst key = isAbsolutePattern\n\t\t? pattern\n\t\t: JSON.stringify([url.origin, pattern]);\n\tconst cached = urlPatternCache.get(key);\n\tif (cached !== undefined) {\n\t\t// Refresh the entry so frequently used patterns stay in the bounded cache.\n\t\turlPatternCache.delete(key);\n\t\turlPatternCache.set(key, cached);\n\t\treturn cached;\n\t}\n\n\tconst compiled = new URLPattern(pattern, url.href);\n\tif (urlPatternCache.size >= URL_PATTERN_CACHE_LIMIT) {\n\t\tconst oldestKey = urlPatternCache.keys().next().value;\n\t\tif (oldestKey !== undefined) urlPatternCache.delete(oldestKey);\n\t}\n\turlPatternCache.set(key, compiled);\n\treturn compiled;\n}\n\n/**\n * A small, deliberately conservative subset of URLPattern routing.\n *\n * The compiler emits routes such as `/:path(.*)?`, `/de/:path*`, or\n * `https://example.com/:path*`. For those routes matching is equivalent to a\n * pathname prefix check and (optionally) an origin check. Everything that has\n * a dynamic host, a custom path regexp, or another URLPattern modifier keeps\n * using the generic implementation above.\n *\n * @typedef {{\n * protocol: string | undefined;\n * hostname: string | undefined;\n * port: string | undefined;\n * pathnamePrefix: string;\n * pathMode: \"segments\" | \"catch-all-optional\" | \"catch-all-required\";\n * }} FastPathPattern\n * @typedef {{\n * base: FastPathPattern;\n * localized: Array<{ locale: string; pattern: FastPathPattern }>;\n * }} FastPathRoute\n */\n\n/** @type {WeakMap<object, FastPathRoute | null>} */\nconst fastPathRouteCache = new WeakMap();\n\n/**\n * @param {URL} urlObj\n * @param {string} targetLocale\n * @param {{ pattern: string; localized: Array<[string, string]> }} element\n * @returns {URL | undefined}\n */\nfunction localizeUrlFastPath(urlObj, targetLocale, element) {\n\tconst route = getFastPathRoute(element);\n\tif (route === null) return undefined;\n\n\t// Preserve URLPattern's ordering: localized patterns are checked before\n\t// the unlocalized pattern, and the first matching pattern wins.\n\tfor (const localized of route.localized) {\n\t\tconst suffix = matchFastPathPattern(localized.pattern, urlObj);\n\t\tif (suffix === undefined) continue;\n\n\t\tconst target = route.localized.find(\n\t\t\t(candidate) => candidate.locale === targetLocale\n\t\t)?.pattern;\n\t\tif (target === undefined) continue;\n\n\t\treturn applyFastPathPattern(target, suffix, urlObj);\n\t}\n\n\tconst suffix = matchFastPathPattern(route.base, urlObj);\n\tif (suffix !== undefined) {\n\t\tconst target = route.localized.find(\n\t\t\t(candidate) => candidate.locale === targetLocale\n\t\t)?.pattern;\n\t\tif (target !== undefined) {\n\t\t\treturn applyFastPathPattern(target, suffix, urlObj);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * @param {URL} urlObj\n * @param {{ pattern: string; localized: Array<[string, string]> }} element\n * @returns {URL | undefined}\n */\nfunction deLocalizeUrlFastPath(urlObj, element) {\n\tconst route = getFastPathRoute(element);\n\tif (route === null) return undefined;\n\n\tfor (const localized of route.localized) {\n\t\tconst suffix = matchFastPathPattern(localized.pattern, urlObj);\n\t\tif (suffix !== undefined) {\n\t\t\treturn applyFastPathPattern(route.base, suffix, urlObj);\n\t\t}\n\t}\n\n\tconst suffix = matchFastPathPattern(route.base, urlObj);\n\tif (suffix !== undefined) {\n\t\treturn applyFastPathPattern(route.base, suffix, urlObj);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * @param {{ pattern: string; localized: Array<[string, string]> }} element\n * @returns {FastPathRoute | null}\n */\nfunction getFastPathRoute(element) {\n\tconst cached = fastPathRouteCache.get(element);\n\tif (cached !== undefined) return cached;\n\n\tconst base = parseFastPathPattern(element.pattern);\n\tif (base === undefined) {\n\t\tfastPathRouteCache.set(element, null);\n\t\treturn null;\n\t}\n\n\tconst localized = [];\n\tfor (const [locale, pattern] of element.localized) {\n\t\tconst parsed = parseFastPathPattern(pattern);\n\t\tif (parsed === undefined || parsed.pathMode !== base.pathMode) {\n\t\t\tfastPathRouteCache.set(element, null);\n\t\t\treturn null;\n\t\t}\n\t\tlocalized.push({ locale, pattern: parsed });\n\t}\n\n\tconst route = { base, localized };\n\tfastPathRouteCache.set(element, route);\n\treturn route;\n}\n\n/**\n * Parse only catch-all path patterns. In particular, do not treat `:path(.)?`\n * as a catch-all: URLPattern's `(.)` means exactly one character and cannot be\n * represented by this prefix matcher without changing routing semantics.\n *\n * @param {string} pattern\n * @returns {FastPathPattern | undefined}\n */\nfunction parseFastPathPattern(pattern) {\n\tconst wildcard = pattern.match(/\\/:path(?:\\(\\.\\*\\)(?:\\?)?|\\*)$/);\n\tif (wildcard === null || wildcard.index === undefined) return undefined;\n\n\tconst prefix = pattern.slice(0, wildcard.index);\n\tconst originAndPath = parseFastPathOriginAndPath(prefix);\n\tif (originAndPath === undefined) return undefined;\n\tconst pathMode = wildcard[0].endsWith(\"*\")\n\t\t? \"segments\"\n\t\t: wildcard[0].endsWith(\"?\")\n\t\t\t? \"catch-all-optional\"\n\t\t\t: \"catch-all-required\";\n\n\treturn { ...originAndPath, pathMode };\n}\n\n/**\n * @param {string} prefix\n * @returns {FastPathPattern | undefined}\n */\nfunction parseFastPathOriginAndPath(prefix) {\n\tif (prefix === \"\" || prefix.startsWith(\"/\")) {\n\t\tif (hasUrlPatternSyntax(prefix)) return undefined;\n\t\treturn {\n\t\t\tprotocol: undefined,\n\t\t\thostname: undefined,\n\t\t\tport: undefined,\n\t\t\tpathnamePrefix: normalizePathPrefix(prefix),\n\t\t\tpathMode: \"catch-all-optional\",\n\t\t};\n\t}\n\n\t// A `:protocol://host` pattern is common in generated configurations. The\n\t// protocol is intentionally left unconstrained, just like URLPattern.\n\tconst dynamicProtocol = prefix.match(/^:protocol:\\/\\/([^/]+)(\\/.*)?$/);\n\tconst staticOrigin = prefix.match(\n\t\t/^([A-Za-z][A-Za-z\\d+.-]*):\\/\\/([^/]+)(\\/.*)?$/\n\t);\n\tif (dynamicProtocol !== null) {\n\t\tconst dynamicHost = dynamicProtocol[1] ?? \"\";\n\t\tconst hostMatch = dynamicHost.match(/^([^:(){}?*+]+)(?::(\\d+))?$/);\n\t\tif (\n\t\t\thostMatch === null ||\n\t\t\t(dynamicProtocol[2] !== undefined &&\n\t\t\t\thasUrlPatternSyntax(dynamicProtocol[2]))\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\tprotocol: undefined,\n\t\t\thostname: (hostMatch[1] ?? \"\").toLowerCase(),\n\t\t\tport: hostMatch[2],\n\t\t\tpathnamePrefix: normalizePathPrefix(dynamicProtocol[2] ?? \"\"),\n\t\t\tpathMode: \"catch-all-optional\",\n\t\t};\n\t}\n\n\tif (staticOrigin === null) return undefined;\n\n\tconst host = staticOrigin[2] ?? \"\";\n\tconst pathname = staticOrigin[3];\n\tconst hostMatch = host.match(/^([^:(){}?*+]+)(?::(\\d+))?$/);\n\tif (\n\t\thostMatch === null ||\n\t\t(pathname !== undefined && hasUrlPatternSyntax(pathname))\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tprotocol: `${staticOrigin[1]}:`,\n\t\thostname: (hostMatch[1] ?? \"\").toLowerCase(),\n\t\tport: normalizePatternPort(hostMatch[2], `${staticOrigin[1]}:`),\n\t\tpathnamePrefix: normalizePathPrefix(pathname ?? \"\"),\n\t\tpathMode: \"catch-all-optional\",\n\t};\n}\n\n/**\n * @param {string | undefined} port\n * @param {string} protocol\n * @returns {string | undefined}\n */\nfunction normalizePatternPort(port, protocol) {\n\tif (port === \"80\" && protocol === \"http:\") return \"\";\n\tif (port === \"443\" && protocol === \"https:\") return \"\";\n\treturn port;\n}\n\n/**\n * @param {string} value\n * @returns {boolean}\n */\nfunction hasUrlPatternSyntax(value) {\n\treturn /[:(){}?*+]/.test(value);\n}\n\n/**\n * @param {string} pathname\n * @returns {string}\n */\nfunction normalizePathPrefix(pathname) {\n\tif (pathname === \"\" || pathname === \"/\") return \"/\";\n\treturn pathname.endsWith(\"/\") ? pathname.slice(0, -1) : pathname;\n}\n\n/**\n * @param {FastPathPattern} pattern\n * @param {URL} urlObj\n * @returns {string | undefined}\n */\nfunction matchFastPathPattern(pattern, urlObj) {\n\tif (pattern.protocol !== undefined && pattern.protocol !== urlObj.protocol) {\n\t\treturn undefined;\n\t}\n\tif (\n\t\tpattern.hostname !== undefined &&\n\t\tpattern.hostname !== urlObj.hostname.toLowerCase()\n\t) {\n\t\treturn undefined;\n\t}\n\tif (pattern.hostname !== undefined) {\n\t\tconst expectedPort =\n\t\t\tpattern.port ?? defaultPortForProtocol(pattern.protocol ?? urlObj.protocol);\n\t\tif (expectedPort !== urlObj.port) return undefined;\n\t}\n\n\tconst prefix = pattern.pathnamePrefix;\n\tif (prefix === \"/\") {\n\t\tif (urlObj.pathname.startsWith(\"//\")) return undefined;\n\t\tif (pattern.pathMode === \"segments\") {\n\t\t\treturn isNonEmptyPathSegments(urlObj.pathname)\n\t\t\t\t? urlObj.pathname\n\t\t\t\t: undefined;\n\t\t}\n\t\treturn urlObj.pathname;\n\t}\n\tif (urlObj.pathname === prefix) {\n\t\treturn pattern.pathMode === \"catch-all-required\" ? undefined : \"\";\n\t}\n\tif (urlObj.pathname.startsWith(`${prefix}/`)) {\n\t\tconst suffix = urlObj.pathname.slice(prefix.length);\n\t\tif (suffix.startsWith(\"//\")) return undefined;\n\t\tif (\n\t\t\tpattern.pathMode === \"segments\" &&\n\t\t\t!isNonEmptyPathSegments(suffix)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn suffix;\n\t}\n\treturn undefined;\n}\n\n/**\n * @param {string} pathname\n * @returns {boolean}\n */\nfunction isNonEmptyPathSegments(pathname) {\n\treturn pathname.length > 1 && !pathname.endsWith(\"/\") && !pathname.includes(\"//\");\n}\n\n/**\n * URLPattern treats the default port as empty in URL instances.\n *\n * @param {string} protocol\n * @returns {string}\n */\nfunction defaultPortForProtocol(protocol) {\n\tif (protocol === \"http:\") return \"\";\n\tif (protocol === \"https:\") return \"\";\n\treturn \"\";\n}\n\n/**\n * @param {FastPathPattern} pattern\n * @param {string} suffix\n * @param {URL} source\n * @returns {URL}\n */\nfunction applyFastPathPattern(pattern, suffix, source) {\n\tconst localized = new URL(source.href);\n\tif (pattern.protocol !== undefined) localized.protocol = pattern.protocol;\n\tif (pattern.hostname !== undefined) {\n\t\tlocalized.hostname = pattern.hostname;\n\t\tlocalized.port =\n\t\t\tpattern.port ?? defaultPortForProtocol(localized.protocol);\n\t}\n\tlocalized.pathname = joinFastPathPrefix(pattern.pathnamePrefix, suffix);\n\treturn localized;\n}\n\n/**\n * @param {string} prefix\n * @param {string} suffix\n * @returns {string}\n */\nfunction joinFastPathPrefix(prefix, suffix) {\n\tif (prefix === \"/\") return suffix === \"\" ? \"/\" : suffix;\n\tif (suffix === \"\") return prefix;\n\treturn `${prefix}${suffix.startsWith(\"/\") ? suffix : `/${suffix}`}`;\n}\n"]}
|