@sebbro/paraglide-lite 0.1.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/LICENSE +21 -0
- package/README.md +67 -0
- package/bin/run.js +4 -0
- package/dist/bundler-plugins/esbuild.d.ts +1 -0
- package/dist/bundler-plugins/esbuild.d.ts.map +1 -0
- package/dist/bundler-plugins/esbuild.js +4 -0
- package/dist/bundler-plugins/esbuild.js.map +1 -0
- package/dist/bundler-plugins/index.d.ts +6 -0
- package/dist/bundler-plugins/index.d.ts.map +1 -0
- package/dist/bundler-plugins/index.js +7 -0
- package/dist/bundler-plugins/index.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.d.ts +19 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.js +85 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.d.ts +2 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.js +53 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.d.ts +31 -0
- package/dist/bundler-plugins/lazy-modules/ssr.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.js +42 -0
- package/dist/bundler-plugins/lazy-modules/ssr.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.d.ts +2 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.js +48 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.d.ts +7 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.js +30 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual.d.ts +86 -0
- package/dist/bundler-plugins/lazy-modules/virtual.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual.js +2 -0
- package/dist/bundler-plugins/lazy-modules/virtual.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.d.ts +18 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.js +328 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.d.ts +2 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.js +45 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/constants.d.ts +2 -0
- package/dist/bundler-plugins/per-locale-build/constants.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/constants.js +3 -0
- package/dist/bundler-plugins/per-locale-build/constants.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/index.d.ts +6 -0
- package/dist/bundler-plugins/per-locale-build/index.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/index.js +43 -0
- package/dist/bundler-plugins/per-locale-build/index.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts +8 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.js +13 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/types.d.ts +4 -0
- package/dist/bundler-plugins/per-locale-build/types.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/types.js +2 -0
- package/dist/bundler-plugins/per-locale-build/types.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts +51 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.js +250 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js +250 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -0
- package/dist/bundler-plugins/plugin-core.d.ts +74 -0
- package/dist/bundler-plugins/plugin-core.d.ts.map +1 -0
- package/dist/bundler-plugins/plugin-core.js +292 -0
- package/dist/bundler-plugins/plugin-core.js.map +1 -0
- package/dist/bundler-plugins/rolldown.d.ts +10 -0
- package/dist/bundler-plugins/rolldown.d.ts.map +1 -0
- package/dist/bundler-plugins/rolldown.js +36 -0
- package/dist/bundler-plugins/rolldown.js.map +1 -0
- package/dist/bundler-plugins/rolldown.test.d.ts +1 -0
- package/dist/bundler-plugins/rolldown.test.d.ts.map +1 -0
- package/dist/bundler-plugins/rolldown.test.js +72 -0
- package/dist/bundler-plugins/rolldown.test.js.map +1 -0
- package/dist/bundler-plugins/rollup.d.ts +1 -0
- package/dist/bundler-plugins/rollup.d.ts.map +1 -0
- package/dist/bundler-plugins/rollup.js +4 -0
- package/dist/bundler-plugins/rollup.js.map +1 -0
- package/dist/bundler-plugins/rspack.d.ts +1 -0
- package/dist/bundler-plugins/rspack.d.ts.map +1 -0
- package/dist/bundler-plugins/rspack.js +4 -0
- package/dist/bundler-plugins/rspack.js.map +1 -0
- package/dist/bundler-plugins/unplugin.d.ts +3 -0
- package/dist/bundler-plugins/unplugin.d.ts.map +1 -0
- package/dist/bundler-plugins/unplugin.js +62 -0
- package/dist/bundler-plugins/unplugin.js.map +1 -0
- package/dist/bundler-plugins/unplugin.test.d.ts +1 -0
- package/dist/bundler-plugins/unplugin.test.d.ts.map +1 -0
- package/dist/bundler-plugins/unplugin.test.js +256 -0
- package/dist/bundler-plugins/unplugin.test.js.map +1 -0
- package/dist/bundler-plugins/virtual-modules.test.d.ts +1 -0
- package/dist/bundler-plugins/virtual-modules.test.d.ts.map +1 -0
- package/dist/bundler-plugins/virtual-modules.test.js +77 -0
- package/dist/bundler-plugins/virtual-modules.test.js.map +1 -0
- package/dist/bundler-plugins/vite.d.ts +17 -0
- package/dist/bundler-plugins/vite.d.ts.map +1 -0
- package/dist/bundler-plugins/vite.js +15 -0
- package/dist/bundler-plugins/vite.js.map +1 -0
- package/dist/bundler-plugins/vite.test.d.ts +1 -0
- package/dist/bundler-plugins/vite.test.d.ts.map +1 -0
- package/dist/bundler-plugins/vite.test.js +61 -0
- package/dist/bundler-plugins/vite.test.js.map +1 -0
- package/dist/bundler-plugins/webpack.d.ts +1 -0
- package/dist/bundler-plugins/webpack.d.ts.map +1 -0
- package/dist/bundler-plugins/webpack.js +4 -0
- package/dist/bundler-plugins/webpack.js.map +1 -0
- package/dist/cli/commands/compile/command.d.ts +2 -0
- package/dist/cli/commands/compile/command.d.ts.map +1 -0
- package/dist/cli/commands/compile/command.js +225 -0
- package/dist/cli/commands/compile/command.js.map +1 -0
- package/dist/cli/commands/compile/command.test.d.ts +1 -0
- package/dist/cli/commands/compile/command.test.d.ts.map +1 -0
- package/dist/cli/commands/compile/command.test.js +69 -0
- package/dist/cli/commands/compile/command.test.js.map +1 -0
- package/dist/cli/commands/init/command.d.ts +2 -0
- package/dist/cli/commands/init/command.d.ts.map +1 -0
- package/dist/cli/commands/init/command.js +90 -0
- package/dist/cli/commands/init/command.js.map +1 -0
- package/dist/cli/defaults.d.ts +11 -0
- package/dist/cli/defaults.d.ts.map +1 -0
- package/dist/cli/defaults.js +13 -0
- package/dist/cli/defaults.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/steps/add-vite-plugin.d.ts +31 -0
- package/dist/cli/steps/add-vite-plugin.d.ts.map +1 -0
- package/dist/cli/steps/add-vite-plugin.js +65 -0
- package/dist/cli/steps/add-vite-plugin.js.map +1 -0
- package/dist/cli/steps/add-vite-plugin.test.d.ts +1 -0
- package/dist/cli/steps/add-vite-plugin.test.d.ts.map +1 -0
- package/dist/cli/steps/add-vite-plugin.test.js +74 -0
- package/dist/cli/steps/add-vite-plugin.test.js.map +1 -0
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts +5 -0
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -0
- package/dist/cli/steps/check-for-uncomitted-changes.js +37 -0
- package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -0
- package/dist/cli/steps/detect-bundler.d.ts +10 -0
- package/dist/cli/steps/detect-bundler.d.ts.map +1 -0
- package/dist/cli/steps/detect-bundler.js +22 -0
- package/dist/cli/steps/detect-bundler.js.map +1 -0
- package/dist/cli/steps/detect-bundler.test.d.ts +1 -0
- package/dist/cli/steps/detect-bundler.test.d.ts.map +1 -0
- package/dist/cli/steps/detect-bundler.test.js +29 -0
- package/dist/cli/steps/detect-bundler.test.js.map +1 -0
- package/dist/cli/steps/initialize-messages.d.ts +11 -0
- package/dist/cli/steps/initialize-messages.d.ts.map +1 -0
- package/dist/cli/steps/initialize-messages.js +31 -0
- package/dist/cli/steps/initialize-messages.js.map +1 -0
- package/dist/cli/steps/prompt-for-outdir.d.ts +8 -0
- package/dist/cli/steps/prompt-for-outdir.d.ts.map +1 -0
- package/dist/cli/steps/prompt-for-outdir.js +19 -0
- package/dist/cli/steps/prompt-for-outdir.js.map +1 -0
- package/dist/cli/steps/update-package-json.d.ts +11 -0
- package/dist/cli/steps/update-package-json.d.ts.map +1 -0
- package/dist/cli/steps/update-package-json.js +34 -0
- package/dist/cli/steps/update-package-json.js.map +1 -0
- package/dist/cli/steps/update-ts-config.d.ts +26 -0
- package/dist/cli/steps/update-ts-config.d.ts.map +1 -0
- package/dist/cli/steps/update-ts-config.js +270 -0
- package/dist/cli/steps/update-ts-config.js.map +1 -0
- package/dist/cli/steps/update-ts-config.test.d.ts +1 -0
- package/dist/cli/steps/update-ts-config.test.d.ts.map +1 -0
- package/dist/cli/steps/update-ts-config.test.js +60 -0
- package/dist/cli/steps/update-ts-config.test.js.map +1 -0
- package/dist/cli/utils.d.ts +36 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +20 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/compiler/assert-url-pattern-available.d.ts +7 -0
- package/dist/compiler/assert-url-pattern-available.d.ts.map +1 -0
- package/dist/compiler/assert-url-pattern-available.js +17 -0
- package/dist/compiler/assert-url-pattern-available.js.map +1 -0
- package/dist/compiler/compile-annotation.d.ts +12 -0
- package/dist/compiler/compile-annotation.d.ts.map +1 -0
- package/dist/compiler/compile-annotation.js +136 -0
- package/dist/compiler/compile-annotation.js.map +1 -0
- package/dist/compiler/compile-bundle.d.ts +28 -0
- package/dist/compiler/compile-bundle.d.ts.map +1 -0
- package/dist/compiler/compile-bundle.js +431 -0
- package/dist/compiler/compile-bundle.js.map +1 -0
- package/dist/compiler/compile-bundle.test.d.ts +1 -0
- package/dist/compiler/compile-bundle.test.d.ts.map +1 -0
- package/dist/compiler/compile-bundle.test.js +399 -0
- package/dist/compiler/compile-bundle.test.js.map +1 -0
- package/dist/compiler/compile-local-variable.d.ts +16 -0
- package/dist/compiler/compile-local-variable.d.ts.map +1 -0
- package/dist/compiler/compile-local-variable.js +28 -0
- package/dist/compiler/compile-local-variable.js.map +1 -0
- package/dist/compiler/compile-local-variable.test.d.ts +1 -0
- package/dist/compiler/compile-local-variable.test.d.ts.map +1 -0
- package/dist/compiler/compile-local-variable.test.js +359 -0
- package/dist/compiler/compile-local-variable.test.js.map +1 -0
- package/dist/compiler/compile-message.d.ts +8 -0
- package/dist/compiler/compile-message.d.ts.map +1 -0
- package/dist/compiler/compile-message.js +174 -0
- package/dist/compiler/compile-message.js.map +1 -0
- package/dist/compiler/compile-message.test.d.ts +1 -0
- package/dist/compiler/compile-message.test.d.ts.map +1 -0
- package/dist/compiler/compile-message.test.js +1060 -0
- package/dist/compiler/compile-message.test.js.map +1 -0
- package/dist/compiler/compile-pattern.d.ts +29 -0
- package/dist/compiler/compile-pattern.d.ts.map +1 -0
- package/dist/compiler/compile-pattern.js +143 -0
- package/dist/compiler/compile-pattern.js.map +1 -0
- package/dist/compiler/compile-pattern.test.d.ts +1 -0
- package/dist/compiler/compile-pattern.test.d.ts.map +1 -0
- package/dist/compiler/compile-pattern.test.js +255 -0
- package/dist/compiler/compile-pattern.test.js.map +1 -0
- package/dist/compiler/compile-project.d.ts +21 -0
- package/dist/compiler/compile-project.d.ts.map +1 -0
- package/dist/compiler/compile-project.js +147 -0
- package/dist/compiler/compile-project.js.map +1 -0
- package/dist/compiler/compile-project.test.d.ts +1 -0
- package/dist/compiler/compile-project.test.d.ts.map +1 -0
- package/dist/compiler/compile-project.test.js +1709 -0
- package/dist/compiler/compile-project.test.js.map +1 -0
- package/dist/compiler/compile.bench.d.ts +1 -0
- package/dist/compiler/compile.bench.d.ts.map +1 -0
- package/dist/compiler/compile.bench.js +89 -0
- package/dist/compiler/compile.bench.js.map +1 -0
- package/dist/compiler/compile.d.ts +24 -0
- package/dist/compiler/compile.d.ts.map +1 -0
- package/dist/compiler/compile.js +106 -0
- package/dist/compiler/compile.js.map +1 -0
- package/dist/compiler/compile.test.d.ts +1 -0
- package/dist/compiler/compile.test.d.ts.map +1 -0
- package/dist/compiler/compile.test.js +66 -0
- package/dist/compiler/compile.test.js.map +1 -0
- package/dist/compiler/compiler-options.d.ts +466 -0
- package/dist/compiler/compiler-options.d.ts.map +1 -0
- package/dist/compiler/compiler-options.js +22 -0
- package/dist/compiler/compiler-options.js.map +1 -0
- package/dist/compiler/create-paraglide.d.ts +21 -0
- package/dist/compiler/create-paraglide.d.ts.map +1 -0
- package/dist/compiler/create-paraglide.js +69 -0
- package/dist/compiler/create-paraglide.js.map +1 -0
- package/dist/compiler/create-paraglide.test.d.ts +1 -0
- package/dist/compiler/create-paraglide.test.d.ts.map +1 -0
- package/dist/compiler/create-paraglide.test.js +55 -0
- package/dist/compiler/create-paraglide.test.js.map +1 -0
- package/dist/compiler/create-readme.d.ts +9 -0
- package/dist/compiler/create-readme.d.ts.map +1 -0
- package/dist/compiler/create-readme.js +127 -0
- package/dist/compiler/create-readme.js.map +1 -0
- package/dist/compiler/emit-files.d.ts +15 -0
- package/dist/compiler/emit-files.d.ts.map +1 -0
- package/dist/compiler/emit-files.js +58 -0
- package/dist/compiler/emit-files.js.map +1 -0
- package/dist/compiler/emit-files.test.d.ts +1 -0
- package/dist/compiler/emit-files.test.d.ts.map +1 -0
- package/dist/compiler/emit-files.test.js +43 -0
- package/dist/compiler/emit-files.test.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.d.ts +11 -0
- package/dist/compiler/emit-ts-declarations.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.js +33 -0
- package/dist/compiler/emit-ts-declarations.interop.test.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.js +353 -0
- package/dist/compiler/emit-ts-declarations.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.test.d.ts +1 -0
- package/dist/compiler/emit-ts-declarations.test.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.test.js +161 -0
- package/dist/compiler/emit-ts-declarations.test.js.map +1 -0
- package/dist/compiler/index.d.ts +13 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/jsdoc-types.d.ts +21 -0
- package/dist/compiler/jsdoc-types.d.ts.map +1 -0
- package/dist/compiler/jsdoc-types.js +59 -0
- package/dist/compiler/jsdoc-types.js.map +1 -0
- package/dist/compiler/jsdoc-types.test.d.ts +1 -0
- package/dist/compiler/jsdoc-types.test.d.ts.map +1 -0
- package/dist/compiler/jsdoc-types.test.js +100 -0
- package/dist/compiler/jsdoc-types.test.js.map +1 -0
- package/dist/compiler/lazy-modules/compile-cache.d.ts +37 -0
- package/dist/compiler/lazy-modules/compile-cache.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/compile-cache.js +34 -0
- package/dist/compiler/lazy-modules/compile-cache.js.map +1 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.d.ts +2 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.js +65 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.js.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.d.ts +18 -0
- package/dist/compiler/lazy-modules/create-loader.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.js +182 -0
- package/dist/compiler/lazy-modules/create-loader.js.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.test.d.ts +2 -0
- package/dist/compiler/lazy-modules/create-loader.test.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.test.js +82 -0
- package/dist/compiler/lazy-modules/create-loader.test.js.map +1 -0
- package/dist/compiler/lazy-modules/manifest.d.ts +32 -0
- package/dist/compiler/lazy-modules/manifest.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/manifest.js +11 -0
- package/dist/compiler/lazy-modules/manifest.js.map +1 -0
- package/dist/compiler/match-literals.d.ts +2 -0
- package/dist/compiler/match-literals.d.ts.map +1 -0
- package/dist/compiler/match-literals.js +42 -0
- package/dist/compiler/match-literals.js.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.d.ts +27 -0
- package/dist/compiler/output-structure/lazy-modules.d.ts.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.js +157 -0
- package/dist/compiler/output-structure/lazy-modules.js.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.test.d.ts +2 -0
- package/dist/compiler/output-structure/lazy-modules.test.d.ts.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.test.js +128 -0
- package/dist/compiler/output-structure/lazy-modules.test.js.map +1 -0
- package/dist/compiler/output-structure/locale-modules.d.ts +4 -0
- package/dist/compiler/output-structure/locale-modules.d.ts.map +1 -0
- package/dist/compiler/output-structure/locale-modules.js +81 -0
- package/dist/compiler/output-structure/locale-modules.js.map +1 -0
- package/dist/compiler/output-structure/locale-modules.test.d.ts +1 -0
- package/dist/compiler/output-structure/locale-modules.test.d.ts.map +1 -0
- package/dist/compiler/output-structure/locale-modules.test.js +163 -0
- package/dist/compiler/output-structure/locale-modules.test.js.map +1 -0
- package/dist/compiler/output-structure/message-modules.d.ts +4 -0
- package/dist/compiler/output-structure/message-modules.d.ts.map +1 -0
- package/dist/compiler/output-structure/message-modules.js +100 -0
- package/dist/compiler/output-structure/message-modules.js.map +1 -0
- package/dist/compiler/output-structure/message-modules.test.d.ts +1 -0
- package/dist/compiler/output-structure/message-modules.test.d.ts.map +1 -0
- package/dist/compiler/output-structure/message-modules.test.js +148 -0
- package/dist/compiler/output-structure/message-modules.test.js.map +1 -0
- package/dist/compiler/per-locale-build.d.ts +2 -0
- package/dist/compiler/per-locale-build.d.ts.map +1 -0
- package/dist/compiler/per-locale-build.js +3 -0
- package/dist/compiler/per-locale-build.js.map +1 -0
- package/dist/compiler/registry.d.ts +13 -0
- package/dist/compiler/registry.d.ts.map +1 -0
- package/dist/compiler/registry.js +60 -0
- package/dist/compiler/registry.js.map +1 -0
- package/dist/compiler/resolve-tsc-js-path.d.ts +9 -0
- package/dist/compiler/resolve-tsc-js-path.d.ts.map +1 -0
- package/dist/compiler/resolve-tsc-js-path.js +23 -0
- package/dist/compiler/resolve-tsc-js-path.js.map +1 -0
- package/dist/compiler/runtime/check-locale.d.ts +31 -0
- package/dist/compiler/runtime/check-locale.d.ts.map +1 -0
- package/dist/compiler/runtime/check-locale.js +51 -0
- package/dist/compiler/runtime/check-locale.js.map +1 -0
- package/dist/compiler/runtime/check-locale.test.d.ts +1 -0
- package/dist/compiler/runtime/check-locale.test.d.ts.map +1 -0
- package/dist/compiler/runtime/check-locale.test.js +84 -0
- package/dist/compiler/runtime/check-locale.test.js.map +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts +35 -0
- package/dist/compiler/runtime/create-runtime.d.ts.map +1 -0
- package/dist/compiler/runtime/create-runtime.js +196 -0
- package/dist/compiler/runtime/create-runtime.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts +13 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.js +43 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js +149 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.d.ts +13 -0
- package/dist/compiler/runtime/extract-locale-from-header.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.js +45 -0
- package/dist/compiler/runtime/extract-locale-from-header.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.js +55 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts +12 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.js +33 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.js +45 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts +34 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.js +70 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.js +119 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.d.ts +41 -0
- package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.js +96 -0
- package/dist/compiler/runtime/extract-locale-from-request.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.js +351 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.d.ts +11 -0
- package/dist/compiler/runtime/extract-locale-from-url.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.js +68 -0
- package/dist/compiler/runtime/extract-locale-from-url.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.js +127 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.js.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts +44 -0
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.js +133 -0
- package/dist/compiler/runtime/generate-static-localized-urls.js.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.js +159 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.js.map +1 -0
- package/dist/compiler/runtime/get-locale.d.ts +42 -0
- package/dist/compiler/runtime/get-locale.d.ts.map +1 -0
- package/dist/compiler/runtime/get-locale.js +158 -0
- package/dist/compiler/runtime/get-locale.js.map +1 -0
- package/dist/compiler/runtime/get-locale.test.d.ts +1 -0
- package/dist/compiler/runtime/get-locale.test.d.ts.map +1 -0
- package/dist/compiler/runtime/get-locale.test.js +295 -0
- package/dist/compiler/runtime/get-locale.test.js.map +1 -0
- package/dist/compiler/runtime/get-text-direction.d.ts +15 -0
- package/dist/compiler/runtime/get-text-direction.d.ts.map +1 -0
- package/dist/compiler/runtime/get-text-direction.js +46 -0
- package/dist/compiler/runtime/get-text-direction.js.map +1 -0
- package/dist/compiler/runtime/get-text-direction.test.d.ts +1 -0
- package/dist/compiler/runtime/get-text-direction.test.d.ts.map +1 -0
- package/dist/compiler/runtime/get-text-direction.test.js +40 -0
- package/dist/compiler/runtime/get-text-direction.test.js.map +1 -0
- package/dist/compiler/runtime/get-url-origin.d.ts +19 -0
- package/dist/compiler/runtime/get-url-origin.d.ts.map +1 -0
- package/dist/compiler/runtime/get-url-origin.js +31 -0
- package/dist/compiler/runtime/get-url-origin.js.map +1 -0
- package/dist/compiler/runtime/get-url-origin.test.d.ts +1 -0
- package/dist/compiler/runtime/get-url-origin.test.d.ts.map +1 -0
- package/dist/compiler/runtime/get-url-origin.test.js +18 -0
- package/dist/compiler/runtime/get-url-origin.test.js.map +1 -0
- package/dist/compiler/runtime/host-routing.d.ts +28 -0
- package/dist/compiler/runtime/host-routing.d.ts.map +1 -0
- package/dist/compiler/runtime/host-routing.js +79 -0
- package/dist/compiler/runtime/host-routing.js.map +1 -0
- package/dist/compiler/runtime/host-routing.test.d.ts +1 -0
- package/dist/compiler/runtime/host-routing.test.d.ts.map +1 -0
- package/dist/compiler/runtime/host-routing.test.js +128 -0
- package/dist/compiler/runtime/host-routing.test.js.map +1 -0
- package/dist/compiler/runtime/localize-href.d.ts +84 -0
- package/dist/compiler/runtime/localize-href.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-href.js +115 -0
- package/dist/compiler/runtime/localize-href.js.map +1 -0
- package/dist/compiler/runtime/localize-href.test.d.ts +1 -0
- package/dist/compiler/runtime/localize-href.test.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-href.test.js +139 -0
- package/dist/compiler/runtime/localize-href.test.js.map +1 -0
- package/dist/compiler/runtime/localize-url.d.ts +95 -0
- package/dist/compiler/runtime/localize-url.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-url.js +327 -0
- package/dist/compiler/runtime/localize-url.js.map +1 -0
- package/dist/compiler/runtime/localize-url.test.d.ts +1 -0
- package/dist/compiler/runtime/localize-url.test.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-url.test.js +533 -0
- package/dist/compiler/runtime/localize-url.test.js.map +1 -0
- package/dist/compiler/runtime/route-strategy.d.ts +32 -0
- package/dist/compiler/runtime/route-strategy.d.ts.map +1 -0
- package/dist/compiler/runtime/route-strategy.js +72 -0
- package/dist/compiler/runtime/route-strategy.js.map +1 -0
- package/dist/compiler/runtime/set-locale.d.ts +46 -0
- package/dist/compiler/runtime/set-locale.d.ts.map +1 -0
- package/dist/compiler/runtime/set-locale.js +172 -0
- package/dist/compiler/runtime/set-locale.js.map +1 -0
- package/dist/compiler/runtime/set-locale.test.d.ts +1 -0
- package/dist/compiler/runtime/set-locale.test.d.ts.map +1 -0
- package/dist/compiler/runtime/set-locale.test.js +555 -0
- package/dist/compiler/runtime/set-locale.test.js.map +1 -0
- package/dist/compiler/runtime/should-redirect.d.ts +100 -0
- package/dist/compiler/runtime/should-redirect.d.ts.map +1 -0
- package/dist/compiler/runtime/should-redirect.js +155 -0
- package/dist/compiler/runtime/should-redirect.js.map +1 -0
- package/dist/compiler/runtime/should-redirect.test.d.ts +1 -0
- package/dist/compiler/runtime/should-redirect.test.d.ts.map +1 -0
- package/dist/compiler/runtime/should-redirect.test.js +270 -0
- package/dist/compiler/runtime/should-redirect.test.js.map +1 -0
- package/dist/compiler/runtime/strategy.d.ts +63 -0
- package/dist/compiler/runtime/strategy.d.ts.map +1 -0
- package/dist/compiler/runtime/strategy.js +65 -0
- package/dist/compiler/runtime/strategy.js.map +1 -0
- package/dist/compiler/runtime/strategy.test.d.ts +1 -0
- package/dist/compiler/runtime/strategy.test.d.ts.map +1 -0
- package/dist/compiler/runtime/strategy.test.js +90 -0
- package/dist/compiler/runtime/strategy.test.js.map +1 -0
- package/dist/compiler/runtime/track-message-call.d.ts +5 -0
- package/dist/compiler/runtime/track-message-call.d.ts.map +1 -0
- package/dist/compiler/runtime/track-message-call.js +14 -0
- package/dist/compiler/runtime/track-message-call.js.map +1 -0
- package/dist/compiler/runtime/track-message-call.test.d.ts +1 -0
- package/dist/compiler/runtime/track-message-call.test.d.ts.map +1 -0
- package/dist/compiler/runtime/track-message-call.test.js +22 -0
- package/dist/compiler/runtime/track-message-call.test.js.map +1 -0
- package/dist/compiler/runtime/type-definitions.d.ts +197 -0
- package/dist/compiler/runtime/type-definitions.d.ts.map +1 -0
- package/dist/compiler/runtime/type-definitions.js +150 -0
- package/dist/compiler/runtime/type-definitions.js.map +1 -0
- package/dist/compiler/runtime/type.d.ts +47 -0
- package/dist/compiler/runtime/type.d.ts.map +1 -0
- package/dist/compiler/runtime/type.js +2 -0
- package/dist/compiler/runtime/type.js.map +1 -0
- package/dist/compiler/runtime/type.test.d.ts +1 -0
- package/dist/compiler/runtime/type.test.d.ts.map +1 -0
- package/dist/compiler/runtime/type.test.js +153 -0
- package/dist/compiler/runtime/type.test.js.map +1 -0
- package/dist/compiler/runtime/url-pattern.d.ts +12 -0
- package/dist/compiler/runtime/url-pattern.d.ts.map +1 -0
- package/dist/compiler/runtime/url-pattern.js +35 -0
- package/dist/compiler/runtime/url-pattern.js.map +1 -0
- package/dist/compiler/runtime/variables.d.ts +128 -0
- package/dist/compiler/runtime/variables.d.ts.map +1 -0
- package/dist/compiler/runtime/variables.js +111 -0
- package/dist/compiler/runtime/variables.js.map +1 -0
- package/dist/compiler/safe-module-id.d.ts +7 -0
- package/dist/compiler/safe-module-id.d.ts.map +1 -0
- package/dist/compiler/safe-module-id.js +78 -0
- package/dist/compiler/safe-module-id.js.map +1 -0
- package/dist/compiler/safe-module-id.test.d.ts +1 -0
- package/dist/compiler/safe-module-id.test.d.ts.map +1 -0
- package/dist/compiler/safe-module-id.test.js +36 -0
- package/dist/compiler/safe-module-id.test.js.map +1 -0
- package/dist/compiler/seed-previous-compilation.d.ts +7 -0
- package/dist/compiler/seed-previous-compilation.d.ts.map +1 -0
- package/dist/compiler/seed-previous-compilation.js +9 -0
- package/dist/compiler/seed-previous-compilation.js.map +1 -0
- package/dist/compiler/server/create-server-file.d.ts +12 -0
- package/dist/compiler/server/create-server-file.d.ts.map +1 -0
- package/dist/compiler/server/create-server-file.js +91 -0
- package/dist/compiler/server/create-server-file.js.map +1 -0
- package/dist/compiler/server/create-server-file.test.d.ts +1 -0
- package/dist/compiler/server/create-server-file.test.d.ts.map +1 -0
- package/dist/compiler/server/create-server-file.test.js +48 -0
- package/dist/compiler/server/create-server-file.test.js.map +1 -0
- package/dist/compiler/server/middleware.d.ts +98 -0
- package/dist/compiler/server/middleware.d.ts.map +1 -0
- package/dist/compiler/server/middleware.js +278 -0
- package/dist/compiler/server/middleware.js.map +1 -0
- package/dist/compiler/server/middleware.test.d.ts +1 -0
- package/dist/compiler/server/middleware.test.d.ts.map +1 -0
- package/dist/compiler/server/middleware.test.js +1001 -0
- package/dist/compiler/server/middleware.test.js.map +1 -0
- package/dist/compiler/server/type.d.ts +6 -0
- package/dist/compiler/server/type.d.ts.map +1 -0
- package/dist/compiler/server/type.js +2 -0
- package/dist/compiler/server/type.js.map +1 -0
- package/dist/compiler/test-helpers.d.ts +30 -0
- package/dist/compiler/test-helpers.d.ts.map +1 -0
- package/dist/compiler/test-helpers.js +50 -0
- package/dist/compiler/test-helpers.js.map +1 -0
- package/dist/compiler/types.d.ts +7 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +2 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/compiler/variable-access.d.ts +3 -0
- package/dist/compiler/variable-access.d.ts.map +1 -0
- package/dist/compiler/variable-access.js +15 -0
- package/dist/compiler/variable-access.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/ast.d.ts +102 -0
- package/dist/messages/ast.d.ts.map +1 -0
- package/dist/messages/ast.js +8 -0
- package/dist/messages/ast.js.map +1 -0
- package/dist/messages/create-bundle-nested.d.ts +16 -0
- package/dist/messages/create-bundle-nested.d.ts.map +1 -0
- package/dist/messages/create-bundle-nested.js +22 -0
- package/dist/messages/create-bundle-nested.js.map +1 -0
- package/dist/messages/index.d.ts +5 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +5 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/load-messages.d.ts +19 -0
- package/dist/messages/load-messages.d.ts.map +1 -0
- package/dist/messages/load-messages.js +49 -0
- package/dist/messages/load-messages.js.map +1 -0
- package/dist/messages/message-format/flatten.d.ts +9 -0
- package/dist/messages/message-format/flatten.d.ts.map +1 -0
- package/dist/messages/message-format/flatten.js +32 -0
- package/dist/messages/message-format/flatten.js.map +1 -0
- package/dist/messages/message-format/import-files.d.ts +32 -0
- package/dist/messages/message-format/import-files.d.ts.map +1 -0
- package/dist/messages/message-format/import-files.js +53 -0
- package/dist/messages/message-format/import-files.js.map +1 -0
- package/dist/messages/message-format/import-files.test.d.ts +1 -0
- package/dist/messages/message-format/import-files.test.d.ts.map +1 -0
- package/dist/messages/message-format/import-files.test.js +145 -0
- package/dist/messages/message-format/import-files.test.js.map +1 -0
- package/dist/messages/message-format/index.d.ts +6 -0
- package/dist/messages/message-format/index.d.ts.map +1 -0
- package/dist/messages/message-format/index.js +7 -0
- package/dist/messages/message-format/index.js.map +1 -0
- package/dist/messages/message-format/parse-bundle.d.ts +31 -0
- package/dist/messages/message-format/parse-bundle.d.ts.map +1 -0
- package/dist/messages/message-format/parse-bundle.js +169 -0
- package/dist/messages/message-format/parse-bundle.js.map +1 -0
- package/dist/messages/message-format/parse-declaration.d.ts +2 -0
- package/dist/messages/message-format/parse-declaration.d.ts.map +1 -0
- package/dist/messages/message-format/parse-declaration.js +56 -0
- package/dist/messages/message-format/parse-declaration.js.map +1 -0
- package/dist/messages/message-format/parse-markup.d.ts +4 -0
- package/dist/messages/message-format/parse-markup.d.ts.map +1 -0
- package/dist/messages/message-format/parse-markup.js +167 -0
- package/dist/messages/message-format/parse-markup.js.map +1 -0
- package/dist/messages/message-format/parse-matches.d.ts +5 -0
- package/dist/messages/message-format/parse-matches.d.ts.map +1 -0
- package/dist/messages/message-format/parse-matches.js +31 -0
- package/dist/messages/message-format/parse-matches.js.map +1 -0
- package/dist/messages/message-format/parse-pattern.d.ts +5 -0
- package/dist/messages/message-format/parse-pattern.d.ts.map +1 -0
- package/dist/messages/message-format/parse-pattern.js +120 -0
- package/dist/messages/message-format/parse-pattern.js.map +1 -0
- package/dist/messages/message-format/unique.d.ts +2 -0
- package/dist/messages/message-format/unique.d.ts.map +1 -0
- package/dist/messages/message-format/unique.js +5 -0
- package/dist/messages/message-format/unique.js.map +1 -0
- package/dist/messages/nest-bundles.d.ts +19 -0
- package/dist/messages/nest-bundles.d.ts.map +1 -0
- package/dist/messages/nest-bundles.js +49 -0
- package/dist/messages/nest-bundles.js.map +1 -0
- package/dist/services/account/index.d.ts +14 -0
- package/dist/services/account/index.d.ts.map +1 -0
- package/dist/services/account/index.js +43 -0
- package/dist/services/account/index.js.map +1 -0
- package/dist/services/account/types.d.ts +4 -0
- package/dist/services/account/types.d.ts.map +1 -0
- package/dist/services/account/types.js +2 -0
- package/dist/services/account/types.js.map +1 -0
- package/dist/services/codegen/escape.d.ts +9 -0
- package/dist/services/codegen/escape.d.ts.map +1 -0
- package/dist/services/codegen/escape.js +19 -0
- package/dist/services/codegen/escape.js.map +1 -0
- package/dist/services/codegen/quotes.d.ts +4 -0
- package/dist/services/codegen/quotes.d.ts.map +1 -0
- package/dist/services/codegen/quotes.js +5 -0
- package/dist/services/codegen/quotes.js.map +1 -0
- package/dist/services/env-variables/create-index-file.d.ts +9 -0
- package/dist/services/env-variables/create-index-file.d.ts.map +1 -0
- package/dist/services/env-variables/create-index-file.js +28 -0
- package/dist/services/env-variables/create-index-file.js.map +1 -0
- package/dist/services/env-variables/index.d.ts +3 -0
- package/dist/services/env-variables/index.d.ts.map +1 -0
- package/dist/services/env-variables/index.js +4 -0
- package/dist/services/env-variables/index.js.map +1 -0
- package/dist/services/environment/package.d.ts +9 -0
- package/dist/services/environment/package.d.ts.map +1 -0
- package/dist/services/environment/package.js +31 -0
- package/dist/services/environment/package.js.map +1 -0
- package/dist/services/environment/package.test.d.ts +1 -0
- package/dist/services/environment/package.test.d.ts.map +1 -0
- package/dist/services/environment/package.test.js +21 -0
- package/dist/services/environment/package.test.js.map +1 -0
- package/dist/services/error-handling.d.ts +12 -0
- package/dist/services/error-handling.d.ts.map +1 -0
- package/dist/services/error-handling.js +27 -0
- package/dist/services/error-handling.js.map +1 -0
- package/dist/services/error-handling.test.d.ts +1 -0
- package/dist/services/error-handling.test.d.ts.map +1 -0
- package/dist/services/error-handling.test.js +10 -0
- package/dist/services/error-handling.test.js.map +1 -0
- package/dist/services/file-handling/content-hash.d.ts +9 -0
- package/dist/services/file-handling/content-hash.js +19 -0
- package/dist/services/file-handling/content-hash.js.map +1 -0
- package/dist/services/file-handling/exists.d.ts +7 -0
- package/dist/services/file-handling/exists.d.ts.map +1 -0
- package/dist/services/file-handling/exists.js +24 -0
- package/dist/services/file-handling/exists.js.map +1 -0
- package/dist/services/file-handling/exists.test.d.ts +1 -0
- package/dist/services/file-handling/exists.test.d.ts.map +1 -0
- package/dist/services/file-handling/exists.test.js +27 -0
- package/dist/services/file-handling/exists.test.js.map +1 -0
- package/dist/services/file-handling/types.d.ts +4 -0
- package/dist/services/file-handling/types.d.ts.map +1 -0
- package/dist/services/file-handling/types.js +2 -0
- package/dist/services/file-handling/types.js.map +1 -0
- package/dist/services/file-handling/write-output.d.ts +21 -0
- package/dist/services/file-handling/write-output.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.js +157 -0
- package/dist/services/file-handling/write-output.js.map +1 -0
- package/dist/services/file-handling/write-output.test.d.ts +1 -0
- package/dist/services/file-handling/write-output.test.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.test.js +217 -0
- package/dist/services/file-handling/write-output.test.js.map +1 -0
- package/dist/services/file-watching/tracked-fs.d.ts +25 -0
- package/dist/services/file-watching/tracked-fs.d.ts.map +1 -0
- package/dist/services/file-watching/tracked-fs.js +94 -0
- package/dist/services/file-watching/tracked-fs.js.map +1 -0
- package/dist/services/file-watching/tracked-fs.test.d.ts +1 -0
- package/dist/services/file-watching/tracked-fs.test.d.ts.map +1 -0
- package/dist/services/file-watching/tracked-fs.test.js +87 -0
- package/dist/services/file-watching/tracked-fs.test.js.map +1 -0
- package/dist/services/logger/index.d.ts +17 -0
- package/dist/services/logger/index.d.ts.map +1 -0
- package/dist/services/logger/index.js +58 -0
- package/dist/services/logger/index.js.map +1 -0
- package/dist/services/lookup.d.ts +14 -0
- package/dist/services/lookup.d.ts.map +1 -0
- package/dist/services/lookup.js +24 -0
- package/dist/services/lookup.js.map +1 -0
- package/dist/urlpattern-polyfill/index.d.ts +2 -0
- package/dist/urlpattern-polyfill/index.d.ts.map +1 -0
- package/dist/urlpattern-polyfill/index.js +2 -0
- package/dist/urlpattern-polyfill/index.js.map +1 -0
- package/dist/utilities/detect-json-formatting.d.ts +10 -0
- package/dist/utilities/detect-json-formatting.d.ts.map +1 -0
- package/dist/utilities/detect-json-formatting.js +80 -0
- package/dist/utilities/detect-json-formatting.js.map +1 -0
- package/dist/utilities/node-normalize-path.d.ts +1 -0
- package/dist/utilities/node-normalize-path.d.ts.map +1 -0
- package/dist/utilities/node-normalize-path.js +10 -0
- package/dist/utilities/node-normalize-path.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import { createParaglide } from "../create-paraglide.js";
|
|
3
|
+
test("pathname based localization", async () => {
|
|
4
|
+
const runtime = await createParaglide({
|
|
5
|
+
baseLocale: "en",
|
|
6
|
+
locales: ["en", "de"],
|
|
7
|
+
strategy: ["url"],
|
|
8
|
+
urlPatterns: [
|
|
9
|
+
// literal match
|
|
10
|
+
{
|
|
11
|
+
pattern: "/blog/about",
|
|
12
|
+
localized: [
|
|
13
|
+
["en", "/blog/about"],
|
|
14
|
+
["de", "/de/artikel/ueber-uns"],
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
// parameter
|
|
18
|
+
{
|
|
19
|
+
pattern: "/blog/:id",
|
|
20
|
+
localized: [
|
|
21
|
+
["en", "/blog/:id"],
|
|
22
|
+
["de", "/de/artikel/:id"],
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
// wildcard
|
|
26
|
+
{
|
|
27
|
+
pattern: "/:path(.*)",
|
|
28
|
+
localized: [
|
|
29
|
+
["de", "/de/:path(.*)"],
|
|
30
|
+
["en", "/:path(.*)"],
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
// wildcard - en to de
|
|
36
|
+
expect(runtime.localizeUrl("https://example.com/home", { locale: "de" }).href).toBe("https://example.com/de/home");
|
|
37
|
+
// wildcard - de to en
|
|
38
|
+
expect(runtime.localizeUrl("https://example.com/de/home", { locale: "en" }).href).toBe("https://example.com/home");
|
|
39
|
+
// wildcard - en to en
|
|
40
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
41
|
+
// wildcard - delocalizing de
|
|
42
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about").href).toBe("https://example.com/about");
|
|
43
|
+
// literal match
|
|
44
|
+
expect(runtime.localizeUrl("https://example.com/blog/about", { locale: "de" }).href).toBe("https://example.com/de/artikel/ueber-uns");
|
|
45
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/artikel/ueber-uns").href).toBe("https://example.com/blog/about");
|
|
46
|
+
// parameter matching
|
|
47
|
+
expect(runtime.localizeUrl("https://example.com/blog/56", { locale: "de" }).href).toBe("https://example.com/de/artikel/56");
|
|
48
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/artikel/56").href).toBe("https://example.com/blog/56");
|
|
49
|
+
});
|
|
50
|
+
test("cross domain urls", async () => {
|
|
51
|
+
const runtime = await createParaglide({
|
|
52
|
+
baseLocale: "en",
|
|
53
|
+
locales: ["en", "de"],
|
|
54
|
+
strategy: ["url"],
|
|
55
|
+
urlPatterns: [
|
|
56
|
+
// Development/deployment mapping
|
|
57
|
+
{
|
|
58
|
+
pattern: "https://localhost::port/:path*",
|
|
59
|
+
localized: [
|
|
60
|
+
["de", "https://localhost::port/de/:path*"],
|
|
61
|
+
["en", "https://localhost::port/:path*"],
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
// Domain based localization
|
|
65
|
+
{
|
|
66
|
+
pattern: "https://example.com/:path*",
|
|
67
|
+
localized: [
|
|
68
|
+
["en", "https://example.com/:path*"],
|
|
69
|
+
["de", "https://de.example.com/:path*"],
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
// in development use localhost with different mapping
|
|
75
|
+
expect(runtime.localizeUrl("https://localhost:5173/about", { locale: "de" }).href).toBe("https://localhost:5173/de/about");
|
|
76
|
+
expect(runtime.localizeUrl("https://localhost:5173/about", { locale: "en" }).href).toBe("https://localhost:5173/about");
|
|
77
|
+
expect(runtime.deLocalizeUrl("https://localhost:5173/de/about").href).toBe("https://localhost:5173/about");
|
|
78
|
+
// DE routing
|
|
79
|
+
expect(runtime.localizeUrl("https://de.example.com/about", { locale: "de" }).href).toBe("https://de.example.com/about");
|
|
80
|
+
expect(runtime.localizeUrl("https://de.example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
81
|
+
// delocalizing
|
|
82
|
+
expect(runtime.deLocalizeUrl("https://de.example.com/about").href).toBe("https://example.com/about");
|
|
83
|
+
// EN routing
|
|
84
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://de.example.com/about");
|
|
85
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
86
|
+
// delocalizing
|
|
87
|
+
expect(runtime.deLocalizeUrl("https://example.com/about").href).toBe("https://example.com/about");
|
|
88
|
+
});
|
|
89
|
+
test("multi tenancy", async () => {
|
|
90
|
+
const runtime = await createParaglide({
|
|
91
|
+
baseLocale: "en",
|
|
92
|
+
locales: ["en", "de", "fr"],
|
|
93
|
+
strategy: ["url"],
|
|
94
|
+
urlPatterns: [
|
|
95
|
+
// 1) customer1.fr => root path locale is fr, other locales via sub-path e.g. /en/
|
|
96
|
+
{
|
|
97
|
+
pattern: "https://customer1.fr/:path*",
|
|
98
|
+
localized: [
|
|
99
|
+
["en", "https://customer1.fr/en/:path*"],
|
|
100
|
+
["fr", "https://customer1.fr/:path*"],
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
// 2) customer2.com => root path locale is en, other locales via sub-path e.g. /fr/
|
|
104
|
+
{
|
|
105
|
+
pattern: "https://customer2.com/:path*",
|
|
106
|
+
localized: [
|
|
107
|
+
["fr", "https://customer2.com/fr/:path*"],
|
|
108
|
+
["en", "https://customer2.com/:path*"],
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
// 3) Any other domain => path-based for en/fr
|
|
112
|
+
{
|
|
113
|
+
pattern: "https://:domain(.*)/:path*",
|
|
114
|
+
localized: [
|
|
115
|
+
["en", "https://:domain(.*)/en/:path*"],
|
|
116
|
+
["fr", "https://:domain(.*)/fr/:path*"],
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
// customer 1 - localizing french to french
|
|
122
|
+
expect(runtime.localizeUrl("https://customer1.fr/about", { locale: "fr" }).href).toBe("https://customer1.fr/about");
|
|
123
|
+
// customer 1 - localizing from french to english
|
|
124
|
+
expect(runtime.localizeUrl("https://customer1.fr/about", { locale: "en" }).href).toBe("https://customer1.fr/en/about");
|
|
125
|
+
// customer 1 - de-localizing french
|
|
126
|
+
expect(runtime.deLocalizeUrl("https://customer1.fr/en/about").href).toBe("https://customer1.fr/about");
|
|
127
|
+
// customer 2 - english to english
|
|
128
|
+
expect(runtime.localizeUrl("https://customer2.com/about", { locale: "en" }).href).toBe("https://customer2.com/about");
|
|
129
|
+
// customer 2 - english to french
|
|
130
|
+
expect(runtime.localizeUrl("https://customer2.com/about", { locale: "fr" }).href).toBe("https://customer2.com/fr/about");
|
|
131
|
+
// customer 2 - de-localize french
|
|
132
|
+
expect(runtime.deLocalizeUrl("https://customer2.com/fr/about").href).toBe("https://customer2.com/about");
|
|
133
|
+
});
|
|
134
|
+
test("providing a URL object as input", async () => {
|
|
135
|
+
const runtime = await createParaglide({
|
|
136
|
+
baseLocale: "en",
|
|
137
|
+
locales: ["en", "de"],
|
|
138
|
+
strategy: ["url"],
|
|
139
|
+
urlPatterns: [
|
|
140
|
+
{
|
|
141
|
+
pattern: "https://:domain(.*)/:path*",
|
|
142
|
+
localized: [
|
|
143
|
+
["en", "https://:domain(.*)/:path*"],
|
|
144
|
+
["de", "https://de.:domain(.*)/:path*"],
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
});
|
|
149
|
+
const url = new URL("https://example.com/about");
|
|
150
|
+
expect(runtime.localizeUrl(url, { locale: "de" }).href).toBe("https://de.example.com/about");
|
|
151
|
+
expect(runtime.deLocalizeUrl(url).href).toBe("https://example.com/about");
|
|
152
|
+
});
|
|
153
|
+
test("localhost with portname", async () => {
|
|
154
|
+
const runtime = await createParaglide({
|
|
155
|
+
baseLocale: "en",
|
|
156
|
+
locales: ["en", "de"],
|
|
157
|
+
strategy: ["url"],
|
|
158
|
+
urlPatterns: [
|
|
159
|
+
{
|
|
160
|
+
pattern: ":protocol://:domain(.*)::port?/:path(.*)?",
|
|
161
|
+
localized: [
|
|
162
|
+
["de", ":protocol://:domain(.*)::port?/de/:path(.*)?"],
|
|
163
|
+
["en", ":protocol://:domain(.*)::port?/:path(.*)?"],
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
});
|
|
168
|
+
// http
|
|
169
|
+
expect(runtime.deLocalizeUrl(new URL("http://localhost:5173/de/about")).href).toBe("http://localhost:5173/about");
|
|
170
|
+
// https
|
|
171
|
+
expect(runtime.deLocalizeUrl(new URL("https://localhost:5173/de/about")).href).toBe("https://localhost:5173/about");
|
|
172
|
+
// no port
|
|
173
|
+
expect(runtime.deLocalizeUrl(new URL("https://localhost/de/about")).href).toBe("https://localhost/about");
|
|
174
|
+
// pathnames
|
|
175
|
+
expect(runtime.deLocalizeUrl(new URL("http://localhost:5173/about")).href).toBe("http://localhost:5173/about");
|
|
176
|
+
expect(runtime.deLocalizeUrl(new URL("http://localhost:5173/")).href).toBe("http://localhost:5173/");
|
|
177
|
+
expect(runtime.deLocalizeUrl(new URL("https://localhost:5173/de")).href).toBe("https://localhost:5173/");
|
|
178
|
+
});
|
|
179
|
+
test("it keeps the query parameters", async () => {
|
|
180
|
+
const runtime = await createParaglide({
|
|
181
|
+
baseLocale: "en",
|
|
182
|
+
locales: ["en", "de"],
|
|
183
|
+
strategy: ["url"],
|
|
184
|
+
urlPatterns: [
|
|
185
|
+
{
|
|
186
|
+
pattern: "https://:domain(.*)/:path(.*)?",
|
|
187
|
+
localized: [
|
|
188
|
+
["de", "https://:domain(.*)/de/:path(.*)?"],
|
|
189
|
+
["en", "https://:domain(.*)/:path(.*)?"],
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
});
|
|
194
|
+
expect(runtime.localizeUrl("https://example.com/about?foo=bar&baz=qux", {
|
|
195
|
+
locale: "de",
|
|
196
|
+
}).href).toBe("https://example.com/de/about?foo=bar&baz=qux");
|
|
197
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about?foo=bar&baz=qux").href).toBe("https://example.com/about?foo=bar&baz=qux");
|
|
198
|
+
});
|
|
199
|
+
test("it keeps the url hash", async () => {
|
|
200
|
+
const runtime = await createParaglide({
|
|
201
|
+
baseLocale: "en",
|
|
202
|
+
locales: ["en", "de"],
|
|
203
|
+
strategy: ["url"],
|
|
204
|
+
urlPatterns: [
|
|
205
|
+
{
|
|
206
|
+
pattern: "https://:domain(.*)/:path(.*)?",
|
|
207
|
+
localized: [
|
|
208
|
+
["de", "https://:domain(.*)/de/:path(.*)?"],
|
|
209
|
+
["en", "https://:domain(.*)/:path(.*)?"],
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
});
|
|
214
|
+
expect(runtime.localizeUrl("https://example.com/about#test", { locale: "de" }).href).toBe("https://example.com/de/about#test");
|
|
215
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about#test").href).toBe("https://example.com/about#test");
|
|
216
|
+
});
|
|
217
|
+
// URL Pattern implicitly matches all paths
|
|
218
|
+
//
|
|
219
|
+
// The pattern https://example.com is interpreted as https://example.com.*
|
|
220
|
+
// It effectively matches every path under https://example.com/
|
|
221
|
+
// This means any request, including https://example.com/about, will match.
|
|
222
|
+
test("it keeps the url path", async () => {
|
|
223
|
+
const runtime = await createParaglide({
|
|
224
|
+
baseLocale: "en",
|
|
225
|
+
locales: ["en", "de"],
|
|
226
|
+
strategy: ["url"],
|
|
227
|
+
urlPatterns: [
|
|
228
|
+
{
|
|
229
|
+
pattern: "https://example.com",
|
|
230
|
+
localized: [
|
|
231
|
+
["de", "https://example.de"],
|
|
232
|
+
["en", "https://example.com"],
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
});
|
|
237
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.de/about");
|
|
238
|
+
expect(runtime.deLocalizeUrl("https://example.de/about").href).toBe("https://example.com/about");
|
|
239
|
+
});
|
|
240
|
+
test("uses getLocale when no locale is provided", async () => {
|
|
241
|
+
const runtime = await createParaglide({
|
|
242
|
+
baseLocale: "en",
|
|
243
|
+
locales: ["en", "de"],
|
|
244
|
+
strategy: ["url"],
|
|
245
|
+
urlPatterns: [
|
|
246
|
+
{
|
|
247
|
+
pattern: "https://:domain(.*)/:path(.*)?",
|
|
248
|
+
localized: [
|
|
249
|
+
["de", "https://:domain(.*)/de/:path(.*)?"],
|
|
250
|
+
["en", "https://:domain(.*)/en/:path(.*)?"],
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
});
|
|
255
|
+
// Override getLocale to return German
|
|
256
|
+
runtime.overwriteGetLocale(() => "de");
|
|
257
|
+
expect(runtime.getLocale()).toBe("de");
|
|
258
|
+
// Should use "de" from getLocale since no locale provided
|
|
259
|
+
expect(runtime.localizeUrl("https://example.com/about").href).toBe("https://example.com/de/about");
|
|
260
|
+
// Should still use explicit locale when provided
|
|
261
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/en/about");
|
|
262
|
+
});
|
|
263
|
+
test("normalizes mixed-case explicit locales for custom url patterns", async () => {
|
|
264
|
+
const runtime = await createParaglide({
|
|
265
|
+
baseLocale: "en",
|
|
266
|
+
locales: ["en", "de"],
|
|
267
|
+
strategy: ["url"],
|
|
268
|
+
urlPatterns: [
|
|
269
|
+
{
|
|
270
|
+
pattern: "https://:domain(.*)/:path(.*)?",
|
|
271
|
+
localized: [
|
|
272
|
+
["de", "https://:domain(.*)/de/:path(.*)?"],
|
|
273
|
+
["en", "https://:domain(.*)/:path(.*)?"],
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
});
|
|
278
|
+
expect(runtime.localizeUrl("https://example.com/about", {
|
|
279
|
+
locale: "DE",
|
|
280
|
+
}).href).toBe("https://example.com/de/about");
|
|
281
|
+
expect(runtime.localizeUrl("https://example.com/de/about", {
|
|
282
|
+
locale: "EN",
|
|
283
|
+
}).href).toBe("https://example.com/about");
|
|
284
|
+
});
|
|
285
|
+
// https://github.com/opral/inlang-paraglide-js/issues/381
|
|
286
|
+
test.each([
|
|
287
|
+
// empty url pattern will set TREE_SHAKE_DEFAULT_ULR_PATTERN_USED to true
|
|
288
|
+
{},
|
|
289
|
+
// real default url pattern to align behaviour
|
|
290
|
+
{
|
|
291
|
+
urlPatterns: [
|
|
292
|
+
{
|
|
293
|
+
pattern: ":protocol://:domain(.*)::port?/:path(.*)?",
|
|
294
|
+
localized: [
|
|
295
|
+
["de", ":protocol://:domain(.*)::port?/de/:path(.*)?"],
|
|
296
|
+
["en", ":protocol://:domain(.*)::port?/:path(.*)?"],
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
])("default url pattern", async (compilerOptions) => {
|
|
302
|
+
const runtime = await createParaglide({
|
|
303
|
+
baseLocale: "en",
|
|
304
|
+
locales: ["en", "de"],
|
|
305
|
+
...compilerOptions,
|
|
306
|
+
});
|
|
307
|
+
runtime.overwriteGetLocale(() => "en");
|
|
308
|
+
expect(runtime.localizeUrl("https://example.com/about").href).toBe("https://example.com/about");
|
|
309
|
+
runtime.overwriteGetLocale(() => "de");
|
|
310
|
+
expect(runtime.localizeUrl("https://example.com/").href).toBe("https://example.com/de/");
|
|
311
|
+
expect(runtime.localizeUrl("https://example.com/about").href).toBe("https://example.com/de/about");
|
|
312
|
+
// Should still use explicit locale when provided
|
|
313
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.com/de/about");
|
|
314
|
+
expect(runtime.localizeUrl("https://example.com/about", {
|
|
315
|
+
locale: "DE",
|
|
316
|
+
}).href).toBe("https://example.com/de/about");
|
|
317
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
318
|
+
expect(runtime.localizeUrl("https://example.com/de/about", {
|
|
319
|
+
locale: "EN",
|
|
320
|
+
}).href).toBe("https://example.com/about");
|
|
321
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about").href).toBe("https://example.com/about");
|
|
322
|
+
expect(runtime.deLocalizeUrl("https://example.com/about").href).toBe("https://example.com/about");
|
|
323
|
+
});
|
|
324
|
+
test("auto fills the url base path", async () => {
|
|
325
|
+
const runtime = await createParaglide({
|
|
326
|
+
baseLocale: "en",
|
|
327
|
+
locales: ["en", "de"],
|
|
328
|
+
strategy: ["url"],
|
|
329
|
+
urlPatterns: [
|
|
330
|
+
{
|
|
331
|
+
pattern: "/:path(.*)?",
|
|
332
|
+
localized: [
|
|
333
|
+
["de", "/de/:path(.*)?"],
|
|
334
|
+
["en", "/:path(.*)?"],
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
});
|
|
339
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
340
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.com/de/about");
|
|
341
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about").href).toBe("https://example.com/about");
|
|
342
|
+
});
|
|
343
|
+
// https://github.com/opral/inlang-paraglide-js/issues/454
|
|
344
|
+
test("works with no trailing slash at the end", async () => {
|
|
345
|
+
const runtime = await createParaglide({
|
|
346
|
+
baseLocale: "en",
|
|
347
|
+
locales: ["en", "de"],
|
|
348
|
+
strategy: ["url"],
|
|
349
|
+
urlPatterns: [
|
|
350
|
+
{
|
|
351
|
+
pattern: "/:path(.*)?",
|
|
352
|
+
localized: [
|
|
353
|
+
["en", "/en/:path(.*)?"],
|
|
354
|
+
["de", "/de/:path(.*)?"],
|
|
355
|
+
],
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
});
|
|
359
|
+
expect(runtime.deLocalizeUrl("https://example.com/en/").href).toBe("https://example.com/");
|
|
360
|
+
expect(runtime.deLocalizeUrl("https://example.com/en").href).toBe("https://example.com/");
|
|
361
|
+
});
|
|
362
|
+
// https://github.com/opral/inlang-paraglide-js/issues/452#issuecomment-2715761308
|
|
363
|
+
test("falls through if no match is found", async () => {
|
|
364
|
+
const runtime = await createParaglide({
|
|
365
|
+
baseLocale: "en",
|
|
366
|
+
locales: ["en", "de"],
|
|
367
|
+
strategy: ["url"],
|
|
368
|
+
urlPatterns: [
|
|
369
|
+
{
|
|
370
|
+
pattern: "/about",
|
|
371
|
+
localized: [
|
|
372
|
+
["de", "/ueber"],
|
|
373
|
+
["en", "/about"],
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
});
|
|
378
|
+
expect(runtime.localizeUrl("https://example.com/", { locale: "en" }).href).toBe("https://example.com/");
|
|
379
|
+
expect(runtime.deLocalizeUrl("https://example.com/").href).toBe("https://example.com/");
|
|
380
|
+
});
|
|
381
|
+
test("defining no localized pattern leads to a fallthrough", async () => {
|
|
382
|
+
const runtime = await createParaglide({
|
|
383
|
+
baseLocale: "en",
|
|
384
|
+
locales: ["en", "de"],
|
|
385
|
+
strategy: ["url"],
|
|
386
|
+
urlPatterns: [
|
|
387
|
+
{
|
|
388
|
+
pattern: "/specific-path",
|
|
389
|
+
localized: [["en", "/specific-path"]],
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
});
|
|
393
|
+
// doesn't localize because no localized pattern is defined
|
|
394
|
+
expect(runtime.localizeUrl("https://example.com/specific-path", { locale: "de" })
|
|
395
|
+
.href).toBe("https://example.com/specific-path");
|
|
396
|
+
// doesn't delocalize because no localized pattern is defined
|
|
397
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/specific-path").href).toBe("https://example.com/de/specific-path");
|
|
398
|
+
});
|
|
399
|
+
// https://github.com/opral/inlang-paraglide-js/issues/456
|
|
400
|
+
test("routing to a 404 page", async () => {
|
|
401
|
+
const runtime = await createParaglide({
|
|
402
|
+
baseLocale: "en",
|
|
403
|
+
locales: ["en", "de"],
|
|
404
|
+
strategy: ["url"],
|
|
405
|
+
urlPatterns: [
|
|
406
|
+
{
|
|
407
|
+
pattern: "/404",
|
|
408
|
+
localized: [
|
|
409
|
+
["en", "/404"],
|
|
410
|
+
["de", "/de/404"],
|
|
411
|
+
],
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
pattern: "specific-path",
|
|
415
|
+
localized: [
|
|
416
|
+
["en", "/specific-path"],
|
|
417
|
+
["de", "/de/404"],
|
|
418
|
+
],
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
pattern: "/:path(.*)?",
|
|
422
|
+
localized: [
|
|
423
|
+
["en", "/:path(.*)?"],
|
|
424
|
+
["de", "/de/:path(.*)?"],
|
|
425
|
+
],
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
});
|
|
429
|
+
expect(runtime.localizeUrl("https://example.com/specific-path", { locale: "en" })
|
|
430
|
+
.href).toBe("https://example.com/specific-path");
|
|
431
|
+
// localizing to a 404 page
|
|
432
|
+
expect(runtime.localizeUrl("https://example.com/specific-path", { locale: "de" })
|
|
433
|
+
.href).toBe("https://example.com/de/404");
|
|
434
|
+
// other paths work because of the catch all
|
|
435
|
+
expect(runtime.localizeUrl("https://example.com/other-path", { locale: "de" }).href).toBe("https://example.com/de/other-path");
|
|
436
|
+
});
|
|
437
|
+
// Test showing the importance of pattern order in the localized array
|
|
438
|
+
test("pattern order in localized array - correct order (specific first)", async () => {
|
|
439
|
+
const runtime = await createParaglide({
|
|
440
|
+
baseLocale: "en",
|
|
441
|
+
locales: ["en", "de"],
|
|
442
|
+
strategy: ["url"],
|
|
443
|
+
urlPatterns: [
|
|
444
|
+
{
|
|
445
|
+
pattern: "/:path(.*)?",
|
|
446
|
+
localized: [
|
|
447
|
+
// CORRECT ORDER: more specific pattern first
|
|
448
|
+
["de", "/de/:path(.*)?"], // More specific pattern with prefix
|
|
449
|
+
["en", "/:path(.*)?"], // Less specific pattern without prefix
|
|
450
|
+
],
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
});
|
|
454
|
+
// These should work correctly with the specific (de) pattern first
|
|
455
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
456
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.com/de/about");
|
|
457
|
+
// Delocalization should work correctly too
|
|
458
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about").href).toBe("https://example.com/about");
|
|
459
|
+
});
|
|
460
|
+
// Test showing the importance of pattern order in the localized array
|
|
461
|
+
test("pattern order in localized array - incorrect order (generic first)", async () => {
|
|
462
|
+
const runtime = await createParaglide({
|
|
463
|
+
baseLocale: "en",
|
|
464
|
+
locales: ["en", "de"],
|
|
465
|
+
strategy: ["url"],
|
|
466
|
+
urlPatterns: [
|
|
467
|
+
{
|
|
468
|
+
pattern: "/:path(.*)?",
|
|
469
|
+
localized: [
|
|
470
|
+
// INCORRECT ORDER: less specific pattern first
|
|
471
|
+
["en", "/:path(.*)?"], // Less specific pattern without prefix
|
|
472
|
+
["de", "/de/:path(.*)?"], // More specific pattern with prefix that may never match
|
|
473
|
+
],
|
|
474
|
+
},
|
|
475
|
+
],
|
|
476
|
+
});
|
|
477
|
+
// English localization works as expected
|
|
478
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
|
|
479
|
+
// German localization still works when explicitly requested
|
|
480
|
+
expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.com/de/about");
|
|
481
|
+
// The problem happens with delocalization:
|
|
482
|
+
// With incorrect pattern order, the generic /:path(.*)?
|
|
483
|
+
// pattern matches first and swallows the /de/ prefix
|
|
484
|
+
expect(runtime.deLocalizeUrl("https://example.com/de/about").href).toBe("https://example.com/de/about"); // Should be "https://example.com/about"
|
|
485
|
+
});
|
|
486
|
+
// Test for port number issue with specific port numbers in the URL pattern
|
|
487
|
+
test("handles explicit port numbers in URL patterns correctly", async () => {
|
|
488
|
+
const runtime = await createParaglide({
|
|
489
|
+
baseLocale: "en",
|
|
490
|
+
locales: ["en", "de"],
|
|
491
|
+
strategy: ["url"],
|
|
492
|
+
urlPatterns: [
|
|
493
|
+
{
|
|
494
|
+
// Using explicit port number - this causes issues with deLocalizeUrl
|
|
495
|
+
pattern: "http://localhost:5173/:path(.*)?",
|
|
496
|
+
localized: [
|
|
497
|
+
["de", "http://localhost:5173/de/:path(.*)?"],
|
|
498
|
+
["en", "http://localhost:5173/:path(.*)?"],
|
|
499
|
+
],
|
|
500
|
+
},
|
|
501
|
+
],
|
|
502
|
+
});
|
|
503
|
+
// Localization should work correctly
|
|
504
|
+
expect(runtime.localizeUrl("http://localhost:5173/about", { locale: "de" }).href).toBe("http://localhost:5173/de/about");
|
|
505
|
+
expect(runtime.localizeUrl("http://localhost:5173/about", { locale: "en" }).href).toBe("http://localhost:5173/about");
|
|
506
|
+
// This is where the bug occurs - delocalizing a URL with a port number
|
|
507
|
+
// The port number (5173) is incorrectly treated as a path parameter
|
|
508
|
+
expect(runtime.deLocalizeUrl("http://localhost:5173/de/about").href).toBe("http://localhost:5173/about");
|
|
509
|
+
});
|
|
510
|
+
// Test for the correct approach using port as a pattern parameter
|
|
511
|
+
test("correctly handles port numbers as pattern parameters", async () => {
|
|
512
|
+
const runtime = await createParaglide({
|
|
513
|
+
baseLocale: "en",
|
|
514
|
+
locales: ["en", "de"],
|
|
515
|
+
strategy: ["url"],
|
|
516
|
+
urlPatterns: [
|
|
517
|
+
{
|
|
518
|
+
// Using port as a proper pattern parameter with :: syntax
|
|
519
|
+
pattern: "http://localhost::port/:path(.*)?",
|
|
520
|
+
localized: [
|
|
521
|
+
["de", "http://localhost::port/de/:path(.*)?"],
|
|
522
|
+
["en", "http://localhost::port/:path(.*)?"],
|
|
523
|
+
],
|
|
524
|
+
},
|
|
525
|
+
],
|
|
526
|
+
});
|
|
527
|
+
// Localization should work correctly
|
|
528
|
+
expect(runtime.localizeUrl("http://localhost:5173/about", { locale: "de" }).href).toBe("http://localhost:5173/de/about");
|
|
529
|
+
expect(runtime.localizeUrl("http://localhost:5173/about", { locale: "en" }).href).toBe("http://localhost:5173/about");
|
|
530
|
+
// Delocalization should also work correctly with the proper pattern
|
|
531
|
+
expect(runtime.deLocalizeUrl("http://localhost:5173/de/about").href).toBe("http://localhost:5173/about");
|
|
532
|
+
});
|
|
533
|
+
//# sourceMappingURL=localize-url.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localize-url.test.js","sourceRoot":"","sources":["../../../src/compiler/runtime/localize-url.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,IAAI,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;IAC9C,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;QACrC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;QACrB,QAAQ,EAAE,CAAC,KAAK,CAAC;QACjB,WAAW,EAAE;YACZ,gBAAgB;YAChB;gBACC,OAAO,EAAE,aAAa;gBACtB,SAAS,EAAE;oBACV,CAAC,IAAI,EAAE,aAAa,CAAC;oBACrB,CAAC,IAAI,EAAE,uBAAuB,CAAC;iBAC/B;aACD;Y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ACrC,MAAM,CACL,OAAO,CAAC,WAAW,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CACzE,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAEzC,MAAM,CACL,OAAO,CAAC,WAAW,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CACzE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAEtC,oEAAoE;IACpE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,gCAAgC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CACxE,6BAA6B,CAC7B,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from \"vitest\";\nimport { createParaglide } from \"../create-paraglide.js\";\n\ntest(\"pathname based localization\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t// literal match\n\t\t\t{\n\t\t\t\tpattern: \"/blog/about\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"/blog/about\"],\n\t\t\t\t\t[\"de\", \"/de/artikel/ueber-uns\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t// parameter\n\t\t\t{\n\t\t\t\tpattern: \"/blog/:id\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"/blog/:id\"],\n\t\t\t\t\t[\"de\", \"/de/artikel/:id\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t// wildcard\n\t\t\t{\n\t\t\t\tpattern: \"/:path(.*)\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"/de/:path(.*)\"],\n\t\t\t\t\t[\"en\", \"/:path(.*)\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// wildcard - en to de\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/home\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/home\");\n\n\t// wildcard - de to en\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/de/home\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/home\");\n\n\t// wildcard - en to en\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\t// wildcard - delocalizing de\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n\n\t// literal match\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/blog/about\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/artikel/ueber-uns\");\n\n\texpect(\n\t\truntime.deLocalizeUrl(\"https://example.com/de/artikel/ueber-uns\").href\n\t).toBe(\"https://example.com/blog/about\");\n\n\t// parameter matching\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/blog/56\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/artikel/56\");\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/artikel/56\").href).toBe(\n\t\t\"https://example.com/blog/56\"\n\t);\n});\n\ntest(\"cross domain urls\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t// Development/deployment mapping\n\t\t\t{\n\t\t\t\tpattern: \"https://localhost::port/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"https://localhost::port/de/:path*\"],\n\t\t\t\t\t[\"en\", \"https://localhost::port/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t// Domain based localization\n\t\t\t{\n\t\t\t\tpattern: \"https://example.com/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://example.com/:path*\"],\n\t\t\t\t\t[\"de\", \"https://de.example.com/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// in development use localhost with different mapping\n\texpect(\n\t\truntime.localizeUrl(\"https://localhost:5173/about\", { locale: \"de\" }).href\n\t).toBe(\"https://localhost:5173/de/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://localhost:5173/about\", { locale: \"en\" }).href\n\t).toBe(\"https://localhost:5173/about\");\n\n\texpect(runtime.deLocalizeUrl(\"https://localhost:5173/de/about\").href).toBe(\n\t\t\"https://localhost:5173/about\"\n\t);\n\n\t// DE routing\n\texpect(\n\t\truntime.localizeUrl(\"https://de.example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://de.example.com/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://de.example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\t// delocalizing\n\texpect(runtime.deLocalizeUrl(\"https://de.example.com/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n\n\t// EN routing\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://de.example.com/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\t// delocalizing\n\texpect(runtime.deLocalizeUrl(\"https://example.com/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n});\n\ntest(\"multi tenancy\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t// 1) customer1.fr => root path locale is fr, other locales via sub-path e.g. /en/\n\t\t\t{\n\t\t\t\tpattern: \"https://customer1.fr/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://customer1.fr/en/:path*\"],\n\t\t\t\t\t[\"fr\", \"https://customer1.fr/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t// 2) customer2.com => root path locale is en, other locales via sub-path e.g. /fr/\n\t\t\t{\n\t\t\t\tpattern: \"https://customer2.com/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"fr\", \"https://customer2.com/fr/:path*\"],\n\t\t\t\t\t[\"en\", \"https://customer2.com/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t// 3) Any other domain => path-based for en/fr\n\t\t\t{\n\t\t\t\tpattern: \"https://:domain(.*)/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://:domain(.*)/en/:path*\"],\n\t\t\t\t\t[\"fr\", \"https://:domain(.*)/fr/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\t// customer 1 - localizing french to french\n\texpect(\n\t\truntime.localizeUrl(\"https://customer1.fr/about\", { locale: \"fr\" }).href\n\t).toBe(\"https://customer1.fr/about\");\n\n\t// customer 1 - localizing from french to english\n\texpect(\n\t\truntime.localizeUrl(\"https://customer1.fr/about\", { locale: \"en\" }).href\n\t).toBe(\"https://customer1.fr/en/about\");\n\n\t// customer 1 - de-localizing french\n\texpect(runtime.deLocalizeUrl(\"https://customer1.fr/en/about\").href).toBe(\n\t\t\"https://customer1.fr/about\"\n\t);\n\n\t// customer 2 - english to english\n\texpect(\n\t\truntime.localizeUrl(\"https://customer2.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://customer2.com/about\");\n\n\t// customer 2 - english to french\n\texpect(\n\t\truntime.localizeUrl(\"https://customer2.com/about\", { locale: \"fr\" }).href\n\t).toBe(\"https://customer2.com/fr/about\");\n\n\t// customer 2 - de-localize french\n\texpect(runtime.deLocalizeUrl(\"https://customer2.com/fr/about\").href).toBe(\n\t\t\"https://customer2.com/about\"\n\t);\n});\n\ntest(\"providing a URL object as input\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://:domain(.*)/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://:domain(.*)/:path*\"],\n\t\t\t\t\t[\"de\", \"https://de.:domain(.*)/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\tconst url = new URL(\"https://example.com/about\");\n\n\texpect(runtime.localizeUrl(url, { locale: \"de\" }).href).toBe(\n\t\t\"https://de.example.com/about\"\n\t);\n\n\texpect(runtime.deLocalizeUrl(url).href).toBe(\"https://example.com/about\");\n});\n\ntest(\"localhost with portname\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \":protocol://:domain(.*)::port?/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \":protocol://:domain(.*)::port?/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \":protocol://:domain(.*)::port?/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// http\n\texpect(\n\t\truntime.deLocalizeUrl(new URL(\"http://localhost:5173/de/about\")).href\n\t).toBe(\"http://localhost:5173/about\");\n\n\t// https\n\texpect(\n\t\truntime.deLocalizeUrl(new URL(\"https://localhost:5173/de/about\")).href\n\t).toBe(\"https://localhost:5173/about\");\n\n\t// no port\n\texpect(\n\t\truntime.deLocalizeUrl(new URL(\"https://localhost/de/about\")).href\n\t).toBe(\"https://localhost/about\");\n\n\t// pathnames\n\texpect(\n\t\truntime.deLocalizeUrl(new URL(\"http://localhost:5173/about\")).href\n\t).toBe(\"http://localhost:5173/about\");\n\n\texpect(runtime.deLocalizeUrl(new URL(\"http://localhost:5173/\")).href).toBe(\n\t\t\"http://localhost:5173/\"\n\t);\n\n\texpect(runtime.deLocalizeUrl(new URL(\"https://localhost:5173/de\")).href).toBe(\n\t\t\"https://localhost:5173/\"\n\t);\n});\n\ntest(\"it keeps the query parameters\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://:domain(.*)/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"https://:domain(.*)/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"https://:domain(.*)/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about?foo=bar&baz=qux\", {\n\t\t\tlocale: \"de\",\n\t\t}).href\n\t).toBe(\"https://example.com/de/about?foo=bar&baz=qux\");\n\n\texpect(\n\t\truntime.deLocalizeUrl(\"https://example.com/de/about?foo=bar&baz=qux\").href\n\t).toBe(\"https://example.com/about?foo=bar&baz=qux\");\n});\n\ntest(\"it keeps the url hash\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://:domain(.*)/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"https://:domain(.*)/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"https://:domain(.*)/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about#test\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/about#test\");\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/about#test\").href).toBe(\n\t\t\"https://example.com/about#test\"\n\t);\n});\n\n// URL Pattern implicitly matches all paths\n//\n// The pattern https://example.com is interpreted as https://example.com.*\n// It effectively matches every path under https://example.com/\n// This means any request, including https://example.com/about, will match.\ntest(\"it keeps the url path\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://example.com\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"https://example.de\"],\n\t\t\t\t\t[\"en\", \"https://example.com\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://example.de/about\");\n\n\texpect(runtime.deLocalizeUrl(\"https://example.de/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n});\n\ntest(\"uses getLocale when no locale is provided\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://:domain(.*)/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"https://:domain(.*)/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"https://:domain(.*)/en/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// Override getLocale to return German\n\truntime.overwriteGetLocale(() => \"de\");\n\n\texpect(runtime.getLocale()).toBe(\"de\");\n\n\t// Should use \"de\" from getLocale since no locale provided\n\texpect(runtime.localizeUrl(\"https://example.com/about\").href).toBe(\n\t\t\"https://example.com/de/about\"\n\t);\n\n\t// Should still use explicit locale when provided\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/en/about\");\n});\n\ntest(\"normalizes mixed-case explicit locales for custom url patterns\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://:domain(.*)/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"https://:domain(.*)/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"https://:domain(.*)/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", {\n\t\t\tlocale: \"DE\",\n\t\t}).href\n\t).toBe(\"https://example.com/de/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/de/about\", {\n\t\t\tlocale: \"EN\",\n\t\t}).href\n\t).toBe(\"https://example.com/about\");\n});\n\n// https://github.com/opral/inlang-paraglide-js/issues/381\ntest.each([\n\t// empty url pattern will set TREE_SHAKE_DEFAULT_ULR_PATTERN_USED to true\n\t{},\n\t// real default url pattern to align behaviour\n\t{\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \":protocol://:domain(.*)::port?/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \":protocol://:domain(.*)::port?/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \":protocol://:domain(.*)::port?/:path(.*)?\"],\n\t\t\t\t] as [string, string][],\n\t\t\t},\n\t\t],\n\t},\n])(\"default url pattern\", async (compilerOptions) => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\t...compilerOptions,\n\t});\n\n\truntime.overwriteGetLocale(() => \"en\");\n\n\texpect(runtime.localizeUrl(\"https://example.com/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n\n\truntime.overwriteGetLocale(() => \"de\");\n\n\texpect(runtime.localizeUrl(\"https://example.com/\").href).toBe(\n\t\t\"https://example.com/de/\"\n\t);\n\n\texpect(runtime.localizeUrl(\"https://example.com/about\").href).toBe(\n\t\t\"https://example.com/de/about\"\n\t);\n\n\t// Should still use explicit locale when provided\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", {\n\t\t\tlocale: \"DE\" as any,\n\t\t}).href\n\t).toBe(\"https://example.com/de/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/de/about\", {\n\t\t\tlocale: \"EN\" as any,\n\t\t}).href\n\t).toBe(\"https://example.com/about\");\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n});\n\ntest(\"auto fills the url base path\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/about\");\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n});\n\n// https://github.com/opral/inlang-paraglide-js/issues/454\ntest(\"works with no trailing slash at the end\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"/en/:path(.*)?\"],\n\t\t\t\t\t[\"de\", \"/de/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/en/\").href).toBe(\n\t\t\"https://example.com/\"\n\t);\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/en\").href).toBe(\n\t\t\"https://example.com/\"\n\t);\n});\n\n// https://github.com/opral/inlang-paraglide-js/issues/452#issuecomment-2715761308\ntest(\"falls through if no match is found\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/about\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"/ueber\"],\n\t\t\t\t\t[\"en\", \"/about\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/\");\n\n\texpect(runtime.deLocalizeUrl(\"https://example.com/\").href).toBe(\n\t\t\"https://example.com/\"\n\t);\n});\n\ntest(\"defining no localized pattern leads to a fallthrough\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/specific-path\",\n\t\t\t\tlocalized: [[\"en\", \"/specific-path\"]],\n\t\t\t},\n\t\t],\n\t});\n\n\t// doesn't localize because no localized pattern is defined\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/specific-path\", { locale: \"de\" })\n\t\t\t.href\n\t).toBe(\"https://example.com/specific-path\");\n\n\t// doesn't delocalize because no localized pattern is defined\n\texpect(\n\t\truntime.deLocalizeUrl(\"https://example.com/de/specific-path\").href\n\t).toBe(\"https://example.com/de/specific-path\");\n});\n\n// https://github.com/opral/inlang-paraglide-js/issues/456\ntest(\"routing to a 404 page\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/404\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"/404\"],\n\t\t\t\t\t[\"de\", \"/de/404\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tpattern: \"specific-path\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"/specific-path\"],\n\t\t\t\t\t[\"de\", \"/de/404\"],\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tpattern: \"/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"/:path(.*)?\"],\n\t\t\t\t\t[\"de\", \"/de/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/specific-path\", { locale: \"en\" })\n\t\t\t.href\n\t).toBe(\"https://example.com/specific-path\");\n\n\t// localizing to a 404 page\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/specific-path\", { locale: \"de\" })\n\t\t\t.href\n\t).toBe(\"https://example.com/de/404\");\n\n\t// other paths work because of the catch all\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/other-path\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/other-path\");\n});\n\n// Test showing the importance of pattern order in the localized array\ntest(\"pattern order in localized array - correct order (specific first)\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t// CORRECT ORDER: more specific pattern first\n\t\t\t\t\t[\"de\", \"/de/:path(.*)?\"], // More specific pattern with prefix\n\t\t\t\t\t[\"en\", \"/:path(.*)?\"], // Less specific pattern without prefix\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// These should work correctly with the specific (de) pattern first\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/about\");\n\n\t// Delocalization should work correctly too\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/about\").href).toBe(\n\t\t\"https://example.com/about\"\n\t);\n});\n\n// Test showing the importance of pattern order in the localized array\ntest(\"pattern order in localized array - incorrect order (generic first)\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t// INCORRECT ORDER: less specific pattern first\n\t\t\t\t\t[\"en\", \"/:path(.*)?\"], // Less specific pattern without prefix\n\t\t\t\t\t[\"de\", \"/de/:path(.*)?\"], // More specific pattern with prefix that may never match\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// English localization works as expected\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"en\" }).href\n\t).toBe(\"https://example.com/about\");\n\n\t// German localization still works when explicitly requested\n\texpect(\n\t\truntime.localizeUrl(\"https://example.com/about\", { locale: \"de\" }).href\n\t).toBe(\"https://example.com/de/about\");\n\n\t// The problem happens with delocalization:\n\t// With incorrect pattern order, the generic /:path(.*)?\n\t// pattern matches first and swallows the /de/ prefix\n\texpect(runtime.deLocalizeUrl(\"https://example.com/de/about\").href).toBe(\n\t\t\"https://example.com/de/about\"\n\t); // Should be \"https://example.com/about\"\n});\n\n// Test for port number issue with specific port numbers in the URL pattern\ntest(\"handles explicit port numbers in URL patterns correctly\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\t// Using explicit port number - this causes issues with deLocalizeUrl\n\t\t\t\tpattern: \"http://localhost:5173/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"http://localhost:5173/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"http://localhost:5173/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// Localization should work correctly\n\texpect(\n\t\truntime.localizeUrl(\"http://localhost:5173/about\", { locale: \"de\" }).href\n\t).toBe(\"http://localhost:5173/de/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"http://localhost:5173/about\", { locale: \"en\" }).href\n\t).toBe(\"http://localhost:5173/about\");\n\n\t// This is where the bug occurs - delocalizing a URL with a port number\n\t// The port number (5173) is incorrectly treated as a path parameter\n\texpect(runtime.deLocalizeUrl(\"http://localhost:5173/de/about\").href).toBe(\n\t\t\"http://localhost:5173/about\"\n\t);\n});\n\n// Test for the correct approach using port as a pattern parameter\ntest(\"correctly handles port numbers as pattern parameters\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"url\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\t// Using port as a proper pattern parameter with :: syntax\n\t\t\t\tpattern: \"http://localhost::port/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"de\", \"http://localhost::port/de/:path(.*)?\"],\n\t\t\t\t\t[\"en\", \"http://localhost::port/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// Localization should work correctly\n\texpect(\n\t\truntime.localizeUrl(\"http://localhost:5173/about\", { locale: \"de\" }).href\n\t).toBe(\"http://localhost:5173/de/about\");\n\n\texpect(\n\t\truntime.localizeUrl(\"http://localhost:5173/about\", { locale: \"en\" }).href\n\t).toBe(\"http://localhost:5173/about\");\n\n\t// Delocalization should also work correctly with the proper pattern\n\texpect(runtime.deLocalizeUrl(\"http://localhost:5173/de/about\").href).toBe(\n\t\t\"http://localhost:5173/about\"\n\t);\n});\n"]}
|