@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,32 @@
|
|
|
1
|
+
import { strategy } from "./variables.js";
|
|
2
|
+
/**
|
|
3
|
+
* Match route policy against both the public URL and its canonical URL.
|
|
4
|
+
*
|
|
5
|
+
* The function is deliberately separate from variables.js: configuration is
|
|
6
|
+
* inert data, while canonicalization and route selection form a routing layer.
|
|
7
|
+
*
|
|
8
|
+
* @param {string | URL} url
|
|
9
|
+
* @returns {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined}
|
|
10
|
+
*/
|
|
11
|
+
export declare function findMatchingRouteStrategy(url: string | URL): {
|
|
12
|
+
match: string;
|
|
13
|
+
strategy?: typeof strategy;
|
|
14
|
+
exclude?: boolean;
|
|
15
|
+
} | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the strategy to use for a specific URL.
|
|
18
|
+
*
|
|
19
|
+
* If no route strategy matches (or the matching rule is `exclude: true`),
|
|
20
|
+
* the global strategy is returned.
|
|
21
|
+
*
|
|
22
|
+
* @param {string | URL} url
|
|
23
|
+
* @returns {typeof strategy}
|
|
24
|
+
*/
|
|
25
|
+
export declare function getStrategyForUrl(url: string | URL): typeof strategy;
|
|
26
|
+
/**
|
|
27
|
+
* Returns whether the given URL is excluded from middleware i18n processing.
|
|
28
|
+
*
|
|
29
|
+
* @param {string | URL} url
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
export declare function isExcludedByRouteStrategy(url: string | URL): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-strategy.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/route-strategy.js"],"names":[],"mappings":"AACA,OAAO,EAAmB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAO3D;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAHlC,MAAM,GAAG,GAGyB,GAFhC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAiCxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAH1B,MAAM,GAAG,GAGiB,GAFxB,OAAO,QAAQ,CAY3B;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAHlC,MAAM,GAAG,GAGyB,GAFhC,OAAO,CAInB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { deLocalizeUrl } from "./localize-url.js";
|
|
2
|
+
import { routeStrategies, strategy } from "./variables.js";
|
|
3
|
+
/** @type {string | undefined} */
|
|
4
|
+
let cachedRouteStrategyUrl;
|
|
5
|
+
/** @type {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined} */
|
|
6
|
+
let cachedRouteStrategy;
|
|
7
|
+
/**
|
|
8
|
+
* Match route policy against both the public URL and its canonical URL.
|
|
9
|
+
*
|
|
10
|
+
* The function is deliberately separate from variables.js: configuration is
|
|
11
|
+
* inert data, while canonicalization and route selection form a routing layer.
|
|
12
|
+
*
|
|
13
|
+
* @param {string | URL} url
|
|
14
|
+
* @returns {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined}
|
|
15
|
+
*/
|
|
16
|
+
export function findMatchingRouteStrategy(url) {
|
|
17
|
+
if (routeStrategies.length === 0) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const urlString = typeof url === "string" ? url : url.href;
|
|
21
|
+
if (cachedRouteStrategyUrl === urlString) {
|
|
22
|
+
return cachedRouteStrategy;
|
|
23
|
+
}
|
|
24
|
+
const publicUrl = new URL(urlString, "http://example.com");
|
|
25
|
+
const canonicalUrl = deLocalizeUrl(publicUrl);
|
|
26
|
+
const candidateUrls = canonicalUrl.href === publicUrl.href
|
|
27
|
+
? [publicUrl]
|
|
28
|
+
: [publicUrl, canonicalUrl];
|
|
29
|
+
let match;
|
|
30
|
+
for (const candidateUrl of candidateUrls) {
|
|
31
|
+
for (const routeStrategy of routeStrategies) {
|
|
32
|
+
const pattern = new URLPattern(routeStrategy.match, candidateUrl.href);
|
|
33
|
+
if (pattern.exec(candidateUrl.href)) {
|
|
34
|
+
match = routeStrategy;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (match)
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
cachedRouteStrategyUrl = urlString;
|
|
42
|
+
cachedRouteStrategy = match;
|
|
43
|
+
return match;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the strategy to use for a specific URL.
|
|
47
|
+
*
|
|
48
|
+
* If no route strategy matches (or the matching rule is `exclude: true`),
|
|
49
|
+
* the global strategy is returned.
|
|
50
|
+
*
|
|
51
|
+
* @param {string | URL} url
|
|
52
|
+
* @returns {typeof strategy}
|
|
53
|
+
*/
|
|
54
|
+
export function getStrategyForUrl(url) {
|
|
55
|
+
const routeStrategy = findMatchingRouteStrategy(url);
|
|
56
|
+
if (routeStrategy &&
|
|
57
|
+
routeStrategy.exclude !== true &&
|
|
58
|
+
Array.isArray(routeStrategy.strategy)) {
|
|
59
|
+
return routeStrategy.strategy;
|
|
60
|
+
}
|
|
61
|
+
return strategy;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns whether the given URL is excluded from middleware i18n processing.
|
|
65
|
+
*
|
|
66
|
+
* @param {string | URL} url
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
69
|
+
export function isExcludedByRouteStrategy(url) {
|
|
70
|
+
return findMatchingRouteStrategy(url)?.exclude === true;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=route-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-strategy.js","sourceRoot":"","sources":["../../../src/compiler/runtime/route-strategy.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE3D,iCAAiC;AACjC,IAAI,sBAAsB,CAAC;AAC3B,2FAA2F;AAC3F,IAAI,mBAAmB,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAG;IAC5C,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAC3D,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,mBAAmB,CAAC;IAC5B,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC3D,MAAM,YAAY,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,aAAa,GAClB,YAAY,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;QACnC,CAAC,CAAC,CAAC,SAAS,CAAC;QACb,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC;IACV,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QAC1C,KAAK,MAAM,aAAa,IAAI,eAAe,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;YACvE,IAAI,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,KAAK,GAAG,aAAa,CAAC;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;QACD,IAAI,KAAK;YAAE,MAAM;IAClB,CAAC;IAED,sBAAsB,GAAG,SAAS,CAAC;IACnC,mBAAmB,GAAG,KAAK,CAAC;IAC5B,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAG;IACpC,MAAM,aAAa,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;IACrD,IACC,aAAa;QACb,aAAa,CAAC,OAAO,KAAK,IAAI;QAC9B,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,EACpC,CAAC;QACF,OAAO,aAAa,CAAC,QAAQ,CAAC;IAC/B,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAG;IAC5C,OAAO,yBAAyB,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AACzD,CAAC","sourcesContent":["import { deLocalizeUrl } from \"./localize-url.js\";\nimport { routeStrategies, strategy } from \"./variables.js\";\n\n/** @type {string | undefined} */\nlet cachedRouteStrategyUrl;\n/** @type {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined} */\nlet cachedRouteStrategy;\n\n/**\n * Match route policy against both the public URL and its canonical URL.\n *\n * The function is deliberately separate from variables.js: configuration is\n * inert data, while canonicalization and route selection form a routing layer.\n *\n * @param {string | URL} url\n * @returns {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined}\n */\nexport function findMatchingRouteStrategy(url) {\n\tif (routeStrategies.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst urlString = typeof url === \"string\" ? url : url.href;\n\tif (cachedRouteStrategyUrl === urlString) {\n\t\treturn cachedRouteStrategy;\n\t}\n\n\tconst publicUrl = new URL(urlString, \"http://example.com\");\n\tconst canonicalUrl = deLocalizeUrl(publicUrl);\n\tconst candidateUrls =\n\t\tcanonicalUrl.href === publicUrl.href\n\t\t\t? [publicUrl]\n\t\t\t: [publicUrl, canonicalUrl];\n\tlet match;\n\tfor (const candidateUrl of candidateUrls) {\n\t\tfor (const routeStrategy of routeStrategies) {\n\t\t\tconst pattern = new URLPattern(routeStrategy.match, candidateUrl.href);\n\t\t\tif (pattern.exec(candidateUrl.href)) {\n\t\t\t\tmatch = routeStrategy;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (match) break;\n\t}\n\n\tcachedRouteStrategyUrl = urlString;\n\tcachedRouteStrategy = match;\n\treturn match;\n}\n\n/**\n * Returns the strategy to use for a specific URL.\n *\n * If no route strategy matches (or the matching rule is `exclude: true`),\n * the global strategy is returned.\n *\n * @param {string | URL} url\n * @returns {typeof strategy}\n */\nexport function getStrategyForUrl(url) {\n\tconst routeStrategy = findMatchingRouteStrategy(url);\n\tif (\n\t\trouteStrategy &&\n\t\trouteStrategy.exclude !== true &&\n\t\tArray.isArray(routeStrategy.strategy)\n\t) {\n\t\treturn routeStrategy.strategy;\n\t}\n\treturn strategy;\n}\n\n/**\n * Returns whether the given URL is excluded from middleware i18n processing.\n *\n * @param {string | URL} url\n * @returns {boolean}\n */\nexport function isExcludedByRouteStrategy(url) {\n\treturn findMatchingRouteStrategy(url)?.exclude === true;\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type SetLocaleFn = (newLocale: Locale, options?: {
|
|
2
|
+
reload?: boolean;
|
|
3
|
+
}) => void | Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Set the locale.
|
|
9
|
+
*
|
|
10
|
+
* Updates the locale using your configured strategies (cookie, localStorage, URL, etc.).
|
|
11
|
+
* By default, this navigates the client to the localized URL or reloads the current
|
|
12
|
+
* document to reflect the new locale. `reload: false` is a narrow browser-only escape
|
|
13
|
+
* hatch for a fully client-rendered, non-URL-routed surface that owns its reactive
|
|
14
|
+
* updates and document state. It does not re-render the UI or update the document.
|
|
15
|
+
* Do not use it for normal locale pickers, URL-routed pages, or switching an SSR,
|
|
16
|
+
* SSG, or hydrated document. It is incompatible with per-locale builds.
|
|
17
|
+
*
|
|
18
|
+
* If any custom strategy's `setLocale` function is async, then this function
|
|
19
|
+
* will become async as well.
|
|
20
|
+
*
|
|
21
|
+
* @see https://paraglidejs.com/strategy
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* setLocale('en');
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* setLocale('en', { reload: false });
|
|
28
|
+
*
|
|
29
|
+
* @type {SetLocaleFn}
|
|
30
|
+
*/
|
|
31
|
+
export declare let setLocale: SetLocaleFn;
|
|
32
|
+
/**
|
|
33
|
+
* Overwrite the `setLocale()` function.
|
|
34
|
+
*
|
|
35
|
+
* Use this function to overwrite how the locale is set. For example,
|
|
36
|
+
* modify a cookie, env variable, or a user's preference.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* overwriteSetLocale((newLocale) => {
|
|
40
|
+
* // set the locale in a cookie
|
|
41
|
+
* return Cookies.set('locale', newLocale)
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* @param {SetLocaleFn} fn
|
|
45
|
+
*/
|
|
46
|
+
export declare const overwriteSetLocale: (fn: SetLocaleFn) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-locale.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"AAmCG,YAAuF,WAAW,GAAxF,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAa;AADrG;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,IAAI,SAAS,EAFV,WAwHT,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,OAFpB,WAAW,SAIrB,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { getLocale } from "./get-locale.js";
|
|
2
|
+
import { clearLocaleCookieCache } from "./extract-locale-from-cookie.js";
|
|
3
|
+
import { localizeUrl } from "./localize-url.js";
|
|
4
|
+
import { getStrategyForUrl } from "./route-strategy.js";
|
|
5
|
+
import { customClientStrategies, isCustomStrategy } from "./strategy.js";
|
|
6
|
+
import { cookieDomain, cookieMaxAge, cookieName, isServer, localStorageKey, experimentalStaticLocale, strategy, TREE_SHAKE_COOKIE_STRATEGY_USED, TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED, TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED, TREE_SHAKE_URL_STRATEGY_USED, } from "./variables.js";
|
|
7
|
+
/**
|
|
8
|
+
* Navigates to the localized URL, or reloads the current page
|
|
9
|
+
*
|
|
10
|
+
* @param {string} [newLocation] The new location
|
|
11
|
+
*/
|
|
12
|
+
const navigateOrReload = (newLocation) => {
|
|
13
|
+
if (newLocation) {
|
|
14
|
+
// reload the page by navigating to the new url
|
|
15
|
+
window.location.href = newLocation;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
// reload the page to reflect the new locale
|
|
19
|
+
window.location.reload();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Set the locale.
|
|
27
|
+
*
|
|
28
|
+
* Updates the locale using your configured strategies (cookie, localStorage, URL, etc.).
|
|
29
|
+
* By default, this navigates the client to the localized URL or reloads the current
|
|
30
|
+
* document to reflect the new locale. `reload: false` is a narrow browser-only escape
|
|
31
|
+
* hatch for a fully client-rendered, non-URL-routed surface that owns its reactive
|
|
32
|
+
* updates and document state. It does not re-render the UI or update the document.
|
|
33
|
+
* Do not use it for normal locale pickers, URL-routed pages, or switching an SSR,
|
|
34
|
+
* SSG, or hydrated document. It is incompatible with per-locale builds.
|
|
35
|
+
*
|
|
36
|
+
* If any custom strategy's `setLocale` function is async, then this function
|
|
37
|
+
* will become async as well.
|
|
38
|
+
*
|
|
39
|
+
* @see https://paraglidejs.com/strategy
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* setLocale('en');
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* setLocale('en', { reload: false });
|
|
46
|
+
*
|
|
47
|
+
* @type {SetLocaleFn}
|
|
48
|
+
*/
|
|
49
|
+
export let setLocale = (newLocale, options) => {
|
|
50
|
+
const optionsWithDefaults = {
|
|
51
|
+
reload: true,
|
|
52
|
+
...options,
|
|
53
|
+
};
|
|
54
|
+
if (experimentalStaticLocale !== undefined &&
|
|
55
|
+
newLocale !== experimentalStaticLocale &&
|
|
56
|
+
optionsWithDefaults.reload === false) {
|
|
57
|
+
console.warn(`Paraglide: setLocale(${JSON.stringify(newLocale)}, { reload: false }) cannot switch away from the statically built locale ${JSON.stringify(experimentalStaticLocale)}. A document navigation is required; reload has been forced to true.`);
|
|
58
|
+
optionsWithDefaults.reload = true;
|
|
59
|
+
}
|
|
60
|
+
// locale is already set
|
|
61
|
+
// https://github.com/opral/inlang-paraglide-js/issues/430
|
|
62
|
+
/** @type {Locale | undefined} */
|
|
63
|
+
let currentLocale;
|
|
64
|
+
try {
|
|
65
|
+
currentLocale = getLocale();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// do nothing, no locale has been set yet.
|
|
69
|
+
}
|
|
70
|
+
/** @type {Array<Promise<void>>} */
|
|
71
|
+
const customSetLocalePromises = [];
|
|
72
|
+
/** @type {string | undefined} */
|
|
73
|
+
let newLocation = undefined;
|
|
74
|
+
let strategyToUse = strategy;
|
|
75
|
+
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
76
|
+
strategyToUse = getStrategyForUrl(window.location.href);
|
|
77
|
+
}
|
|
78
|
+
for (const strat of strategyToUse) {
|
|
79
|
+
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&
|
|
80
|
+
strat === "globalVariable") {
|
|
81
|
+
// a default for a custom strategy to get started quickly
|
|
82
|
+
// is likely overwritten by `defineSetLocale()`
|
|
83
|
+
_locale = newLocale;
|
|
84
|
+
}
|
|
85
|
+
else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
86
|
+
if (isServer ||
|
|
87
|
+
typeof document === "undefined" ||
|
|
88
|
+
typeof window === "undefined") {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
// set the cookie
|
|
92
|
+
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
93
|
+
document.cookie = cookieDomain
|
|
94
|
+
? `${cookieString}; domain=${cookieDomain}`
|
|
95
|
+
: cookieString;
|
|
96
|
+
clearLocaleCookieCache();
|
|
97
|
+
}
|
|
98
|
+
else if (strat === "baseLocale") {
|
|
99
|
+
// nothing to be set here. baseLocale is only a fallback
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
else if (TREE_SHAKE_URL_STRATEGY_USED &&
|
|
103
|
+
strat === "url" &&
|
|
104
|
+
typeof window !== "undefined") {
|
|
105
|
+
// route to the new url
|
|
106
|
+
//
|
|
107
|
+
// this triggers a page reload but a user rarely
|
|
108
|
+
// switches locales, so this should be fine.
|
|
109
|
+
//
|
|
110
|
+
// if the behavior is not desired, the implementation
|
|
111
|
+
// can be overwritten by `defineSetLocale()` to avoid
|
|
112
|
+
// a full page reload.
|
|
113
|
+
newLocation = localizeUrl(window.location.href, {
|
|
114
|
+
locale: newLocale,
|
|
115
|
+
}).href;
|
|
116
|
+
}
|
|
117
|
+
else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&
|
|
118
|
+
strat === "localStorage" &&
|
|
119
|
+
typeof window !== "undefined") {
|
|
120
|
+
// set the localStorage
|
|
121
|
+
localStorage.setItem(localStorageKey, newLocale);
|
|
122
|
+
}
|
|
123
|
+
else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
124
|
+
const handler = customClientStrategies.get(strat);
|
|
125
|
+
if (handler) {
|
|
126
|
+
let result = handler.setLocale(newLocale);
|
|
127
|
+
// Handle async setLocale
|
|
128
|
+
if (result instanceof Promise) {
|
|
129
|
+
result = result.catch((error) => {
|
|
130
|
+
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
131
|
+
cause: error,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
customSetLocalePromises.push(result);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const runReload = () => {
|
|
140
|
+
if (!isServer &&
|
|
141
|
+
optionsWithDefaults.reload &&
|
|
142
|
+
window.location &&
|
|
143
|
+
newLocale !== currentLocale) {
|
|
144
|
+
navigateOrReload(newLocation);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
if (customSetLocalePromises.length) {
|
|
148
|
+
return Promise.all(customSetLocalePromises).then(() => {
|
|
149
|
+
runReload();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
runReload();
|
|
153
|
+
return;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Overwrite the `setLocale()` function.
|
|
157
|
+
*
|
|
158
|
+
* Use this function to overwrite how the locale is set. For example,
|
|
159
|
+
* modify a cookie, env variable, or a user's preference.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* overwriteSetLocale((newLocale) => {
|
|
163
|
+
* // set the locale in a cookie
|
|
164
|
+
* return Cookies.set('locale', newLocale)
|
|
165
|
+
* });
|
|
166
|
+
*
|
|
167
|
+
* @param {SetLocaleFn} fn
|
|
168
|
+
*/
|
|
169
|
+
export const overwriteSetLocale = (fn) => {
|
|
170
|
+
setLocale = fn;
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=set-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-locale.js","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,eAAe,EACf,wBAAwB,EACxB,QAAQ,EACR,+BAA+B,EAC/B,wCAAwC,EACxC,sCAAsC,EACtC,4BAA4B,GAC5B,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,EAAE;IACxC,IAAI,WAAW,EAAE,CAAC;QACjB,+CAA+C;QAC/C,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;IACpC,CAAC;SAAM,CAAC;QACP,4CAA4C;QAC5C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;AACF,CAAC,CAAC;AAEF;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,IAAI,SAAS,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;IAC7C,MAAM,mBAAmB,GAAG;QAC3B,MAAM,EAAE,IAAI;QACZ,GAAG,OAAO;KACV,CAAC;IACF,IACC,wBAAwB,KAAK,SAAS;QACtC,SAAS,KAAK,wBAAwB;QACtC,mBAAmB,CAAC,MAAM,KAAK,KAAK,EACnC,CAAC;QACF,OAAO,CAAC,IAAI,CACX,wBAAwB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,4EAA4E,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,sEAAsE,CAC3O,CAAC;QACF,mBAAmB,CAAC,MAAM,GAAG,IAAI,CAAC;IACnC,CAAC;IACD,wBAAwB;IACxB,0DAA0D;IAC1D,iCAAiC;IACjC,IAAI,aAAa,CAAC;IAClB,IAAI,CAAC;QACJ,aAAa,GAAG,SAAS,EAAE,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACR,0CAA0C;IAC3C,CAAC;IACD,mCAAmC;IACnC,MAAM,uBAAuB,GAAG,EAAE,CAAC;IACnC,iCAAiC;IACjC,IAAI,WAAW,GAAG,SAAS,CAAC;IAC5B,IAAI,aAAa,GAAG,QAAQ,CAAC;IAC7B,IAAI,CAAC,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QACzE,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QACnC,IACC,wCAAwC;YACxC,KAAK,KAAK,gBAAgB,EACzB,CAAC;YACF,yDAAyD;YACzD,+CAA+C;YAC/C,OAAO,GAAG,SAAS,CAAC;QACrB,CAAC;aAAM,IAAI,+BAA+B,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;YAClE,IACC,QAAQ;gBACR,OAAO,QAAQ,KAAK,WAAW;gBAC/B,OAAO,MAAM,KAAK,WAAW,EAC5B,CAAC;gBACF,SAAS;YACV,CAAC;YAED,iBAAiB;YACjB,MAAM,YAAY,GAAG,GAAG,UAAU,IAAI,SAAS,qBAAqB,YAAY,EAAE,CAAC;YACnF,QAAQ,CAAC,MAAM,GAAG,YAAY;gBAC7B,CAAC,CAAC,GAAG,YAAY,YAAY,YAAY,EAAE;gBAC3C,CAAC,CAAC,YAAY,CAAC;YAChB,sBAAsB,EAAE,CAAC;QAC1B,CAAC;aAAM,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;YACnC,wDAAwD;YACxD,SAAS;QACV,CAAC;aAAM,IACN,4BAA4B;YAC5B,KAAK,KAAK,KAAK;YACf,OAAO,MAAM,KAAK,WAAW,EAC5B,CAAC;YACF,uBAAuB;YACvB,EAAE;YACF,gDAAgD;YAChD,4CAA4C;YAC5C,EAAE;YACF,qDAAqD;YACrD,qDAAqD;YACrD,sBAAsB;YACtB,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;gBAC/C,MAAM,EAAE,SAAS;aACjB,CAAC,CAAC,IAAI,CAAC;QACT,CAAC;aAAM,IACN,sCAAsC;YACtC,KAAK,KAAK,cAAc;YACxB,OAAO,MAAM,KAAK,WAAW,EAC5B,CAAC;YACF,uBAAuB;YACvB,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;QAClD,CAAC;aAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACzE,MAAM,OAAO,GAAG,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClD,IAAI,OAAO,EAAE,CAAC;gBACb,IAAI,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAC1C,yBAAyB;gBACzB,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;oBAC/B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;wBAC/B,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,qBAAqB,EAAE;4BAC/D,KAAK,EAAE,KAAK;yBACZ,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;oBACH,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAG,GAAG,EAAE;QACtB,IACC,CAAC,QAAQ;YACT,mBAAmB,CAAC,MAAM;YAC1B,MAAM,CAAC,QAAQ;YACf,SAAS,KAAK,aAAa,EAC1B,CAAC;YACF,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC;IAEF,IAAI,uBAAuB,CAAC,MAAM,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACrD,SAAS,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,SAAS,EAAE,CAAC;IAEZ,OAAO;AACR,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE;IACxC,SAAS,GAAG,EAAE,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { getLocale } from \"./get-locale.js\";\nimport { clearLocaleCookieCache } from \"./extract-locale-from-cookie.js\";\nimport { localizeUrl } from \"./localize-url.js\";\nimport { getStrategyForUrl } from \"./route-strategy.js\";\nimport { customClientStrategies, isCustomStrategy } from \"./strategy.js\";\nimport {\n\tcookieDomain,\n\tcookieMaxAge,\n\tcookieName,\n\tisServer,\n\tlocalStorageKey,\n\texperimentalStaticLocale,\n\tstrategy,\n\tTREE_SHAKE_COOKIE_STRATEGY_USED,\n\tTREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED,\n\tTREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED,\n\tTREE_SHAKE_URL_STRATEGY_USED,\n} from \"./variables.js\";\n\n/**\n * Navigates to the localized URL, or reloads the current page\n *\n * @param {string} [newLocation] The new location\n */\nconst navigateOrReload = (newLocation) => {\n\tif (newLocation) {\n\t\t// reload the page by navigating to the new url\n\t\twindow.location.href = newLocation;\n\t} else {\n\t\t// reload the page to reflect the new locale\n\t\twindow.location.reload();\n\t}\n};\n\n/**\n * @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn\n */\n\n/**\n * Set the locale.\n *\n * Updates the locale using your configured strategies (cookie, localStorage, URL, etc.).\n * By default, this navigates the client to the localized URL or reloads the current\n * document to reflect the new locale. `reload: false` is a narrow browser-only escape\n * hatch for a fully client-rendered, non-URL-routed surface that owns its reactive\n * updates and document state. It does not re-render the UI or update the document.\n * Do not use it for normal locale pickers, URL-routed pages, or switching an SSR,\n * SSG, or hydrated document. It is incompatible with per-locale builds.\n *\n * If any custom strategy's `setLocale` function is async, then this function\n * will become async as well.\n *\n * @see https://paraglidejs.com/strategy\n *\n * @example\n * setLocale('en');\n *\n * @example\n * setLocale('en', { reload: false });\n *\n * @type {SetLocaleFn}\n */\nexport let setLocale = (newLocale, options) => {\n\tconst optionsWithDefaults = {\n\t\treload: true,\n\t\t...options,\n\t};\n\tif (\n\t\texperimentalStaticLocale !== undefined &&\n\t\tnewLocale !== experimentalStaticLocale &&\n\t\toptionsWithDefaults.reload === false\n\t) {\n\t\tconsole.warn(\n\t\t\t`Paraglide: setLocale(${JSON.stringify(newLocale)}, { reload: false }) cannot switch away from the statically built locale ${JSON.stringify(experimentalStaticLocale)}. A document navigation is required; reload has been forced to true.`\n\t\t);\n\t\toptionsWithDefaults.reload = true;\n\t}\n\t// locale is already set\n\t// https://github.com/opral/inlang-paraglide-js/issues/430\n\t/** @type {Locale | undefined} */\n\tlet currentLocale;\n\ttry {\n\t\tcurrentLocale = getLocale();\n\t} catch {\n\t\t// do nothing, no locale has been set yet.\n\t}\n\t/** @type {Array<Promise<void>>} */\n\tconst customSetLocalePromises = [];\n\t/** @type {string | undefined} */\n\tlet newLocation = undefined;\n\tlet strategyToUse = strategy;\n\tif (!isServer && typeof window !== \"undefined\" && window.location?.href) {\n\t\tstrategyToUse = getStrategyForUrl(window.location.href);\n\t}\n\tfor (const strat of strategyToUse) {\n\t\tif (\n\t\t\tTREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&\n\t\t\tstrat === \"globalVariable\"\n\t\t) {\n\t\t\t// a default for a custom strategy to get started quickly\n\t\t\t// is likely overwritten by `defineSetLocale()`\n\t\t\t_locale = newLocale;\n\t\t} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === \"cookie\") {\n\t\t\tif (\n\t\t\t\tisServer ||\n\t\t\t\ttypeof document === \"undefined\" ||\n\t\t\t\ttypeof window === \"undefined\"\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// set the cookie\n\t\t\tconst cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;\n\t\t\tdocument.cookie = cookieDomain\n\t\t\t\t? `${cookieString}; domain=${cookieDomain}`\n\t\t\t\t: cookieString;\n\t\t\tclearLocaleCookieCache();\n\t\t} else if (strat === \"baseLocale\") {\n\t\t\t// nothing to be set here. baseLocale is only a fallback\n\t\t\tcontinue;\n\t\t} else if (\n\t\t\tTREE_SHAKE_URL_STRATEGY_USED &&\n\t\t\tstrat === \"url\" &&\n\t\t\ttypeof window !== \"undefined\"\n\t\t) {\n\t\t\t// route to the new url\n\t\t\t//\n\t\t\t// this triggers a page reload but a user rarely\n\t\t\t// switches locales, so this should be fine.\n\t\t\t//\n\t\t\t// if the behavior is not desired, the implementation\n\t\t\t// can be overwritten by `defineSetLocale()` to avoid\n\t\t\t// a full page reload.\n\t\t\tnewLocation = localizeUrl(window.location.href, {\n\t\t\t\tlocale: newLocale,\n\t\t\t}).href;\n\t\t} else if (\n\t\t\tTREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&\n\t\t\tstrat === \"localStorage\" &&\n\t\t\ttypeof window !== \"undefined\"\n\t\t) {\n\t\t\t// set the localStorage\n\t\t\tlocalStorage.setItem(localStorageKey, newLocale);\n\t\t} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {\n\t\t\tconst handler = customClientStrategies.get(strat);\n\t\t\tif (handler) {\n\t\t\t\tlet result = handler.setLocale(newLocale);\n\t\t\t\t// Handle async setLocale\n\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\tresult = result.catch((error) => {\n\t\t\t\t\t\tthrow new Error(`Custom strategy \"${strat}\" setLocale failed.`, {\n\t\t\t\t\t\t\tcause: error,\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\tcustomSetLocalePromises.push(result);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst runReload = () => {\n\t\tif (\n\t\t\t!isServer &&\n\t\t\toptionsWithDefaults.reload &&\n\t\t\twindow.location &&\n\t\t\tnewLocale !== currentLocale\n\t\t) {\n\t\t\tnavigateOrReload(newLocation);\n\t\t}\n\t};\n\n\tif (customSetLocalePromises.length) {\n\t\treturn Promise.all(customSetLocalePromises).then(() => {\n\t\t\trunReload();\n\t\t});\n\t}\n\n\trunReload();\n\n\treturn;\n};\n\n/**\n * Overwrite the `setLocale()` function.\n *\n * Use this function to overwrite how the locale is set. For example,\n * modify a cookie, env variable, or a user's preference.\n *\n * @example\n * overwriteSetLocale((newLocale) => {\n * // set the locale in a cookie\n * return Cookies.set('locale', newLocale)\n * });\n *\n * @param {SetLocaleFn} fn\n */\nexport const overwriteSetLocale = (fn) => {\n\tsetLocale = fn;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-locale.test.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/set-locale.test.ts"],"names":[],"mappings":""}
|