@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,74 @@
|
|
|
1
|
+
import nodeFs from "node:fs";
|
|
2
|
+
import { type CompilationResult } from "../compiler/compile.js";
|
|
3
|
+
import type { CompilerOptions } from "../compiler/compiler-options.js";
|
|
4
|
+
import { Logger } from "../services/logger/index.js";
|
|
5
|
+
export declare const PLUGIN_NAME = "unplugin-paraglide-lite";
|
|
6
|
+
declare const logger: Logger;
|
|
7
|
+
export type PluginState = {
|
|
8
|
+
/** Identity of the fs the tracked wrapper was created around. */
|
|
9
|
+
baseFs: typeof nodeFs | undefined;
|
|
10
|
+
trackedFs: typeof nodeFs;
|
|
11
|
+
readFiles: Set<string>;
|
|
12
|
+
clearReadFiles: () => void;
|
|
13
|
+
previousCompilation: CompilationResult | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Digest of the input files and options of the last successful compilation.
|
|
16
|
+
*
|
|
17
|
+
* `vite build` fires `buildStart` once per environment (client, ssr, ...).
|
|
18
|
+
* When the digest of the current inputs matches, `compile()` is skipped
|
|
19
|
+
* entirely — project loading and message compilation are expensive even
|
|
20
|
+
* when `previousCompilation` dedupes the writes.
|
|
21
|
+
*
|
|
22
|
+
* https://github.com/opral/paraglide-js/issues/693
|
|
23
|
+
*/
|
|
24
|
+
previousInputsDigest: string | undefined;
|
|
25
|
+
/** Absolute path → generated JS source for resolveId/load. */
|
|
26
|
+
virtualModules: Map<string, string>;
|
|
27
|
+
/** Absolute outdir used to build virtualModules. */
|
|
28
|
+
absoluteOutdir: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Default isServer which differs per bundler. Mutated by Vite hooks.
|
|
32
|
+
*/
|
|
33
|
+
export declare let isServerExpression: string | undefined;
|
|
34
|
+
export declare function setIsServerExpression(value: string | undefined): void;
|
|
35
|
+
export declare function getPluginState(args: CompilerOptions): PluginState;
|
|
36
|
+
/** @internal test helper */
|
|
37
|
+
export declare function resetPluginStateForTests(): void;
|
|
38
|
+
export declare function withoutCleanOutdir(args: CompilerOptions): Omit<CompilerOptions, "cleanOutdir">;
|
|
39
|
+
export declare function resolveOutputStructure(args: CompilerOptions): NonNullable<CompilerOptions["outputStructure"]>;
|
|
40
|
+
/**
|
|
41
|
+
* Hashes the files (and directory listings) the last compilation read,
|
|
42
|
+
* together with the options that affect the output. Returns `undefined`
|
|
43
|
+
* when the digest can't be computed (no tracked reads yet, an unexpected
|
|
44
|
+
* read error, ...) — `undefined` never matches, so the caller compiles.
|
|
45
|
+
*/
|
|
46
|
+
export declare function computeInputsDigest(state: PluginState, args: CompilerOptions, outputStructure: NonNullable<CompilerOptions["outputStructure"]>): Promise<string | undefined>;
|
|
47
|
+
export type AddWatchFile = (id: string) => void;
|
|
48
|
+
export declare function compileFromBuildStart(args: {
|
|
49
|
+
compilerOptions: CompilerOptions;
|
|
50
|
+
state: PluginState;
|
|
51
|
+
addWatchFile: AddWatchFile;
|
|
52
|
+
/** Force full disk emit (CLI / per-locale builds). */
|
|
53
|
+
forceEmitFiles?: true;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
export declare function compileFromWatchChange(args: {
|
|
56
|
+
compilerOptions: CompilerOptions;
|
|
57
|
+
state: PluginState;
|
|
58
|
+
changedPath: string;
|
|
59
|
+
addWatchFile: AddWatchFile;
|
|
60
|
+
forceEmitFiles?: true;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves an import to a generated paraglide module when present in memory.
|
|
64
|
+
*
|
|
65
|
+
* Only claims ids that resolve to a path under `outdir`. Relative imports from
|
|
66
|
+
* outside outdir (e.g. Svelte's own `./runtime.js`) must not be rewritten.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveVirtualModuleId(args: {
|
|
69
|
+
id: string;
|
|
70
|
+
importer: string | undefined;
|
|
71
|
+
state: PluginState;
|
|
72
|
+
}): string | undefined;
|
|
73
|
+
export declare function loadVirtualModule(id: string, state: PluginState): string | undefined;
|
|
74
|
+
export { logger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-core.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/plugin-core.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,SAAS,CAAC;AAG7B,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAQrD,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD,QAAA,MAAM,MAAM,QAAe,CAAC;AAE5B,MAAM,MAAM,WAAW,GAAG;IACzB,iEAAiE;IACjE,MAAM,EAAE,OAAO,MAAM,GAAG,SAAS,CAAC;IAClC,SAAS,EAAE,OAAO,MAAM,CAAC;IACzB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mBAAmB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACnD;;;;;;;;;OASG;IACH,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,8DAA8D;IAC9D,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oDAAoD;IACpD,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AAQF;;GAEG;AACH,eAAO,IAAI,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;AAElD,wB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AAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;CACnB,GAAG,MAAM,GAAG,SAAS,CAwCrB;AAUD,wBAAgB,iBAAiB,CAChC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,WAAW,GAChB,MAAM,GAAG,SAAS,CAGpB;AAWD,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import nodeFs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { relative } from "node:path";
|
|
5
|
+
import { compile } from "../compiler/compile.js";
|
|
6
|
+
import { buildVirtualModules } from "../compiler/emit-files.js";
|
|
7
|
+
import { seedPreviousCompilationFromOutdir } from "../compiler/seed-previous-compilation.js";
|
|
8
|
+
import { Logger } from "../services/logger/index.js";
|
|
9
|
+
import { createTrackedFs, getWatchTargets, isPathWithinDirectories, } from "../services/file-watching/tracked-fs.js";
|
|
10
|
+
import { nodeNormalizePath } from "../utilities/node-normalize-path.js";
|
|
11
|
+
export const PLUGIN_NAME = "unplugin-paraglide-lite";
|
|
12
|
+
const logger = new Logger();
|
|
13
|
+
// Module-scoped so the warm state survives plugin re-instantiation within
|
|
14
|
+
// one process (e.g. a vite config reload), but recreated when a different
|
|
15
|
+
// fs is passed — the tracked wrapper, read set, and cached compilation are
|
|
16
|
+
// only valid for the filesystem they were produced from.
|
|
17
|
+
let pluginState;
|
|
18
|
+
/**
|
|
19
|
+
* Default isServer which differs per bundler. Mutated by Vite hooks.
|
|
20
|
+
*/
|
|
21
|
+
export let isServerExpression;
|
|
22
|
+
export function setIsServerExpression(value) {
|
|
23
|
+
isServerExpression = value;
|
|
24
|
+
}
|
|
25
|
+
export function getPluginState(args) {
|
|
26
|
+
if (pluginState === undefined || pluginState.baseFs !== args.fs) {
|
|
27
|
+
const tracked = createTrackedFs({ fs: args.fs });
|
|
28
|
+
pluginState = {
|
|
29
|
+
baseFs: args.fs,
|
|
30
|
+
trackedFs: tracked.fs,
|
|
31
|
+
readFiles: tracked.readFiles,
|
|
32
|
+
clearReadFiles: tracked.clearReadFiles,
|
|
33
|
+
previousCompilation: undefined,
|
|
34
|
+
previousInputsDigest: undefined,
|
|
35
|
+
virtualModules: new Map(),
|
|
36
|
+
absoluteOutdir: path.resolve(process.cwd(), args.outdir),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return pluginState;
|
|
40
|
+
}
|
|
41
|
+
/** @internal test helper */
|
|
42
|
+
export function resetPluginStateForTests() {
|
|
43
|
+
pluginState = undefined;
|
|
44
|
+
isServerExpression = undefined;
|
|
45
|
+
}
|
|
46
|
+
export function withoutCleanOutdir(args) {
|
|
47
|
+
const { cleanOutdir, ...compileArgs } = args;
|
|
48
|
+
void cleanOutdir;
|
|
49
|
+
return compileArgs;
|
|
50
|
+
}
|
|
51
|
+
export function resolveOutputStructure(args) {
|
|
52
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
53
|
+
return (args.outputStructure ??
|
|
54
|
+
(isProduction ? "message-modules" : "locale-modules"));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Hashes the files (and directory listings) the last compilation read,
|
|
58
|
+
* together with the options that affect the output. Returns `undefined`
|
|
59
|
+
* when the digest can't be computed (no tracked reads yet, an unexpected
|
|
60
|
+
* read error, ...) — `undefined` never matches, so the caller compiles.
|
|
61
|
+
*/
|
|
62
|
+
export async function computeInputsDigest(state, args, outputStructure) {
|
|
63
|
+
if (state.readFiles.size === 0) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const targets = getWatchTargets(state.readFiles, { outdir: args.outdir });
|
|
67
|
+
if (targets.files.size === 0) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const fsp = (args.fs ?? nodeFs).promises;
|
|
71
|
+
const hash = createHash("sha256");
|
|
72
|
+
try {
|
|
73
|
+
const { fs: _fs, ...serializableArgs } = args;
|
|
74
|
+
void _fs;
|
|
75
|
+
hash.update(JSON.stringify({
|
|
76
|
+
...serializableArgs,
|
|
77
|
+
outputStructure,
|
|
78
|
+
isServer: isServerExpression,
|
|
79
|
+
}));
|
|
80
|
+
for (const directoryPath of [...targets.directories].sort()) {
|
|
81
|
+
const entries = await fsp
|
|
82
|
+
.readdir(directoryPath)
|
|
83
|
+
.catch(rethrowUnlessEnoent);
|
|
84
|
+
hash.update(`\0dir:${directoryPath.length}:${directoryPath}:`);
|
|
85
|
+
if (entries === undefined) {
|
|
86
|
+
hash.update("missing");
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
for (const entry of [...entries].sort()) {
|
|
90
|
+
hash.update(`${entry.length}:${entry},`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const filePath of [...targets.files].sort()) {
|
|
95
|
+
const content = await fsp.readFile(filePath).catch(rethrowUnlessEnoent);
|
|
96
|
+
hash.update(`\0file:${filePath.length}:${filePath}:`);
|
|
97
|
+
if (content === undefined) {
|
|
98
|
+
hash.update("missing");
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
hash.update(`${content.length}:`);
|
|
102
|
+
hash.update(content);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return hash.digest("hex");
|
|
110
|
+
}
|
|
111
|
+
function rethrowUnlessEnoent(error) {
|
|
112
|
+
if (error?.code === "ENOENT") {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
export async function compileFromBuildStart(args) {
|
|
118
|
+
const { state, compilerOptions: userArgs } = args;
|
|
119
|
+
const compilerOptions = args.forceEmitFiles
|
|
120
|
+
? { ...userArgs, emitFiles: true }
|
|
121
|
+
: userArgs;
|
|
122
|
+
const { trackedFs, readFiles } = state;
|
|
123
|
+
const outputStructure = resolveOutputStructure(compilerOptions);
|
|
124
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
125
|
+
try {
|
|
126
|
+
if (state.previousCompilation && state.previousInputsDigest) {
|
|
127
|
+
const currentDigest = await computeInputsDigest(state, compilerOptions, outputStructure);
|
|
128
|
+
if (currentDigest === state.previousInputsDigest) {
|
|
129
|
+
logger.info(`Compilation skipped — inputs unchanged (${outputStructure})`);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const seededPrevious = state.previousCompilation ??
|
|
134
|
+
(await seedPreviousCompilationFromOutdir({
|
|
135
|
+
outdir: compilerOptions.outdir,
|
|
136
|
+
fs: compilerOptions.fs?.promises,
|
|
137
|
+
}));
|
|
138
|
+
const result = await compile({
|
|
139
|
+
previousCompilation: seededPrevious,
|
|
140
|
+
outputStructure,
|
|
141
|
+
isServer: isServerExpression,
|
|
142
|
+
...withoutCleanOutdir(compilerOptions),
|
|
143
|
+
cleanOutdir: false,
|
|
144
|
+
fs: trackedFs,
|
|
145
|
+
});
|
|
146
|
+
updateVirtualModules(state, compilerOptions, result);
|
|
147
|
+
state.previousCompilation = result;
|
|
148
|
+
state.previousInputsDigest = await computeInputsDigest(state, compilerOptions, outputStructure);
|
|
149
|
+
logger.success(`Compilation complete (${outputStructure})`);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
state.previousInputsDigest = undefined;
|
|
153
|
+
logger.error("Failed to compile project:", error.message);
|
|
154
|
+
logger.info("Please check your translation files for syntax errors.");
|
|
155
|
+
if (isProduction)
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
const targets = getWatchTargets(readFiles, {
|
|
160
|
+
outdir: compilerOptions.outdir,
|
|
161
|
+
});
|
|
162
|
+
for (const filePath of targets.files) {
|
|
163
|
+
args.addWatchFile(filePath);
|
|
164
|
+
}
|
|
165
|
+
for (const directoryPath of targets.directories) {
|
|
166
|
+
args.addWatchFile(directoryPath);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export async function compileFromWatchChange(args) {
|
|
171
|
+
const { state } = args;
|
|
172
|
+
const compilerOptions = args.forceEmitFiles
|
|
173
|
+
? { ...args.compilerOptions, emitFiles: true }
|
|
174
|
+
: args.compilerOptions;
|
|
175
|
+
const { trackedFs, readFiles, clearReadFiles } = state;
|
|
176
|
+
const normalizedPath = nodeNormalizePath(args.changedPath);
|
|
177
|
+
const targets = getWatchTargets(readFiles, {
|
|
178
|
+
outdir: compilerOptions.outdir,
|
|
179
|
+
});
|
|
180
|
+
if (targets.isIgnoredPath(normalizedPath)) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const shouldCompile = targets.files.has(normalizedPath) ||
|
|
184
|
+
isPathWithinDirectories(normalizedPath, targets.directories);
|
|
185
|
+
if (shouldCompile === false) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const outputStructure = resolveOutputStructure(compilerOptions);
|
|
189
|
+
const previouslyReadFiles = new Set(readFiles);
|
|
190
|
+
try {
|
|
191
|
+
logger.info(`Re-compiling messages... File "${relative(process.cwd(), args.changedPath)}" has changed.`);
|
|
192
|
+
clearReadFiles();
|
|
193
|
+
const result = await compile({
|
|
194
|
+
previousCompilation: state.previousCompilation,
|
|
195
|
+
outputStructure,
|
|
196
|
+
isServer: isServerExpression,
|
|
197
|
+
...withoutCleanOutdir(compilerOptions),
|
|
198
|
+
cleanOutdir: false,
|
|
199
|
+
fs: trackedFs,
|
|
200
|
+
});
|
|
201
|
+
updateVirtualModules(state, compilerOptions, result);
|
|
202
|
+
state.previousCompilation = result;
|
|
203
|
+
state.previousInputsDigest = await computeInputsDigest(state, compilerOptions, outputStructure);
|
|
204
|
+
logger.success(`Re-compilation complete (${outputStructure})`);
|
|
205
|
+
const nextTargets = getWatchTargets(readFiles, {
|
|
206
|
+
outdir: compilerOptions.outdir,
|
|
207
|
+
});
|
|
208
|
+
for (const filePath of nextTargets.files) {
|
|
209
|
+
args.addWatchFile(filePath);
|
|
210
|
+
}
|
|
211
|
+
for (const directoryPath of nextTargets.directories) {
|
|
212
|
+
args.addWatchFile(directoryPath);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
clearReadFiles();
|
|
217
|
+
for (const filePath of previouslyReadFiles) {
|
|
218
|
+
readFiles.add(filePath);
|
|
219
|
+
}
|
|
220
|
+
state.previousCompilation = undefined;
|
|
221
|
+
state.previousInputsDigest = undefined;
|
|
222
|
+
state.virtualModules = new Map();
|
|
223
|
+
logger.warn("Failed to re-compile project:", e.message);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function updateVirtualModules(state, args, result) {
|
|
227
|
+
state.absoluteOutdir = path.resolve(process.cwd(), args.outdir);
|
|
228
|
+
state.virtualModules = buildVirtualModules(args.outdir, result.output, process.cwd());
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Resolves an import to a generated paraglide module when present in memory.
|
|
232
|
+
*
|
|
233
|
+
* Only claims ids that resolve to a path under `outdir`. Relative imports from
|
|
234
|
+
* outside outdir (e.g. Svelte's own `./runtime.js`) must not be rewritten.
|
|
235
|
+
*/
|
|
236
|
+
export function resolveVirtualModuleId(args) {
|
|
237
|
+
if (args.state.virtualModules.size === 0) {
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
const bareId = stripQueryAndHash(args.id);
|
|
241
|
+
const candidates = [];
|
|
242
|
+
if (path.isAbsolute(bareId)) {
|
|
243
|
+
candidates.push(bareId);
|
|
244
|
+
}
|
|
245
|
+
else if (args.importer) {
|
|
246
|
+
const importerPath = stripQueryAndHash(args.importer);
|
|
247
|
+
candidates.push(path.resolve(path.dirname(importerPath), bareId));
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
candidates.push(path.resolve(process.cwd(), bareId));
|
|
251
|
+
}
|
|
252
|
+
const outdir = nodeNormalizePath(args.state.absoluteOutdir);
|
|
253
|
+
for (const candidate of candidates) {
|
|
254
|
+
const normalized = nodeNormalizePath(candidate);
|
|
255
|
+
if (!isPathInsideDirectory(normalized, outdir)) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (args.state.virtualModules.has(normalized)) {
|
|
259
|
+
return normalized;
|
|
260
|
+
}
|
|
261
|
+
if (args.state.virtualModules.has(`${normalized}.js`)) {
|
|
262
|
+
return `${normalized}.js`;
|
|
263
|
+
}
|
|
264
|
+
const indexPath = nodeNormalizePath(path.join(normalized, "index.js"));
|
|
265
|
+
if (!normalized.endsWith(".js") &&
|
|
266
|
+
args.state.virtualModules.has(indexPath)) {
|
|
267
|
+
return indexPath;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return undefined;
|
|
271
|
+
}
|
|
272
|
+
function isPathInsideDirectory(filePath, directory) {
|
|
273
|
+
const relativePath = path.relative(directory, filePath);
|
|
274
|
+
return (relativePath === "" ||
|
|
275
|
+
(!relativePath.startsWith("..") && !path.isAbsolute(relativePath)));
|
|
276
|
+
}
|
|
277
|
+
export function loadVirtualModule(id, state) {
|
|
278
|
+
const normalized = nodeNormalizePath(stripQueryAndHash(id));
|
|
279
|
+
return state.virtualModules.get(normalized);
|
|
280
|
+
}
|
|
281
|
+
function stripQueryAndHash(id) {
|
|
282
|
+
const queryIndex = id.indexOf("?");
|
|
283
|
+
const hashIndex = id.indexOf("#");
|
|
284
|
+
let end = id.length;
|
|
285
|
+
if (queryIndex !== -1)
|
|
286
|
+
end = Math.min(end, queryIndex);
|
|
287
|
+
if (hashIndex !== -1)
|
|
288
|
+
end = Math.min(end, hashIndex);
|
|
289
|
+
return id.slice(0, end);
|
|
290
|
+
}
|
|
291
|
+
export { logger };
|
|
292
|
+
//# sourceMappingURL=plugin-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-core.js","sourceRoot":"","sources":["../../src/bundler-plugins/plugin-core.ts"],"names":[],"mappings":"AAAA,OAA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CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAU;IACpC,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC;IACpB,IAAI,UAAU,KAAK,CAAC,CAAC;QAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACvD,IAAI,SAAS,KAAK,CAAC,CAAC;QAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IACrD,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport nodeFs from \"node:fs\";\nimport path from \"node:path\";\nimport { relative } from \"node:path\";\nimport { compile, type CompilationResult } from \"../compiler/compile.js\";\nimport type { CompilerOptions } from \"../compiler/compiler-options.js\";\nimport { buildVirtualModules } from \"../compiler/emit-files.js\";\nimport { seedPreviousCompilationFromOutdir } from \"../compiler/seed-previous-compilation.js\";\nimport { Logger } from \"../services/logger/index.js\";\nimport {\n\tcreateTrackedFs,\n\tgetWatchTargets,\n\tisPathWithinDirectories,\n} from \"../services/file-watching/tracked-fs.js\";\nimport { nodeNormalizePath } from \"../utilities/node-normalize-path.js\";\n\nexport const PLUGIN_NAME = \"unplugin-paraglide-lite\";\n\nconst logger = new Logger();\n\nexport type PluginState = {\n\t/** Identity of the fs the tracked wrapper was created around. */\n\tbaseFs: typeof nodeFs | undefined;\n\ttrackedFs: typeof nodeFs;\n\treadFiles: Set<string>;\n\tclearReadFiles: () => void;\n\tpreviousCompilation: CompilationResult | undefined;\n\t/**\n\t * Digest of the input files and options of the last successful compilation.\n\t *\n\t * `vite build` fires `buildStart` once per environment (client, ssr, ...).\n\t * When the digest of the current inputs matches, `compile()` is skipped\n\t * entirely — project loading and message compilation are expensive even\n\t * when `previousCompilation` dedupes the writes.\n\t *\n\t * https://github.com/opral/paraglide-js/issues/693\n\t */\n\tpreviousInputsDigest: string | undefined;\n\t/** Absolute path → generated JS source for resolveId/load. */\n\tvirtualModules: Map<string, string>;\n\t/** Absolute outdir used to build virtualModules. */\n\tabsoluteOutdir: string;\n};\n\n// Module-scoped so the warm state survives plugin re-instantiation within\n// one process (e.g. a vite config reload), but recreated when a different\n// fs is passed — the tracked wrapper, read set, and cached compilation are\n// only valid for the filesystem they were produced from.\nlet pluginState: PluginState | undefined;\n\n/**\n * Default isServer which differs per bundler. Mutated by Vite hooks.\n */\nexport let isServerExpression: string | undefined;\n\nexport function setIsServerExpression(value: string | undefined): void {\n\tisServerExpression = value;\n}\n\nexport function getPluginState(args: CompilerOptions): PluginState {\n\tif (pluginState === undefined || pluginState.baseFs !== args.fs) {\n\t\tconst tracked = createTrackedFs({ fs: args.fs });\n\t\tpluginState = {\n\t\t\tbaseFs: args.fs,\n\t\t\ttrackedFs: tracked.fs,\n\t\t\treadFiles: tracked.readFiles,\n\t\t\tclearReadFiles: tracked.clearReadFiles,\n\t\t\tpreviousCompilation: undefined,\n\t\t\tpreviousInputsDigest: undefined,\n\t\t\tvirtualModules: new Map(),\n\t\t\tabsoluteOutdir: path.resolve(process.cwd(), args.outdir),\n\t\t};\n\t}\n\treturn pluginState;\n}\n\n/** @internal test helper */\nexport function resetPluginStateForTests(): void {\n\tpluginState = undefined;\n\tisServerExpression = undefined;\n}\n\nexport function withoutCleanOutdir(\n\targs: CompilerOptions\n): Omit<CompilerOptions, \"cleanOutdir\"> {\n\tconst { cleanOutdir, ...compileArgs } = args;\n\tvoid cleanOutdir;\n\treturn compileArgs;\n}\n\nexport function resolveOutputStructure(\n\targs: CompilerOptions\n): NonNullable<CompilerOptions[\"outputStructure\"]> {\n\tconst isProduction = process.env.NODE_ENV === \"production\";\n\treturn (\n\t\targs.outputStructure ??\n\t\t(isProduction ? \"message-modules\" : \"locale-modules\")\n\t);\n}\n\n/**\n * Hashes the files (and directory listings) the last compilation read,\n * together with the options that affect the output. Returns `undefined`\n * when the digest can't be computed (no tracked reads yet, an unexpected\n * read error, ...) — `undefined` never matches, so the caller compiles.\n */\nexport async function computeInputsDigest(\n\tstate: PluginState,\n\targs: CompilerOptions,\n\toutputStructure: NonNullable<CompilerOptions[\"outputStructure\"]>\n): Promise<string | undefined> {\n\tif (state.readFiles.size === 0) {\n\t\treturn undefined;\n\t}\n\tconst targets = getWatchTargets(state.readFiles, { outdir: args.outdir });\n\tif (targets.files.size === 0) {\n\t\treturn undefined;\n\t}\n\tconst fsp = (args.fs ?? nodeFs).promises;\n\tconst hash = createHash(\"sha256\");\n\ttry {\n\t\tconst { fs: _fs, ...serializableArgs } = args;\n\t\tvoid _fs;\n\t\thash.update(\n\t\t\tJSON.stringify({\n\t\t\t\t...serializableArgs,\n\t\t\t\toutputStructure,\n\t\t\t\tisServer: isServerExpression,\n\t\t\t})\n\t\t);\n\t\tfor (const directoryPath of [...targets.directories].sort()) {\n\t\t\tconst entries = await fsp\n\t\t\t\t.readdir(directoryPath)\n\t\t\t\t.catch(rethrowUnlessEnoent);\n\t\t\thash.update(`\\0dir:${directoryPath.length}:${directoryPath}:`);\n\t\t\tif (entries === undefined) {\n\t\t\t\thash.update(\"missing\");\n\t\t\t} else {\n\t\t\t\tfor (const entry of [...entries].sort()) {\n\t\t\t\t\thash.update(`${entry.length}:${entry},`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const filePath of [...targets.files].sort()) {\n\t\t\tconst content = await fsp.readFile(filePath).catch(rethrowUnlessEnoent);\n\t\t\thash.update(`\\0file:${filePath.length}:${filePath}:`);\n\t\t\tif (content === undefined) {\n\t\t\t\thash.update(\"missing\");\n\t\t\t} else {\n\t\t\t\thash.update(`${content.length}:`);\n\t\t\t\thash.update(content);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\treturn undefined;\n\t}\n\treturn hash.digest(\"hex\");\n}\n\nfunction rethrowUnlessEnoent(error: unknown): undefined {\n\tif ((error as NodeJS.ErrnoException)?.code === \"ENOENT\") {\n\t\treturn undefined;\n\t}\n\tthrow error;\n}\n\nexport type AddWatchFile = (id: string) => void;\n\nexport async function compileFromBuildStart(args: {\n\tcompilerOptions: CompilerOptions;\n\tstate: PluginState;\n\taddWatchFile: AddWatchFile;\n\t/** Force full disk emit (CLI / per-locale builds). */\n\tforceEmitFiles?: true;\n}): Promise<void> {\n\tconst { state, compilerOptions: userArgs } = args;\n\tconst compilerOptions: CompilerOptions = args.forceEmitFiles\n\t\t? { ...userArgs, emitFiles: true }\n\t\t: userArgs;\n\tconst { trackedFs, readFiles } = state;\n\tconst outputStructure = resolveOutputStructure(compilerOptions);\n\tconst isProduction = process.env.NODE_ENV === \"production\";\n\n\ttry {\n\t\tif (state.previousCompilation && state.previousInputsDigest) {\n\t\t\tconst currentDigest = await computeInputsDigest(\n\t\t\t\tstate,\n\t\t\t\tcompilerOptions,\n\t\t\t\toutputStructure\n\t\t\t);\n\t\t\tif (currentDigest === state.previousInputsDigest) {\n\t\t\t\tlogger.info(\n\t\t\t\t\t`Compilation skipped — inputs unchanged (${outputStructure})`\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst seededPrevious =\n\t\t\tstate.previousCompilation ??\n\t\t\t(await seedPreviousCompilationFromOutdir({\n\t\t\t\toutdir: compilerOptions.outdir,\n\t\t\t\tfs: compilerOptions.fs?.promises,\n\t\t\t}));\n\n\t\tconst result = await compile({\n\t\t\tpreviousCompilation: seededPrevious,\n\t\t\toutputStructure,\n\t\t\tisServer: isServerExpression,\n\t\t\t...withoutCleanOutdir(compilerOptions),\n\t\t\tcleanOutdir: false,\n\t\t\tfs: trackedFs,\n\t\t});\n\n\t\tupdateVirtualModules(state, compilerOptions, result);\n\t\tstate.previousCompilation = result;\n\t\tstate.previousInputsDigest = await computeInputsDigest(\n\t\t\tstate,\n\t\t\tcompilerOptions,\n\t\t\toutputStructure\n\t\t);\n\t\tlogger.success(`Compilation complete (${outputStructure})`);\n\t} catch (error) {\n\t\tstate.previousInputsDigest = undefined;\n\t\tlogger.error(\"Failed to compile project:\", (error as Error).message);\n\t\tlogger.info(\"Please check your translation files for syntax errors.\");\n\t\tif (isProduction) throw error;\n\t} finally {\n\t\tconst targets = getWatchTargets(readFiles, {\n\t\t\toutdir: compilerOptions.outdir,\n\t\t});\n\t\tfor (const filePath of targets.files) {\n\t\t\targs.addWatchFile(filePath);\n\t\t}\n\t\tfor (const directoryPath of targets.directories) {\n\t\t\targs.addWatchFile(directoryPath);\n\t\t}\n\t}\n}\n\nexport async function compileFromWatchChange(args: {\n\tcompilerOptions: CompilerOptions;\n\tstate: PluginState;\n\tchangedPath: string;\n\taddWatchFile: AddWatchFile;\n\tforceEmitFiles?: true;\n}): Promise<void> {\n\tconst { state } = args;\n\tconst compilerOptions: CompilerOptions = args.forceEmitFiles\n\t\t? { ...args.compilerOptions, emitFiles: true }\n\t\t: args.compilerOptions;\n\tconst { trackedFs, readFiles, clearReadFiles } = state;\n\tconst normalizedPath = nodeNormalizePath(args.changedPath);\n\tconst targets = getWatchTargets(readFiles, {\n\t\toutdir: compilerOptions.outdir,\n\t});\n\tif (targets.isIgnoredPath(normalizedPath)) {\n\t\treturn;\n\t}\n\tconst shouldCompile =\n\t\ttargets.files.has(normalizedPath) ||\n\t\tisPathWithinDirectories(normalizedPath, targets.directories);\n\tif (shouldCompile === false) {\n\t\treturn;\n\t}\n\n\tconst outputStructure = resolveOutputStructure(compilerOptions);\n\tconst previouslyReadFiles = new Set(readFiles);\n\n\ttry {\n\t\tlogger.info(\n\t\t\t`Re-compiling messages... File \"${relative(process.cwd(), args.changedPath)}\" has changed.`\n\t\t);\n\n\t\tclearReadFiles();\n\n\t\tconst result = await compile({\n\t\t\tpreviousCompilation: state.previousCompilation,\n\t\t\toutputStructure,\n\t\t\tisServer: isServerExpression,\n\t\t\t...withoutCleanOutdir(compilerOptions),\n\t\t\tcleanOutdir: false,\n\t\t\tfs: trackedFs,\n\t\t});\n\n\t\tupdateVirtualModules(state, compilerOptions, result);\n\t\tstate.previousCompilation = result;\n\t\tstate.previousInputsDigest = await computeInputsDigest(\n\t\t\tstate,\n\t\t\tcompilerOptions,\n\t\t\toutputStructure\n\t\t);\n\n\t\tlogger.success(`Re-compilation complete (${outputStructure})`);\n\n\t\tconst nextTargets = getWatchTargets(readFiles, {\n\t\t\toutdir: compilerOptions.outdir,\n\t\t});\n\t\tfor (const filePath of nextTargets.files) {\n\t\t\targs.addWatchFile(filePath);\n\t\t}\n\t\tfor (const directoryPath of nextTargets.directories) {\n\t\t\targs.addWatchFile(directoryPath);\n\t\t}\n\t} catch (e) {\n\t\tclearReadFiles();\n\t\tfor (const filePath of previouslyReadFiles) {\n\t\t\treadFiles.add(filePath);\n\t\t}\n\t\tstate.previousCompilation = undefined;\n\t\tstate.previousInputsDigest = undefined;\n\t\tstate.virtualModules = new Map();\n\t\tlogger.warn(\"Failed to re-compile project:\", (e as Error).message);\n\t}\n}\n\nfunction updateVirtualModules(\n\tstate: PluginState,\n\targs: CompilerOptions,\n\tresult: CompilationResult\n): void {\n\tstate.absoluteOutdir = path.resolve(process.cwd(), args.outdir);\n\tstate.virtualModules = buildVirtualModules(\n\t\targs.outdir,\n\t\tresult.output,\n\t\tprocess.cwd()\n\t);\n}\n\n/**\n * Resolves an import to a generated paraglide module when present in memory.\n *\n * Only claims ids that resolve to a path under `outdir`. Relative imports from\n * outside outdir (e.g. Svelte's own `./runtime.js`) must not be rewritten.\n */\nexport function resolveVirtualModuleId(args: {\n\tid: string;\n\timporter: string | undefined;\n\tstate: PluginState;\n}): string | undefined {\n\tif (args.state.virtualModules.size === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst bareId = stripQueryAndHash(args.id);\n\tconst candidates: string[] = [];\n\n\tif (path.isAbsolute(bareId)) {\n\t\tcandidates.push(bareId);\n\t} else if (args.importer) {\n\t\tconst importerPath = stripQueryAndHash(args.importer);\n\t\tcandidates.push(path.resolve(path.dirname(importerPath), bareId));\n\t} else {\n\t\tcandidates.push(path.resolve(process.cwd(), bareId));\n\t}\n\n\tconst outdir = nodeNormalizePath(args.state.absoluteOutdir);\n\n\tfor (const candidate of candidates) {\n\t\tconst normalized = nodeNormalizePath(candidate);\n\t\tif (!isPathInsideDirectory(normalized, outdir)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (args.state.virtualModules.has(normalized)) {\n\t\t\treturn normalized;\n\t\t}\n\t\tif (args.state.virtualModules.has(`${normalized}.js`)) {\n\t\t\treturn `${normalized}.js`;\n\t\t}\n\t\tconst indexPath = nodeNormalizePath(path.join(normalized, \"index.js\"));\n\t\tif (\n\t\t\t!normalized.endsWith(\".js\") &&\n\t\t\targs.state.virtualModules.has(indexPath)\n\t\t) {\n\t\t\treturn indexPath;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction isPathInsideDirectory(filePath: string, directory: string): boolean {\n\tconst relativePath = path.relative(directory, filePath);\n\treturn (\n\t\trelativePath === \"\" ||\n\t\t(!relativePath.startsWith(\"..\") && !path.isAbsolute(relativePath))\n\t);\n}\n\nexport function loadVirtualModule(\n\tid: string,\n\tstate: PluginState\n): string | undefined {\n\tconst normalized = nodeNormalizePath(stripQueryAndHash(id));\n\treturn state.virtualModules.get(normalized);\n}\n\nfunction stripQueryAndHash(id: string): string {\n\tconst queryIndex = id.indexOf(\"?\");\n\tconst hashIndex = id.indexOf(\"#\");\n\tlet end = id.length;\n\tif (queryIndex !== -1) end = Math.min(end, queryIndex);\n\tif (hashIndex !== -1) end = Math.min(end, hashIndex);\n\treturn id.slice(0, end);\n}\n\nexport { logger };\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plugin } from "rolldown";
|
|
2
|
+
import type { CompilerOptions } from "../compiler/compiler-options.js";
|
|
3
|
+
/**
|
|
4
|
+
* First-class Rolldown plugin (no unplugin wrapper).
|
|
5
|
+
*
|
|
6
|
+
* Shares compile/watch/digest with the Vite unplugin path and serves
|
|
7
|
+
* generated modules via `resolveId` / `load` when `emitFiles` is
|
|
8
|
+
* `"types"` or `false`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function paraglideRolldownPlugin(options: CompilerOptions): Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/rolldown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAUvE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CA2BxE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PLUGIN_NAME, compileFromBuildStart, compileFromWatchChange, getPluginState, loadVirtualModule, resolveVirtualModuleId, } from "./plugin-core.js";
|
|
2
|
+
/**
|
|
3
|
+
* First-class Rolldown plugin (no unplugin wrapper).
|
|
4
|
+
*
|
|
5
|
+
* Shares compile/watch/digest with the Vite unplugin path and serves
|
|
6
|
+
* generated modules via `resolveId` / `load` when `emitFiles` is
|
|
7
|
+
* `"types"` or `false`.
|
|
8
|
+
*/
|
|
9
|
+
export function paraglideRolldownPlugin(options) {
|
|
10
|
+
const state = getPluginState(options);
|
|
11
|
+
return {
|
|
12
|
+
name: PLUGIN_NAME,
|
|
13
|
+
async buildStart() {
|
|
14
|
+
await compileFromBuildStart({
|
|
15
|
+
compilerOptions: options,
|
|
16
|
+
state,
|
|
17
|
+
addWatchFile: (id) => this.addWatchFile(id),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
async watchChange(changedPath) {
|
|
21
|
+
await compileFromWatchChange({
|
|
22
|
+
compilerOptions: options,
|
|
23
|
+
state,
|
|
24
|
+
changedPath,
|
|
25
|
+
addWatchFile: (id) => this.addWatchFile(id),
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
resolveId(id, importer) {
|
|
29
|
+
return resolveVirtualModuleId({ id, importer, state });
|
|
30
|
+
},
|
|
31
|
+
load(id) {
|
|
32
|
+
return loadVirtualModule(id, state);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=rolldown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.js","sourceRoot":"","sources":["../../src/bundler-plugins/rolldown.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,GACtB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAwB;IAC/D,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,KAAK,CAAC,UAAU;YACf,MAAM,qBAAqB,CAAC;gBAC3B,eAAe,EAAE,OAAO;gBACxB,KAAK;gBACL,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;aAC3C,CAAC,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,WAAW;YAC5B,MAAM,sBAAsB,CAAC;gBAC5B,eAAe,EAAE,OAAO;gBACxB,KAAK;gBACL,WAAW;gBACX,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;aAC3C,CAAC,CAAC;QACJ,CAAC;QACD,SAAS,CAAC,EAAE,EAAE,QAAQ;YACrB,OAAO,sBAAsB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,EAAE;YACN,OAAO,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { Plugin } from \"rolldown\";\nimport type { CompilerOptions } from \"../compiler/compiler-options.js\";\nimport {\n\tPLUGIN_NAME,\n\tcompileFromBuildStart,\n\tcompileFromWatchChange,\n\tgetPluginState,\n\tloadVirtualModule,\n\tresolveVirtualModuleId,\n} from \"./plugin-core.js\";\n\n/**\n * First-class Rolldown plugin (no unplugin wrapper).\n *\n * Shares compile/watch/digest with the Vite unplugin path and serves\n * generated modules via `resolveId` / `load` when `emitFiles` is\n * `\"types\"` or `false`.\n */\nexport function paraglideRolldownPlugin(options: CompilerOptions): Plugin {\n\tconst state = getPluginState(options);\n\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tasync buildStart() {\n\t\t\tawait compileFromBuildStart({\n\t\t\t\tcompilerOptions: options,\n\t\t\t\tstate,\n\t\t\t\taddWatchFile: (id) => this.addWatchFile(id),\n\t\t\t});\n\t\t},\n\t\tasync watchChange(changedPath) {\n\t\t\tawait compileFromWatchChange({\n\t\t\t\tcompilerOptions: options,\n\t\t\t\tstate,\n\t\t\t\tchangedPath,\n\t\t\t\taddWatchFile: (id) => this.addWatchFile(id),\n\t\t\t});\n\t\t},\n\t\tresolveId(id, importer) {\n\t\t\treturn resolveVirtualModuleId({ id, importer, state });\n\t\t},\n\t\tload(id) {\n\t\t\treturn loadVirtualModule(id, state);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.test.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/rolldown.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { beforeEach, expect, test, vi } from "vitest";
|
|
2
|
+
import consola from "consola";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { rolldown } from "rolldown";
|
|
5
|
+
import { createPluginTestFs, defaultPluginCompileOptions, } from "../compiler/test-helpers.js";
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
vi.resetModules();
|
|
8
|
+
consola.mockTypes(() => vi.fn());
|
|
9
|
+
});
|
|
10
|
+
test("rolldown plugin compiles and serves virtual modules without writing js", async () => {
|
|
11
|
+
const { paraglideRolldownPlugin } = await import("./rolldown.js");
|
|
12
|
+
const fs = createPluginTestFs();
|
|
13
|
+
const outdir = "/rolldown-out";
|
|
14
|
+
const plugin = paraglideRolldownPlugin({
|
|
15
|
+
...defaultPluginCompileOptions,
|
|
16
|
+
outdir,
|
|
17
|
+
emitFiles: false,
|
|
18
|
+
fs,
|
|
19
|
+
});
|
|
20
|
+
// Drive buildStart the same way Rolldown would
|
|
21
|
+
await plugin.buildStart?.call({
|
|
22
|
+
addWatchFile: () => { },
|
|
23
|
+
});
|
|
24
|
+
await expect(fs.promises.readFile(path.resolve(outdir, "runtime.js"), "utf8")).rejects.toThrow();
|
|
25
|
+
// Bundle an entry that imports from the virtual outdir
|
|
26
|
+
const entryPath = "/entry.js";
|
|
27
|
+
await fs.promises.writeFile(entryPath, `import { hello } from "${outdir}/messages.js";\nexport default hello;\n`);
|
|
28
|
+
// memfs isn't used by rolldown's real FS — write entry + messages to a
|
|
29
|
+
// temp approach: instead assert resolveId/load from the plugin directly.
|
|
30
|
+
const resolved = plugin.resolveId?.(`${outdir}/messages.js`, entryPath);
|
|
31
|
+
expect(resolved).toBe(path.resolve(outdir, "messages.js"));
|
|
32
|
+
const loaded = plugin.load?.(resolved);
|
|
33
|
+
expect(loaded).toContain("messages/_index.js");
|
|
34
|
+
const indexResolved = plugin.resolveId?.("./messages/_index.js", resolved);
|
|
35
|
+
expect(indexResolved).toBe(path.resolve(outdir, "messages/_index.js"));
|
|
36
|
+
expect(plugin.load?.(indexResolved)).toContain("hello");
|
|
37
|
+
});
|
|
38
|
+
test("rolldown can bundle with emitFiles true using on-disk output", async () => {
|
|
39
|
+
const { paraglideRolldownPlugin } = await import("./rolldown.js");
|
|
40
|
+
const { mkdtemp, writeFile, mkdir, rm, readFile } = await import("node:fs/promises");
|
|
41
|
+
const { tmpdir } = await import("node:os");
|
|
42
|
+
const root = await mkdtemp(path.join(tmpdir(), "paraglide-rolldown-"));
|
|
43
|
+
try {
|
|
44
|
+
const messagesDir = path.join(root, "messages");
|
|
45
|
+
const outdir = path.join(root, "paraglide");
|
|
46
|
+
const entry = path.join(root, "entry.js");
|
|
47
|
+
await mkdir(messagesDir, { recursive: true });
|
|
48
|
+
await writeFile(path.join(messagesDir, "en.json"), JSON.stringify({ hello: "Hello {name}" }));
|
|
49
|
+
await writeFile(path.join(messagesDir, "de.json"), JSON.stringify({ hello: "Hallo {name}" }));
|
|
50
|
+
await writeFile(entry, `import * as m from "./paraglide/messages.js";\nexport const text = m.hello({ name: "Ada" });\n`);
|
|
51
|
+
const plugin = paraglideRolldownPlugin({
|
|
52
|
+
messages: path.join(messagesDir, "{locale}.json"),
|
|
53
|
+
locales: ["en", "de"],
|
|
54
|
+
baseLocale: "en",
|
|
55
|
+
outdir,
|
|
56
|
+
emitFiles: true,
|
|
57
|
+
outputStructure: "locale-modules",
|
|
58
|
+
});
|
|
59
|
+
const bundle = await rolldown({
|
|
60
|
+
input: entry,
|
|
61
|
+
plugins: [plugin],
|
|
62
|
+
});
|
|
63
|
+
const { output } = await bundle.generate({ format: "esm" });
|
|
64
|
+
const code = output.map((chunk) => ("code" in chunk ? chunk.code : "")).join("\n");
|
|
65
|
+
expect(code).toMatch(/Hello|Ada/);
|
|
66
|
+
await expect(readFile(path.join(outdir, "runtime.js"), "utf8")).resolves.toBeTruthy();
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
await rm(root, { recursive: true, force: true });
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=rolldown.test.js.map
|
|
@@ -0,0 +1 @@
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E,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAC3E,IAAI,CACJ,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClC,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACvF,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["import { beforeEach, expect, test, vi } from \"vitest\";\nimport consola from \"consola\";\nimport path from \"node:path\";\nimport { rolldown } from \"rolldown\";\nimport {\n\tcreatePluginTestFs,\n\tdefaultPluginCompileOptions,\n} from \"../compiler/test-helpers.js\";\n\nbeforeEach(() => {\n\tvi.resetModules();\n\tconsola.mockTypes(() => vi.fn());\n});\n\ntest(\"rolldown plugin compiles and serves virtual modules without writing js\", async () => {\n\tconst { paraglideRolldownPlugin } = await import(\"./rolldown.js\");\n\n\tconst fs = createPluginTestFs();\n\tconst outdir = \"/rolldown-out\";\n\n\tconst plugin = paraglideRolldownPlugin({\n\t\t...defaultPluginCompileOptions,\n\t\toutdir,\n\t\temitFiles: false,\n\t\tfs,\n\t});\n\n\t// Drive buildStart the same way Rolldown would\n\tawait (plugin as any).buildStart?.call({\n\t\taddWatchFile: () => {},\n\t});\n\n\tawait expect(\n\t\tfs.promises.readFile(path.resolve(outdir, \"runtime.js\"), \"utf8\")\n\t).rejects.toThrow();\n\n\t// Bundle an entry that imports from the virtual outdir\n\tconst entryPath = \"/entry.js\";\n\tawait fs.promises.writeFile(\n\t\tentryPath,\n\t\t`import { hello } from \"${outdir}/messages.js\";\\nexport default hello;\\n`\n\t);\n\n\t// memfs isn't used by rolldown's real FS — write entry + messages to a\n\t// temp approach: instead assert resolveId/load from the plugin directly.\n\tconst resolved = (plugin as any).resolveId?.(\n\t\t`${outdir}/messages.js`,\n\t\tentryPath\n\t);\n\texpect(resolved).toBe(path.resolve(outdir, \"messages.js\"));\n\tconst loaded = (plugin as any).load?.(resolved);\n\texpect(loaded).toContain(\"messages/_index.js\");\n\n\tconst indexResolved = (plugin as any).resolveId?.(\n\t\t\"./messages/_index.js\",\n\t\tresolved\n\t);\n\texpect(indexResolved).toBe(path.resolve(outdir, \"messages/_index.js\"));\n\texpect((plugin as any).load?.(indexResolved)).toContain(\"hello\");\n});\n\ntest(\"rolldown can bundle with emitFiles true using on-disk output\", async () => {\n\tconst { paraglideRolldownPlugin } = await import(\"./rolldown.js\");\n\tconst { mkdtemp, writeFile, mkdir, rm, readFile } = await import(\n\t\t\"node:fs/promises\"\n\t);\n\tconst { tmpdir } = await import(\"node:os\");\n\n\tconst root = await mkdtemp(path.join(tmpdir(), \"paraglide-rolldown-\"));\n\ttry {\n\t\tconst messagesDir = path.join(root, \"messages\");\n\t\tconst outdir = path.join(root, \"paraglide\");\n\t\tconst entry = path.join(root, \"entry.js\");\n\t\tawait mkdir(messagesDir, { recursive: true });\n\t\tawait writeFile(\n\t\t\tpath.join(messagesDir, \"en.json\"),\n\t\t\tJSON.stringify({ hello: \"Hello {name}\" })\n\t\t);\n\t\tawait writeFile(\n\t\t\tpath.join(messagesDir, \"de.json\"),\n\t\t\tJSON.stringify({ hello: \"Hallo {name}\" })\n\t\t);\n\t\tawait writeFile(\n\t\t\tentry,\n\t\t\t`import * as m from \"./paraglide/messages.js\";\\nexport const text = m.hello({ name: \"Ada\" });\\n`\n\t\t);\n\n\t\tconst plugin = paraglideRolldownPlugin({\n\t\t\tmessages: path.join(messagesDir, \"{locale}.json\"),\n\t\t\tlocales: [\"en\", \"de\"],\n\t\t\tbaseLocale: \"en\",\n\t\t\toutdir,\n\t\t\temitFiles: true,\n\t\t\toutputStructure: \"locale-modules\",\n\t\t});\n\n\t\tconst bundle = await rolldown({\n\t\t\tinput: entry,\n\t\t\tplugins: [plugin],\n\t\t});\n\t\tconst { output } = await bundle.generate({ format: \"esm\" });\n\t\tconst code = output.map((chunk) => (\"code\" in chunk ? chunk.code : \"\")).join(\n\t\t\t\"\\n\"\n\t\t);\n\t\texpect(code).toMatch(/Hello|Ada/);\n\t\tawait expect(readFile(path.join(outdir, \"runtime.js\"), \"utf8\")).resolves.toBeTruthy();\n\t} finally {\n\t\tawait rm(root, { recursive: true, force: true });\n\t}\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const paraglideRollupPlugin: (options: import("../index.js").CompilerOptions) => import("unplugin").RollupPlugin<any>[] | import("unplugin").RollupPlugin<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/rollup.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,mIAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../src/bundler-plugins/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { createRollupPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"./unplugin.js\";\n\nexport const paraglideRollupPlugin = createRollupPlugin(unpluginFactory);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const paraglideRspackPlugin: (options: import("../index.js").CompilerOptions) => RspackPluginInstance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/rspack.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,0EAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.js","sourceRoot":"","sources":["../../src/bundler-plugins/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { createRspackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"./unplugin.js\";\n\nexport const paraglideRspackPlugin = createRspackPlugin(unpluginFactory);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unplugin.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/unplugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAWvE,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,eAAe,CA+D5D,CAAC"}
|