@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,353 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import { execFile } from "node:child_process";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { resolveTscJsPath } from "./resolve-tsc-js-path.js";
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
const missingTypeScriptMessage = `Paraglide's "emitTsDeclarations" option requires the "typescript" package.
|
|
9
|
+
|
|
10
|
+
Install TypeScript in your project, or disable "emitTsDeclarations".`;
|
|
11
|
+
const failedToLoadTypeScriptMessage = `Paraglide's "emitTsDeclarations" option requires the "typescript" package.
|
|
12
|
+
|
|
13
|
+
TypeScript appears to be installed, but failed to load. See the error cause for details.`;
|
|
14
|
+
/**
|
|
15
|
+
* Generates `.d.ts` files for the compiled Paraglide output using the TypeScript compiler.
|
|
16
|
+
*
|
|
17
|
+
* @param output - The generated compiler output keyed by relative file path.
|
|
18
|
+
* @returns The generated declaration files keyed by relative path.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const declarations = await emitTsDeclarations(output);
|
|
22
|
+
* // Merge them into the compiler output before writing to disk
|
|
23
|
+
*/
|
|
24
|
+
export async function emitTsDeclarations(output) {
|
|
25
|
+
const ts = await importTypeScript();
|
|
26
|
+
const jsEntries = Object.entries(output).filter(([fileName]) => fileName.endsWith(".js"));
|
|
27
|
+
if (jsEntries.length === 0) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
// TypeScript 7+ (the Go-based compiler) no longer ships the in-process
|
|
31
|
+
// compiler API — its main entry point only exports version metadata.
|
|
32
|
+
// https://github.com/opral/paraglide-js/issues/711
|
|
33
|
+
const compilerApi = resolveCompilerApi(ts);
|
|
34
|
+
if (compilerApi === undefined) {
|
|
35
|
+
return emitWithTscCli(jsEntries);
|
|
36
|
+
}
|
|
37
|
+
return emitWithCompilerApi(compilerApi, jsEntries);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns the in-process compiler API (TypeScript 5/6), or `undefined` when
|
|
41
|
+
* the installed TypeScript does not provide one (TypeScript 7+).
|
|
42
|
+
*
|
|
43
|
+
* Unwraps default-only interop shapes (`{ default: ts }`) that bundlers and
|
|
44
|
+
* CJS interop can produce. Without the unwrap, TypeScript 5/6 would be
|
|
45
|
+
* misrouted to the CLI path, whose TypeScript 5 declaration emitter produces
|
|
46
|
+
* syntactically invalid quoted export aliases.
|
|
47
|
+
*/
|
|
48
|
+
function resolveCompilerApi(ts) {
|
|
49
|
+
if (typeof ts.createProgram === "function") {
|
|
50
|
+
return ts;
|
|
51
|
+
}
|
|
52
|
+
const defaultExport = ts.default;
|
|
53
|
+
if (defaultExport && typeof defaultExport.createProgram === "function") {
|
|
54
|
+
return defaultExport;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Emits declarations with the in-process TypeScript compiler API (TypeScript 5/6).
|
|
60
|
+
*/
|
|
61
|
+
async function emitWithCompilerApi(ts, jsEntries) {
|
|
62
|
+
const virtualRoot = path.join(process.cwd(), "__paraglide_virtual_output");
|
|
63
|
+
const normalizeFileName = (fileName) => path.normalize(path.isAbsolute(fileName) ? fileName : path.join(virtualRoot, fileName));
|
|
64
|
+
const files = new Map(jsEntries.map(([fileName, content]) => [
|
|
65
|
+
normalizeFileName(fileName),
|
|
66
|
+
content,
|
|
67
|
+
]));
|
|
68
|
+
const quotedExportAliases = collectQuotedExportAliases(ts, files);
|
|
69
|
+
const virtualDirectories = new Set(Array.from(files.keys()).flatMap((filePath) => {
|
|
70
|
+
const directories = [];
|
|
71
|
+
let current = path.dirname(filePath);
|
|
72
|
+
while (current.startsWith(virtualRoot) && current !== virtualRoot) {
|
|
73
|
+
directories.push(current);
|
|
74
|
+
const parent = path.dirname(current);
|
|
75
|
+
if (parent === current)
|
|
76
|
+
break;
|
|
77
|
+
current = parent;
|
|
78
|
+
}
|
|
79
|
+
return directories;
|
|
80
|
+
}));
|
|
81
|
+
// Ensure the virtual root itself is treated as existing
|
|
82
|
+
virtualDirectories.add(virtualRoot);
|
|
83
|
+
const compilerOptions = {
|
|
84
|
+
allowJs: true,
|
|
85
|
+
checkJs: true,
|
|
86
|
+
declaration: true,
|
|
87
|
+
emitDeclarationOnly: true,
|
|
88
|
+
isolatedDeclarations: true,
|
|
89
|
+
esModuleInterop: true,
|
|
90
|
+
lib: ["ESNext", "DOM"],
|
|
91
|
+
module: ts.ModuleKind.ESNext,
|
|
92
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
93
|
+
noEmitOnError: false,
|
|
94
|
+
outDir: virtualRoot,
|
|
95
|
+
rootDir: virtualRoot,
|
|
96
|
+
skipLibCheck: true,
|
|
97
|
+
target: ts.ScriptTarget.ESNext,
|
|
98
|
+
};
|
|
99
|
+
const defaultHost = ts.createCompilerHost(compilerOptions, true);
|
|
100
|
+
const declarations = {};
|
|
101
|
+
const host = {
|
|
102
|
+
...defaultHost,
|
|
103
|
+
fileExists: (fileName) => {
|
|
104
|
+
const normalized = normalizeFileName(fileName);
|
|
105
|
+
return files.has(normalized) || defaultHost.fileExists(fileName);
|
|
106
|
+
},
|
|
107
|
+
directoryExists: (directoryName) => {
|
|
108
|
+
const normalized = normalizeFileName(directoryName);
|
|
109
|
+
return (virtualDirectories.has(normalized) ||
|
|
110
|
+
defaultHost.directoryExists?.(directoryName) === true);
|
|
111
|
+
},
|
|
112
|
+
getDirectories: (directoryName) => {
|
|
113
|
+
const normalized = normalizeFileName(directoryName);
|
|
114
|
+
const children = Array.from(virtualDirectories).filter((dir) => path.dirname(dir) === normalized);
|
|
115
|
+
return [
|
|
116
|
+
...(defaultHost.getDirectories?.(directoryName) ?? []),
|
|
117
|
+
...children.map((dir) => path.basename(dir)),
|
|
118
|
+
];
|
|
119
|
+
},
|
|
120
|
+
readFile: (fileName) => {
|
|
121
|
+
const normalized = normalizeFileName(fileName);
|
|
122
|
+
return files.get(normalized) ?? defaultHost.readFile(fileName);
|
|
123
|
+
},
|
|
124
|
+
getSourceFile: (fileName, languageVersion, onError, shouldCreateNewFile) => {
|
|
125
|
+
const normalized = normalizeFileName(fileName);
|
|
126
|
+
const sourceText = files.get(normalized);
|
|
127
|
+
if (sourceText !== undefined) {
|
|
128
|
+
return ts.createSourceFile(fileName, sourceText, languageVersion, true);
|
|
129
|
+
}
|
|
130
|
+
return defaultHost.getSourceFile(fileName, languageVersion, onError, shouldCreateNewFile);
|
|
131
|
+
},
|
|
132
|
+
writeFile: (fileName, text) => {
|
|
133
|
+
const relativePath = path
|
|
134
|
+
.relative(virtualRoot, fileName)
|
|
135
|
+
.split(path.sep)
|
|
136
|
+
.join(path.posix.sep);
|
|
137
|
+
if (!relativePath.startsWith("..")) {
|
|
138
|
+
declarations[relativePath] = text;
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
const program = ts.createProgram(Array.from(files.keys()), compilerOptions, host);
|
|
143
|
+
program.emit(undefined, undefined, undefined, true, {
|
|
144
|
+
afterDeclarations: [
|
|
145
|
+
createQuotedExportAliasTransformer(ts, quotedExportAliases, normalizeFileName),
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
return declarations;
|
|
149
|
+
}
|
|
150
|
+
const failedToEmitWithTscMessage = `Paraglide's "emitTsDeclarations" option failed to generate declaration files with the installed TypeScript version.
|
|
151
|
+
|
|
152
|
+
TypeScript 7+ no longer provides the in-process compiler API, so Paraglide invokes its "tsc" CLI instead — which did not produce a declaration file for every compiled file. As a workaround, install TypeScript 5 or 6, or disable "emitTsDeclarations".`;
|
|
153
|
+
/**
|
|
154
|
+
* Emits declarations by invoking the `tsc` CLI of the installed TypeScript
|
|
155
|
+
* package (TypeScript 7+, where the in-process compiler API is unavailable).
|
|
156
|
+
*
|
|
157
|
+
* The compiled output is written to a temporary directory because the
|
|
158
|
+
* Go-based compiler cannot read from a virtual filesystem.
|
|
159
|
+
*/
|
|
160
|
+
async function emitWithTscCli(jsEntries) {
|
|
161
|
+
// entries escaping the output root cannot be declared safely; the
|
|
162
|
+
// compiler-API path silently drops them too (see the writeFile hook).
|
|
163
|
+
// Checked against both separator conventions because path.join interprets
|
|
164
|
+
// backslashes on Windows (`foo\..\..\x.js` would escape the temp dir).
|
|
165
|
+
const safeEntries = jsEntries.filter(([fileName]) => [path.posix, path.win32].every((platformPath) => {
|
|
166
|
+
const normalized = platformPath.normalize(fileName);
|
|
167
|
+
return (normalized.startsWith("..") === false &&
|
|
168
|
+
platformPath.isAbsolute(normalized) === false);
|
|
169
|
+
}));
|
|
170
|
+
// resolved before spawning so a missing tsc entry point surfaces its own
|
|
171
|
+
// pointed error instead of the generic "no declaration files" one
|
|
172
|
+
const tscJsPath = resolveTscJsPath();
|
|
173
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "paraglide-dts-"));
|
|
174
|
+
try {
|
|
175
|
+
const srcDir = path.join(tempDir, "src");
|
|
176
|
+
const outDir = path.join(tempDir, "dist");
|
|
177
|
+
await fs.mkdir(outDir, { recursive: true });
|
|
178
|
+
for (const [fileName, content] of safeEntries) {
|
|
179
|
+
const filePath = path.join(srcDir, fileName);
|
|
180
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
181
|
+
await fs.writeFile(filePath, content);
|
|
182
|
+
}
|
|
183
|
+
const tsconfigPath = path.join(tempDir, "tsconfig.json");
|
|
184
|
+
await fs.writeFile(tsconfigPath, JSON.stringify({
|
|
185
|
+
compilerOptions: {
|
|
186
|
+
allowJs: true,
|
|
187
|
+
checkJs: true,
|
|
188
|
+
declaration: true,
|
|
189
|
+
emitDeclarationOnly: true,
|
|
190
|
+
esModuleInterop: true,
|
|
191
|
+
lib: ["ESNext", "DOM"],
|
|
192
|
+
module: "ESNext",
|
|
193
|
+
moduleResolution: "bundler",
|
|
194
|
+
// Declaration emit does not need a typecheck; skipping it also
|
|
195
|
+
// suppresses diagnostics about the project's environment (e.g.
|
|
196
|
+
// a missing @types/node) that are irrelevant to the output.
|
|
197
|
+
noCheck: true,
|
|
198
|
+
noEmitOnError: false,
|
|
199
|
+
outDir: "./dist",
|
|
200
|
+
rootDir: "./src",
|
|
201
|
+
skipLibCheck: true,
|
|
202
|
+
target: "ESNext",
|
|
203
|
+
},
|
|
204
|
+
files: safeEntries.map(([fileName]) => `./src/${fileName}`),
|
|
205
|
+
}));
|
|
206
|
+
let tscError;
|
|
207
|
+
try {
|
|
208
|
+
await execFileAsync(process.execPath, [tscJsPath, "--project", tsconfigPath], {
|
|
209
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
210
|
+
// Electron-based hosts must execute tsc with their embedded
|
|
211
|
+
// Node instead of launching another instance of the host app.
|
|
212
|
+
// Harmless under node and bun.
|
|
213
|
+
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
// tsc exits non-zero when the input has diagnostics even though the
|
|
218
|
+
// declaration files are still emitted (noEmitOnError is false).
|
|
219
|
+
// Success is judged by the presence of declaration files below.
|
|
220
|
+
tscError = error;
|
|
221
|
+
}
|
|
222
|
+
const declarations = {};
|
|
223
|
+
for (const entry of await fs.readdir(outDir, { recursive: true })) {
|
|
224
|
+
if (entry.endsWith(".d.ts")) {
|
|
225
|
+
declarations[entry.split(path.sep).join(path.posix.sep)] =
|
|
226
|
+
await fs.readFile(path.join(outDir, entry), "utf-8");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// tsc emits exactly one .d.ts per input .js (even for inputs with
|
|
230
|
+
// syntax errors), so a count mismatch means the compiler died mid-emit
|
|
231
|
+
// and the result would be silently incomplete.
|
|
232
|
+
if (Object.keys(declarations).length !== safeEntries.length) {
|
|
233
|
+
throw new Error(withTscOutput(failedToEmitWithTscMessage, tscError), {
|
|
234
|
+
cause: tscError,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return declarations;
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Appends the spawned compiler's output to the error message.
|
|
245
|
+
*
|
|
246
|
+
* tsc writes diagnostics to stdout, which `execFile` errors expose only as a
|
|
247
|
+
* property — not in the message — so error reporters that print only
|
|
248
|
+
* message/stack would otherwise hide the reason the emit failed.
|
|
249
|
+
*/
|
|
250
|
+
function withTscOutput(message, tscError) {
|
|
251
|
+
const { stdout, stderr } = (tscError ?? {});
|
|
252
|
+
const output = [stdout, stderr]
|
|
253
|
+
.filter((value) => typeof value === "string")
|
|
254
|
+
.join("\n")
|
|
255
|
+
.trim();
|
|
256
|
+
if (output === "") {
|
|
257
|
+
return message;
|
|
258
|
+
}
|
|
259
|
+
const truncated = output.length > 4000 ? output.slice(0, 4000) + "\n… (truncated)" : output;
|
|
260
|
+
return `${message}\n\nCompiler output:\n${truncated}`;
|
|
261
|
+
}
|
|
262
|
+
function collectQuotedExportAliases(ts, files) {
|
|
263
|
+
const aliases = new Map();
|
|
264
|
+
for (const [fileName, content] of files) {
|
|
265
|
+
const sourceFile = ts.createSourceFile(fileName, content, ts.ScriptTarget.ESNext, true, ts.ScriptKind.JS);
|
|
266
|
+
const fileAliases = new Map();
|
|
267
|
+
const visit = (node) => {
|
|
268
|
+
if (ts.isExportDeclaration(node) &&
|
|
269
|
+
node.exportClause &&
|
|
270
|
+
ts.isNamedExports(node.exportClause)) {
|
|
271
|
+
for (const specifier of node.exportClause.elements) {
|
|
272
|
+
if (ts.isStringLiteral(specifier.name)) {
|
|
273
|
+
const localName = moduleExportNameText(specifier.propertyName ?? specifier.name);
|
|
274
|
+
const exportedName = specifier.name.text;
|
|
275
|
+
const localAliases = fileAliases.get(localName) ?? new Set();
|
|
276
|
+
localAliases.add(exportedName);
|
|
277
|
+
fileAliases.set(localName, localAliases);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
ts.forEachChild(node, visit);
|
|
282
|
+
};
|
|
283
|
+
visit(sourceFile);
|
|
284
|
+
if (fileAliases.size > 0) {
|
|
285
|
+
aliases.set(fileName, fileAliases);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return aliases;
|
|
289
|
+
}
|
|
290
|
+
function createQuotedExportAliasTransformer(ts, quotedExportAliases, normalizeFileName) {
|
|
291
|
+
return (context) => {
|
|
292
|
+
const visitSourceFile = (sourceFile) => {
|
|
293
|
+
const fileAliases = quotedExportAliases.get(normalizeFileName(sourceFile.fileName));
|
|
294
|
+
if (!fileAliases) {
|
|
295
|
+
return sourceFile;
|
|
296
|
+
}
|
|
297
|
+
const visit = (node) => {
|
|
298
|
+
if (ts.isExportDeclaration(node) &&
|
|
299
|
+
node.exportClause &&
|
|
300
|
+
ts.isNamedExports(node.exportClause)) {
|
|
301
|
+
const elements = [];
|
|
302
|
+
const emitted = new Set();
|
|
303
|
+
for (const specifier of node.exportClause.elements) {
|
|
304
|
+
const localName = moduleExportNameText(specifier.propertyName ?? specifier.name);
|
|
305
|
+
const exportedName = moduleExportNameText(specifier.name);
|
|
306
|
+
const shouldQuote = fileAliases.get(localName)?.has(exportedName);
|
|
307
|
+
const nextSpecifier = shouldQuote
|
|
308
|
+
? ts.factory.updateExportSpecifier(specifier, specifier.isTypeOnly, specifier.propertyName, ts.factory.createStringLiteral(exportedName))
|
|
309
|
+
: specifier;
|
|
310
|
+
const emittedKey = `${moduleExportNameText(nextSpecifier.propertyName ?? nextSpecifier.name)}\0${moduleExportNameText(nextSpecifier.name)}`;
|
|
311
|
+
if (!emitted.has(emittedKey)) {
|
|
312
|
+
elements.push(nextSpecifier);
|
|
313
|
+
emitted.add(emittedKey);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.updateNamedExports(node.exportClause, elements), node.moduleSpecifier, node.attributes);
|
|
317
|
+
}
|
|
318
|
+
return ts.visitEachChild(node, visit, context);
|
|
319
|
+
};
|
|
320
|
+
return ts.visitEachChild(sourceFile, visit, context);
|
|
321
|
+
};
|
|
322
|
+
return (sourceFileOrBundle) => {
|
|
323
|
+
if ("fileName" in sourceFileOrBundle) {
|
|
324
|
+
return visitSourceFile(sourceFileOrBundle);
|
|
325
|
+
}
|
|
326
|
+
return sourceFileOrBundle;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function moduleExportNameText(name) {
|
|
331
|
+
return name.text;
|
|
332
|
+
}
|
|
333
|
+
async function importTypeScript() {
|
|
334
|
+
try {
|
|
335
|
+
return await import("typescript");
|
|
336
|
+
}
|
|
337
|
+
catch (cause) {
|
|
338
|
+
if (isMissingTypeScriptPackageError(cause)) {
|
|
339
|
+
throw new Error(missingTypeScriptMessage);
|
|
340
|
+
}
|
|
341
|
+
throw new Error(failedToLoadTypeScriptMessage, { cause });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function isMissingTypeScriptPackageError(cause) {
|
|
345
|
+
if (cause instanceof Error === false) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
if ("code" in cause && cause.code !== "ERR_MODULE_NOT_FOUND") {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
return cause.message.includes("Cannot find package 'typescript'");
|
|
352
|
+
}
|
|
353
|
+
//# sourceMappingURL=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B,CAAC;QAC3B,CAAC,CAAC;IACH,CAAC,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,IAA2C;IACxE,OAAO,IAAI,CAAC,IAAI,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,gBAAgB;IAC9B,IAAI,CAAC;QACJ,OAAO,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,+BAA+B,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;AACF,CAAC;AAED,SAAS,+BAA+B,CAAC,KAAc;IACtD,IAAI,KAAK,YAAY,KAAK,KAAK,KAAK,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import path from \"node:path\";\nimport fs from \"node:fs/promises\";\nimport os from \"node:os\";\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { resolveTscJsPath } from \"./resolve-tsc-js-path.js\";\n\nconst execFileAsync = promisify(execFile);\n\ntype TypeScript = typeof import(\"typescript\");\n\nconst missingTypeScriptMessage = `Paraglide's \"emitTsDeclarations\" option requires the \"typescript\" package.\n\nInstall TypeScript in your project, or disable \"emitTsDeclarations\".`;\n\nconst failedToLoadTypeScriptMessage = `Paraglide's \"emitTsDeclarations\" option requires the \"typescript\" package.\n\nTypeScript appears to be installed, but failed to load. See the error cause for details.`;\n\n/**\n * Generates `.d.ts` files for the compiled Paraglide output using the TypeScript compiler.\n *\n * @param output - The generated compiler output keyed by relative file path.\n * @returns The generated declaration files keyed by relative path.\n *\n * @example\n * const declarations = await emitTsDeclarations(output);\n * // Merge them into the compiler output before writing to disk\n */\nexport async function emitTsDeclarations(\n\toutput: Record<string, string>\n): Promise<Record<string, string>> {\n\tconst ts = await importTypeScript();\n\n\tconst jsEntries = Object.entries(output).filter(([fileName]) =>\n\t\tfileName.endsWith(\".js\")\n\t);\n\n\tif (jsEntries.length === 0) {\n\t\treturn {};\n\t}\n\n\t// TypeScript 7+ (the Go-based compiler) no longer ships the in-process\n\t// compiler API — its main entry point only exports version metadata.\n\t// https://github.com/opral/paraglide-js/issues/711\n\tconst compilerApi = resolveCompilerApi(ts);\n\tif (compilerApi === undefined) {\n\t\treturn emitWithTscCli(jsEntries);\n\t}\n\n\treturn emitWithCompilerApi(compilerApi, jsEntries);\n}\n\n/**\n * Returns the in-process compiler API (TypeScript 5/6), or `undefined` when\n * the installed TypeScript does not provide one (TypeScript 7+).\n *\n * Unwraps default-only interop shapes (`{ default: ts }`) that bundlers and\n * CJS interop can produce. Without the unwrap, TypeScript 5/6 would be\n * misrouted to the CLI path, whose TypeScript 5 declaration emitter produces\n * syntactically invalid quoted export aliases.\n */\nfunction resolveCompilerApi(ts: TypeScript): TypeScript | undefined {\n\tif (typeof ts.createProgram === \"function\") {\n\t\treturn ts;\n\t}\n\tconst defaultExport = (ts as { default?: TypeScript }).default;\n\tif (defaultExport && typeof defaultExport.createProgram === \"function\") {\n\t\treturn defaultExport;\n\t}\n\treturn undefined;\n}\n\n/**\n * Emits declarations with the in-process TypeScript compiler API (TypeScript 5/6).\n */\nasync function emitWithCompilerApi(\n\tts: TypeScript,\n\tjsEntries: [string, string][]\n): Promise<Record<string, string>> {\n\tconst virtualRoot = path.join(process.cwd(), \"__paraglide_virtual_output\");\n\tconst normalizeFileName = (fileName: string) =>\n\t\tpath.normalize(\n\t\t\tpath.isAbsolute(fileName) ? fileName : path.join(virtualRoot, fileName)\n\t\t);\n\n\tconst files = new Map(\n\t\tjsEntries.map(([fileName, content]) => [\n\t\t\tnormalizeFileName(fileName),\n\t\t\tcontent,\n\t\t])\n\t);\n\tconst quotedExportAliases = collectQuotedExportAliases(ts, files);\n\n\tconst virtualDirectories = new Set(\n\t\tArray.from(files.keys()).flatMap((filePath) => {\n\t\t\tconst directories: string[] = [];\n\t\t\tlet current = path.dirname(filePath);\n\t\t\twhile (current.startsWith(virtualRoot) && current !== virtualRoot) {\n\t\t\t\tdirectories.push(current);\n\t\t\t\tconst parent = path.dirname(current);\n\t\t\t\tif (parent === current) break;\n\t\t\t\tcurrent = parent;\n\t\t\t}\n\t\t\treturn directories;\n\t\t})\n\t);\n\t// Ensure the virtual root itself is treated as existing\n\tvirtualDirectories.add(virtualRoot);\n\n\tconst compilerOptions: import(\"typescript\").CompilerOptions = {\n\t\tallowJs: true,\n\t\tcheckJs: true,\n\t\tdeclaration: true,\n\t\temitDeclarationOnly: true,\n\t\tisolatedDeclarations: true,\n\t\tesModuleInterop: true,\n\t\tlib: [\"ESNext\", \"DOM\"],\n\t\tmodule: ts.ModuleKind.ESNext,\n\t\tmoduleResolution: ts.ModuleResolutionKind.Bundler,\n\t\tnoEmitOnError: false,\n\t\toutDir: virtualRoot,\n\t\trootDir: virtualRoot,\n\t\tskipLibCheck: true,\n\t\ttarget: ts.ScriptTarget.ESNext,\n\t};\n\n\tconst defaultHost = ts.createCompilerHost(compilerOptions, true);\n\tconst declarations: Record<string, string> = {};\n\n\tconst host: import(\"typescript\").CompilerHost = {\n\t\t...defaultHost,\n\t\tfileExists: (fileName) => {\n\t\t\tconst normalized = normalizeFileName(fileName);\n\t\t\treturn files.has(normalized) || defaultHost.fileExists(fileName);\n\t\t},\n\t\tdirectoryExists: (directoryName) => {\n\t\t\tconst normalized = normalizeFileName(directoryName);\n\t\t\treturn (\n\t\t\t\tvirtualDirectories.has(normalized) ||\n\t\t\t\tdefaultHost.directoryExists?.(directoryName) === true\n\t\t\t);\n\t\t},\n\t\tgetDirectories: (directoryName) => {\n\t\t\tconst normalized = normalizeFileName(directoryName);\n\t\t\tconst children = Array.from(virtualDirectories).filter(\n\t\t\t\t(dir) => path.dirname(dir) === normalized\n\t\t\t);\n\t\t\treturn [\n\t\t\t\t...(defaultHost.getDirectories?.(directoryName) ?? []),\n\t\t\t\t...children.map((dir) => path.basename(dir)),\n\t\t\t];\n\t\t},\n\t\treadFile: (fileName) => {\n\t\t\tconst normalized = normalizeFileName(fileName);\n\t\t\treturn files.get(normalized) ?? defaultHost.readFile(fileName);\n\t\t},\n\t\tgetSourceFile: (\n\t\t\tfileName,\n\t\t\tlanguageVersion,\n\t\t\tonError,\n\t\t\tshouldCreateNewFile\n\t\t) => {\n\t\t\tconst normalized = normalizeFileName(fileName);\n\t\t\tconst sourceText = files.get(normalized);\n\t\t\tif (sourceText !== undefined) {\n\t\t\t\treturn ts.createSourceFile(fileName, sourceText, languageVersion, true);\n\t\t\t}\n\t\t\treturn defaultHost.getSourceFile(\n\t\t\t\tfileName,\n\t\t\t\tlanguageVersion,\n\t\t\t\tonError,\n\t\t\t\tshouldCreateNewFile\n\t\t\t);\n\t\t},\n\t\twriteFile: (fileName, text) => {\n\t\t\tconst relativePath = path\n\t\t\t\t.relative(virtualRoot, fileName)\n\t\t\t\t.split(path.sep)\n\t\t\t\t.join(path.posix.sep);\n\n\t\t\tif (!relativePath.startsWith(\"..\")) {\n\t\t\t\tdeclarations[relativePath] = text;\n\t\t\t}\n\t\t},\n\t};\n\n\tconst program = ts.createProgram(\n\t\tArray.from(files.keys()),\n\t\tcompilerOptions,\n\t\thost\n\t);\n\n\tprogram.emit(undefined, undefined, undefined, true, {\n\t\tafterDeclarations: [\n\t\t\tcreateQuotedExportAliasTransformer(\n\t\t\t\tts,\n\t\t\t\tquotedExportAliases,\n\t\t\t\tnormalizeFileName\n\t\t\t),\n\t\t],\n\t});\n\n\treturn declarations;\n}\n\nconst failedToEmitWithTscMessage = `Paraglide's \"emitTsDeclarations\" option failed to generate declaration files with the installed TypeScript version.\n\nTypeScript 7+ no longer provides the in-process compiler API, so Paraglide invokes its \"tsc\" CLI instead — which did not produce a declaration file for every compiled file. As a workaround, install TypeScript 5 or 6, or disable \"emitTsDeclarations\".`;\n\n/**\n * Emits declarations by invoking the `tsc` CLI of the installed TypeScript\n * package (TypeScript 7+, where the in-process compiler API is unavailable).\n *\n * The compiled output is written to a temporary directory because the\n * Go-based compiler cannot read from a virtual filesystem.\n */\nasync function emitWithTscCli(\n\tjsEntries: [string, string][]\n): Promise<Record<string, string>> {\n\t// entries escaping the output root cannot be declared safely; the\n\t// compiler-API path silently drops them too (see the writeFile hook).\n\t// Checked against both separator conventions because path.join interprets\n\t// backslashes on Windows (`foo\\..\\..\\x.js` would escape the temp dir).\n\tconst safeEntries = jsEntries.filter(([fileName]) =>\n\t\t[path.posix, path.win32].every((platformPath) => {\n\t\t\tconst normalized = platformPath.normalize(fileName);\n\t\t\treturn (\n\t\t\t\tnormalized.startsWith(\"..\") === false &&\n\t\t\t\tplatformPath.isAbsolute(normalized) === false\n\t\t\t);\n\t\t})\n\t);\n\n\t// resolved before spawning so a missing tsc entry point surfaces its own\n\t// pointed error instead of the generic \"no declaration files\" one\n\tconst tscJsPath = resolveTscJsPath();\n\n\tconst tempDir = await fs.mkdtemp(path.join(os.tmpdir(), \"paraglide-dts-\"));\n\n\ttry {\n\t\tconst srcDir = path.join(tempDir, \"src\");\n\t\tconst outDir = path.join(tempDir, \"dist\");\n\t\tawait fs.mkdir(outDir, { recursive: true });\n\n\t\tfor (const [fileName, content] of safeEntries) {\n\t\t\tconst filePath = path.join(srcDir, fileName);\n\t\t\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\t\t\tawait fs.writeFile(filePath, content);\n\t\t}\n\n\t\tconst tsconfigPath = path.join(tempDir, \"tsconfig.json\");\n\t\tawait fs.writeFile(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify({\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\tallowJs: true,\n\t\t\t\t\tcheckJs: true,\n\t\t\t\t\tdeclaration: true,\n\t\t\t\t\temitDeclarationOnly: true,\n\t\t\t\t\tesModuleInterop: true,\n\t\t\t\t\tlib: [\"ESNext\", \"DOM\"],\n\t\t\t\t\tmodule: \"ESNext\",\n\t\t\t\t\tmoduleResolution: \"bundler\",\n\t\t\t\t\t// Declaration emit does not need a typecheck; skipping it also\n\t\t\t\t\t// suppresses diagnostics about the project's environment (e.g.\n\t\t\t\t\t// a missing @types/node) that are irrelevant to the output.\n\t\t\t\t\tnoCheck: true,\n\t\t\t\t\tnoEmitOnError: false,\n\t\t\t\t\toutDir: \"./dist\",\n\t\t\t\t\trootDir: \"./src\",\n\t\t\t\t\tskipLibCheck: true,\n\t\t\t\t\ttarget: \"ESNext\",\n\t\t\t\t},\n\t\t\t\tfiles: safeEntries.map(([fileName]) => `./src/${fileName}`),\n\t\t\t})\n\t\t);\n\n\t\tlet tscError: unknown;\n\t\ttry {\n\t\t\tawait execFileAsync(\n\t\t\t\tprocess.execPath,\n\t\t\t\t[tscJsPath, \"--project\", tsconfigPath],\n\t\t\t\t{\n\t\t\t\t\tmaxBuffer: 64 * 1024 * 1024,\n\t\t\t\t\t// Electron-based hosts must execute tsc with their embedded\n\t\t\t\t\t// Node instead of launching another instance of the host app.\n\t\t\t\t\t// Harmless under node and bun.\n\t\t\t\t\tenv: { ...process.env, ELECTRON_RUN_AS_NODE: \"1\" },\n\t\t\t\t}\n\t\t\t);\n\t\t} catch (error) {\n\t\t\t// tsc exits non-zero when the input has diagnostics even though the\n\t\t\t// declaration files are still emitted (noEmitOnError is false).\n\t\t\t// Success is judged by the presence of declaration files below.\n\t\t\ttscError = error;\n\t\t}\n\n\t\tconst declarations: Record<string, string> = {};\n\n\t\tfor (const entry of await fs.readdir(outDir, { recursive: true })) {\n\t\t\tif (entry.endsWith(\".d.ts\")) {\n\t\t\t\tdeclarations[entry.split(path.sep).join(path.posix.sep)] =\n\t\t\t\t\tawait fs.readFile(path.join(outDir, entry), \"utf-8\");\n\t\t\t}\n\t\t}\n\n\t\t// tsc emits exactly one .d.ts per input .js (even for inputs with\n\t\t// syntax errors), so a count mismatch means the compiler died mid-emit\n\t\t// and the result would be silently incomplete.\n\t\tif (Object.keys(declarations).length !== safeEntries.length) {\n\t\t\tthrow new Error(withTscOutput(failedToEmitWithTscMessage, tscError), {\n\t\t\t\tcause: tscError,\n\t\t\t});\n\t\t}\n\n\t\treturn declarations;\n\t} finally {\n\t\tawait fs.rm(tempDir, { recursive: true, force: true });\n\t}\n}\n\n/**\n * Appends the spawned compiler's output to the error message.\n *\n * tsc writes diagnostics to stdout, which `execFile` errors expose only as a\n * property — not in the message — so error reporters that print only\n * message/stack would otherwise hide the reason the emit failed.\n */\nfunction withTscOutput(message: string, tscError: unknown): string {\n\tconst { stdout, stderr } = (tscError ?? {}) as {\n\t\tstdout?: unknown;\n\t\tstderr?: unknown;\n\t};\n\tconst output = [stdout, stderr]\n\t\t.filter((value): value is string => typeof value === \"string\")\n\t\t.join(\"\\n\")\n\t\t.trim();\n\tif (output === \"\") {\n\t\treturn message;\n\t}\n\tconst truncated =\n\t\toutput.length > 4000 ? output.slice(0, 4000) + \"\\n… (truncated)\" : output;\n\treturn `${message}\\n\\nCompiler output:\\n${truncated}`;\n}\n\ntype QuotedExportAliases = Map<string, Map<string, Set<string>>>;\n\nfunction collectQuotedExportAliases(\n\tts: TypeScript,\n\tfiles: Map<string, string>\n): QuotedExportAliases {\n\tconst aliases: QuotedExportAliases = new Map();\n\n\tfor (const [fileName, content] of files) {\n\t\tconst sourceFile = ts.createSourceFile(\n\t\t\tfileName,\n\t\t\tcontent,\n\t\t\tts.ScriptTarget.ESNext,\n\t\t\ttrue,\n\t\t\tts.ScriptKind.JS\n\t\t);\n\t\tconst fileAliases = new Map<string, Set<string>>();\n\n\t\tconst visit = (node: import(\"typescript\").Node) => {\n\t\t\tif (\n\t\t\t\tts.isExportDeclaration(node) &&\n\t\t\t\tnode.exportClause &&\n\t\t\t\tts.isNamedExports(node.exportClause)\n\t\t\t) {\n\t\t\t\tfor (const specifier of node.exportClause.elements) {\n\t\t\t\t\tif (ts.isStringLiteral(specifier.name)) {\n\t\t\t\t\t\tconst localName = moduleExportNameText(\n\t\t\t\t\t\t\tspecifier.propertyName ?? specifier.name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst exportedName = specifier.name.text;\n\t\t\t\t\t\tconst localAliases =\n\t\t\t\t\t\t\tfileAliases.get(localName) ?? new Set<string>();\n\t\t\t\t\t\tlocalAliases.add(exportedName);\n\t\t\t\t\t\tfileAliases.set(localName, localAliases);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tts.forEachChild(node, visit);\n\t\t};\n\n\t\tvisit(sourceFile);\n\n\t\tif (fileAliases.size > 0) {\n\t\t\taliases.set(fileName, fileAliases);\n\t\t}\n\t}\n\n\treturn aliases;\n}\n\nfunction createQuotedExportAliasTransformer(\n\tts: TypeScript,\n\tquotedExportAliases: QuotedExportAliases,\n\tnormalizeFileName: (fileName: string) => string\n): import(\"typescript\").TransformerFactory<\n\timport(\"typescript\").SourceFile | import(\"typescript\").Bundle\n> {\n\treturn (context) => {\n\t\tconst visitSourceFile = (sourceFile: import(\"typescript\").SourceFile) => {\n\t\t\tconst fileAliases = quotedExportAliases.get(\n\t\t\t\tnormalizeFileName(sourceFile.fileName)\n\t\t\t);\n\n\t\t\tif (!fileAliases) {\n\t\t\t\treturn sourceFile;\n\t\t\t}\n\n\t\t\tconst visit = (\n\t\t\t\tnode: import(\"typescript\").Node\n\t\t\t): import(\"typescript\").VisitResult<import(\"typescript\").Node> => {\n\t\t\t\tif (\n\t\t\t\t\tts.isExportDeclaration(node) &&\n\t\t\t\t\tnode.exportClause &&\n\t\t\t\t\tts.isNamedExports(node.exportClause)\n\t\t\t\t) {\n\t\t\t\t\tconst elements: import(\"typescript\").ExportSpecifier[] = [];\n\t\t\t\t\tconst emitted = new Set<string>();\n\n\t\t\t\t\tfor (const specifier of node.exportClause.elements) {\n\t\t\t\t\t\tconst localName = moduleExportNameText(\n\t\t\t\t\t\t\tspecifier.propertyName ?? specifier.name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst exportedName = moduleExportNameText(specifier.name);\n\t\t\t\t\t\tconst shouldQuote = fileAliases.get(localName)?.has(exportedName);\n\t\t\t\t\t\tconst nextSpecifier = shouldQuote\n\t\t\t\t\t\t\t? ts.factory.updateExportSpecifier(\n\t\t\t\t\t\t\t\t\tspecifier,\n\t\t\t\t\t\t\t\t\tspecifier.isTypeOnly,\n\t\t\t\t\t\t\t\t\tspecifier.propertyName,\n\t\t\t\t\t\t\t\t\tts.factory.createStringLiteral(exportedName)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: specifier;\n\t\t\t\t\t\tconst emittedKey = `${moduleExportNameText(\n\t\t\t\t\t\t\tnextSpecifier.propertyName ?? nextSpecifier.name\n\t\t\t\t\t\t)}\\0${moduleExportNameText(nextSpecifier.name)}`;\n\n\t\t\t\t\t\tif (!emitted.has(emittedKey)) {\n\t\t\t\t\t\t\telements.push(nextSpecifier);\n\t\t\t\t\t\t\temitted.add(emittedKey);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn ts.factory.updateExportDeclaration(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tnode.modifiers,\n\t\t\t\t\t\tnode.isTypeOnly,\n\t\t\t\t\t\tts.factory.updateNamedExports(node.exportClause, elements),\n\t\t\t\t\t\tnode.moduleSpecifier,\n\t\t\t\t\t\tnode.attributes\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn ts.visitEachChild(node, visit, context);\n\t\t\t};\n\n\t\t\treturn ts.visitEachChild(sourceFile, visit, context);\n\t\t};\n\n\t\treturn (sourceFileOrBundle) => {\n\t\t\tif (\"fileName\" in sourceFileOrBundle) {\n\t\t\t\treturn visitSourceFile(sourceFileOrBundle);\n\t\t\t}\n\t\t\treturn sourceFileOrBundle;\n\t\t};\n\t};\n}\n\nfunction moduleExportNameText(name: import(\"typescript\").ModuleExportName) {\n\treturn name.text;\n}\n\nasync function importTypeScript(): Promise<TypeScript> {\n\ttry {\n\t\treturn await import(\"typescript\");\n\t} catch (cause) {\n\t\tif (isMissingTypeScriptPackageError(cause)) {\n\t\t\tthrow new Error(missingTypeScriptMessage);\n\t\t}\n\t\tthrow new Error(failedToLoadTypeScriptMessage, { cause });\n\t}\n}\n\nfunction isMissingTypeScriptPackageError(cause: unknown): boolean {\n\tif (cause instanceof Error === false) {\n\t\treturn false;\n\t}\n\tif (\"code\" in cause && cause.code !== \"ERR_MODULE_NOT_FOUND\") {\n\t\treturn false;\n\t}\n\treturn cause.message.includes(\"Cannot find package 'typescript'\");\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-ts-declarations.test.d.ts","sourceRoot":"","sources":["../../src/compiler/emit-ts-declarations.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { beforeEach, expect, test, vi } from "vitest";
|
|
2
|
+
import { createProject as typescriptProject, ts } from "@ts-morph/bootstrap";
|
|
3
|
+
import { createBundleNested } from "./test-helpers.js";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { compileProject } from "./compile-project.js";
|
|
7
|
+
// TypeScript 7 (the Go-based compiler, npm `latest` since 7.0.2) no longer
|
|
8
|
+
// ships the in-process compiler API. Its main entry point only exports
|
|
9
|
+
// `version` and `versionMajorMinor` — no `createProgram`, no `ScriptTarget`,
|
|
10
|
+
// no `ModuleKind`. Emitting declarations must go through the `tsc` CLI
|
|
11
|
+
// instead. https://github.com/opral/paraglide-js/issues/711
|
|
12
|
+
//
|
|
13
|
+
// The repo's own `typescript` dev dependency stays on 5.x for the existing
|
|
14
|
+
// tests; this file swaps in the aliased TypeScript 7 package to simulate a
|
|
15
|
+
// user who upgraded.
|
|
16
|
+
//
|
|
17
|
+
// Note: vitest wraps factory mocks in a proxy that throws on missing exports.
|
|
18
|
+
// The real TypeScript 7 module returns `undefined` for them instead, so the
|
|
19
|
+
// classic compiler API surface is stubbed out explicitly to mirror that.
|
|
20
|
+
vi.mock("typescript", async () => {
|
|
21
|
+
const actual = await vi.importActual("typescript-go");
|
|
22
|
+
return {
|
|
23
|
+
...actual,
|
|
24
|
+
createProgram: undefined,
|
|
25
|
+
createCompilerHost: undefined,
|
|
26
|
+
createSourceFile: undefined,
|
|
27
|
+
ScriptTarget: undefined,
|
|
28
|
+
ScriptKind: undefined,
|
|
29
|
+
ModuleKind: undefined,
|
|
30
|
+
ModuleResolutionKind: undefined,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
// In production, the `typescript` module and the `tsc` CLI resolve to the
|
|
34
|
+
// same package. In this test the module is mocked with the TypeScript 7
|
|
35
|
+
// alias, so the CLI resolution must point at that alias too — otherwise it
|
|
36
|
+
// would find the repo's TypeScript 5 dev dependency. Mutable so the error
|
|
37
|
+
// path can be tested with a broken resolution.
|
|
38
|
+
const tscResolution = vi.hoisted(() => ({ tscJsPath: "" }));
|
|
39
|
+
vi.mock("./resolve-tsc-js-path.js", () => ({
|
|
40
|
+
resolveTscJsPath: () => tscResolution.tscJsPath,
|
|
41
|
+
}));
|
|
42
|
+
const typescriptGoTscJsPath = path.join(path.dirname(createRequire(import.meta.url).resolve("typescript-go/package.json")), "lib", "tsc.js");
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
tscResolution.tscJsPath = typescriptGoTscJsPath;
|
|
45
|
+
});
|
|
46
|
+
function testMessagesInput() {
|
|
47
|
+
const quotedAliasBundle = createBundleNested({
|
|
48
|
+
id: "greeting.hello",
|
|
49
|
+
messages: [
|
|
50
|
+
{
|
|
51
|
+
locale: "en",
|
|
52
|
+
variants: [{ pattern: [{ type: "text", value: "Hello" }] }],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
const parameterizedBundle = createBundleNested({
|
|
57
|
+
id: "balance",
|
|
58
|
+
declarations: [{ type: "input-variable", name: "amount" }],
|
|
59
|
+
messages: [
|
|
60
|
+
{
|
|
61
|
+
locale: "en",
|
|
62
|
+
variants: [
|
|
63
|
+
{
|
|
64
|
+
pattern: [
|
|
65
|
+
{ type: "text", value: "You have " },
|
|
66
|
+
{
|
|
67
|
+
type: "expression",
|
|
68
|
+
arg: { type: "variable-reference", name: "amount" },
|
|
69
|
+
},
|
|
70
|
+
{ type: "text", value: " coins." },
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
bundles: [quotedAliasBundle, parameterizedBundle],
|
|
79
|
+
settings: { locales: ["en"], baseLocale: "en" },
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
test("emitTsDeclarations works with TypeScript 7 (tsgo)", async () => {
|
|
83
|
+
const { bundles, settings } = testMessagesInput();
|
|
84
|
+
for (const outputStructure of [
|
|
85
|
+
"message-modules",
|
|
86
|
+
"locale-modules",
|
|
87
|
+
]) {
|
|
88
|
+
const output = await compileProject({
|
|
89
|
+
bundles,
|
|
90
|
+
settings,
|
|
91
|
+
compilerOptions: {
|
|
92
|
+
emitTsDeclarations: true,
|
|
93
|
+
outputStructure,
|
|
94
|
+
// path-traversing keys (incl. Windows separators) must be
|
|
95
|
+
// silently skipped like on the compiler-API path — neither
|
|
96
|
+
// escaping the temp dir nor failing the completeness check
|
|
97
|
+
additionalFiles: {
|
|
98
|
+
"../escape.js": "export const escape = 1;",
|
|
99
|
+
"foo\\..\\..\\escape.js": "export const escape = 1;",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
expect(output["../escape.d.ts"]).toBeUndefined();
|
|
104
|
+
expect(output["foo\\..\\..\\escape.d.ts"]).toBeUndefined();
|
|
105
|
+
expect(output).toHaveProperty("runtime.d.ts");
|
|
106
|
+
expect(output).toHaveProperty("messages.d.ts");
|
|
107
|
+
expect(output).toHaveProperty("registry.d.ts");
|
|
108
|
+
expect(output["runtime.d.ts"]).toContain("getLocale");
|
|
109
|
+
// TypeScript 5's declaration emitter drops the quotes around export
|
|
110
|
+
// aliases that are not valid identifiers (worked around by a custom
|
|
111
|
+
// transformer on the compiler-API path); tsgo emits them correctly.
|
|
112
|
+
const declarationFile = outputStructure === "message-modules"
|
|
113
|
+
? "messages/greeting_hello.d.ts"
|
|
114
|
+
: "messages/_index.d.ts";
|
|
115
|
+
expect(output[declarationFile]).toContain(`as "greeting.hello"`);
|
|
116
|
+
// the emitted declarations must typecheck for a consumer
|
|
117
|
+
// (@ts-morph/bootstrap bundles its own compiler and is unaffected
|
|
118
|
+
// by the TypeScript 7 mock above)
|
|
119
|
+
const tsProject = await typescriptProject({
|
|
120
|
+
useInMemoryFileSystem: true,
|
|
121
|
+
compilerOptions: {
|
|
122
|
+
module: ts.ModuleKind.Node16,
|
|
123
|
+
moduleResolution: ts.ModuleResolutionKind.Node16,
|
|
124
|
+
strict: true,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
for (const [fileName, code] of Object.entries(output)) {
|
|
128
|
+
if (fileName.endsWith(".d.ts")) {
|
|
129
|
+
tsProject.createSourceFile(fileName, code);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
tsProject.createSourceFile("test.ts", `
|
|
133
|
+
import { "greeting.hello" as greetingHello, balance } from "./messages.js";
|
|
134
|
+
|
|
135
|
+
greetingHello() satisfies string;
|
|
136
|
+
balance({ amount: 5 }) satisfies string;
|
|
137
|
+
`);
|
|
138
|
+
const program = tsProject.createProgram();
|
|
139
|
+
const diagnostics = ts.getPreEmitDiagnostics(program).filter((d) => {
|
|
140
|
+
const text = d.messageText.toString();
|
|
141
|
+
return (!text.includes("Cannot find name 'URLPattern'") &&
|
|
142
|
+
!text.includes("Type 'string' is not assignable to type"));
|
|
143
|
+
});
|
|
144
|
+
for (const diagnostic of diagnostics) {
|
|
145
|
+
console.error(diagnostic.messageText, diagnostic.file?.fileName);
|
|
146
|
+
}
|
|
147
|
+
expect(diagnostics.length).toEqual(0);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
test("emitTsDeclarations throws a descriptive error when the tsc CLI produces no declarations", async () => {
|
|
151
|
+
tscResolution.tscJsPath = path.join(path.dirname(typescriptGoTscJsPath), "does-not-exist.js");
|
|
152
|
+
const { bundles, settings } = testMessagesInput();
|
|
153
|
+
await expect(compileProject({
|
|
154
|
+
bundles,
|
|
155
|
+
settings,
|
|
156
|
+
compilerOptions: {
|
|
157
|
+
emitTsDeclarations: true,
|
|
158
|
+
},
|
|
159
|
+
})).rejects.toThrow(/did not produce a declaration file for every compiled/);
|
|
160
|
+
});
|
|
161
|
+
//# sourceMappingURL=emit-ts-declarations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-ts-declarations.test.js","sourceRoot":"","sources":["../../src/compiler/emit-ts-declarations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,2EAA2E;AAC3E,uEAAuE;AACvE,6EAA6E;AAC7E,uEAAuE;AACvE,4DAA4D;AAC5D,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,qBAAqB;AACrB,EAAE;AACF,8EAA8E;AAC9E,4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} from \"@ts-morph/bootstrap\";\nimport type { BundleNested } from \"../messages/ast.js\";\nimport { createBundleNested } from \"./test-helpers.js\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { compileProject } from \"./compile-project.js\";\n\n// TypeScript 7 (the Go-based compiler, npm `latest` since 7.0.2) no longer\n// ships the in-process compiler API. Its main entry point only exports\n// `version` and `versionMajorMinor` — no `createProgram`, no `ScriptTarget`,\n// no `ModuleKind`. Emitting declarations must go through the `tsc` CLI\n// instead. https://github.com/opral/paraglide-js/issues/711\n//\n// The repo's own `typescript` dev dependency stays on 5.x for the existing\n// tests; this file swaps in the aliased TypeScript 7 package to simulate a\n// user who upgraded.\n//\n// Note: vitest wraps factory mocks in a proxy that throws on missing exports.\n// The real TypeScript 7 module returns `undefined` for them instead, so the\n// classic compiler API surface is stubbed out explicitly to mirror that.\nvi.mock(\"typescript\", async () => {\n\tconst actual =\n\t\tawait vi.importActual<typeof import(\"typescript-go\")>(\"typescript-go\");\n\treturn {\n\t\t...actual,\n\t\tcreateProgram: undefined,\n\t\tcreateCompilerHost: undefined,\n\t\tcreateSourceFile: undefined,\n\t\tScriptTarget: undefined,\n\t\tScriptKind: undefined,\n\t\tModuleKind: undefined,\n\t\tModuleResolutionKind: undefined,\n\t};\n});\n\n// In production, the `typescript` module and the `tsc` CLI resolve to the\n// same package. In this test the module is mocked with the TypeScript 7\n// alias, so the CLI resolution must point at that alias too — otherwise it\n// would find the repo's TypeScript 5 dev dependency. Mutable so the error\n// path can be tested with a broken resolution.\nconst tscResolution = vi.hoisted(() => ({ tscJsPath: \"\" }));\n\nvi.mock(\"./resolve-tsc-js-path.js\", () => ({\n\tresolveTscJsPath: () => tscResolution.tscJsPath,\n}));\n\nconst typescriptGoTscJsPath = path.join(\n\tpath.dirname(\n\t\tcreateRequire(import.meta.url).resolve(\"typescript-go/package.json\")\n\t),\n\t\"lib\",\n\t\"tsc.js\"\n);\n\nbeforeEach(() => {\n\ttscResolution.tscJsPath = typescriptGoTscJsPath;\n});\n\nfunction testMessagesInput() {\n\tconst quotedAliasBundle: BundleNested = createBundleNested({\n\t\tid: \"greeting.hello\",\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tlocale: \"en\",\n\t\t\t\tvariants: [{ pattern: [{ type: \"text\", value: \"Hello\" }] }],\n\t\t\t},\n\t\t],\n\t});\n\n\tconst parameterizedBundle: BundleNested = createBundleNested({\n\t\tid: \"balance\",\n\t\tdeclarations: [{ type: \"input-variable\", name: \"amount\" }],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tlocale: \"en\",\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{ type: \"text\", value: \"You have \" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ type: \"text\", value: \" coins.\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\treturn {\n\t\tbundles: [quotedAliasBundle, parameterizedBundle],\n\t\tsettings: { locales: [\"en\"], baseLocale: \"en\" },\n\t};\n}\n\ntest(\"emitTsDeclarations works with TypeScript 7 (tsgo)\", async () => {\n\tconst { bundles, settings } = testMessagesInput();\n\n\tfor (const outputStructure of [\n\t\t\"message-modules\",\n\t\t\"locale-modules\",\n\t] as const) {\n\t\tconst output = await compileProject({\n\t\t\tbundles,\n\t\t\tsettings,\n\t\t\tcompilerOptions: {\n\t\t\t\temitTsDeclarations: true,\n\t\t\t\toutputStructure,\n\t\t\t\t// path-traversing keys (incl. Windows separators) must be\n\t\t\t\t// silently skipped like on the compiler-API path — neither\n\t\t\t\t// escaping the temp dir nor failing the completeness check\n\t\t\t\tadditionalFiles: {\n\t\t\t\t\t\"../escape.js\": \"export const escape = 1;\",\n\t\t\t\t\t\"foo\\\\..\\\\..\\\\escape.js\": \"export const escape = 1;\",\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\texpect(output[\"../escape.d.ts\"]).toBeUndefined();\n\t\texpect(output[\"foo\\\\..\\\\..\\\\escape.d.ts\"]).toBeUndefined();\n\n\t\texpect(output).toHaveProperty(\"runtime.d.ts\");\n\t\texpect(output).toHaveProperty(\"messages.d.ts\");\n\t\texpect(output).toHaveProperty(\"registry.d.ts\");\n\t\texpect(output[\"runtime.d.ts\"]).toContain(\"getLocale\");\n\n\t\t// TypeScript 5's declaration emitter drops the quotes around export\n\t\t// aliases that are not valid identifiers (worked around by a custom\n\t\t// transformer on the compiler-API path); tsgo emits them correctly.\n\t\tconst declarationFile =\n\t\t\toutputStructure === \"message-modules\"\n\t\t\t\t? \"messages/greeting_hello.d.ts\"\n\t\t\t\t: \"messages/_index.d.ts\";\n\n\t\texpect(output[declarationFile]).toContain(`as \"greeting.hello\"`);\n\n\t\t// the emitted declarations must typecheck for a consumer\n\t\t// (@ts-morph/bootstrap bundles its own compiler and is unaffected\n\t\t// by the TypeScript 7 mock above)\n\t\tconst tsProject = await typescriptProject({\n\t\t\tuseInMemoryFileSystem: true,\n\t\t\tcompilerOptions: {\n\t\t\t\tmodule: ts.ModuleKind.Node16,\n\t\t\t\tmoduleResolution: ts.ModuleResolutionKind.Node16,\n\t\t\t\tstrict: true,\n\t\t\t},\n\t\t});\n\n\t\tfor (const [fileName, code] of Object.entries(output)) {\n\t\t\tif (fileName.endsWith(\".d.ts\")) {\n\t\t\t\ttsProject.createSourceFile(fileName, code);\n\t\t\t}\n\t\t}\n\n\t\ttsProject.createSourceFile(\n\t\t\t\"test.ts\",\n\t\t\t`\n\t\t\t\timport { \"greeting.hello\" as greetingHello, balance } from \"./messages.js\";\n\n\t\t\t\tgreetingHello() satisfies string;\n\t\t\t\tbalance({ amount: 5 }) satisfies string;\n\t\t\t`\n\t\t);\n\n\t\tconst program = tsProject.createProgram();\n\t\tconst diagnostics = ts.getPreEmitDiagnostics(program).filter((d) => {\n\t\t\tconst text = d.messageText.toString();\n\t\t\treturn (\n\t\t\t\t!text.includes(\"Cannot find name 'URLPattern'\") &&\n\t\t\t\t!text.includes(\"Type 'string' is not assignable to type\")\n\t\t\t);\n\t\t});\n\t\tfor (const diagnostic of diagnostics) {\n\t\t\tconsole.error(diagnostic.messageText, diagnostic.file?.fileName);\n\t\t}\n\t\texpect(diagnostics.length).toEqual(0);\n\t}\n});\n\ntest(\"emitTsDeclarations throws a descriptive error when the tsc CLI produces no declarations\", async () => {\n\ttscResolution.tscJsPath = path.join(\n\t\tpath.dirname(typescriptGoTscJsPath),\n\t\t\"does-not-exist.js\"\n\t);\n\n\tconst { bundles, settings } = testMessagesInput();\n\n\tawait expect(\n\t\tcompileProject({\n\t\t\tbundles,\n\t\t\tsettings,\n\t\t\tcompilerOptions: {\n\t\t\t\temitTsDeclarations: true,\n\t\t\t},\n\t\t})\n\t).rejects.toThrow(/did not produce a declaration file for every compiled/);\n});\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { defaultCompilerOptions, type CompilerOptions, type RoutingConfig, type HostRoutingRule, } from "./compiler-options.js";
|
|
2
|
+
export type { LocalizedString, MessagePart, MessageMarkupAttribute, MessageMarkupOption, MessageMarkupAttributes, MessageMarkupOptions, MessageMarkupTag, MessageMarkupSchema, MessageMetadata, MessageBundleFunction, MessageFunction, } from "./types.js";
|
|
3
|
+
export type { Runtime } from "./runtime/type.js";
|
|
4
|
+
export type { ServerRuntime } from "./server/type.js";
|
|
5
|
+
export { compile } from "./compile.js";
|
|
6
|
+
export { filterOutputForEmit, buildVirtualModules, type EmitFiles, } from "./emit-files.js";
|
|
7
|
+
export { compileProject } from "./compile-project.js";
|
|
8
|
+
export { compileBundle } from "./compile-bundle.js";
|
|
9
|
+
export { compileMessage } from "./compile-message.js";
|
|
10
|
+
export { compilePattern } from "./compile-pattern.js";
|
|
11
|
+
export { writeOutput } from "../services/file-handling/write-output.js";
|
|
12
|
+
export { loadMessages } from "../messages/load-messages.js";
|
|
13
|
+
export { createParaglide } from "./create-paraglide.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACX,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,SAAS,GACd,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { defaultCompilerOptions, } from "./compiler-options.js";
|
|
2
|
+
export { compile } from "./compile.js";
|
|
3
|
+
export { filterOutputForEmit, buildVirtualModules, } from "./emit-files.js";
|
|
4
|
+
export { compileProject } from "./compile-project.js";
|
|
5
|
+
export { compileBundle } from "./compile-bundle.js";
|
|
6
|
+
export { compileMessage } from "./compile-message.js";
|
|
7
|
+
export { compilePattern } from "./compile-pattern.js";
|
|
8
|
+
export { writeOutput } from "../services/file-handling/write-output.js";
|
|
9
|
+
export { loadMessages } from "../messages/load-messages.js";
|
|
10
|
+
export { createParaglide } from "./create-paraglide.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|