@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,399 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import { compileBundle, toBundleInputTypeAliasName } from "./compile-bundle.js";
|
|
3
|
+
import { toSafeModuleId } from "./safe-module-id.js";
|
|
4
|
+
import { perLocaleBuildStaticLocaleExpression } from "./per-locale-build.js";
|
|
5
|
+
test("compiles to jsdoc", async () => {
|
|
6
|
+
const mockBundle = {
|
|
7
|
+
id: "blue_moon_bottle",
|
|
8
|
+
declarations: [{ type: "input-variable", name: "age" }],
|
|
9
|
+
messages: [
|
|
10
|
+
{
|
|
11
|
+
id: "message-id",
|
|
12
|
+
bundleId: "blue_moon_bottle",
|
|
13
|
+
locale: "en",
|
|
14
|
+
selectors: [],
|
|
15
|
+
variants: [
|
|
16
|
+
{
|
|
17
|
+
id: "1",
|
|
18
|
+
messageId: "message-id",
|
|
19
|
+
matches: [],
|
|
20
|
+
pattern: [
|
|
21
|
+
{ type: "text", value: "Hello" },
|
|
22
|
+
{
|
|
23
|
+
type: "expression",
|
|
24
|
+
arg: { type: "variable-reference", name: "age" },
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
const result = compileBundle({
|
|
33
|
+
fallbackMap: {
|
|
34
|
+
en: "en",
|
|
35
|
+
"en-US": "en",
|
|
36
|
+
},
|
|
37
|
+
bundle: mockBundle,
|
|
38
|
+
messageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.blue_moon_bottle`,
|
|
39
|
+
settings: {
|
|
40
|
+
locales: ["en", "en-US"],
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
expect(result.bundle.code).toMatchInlineSnapshot(`
|
|
44
|
+
"/**
|
|
45
|
+
* | output |
|
|
46
|
+
* | --- |
|
|
47
|
+
* | "Hello{age}" |
|
|
48
|
+
*
|
|
49
|
+
* @param {Blue_Moon_BottleInputs} inputs
|
|
50
|
+
* @param {{ locale?: "en" | "en-US" }} options
|
|
51
|
+
* @returns {LocalizedString}
|
|
52
|
+
*/
|
|
53
|
+
export const blue_moon_bottle = /** @type {((inputs: Blue_Moon_BottleInputs, options?: { locale?: "en" | "en-US" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Blue_Moon_BottleInputs, { locale?: "en" | "en-US" }, {}>} */ ((inputs, options = {}) => {
|
|
54
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
55
|
+
if (locale === "en") return en.blue_moon_bottle(inputs)
|
|
56
|
+
return en_us2.blue_moon_bottle(inputs)
|
|
57
|
+
});"
|
|
58
|
+
`);
|
|
59
|
+
});
|
|
60
|
+
test("uses the base locale as the exhaustive locale branch", () => {
|
|
61
|
+
const mockBundle = {
|
|
62
|
+
id: "greeting",
|
|
63
|
+
declarations: [],
|
|
64
|
+
messages: [
|
|
65
|
+
{
|
|
66
|
+
id: "message-id",
|
|
67
|
+
bundleId: "greeting",
|
|
68
|
+
locale: "en",
|
|
69
|
+
selectors: [],
|
|
70
|
+
variants: [
|
|
71
|
+
{
|
|
72
|
+
id: "variant-id",
|
|
73
|
+
messageId: "message-id",
|
|
74
|
+
matches: [],
|
|
75
|
+
pattern: [{ type: "text", value: "Hello" }],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
const result = compileBundle({
|
|
82
|
+
fallbackMap: {
|
|
83
|
+
fr: "en",
|
|
84
|
+
de: "en",
|
|
85
|
+
en: undefined,
|
|
86
|
+
ja: "en",
|
|
87
|
+
},
|
|
88
|
+
bundle: mockBundle,
|
|
89
|
+
messageReferenceExpression: (locale) => `${locale}_greeting`,
|
|
90
|
+
settings: {
|
|
91
|
+
baseLocale: "en",
|
|
92
|
+
locales: ["fr", "de", "en", "ja"],
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
expect(result.bundle.code).toContain([
|
|
96
|
+
'if (locale === "fr") return fr_greeting(inputs)',
|
|
97
|
+
'if (locale === "de") return de_greeting(inputs)',
|
|
98
|
+
'if (locale === "ja") return ja_greeting(inputs)',
|
|
99
|
+
"return en_greeting(inputs)",
|
|
100
|
+
].join("\n\t"));
|
|
101
|
+
});
|
|
102
|
+
test("emits middleware locale splitting hooks when enabled", () => {
|
|
103
|
+
const mockBundle = {
|
|
104
|
+
id: "blue_moon_bottle",
|
|
105
|
+
declarations: [{ type: "input-variable", name: "age" }],
|
|
106
|
+
messages: [
|
|
107
|
+
{
|
|
108
|
+
id: "message-id",
|
|
109
|
+
bundleId: "blue_moon_bottle",
|
|
110
|
+
locale: "en",
|
|
111
|
+
selectors: [],
|
|
112
|
+
variants: [
|
|
113
|
+
{ id: "1", messageId: "message-id", matches: [], pattern: [] },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
const result = compileBundle({
|
|
119
|
+
fallbackMap: { en: "en" },
|
|
120
|
+
bundle: mockBundle,
|
|
121
|
+
messageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.blue_moon_bottle`,
|
|
122
|
+
settings: {
|
|
123
|
+
locales: ["en"],
|
|
124
|
+
},
|
|
125
|
+
experimentalMiddlewareLocaleSplitting: true,
|
|
126
|
+
});
|
|
127
|
+
expect(result.bundle.code).toContain("if (experimentalMiddlewareLocaleSplitting && isServer === false)");
|
|
128
|
+
expect(result.bundle.code).toContain('trackMessageCall("blue_moon_bottle", locale)');
|
|
129
|
+
expect(result.bundle.code).toContain("globalThis).__paraglide.ssr.blue_moon_bottle(inputs)");
|
|
130
|
+
});
|
|
131
|
+
test("emits the per-locale build marker inside the message function", () => {
|
|
132
|
+
const mockBundle = {
|
|
133
|
+
id: "greeting",
|
|
134
|
+
declarations: [],
|
|
135
|
+
messages: [
|
|
136
|
+
{
|
|
137
|
+
id: "greeting-en",
|
|
138
|
+
bundleId: "greeting",
|
|
139
|
+
locale: "en",
|
|
140
|
+
selectors: [],
|
|
141
|
+
variants: [
|
|
142
|
+
{
|
|
143
|
+
id: "greeting-en-variant",
|
|
144
|
+
messageId: "greeting-en",
|
|
145
|
+
matches: [],
|
|
146
|
+
pattern: [{ type: "text", value: "hello" }],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "greeting-de",
|
|
152
|
+
bundleId: "greeting",
|
|
153
|
+
locale: "de",
|
|
154
|
+
selectors: [],
|
|
155
|
+
variants: [
|
|
156
|
+
{
|
|
157
|
+
id: "greeting-de-variant",
|
|
158
|
+
messageId: "greeting-de",
|
|
159
|
+
matches: [],
|
|
160
|
+
pattern: [{ type: "text", value: "hallo" }],
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
const expression = perLocaleBuildStaticLocaleExpression;
|
|
167
|
+
const result = compileBundle({
|
|
168
|
+
bundle: mockBundle,
|
|
169
|
+
fallbackMap: { en: undefined, de: "en" },
|
|
170
|
+
messageReferenceExpression: (locale) => `${locale}_greeting`,
|
|
171
|
+
settings: { locales: ["en", "de"], baseLocale: "en" },
|
|
172
|
+
experimentalStaticLocale: expression,
|
|
173
|
+
});
|
|
174
|
+
expect(result.bundle.code).toContain(`const locale = ${expression} ?? options.locale ?? getLocale()`);
|
|
175
|
+
expect(result.bundle.code).toContain(`if (${expression} !== undefined && options.locale !== undefined && options.locale !== ${expression}) console.warn(`);
|
|
176
|
+
expect(result.bundle.code).toContain("full document navigation");
|
|
177
|
+
});
|
|
178
|
+
test("compiles to jsdoc with missing translation", async () => {
|
|
179
|
+
const mockBundle = {
|
|
180
|
+
id: "blue_moon_bottle",
|
|
181
|
+
declarations: [{ type: "input-variable", name: "age" }],
|
|
182
|
+
messages: [
|
|
183
|
+
{
|
|
184
|
+
id: "message-id",
|
|
185
|
+
bundleId: "blue_moon_bottle",
|
|
186
|
+
locale: "en",
|
|
187
|
+
selectors: [],
|
|
188
|
+
variants: [
|
|
189
|
+
{
|
|
190
|
+
id: "1",
|
|
191
|
+
messageId: "message-id",
|
|
192
|
+
matches: [],
|
|
193
|
+
pattern: [
|
|
194
|
+
{ type: "text", value: "Hello" },
|
|
195
|
+
{
|
|
196
|
+
type: "expression",
|
|
197
|
+
arg: { type: "variable-reference", name: "age" },
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
};
|
|
205
|
+
const result = compileBundle({
|
|
206
|
+
fallbackMap: {
|
|
207
|
+
en: "en",
|
|
208
|
+
"en-US": "en",
|
|
209
|
+
},
|
|
210
|
+
bundle: mockBundle,
|
|
211
|
+
messageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.blue_moon_bottle`,
|
|
212
|
+
settings: {
|
|
213
|
+
locales: ["en", "en-US", "fr"],
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
expect(result.bundle.code).toMatchInlineSnapshot(`
|
|
217
|
+
"/**
|
|
218
|
+
* | output |
|
|
219
|
+
* | --- |
|
|
220
|
+
* | "Hello{age}" |
|
|
221
|
+
*
|
|
222
|
+
* @param {Blue_Moon_BottleInputs} inputs
|
|
223
|
+
* @param {{ locale?: "en" | "en-US" }} options
|
|
224
|
+
* @returns {LocalizedString}
|
|
225
|
+
*/
|
|
226
|
+
export const blue_moon_bottle = /** @type {((inputs: Blue_Moon_BottleInputs, options?: { locale?: "en" | "en-US" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Blue_Moon_BottleInputs, { locale?: "en" | "en-US" }, {}>} */ ((inputs, options = {}) => {
|
|
227
|
+
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
228
|
+
if (locale === "en") return en.blue_moon_bottle(inputs)
|
|
229
|
+
if (locale === "en-US") return en_us2.blue_moon_bottle(inputs)
|
|
230
|
+
return /** @type {LocalizedString} */ ("blue_moon_bottle")
|
|
231
|
+
});"
|
|
232
|
+
`);
|
|
233
|
+
});
|
|
234
|
+
// https://github.com/opral/inlang-paraglide-js/issues/285
|
|
235
|
+
test("compiles bundles with arbitrary module identifiers", async () => {
|
|
236
|
+
const mockBundle = {
|
|
237
|
+
id: "$p@44🍌",
|
|
238
|
+
declarations: [{ type: "input-variable", name: "age" }],
|
|
239
|
+
messages: [
|
|
240
|
+
{
|
|
241
|
+
id: "message-id",
|
|
242
|
+
bundleId: "$p@44🍌",
|
|
243
|
+
locale: "en",
|
|
244
|
+
selectors: [],
|
|
245
|
+
variants: [
|
|
246
|
+
{
|
|
247
|
+
id: "1",
|
|
248
|
+
messageId: "message-id",
|
|
249
|
+
matches: [],
|
|
250
|
+
pattern: [
|
|
251
|
+
{ type: "text", value: "Hello" },
|
|
252
|
+
{
|
|
253
|
+
type: "expression",
|
|
254
|
+
arg: { type: "variable-reference", name: "age" },
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
};
|
|
262
|
+
const result = compileBundle({
|
|
263
|
+
fallbackMap: {},
|
|
264
|
+
bundle: mockBundle,
|
|
265
|
+
messageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.blue_moon_bottle`,
|
|
266
|
+
});
|
|
267
|
+
expect(result.bundle.code).includes(`export { ${toSafeModuleId("$p@44🍌")} as "$p@44🍌" }`);
|
|
268
|
+
});
|
|
269
|
+
test("keeps generated input typedef names collision-free for repeated underscores", () => {
|
|
270
|
+
expect(toBundleInputTypeAliasName("foo_bar")).toBe("Foo_BarInputs");
|
|
271
|
+
expect(toBundleInputTypeAliasName("foo__bar")).toBe("Foo__BarInputs");
|
|
272
|
+
expect(toBundleInputTypeAliasName("foo_bar")).not.toBe(toBundleInputTypeAliasName("foo__bar"));
|
|
273
|
+
});
|
|
274
|
+
test("handles message pattern with duplicate variable references", async () => {
|
|
275
|
+
const mockBundle = {
|
|
276
|
+
id: "date_last_days",
|
|
277
|
+
declarations: [
|
|
278
|
+
{ type: "input-variable", name: "days" },
|
|
279
|
+
{ type: "input-variable", name: "days" },
|
|
280
|
+
],
|
|
281
|
+
messages: [
|
|
282
|
+
{
|
|
283
|
+
id: "date_last_days",
|
|
284
|
+
bundleId: "date_last_days",
|
|
285
|
+
locale: "en",
|
|
286
|
+
selectors: [],
|
|
287
|
+
variants: [
|
|
288
|
+
{
|
|
289
|
+
id: "1",
|
|
290
|
+
messageId: "date_last_days",
|
|
291
|
+
matches: [],
|
|
292
|
+
pattern: [
|
|
293
|
+
{ type: "text", value: "Last " },
|
|
294
|
+
{
|
|
295
|
+
type: "expression",
|
|
296
|
+
arg: { type: "variable-reference", name: "days" },
|
|
297
|
+
},
|
|
298
|
+
{ type: "text", value: " days, showing " },
|
|
299
|
+
{
|
|
300
|
+
type: "expression",
|
|
301
|
+
arg: { type: "variable-reference", name: "days" },
|
|
302
|
+
},
|
|
303
|
+
{ type: "text", value: " items" },
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
};
|
|
310
|
+
const result = compileBundle({
|
|
311
|
+
fallbackMap: {
|
|
312
|
+
en: "en",
|
|
313
|
+
},
|
|
314
|
+
bundle: mockBundle,
|
|
315
|
+
messageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.date_last_days`,
|
|
316
|
+
});
|
|
317
|
+
// The JSDoc should not have duplicate parameters
|
|
318
|
+
expect(result.bundle.code).toContain("@param {Date_Last_DaysInputs} inputs");
|
|
319
|
+
expect(result.bundle.code).not.toContain("days: NonNullable<unknown>, days: NonNullable<unknown>");
|
|
320
|
+
// Check that the pattern is compiled correctly
|
|
321
|
+
const enMessage = result.messages?.en;
|
|
322
|
+
expect(enMessage).toBeDefined();
|
|
323
|
+
expect(enMessage?.code).toContain("Last ${i?.days} days, showing ${i?.days} items");
|
|
324
|
+
});
|
|
325
|
+
test("adds .parts() to bundle functions when markup exists", async () => {
|
|
326
|
+
const mockBundle = {
|
|
327
|
+
id: "notice",
|
|
328
|
+
declarations: [{ type: "input-variable", name: "count" }],
|
|
329
|
+
messages: [
|
|
330
|
+
{
|
|
331
|
+
id: "notice-id",
|
|
332
|
+
bundleId: "notice",
|
|
333
|
+
locale: "en",
|
|
334
|
+
selectors: [],
|
|
335
|
+
variants: [
|
|
336
|
+
{
|
|
337
|
+
id: "1",
|
|
338
|
+
messageId: "notice-id",
|
|
339
|
+
matches: [],
|
|
340
|
+
pattern: [
|
|
341
|
+
{
|
|
342
|
+
type: "markup-start",
|
|
343
|
+
name: "strong",
|
|
344
|
+
options: [],
|
|
345
|
+
attributes: [],
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
type: "expression",
|
|
349
|
+
arg: { type: "variable-reference", name: "count" },
|
|
350
|
+
},
|
|
351
|
+
{ type: "text", value: " items" },
|
|
352
|
+
{
|
|
353
|
+
type: "markup-end",
|
|
354
|
+
name: "strong",
|
|
355
|
+
options: [],
|
|
356
|
+
attributes: [],
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
],
|
|
361
|
+
},
|
|
362
|
+
],
|
|
363
|
+
};
|
|
364
|
+
const result = compileBundle({
|
|
365
|
+
fallbackMap: {
|
|
366
|
+
en: undefined,
|
|
367
|
+
},
|
|
368
|
+
bundle: mockBundle,
|
|
369
|
+
messageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.notice`,
|
|
370
|
+
settings: {
|
|
371
|
+
locales: ["en"],
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
const compiledEnMessage = result.messages.en;
|
|
375
|
+
if (!compiledEnMessage) {
|
|
376
|
+
throw new Error("Expected compiled english message");
|
|
377
|
+
}
|
|
378
|
+
const moduleSource = `
|
|
379
|
+
const getLocale = () => "en";
|
|
380
|
+
const trackMessageCall = () => {};
|
|
381
|
+
const experimentalMiddlewareLocaleSplitting = false;
|
|
382
|
+
const isServer = true;
|
|
383
|
+
const experimentalStaticLocale = undefined;
|
|
384
|
+
const en = {
|
|
385
|
+
notice: ${compiledEnMessage.code.replace(/;\s*$/, "")}
|
|
386
|
+
};
|
|
387
|
+
${result.bundle.code}
|
|
388
|
+
`;
|
|
389
|
+
const { notice } = await import("data:text/javascript;base64," + btoa(moduleSource));
|
|
390
|
+
expect(notice({ count: 3 })).toBe("3 items");
|
|
391
|
+
expect(notice.parts({ count: 3 })).toEqual([
|
|
392
|
+
{ type: "markup-start", name: "strong", options: {}, attributes: {} },
|
|
393
|
+
{ type: "text", value: "3" },
|
|
394
|
+
{ type: "text", value: " items" },
|
|
395
|
+
{ type: "markup-end", name: "strong", options: {}, attributes: {} },
|
|
396
|
+
]);
|
|
397
|
+
expect(result.bundle.code).toContain('MessageMetadata<NoticeInputs, { locale?: "en" }, { strong: { options: {}; attributes: {}; children: true } }>');
|
|
398
|
+
});
|
|
399
|
+
//# sourceMappingURL=compile-bundle.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-bundle.test.js","sourceRoot":"","sources":["../../src/compiler/compile-bundle.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oCAAoC,EAAE,MAAM,uBAAuB,CAAC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asName } from \"./compile-bundle.js\";\nimport type { BundleNested, ParaglideSettings } from \"../messages/ast.js\";\nimport { toSafeModuleId } from \"./safe-module-id.js\";\nimport { perLocaleBuildStaticLocaleExpression } from \"./per-locale-build.js\";\n\ntest(\"compiles to jsdoc\", async () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"blue_moon_bottle\",\n\t\tdeclarations: [{ type: \"input-variable\", name: \"age\" }],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"message-id\",\n\t\t\t\tbundleId: \"blue_moon_bottle\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\tmessageId: \"message-id\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{ type: \"text\", value: \"Hello\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"age\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: {\n\t\t\ten: \"en\",\n\t\t\t\"en-US\": \"en\",\n\t\t},\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) =>\n\t\t\t`${toSafeModuleId(locale)}.blue_moon_bottle`,\n\t\tsettings: {\n\t\t\tlocales: [\"en\", \"en-US\"],\n\t\t} as ParaglideSettings,\n\t});\n\n\texpect(result.bundle.code).toMatchInlineSnapshot(\n\t\t`\n\t\t\"/**\n\t\t* | output |\n\t\t* | --- |\n\t\t* | \"Hello{age}\" |\n\t\t*\n\t\t* @param {Blue_Moon_BottleInputs} inputs\n\t\t* @param {{ locale?: \"en\" | \"en-US\" }} options\n\t\t* @returns {LocalizedString}\n\t\t*/\n\t\texport const blue_moon_bottle = /** @type {((inputs: Blue_Moon_BottleInputs, options?: { locale?: \"en\" | \"en-US\" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Blue_Moon_BottleInputs, { locale?: \"en\" | \"en-US\" }, {}>} */ ((inputs, options = {}) => {\n\t\t\tconst locale = experimentalStaticLocale ?? options.locale ?? getLocale()\n\t\t\tif (locale === \"en\") return en.blue_moon_bottle(inputs)\n\t\t\treturn en_us2.blue_moon_bottle(inputs)\n\t\t});\"\n\t`\n\t);\n});\n\ntest(\"uses the base locale as the exhaustive locale branch\", () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"greeting\",\n\t\tdeclarations: [],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"message-id\",\n\t\t\t\tbundleId: \"greeting\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"variant-id\",\n\t\t\t\t\t\tmessageId: \"message-id\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [{ type: \"text\", value: \"Hello\" }],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: {\n\t\t\tfr: \"en\",\n\t\t\tde: \"en\",\n\t\t\ten: undefined,\n\t\t\tja: \"en\",\n\t\t},\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) => `${locale}_greeting`,\n\t\tsettings: {\n\t\t\tbaseLocale: \"en\",\n\t\t\tlocales: [\"fr\", \"de\", \"en\", \"ja\"],\n\t\t} as ParaglideSettings,\n\t});\n\n\texpect(result.bundle.code).toContain(\n\t\t[\n\t\t\t'if (locale === \"fr\") return fr_greeting(inputs)',\n\t\t\t'if (locale === \"de\") return de_greeting(inputs)',\n\t\t\t'if (locale === \"ja\") return ja_greeting(inputs)',\n\t\t\t\"return en_greeting(inputs)\",\n\t\t].join(\"\\n\\t\")\n\t);\n});\n\ntest(\"emits middleware locale splitting hooks when enabled\", () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"blue_moon_bottle\",\n\t\tdeclarations: [{ type: \"input-variable\", name: \"age\" }],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"message-id\",\n\t\t\t\tbundleId: \"blue_moon_bottle\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{ id: \"1\", messageId: \"message-id\", matches: [], pattern: [] },\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: { en: \"en\" },\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) =>\n\t\t\t`${toSafeModuleId(locale)}.blue_moon_bottle`,\n\t\tsettings: {\n\t\t\tlocales: [\"en\"],\n\t\t} as ParaglideSettings,\n\t\texperimentalMiddlewareLocaleSplitting: true,\n\t});\n\n\texpect(result.bundle.code).toContain(\n\t\t\"if (experimentalMiddlewareLocaleSplitting && isServer === false)\"\n\t);\n\texpect(result.bundle.code).toContain(\n\t\t'trackMessageCall(\"blue_moon_bottle\", locale)'\n\t);\n\texpect(result.bundle.code).toContain(\n\t\t\"globalThis).__paraglide.ssr.blue_moon_bottle(inputs)\"\n\t);\n});\n\ntest(\"emits the per-locale build marker inside the message function\", () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"greeting\",\n\t\tdeclarations: [],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"greeting-en\",\n\t\t\t\tbundleId: \"greeting\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"greeting-en-variant\",\n\t\t\t\t\t\tmessageId: \"greeting-en\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [{ type: \"text\", value: \"hello\" }],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"greeting-de\",\n\t\t\t\tbundleId: \"greeting\",\n\t\t\t\tlocale: \"de\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"greeting-de-variant\",\n\t\t\t\t\t\tmessageId: \"greeting-de\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [{ type: \"text\", value: \"hallo\" }],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\tconst expression = perLocaleBuildStaticLocaleExpression;\n\tconst result = compileBundle({\n\t\tbundle: mockBundle,\n\t\tfallbackMap: { en: undefined, de: \"en\" },\n\t\tmessageReferenceExpression: (locale) => `${locale}_greeting`,\n\t\tsettings: { locales: [\"en\", \"de\"], baseLocale: \"en\" } as ParaglideSettings,\n\t\texperimentalStaticLocale: expression,\n\t});\n\n\texpect(result.bundle.code).toContain(\n\t\t`const locale = ${expression} ?? options.locale ?? getLocale()`\n\t);\n\texpect(result.bundle.code).toContain(\n\t\t`if (${expression} !== undefined && options.locale !== undefined && options.locale !== ${expression}) console.warn(`\n\t);\n\texpect(result.bundle.code).toContain(\"full document navigation\");\n});\n\ntest(\"compiles to jsdoc with missing translation\", async () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"blue_moon_bottle\",\n\t\tdeclarations: [{ type: \"input-variable\", name: \"age\" }],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"message-id\",\n\t\t\t\tbundleId: \"blue_moon_bottle\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\tmessageId: \"message-id\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{ type: \"text\", value: \"Hello\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"age\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: {\n\t\t\ten: \"en\",\n\t\t\t\"en-US\": \"en\",\n\t\t},\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) =>\n\t\t\t`${toSafeModuleId(locale)}.blue_moon_bottle`,\n\t\tsettings: {\n\t\t\tlocales: [\"en\", \"en-US\", \"fr\"],\n\t\t} as ParaglideSettings,\n\t});\n\n\texpect(result.bundle.code).toMatchInlineSnapshot(\n\t\t`\n\t\t\"/**\n\t\t* | output |\n\t\t* | --- |\n\t\t* | \"Hello{age}\" |\n\t\t*\n\t\t* @param {Blue_Moon_BottleInputs} inputs\n\t\t* @param {{ locale?: \"en\" | \"en-US\" }} options\n\t\t* @returns {LocalizedString}\n\t\t*/\n\t\texport const blue_moon_bottle = /** @type {((inputs: Blue_Moon_BottleInputs, options?: { locale?: \"en\" | \"en-US\" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Blue_Moon_BottleInputs, { locale?: \"en\" | \"en-US\" }, {}>} */ ((inputs, options = {}) => {\n\t\t\tconst locale = experimentalStaticLocale ?? options.locale ?? getLocale()\n\t\t\tif (locale === \"en\") return en.blue_moon_bottle(inputs)\n\t\t\tif (locale === \"en-US\") return en_us2.blue_moon_bottle(inputs)\n\t\t\treturn /** @type {LocalizedString} */ (\"blue_moon_bottle\")\n\t\t});\"\n\t`\n\t);\n});\n\n// https://github.com/opral/inlang-paraglide-js/issues/285\ntest(\"compiles bundles with arbitrary module identifiers\", async () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"$p@44🍌\",\n\t\tdeclarations: [{ type: \"input-variable\", name: \"age\" }],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"message-id\",\n\t\t\t\tbundleId: \"$p@44🍌\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\tmessageId: \"message-id\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{ type: \"text\", value: \"Hello\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"age\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: {},\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) =>\n\t\t\t`${toSafeModuleId(locale)}.blue_moon_bottle`,\n\t});\n\n\texpect(result.bundle.code).includes(\n\t\t`export { ${toSafeModuleId(\"$p@44🍌\")} as \"$p@44🍌\" }`\n\t);\n});\n\ntest(\"keeps generated input typedef names collision-free for repeated underscores\", () => {\n\texpect(toBundleInputTypeAliasName(\"foo_bar\")).toBe(\"Foo_BarInputs\");\n\texpect(toBundleInputTypeAliasName(\"foo__bar\")).toBe(\"Foo__BarInputs\");\n\texpect(toBundleInputTypeAliasName(\"foo_bar\")).not.toBe(\n\t\ttoBundleInputTypeAliasName(\"foo__bar\")\n\t);\n});\n\ntest(\"handles message pattern with duplicate variable references\", async () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"date_last_days\",\n\t\tdeclarations: [\n\t\t\t{ type: \"input-variable\", name: \"days\" },\n\t\t\t{ type: \"input-variable\", name: \"days\" },\n\t\t],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"date_last_days\",\n\t\t\t\tbundleId: \"date_last_days\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\tmessageId: \"date_last_days\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{ type: \"text\", value: \"Last \" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"days\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ type: \"text\", value: \" days, showing \" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"days\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ type: \"text\", value: \" items\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: {\n\t\t\ten: \"en\",\n\t\t},\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) =>\n\t\t\t`${toSafeModuleId(locale)}.date_last_days`,\n\t});\n\n\t// The JSDoc should not have duplicate parameters\n\texpect(result.bundle.code).toContain(\"@param {Date_Last_DaysInputs} inputs\");\n\texpect(result.bundle.code).not.toContain(\n\t\t\"days: NonNullable<unknown>, days: NonNullable<unknown>\"\n\t);\n\n\t// Check that the pattern is compiled correctly\n\tconst enMessage = result.messages?.en;\n\texpect(enMessage).toBeDefined();\n\texpect(enMessage?.code).toContain(\n\t\t\"Last ${i?.days} days, showing ${i?.days} items\"\n\t);\n});\n\ntest(\"adds .parts() to bundle functions when markup exists\", async () => {\n\tconst mockBundle: BundleNested = {\n\t\tid: \"notice\",\n\t\tdeclarations: [{ type: \"input-variable\", name: \"count\" }],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tid: \"notice-id\",\n\t\t\t\tbundleId: \"notice\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\tmessageId: \"notice-id\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"markup-start\",\n\t\t\t\t\t\t\t\tname: \"strong\",\n\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\tattributes: [],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ type: \"text\", value: \" items\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"markup-end\",\n\t\t\t\t\t\t\t\tname: \"strong\",\n\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\tattributes: [],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tconst result = compileBundle({\n\t\tfallbackMap: {\n\t\t\ten: undefined,\n\t\t},\n\t\tbundle: mockBundle,\n\t\tmessageReferenceExpression: (locale) => `${toSafeModuleId(locale)}.notice`,\n\t\tsettings: {\n\t\t\tlocales: [\"en\"],\n\t\t} as ParaglideSettings,\n\t});\n\tconst compiledEnMessage = result.messages.en;\n\tif (!compiledEnMessage) {\n\t\tthrow new Error(\"Expected compiled english message\");\n\t}\n\n\tconst moduleSource = `\nconst getLocale = () => \"en\";\nconst trackMessageCall = () => {};\nconst experimentalMiddlewareLocaleSplitting = false;\nconst isServer = true;\nconst experimentalStaticLocale = undefined;\nconst en = {\n\tnotice: ${compiledEnMessage.code.replace(/;\\s*$/, \"\")}\n};\n${result.bundle.code}\n`;\n\n\tconst { notice } = await import(\n\t\t\"data:text/javascript;base64,\" + btoa(moduleSource)\n\t);\n\n\texpect(notice({ count: 3 })).toBe(\"3 items\");\n\texpect(notice.parts({ count: 3 })).toEqual([\n\t\t{ type: \"markup-start\", name: \"strong\", options: {}, attributes: {} },\n\t\t{ type: \"text\", value: \"3\" },\n\t\t{ type: \"text\", value: \" items\" },\n\t\t{ type: \"markup-end\", name: \"strong\", options: {}, attributes: {} },\n\t]);\n\texpect(result.bundle.code).toContain(\n\t\t'MessageMetadata<NoticeInputs, { locale?: \"en\" }, { strong: { options: {}; attributes: {}; children: true } }>'\n\t);\n});\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LocalVariable } from "../messages/ast.js";
|
|
2
|
+
/**
|
|
3
|
+
* Compiles a local variable.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const code = compileLocalVariable({
|
|
7
|
+
* type: "local-variable",
|
|
8
|
+
* name: "myVar",
|
|
9
|
+
* value: { type: "literal", value: "Hello" }
|
|
10
|
+
* });
|
|
11
|
+
* >> code === "const myVar = 'Hello';"
|
|
12
|
+
*/
|
|
13
|
+
export declare function compileLocalVariable(args: {
|
|
14
|
+
locale: string;
|
|
15
|
+
declaration: LocalVariable;
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-local-variable.d.ts","sourceRoot":"","sources":["../../src/compiler/compile-local-variable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AAKpF;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,aAAa,CAAC;CAC3B,GAAG,MAAM,CAUT"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { compileInputAccess } from "./variable-access.js";
|
|
2
|
+
import { escapeForDoubleQuoteString } from "../services/codegen/escape.js";
|
|
3
|
+
import { compileAnnotation } from "./compile-annotation.js";
|
|
4
|
+
/**
|
|
5
|
+
* Compiles a local variable.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const code = compileLocalVariable({
|
|
9
|
+
* type: "local-variable",
|
|
10
|
+
* name: "myVar",
|
|
11
|
+
* value: { type: "literal", value: "Hello" }
|
|
12
|
+
* });
|
|
13
|
+
* >> code === "const myVar = 'Hello';"
|
|
14
|
+
*/
|
|
15
|
+
export function compileLocalVariable(args) {
|
|
16
|
+
const annotation = args.declaration.value.annotation;
|
|
17
|
+
const value = compileAnnotation(compileLiteralOrVarRef(args.declaration.value.arg), args.locale, annotation);
|
|
18
|
+
return `const ${args.declaration.name} = ${value};`;
|
|
19
|
+
}
|
|
20
|
+
function compileLiteralOrVarRef(value) {
|
|
21
|
+
switch (value.type) {
|
|
22
|
+
case "literal":
|
|
23
|
+
return `"${escapeForDoubleQuoteString(value.value)}"`;
|
|
24
|
+
case "variable-reference":
|
|
25
|
+
return compileInputAccess(value.name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=compile-local-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-local-variable.js","sourceRoot":"","sources":["../../src/compiler/compile-local-variable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAGpC;IACA,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC;IAErD,MAAM,KAAK,GAAG,iBAAiB,CAC9B,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAClD,IAAI,CAAC,MAAM,EACX,UAAU,CACV,CAAC;IAEF,OAAO,SAAS,IAAI,CAAC,WAAW,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC;AACrD,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAkC;IACjE,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACb,OAAO,IAAI,0BAA0B,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;QACvD,KAAK,oBAAoB;YACxB,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;AACF,CAAC","sourcesContent":["import type { Literal, LocalVariable, VariableReference } from \"../messages/ast.js\";\nimport { compileInputAccess } from \"./variable-access.js\";\nimport { escapeForDoubleQuoteString } from \"../services/codegen/escape.js\";\nimport { compileAnnotation } from \"./compile-annotation.js\";\n\n/**\n * Compiles a local variable.\n *\n * @example\n * const code = compileLocalVariable({\n * type: \"local-variable\",\n * name: \"myVar\",\n * value: { type: \"literal\", value: \"Hello\" }\n * });\n * >> code === \"const myVar = 'Hello';\"\n */\nexport function compileLocalVariable(args: {\n\tlocale: string;\n\tdeclaration: LocalVariable;\n}): string {\n\tconst annotation = args.declaration.value.annotation;\n\n\tconst value = compileAnnotation(\n\t\tcompileLiteralOrVarRef(args.declaration.value.arg),\n\t\targs.locale,\n\t\tannotation\n\t);\n\n\treturn `const ${args.declaration.name} = ${value};`;\n}\n\nfunction compileLiteralOrVarRef(value: Literal | VariableReference): string {\n\tswitch (value.type) {\n\t\tcase \"literal\":\n\t\t\treturn `\"${escapeForDoubleQuoteString(value.value)}\"`;\n\t\tcase \"variable-reference\":\n\t\t\treturn compileInputAccess(value.name);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-local-variable.test.d.ts","sourceRoot":"","sources":["../../src/compiler/compile-local-variable.test.ts"],"names":[],"mappings":""}
|