@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,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {`custom_${string}`} CustomStrategy
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {BuiltInStrategy | CustomStrategy} Strategy
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {Array<Strategy>} Strategies
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler
|
|
18
|
+
*/
|
|
19
|
+
/** @type {Map<string, CustomServerStrategyHandler>} */
|
|
20
|
+
export const customServerStrategies = new Map();
|
|
21
|
+
/** @type {Map<string, CustomClientStrategyHandler>} */
|
|
22
|
+
export const customClientStrategies = new Map();
|
|
23
|
+
/**
|
|
24
|
+
* Checks if the given strategy is a custom strategy.
|
|
25
|
+
*
|
|
26
|
+
* @param {unknown} strategy The name of the custom strategy to validate.
|
|
27
|
+
* Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores.
|
|
28
|
+
* @returns {boolean} Returns true if it is a custom strategy, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export function isCustomStrategy(strategy) {
|
|
31
|
+
return (typeof strategy === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Defines a custom strategy that is executed on the server.
|
|
35
|
+
*
|
|
36
|
+
* @see https://paraglidejs.com/strategy#write-your-own-strategy
|
|
37
|
+
*
|
|
38
|
+
* @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
|
|
39
|
+
* @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement
|
|
40
|
+
* the method getLocale.
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
export function defineCustomServerStrategy(strategy, handler) {
|
|
44
|
+
if (!isCustomStrategy(strategy)) {
|
|
45
|
+
throw new Error(`Invalid custom strategy: "${strategy}". Must be a custom strategy following the pattern custom-name.`);
|
|
46
|
+
}
|
|
47
|
+
customServerStrategies.set(strategy, handler);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Defines a custom strategy that is executed on the client.
|
|
51
|
+
*
|
|
52
|
+
* @see https://paraglidejs.com/strategy#write-your-own-strategy
|
|
53
|
+
*
|
|
54
|
+
* @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
|
|
55
|
+
* @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the
|
|
56
|
+
* methods getLocale and setLocale.
|
|
57
|
+
* @returns {void}
|
|
58
|
+
*/
|
|
59
|
+
export function defineCustomClientStrategy(strategy, handler) {
|
|
60
|
+
if (!isCustomStrategy(strategy)) {
|
|
61
|
+
throw new Error(`Invalid custom strategy: "${strategy}". Must be a custom strategy following the pattern custom-name.`);
|
|
62
|
+
}
|
|
63
|
+
customClientStrategies.set(strategy, handler);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../src/compiler/runtime/strategy.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAE,CAAC;AAChD,uDAAuD;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAE,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAQ;IACxC,OAAO,CACN,OAAO,QAAQ,KAAK,QAAQ,IAAI,yBAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC,CACxE,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAAQ,EAAE,OAAO;IAC3D,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACd,6BAA6B,QAAQ,iEAAiE,CACtG,CAAC;IACH,CAAC;IAED,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAAQ,EAAE,OAAO;IAC3D,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACd,6BAA6B,QAAQ,iEAAiE,CACtG,CAAC;IACH,CAAC;IAED,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/**\n * @typedef {\"cookie\" | \"baseLocale\" | \"globalVariable\" | \"url\" | \"preferredLanguage\" | \"localStorage\"} BuiltInStrategy\n */\n\n/**\n * @typedef {`custom_${string}`} CustomStrategy\n */\n\n/**\n * @typedef {BuiltInStrategy | CustomStrategy} Strategy\n */\n\n/**\n * @typedef {Array<Strategy>} Strategies\n */\n\n/**\n * @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler\n */\n\n/**\n * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler\n */\n\n/** @type {Map<string, CustomServerStrategyHandler>} */\nexport const customServerStrategies = new Map();\n/** @type {Map<string, CustomClientStrategyHandler>} */\nexport const customClientStrategies = new Map();\n\n/**\n * Checks if the given strategy is a custom strategy.\n *\n * @param {unknown} strategy The name of the custom strategy to validate.\n * Must be a string that starts with \"custom-\" followed by alphanumeric characters, hyphens, or underscores.\n * @returns {boolean} Returns true if it is a custom strategy, false otherwise.\n */\nexport function isCustomStrategy(strategy) {\n\treturn (\n\t\ttypeof strategy === \"string\" && /^custom-[A-Za-z0-9_-]+$/.test(strategy)\n\t);\n}\n\n/**\n * Defines a custom strategy that is executed on the server.\n *\n * @see https://paraglidejs.com/strategy#write-your-own-strategy\n *\n * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.\n * @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement\n * the method getLocale.\n * @returns {void}\n */\nexport function defineCustomServerStrategy(strategy, handler) {\n\tif (!isCustomStrategy(strategy)) {\n\t\tthrow new Error(\n\t\t\t`Invalid custom strategy: \"${strategy}\". Must be a custom strategy following the pattern custom-name.`\n\t\t);\n\t}\n\n\tcustomServerStrategies.set(strategy, handler);\n}\n\n/**\n * Defines a custom strategy that is executed on the client.\n *\n * @see https://paraglidejs.com/strategy#write-your-own-strategy\n *\n * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.\n * @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the\n * methods getLocale and setLocale.\n * @returns {void}\n */\nexport function defineCustomClientStrategy(strategy, handler) {\n\tif (!isCustomStrategy(strategy)) {\n\t\tthrow new Error(\n\t\t\t`Invalid custom strategy: \"${strategy}\". Must be a custom strategy following the pattern custom-name.`\n\t\t);\n\t}\n\n\tcustomClientStrategies.set(strategy, handler);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.test.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/strategy.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { test, expect, describe, beforeEach } from "vitest";
|
|
2
|
+
import { defineCustomServerStrategy, defineCustomClientStrategy, isCustomStrategy, } from "./strategy.js";
|
|
3
|
+
import { createParaglide } from "../create-paraglide.js";
|
|
4
|
+
describe("isCustomStrategy", () => {
|
|
5
|
+
test("returns true for valid custom strategy patterns", () => {
|
|
6
|
+
expect(isCustomStrategy("custom-header")).toBe(true);
|
|
7
|
+
expect(isCustomStrategy("custom-auth123")).toBe(true);
|
|
8
|
+
expect(isCustomStrategy("custom-API")).toBe(true);
|
|
9
|
+
expect(isCustomStrategy("custom-sessionStorage")).toBe(true);
|
|
10
|
+
expect(isCustomStrategy("custom-oAuth2")).toBe(true);
|
|
11
|
+
expect(isCustomStrategy("custom-a")).toBe(true);
|
|
12
|
+
expect(isCustomStrategy("custom-1")).toBe(true);
|
|
13
|
+
expect(isCustomStrategy("custom-Z")).toBe(true);
|
|
14
|
+
expect(isCustomStrategy("custom-9")).toBe(true);
|
|
15
|
+
expect(isCustomStrategy("custom-aZ19")).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
test("returns false for invalid custom strategy patterns", () => {
|
|
18
|
+
expect(isCustomStrategy("")).toBe(false);
|
|
19
|
+
expect(isCustomStrategy("custom_")).toBe(false);
|
|
20
|
+
expect(isCustomStrategy("custom-")).toBe(false);
|
|
21
|
+
expect(isCustomStrategy("header")).toBe(false);
|
|
22
|
+
expect(isCustomStrategy("custom")).toBe(false);
|
|
23
|
+
// These are now valid with our relaxed pattern:
|
|
24
|
+
expect(isCustomStrategy("custom-invalid-name")).toBe(true);
|
|
25
|
+
expect(isCustomStrategy("custom-invalid_name")).toBe(true);
|
|
26
|
+
// But spaces and special chars are still invalid:
|
|
27
|
+
expect(isCustomStrategy("custom-invalid name")).toBe(false);
|
|
28
|
+
expect(isCustomStrategy("custom-invalid@")).toBe(false);
|
|
29
|
+
expect(isCustomStrategy("Custom-header")).toBe(false);
|
|
30
|
+
expect(isCustomStrategy("CUSTOM-header")).toBe(false);
|
|
31
|
+
expect(isCustomStrategy(null)).toBe(false);
|
|
32
|
+
expect(isCustomStrategy(undefined)).toBe(false);
|
|
33
|
+
expect(isCustomStrategy(123)).toBe(false);
|
|
34
|
+
expect(isCustomStrategy({})).toBe(false);
|
|
35
|
+
expect(isCustomStrategy([])).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
test("returns false for built-in strategy names", () => {
|
|
38
|
+
expect(isCustomStrategy("cookie")).toBe(false);
|
|
39
|
+
expect(isCustomStrategy("baseLocale")).toBe(false);
|
|
40
|
+
expect(isCustomStrategy("globalVariable")).toBe(false);
|
|
41
|
+
expect(isCustomStrategy("url")).toBe(false);
|
|
42
|
+
expect(isCustomStrategy("preferredLanguage")).toBe(false);
|
|
43
|
+
expect(isCustomStrategy("localStorage")).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe.each([
|
|
47
|
+
["defineCustomServerStrategy", defineCustomServerStrategy],
|
|
48
|
+
["defineCustomClientStrategy", defineCustomClientStrategy],
|
|
49
|
+
])("%s", (strategyName, defineStrategy) => {
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
// Reset global variables before each test
|
|
52
|
+
if (typeof globalThis !== "undefined") {
|
|
53
|
+
// @ts-expect-error - Testing environment cleanup
|
|
54
|
+
delete globalThis.document;
|
|
55
|
+
// @ts-expect-error - Testing environment cleanup
|
|
56
|
+
delete globalThis.window;
|
|
57
|
+
// @ts-expect-error - Testing environment cleanup
|
|
58
|
+
delete globalThis.localStorage;
|
|
59
|
+
// @ts-expect-error - Testing environment cleanup
|
|
60
|
+
delete globalThis.navigator;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const defaultHandler = { getLocale: () => "en", setLocale: () => { } };
|
|
64
|
+
const invalidInputs = [
|
|
65
|
+
["", "empty name"],
|
|
66
|
+
["@invalid", "names with special characters (@)"],
|
|
67
|
+
["invalid!", "names with special characters (!)"],
|
|
68
|
+
["inva lid", "names with spaces"],
|
|
69
|
+
];
|
|
70
|
+
test.each(invalidInputs)(`${strategyName} throws error for %s (%s)`, (input) => {
|
|
71
|
+
expect(() => defineStrategy(input, defaultHandler)).toThrow(`Invalid custom strategy: "${input}". Must be a custom strategy following the pattern custom-name.`);
|
|
72
|
+
});
|
|
73
|
+
test(`${strategyName} should compile with custom strategies in strategy array`, async () => {
|
|
74
|
+
// Test that compile accepts custom strategies
|
|
75
|
+
const runtime = await createParaglide({
|
|
76
|
+
baseLocale: "en",
|
|
77
|
+
locales: ["en", "de", "fr"],
|
|
78
|
+
strategy: ["custom-auth", "custom-header", "cookie", "baseLocale"],
|
|
79
|
+
cookieName: "PARAGLIDE_LOCALE",
|
|
80
|
+
});
|
|
81
|
+
// Verify the runtime contains the strategy array
|
|
82
|
+
expect(runtime.strategy).toEqual([
|
|
83
|
+
"custom-auth",
|
|
84
|
+
"custom-header",
|
|
85
|
+
"cookie",
|
|
86
|
+
"baseLocale",
|
|
87
|
+
]);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=strategy.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.test.js","sourceRoot":"","sources":["../../../src/compiler/runtime/strategy.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,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rategy,\n\tisCustomStrategy,\n} from \"./strategy.js\";\nimport { createParaglide } from \"../create-paraglide.js\";\n\ndescribe(\"isCustomStrategy\", () => {\n\ttest(\"returns true for valid custom strategy patterns\", () => {\n\t\texpect(isCustomStrategy(\"custom-header\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-auth123\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-API\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-sessionStorage\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-oAuth2\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-a\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-1\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-Z\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-9\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-aZ19\")).toBe(true);\n\t});\n\n\ttest(\"returns false for invalid custom strategy patterns\", () => {\n\t\texpect(isCustomStrategy(\"\")).toBe(false);\n\t\texpect(isCustomStrategy(\"custom_\")).toBe(false);\n\t\texpect(isCustomStrategy(\"custom-\")).toBe(false);\n\t\texpect(isCustomStrategy(\"header\")).toBe(false);\n\t\texpect(isCustomStrategy(\"custom\")).toBe(false);\n\t\t// These are now valid with our relaxed pattern:\n\t\texpect(isCustomStrategy(\"custom-invalid-name\")).toBe(true);\n\t\texpect(isCustomStrategy(\"custom-invalid_name\")).toBe(true);\n\t\t// But spaces and special chars are still invalid:\n\t\texpect(isCustomStrategy(\"custom-invalid name\")).toBe(false);\n\t\texpect(isCustomStrategy(\"custom-invalid@\")).toBe(false);\n\t\texpect(isCustomStrategy(\"Custom-header\")).toBe(false);\n\t\texpect(isCustomStrategy(\"CUSTOM-header\")).toBe(false);\n\t\texpect(isCustomStrategy(null)).toBe(false);\n\t\texpect(isCustomStrategy(undefined)).toBe(false);\n\t\texpect(isCustomStrategy(123)).toBe(false);\n\t\texpect(isCustomStrategy({})).toBe(false);\n\t\texpect(isCustomStrategy([])).toBe(false);\n\t});\n\n\ttest(\"returns false for built-in strategy names\", () => {\n\t\texpect(isCustomStrategy(\"cookie\")).toBe(false);\n\t\texpect(isCustomStrategy(\"baseLocale\")).toBe(false);\n\t\texpect(isCustomStrategy(\"globalVariable\")).toBe(false);\n\t\texpect(isCustomStrategy(\"url\")).toBe(false);\n\t\texpect(isCustomStrategy(\"preferredLanguage\")).toBe(false);\n\t\texpect(isCustomStrategy(\"localStorage\")).toBe(false);\n\t});\n});\n\ndescribe.each([\n\t[\"defineCustomServerStrategy\", defineCustomServerStrategy],\n\t[\"defineCustomClientStrategy\", defineCustomClientStrategy],\n])(\"%s\", (strategyName, defineStrategy) => {\n\tbeforeEach(() => {\n\t\t// Reset global variables before each test\n\t\tif (typeof globalThis !== \"undefined\") {\n\t\t\t// @ts-expect-error - Testing environment cleanup\n\t\t\tdelete globalThis.document;\n\t\t\t// @ts-expect-error - Testing environment cleanup\n\t\t\tdelete globalThis.window;\n\t\t\t// @ts-expect-error - Testing environment cleanup\n\t\t\tdelete globalThis.localStorage;\n\t\t\t// @ts-expect-error - Testing environment cleanup\n\t\t\tdelete globalThis.navigator;\n\t\t}\n\t});\n\n\tconst defaultHandler = { getLocale: () => \"en\", setLocale: () => {} };\n\n\tconst invalidInputs = [\n\t\t[\"\", \"empty name\"],\n\t\t[\"@invalid\", \"names with special characters (@)\"],\n\t\t[\"invalid!\", \"names with special characters (!)\"],\n\t\t[\"inva lid\", \"names with spaces\"],\n\t];\n\n\ttest.each(invalidInputs)(\n\t\t`${strategyName} throws error for %s (%s)`,\n\t\t(input) => {\n\t\t\texpect(() => defineStrategy(input, defaultHandler)).toThrow(\n\t\t\t\t`Invalid custom strategy: \"${input}\". Must be a custom strategy following the pattern custom-name.`\n\t\t\t);\n\t\t}\n\t);\n\n\ttest(`${strategyName} should compile with custom strategies in strategy array`, async () => {\n\t\t// Test that compile accepts custom strategies\n\t\tconst runtime = await createParaglide({\n\t\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t\t\tstrategy: [\"custom-auth\", \"custom-header\", \"cookie\", \"baseLocale\"],\n\t\t\tcookieName: \"PARAGLIDE_LOCALE\",\n\t\t});\n\n\t\t// Verify the runtime contains the strategy array\n\t\texpect(runtime.strategy).toEqual([\n\t\t\t\"custom-auth\",\n\t\t\t\"custom-header\",\n\t\t\t\"cookie\",\n\t\t\t\"baseLocale\",\n\t\t]);\n\t});\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-message-call.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/track-message-call.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAHlC,MAGkC,EAAE,MAAM,EAF1C,MAE0C,QAQpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { serverAsyncLocalStorage, isServer } from "./variables.js";
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} safeModuleId
|
|
4
|
+
* @param {Locale} locale
|
|
5
|
+
*/
|
|
6
|
+
export function trackMessageCall(safeModuleId, locale) {
|
|
7
|
+
if (isServer === false)
|
|
8
|
+
return;
|
|
9
|
+
const store = serverAsyncLocalStorage?.getStore();
|
|
10
|
+
if (store) {
|
|
11
|
+
store.messageCalls?.add(`${safeModuleId}:${locale}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=track-message-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-message-call.js","sourceRoot":"","sources":["../../../src/compiler/runtime/track-message-call.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAY,EAAE,MAAM;IACpD,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO;IAE/B,MAAM,KAAK,GAAG,uBAAuB,EAAE,QAAQ,EAAE,CAAC;IAElD,IAAI,KAAK,EAAE,CAAC;QACX,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,YAAY,IAAI,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;AACF,CAAC","sourcesContent":["import { serverAsyncLocalStorage, isServer } from \"./variables.js\";\n\n/**\n * @param {string} safeModuleId\n * @param {Locale} locale\n */\nexport function trackMessageCall(safeModuleId, locale) {\n\tif (isServer === false) return;\n\n\tconst store = serverAsyncLocalStorage?.getStore();\n\n\tif (store) {\n\t\tstore.messageCalls?.add(`${safeModuleId}:${locale}`);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-message-call.test.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/track-message-call.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { createParaglide } from "../create-paraglide.js";
|
|
3
|
+
import { test, expect } from "vitest";
|
|
4
|
+
test("tracks message calls", async () => {
|
|
5
|
+
const runtime = await createParaglide({
|
|
6
|
+
baseLocale: "en",
|
|
7
|
+
locales: ["en", "de"],
|
|
8
|
+
});
|
|
9
|
+
const mockMessage = (str) => {
|
|
10
|
+
runtime.trackMessageCall(str, "de");
|
|
11
|
+
};
|
|
12
|
+
runtime.overwriteServerAsyncLocalStorage(new AsyncLocalStorage());
|
|
13
|
+
const messageCalls = new Set();
|
|
14
|
+
const result = runtime.serverAsyncLocalStorage?.run({ messageCalls }, () => {
|
|
15
|
+
mockMessage("test1");
|
|
16
|
+
mockMessage("test2");
|
|
17
|
+
return "test3";
|
|
18
|
+
});
|
|
19
|
+
expect(result).toBe("test3");
|
|
20
|
+
expect(messageCalls).toEqual(new Set(["test1:de", "test2:de"]));
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=track-message-call.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-message-call.test.js","sourceRoot":"","sources":["../../../src/compiler/runtime/track-message-call.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEtC,IAAI,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;IACvC,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC;QACrC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;KACrB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;QACnC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,OAAO,CAAC,gCAAgC,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;IAElE,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IAEvC,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE;QAC1E,WAAW,CAAC,OAAO,CAAC,CAAC;QACrB,WAAW,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,OAAO,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { createParaglide } from \"../create-paraglide.js\";\nimport { test, expect } from \"vitest\";\n\ntest(\"tracks message calls\", async () => {\n\tconst runtime = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\"],\n\t});\n\n\tconst mockMessage = (str: string) => {\n\t\truntime.trackMessageCall(str, \"de\");\n\t};\n\n\truntime.overwriteServerAsyncLocalStorage(new AsyncLocalStorage());\n\n\tconst messageCalls = new Set<string>();\n\n\tconst result = runtime.serverAsyncLocalStorage?.run({ messageCalls }, () => {\n\t\tmockMessage(\"test1\");\n\t\tmockMessage(\"test2\");\n\t\treturn \"test3\";\n\t});\n\n\texpect(result).toBe(\"test3\");\n\texpect(messageCalls).toEqual(new Set([\"test1:de\", \"test2:de\"]));\n});\n"]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
export type Locale = string;
|
|
2
|
+
export type LocalizedString = string & {
|
|
3
|
+
readonly __brand: 'LocalizedString';
|
|
4
|
+
};
|
|
5
|
+
export type MessageMarkupOption = {
|
|
6
|
+
name: string;
|
|
7
|
+
value: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type MessageMarkupAttribute = {
|
|
10
|
+
name: string;
|
|
11
|
+
value: string | true;
|
|
12
|
+
};
|
|
13
|
+
export type MessageMarkupOptions = Record<string, unknown>;
|
|
14
|
+
export type MessageMarkupAttributes = Record<string, string | true>;
|
|
15
|
+
export type MessageMarkupTag = {
|
|
16
|
+
options: MessageMarkupOptions;
|
|
17
|
+
attributes: MessageMarkupAttributes;
|
|
18
|
+
children: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type MessageMarkupSchema = Record<string, MessageMarkupTag>;
|
|
21
|
+
export type MessageMetadata<Inputs, Options, Markup extends MessageMarkupSchema = MessageMarkupSchema> = {
|
|
22
|
+
readonly __paraglide?: {
|
|
23
|
+
inputs: Inputs;
|
|
24
|
+
options: Options;
|
|
25
|
+
markup: Markup;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type MessagePart = {
|
|
29
|
+
type: "text";
|
|
30
|
+
value: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: "markup-start";
|
|
33
|
+
name: string;
|
|
34
|
+
options: MessageMarkupOptions;
|
|
35
|
+
attributes: MessageMarkupAttributes;
|
|
36
|
+
} | {
|
|
37
|
+
type: "markup-end";
|
|
38
|
+
name: string;
|
|
39
|
+
options: MessageMarkupOptions;
|
|
40
|
+
attributes: MessageMarkupAttributes;
|
|
41
|
+
} | {
|
|
42
|
+
type: "markup-standalone";
|
|
43
|
+
name: string;
|
|
44
|
+
options: MessageMarkupOptions;
|
|
45
|
+
attributes: MessageMarkupAttributes;
|
|
46
|
+
};
|
|
47
|
+
export type MessageFunction = (inputs?: Record<string, never>) => LocalizedString;
|
|
48
|
+
export type MessageBundleFunction<T extends string> = (params: Record<string, never>, options: {
|
|
49
|
+
locale: T;
|
|
50
|
+
}) => LocalizedString;
|
|
51
|
+
/**
|
|
52
|
+
* A locale that is available in the project.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* setLocale(request.locale as Locale)
|
|
56
|
+
*
|
|
57
|
+
* @typedef {string} Locale
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* A branded type representing a localized string.
|
|
61
|
+
*
|
|
62
|
+
* Message functions return this type instead of \`string\`, enabling TypeScript
|
|
63
|
+
* to distinguish translated strings from regular strings at compile time.
|
|
64
|
+
* This allows you to enforce that only properly localized content is used
|
|
65
|
+
* in your UI components.
|
|
66
|
+
*
|
|
67
|
+
* Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
|
|
68
|
+
* backward compatible—you can pass it anywhere a \`string\` is expected.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Enforce localized strings in your components
|
|
72
|
+
* function PageTitle(props: { title: LocalizedString }) {
|
|
73
|
+
* return <h1>{props.title}</h1>
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* // ✅ Correct: using a message function
|
|
77
|
+
* <PageTitle title={m.welcome_title()} />
|
|
78
|
+
*
|
|
79
|
+
* // ❌ Type error: raw strings are not LocalizedString
|
|
80
|
+
* <PageTitle title="Welcome" />
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* // LocalizedString is assignable to string (backward compatible)
|
|
84
|
+
* const localized: LocalizedString = m.greeting()
|
|
85
|
+
* const str: string = localized // ✅ works fine
|
|
86
|
+
*
|
|
87
|
+
* // But string is not assignable to LocalizedString
|
|
88
|
+
* const raw: LocalizedString = "Hello" // ❌ Type error
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Catches accidental string concatenation
|
|
92
|
+
* function showMessage(msg: LocalizedString) { ... }
|
|
93
|
+
*
|
|
94
|
+
* showMessage(m.hello()) // ✅
|
|
95
|
+
* showMessage("Hello " + userName) // ❌ Type error
|
|
96
|
+
* showMessage(m.hello_user({ name: userName })) // ✅ use params instead
|
|
97
|
+
*
|
|
98
|
+
* @typedef {string & { readonly __brand: 'LocalizedString' }} LocalizedString
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* A single markup option passed to a tag instance.
|
|
102
|
+
*
|
|
103
|
+
* @typedef {{
|
|
104
|
+
* name: string;
|
|
105
|
+
* value: unknown;
|
|
106
|
+
* }} MessageMarkupOption
|
|
107
|
+
*/
|
|
108
|
+
/**
|
|
109
|
+
* A single static markup attribute attached to a tag instance.
|
|
110
|
+
*
|
|
111
|
+
* @typedef {{
|
|
112
|
+
* name: string;
|
|
113
|
+
* value: string | true;
|
|
114
|
+
* }} MessageMarkupAttribute
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* Record of markup options for a tag instance.
|
|
118
|
+
*
|
|
119
|
+
* @typedef {Record<string, unknown>} MessageMarkupOptions
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Record of markup attributes for a tag instance.
|
|
123
|
+
*
|
|
124
|
+
* @typedef {Record<string, string | true>} MessageMarkupAttributes
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* Type-level schema for a single markup tag.
|
|
128
|
+
*
|
|
129
|
+
* @typedef {{
|
|
130
|
+
* options: MessageMarkupOptions;
|
|
131
|
+
* attributes: MessageMarkupAttributes;
|
|
132
|
+
* children: boolean;
|
|
133
|
+
* }} MessageMarkupTag
|
|
134
|
+
*/
|
|
135
|
+
/**
|
|
136
|
+
* Type-level schema for all markup tags in a message.
|
|
137
|
+
*
|
|
138
|
+
* @typedef {Record<string, MessageMarkupTag>} MessageMarkupSchema
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Type-only metadata attached to compiled message functions.
|
|
142
|
+
*
|
|
143
|
+
* @template Inputs
|
|
144
|
+
* @template Options
|
|
145
|
+
* @template {MessageMarkupSchema} [Markup = MessageMarkupSchema]
|
|
146
|
+
* @typedef {{
|
|
147
|
+
* readonly __paraglide?: {
|
|
148
|
+
* inputs: Inputs;
|
|
149
|
+
* options: Options;
|
|
150
|
+
* markup: Markup;
|
|
151
|
+
* };
|
|
152
|
+
* }} MessageMetadata
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* A compiled, framework-neutral message part.
|
|
156
|
+
*
|
|
157
|
+
* @typedef {{
|
|
158
|
+
* type: "text";
|
|
159
|
+
* value: string;
|
|
160
|
+
* } | {
|
|
161
|
+
* type: "markup-start";
|
|
162
|
+
* name: string;
|
|
163
|
+
* options: MessageMarkupOptions;
|
|
164
|
+
* attributes: MessageMarkupAttributes;
|
|
165
|
+
* } | {
|
|
166
|
+
* type: "markup-end";
|
|
167
|
+
* name: string;
|
|
168
|
+
* options: MessageMarkupOptions;
|
|
169
|
+
* attributes: MessageMarkupAttributes;
|
|
170
|
+
* } | {
|
|
171
|
+
* type: "markup-standalone";
|
|
172
|
+
* name: string;
|
|
173
|
+
* options: MessageMarkupOptions;
|
|
174
|
+
* attributes: MessageMarkupAttributes;
|
|
175
|
+
* }} MessagePart
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* A message function is a message for a specific locale.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* m.hello({ name: 'world' })
|
|
182
|
+
*
|
|
183
|
+
* @typedef {(inputs?: Record<string, never>) => LocalizedString} MessageFunction
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* A message bundle function that selects the message to be returned.
|
|
187
|
+
*
|
|
188
|
+
* Uses `getLocale()` under the hood to determine the locale with an option.
|
|
189
|
+
*
|
|
190
|
+
* @template {string} T
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* import { m } from './messages.js'
|
|
194
|
+
* m.hello({ name: 'world' }, { locale: "en" })
|
|
195
|
+
*
|
|
196
|
+
* @typedef {(params: Record<string, never>, options: { locale: T }) => LocalizedString} MessageBundleFunction
|
|
197
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-definitions.d.ts","sourceRoot":"","sources":["../../../src/compiler/runtime/type-definitions.js"],"names":[],"mappings":"AAQG,YAAkB,MAAM,GAAd,MAAM,CAAQ;AA0CxB,YAA4D,eAAe,GAAjE,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,CAAiB;AAM3E,YAGG,mBAAmB,GAHZ;IACR,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAqB;AAMtB,YAGG,sBAAsB,GAHf;IACR,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAwB;AAMzB,YAAmC,oBAAoB,GAA7C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAsB;AAMvD,YAAyC,uBAAuB,GAAtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAyB;AAMhE,YAIG,gBAAgB,GAJT;IACR,OAAO,EAAE,oBAAoB,CAAC;IAC9B,UAAU,EAAE,uBAAuB,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;CACnB,C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AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// ------ TYPES ------
|
|
2
|
+
export {};
|
|
3
|
+
/**
|
|
4
|
+
* A locale that is available in the project.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* setLocale(request.locale as Locale)
|
|
8
|
+
*
|
|
9
|
+
* @typedef {string} Locale
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A branded type representing a localized string.
|
|
13
|
+
*
|
|
14
|
+
* Message functions return this type instead of \`string\`, enabling TypeScript
|
|
15
|
+
* to distinguish translated strings from regular strings at compile time.
|
|
16
|
+
* This allows you to enforce that only properly localized content is used
|
|
17
|
+
* in your UI components.
|
|
18
|
+
*
|
|
19
|
+
* Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
|
|
20
|
+
* backward compatible—you can pass it anywhere a \`string\` is expected.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Enforce localized strings in your components
|
|
24
|
+
* function PageTitle(props: { title: LocalizedString }) {
|
|
25
|
+
* return <h1>{props.title}</h1>
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // ✅ Correct: using a message function
|
|
29
|
+
* <PageTitle title={m.welcome_title()} />
|
|
30
|
+
*
|
|
31
|
+
* // ❌ Type error: raw strings are not LocalizedString
|
|
32
|
+
* <PageTitle title="Welcome" />
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // LocalizedString is assignable to string (backward compatible)
|
|
36
|
+
* const localized: LocalizedString = m.greeting()
|
|
37
|
+
* const str: string = localized // ✅ works fine
|
|
38
|
+
*
|
|
39
|
+
* // But string is not assignable to LocalizedString
|
|
40
|
+
* const raw: LocalizedString = "Hello" // ❌ Type error
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Catches accidental string concatenation
|
|
44
|
+
* function showMessage(msg: LocalizedString) { ... }
|
|
45
|
+
*
|
|
46
|
+
* showMessage(m.hello()) // ✅
|
|
47
|
+
* showMessage("Hello " + userName) // ❌ Type error
|
|
48
|
+
* showMessage(m.hello_user({ name: userName })) // ✅ use params instead
|
|
49
|
+
*
|
|
50
|
+
* @typedef {string & { readonly __brand: 'LocalizedString' }} LocalizedString
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* A single markup option passed to a tag instance.
|
|
54
|
+
*
|
|
55
|
+
* @typedef {{
|
|
56
|
+
* name: string;
|
|
57
|
+
* value: unknown;
|
|
58
|
+
* }} MessageMarkupOption
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* A single static markup attribute attached to a tag instance.
|
|
62
|
+
*
|
|
63
|
+
* @typedef {{
|
|
64
|
+
* name: string;
|
|
65
|
+
* value: string | true;
|
|
66
|
+
* }} MessageMarkupAttribute
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
* Record of markup options for a tag instance.
|
|
70
|
+
*
|
|
71
|
+
* @typedef {Record<string, unknown>} MessageMarkupOptions
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Record of markup attributes for a tag instance.
|
|
75
|
+
*
|
|
76
|
+
* @typedef {Record<string, string | true>} MessageMarkupAttributes
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* Type-level schema for a single markup tag.
|
|
80
|
+
*
|
|
81
|
+
* @typedef {{
|
|
82
|
+
* options: MessageMarkupOptions;
|
|
83
|
+
* attributes: MessageMarkupAttributes;
|
|
84
|
+
* children: boolean;
|
|
85
|
+
* }} MessageMarkupTag
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Type-level schema for all markup tags in a message.
|
|
89
|
+
*
|
|
90
|
+
* @typedef {Record<string, MessageMarkupTag>} MessageMarkupSchema
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* Type-only metadata attached to compiled message functions.
|
|
94
|
+
*
|
|
95
|
+
* @template Inputs
|
|
96
|
+
* @template Options
|
|
97
|
+
* @template {MessageMarkupSchema} [Markup = MessageMarkupSchema]
|
|
98
|
+
* @typedef {{
|
|
99
|
+
* readonly __paraglide?: {
|
|
100
|
+
* inputs: Inputs;
|
|
101
|
+
* options: Options;
|
|
102
|
+
* markup: Markup;
|
|
103
|
+
* };
|
|
104
|
+
* }} MessageMetadata
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* A compiled, framework-neutral message part.
|
|
108
|
+
*
|
|
109
|
+
* @typedef {{
|
|
110
|
+
* type: "text";
|
|
111
|
+
* value: string;
|
|
112
|
+
* } | {
|
|
113
|
+
* type: "markup-start";
|
|
114
|
+
* name: string;
|
|
115
|
+
* options: MessageMarkupOptions;
|
|
116
|
+
* attributes: MessageMarkupAttributes;
|
|
117
|
+
* } | {
|
|
118
|
+
* type: "markup-end";
|
|
119
|
+
* name: string;
|
|
120
|
+
* options: MessageMarkupOptions;
|
|
121
|
+
* attributes: MessageMarkupAttributes;
|
|
122
|
+
* } | {
|
|
123
|
+
* type: "markup-standalone";
|
|
124
|
+
* name: string;
|
|
125
|
+
* options: MessageMarkupOptions;
|
|
126
|
+
* attributes: MessageMarkupAttributes;
|
|
127
|
+
* }} MessagePart
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* A message function is a message for a specific locale.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* m.hello({ name: 'world' })
|
|
134
|
+
*
|
|
135
|
+
* @typedef {(inputs?: Record<string, never>) => LocalizedString} MessageFunction
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
* A message bundle function that selects the message to be returned.
|
|
139
|
+
*
|
|
140
|
+
* Uses `getLocale()` under the hood to determine the locale with an option.
|
|
141
|
+
*
|
|
142
|
+
* @template {string} T
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* import { m } from './messages.js'
|
|
146
|
+
* m.hello({ name: 'world' }, { locale: "en" })
|
|
147
|
+
*
|
|
148
|
+
* @typedef {(params: Record<string, never>, options: { locale: T }) => LocalizedString} MessageBundleFunction
|
|
149
|
+
*/
|
|
150
|
+
//# sourceMappingURL=type-definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-definitions.js","sourceRoot":"","sources":["../../../src/compiler/runtime/type-definitions.js"],"names":[],"mappings":"AAAA,sBAAsB;;AAEtB;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;GAYG","sourcesContent":["// ------ TYPES ------\n\n/**\n * A locale that is available in the project.\n *\n * @example\n * setLocale(request.locale as Locale)\n *\n * @typedef {string} Locale\n */\n\n/**\n * A branded type representing a localized string.\n *\n * Message functions return this type instead of \\`string\\`, enabling TypeScript\n * to distinguish translated strings from regular strings at compile time.\n * This allows you to enforce that only properly localized content is used\n * in your UI components.\n *\n * Since \\`LocalizedString\\` is a branded subtype of \\`string\\`, it remains fully\n * backward compatible—you can pass it anywhere a \\`string\\` is expected.\n *\n * @example\n * // Enforce localized strings in your components\n * function PageTitle(props: { title: LocalizedString }) {\n * return <h1>{props.title}</h1>\n * }\n *\n * // ✅ Correct: using a message function\n * <PageTitle title={m.welcome_title()} />\n *\n * // ❌ Type error: raw strings are not LocalizedString\n * <PageTitle title=\"Welcome\" />\n *\n * @example\n * // LocalizedString is assignable to string (backward compatible)\n * const localized: LocalizedString = m.greeting()\n * const str: string = localized // ✅ works fine\n *\n * // But string is not assignable to LocalizedString\n * const raw: LocalizedString = \"Hello\" // ❌ Type error\n *\n * @example\n * // Catches accidental string concatenation\n * function showMessage(msg: LocalizedString) { ... }\n *\n * showMessage(m.hello()) // ✅\n * showMessage(\"Hello \" + userName) // ❌ Type error\n * showMessage(m.hello_user({ name: userName })) // ✅ use params instead\n *\n * @typedef {string & { readonly __brand: 'LocalizedString' }} LocalizedString\n */\n\n/**\n * A single markup option passed to a tag instance.\n *\n * @typedef {{\n * name: string;\n * value: unknown;\n * }} MessageMarkupOption\n */\n\n/**\n * A single static markup attribute attached to a tag instance.\n *\n * @typedef {{\n * name: string;\n * value: string | true;\n * }} MessageMarkupAttribute\n */\n\n/**\n * Record of markup options for a tag instance.\n *\n * @typedef {Record<string, unknown>} MessageMarkupOptions\n */\n\n/**\n * Record of markup attributes for a tag instance.\n *\n * @typedef {Record<string, string | true>} MessageMarkupAttributes\n */\n\n/**\n * Type-level schema for a single markup tag.\n *\n * @typedef {{\n * options: MessageMarkupOptions;\n * attributes: MessageMarkupAttributes;\n * children: boolean;\n * }} MessageMarkupTag\n */\n\n/**\n * Type-level schema for all markup tags in a message.\n *\n * @typedef {Record<string, MessageMarkupTag>} MessageMarkupSchema\n */\n\n/**\n * Type-only metadata attached to compiled message functions.\n *\n * @template Inputs\n * @template Options\n * @template {MessageMarkupSchema} [Markup = MessageMarkupSchema]\n * @typedef {{\n * readonly __paraglide?: {\n * inputs: Inputs;\n * options: Options;\n * markup: Markup;\n * };\n * }} MessageMetadata\n */\n\n/**\n * A compiled, framework-neutral message part.\n *\n * @typedef {{\n * type: \"text\";\n * value: string;\n * } | {\n * type: \"markup-start\";\n * name: string;\n * options: MessageMarkupOptions;\n * attributes: MessageMarkupAttributes;\n * } | {\n * type: \"markup-end\";\n * name: string;\n * options: MessageMarkupOptions;\n * attributes: MessageMarkupAttributes;\n * } | {\n * type: \"markup-standalone\";\n * name: string;\n * options: MessageMarkupOptions;\n * attributes: MessageMarkupAttributes;\n * }} MessagePart\n */\n\n/**\n * A message function is a message for a specific locale.\n *\n * @example\n * m.hello({ name: 'world' })\n *\n * @typedef {(inputs?: Record<string, never>) => LocalizedString} MessageFunction\n */\n\n/**\n * A message bundle function that selects the message to be returned.\n *\n * Uses `getLocale()` under the hood to determine the locale with an option.\n *\n * @template {string} T\n *\n * @example\n * import { m } from './messages.js'\n * m.hello({ name: 'world' }, { locale: \"en\" })\n *\n * @typedef {(params: Record<string, never>, options: { locale: T }) => LocalizedString} MessageBundleFunction\n */\n"]}
|