@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,GAItB,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACN,mBAAmB,EACnB,mBAAmB,GAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export {\n\tdefaultCompilerOptions,\n\ttype CompilerOptions,\n\ttype RoutingConfig,\n\ttype HostRoutingRule,\n} from \"./compiler-options.js\";\nexport type {\n\tLocalizedString,\n\tMessagePart,\n\tMessageMarkupAttribute,\n\tMessageMarkupOption,\n\tMessageMarkupAttributes,\n\tMessageMarkupOptions,\n\tMessageMarkupTag,\n\tMessageMarkupSchema,\n\tMessageMetadata,\n\tMessageBundleFunction,\n\tMessageFunction,\n} from \"./types.js\";\nexport type { Runtime } from \"./runtime/type.js\";\nexport type { ServerRuntime } from \"./server/type.js\";\nexport { compile } from \"./compile.js\";\nexport {\n\tfilterOutputForEmit,\n\tbuildVirtualModules,\n\ttype EmitFiles,\n} from \"./emit-files.js\";\nexport { compileProject } from \"./compile-project.js\";\nexport { compileBundle } from \"./compile-bundle.js\";\nexport { compileMessage } from \"./compile-message.js\";\nexport { compilePattern } from \"./compile-pattern.js\";\nexport { writeOutput } from \"../services/file-handling/write-output.js\";\nexport { loadMessages } from \"../messages/load-messages.js\";\nexport { createParaglide } from \"./create-paraglide.js\";\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InputVariable } from "../messages/ast.js";
|
|
2
|
+
export type InputMatchTypes = Map<string, {
|
|
3
|
+
literals: Set<string>;
|
|
4
|
+
hasCatchAll: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function jsDocBundleFunctionTypes(args: {
|
|
7
|
+
inputs: InputVariable[];
|
|
8
|
+
locales: string[];
|
|
9
|
+
matchTypes?: InputMatchTypes;
|
|
10
|
+
inputTypeOverride?: string;
|
|
11
|
+
}): string;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the types for the input variables.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const inputs = [{ name: "age" }]
|
|
17
|
+
* inputsType(inputs)
|
|
18
|
+
* >> "{ age: NonNullable<unknown> }"
|
|
19
|
+
*/
|
|
20
|
+
export declare function inputsType(inputs: InputVariable[], matchTypes?: InputMatchTypes): string;
|
|
21
|
+
export declare function inputTypeForName(name: string, matchTypes?: InputMatchTypes): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdoc-types.d.ts","sourceRoot":"","sources":["../../src/compiler/jsdoc-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,MAAM,eAAe,GAAG,GAAG,CAChC,MAAM,EACN;IAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAC/C,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,aAAa,EAAE,EACvB,UAAU,CAAC,EAAE,eAAe,GAC1B,MAAM,CAuBR;AAmBD,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,eAAe,GAC1B,MAAM,CAER"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { renderInputMatchTypeVariants } from "./match-literals.js";
|
|
2
|
+
import { isValidIdentifier, quotePropertyKey } from "./variable-access.js";
|
|
3
|
+
export function jsDocBundleFunctionTypes(args) {
|
|
4
|
+
const localesUnion = args.locales.map((locale) => `"${locale}"`).join(" | ");
|
|
5
|
+
const inputType = args.inputTypeOverride ?? inputsType(args.inputs, args.matchTypes);
|
|
6
|
+
return `
|
|
7
|
+
* @param {${inputType}} inputs
|
|
8
|
+
* @param {{ locale?: ${localesUnion} }} options
|
|
9
|
+
* @returns {LocalizedString}`;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns the types for the input variables.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const inputs = [{ name: "age" }]
|
|
16
|
+
* inputsType(inputs)
|
|
17
|
+
* >> "{ age: NonNullable<unknown> }"
|
|
18
|
+
*/
|
|
19
|
+
export function inputsType(inputs, matchTypes) {
|
|
20
|
+
if (inputs.length === 0) {
|
|
21
|
+
return "{}";
|
|
22
|
+
}
|
|
23
|
+
// Deduplicate inputs by name to avoid TypeScript errors with duplicate properties in JSDoc
|
|
24
|
+
const uniqueInputMap = new Map();
|
|
25
|
+
for (const input of inputs) {
|
|
26
|
+
uniqueInputMap.set(input.name, input);
|
|
27
|
+
}
|
|
28
|
+
const uniqueInputs = Array.from(uniqueInputMap.values());
|
|
29
|
+
const inputParams = uniqueInputs
|
|
30
|
+
.map((input) => {
|
|
31
|
+
const name = isValidIdentifier(input.name)
|
|
32
|
+
? input.name
|
|
33
|
+
: quotePropertyKey(input.name);
|
|
34
|
+
return `${name}: ${resolveInputType(input.name, matchTypes)}`;
|
|
35
|
+
})
|
|
36
|
+
.join(", ");
|
|
37
|
+
return `{ ${inputParams} }`;
|
|
38
|
+
}
|
|
39
|
+
function resolveInputType(name, matchTypes) {
|
|
40
|
+
if (!matchTypes)
|
|
41
|
+
return "NonNullable<unknown>";
|
|
42
|
+
const info = matchTypes.get(name);
|
|
43
|
+
if (!info)
|
|
44
|
+
return "NonNullable<unknown>";
|
|
45
|
+
if (info.hasCatchAll)
|
|
46
|
+
return "NonNullable<unknown>";
|
|
47
|
+
const literals = Array.from(info.literals);
|
|
48
|
+
if (literals.length === 0)
|
|
49
|
+
return "NonNullable<unknown>";
|
|
50
|
+
literals.sort();
|
|
51
|
+
return literals
|
|
52
|
+
.flatMap((value) => renderInputMatchTypeVariants(value))
|
|
53
|
+
.filter((value, index, values) => values.indexOf(value) === index)
|
|
54
|
+
.join(" | ");
|
|
55
|
+
}
|
|
56
|
+
export function inputTypeForName(name, matchTypes) {
|
|
57
|
+
return resolveInputType(name, matchTypes);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=jsdoc-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdoc-types.js","sourceRoot":"","sources":["../../src/compiler/jsdoc-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,iBA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;IACb,OAAO,KAAK,WAAW,IAAI,CAAC;AAC7B,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,UAA4B;IACnE,IAAI,CAAC,UAAU;QAAE,OAAO,sBAAsB,CAAC;IAE/C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,sBAAsB,CAAC;IACzC,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,sBAAsB,CAAC;IAEpD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,sBAAsB,CAAC;IAEzD,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChB,OAAO,QAAQ;SACb,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;SACvD,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;SACjE,IAAI,CAAC,KAAK,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC/B,IAAY,EACZ,UAA4B;IAE5B,OAAO,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import type { InputVariable } from \"../messages/ast.js\";\nimport { renderInputMatchTypeVariants } from \"./match-literals.js\";\nimport { isValidIdentifier, quotePropertyKey } from \"./variable-access.js\";\n\nexport type InputMatchTypes = Map<\n\tstring,\n\t{ literals: Set<string>; hasCatchAll: boolean }\n>;\n\nexport function jsDocBundleFunctionTypes(args: {\n\tinputs: InputVariable[];\n\tlocales: string[];\n\tmatchTypes?: InputMatchTypes;\n\tinputTypeOverride?: string;\n}): string {\n\tconst localesUnion = args.locales.map((locale) => `\"${locale}\"`).join(\" | \");\n\tconst inputType =\n\t\targs.inputTypeOverride ?? inputsType(args.inputs, args.matchTypes);\n\n\treturn `\n* @param {${inputType}} inputs\n* @param {{ locale?: ${localesUnion} }} options\n* @returns {LocalizedString}`;\n}\n\n/**\n * Returns the types for the input variables.\n *\n * @example\n * const inputs = [{ name: \"age\" }]\n * inputsType(inputs)\n * >> \"{ age: NonNullable<unknown> }\"\n */\nexport function inputsType(\n\tinputs: InputVariable[],\n\tmatchTypes?: InputMatchTypes\n): string {\n\tif (inputs.length === 0) {\n\t\treturn \"{}\";\n\t}\n\n\t// Deduplicate inputs by name to avoid TypeScript errors with duplicate properties in JSDoc\n\tconst uniqueInputMap = new Map<string, InputVariable>();\n\n\tfor (const input of inputs) {\n\t\tuniqueInputMap.set(input.name, input);\n\t}\n\n\tconst uniqueInputs = Array.from(uniqueInputMap.values());\n\n\tconst inputParams = uniqueInputs\n\t\t.map((input) => {\n\t\t\tconst name = isValidIdentifier(input.name)\n\t\t\t\t? input.name\n\t\t\t\t: quotePropertyKey(input.name);\n\t\t\treturn `${name}: ${resolveInputType(input.name, matchTypes)}`;\n\t\t})\n\t\t.join(\", \");\n\treturn `{ ${inputParams} }`;\n}\n\nfunction resolveInputType(name: string, matchTypes?: InputMatchTypes): string {\n\tif (!matchTypes) return \"NonNullable<unknown>\";\n\n\tconst info = matchTypes.get(name);\n\tif (!info) return \"NonNullable<unknown>\";\n\tif (info.hasCatchAll) return \"NonNullable<unknown>\";\n\n\tconst literals = Array.from(info.literals);\n\tif (literals.length === 0) return \"NonNullable<unknown>\";\n\n\tliterals.sort();\n\treturn literals\n\t\t.flatMap((value) => renderInputMatchTypeVariants(value))\n\t\t.filter((value, index, values) => values.indexOf(value) === index)\n\t\t.join(\" | \");\n}\n\nexport function inputTypeForName(\n\tname: string,\n\tmatchTypes?: InputMatchTypes\n): string {\n\treturn resolveInputType(name, matchTypes);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdoc-types.test.d.ts","sourceRoot":"","sources":["../../src/compiler/jsdoc-types.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import { inputsType, jsDocBundleFunctionTypes } from "./jsdoc-types.js";
|
|
3
|
+
test("inputsType generates unique parameter types even when the same input appears multiple times", () => {
|
|
4
|
+
// Simulate a case where the same input appears multiple times (like in a translation with placeholders)
|
|
5
|
+
const inputs = [
|
|
6
|
+
{ name: "days", type: "input-variable" },
|
|
7
|
+
{ name: "days", type: "input-variable" }, // Duplicated input
|
|
8
|
+
];
|
|
9
|
+
// The generated input type should only include each parameter once
|
|
10
|
+
const result = inputsType(inputs);
|
|
11
|
+
expect(result).toBe("{ days: NonNullable<unknown> }");
|
|
12
|
+
// It should not generate a duplicate parameter
|
|
13
|
+
expect(result).not.toBe("{ days: NonNullable<unknown>, days: NonNullable<unknown> }");
|
|
14
|
+
});
|
|
15
|
+
test("inputsType quotes non-identifier input names", () => {
|
|
16
|
+
const inputs = [{ name: "half!", type: "input-variable" }];
|
|
17
|
+
const result = inputsType(inputs);
|
|
18
|
+
expect(result).toBe('{ "half!": NonNullable<unknown> }');
|
|
19
|
+
});
|
|
20
|
+
test("jsDocBundleFunctionTypes correctly handles messages with duplicate inputs", () => {
|
|
21
|
+
const inputs = [
|
|
22
|
+
{ name: "days", type: "input-variable" },
|
|
23
|
+
{ name: "days", type: "input-variable" }, // Duplicated input
|
|
24
|
+
];
|
|
25
|
+
const locales = ["en-us", "de-de"];
|
|
26
|
+
const result = jsDocBundleFunctionTypes({ inputs, locales });
|
|
27
|
+
// The JSDoc should only include each parameter once
|
|
28
|
+
expect(result).toContain("@param {{ days: NonNullable<unknown> }} inputs");
|
|
29
|
+
// It should not contain duplicated parameters
|
|
30
|
+
expect(result).not.toContain("@param {{ days: NonNullable<unknown>, days: NonNullable<unknown> }} inputs");
|
|
31
|
+
});
|
|
32
|
+
test("jsDocBundleFunctionTypes returns LocalizedString type", () => {
|
|
33
|
+
const inputs = [];
|
|
34
|
+
const locales = ["en", "de"];
|
|
35
|
+
const result = jsDocBundleFunctionTypes({ inputs, locales });
|
|
36
|
+
// The JSDoc should specify LocalizedString as the return type
|
|
37
|
+
expect(result).toContain("@returns {LocalizedString}");
|
|
38
|
+
// It should not return plain string
|
|
39
|
+
expect(result).not.toContain("@returns {string}");
|
|
40
|
+
});
|
|
41
|
+
test("inputsType emits literal unions for match values", () => {
|
|
42
|
+
const inputs = [
|
|
43
|
+
{ name: "type", type: "input-variable" },
|
|
44
|
+
{ name: "status", type: "input-variable" },
|
|
45
|
+
];
|
|
46
|
+
const matchTypes = new Map([
|
|
47
|
+
[
|
|
48
|
+
"type",
|
|
49
|
+
{
|
|
50
|
+
literals: new Set(["invalid", "empty", "min_length"]),
|
|
51
|
+
hasCatchAll: false,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
["status", { literals: new Set(["ready", "done"]), hasCatchAll: false }],
|
|
55
|
+
]);
|
|
56
|
+
const result = inputsType(inputs, matchTypes);
|
|
57
|
+
expect(result).toBe('{ type: "empty" | "invalid" | "min_length", status: "done" | "ready" }');
|
|
58
|
+
});
|
|
59
|
+
test("inputsType accepts both number and string forms for numeric match values", () => {
|
|
60
|
+
const inputs = [{ name: "input", type: "input-variable" }];
|
|
61
|
+
const matchTypes = new Map([
|
|
62
|
+
[
|
|
63
|
+
"input",
|
|
64
|
+
{
|
|
65
|
+
literals: new Set(["1", "2"]),
|
|
66
|
+
hasCatchAll: false,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
]);
|
|
70
|
+
const result = inputsType(inputs, matchTypes);
|
|
71
|
+
expect(result).toBe('{ input: 1 | "1" | 2 | "2" }');
|
|
72
|
+
});
|
|
73
|
+
test("inputsType widens infinity match values to number and string forms", () => {
|
|
74
|
+
const inputs = [{ name: "input", type: "input-variable" }];
|
|
75
|
+
const matchTypes = new Map([
|
|
76
|
+
[
|
|
77
|
+
"input",
|
|
78
|
+
{
|
|
79
|
+
literals: new Set(["Infinity", "-Infinity"]),
|
|
80
|
+
hasCatchAll: false,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
]);
|
|
84
|
+
const result = inputsType(inputs, matchTypes);
|
|
85
|
+
expect(result).toBe('{ input: number | "-Infinity" | "Infinity" }');
|
|
86
|
+
});
|
|
87
|
+
test("inputsType falls back to NonNullable<unknown> when catchall exists", () => {
|
|
88
|
+
const inputs = [{ name: "type", type: "input-variable" }];
|
|
89
|
+
const matchTypes = new Map([
|
|
90
|
+
["type", { literals: new Set(["invalid"]), hasCatchAll: true }],
|
|
91
|
+
]);
|
|
92
|
+
const result = inputsType(inputs, matchTypes);
|
|
93
|
+
expect(result).toBe("{ type: NonNullable<unknown> }");
|
|
94
|
+
});
|
|
95
|
+
test("inputsType falls back to NonNullable<unknown> when no match info exists", () => {
|
|
96
|
+
const inputs = [{ name: "type", type: "input-variable" }];
|
|
97
|
+
const result = inputsType(inputs);
|
|
98
|
+
expect(result).toBe("{ type: NonNullable<unknown> }");
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=jsdoc-types.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdoc-types.test.js","sourceRoot":"","sources":["../../src/compiler/jsdoc-types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAGxE,IAAI,CAAC,6FAA6F,EAAE,GAAG,EAAE;IACxG,wGAAwG;IACxG,MAAM,MAAM,GAAoB;QAC/B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE;QACxC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,m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,MAAM,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yEAAyE,EAAE,GAAG,EAAE;IACpF,MAAM,MAAM,GAAoB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAE3E,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from \"vitest\";\nimport { inputsType, jsDocBundleFunctionTypes } from \"./jsdoc-types.js\";\nimport type { InputVariable } from \"../messages/ast.js\";\n\ntest(\"inputsType generates unique parameter types even when the same input appears multiple times\", () => {\n\t// Simulate a case where the same input appears multiple times (like in a translation with placeholders)\n\tconst inputs: InputVariable[] = [\n\t\t{ name: \"days\", type: \"input-variable\" },\n\t\t{ name: \"days\", type: \"input-variable\" }, // Duplicated input\n\t];\n\n\t// The generated input type should only include each parameter once\n\tconst result = inputsType(inputs);\n\texpect(result).toBe(\"{ days: NonNullable<unknown> }\");\n\n\t// It should not generate a duplicate parameter\n\texpect(result).not.toBe(\n\t\t\"{ days: NonNullable<unknown>, days: NonNullable<unknown> }\"\n\t);\n});\n\ntest(\"inputsType quotes non-identifier input names\", () => {\n\tconst inputs: InputVariable[] = [{ name: \"half!\", type: \"input-variable\" }];\n\n\tconst result = inputsType(inputs);\n\n\texpect(result).toBe('{ \"half!\": NonNullable<unknown> }');\n});\n\ntest(\"jsDocBundleFunctionTypes correctly handles messages with duplicate inputs\", () => {\n\tconst inputs: InputVariable[] = [\n\t\t{ name: \"days\", type: \"input-variable\" },\n\t\t{ name: \"days\", type: \"input-variable\" }, // Duplicated input\n\t];\n\n\tconst locales = [\"en-us\", \"de-de\"];\n\n\tconst result = jsDocBundleFunctionTypes({ inputs, locales });\n\n\t// The JSDoc should only include each parameter once\n\texpect(result).toContain(\"@param {{ days: NonNullable<unknown> }} inputs\");\n\n\t// It should not contain duplicated parameters\n\texpect(result).not.toContain(\n\t\t\"@param {{ days: NonNullable<unknown>, days: NonNullable<unknown> }} inputs\"\n\t);\n});\n\ntest(\"jsDocBundleFunctionTypes returns LocalizedString type\", () => {\n\tconst inputs: InputVariable[] = [];\n\tconst locales = [\"en\", \"de\"];\n\n\tconst result = jsDocBundleFunctionTypes({ inputs, locales });\n\n\t// The JSDoc should specify LocalizedString as the return type\n\texpect(result).toContain(\"@returns {LocalizedString}\");\n\n\t// It should not return plain string\n\texpect(result).not.toContain(\"@returns {string}\");\n});\n\ntest(\"inputsType emits literal unions for match values\", () => {\n\tconst inputs: InputVariable[] = [\n\t\t{ name: \"type\", type: \"input-variable\" },\n\t\t{ name: \"status\", type: \"input-variable\" },\n\t];\n\n\tconst matchTypes = new Map([\n\t\t[\n\t\t\t\"type\",\n\t\t\t{\n\t\t\t\tliterals: new Set([\"invalid\", \"empty\", \"min_length\"]),\n\t\t\t\thasCatchAll: false,\n\t\t\t},\n\t\t],\n\t\t[\"status\", { literals: new Set([\"ready\", \"done\"]), hasCatchAll: false }],\n\t]);\n\n\tconst result = inputsType(inputs, matchTypes);\n\n\texpect(result).toBe(\n\t\t'{ type: \"empty\" | \"invalid\" | \"min_length\", status: \"done\" | \"ready\" }'\n\t);\n});\n\ntest(\"inputsType accepts both number and string forms for numeric match values\", () => {\n\tconst inputs: InputVariable[] = [{ name: \"input\", type: \"input-variable\" }];\n\n\tconst matchTypes = new Map([\n\t\t[\n\t\t\t\"input\",\n\t\t\t{\n\t\t\t\tliterals: new Set([\"1\", \"2\"]),\n\t\t\t\thasCatchAll: false,\n\t\t\t},\n\t\t],\n\t]);\n\n\tconst result = inputsType(inputs, matchTypes);\n\n\texpect(result).toBe('{ input: 1 | \"1\" | 2 | \"2\" }');\n});\n\ntest(\"inputsType widens infinity match values to number and string forms\", () => {\n\tconst inputs: InputVariable[] = [{ name: \"input\", type: \"input-variable\" }];\n\n\tconst matchTypes = new Map([\n\t\t[\n\t\t\t\"input\",\n\t\t\t{\n\t\t\t\tliterals: new Set([\"Infinity\", \"-Infinity\"]),\n\t\t\t\thasCatchAll: false,\n\t\t\t},\n\t\t],\n\t]);\n\n\tconst result = inputsType(inputs, matchTypes);\n\n\texpect(result).toBe('{ input: number | \"-Infinity\" | \"Infinity\" }');\n});\n\ntest(\"inputsType falls back to NonNullable<unknown> when catchall exists\", () => {\n\tconst inputs: InputVariable[] = [{ name: \"type\", type: \"input-variable\" }];\n\n\tconst matchTypes = new Map([\n\t\t[\"type\", { literals: new Set([\"invalid\"]), hasCatchAll: true }],\n\t]);\n\n\tconst result = inputsType(inputs, matchTypes);\n\n\texpect(result).toBe(\"{ type: NonNullable<unknown> }\");\n});\n\ntest(\"inputsType falls back to NonNullable<unknown> when no match info exists\", () => {\n\tconst inputs: InputVariable[] = [{ name: \"type\", type: \"input-variable\" }];\n\n\tconst result = inputsType(inputs);\n\n\texpect(result).toBe(\"{ type: NonNullable<unknown> }\");\n});\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Incremental compile cache for lazy-modules watch mode.
|
|
3
|
+
*
|
|
4
|
+
* Tracks locale-file content hashes and per-(locale, key) module hashes so
|
|
5
|
+
* watch updates can re-emit only changed keys.
|
|
6
|
+
*/
|
|
7
|
+
export type CompileCache = {
|
|
8
|
+
localeFileHashes: Record<string, string>;
|
|
9
|
+
moduleHashes: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export declare function emptyCompileCache(): CompileCache;
|
|
12
|
+
export type LocaleKeyDiff = {
|
|
13
|
+
/** Locales whose files are unchanged — skip entirely */
|
|
14
|
+
unchangedLocales: string[];
|
|
15
|
+
/** Locales that need a full key pass */
|
|
16
|
+
changedLocales: string[];
|
|
17
|
+
/** Keys added or updated per locale */
|
|
18
|
+
updatedKeys: Record<string, string[]>;
|
|
19
|
+
/** Keys removed per locale */
|
|
20
|
+
removedKeys: Record<string, string[]>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Diff previous vs current key→content-hash maps for one locale.
|
|
24
|
+
*/
|
|
25
|
+
export declare function diffLocaleKeys(args: {
|
|
26
|
+
locale: string;
|
|
27
|
+
previous: Record<string, string>;
|
|
28
|
+
next: Record<string, string>;
|
|
29
|
+
}): {
|
|
30
|
+
updated: string[];
|
|
31
|
+
removed: string[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Build a module-hash map key.
|
|
35
|
+
*/
|
|
36
|
+
export declare function moduleCacheKey(locale: string, key: string): string;
|
|
37
|
+
//# sourceMappingURL=compile-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-cache.d.ts","sourceRoot":"","sources":["../../../src/compiler/lazy-modules/compile-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD;AAED,MAAM,MAAM,aAAa,GAAG;IAC3B,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,wCAAwC;IACxC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAmB3C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function emptyCompileCache() {
|
|
2
|
+
return {
|
|
3
|
+
localeFileHashes: {},
|
|
4
|
+
moduleHashes: {},
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Diff previous vs current key→content-hash maps for one locale.
|
|
9
|
+
*/
|
|
10
|
+
export function diffLocaleKeys(args) {
|
|
11
|
+
const updated = [];
|
|
12
|
+
const removed = [];
|
|
13
|
+
for (const [key, hash] of Object.entries(args.next)) {
|
|
14
|
+
if (args.previous[key] !== hash) {
|
|
15
|
+
updated.push(key);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
for (const key of Object.keys(args.previous)) {
|
|
19
|
+
if (!(key in args.next)) {
|
|
20
|
+
removed.push(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
updated: updated.sort(),
|
|
25
|
+
removed: removed.sort(),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build a module-hash map key.
|
|
30
|
+
*/
|
|
31
|
+
export function moduleCacheKey(locale, key) {
|
|
32
|
+
return `${locale}:${key}`;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=compile-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-cache.js","sourceRoot":"","sources":["../../../src/compiler/lazy-modules/compile-cache.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,iBAAiB;IAChC,OAAO;QACN,gBAAgB,EAAE,EAAE;QACpB,YAAY,EAAE,EAAE;KAChB,CAAC;AACH,CAAC;AAaD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAI9B;IACA,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9C,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IAED,OAAO;QACN,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;QACvB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;KACvB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,GAAW;IACzD,OAAO,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-project.lazy.test.d.ts","sourceRoot":"","sources":["../../../src/compiler/lazy-modules/compile-project.lazy.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import { compileProject } from "../compile-project.js";
|
|
3
|
+
import { createBundleNested } from "../test-helpers.js";
|
|
4
|
+
const bundles = [
|
|
5
|
+
createBundleNested({
|
|
6
|
+
id: "hello",
|
|
7
|
+
messages: [
|
|
8
|
+
{
|
|
9
|
+
locale: "en",
|
|
10
|
+
variants: [{ pattern: [{ type: "text", value: "Hello" }] }],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
locale: "de",
|
|
14
|
+
variants: [{ pattern: [{ type: "text", value: "Hallo" }] }],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
}),
|
|
18
|
+
createBundleNested({
|
|
19
|
+
id: "only_en",
|
|
20
|
+
messages: [
|
|
21
|
+
{
|
|
22
|
+
locale: "en",
|
|
23
|
+
variants: [{ pattern: [{ type: "text", value: "English only" }] }],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
}),
|
|
27
|
+
];
|
|
28
|
+
test("compileProject lazy-modules emits per-locale modules and duplicates fallbacks", async () => {
|
|
29
|
+
const output = await compileProject({
|
|
30
|
+
bundles,
|
|
31
|
+
settings: { locales: ["en", "de"], baseLocale: "en" },
|
|
32
|
+
compilerOptions: {
|
|
33
|
+
outputStructure: "lazy-modules",
|
|
34
|
+
emitGitIgnore: false,
|
|
35
|
+
emitPrettierIgnore: false,
|
|
36
|
+
emitReadme: false,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
expect(output["messages/en/hello.js"]).toContain("Hello");
|
|
40
|
+
expect(output["messages/de/hello.js"]).toContain("Hallo");
|
|
41
|
+
expect(output["messages/de/only_en.js"]).toContain("English only");
|
|
42
|
+
expect(output["messages/de/only_en.js"]).not.toMatch(/from ['"]/);
|
|
43
|
+
expect(output["messages.js"]).toContain("prefetchMessages");
|
|
44
|
+
expect(output["loader.js"]).toContain("export const m");
|
|
45
|
+
const manifest = JSON.parse(output["manifest.json"]);
|
|
46
|
+
expect(manifest.messages.hello?.en?.module).toBe("messages/en/hello.js");
|
|
47
|
+
expect(manifest.catalogHash).toBeTruthy();
|
|
48
|
+
});
|
|
49
|
+
test("compileProject lazy-modules hash is stable across identical compiles", async () => {
|
|
50
|
+
const opts = {
|
|
51
|
+
bundles,
|
|
52
|
+
settings: { locales: ["en", "de"], baseLocale: "en" },
|
|
53
|
+
compilerOptions: {
|
|
54
|
+
outputStructure: "lazy-modules",
|
|
55
|
+
emitGitIgnore: false,
|
|
56
|
+
emitPrettierIgnore: false,
|
|
57
|
+
emitReadme: false,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
const a = await compileProject(opts);
|
|
61
|
+
const b = await compileProject(opts);
|
|
62
|
+
expect(a["manifest.json"]).toBe(b["manifest.json"]);
|
|
63
|
+
expect(a["messages/en/hello.js"]).toBe(b["messages/en/hello.js"]);
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=compile-project.lazy.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-project.lazy.test.js","sourceRoot":"","sources":["../../../src/compiler/lazy-modules/compile-project.lazy.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,OAAO,GAAG;IACf,kBAAkB,CAAC;QAClB,EAAE,EAAE,OAAO;QACX,QAAQ,EAAE;YACT;gBACC,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;aAC3D;YACD;gBACC,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;aAC3D;SACD;KACD,CAAC;IACF,kBAAkB,CAAC;QAClB,EAAE,EAAE,SAAS;QACb,QAAQ,EAAE;YACT;gBACC,MAAM,EAAE,IAAI;gBAC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AC;IACzE,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,sEAAsE,EAAE,KAAK,IAAI,EAAE;IACvF,MAAM,IAAI,GAAG;QACZ,OAAO;QACP,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAa,EAAE,UAAU,EAAE,IAAI,EAAE;QACjE,eAAe,EAAE;YAChB,eAAe,EAAE,cAAuB;YACxC,aAAa,EAAE,KAAK;YACpB,kBAAkB,EAAE,KAAK;YACzB,UAAU,EAAE,KAAK;SACjB;KACD,CAAC;IAEF,MAAM,CAAC,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAErC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LazyMessageManifest } from "./manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* Generates the runtime loader that backs `m` for lazy-modules output.
|
|
4
|
+
*
|
|
5
|
+
* Message modules must be prefetched (SSR / modulepreload) before first
|
|
6
|
+
* synchronous `m.foo()` call. Dynamic `import()` loads per-(locale, key)
|
|
7
|
+
* modules; Vite turns those into normal immutable chunks.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createLoaderFile(args: {
|
|
10
|
+
manifest: LazyMessageManifest;
|
|
11
|
+
/**
|
|
12
|
+
* How the loader resolves a module for dynamic import.
|
|
13
|
+
* - `"relative"` — `import("./" + modulePath)` (disk / CLI output)
|
|
14
|
+
* - `"virtual"` — `import("virtual:paraglide/" + modulePath)` (Vite plugin)
|
|
15
|
+
*/
|
|
16
|
+
importStyle?: "relative" | "virtual";
|
|
17
|
+
}): string;
|
|
18
|
+
//# sourceMappingURL=create-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-loader.d.ts","sourceRoot":"","sources":["../../../src/compiler/lazy-modules/create-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACtC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC,GAAG,MAAM,CA4JT"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { quotePropertyKey } from "../variable-access.js";
|
|
2
|
+
/**
|
|
3
|
+
* Generates the runtime loader that backs `m` for lazy-modules output.
|
|
4
|
+
*
|
|
5
|
+
* Message modules must be prefetched (SSR / modulepreload) before first
|
|
6
|
+
* synchronous `m.foo()` call. Dynamic `import()` loads per-(locale, key)
|
|
7
|
+
* modules; Vite turns those into normal immutable chunks.
|
|
8
|
+
*/
|
|
9
|
+
export function createLoaderFile(args) {
|
|
10
|
+
const importStyle = args.importStyle ?? "relative";
|
|
11
|
+
const importerMap = buildImporterMap(args.manifest, importStyle);
|
|
12
|
+
const runtimeSpecifier = importStyle === "virtual" ? "virtual:paraglide/runtime.js" : "./runtime.js";
|
|
13
|
+
return `import { getLocale } from ${JSON.stringify(runtimeSpecifier)};
|
|
14
|
+
|
|
15
|
+
/** @typedef {import(${JSON.stringify(runtimeSpecifier)}).LocalizedString} LocalizedString */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {(inputs?: Record<string, unknown>, options?: { locale?: string }) => LocalizedString} MessageFn
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** @type {Map<string, MessageFn>} */
|
|
22
|
+
const moduleCache = new Map();
|
|
23
|
+
|
|
24
|
+
/** @type {Map<string, Promise<MessageFn>>} */
|
|
25
|
+
const inflight = new Map();
|
|
26
|
+
|
|
27
|
+
${importerMap}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} locale
|
|
31
|
+
* @param {string} key
|
|
32
|
+
*/
|
|
33
|
+
function cacheKey(locale, key) {
|
|
34
|
+
return locale + ':' + key;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {string} locale
|
|
39
|
+
* @param {string} key
|
|
40
|
+
* @returns {(() => Promise<{ default: MessageFn }>) | undefined}
|
|
41
|
+
*/
|
|
42
|
+
function getImporter(locale, key) {
|
|
43
|
+
const byLocale = messageImporters[key];
|
|
44
|
+
if (!byLocale) return undefined;
|
|
45
|
+
return byLocale[locale];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Load and cache a single message module.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} locale
|
|
52
|
+
* @param {string} key
|
|
53
|
+
* @returns {Promise<MessageFn | undefined>}
|
|
54
|
+
*/
|
|
55
|
+
export async function loadMessageModule(locale, key) {
|
|
56
|
+
const id = cacheKey(locale, key);
|
|
57
|
+
const cached = moduleCache.get(id);
|
|
58
|
+
if (cached) return cached;
|
|
59
|
+
|
|
60
|
+
const pending = inflight.get(id);
|
|
61
|
+
if (pending) return pending;
|
|
62
|
+
|
|
63
|
+
const importer = getImporter(locale, key);
|
|
64
|
+
if (!importer) return undefined;
|
|
65
|
+
|
|
66
|
+
const promise = importer()
|
|
67
|
+
.then((mod) => {
|
|
68
|
+
const fn = mod.default;
|
|
69
|
+
moduleCache.set(id, fn);
|
|
70
|
+
inflight.delete(id);
|
|
71
|
+
return fn;
|
|
72
|
+
})
|
|
73
|
+
.catch((error) => {
|
|
74
|
+
inflight.delete(id);
|
|
75
|
+
throw error;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
inflight.set(id, promise);
|
|
79
|
+
return promise;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Prefetch message modules so subsequent \`m.key()\` calls are synchronous.
|
|
84
|
+
*
|
|
85
|
+
* Call from SSR (or a client loader) before rendering.
|
|
86
|
+
*
|
|
87
|
+
* @param {{ locale: string, keys: string[] }} args
|
|
88
|
+
*/
|
|
89
|
+
export async function prefetchMessages(args) {
|
|
90
|
+
await Promise.all(
|
|
91
|
+
args.keys.map((key) => loadMessageModule(args.locale, key))
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @param {string} key
|
|
97
|
+
* @returns {MessageFn}
|
|
98
|
+
*/
|
|
99
|
+
function createMessageFn(key) {
|
|
100
|
+
/** @type {MessageFn} */
|
|
101
|
+
const fn = (inputs = {}, options = {}) => {
|
|
102
|
+
const locale = options.locale ?? getLocale();
|
|
103
|
+
const id = cacheKey(locale, key);
|
|
104
|
+
const loaded = moduleCache.get(id);
|
|
105
|
+
if (!loaded) {
|
|
106
|
+
const hint =
|
|
107
|
+
typeof process !== 'undefined' &&
|
|
108
|
+
process.env &&
|
|
109
|
+
process.env.NODE_ENV !== 'production'
|
|
110
|
+
? \` Call prefetchMessages({ locale: "\${locale}", keys: ["\${key}"] }) before render, or ensure SSR/modulepreload ran.\`
|
|
111
|
+
: '';
|
|
112
|
+
throw new Error(
|
|
113
|
+
\`[paraglide] Message "\${key}" for locale "\${locale}" was not prefetched.\${hint}\`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return loaded(inputs);
|
|
117
|
+
};
|
|
118
|
+
return fn;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** @type {Map<string | symbol, MessageFn>} */
|
|
122
|
+
const fnCache = new Map();
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Lazy message accessor. Keys resolve on property access; bodies load via
|
|
126
|
+
* \`prefetchMessages\` / dynamic \`import()\`.
|
|
127
|
+
*
|
|
128
|
+
* @type {Record<string, MessageFn>}
|
|
129
|
+
*/
|
|
130
|
+
export const m = new Proxy(
|
|
131
|
+
{},
|
|
132
|
+
{
|
|
133
|
+
get(_target, prop) {
|
|
134
|
+
if (typeof prop !== 'string' || prop === 'then') {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
let fn = fnCache.get(prop);
|
|
138
|
+
if (!fn) {
|
|
139
|
+
fn = createMessageFn(prop);
|
|
140
|
+
fnCache.set(prop, fn);
|
|
141
|
+
}
|
|
142
|
+
return fn;
|
|
143
|
+
},
|
|
144
|
+
has(_target, prop) {
|
|
145
|
+
return typeof prop === 'string' && prop in messageImporters;
|
|
146
|
+
},
|
|
147
|
+
ownKeys() {
|
|
148
|
+
return Object.keys(messageImporters);
|
|
149
|
+
},
|
|
150
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
151
|
+
if (typeof prop === 'string' && prop in messageImporters) {
|
|
152
|
+
return {
|
|
153
|
+
configurable: true,
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: () => createMessageFn(prop),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
},
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
`;
|
|
163
|
+
}
|
|
164
|
+
function buildImporterMap(manifest, importStyle) {
|
|
165
|
+
const lines = [
|
|
166
|
+
"/** @type {Record<string, Record<string, () => Promise<{ default: MessageFn }>>>} */",
|
|
167
|
+
"const messageImporters = {",
|
|
168
|
+
];
|
|
169
|
+
for (const [key, locales] of Object.entries(manifest.messages)) {
|
|
170
|
+
lines.push(`\t${quotePropertyKey(key)}: {`);
|
|
171
|
+
for (const [locale, entry] of Object.entries(locales)) {
|
|
172
|
+
const specifier = importStyle === "virtual"
|
|
173
|
+
? `virtual:paraglide/${entry.module}`
|
|
174
|
+
: `./${entry.module}`;
|
|
175
|
+
lines.push(`\t\t${quotePropertyKey(locale)}: () => import(${JSON.stringify(specifier)}),`);
|
|
176
|
+
}
|
|
177
|
+
lines.push("\t},");
|
|
178
|
+
}
|
|
179
|
+
lines.push("};");
|
|
180
|
+
return lines.join("\n");
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=create-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-loader.js","sourceRoot":"","sources":["../../../src/compiler/lazy-modules/create-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAQhC;IACA,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,UAAU,CAAC;IACnD,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjE,MAAM,gBAAgB,GACrB,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,cAAc,CAAC;IAE7E,OAAO,6BAA6B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;;uBAE9C,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;;;EAYrD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIZ,CAAC;AACF,CAAC;AAED,SAAS,gBAAgB,CACxB,QAA6B,EAC7B,WAAmC;IAEnC,MAAM,KAAK,GAAa;QACvB,sFAAsF;QACtF,4BAA4B;KAC5B,CAAC;IAEF,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChE,KA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