@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,555 @@
|
|
|
1
|
+
import { expect, test, vi } from "vitest";
|
|
2
|
+
import { createParaglide } from "../create-paraglide.js";
|
|
3
|
+
test("sets the cookie to a different locale", async () => {
|
|
4
|
+
// @ts-expect-error - global variable definition
|
|
5
|
+
globalThis.document = {};
|
|
6
|
+
// @ts-expect-error - global variable definition
|
|
7
|
+
globalThis.window = {};
|
|
8
|
+
// @ts-expect-error - global variable definition
|
|
9
|
+
globalThis.window.location = { hostname: "example.com" };
|
|
10
|
+
globalThis.window.location.reload = vi.fn();
|
|
11
|
+
const runtime = await createParaglide({
|
|
12
|
+
baseLocale: "en",
|
|
13
|
+
locales: ["en", "de"],
|
|
14
|
+
strategy: ["cookie"],
|
|
15
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
16
|
+
});
|
|
17
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
18
|
+
runtime.setLocale("de");
|
|
19
|
+
// set the locale
|
|
20
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
21
|
+
// reloads the site if window is available
|
|
22
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
23
|
+
});
|
|
24
|
+
test("sets the cookie with explicit domain to a different locale navigating subdomain", async () => {
|
|
25
|
+
// @ts-expect-error - global variable definition
|
|
26
|
+
globalThis.document = {};
|
|
27
|
+
// @ts-expect-error - global variable definition
|
|
28
|
+
globalThis.window = {};
|
|
29
|
+
// @ts-expect-error - global variable definition
|
|
30
|
+
globalThis.window.location = { hostname: "web.example.com" };
|
|
31
|
+
globalThis.window.location.reload = vi.fn();
|
|
32
|
+
const runtime = await createParaglide({
|
|
33
|
+
baseLocale: "en",
|
|
34
|
+
locales: ["en", "de"],
|
|
35
|
+
strategy: ["cookie"],
|
|
36
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
37
|
+
cookieDomain: "example.com",
|
|
38
|
+
});
|
|
39
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
40
|
+
runtime.setLocale("de");
|
|
41
|
+
// set the locale
|
|
42
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
43
|
+
// reloads the site if window is available
|
|
44
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
45
|
+
});
|
|
46
|
+
test("sets the cookie with explicit domain to a different locale navigating domain", async () => {
|
|
47
|
+
// @ts-expect-error - global variable definition
|
|
48
|
+
globalThis.document = {};
|
|
49
|
+
// @ts-expect-error - global variable definition
|
|
50
|
+
globalThis.window = {};
|
|
51
|
+
// @ts-expect-error - global variable definition
|
|
52
|
+
globalThis.window.location = { hostname: "example.com" };
|
|
53
|
+
globalThis.window.location.reload = vi.fn();
|
|
54
|
+
const runtime = await createParaglide({
|
|
55
|
+
baseLocale: "en",
|
|
56
|
+
locales: ["en", "de"],
|
|
57
|
+
strategy: ["cookie"],
|
|
58
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
59
|
+
cookieDomain: "example.com",
|
|
60
|
+
});
|
|
61
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
62
|
+
runtime.setLocale("de");
|
|
63
|
+
// set the locale
|
|
64
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com");
|
|
65
|
+
// reloads the site if window is available
|
|
66
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
67
|
+
});
|
|
68
|
+
test("url pattern strategy sets the window location", async () => {
|
|
69
|
+
// @ts-expect-error - global variable definition
|
|
70
|
+
globalThis.window = {};
|
|
71
|
+
// @ts-expect-error - global variable definition
|
|
72
|
+
globalThis.window.location = {};
|
|
73
|
+
globalThis.window.location.hostname = "example.com";
|
|
74
|
+
globalThis.window.location.reload = vi.fn();
|
|
75
|
+
const runtime = await createParaglide({
|
|
76
|
+
baseLocale: "en",
|
|
77
|
+
locales: ["en", "de"],
|
|
78
|
+
strategy: ["url"],
|
|
79
|
+
urlPatterns: [
|
|
80
|
+
{
|
|
81
|
+
pattern: "https://example.:tld/:path*",
|
|
82
|
+
localized: [
|
|
83
|
+
["en", "https://example.com/:path*"],
|
|
84
|
+
["de", "https://example.de/:path*"],
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
globalThis.window.location.href = "https://example.com/page";
|
|
90
|
+
runtime.setLocale("de");
|
|
91
|
+
expect(globalThis.window.location.href).toBe("https://example.de/page");
|
|
92
|
+
// setting window.location.hostname automatically reloads the page
|
|
93
|
+
expect(globalThis.window.location.reload).not.toBeCalled();
|
|
94
|
+
});
|
|
95
|
+
test("url strategy setLocale normalizes mixed-case explicit locales", async () => {
|
|
96
|
+
// @ts-expect-error - global variable definition
|
|
97
|
+
globalThis.window = {};
|
|
98
|
+
// @ts-expect-error - global variable definition
|
|
99
|
+
globalThis.window.location = {};
|
|
100
|
+
globalThis.window.location.hostname = "example.com";
|
|
101
|
+
globalThis.window.location.reload = vi.fn();
|
|
102
|
+
const runtime = await createParaglide({
|
|
103
|
+
baseLocale: "en",
|
|
104
|
+
locales: ["en", "de"],
|
|
105
|
+
strategy: ["url"],
|
|
106
|
+
urlPatterns: [
|
|
107
|
+
{
|
|
108
|
+
pattern: "https://example.:tld/:path*",
|
|
109
|
+
localized: [
|
|
110
|
+
["en", "https://example.com/:path*"],
|
|
111
|
+
["de", "https://example.de/:path*"],
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
});
|
|
116
|
+
globalThis.window.location.href = "https://example.com/page";
|
|
117
|
+
runtime.setLocale("DE");
|
|
118
|
+
expect(globalThis.window.location.href).toBe("https://example.de/page");
|
|
119
|
+
// setting window.location.hostname automatically reloads the page
|
|
120
|
+
expect(globalThis.window.location.reload).not.toBeCalled();
|
|
121
|
+
});
|
|
122
|
+
test("routeStrategies can disable url navigation on matching routes", async () => {
|
|
123
|
+
// @ts-expect-error - global variable definition
|
|
124
|
+
globalThis.window = {};
|
|
125
|
+
// @ts-expect-error - global variable definition
|
|
126
|
+
globalThis.document = {};
|
|
127
|
+
// @ts-expect-error - global variable definition
|
|
128
|
+
globalThis.window.location = {
|
|
129
|
+
href: "https://example.com/dashboard",
|
|
130
|
+
hostname: "example.com",
|
|
131
|
+
reload: vi.fn(),
|
|
132
|
+
};
|
|
133
|
+
const runtime = await createParaglide({
|
|
134
|
+
baseLocale: "en",
|
|
135
|
+
locales: ["en", "fr"],
|
|
136
|
+
strategy: ["url", "cookie", "baseLocale"],
|
|
137
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
138
|
+
routeStrategies: [
|
|
139
|
+
{
|
|
140
|
+
match: "/dashboard/:path(.*)?",
|
|
141
|
+
strategy: ["cookie", "baseLocale"],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en";
|
|
146
|
+
runtime.setLocale("fr");
|
|
147
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path=/; max-age=34560000");
|
|
148
|
+
expect(globalThis.window.location.href).toBe("https://example.com/dashboard");
|
|
149
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
150
|
+
});
|
|
151
|
+
// `!document.cookie` was used which returned false for an empty string
|
|
152
|
+
test("sets the cookie when it's an empty string", async () => {
|
|
153
|
+
const runtime = await createParaglide({
|
|
154
|
+
baseLocale: "en",
|
|
155
|
+
locales: ["en", "fr"],
|
|
156
|
+
strategy: ["cookie"],
|
|
157
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
158
|
+
});
|
|
159
|
+
/** @ts-expect-error - client side api */
|
|
160
|
+
globalThis.document = { cookie: "" };
|
|
161
|
+
runtime.setLocale("en");
|
|
162
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
163
|
+
});
|
|
164
|
+
test("when strategy precedes URL, it should set the locale and re-direct to the URL", async () => {
|
|
165
|
+
const runtime = await createParaglide({
|
|
166
|
+
baseLocale: "en",
|
|
167
|
+
locales: ["en", "fr"],
|
|
168
|
+
strategy: ["cookie", "url", "baseLocale"],
|
|
169
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
170
|
+
isServer: "false",
|
|
171
|
+
urlPatterns: [
|
|
172
|
+
{
|
|
173
|
+
pattern: "https://example.com/en/:path(.*)?",
|
|
174
|
+
localized: [
|
|
175
|
+
["en", "https://example.com/en/:path(.*)?"],
|
|
176
|
+
["fr", "https://example.com/fr/:path(.*)?"],
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
});
|
|
181
|
+
/** @ts-expect-error - client side api */
|
|
182
|
+
globalThis.document = { cookie: "PARAGLIDE_LOCALE=fr" };
|
|
183
|
+
globalThis.window = {
|
|
184
|
+
location: new URL("https://example.com/fr/some-path"),
|
|
185
|
+
};
|
|
186
|
+
// Cookie strategy should determine locale as French
|
|
187
|
+
expect(runtime.getLocale()).toBe("fr");
|
|
188
|
+
runtime.setLocale("en");
|
|
189
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
190
|
+
expect(globalThis.window.location.href).toBe("https://example.com/en/some-path");
|
|
191
|
+
});
|
|
192
|
+
test("overwriteSetLocale receives the options object", async () => {
|
|
193
|
+
const runtime = await createParaglide({
|
|
194
|
+
baseLocale: "en",
|
|
195
|
+
locales: ["en", "fr"],
|
|
196
|
+
strategy: ["cookie"],
|
|
197
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
198
|
+
});
|
|
199
|
+
// Provide minimal browser globals to avoid strategy branches failing.
|
|
200
|
+
/** @ts-expect-error - browser shim for tests */
|
|
201
|
+
globalThis.document = { cookie: "" };
|
|
202
|
+
globalThis.window = {
|
|
203
|
+
location: {
|
|
204
|
+
href: "https://example.com/en",
|
|
205
|
+
reload: vi.fn(),
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
const spy = vi.fn();
|
|
209
|
+
runtime.overwriteSetLocale(spy);
|
|
210
|
+
runtime.setLocale("fr", { reload: false });
|
|
211
|
+
expect(spy).toHaveBeenCalledWith("fr", { reload: false });
|
|
212
|
+
});
|
|
213
|
+
// https://github.com/opral/inlang-paraglide-js/issues/430
|
|
214
|
+
test("should not reload when setting locale to current locale", async () => {
|
|
215
|
+
// @ts-expect-error - global variable definition
|
|
216
|
+
globalThis.document = {};
|
|
217
|
+
// @ts-expect-error - global variable definition
|
|
218
|
+
globalThis.window = {};
|
|
219
|
+
// @ts-expect-error - global variable definition
|
|
220
|
+
globalThis.window.location = { hostname: "example.com" };
|
|
221
|
+
globalThis.window.location.reload = vi.fn();
|
|
222
|
+
const runtime = await createParaglide({
|
|
223
|
+
baseLocale: "en",
|
|
224
|
+
locales: ["en", "de"],
|
|
225
|
+
strategy: ["cookie"],
|
|
226
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
227
|
+
});
|
|
228
|
+
globalThis.document.cookie = "PARAGLIDE_LOCALE=en; path=/";
|
|
229
|
+
// Setting to the current locale (en)
|
|
230
|
+
runtime.setLocale("en");
|
|
231
|
+
// Cookie should remain unchanged
|
|
232
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=en; path=/; max-age=34560000");
|
|
233
|
+
// Should not trigger a reload
|
|
234
|
+
expect(globalThis.window.location.reload).not.toBeCalled();
|
|
235
|
+
// Setting to a different locale should still work
|
|
236
|
+
runtime.setLocale("de");
|
|
237
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=de; path=/; max-age=34560000");
|
|
238
|
+
expect(globalThis.window.location.reload).toBeCalled();
|
|
239
|
+
});
|
|
240
|
+
test("static locale builds force a document reload when switching locales", async () => {
|
|
241
|
+
// @ts-expect-error - browser shim for tests
|
|
242
|
+
globalThis.document = { cookie: "" };
|
|
243
|
+
globalThis.window = {
|
|
244
|
+
location: {
|
|
245
|
+
href: "https://example.com/en",
|
|
246
|
+
hostname: "example.com",
|
|
247
|
+
reload: vi.fn(),
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined);
|
|
251
|
+
try {
|
|
252
|
+
const runtime = await createParaglide({
|
|
253
|
+
baseLocale: "en",
|
|
254
|
+
locales: ["en", "de"],
|
|
255
|
+
strategy: ["cookie"],
|
|
256
|
+
isServer: "false",
|
|
257
|
+
experimentalStaticLocale: JSON.stringify("en"),
|
|
258
|
+
});
|
|
259
|
+
runtime.setLocale("de", { reload: false });
|
|
260
|
+
expect(warn).toHaveBeenCalledOnce();
|
|
261
|
+
expect(globalThis.window.location.reload).toHaveBeenCalledOnce();
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
warn.mockRestore();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
test("sets the locale to localStorage", async () => {
|
|
268
|
+
// @ts-expect-error - global variable definition
|
|
269
|
+
globalThis.localStorage = {
|
|
270
|
+
setItem: vi.fn(),
|
|
271
|
+
getItem: () => "en",
|
|
272
|
+
};
|
|
273
|
+
// @ts-expect-error - global variable definition
|
|
274
|
+
globalThis.window = {};
|
|
275
|
+
const runtime = await createParaglide({
|
|
276
|
+
baseLocale: "en",
|
|
277
|
+
locales: ["en", "de"],
|
|
278
|
+
strategy: ["localStorage"],
|
|
279
|
+
});
|
|
280
|
+
runtime.setLocale("de");
|
|
281
|
+
expect(globalThis.localStorage.setItem).toHaveBeenCalledWith("PARAGLIDE_LOCALE", "de");
|
|
282
|
+
});
|
|
283
|
+
// Test that all strategies set their respective storage mechanisms
|
|
284
|
+
test("should set locale in all configured storage mechanisms regardless of which strategy resolved the locale", async () => {
|
|
285
|
+
// Setup global objects
|
|
286
|
+
// @ts-expect-error - global variable definition
|
|
287
|
+
globalThis.document = { cookie: "" };
|
|
288
|
+
// @ts-expect-error - global variable definition
|
|
289
|
+
globalThis.localStorage = {
|
|
290
|
+
setItem: vi.fn(),
|
|
291
|
+
getItem: () => null,
|
|
292
|
+
};
|
|
293
|
+
// @ts-expect-error - global variable definition
|
|
294
|
+
globalThis.window = {};
|
|
295
|
+
// @ts-expect-error - global variable definition
|
|
296
|
+
globalThis.window.location = {};
|
|
297
|
+
globalThis.window.location.hostname = "example.com";
|
|
298
|
+
globalThis.window.location.href = "https://example.com/en/page";
|
|
299
|
+
globalThis.window.location.reload = vi.fn();
|
|
300
|
+
// Create runtime with multiple strategies
|
|
301
|
+
const runtime = await createParaglide({
|
|
302
|
+
baseLocale: "en",
|
|
303
|
+
locales: ["en", "de", "fr"],
|
|
304
|
+
strategy: ["url", "localStorage", "cookie", "baseLocale"],
|
|
305
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
306
|
+
urlPatterns: [
|
|
307
|
+
{
|
|
308
|
+
pattern: "https://example.com/:locale/:path*",
|
|
309
|
+
localized: [
|
|
310
|
+
["en", "https://example.com/en/:path*"],
|
|
311
|
+
["de", "https://example.com/de/:path*"],
|
|
312
|
+
["fr", "https://example.com/fr/:path*"],
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
});
|
|
317
|
+
// Call setLocale
|
|
318
|
+
runtime.setLocale("fr");
|
|
319
|
+
// Verify that all storage mechanisms are updated
|
|
320
|
+
expect(globalThis.window.location.href).toBe("https://example.com/fr/page");
|
|
321
|
+
expect(globalThis.localStorage.setItem).toHaveBeenCalledWith("PARAGLIDE_LOCALE", "fr");
|
|
322
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path=/; max-age=34560000");
|
|
323
|
+
});
|
|
324
|
+
test("calls setLocale on custom strategy", async () => {
|
|
325
|
+
let customLocale = "en";
|
|
326
|
+
let setLocaleCalled = false;
|
|
327
|
+
globalThis.window = {
|
|
328
|
+
location: { reload: vi.fn() },
|
|
329
|
+
};
|
|
330
|
+
const runtime = await createParaglide({
|
|
331
|
+
baseLocale: "en",
|
|
332
|
+
locales: ["en", "fr", "de"],
|
|
333
|
+
strategy: ["custom-setter", "baseLocale"],
|
|
334
|
+
isServer: "false",
|
|
335
|
+
});
|
|
336
|
+
runtime.defineCustomClientStrategy("custom-setter", {
|
|
337
|
+
getLocale: () => customLocale,
|
|
338
|
+
setLocale: (locale) => {
|
|
339
|
+
customLocale = locale;
|
|
340
|
+
setLocaleCalled = true;
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
runtime.setLocale("fr");
|
|
344
|
+
expect(setLocaleCalled).toBe(true);
|
|
345
|
+
expect(customLocale).toBe("fr");
|
|
346
|
+
expect(globalThis.window.location.reload).toHaveBeenCalled();
|
|
347
|
+
});
|
|
348
|
+
test("calls setLocale on multiple custom strategies", async () => {
|
|
349
|
+
let customLocale1 = "en";
|
|
350
|
+
let customLocale2 = "en";
|
|
351
|
+
let setLocaleCalled1 = false;
|
|
352
|
+
let setLocaleCalled2 = false;
|
|
353
|
+
globalThis.window = {
|
|
354
|
+
location: { reload: vi.fn() },
|
|
355
|
+
};
|
|
356
|
+
const runtime = await createParaglide({
|
|
357
|
+
baseLocale: "en",
|
|
358
|
+
locales: ["en", "fr", "de"],
|
|
359
|
+
strategy: ["custom-multi1", "custom-multi2", "baseLocale"],
|
|
360
|
+
isServer: "false",
|
|
361
|
+
});
|
|
362
|
+
runtime.defineCustomClientStrategy("custom-multi1", {
|
|
363
|
+
getLocale: () => customLocale1,
|
|
364
|
+
setLocale: (locale) => {
|
|
365
|
+
customLocale1 = locale;
|
|
366
|
+
setLocaleCalled1 = true;
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
runtime.defineCustomClientStrategy("custom-multi2", {
|
|
370
|
+
getLocale: () => customLocale2,
|
|
371
|
+
setLocale: (locale) => {
|
|
372
|
+
customLocale2 = locale;
|
|
373
|
+
setLocaleCalled2 = true;
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
runtime.setLocale("de");
|
|
377
|
+
expect(setLocaleCalled1).toBe(true);
|
|
378
|
+
expect(setLocaleCalled2).toBe(true);
|
|
379
|
+
expect(customLocale1).toBe("de");
|
|
380
|
+
expect(customLocale2).toBe("de");
|
|
381
|
+
});
|
|
382
|
+
test("setLocale should return a promise if any custom setLocale function is async", async () => {
|
|
383
|
+
let customLocale1 = "en";
|
|
384
|
+
const runtime = await createParaglide({
|
|
385
|
+
baseLocale: "en",
|
|
386
|
+
locales: ["en", "fr", "de"],
|
|
387
|
+
strategy: ["custom-async", "baseLocale"],
|
|
388
|
+
isServer: "false",
|
|
389
|
+
});
|
|
390
|
+
runtime.defineCustomClientStrategy("custom-async", {
|
|
391
|
+
getLocale: () => customLocale1,
|
|
392
|
+
setLocale: async (locale) => {
|
|
393
|
+
customLocale1 = locale;
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
const setLocalePromise = runtime.setLocale("de");
|
|
397
|
+
const setLocalePromiseWithoutReload = runtime.setLocale("de", {
|
|
398
|
+
reload: false,
|
|
399
|
+
});
|
|
400
|
+
expect(setLocalePromise).toBeInstanceOf(Promise);
|
|
401
|
+
expect(setLocalePromiseWithoutReload).toBeInstanceOf(Promise);
|
|
402
|
+
});
|
|
403
|
+
test("awaits async setLocale functions to resolve in custom strategy", async () => {
|
|
404
|
+
let customLocale1 = "en";
|
|
405
|
+
globalThis.window = {
|
|
406
|
+
location: {
|
|
407
|
+
reload: vi.fn(),
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
const runtime = await createParaglide({
|
|
411
|
+
baseLocale: "en",
|
|
412
|
+
locales: ["en", "fr", "de"],
|
|
413
|
+
strategy: ["custom-async", "baseLocale"],
|
|
414
|
+
isServer: "false",
|
|
415
|
+
});
|
|
416
|
+
runtime.defineCustomClientStrategy("custom-async", {
|
|
417
|
+
getLocale: () => customLocale1,
|
|
418
|
+
setLocale: async (locale) => {
|
|
419
|
+
customLocale1 = locale;
|
|
420
|
+
},
|
|
421
|
+
});
|
|
422
|
+
const setLocalePromise = runtime.setLocale("de");
|
|
423
|
+
expect(window.location.reload).not.toHaveBeenCalled();
|
|
424
|
+
await setLocalePromise;
|
|
425
|
+
// Verify that setLocale resolved before reload was called
|
|
426
|
+
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
|
427
|
+
expect(customLocale1).toBe("de");
|
|
428
|
+
});
|
|
429
|
+
test("awaits async setLocale functions to resolve in multiple custom strategies", async () => {
|
|
430
|
+
let customLocale1 = "en";
|
|
431
|
+
let customLocale2 = "en";
|
|
432
|
+
globalThis.window = {
|
|
433
|
+
location: {
|
|
434
|
+
reload: vi.fn(),
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
const runtime = await createParaglide({
|
|
438
|
+
baseLocale: "en",
|
|
439
|
+
locales: ["en", "fr", "de"],
|
|
440
|
+
strategy: ["custom-async1", "custom-async2", "baseLocale"],
|
|
441
|
+
isServer: "false",
|
|
442
|
+
});
|
|
443
|
+
runtime.defineCustomClientStrategy("custom-async1", {
|
|
444
|
+
getLocale: () => customLocale1,
|
|
445
|
+
setLocale: async (locale) => {
|
|
446
|
+
customLocale1 = locale;
|
|
447
|
+
},
|
|
448
|
+
});
|
|
449
|
+
runtime.defineCustomClientStrategy("custom-async2", {
|
|
450
|
+
getLocale: () => customLocale2,
|
|
451
|
+
setLocale: async (locale) => {
|
|
452
|
+
customLocale2 = locale;
|
|
453
|
+
},
|
|
454
|
+
});
|
|
455
|
+
const setLocalePromise = runtime.setLocale("de");
|
|
456
|
+
expect(window.location.reload).not.toHaveBeenCalled();
|
|
457
|
+
await setLocalePromise;
|
|
458
|
+
// Verify that setLocale resolved before reload was called
|
|
459
|
+
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
|
460
|
+
expect(customLocale1).toBe("de");
|
|
461
|
+
expect(customLocale2).toBe("de");
|
|
462
|
+
});
|
|
463
|
+
test("reload should not run if async setLocale function rejects in custom strategy", async () => {
|
|
464
|
+
const customLocale1 = "en";
|
|
465
|
+
globalThis.window = {
|
|
466
|
+
location: {
|
|
467
|
+
reload: vi.fn(),
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
const runtime = await createParaglide({
|
|
471
|
+
baseLocale: "en",
|
|
472
|
+
locales: ["en", "fr", "de"],
|
|
473
|
+
strategy: ["custom-async", "baseLocale"],
|
|
474
|
+
isServer: "false",
|
|
475
|
+
});
|
|
476
|
+
runtime.defineCustomClientStrategy("custom-async", {
|
|
477
|
+
getLocale: () => customLocale1,
|
|
478
|
+
setLocale: async () => {
|
|
479
|
+
throw new Error("fetch error");
|
|
480
|
+
},
|
|
481
|
+
});
|
|
482
|
+
const error = expect(() => runtime.setLocale("de")).rejects;
|
|
483
|
+
await error.toThrowError(`Custom strategy "custom-async" setLocale failed.`);
|
|
484
|
+
await error.toMatchObject({ cause: { message: "fetch error" } });
|
|
485
|
+
// Verify that reload was never called
|
|
486
|
+
expect(window.location.reload).toHaveBeenCalledTimes(0);
|
|
487
|
+
expect(customLocale1).toBe("en");
|
|
488
|
+
});
|
|
489
|
+
test("custom strategy setLocale works with cookie and localStorage", async () => {
|
|
490
|
+
let customData = "en";
|
|
491
|
+
globalThis.document = { cookie: "" };
|
|
492
|
+
globalThis.localStorage = {
|
|
493
|
+
setItem: vi.fn(),
|
|
494
|
+
getItem: () => null,
|
|
495
|
+
};
|
|
496
|
+
globalThis.window = {
|
|
497
|
+
location: {
|
|
498
|
+
hostname: "example.com",
|
|
499
|
+
reload: vi.fn(),
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
const runtime = await createParaglide({
|
|
503
|
+
baseLocale: "en",
|
|
504
|
+
locales: ["en", "fr", "de"],
|
|
505
|
+
strategy: ["custom-api", "localStorage", "cookie", "baseLocale"],
|
|
506
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
507
|
+
isServer: "false",
|
|
508
|
+
});
|
|
509
|
+
runtime.defineCustomClientStrategy("custom-api", {
|
|
510
|
+
getLocale: () => customData,
|
|
511
|
+
setLocale: (locale) => {
|
|
512
|
+
customData = locale;
|
|
513
|
+
},
|
|
514
|
+
});
|
|
515
|
+
runtime.setLocale("fr");
|
|
516
|
+
expect(customData).toBe("fr");
|
|
517
|
+
expect(globalThis.localStorage.setItem).toHaveBeenCalledWith("PARAGLIDE_LOCALE", "fr");
|
|
518
|
+
expect(globalThis.document.cookie).toBe("PARAGLIDE_LOCALE=fr; path=/; max-age=34560000");
|
|
519
|
+
});
|
|
520
|
+
test("custom strategy setLocale integrates with URL strategy", async () => {
|
|
521
|
+
let customStoredLocale = "en";
|
|
522
|
+
globalThis.window = {
|
|
523
|
+
location: {
|
|
524
|
+
hostname: "example.com",
|
|
525
|
+
href: "https://example.com/en/page",
|
|
526
|
+
reload: vi.fn(),
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
const runtime = await createParaglide({
|
|
530
|
+
baseLocale: "en",
|
|
531
|
+
locales: ["en", "fr", "de"],
|
|
532
|
+
strategy: ["url", "custom-urlIntegration", "baseLocale"],
|
|
533
|
+
urlPatterns: [
|
|
534
|
+
{
|
|
535
|
+
pattern: "https://example.com/:locale/:path*",
|
|
536
|
+
localized: [
|
|
537
|
+
["en", "https://example.com/en/:path*"],
|
|
538
|
+
["fr", "https://example.com/fr/:path*"],
|
|
539
|
+
["de", "https://example.com/de/:path*"],
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
],
|
|
543
|
+
isServer: "false",
|
|
544
|
+
});
|
|
545
|
+
runtime.defineCustomClientStrategy("custom-urlIntegration", {
|
|
546
|
+
getLocale: () => customStoredLocale,
|
|
547
|
+
setLocale: (locale) => {
|
|
548
|
+
customStoredLocale = locale;
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
runtime.setLocale("de");
|
|
552
|
+
expect(globalThis.window.location.href).toBe("https://example.com/de/page");
|
|
553
|
+
expect(customStoredLocale).toBe("de");
|
|
554
|
+
});
|
|
555
|
+
//# sourceMappingURL=set-locale.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-locale.test.js","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,IAAI,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;IACxD,gDAAgD;IAChD,UAAU,CAAC,QAAQ,GAAG,EAAE,CAAC;IACzB,gDAAgD;IAChD,UAAU,CAAC,MAAM,GAAG,EAAE,CAAC;IACvB,gDAAgD;IAChD,UAAU,CAAC,MAAM,CAAC,QAAQ,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IACzD,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IAE5C,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;QACrC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;QACrB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,UAAU,EAAE,kBAAkB;KAC9B,CAAC,CAAC;IAEH,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,qBAAqB,CAAC;IAEnD,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAExB,iBAAiB;IACjB,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CACtC,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,EAAE,aAAa;YACvB,IAAI,EAAE,6BAA6B;YACnC,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE;SACf;KACM,CAAC;IAET,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;QACrC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,EAAE,YAAY,CAAC;QACxD,WAAW,EAAE;YACZ;gBACC,OAAO,EAAE,oCAAoC;gBAC7C,SAAS,EAAE;oBACV,CAAC,IAAI,EAAE,+BAA+B,CAAC;oBACvC,CAAC,IAAI,EAAE,+BAA+B,CAAC;oBACvC,CAAC,IAAI,EAAE,+BAA+B,CAAC;iBACvC;aACD;SACD;QACD,QAAQ,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,OAAO,CAAC,0BAA0B,CAAC,uBAAuB,EAAE;QAC3D,SAAS,EAAE,GAAG,EAAE,CAAC,kBAAkB;QACnC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;YACrB,kBAAkB,GAAG,MAAM,CAAC;QAC7B,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAExB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAC5E,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test, vi } from \"vitest\";\nimport { createParaglide } from \"../create-paraglide.js\";\n\ntest(\"sets the cookie to a different locale\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.document = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = { hostname: \"example.com\" };\n\tglobalThis.window.location.reload = vi.fn();\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"cookie\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t});\n\n\tglobalThis.document.cookie = \"PARAGLIDE_LOCALE=en\";\n\n\truntime.setLocale(\"de\");\n\n\t// set the locale\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=de; path=/; max-age=34560000\"\n\t);\n\t// reloads the site if window is available\n\texpect(globalThis.window.location.reload).toBeCalled();\n});\n\ntest(\"sets the cookie with explicit domain to a different locale navigating subdomain\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.document = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = { hostname: \"web.example.com\" };\n\tglobalThis.window.location.reload = vi.fn();\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"cookie\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\tcookieDomain: \"example.com\",\n\t});\n\n\tglobalThis.document.cookie = \"PARAGLIDE_LOCALE=en\";\n\n\truntime.setLocale(\"de\");\n\n\t// set the locale\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com\"\n\t);\n\t// reloads the site if window is available\n\texpect(globalThis.window.location.reload).toBeCalled();\n});\n\ntest(\"sets the cookie with explicit domain to a different locale navigating domain\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.document = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = { hostname: \"example.com\" };\n\tglobalThis.window.location.reload = vi.fn();\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"cookie\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\tcookieDomain: \"example.com\",\n\t});\n\n\tglobalThis.document.cookie = \"PARAGLIDE_LOCALE=en\";\n\n\truntime.setLocale(\"de\");\n\n\t// set the locale\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=de; path=/; max-age=34560000; domain=example.com\"\n\t);\n\t// reloads the site if window is available\n\texpect(globalThis.window.location.reload).toBeCalled();\n});\n\ntest(\"url pattern strategy sets the window location\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = {};\n\tglobalThis.window.location.hostname = \"example.com\";\n\tglobalThis.window.location.reload = vi.fn();\n\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.:tld/: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://example.de/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\tglobalThis.window.location.href = \"https://example.com/page\";\n\n\truntime.setLocale(\"de\");\n\n\texpect(globalThis.window.location.href).toBe(\"https://example.de/page\");\n\t// setting window.location.hostname automatically reloads the page\n\texpect(globalThis.window.location.reload).not.toBeCalled();\n});\n\ntest(\"url strategy setLocale normalizes mixed-case explicit locales\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = {};\n\tglobalThis.window.location.hostname = \"example.com\";\n\tglobalThis.window.location.reload = vi.fn();\n\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.:tld/: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://example.de/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\tglobalThis.window.location.href = \"https://example.com/page\";\n\n\truntime.setLocale(\"DE\" as any);\n\n\texpect(globalThis.window.location.href).toBe(\"https://example.de/page\");\n\t// setting window.location.hostname automatically reloads the page\n\texpect(globalThis.window.location.reload).not.toBeCalled();\n});\n\ntest(\"routeStrategies can disable url navigation on matching routes\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.document = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = {\n\t\thref: \"https://example.com/dashboard\",\n\t\thostname: \"example.com\",\n\t\treload: vi.fn(),\n\t};\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\"],\n\t\tstrategy: [\"url\", \"cookie\", \"baseLocale\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\trouteStrategies: [\n\t\t\t{\n\t\t\t\tmatch: \"/dashboard/:path(.*)?\",\n\t\t\t\tstrategy: [\"cookie\", \"baseLocale\"],\n\t\t\t},\n\t\t],\n\t});\n\n\tglobalThis.document.cookie = \"PARAGLIDE_LOCALE=en\";\n\truntime.setLocale(\"fr\");\n\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=fr; path=/; max-age=34560000\"\n\t);\n\texpect(globalThis.window.location.href).toBe(\"https://example.com/dashboard\");\n\texpect(globalThis.window.location.reload).toBeCalled();\n});\n\n// `!document.cookie` was used which returned false for an empty string\ntest(\"sets the cookie when it's an empty string\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\"],\n\t\tstrategy: [\"cookie\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t});\n\n\t/** @ts-expect-error - client side api */\n\tglobalThis.document = { cookie: \"\" };\n\n\truntime.setLocale(\"en\");\n\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=en; path=/; max-age=34560000\"\n\t);\n});\n\ntest(\"when strategy precedes URL, it should set the locale and re-direct to the URL\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\"],\n\t\tstrategy: [\"cookie\", \"url\", \"baseLocale\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\tisServer: \"false\",\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://example.com/en/:path(.*)?\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://example.com/en/:path(.*)?\"],\n\t\t\t\t\t[\"fr\", \"https://example.com/fr/:path(.*)?\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t/** @ts-expect-error - client side api */\n\tglobalThis.document = { cookie: \"PARAGLIDE_LOCALE=fr\" };\n\tglobalThis.window = {\n\t\tlocation: new URL(\"https://example.com/fr/some-path\"),\n\t} as any;\n\n\t// Cookie strategy should determine locale as French\n\texpect(runtime.getLocale()).toBe(\"fr\");\n\n\truntime.setLocale(\"en\");\n\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=en; path=/; max-age=34560000\"\n\t);\n\texpect(globalThis.window.location.href).toBe(\n\t\t\"https://example.com/en/some-path\"\n\t);\n});\n\ntest(\"overwriteSetLocale receives the options object\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\"],\n\t\tstrategy: [\"cookie\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t});\n\n\t// Provide minimal browser globals to avoid strategy branches failing.\n\t/** @ts-expect-error - browser shim for tests */\n\tglobalThis.document = { cookie: \"\" };\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\thref: \"https://example.com/en\",\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\n\tconst spy = vi.fn();\n\truntime.overwriteSetLocale(spy);\n\n\truntime.setLocale(\"fr\", { reload: false });\n\n\texpect(spy).toHaveBeenCalledWith(\"fr\", { reload: false });\n});\n\n// https://github.com/opral/inlang-paraglide-js/issues/430\ntest(\"should not reload when setting locale to current locale\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.document = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = { hostname: \"example.com\" };\n\tglobalThis.window.location.reload = vi.fn();\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"cookie\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t});\n\n\tglobalThis.document.cookie = \"PARAGLIDE_LOCALE=en; path=/\";\n\n\t// Setting to the current locale (en)\n\truntime.setLocale(\"en\");\n\n\t// Cookie should remain unchanged\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=en; path=/; max-age=34560000\"\n\t);\n\t// Should not trigger a reload\n\texpect(globalThis.window.location.reload).not.toBeCalled();\n\n\t// Setting to a different locale should still work\n\truntime.setLocale(\"de\");\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=de; path=/; max-age=34560000\"\n\t);\n\texpect(globalThis.window.location.reload).toBeCalled();\n});\n\ntest(\"static locale builds force a document reload when switching locales\", async () => {\n\t// @ts-expect-error - browser shim for tests\n\tglobalThis.document = { cookie: \"\" };\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\thref: \"https://example.com/en\",\n\t\t\thostname: \"example.com\",\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\tconst warn = vi.spyOn(console, \"warn\").mockImplementation(() => undefined);\n\n\ttry {\n\t\tconst runtime = await createParaglide({\n\t\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\t\tstrategy: [\"cookie\"],\n\t\t\tisServer: \"false\",\n\t\t\texperimentalStaticLocale: JSON.stringify(\"en\"),\n\t\t});\n\n\t\truntime.setLocale(\"de\", { reload: false });\n\n\t\texpect(warn).toHaveBeenCalledOnce();\n\t\texpect(globalThis.window.location.reload).toHaveBeenCalledOnce();\n\t} finally {\n\t\twarn.mockRestore();\n\t}\n});\n\ntest(\"sets the locale to localStorage\", async () => {\n\t// @ts-expect-error - global variable definition\n\tglobalThis.localStorage = {\n\t\tsetItem: vi.fn(),\n\t\tgetItem: () => \"en\",\n\t};\n\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t\tstrategy: [\"localStorage\"],\n\t});\n\n\truntime.setLocale(\"de\");\n\n\texpect(globalThis.localStorage.setItem).toHaveBeenCalledWith(\n\t\t\"PARAGLIDE_LOCALE\",\n\t\t\"de\"\n\t);\n});\n\n// Test that all strategies set their respective storage mechanisms\ntest(\"should set locale in all configured storage mechanisms regardless of which strategy resolved the locale\", async () => {\n\t// Setup global objects\n\t// @ts-expect-error - global variable definition\n\tglobalThis.document = { cookie: \"\" };\n\t// @ts-expect-error - global variable definition\n\tglobalThis.localStorage = {\n\t\tsetItem: vi.fn(),\n\t\tgetItem: () => null,\n\t};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window = {};\n\t// @ts-expect-error - global variable definition\n\tglobalThis.window.location = {};\n\tglobalThis.window.location.hostname = \"example.com\";\n\tglobalThis.window.location.href = \"https://example.com/en/page\";\n\tglobalThis.window.location.reload = vi.fn();\n\n\t// Create runtime with multiple strategies\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t\tstrategy: [\"url\", \"localStorage\", \"cookie\", \"baseLocale\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://example.com/:locale/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://example.com/en/:path*\"],\n\t\t\t\t\t[\"de\", \"https://example.com/de/:path*\"],\n\t\t\t\t\t[\"fr\", \"https://example.com/fr/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\t// Call setLocale\n\truntime.setLocale(\"fr\");\n\n\t// Verify that all storage mechanisms are updated\n\texpect(globalThis.window.location.href).toBe(\"https://example.com/fr/page\");\n\texpect(globalThis.localStorage.setItem).toHaveBeenCalledWith(\n\t\t\"PARAGLIDE_LOCALE\",\n\t\t\"fr\"\n\t);\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=fr; path=/; max-age=34560000\"\n\t);\n});\n\ntest(\"calls setLocale on custom strategy\", async () => {\n\tlet customLocale = \"en\";\n\tlet setLocaleCalled = false;\n\n\tglobalThis.window = {\n\t\tlocation: { reload: vi.fn() },\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-setter\", \"baseLocale\"],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-setter\", {\n\t\tgetLocale: () => customLocale,\n\t\tsetLocale: (locale) => {\n\t\t\tcustomLocale = locale;\n\t\t\tsetLocaleCalled = true;\n\t\t},\n\t});\n\n\truntime.setLocale(\"fr\");\n\n\texpect(setLocaleCalled).toBe(true);\n\texpect(customLocale).toBe(\"fr\");\n\texpect(globalThis.window.location.reload).toHaveBeenCalled();\n});\n\ntest(\"calls setLocale on multiple custom strategies\", async () => {\n\tlet customLocale1 = \"en\";\n\tlet customLocale2 = \"en\";\n\tlet setLocaleCalled1 = false;\n\tlet setLocaleCalled2 = false;\n\n\tglobalThis.window = {\n\t\tlocation: { reload: vi.fn() },\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-multi1\", \"custom-multi2\", \"baseLocale\"],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-multi1\", {\n\t\tgetLocale: () => customLocale1,\n\t\tsetLocale: (locale) => {\n\t\t\tcustomLocale1 = locale;\n\t\t\tsetLocaleCalled1 = true;\n\t\t},\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-multi2\", {\n\t\tgetLocale: () => customLocale2,\n\t\tsetLocale: (locale) => {\n\t\t\tcustomLocale2 = locale;\n\t\t\tsetLocaleCalled2 = true;\n\t\t},\n\t});\n\n\truntime.setLocale(\"de\");\n\n\texpect(setLocaleCalled1).toBe(true);\n\texpect(setLocaleCalled2).toBe(true);\n\texpect(customLocale1).toBe(\"de\");\n\texpect(customLocale2).toBe(\"de\");\n});\n\ntest(\"setLocale should return a promise if any custom setLocale function is async\", async () => {\n\tlet customLocale1 = \"en\";\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-async\", \"baseLocale\"],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-async\", {\n\t\tgetLocale: () => customLocale1,\n\t\tsetLocale: async (locale) => {\n\t\t\tcustomLocale1 = locale;\n\t\t},\n\t});\n\n\tconst setLocalePromise = runtime.setLocale(\"de\");\n\tconst setLocalePromiseWithoutReload = runtime.setLocale(\"de\", {\n\t\treload: false,\n\t});\n\n\texpect(setLocalePromise).toBeInstanceOf(Promise);\n\texpect(setLocalePromiseWithoutReload).toBeInstanceOf(Promise);\n});\n\ntest(\"awaits async setLocale functions to resolve in custom strategy\", async () => {\n\tlet customLocale1 = \"en\";\n\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-async\", \"baseLocale\"],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-async\", {\n\t\tgetLocale: () => customLocale1,\n\t\tsetLocale: async (locale) => {\n\t\t\tcustomLocale1 = locale;\n\t\t},\n\t});\n\n\tconst setLocalePromise = runtime.setLocale(\"de\");\n\texpect(window.location.reload).not.toHaveBeenCalled();\n\n\tawait setLocalePromise;\n\n\t// Verify that setLocale resolved before reload was called\n\texpect(window.location.reload).toHaveBeenCalledTimes(1);\n\texpect(customLocale1).toBe(\"de\");\n});\n\ntest(\"awaits async setLocale functions to resolve in multiple custom strategies\", async () => {\n\tlet customLocale1 = \"en\";\n\tlet customLocale2 = \"en\";\n\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-async1\", \"custom-async2\", \"baseLocale\"],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-async1\", {\n\t\tgetLocale: () => customLocale1,\n\t\tsetLocale: async (locale) => {\n\t\t\tcustomLocale1 = locale;\n\t\t},\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-async2\", {\n\t\tgetLocale: () => customLocale2,\n\t\tsetLocale: async (locale) => {\n\t\t\tcustomLocale2 = locale;\n\t\t},\n\t});\n\n\tconst setLocalePromise = runtime.setLocale(\"de\");\n\texpect(window.location.reload).not.toHaveBeenCalled();\n\n\tawait setLocalePromise;\n\n\t// Verify that setLocale resolved before reload was called\n\texpect(window.location.reload).toHaveBeenCalledTimes(1);\n\texpect(customLocale1).toBe(\"de\");\n\texpect(customLocale2).toBe(\"de\");\n});\n\ntest(\"reload should not run if async setLocale function rejects in custom strategy\", async () => {\n\tconst customLocale1 = \"en\";\n\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-async\", \"baseLocale\"],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-async\", {\n\t\tgetLocale: () => customLocale1,\n\t\tsetLocale: async () => {\n\t\t\tthrow new Error(\"fetch error\");\n\t\t},\n\t});\n\n\tconst error = expect(() => runtime.setLocale(\"de\")).rejects;\n\tawait error.toThrowError(`Custom strategy \"custom-async\" setLocale failed.`);\n\tawait error.toMatchObject({ cause: { message: \"fetch error\" } });\n\n\t// Verify that reload was never called\n\texpect(window.location.reload).toHaveBeenCalledTimes(0);\n\texpect(customLocale1).toBe(\"en\");\n});\n\ntest(\"custom strategy setLocale works with cookie and localStorage\", async () => {\n\tlet customData = \"en\";\n\n\tglobalThis.document = { cookie: \"\" } as any;\n\tglobalThis.localStorage = {\n\t\tsetItem: vi.fn(),\n\t\tgetItem: () => null,\n\t} as any;\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\thostname: \"example.com\",\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"custom-api\", \"localStorage\", \"cookie\", \"baseLocale\"],\n\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-api\", {\n\t\tgetLocale: () => customData,\n\t\tsetLocale: (locale) => {\n\t\t\tcustomData = locale;\n\t\t},\n\t});\n\n\truntime.setLocale(\"fr\");\n\n\texpect(customData).toBe(\"fr\");\n\texpect(globalThis.localStorage.setItem).toHaveBeenCalledWith(\n\t\t\"PARAGLIDE_LOCALE\",\n\t\t\"fr\"\n\t);\n\texpect(globalThis.document.cookie).toBe(\n\t\t\"PARAGLIDE_LOCALE=fr; path=/; max-age=34560000\"\n\t);\n});\n\ntest(\"custom strategy setLocale integrates with URL strategy\", async () => {\n\tlet customStoredLocale = \"en\";\n\n\tglobalThis.window = {\n\t\tlocation: {\n\t\t\thostname: \"example.com\",\n\t\t\thref: \"https://example.com/en/page\",\n\t\t\treload: vi.fn(),\n\t\t},\n\t} as any;\n\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"fr\", \"de\"],\n\t\tstrategy: [\"url\", \"custom-urlIntegration\", \"baseLocale\"],\n\t\turlPatterns: [\n\t\t\t{\n\t\t\t\tpattern: \"https://example.com/:locale/:path*\",\n\t\t\t\tlocalized: [\n\t\t\t\t\t[\"en\", \"https://example.com/en/:path*\"],\n\t\t\t\t\t[\"fr\", \"https://example.com/fr/:path*\"],\n\t\t\t\t\t[\"de\", \"https://example.com/de/:path*\"],\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tisServer: \"false\",\n\t});\n\n\truntime.defineCustomClientStrategy(\"custom-urlIntegration\", {\n\t\tgetLocale: () => customStoredLocale,\n\t\tsetLocale: (locale) => {\n\t\t\tcustomStoredLocale = locale;\n\t\t},\n\t});\n\n\truntime.setLocale(\"de\");\n\n\texpect(globalThis.window.location.href).toBe(\"https://example.com/de/page\");\n\texpect(customStoredLocale).toBe(\"de\");\n});\n"]}
|