@sebbro/paraglide-lite 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/bin/run.js +4 -0
- package/dist/bundler-plugins/esbuild.d.ts +1 -0
- package/dist/bundler-plugins/esbuild.d.ts.map +1 -0
- package/dist/bundler-plugins/esbuild.js +4 -0
- package/dist/bundler-plugins/esbuild.js.map +1 -0
- package/dist/bundler-plugins/index.d.ts +6 -0
- package/dist/bundler-plugins/index.d.ts.map +1 -0
- package/dist/bundler-plugins/index.js +7 -0
- package/dist/bundler-plugins/index.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.d.ts +19 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.js +85 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.d.ts +2 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.js +53 -0
- package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.d.ts +31 -0
- package/dist/bundler-plugins/lazy-modules/ssr.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.js +42 -0
- package/dist/bundler-plugins/lazy-modules/ssr.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.d.ts +2 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.js +48 -0
- package/dist/bundler-plugins/lazy-modules/ssr.test.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.d.ts +7 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.js +30 -0
- package/dist/bundler-plugins/lazy-modules/virtual-ids.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual.d.ts +86 -0
- package/dist/bundler-plugins/lazy-modules/virtual.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/virtual.js +2 -0
- package/dist/bundler-plugins/lazy-modules/virtual.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.d.ts +18 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.js +328 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.js.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.d.ts +2 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.d.ts.map +1 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.js +45 -0
- package/dist/bundler-plugins/lazy-modules/vite-plugin.test.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/constants.d.ts +2 -0
- package/dist/bundler-plugins/per-locale-build/constants.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/constants.js +3 -0
- package/dist/bundler-plugins/per-locale-build/constants.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/index.d.ts +6 -0
- package/dist/bundler-plugins/per-locale-build/index.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/index.js +43 -0
- package/dist/bundler-plugins/per-locale-build/index.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts +8 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.js +13 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/types.d.ts +4 -0
- package/dist/bundler-plugins/per-locale-build/types.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/types.js +2 -0
- package/dist/bundler-plugins/per-locale-build/types.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts +51 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.js +250 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js +250 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -0
- package/dist/bundler-plugins/plugin-core.d.ts +74 -0
- package/dist/bundler-plugins/plugin-core.d.ts.map +1 -0
- package/dist/bundler-plugins/plugin-core.js +292 -0
- package/dist/bundler-plugins/plugin-core.js.map +1 -0
- package/dist/bundler-plugins/rolldown.d.ts +10 -0
- package/dist/bundler-plugins/rolldown.d.ts.map +1 -0
- package/dist/bundler-plugins/rolldown.js +36 -0
- package/dist/bundler-plugins/rolldown.js.map +1 -0
- package/dist/bundler-plugins/rolldown.test.d.ts +1 -0
- package/dist/bundler-plugins/rolldown.test.d.ts.map +1 -0
- package/dist/bundler-plugins/rolldown.test.js +72 -0
- package/dist/bundler-plugins/rolldown.test.js.map +1 -0
- package/dist/bundler-plugins/rollup.d.ts +1 -0
- package/dist/bundler-plugins/rollup.d.ts.map +1 -0
- package/dist/bundler-plugins/rollup.js +4 -0
- package/dist/bundler-plugins/rollup.js.map +1 -0
- package/dist/bundler-plugins/rspack.d.ts +1 -0
- package/dist/bundler-plugins/rspack.d.ts.map +1 -0
- package/dist/bundler-plugins/rspack.js +4 -0
- package/dist/bundler-plugins/rspack.js.map +1 -0
- package/dist/bundler-plugins/unplugin.d.ts +3 -0
- package/dist/bundler-plugins/unplugin.d.ts.map +1 -0
- package/dist/bundler-plugins/unplugin.js +62 -0
- package/dist/bundler-plugins/unplugin.js.map +1 -0
- package/dist/bundler-plugins/unplugin.test.d.ts +1 -0
- package/dist/bundler-plugins/unplugin.test.d.ts.map +1 -0
- package/dist/bundler-plugins/unplugin.test.js +256 -0
- package/dist/bundler-plugins/unplugin.test.js.map +1 -0
- package/dist/bundler-plugins/virtual-modules.test.d.ts +1 -0
- package/dist/bundler-plugins/virtual-modules.test.d.ts.map +1 -0
- package/dist/bundler-plugins/virtual-modules.test.js +77 -0
- package/dist/bundler-plugins/virtual-modules.test.js.map +1 -0
- package/dist/bundler-plugins/vite.d.ts +17 -0
- package/dist/bundler-plugins/vite.d.ts.map +1 -0
- package/dist/bundler-plugins/vite.js +15 -0
- package/dist/bundler-plugins/vite.js.map +1 -0
- package/dist/bundler-plugins/vite.test.d.ts +1 -0
- package/dist/bundler-plugins/vite.test.d.ts.map +1 -0
- package/dist/bundler-plugins/vite.test.js +61 -0
- package/dist/bundler-plugins/vite.test.js.map +1 -0
- package/dist/bundler-plugins/webpack.d.ts +1 -0
- package/dist/bundler-plugins/webpack.d.ts.map +1 -0
- package/dist/bundler-plugins/webpack.js +4 -0
- package/dist/bundler-plugins/webpack.js.map +1 -0
- package/dist/cli/commands/compile/command.d.ts +2 -0
- package/dist/cli/commands/compile/command.d.ts.map +1 -0
- package/dist/cli/commands/compile/command.js +225 -0
- package/dist/cli/commands/compile/command.js.map +1 -0
- package/dist/cli/commands/compile/command.test.d.ts +1 -0
- package/dist/cli/commands/compile/command.test.d.ts.map +1 -0
- package/dist/cli/commands/compile/command.test.js +69 -0
- package/dist/cli/commands/compile/command.test.js.map +1 -0
- package/dist/cli/commands/init/command.d.ts +2 -0
- package/dist/cli/commands/init/command.d.ts.map +1 -0
- package/dist/cli/commands/init/command.js +90 -0
- package/dist/cli/commands/init/command.js.map +1 -0
- package/dist/cli/defaults.d.ts +11 -0
- package/dist/cli/defaults.d.ts.map +1 -0
- package/dist/cli/defaults.js +13 -0
- package/dist/cli/defaults.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/steps/add-vite-plugin.d.ts +31 -0
- package/dist/cli/steps/add-vite-plugin.d.ts.map +1 -0
- package/dist/cli/steps/add-vite-plugin.js +65 -0
- package/dist/cli/steps/add-vite-plugin.js.map +1 -0
- package/dist/cli/steps/add-vite-plugin.test.d.ts +1 -0
- package/dist/cli/steps/add-vite-plugin.test.d.ts.map +1 -0
- package/dist/cli/steps/add-vite-plugin.test.js +74 -0
- package/dist/cli/steps/add-vite-plugin.test.js.map +1 -0
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts +5 -0
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -0
- package/dist/cli/steps/check-for-uncomitted-changes.js +37 -0
- package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -0
- package/dist/cli/steps/detect-bundler.d.ts +10 -0
- package/dist/cli/steps/detect-bundler.d.ts.map +1 -0
- package/dist/cli/steps/detect-bundler.js +22 -0
- package/dist/cli/steps/detect-bundler.js.map +1 -0
- package/dist/cli/steps/detect-bundler.test.d.ts +1 -0
- package/dist/cli/steps/detect-bundler.test.d.ts.map +1 -0
- package/dist/cli/steps/detect-bundler.test.js +29 -0
- package/dist/cli/steps/detect-bundler.test.js.map +1 -0
- package/dist/cli/steps/initialize-messages.d.ts +11 -0
- package/dist/cli/steps/initialize-messages.d.ts.map +1 -0
- package/dist/cli/steps/initialize-messages.js +31 -0
- package/dist/cli/steps/initialize-messages.js.map +1 -0
- package/dist/cli/steps/prompt-for-outdir.d.ts +8 -0
- package/dist/cli/steps/prompt-for-outdir.d.ts.map +1 -0
- package/dist/cli/steps/prompt-for-outdir.js +19 -0
- package/dist/cli/steps/prompt-for-outdir.js.map +1 -0
- package/dist/cli/steps/update-package-json.d.ts +11 -0
- package/dist/cli/steps/update-package-json.d.ts.map +1 -0
- package/dist/cli/steps/update-package-json.js +34 -0
- package/dist/cli/steps/update-package-json.js.map +1 -0
- package/dist/cli/steps/update-ts-config.d.ts +26 -0
- package/dist/cli/steps/update-ts-config.d.ts.map +1 -0
- package/dist/cli/steps/update-ts-config.js +270 -0
- package/dist/cli/steps/update-ts-config.js.map +1 -0
- package/dist/cli/steps/update-ts-config.test.d.ts +1 -0
- package/dist/cli/steps/update-ts-config.test.d.ts.map +1 -0
- package/dist/cli/steps/update-ts-config.test.js +60 -0
- package/dist/cli/steps/update-ts-config.test.js.map +1 -0
- package/dist/cli/utils.d.ts +36 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +20 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/compiler/assert-url-pattern-available.d.ts +7 -0
- package/dist/compiler/assert-url-pattern-available.d.ts.map +1 -0
- package/dist/compiler/assert-url-pattern-available.js +17 -0
- package/dist/compiler/assert-url-pattern-available.js.map +1 -0
- package/dist/compiler/compile-annotation.d.ts +12 -0
- package/dist/compiler/compile-annotation.d.ts.map +1 -0
- package/dist/compiler/compile-annotation.js +136 -0
- package/dist/compiler/compile-annotation.js.map +1 -0
- package/dist/compiler/compile-bundle.d.ts +28 -0
- package/dist/compiler/compile-bundle.d.ts.map +1 -0
- package/dist/compiler/compile-bundle.js +431 -0
- package/dist/compiler/compile-bundle.js.map +1 -0
- package/dist/compiler/compile-bundle.test.d.ts +1 -0
- package/dist/compiler/compile-bundle.test.d.ts.map +1 -0
- package/dist/compiler/compile-bundle.test.js +399 -0
- package/dist/compiler/compile-bundle.test.js.map +1 -0
- package/dist/compiler/compile-local-variable.d.ts +16 -0
- package/dist/compiler/compile-local-variable.d.ts.map +1 -0
- package/dist/compiler/compile-local-variable.js +28 -0
- package/dist/compiler/compile-local-variable.js.map +1 -0
- package/dist/compiler/compile-local-variable.test.d.ts +1 -0
- package/dist/compiler/compile-local-variable.test.d.ts.map +1 -0
- package/dist/compiler/compile-local-variable.test.js +359 -0
- package/dist/compiler/compile-local-variable.test.js.map +1 -0
- package/dist/compiler/compile-message.d.ts +8 -0
- package/dist/compiler/compile-message.d.ts.map +1 -0
- package/dist/compiler/compile-message.js +174 -0
- package/dist/compiler/compile-message.js.map +1 -0
- package/dist/compiler/compile-message.test.d.ts +1 -0
- package/dist/compiler/compile-message.test.d.ts.map +1 -0
- package/dist/compiler/compile-message.test.js +1060 -0
- package/dist/compiler/compile-message.test.js.map +1 -0
- package/dist/compiler/compile-pattern.d.ts +29 -0
- package/dist/compiler/compile-pattern.d.ts.map +1 -0
- package/dist/compiler/compile-pattern.js +143 -0
- package/dist/compiler/compile-pattern.js.map +1 -0
- package/dist/compiler/compile-pattern.test.d.ts +1 -0
- package/dist/compiler/compile-pattern.test.d.ts.map +1 -0
- package/dist/compiler/compile-pattern.test.js +255 -0
- package/dist/compiler/compile-pattern.test.js.map +1 -0
- package/dist/compiler/compile-project.d.ts +21 -0
- package/dist/compiler/compile-project.d.ts.map +1 -0
- package/dist/compiler/compile-project.js +147 -0
- package/dist/compiler/compile-project.js.map +1 -0
- package/dist/compiler/compile-project.test.d.ts +1 -0
- package/dist/compiler/compile-project.test.d.ts.map +1 -0
- package/dist/compiler/compile-project.test.js +1709 -0
- package/dist/compiler/compile-project.test.js.map +1 -0
- package/dist/compiler/compile.bench.d.ts +1 -0
- package/dist/compiler/compile.bench.d.ts.map +1 -0
- package/dist/compiler/compile.bench.js +89 -0
- package/dist/compiler/compile.bench.js.map +1 -0
- package/dist/compiler/compile.d.ts +24 -0
- package/dist/compiler/compile.d.ts.map +1 -0
- package/dist/compiler/compile.js +106 -0
- package/dist/compiler/compile.js.map +1 -0
- package/dist/compiler/compile.test.d.ts +1 -0
- package/dist/compiler/compile.test.d.ts.map +1 -0
- package/dist/compiler/compile.test.js +66 -0
- package/dist/compiler/compile.test.js.map +1 -0
- package/dist/compiler/compiler-options.d.ts +466 -0
- package/dist/compiler/compiler-options.d.ts.map +1 -0
- package/dist/compiler/compiler-options.js +22 -0
- package/dist/compiler/compiler-options.js.map +1 -0
- package/dist/compiler/create-paraglide.d.ts +21 -0
- package/dist/compiler/create-paraglide.d.ts.map +1 -0
- package/dist/compiler/create-paraglide.js +69 -0
- package/dist/compiler/create-paraglide.js.map +1 -0
- package/dist/compiler/create-paraglide.test.d.ts +1 -0
- package/dist/compiler/create-paraglide.test.d.ts.map +1 -0
- package/dist/compiler/create-paraglide.test.js +55 -0
- package/dist/compiler/create-paraglide.test.js.map +1 -0
- package/dist/compiler/create-readme.d.ts +9 -0
- package/dist/compiler/create-readme.d.ts.map +1 -0
- package/dist/compiler/create-readme.js +127 -0
- package/dist/compiler/create-readme.js.map +1 -0
- package/dist/compiler/emit-files.d.ts +15 -0
- package/dist/compiler/emit-files.d.ts.map +1 -0
- package/dist/compiler/emit-files.js +58 -0
- package/dist/compiler/emit-files.js.map +1 -0
- package/dist/compiler/emit-files.test.d.ts +1 -0
- package/dist/compiler/emit-files.test.d.ts.map +1 -0
- package/dist/compiler/emit-files.test.js +43 -0
- package/dist/compiler/emit-files.test.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.d.ts +11 -0
- package/dist/compiler/emit-ts-declarations.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.interop.test.js +33 -0
- package/dist/compiler/emit-ts-declarations.interop.test.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.js +353 -0
- package/dist/compiler/emit-ts-declarations.js.map +1 -0
- package/dist/compiler/emit-ts-declarations.test.d.ts +1 -0
- package/dist/compiler/emit-ts-declarations.test.d.ts.map +1 -0
- package/dist/compiler/emit-ts-declarations.test.js +161 -0
- package/dist/compiler/emit-ts-declarations.test.js.map +1 -0
- package/dist/compiler/index.d.ts +13 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/jsdoc-types.d.ts +21 -0
- package/dist/compiler/jsdoc-types.d.ts.map +1 -0
- package/dist/compiler/jsdoc-types.js +59 -0
- package/dist/compiler/jsdoc-types.js.map +1 -0
- package/dist/compiler/jsdoc-types.test.d.ts +1 -0
- package/dist/compiler/jsdoc-types.test.d.ts.map +1 -0
- package/dist/compiler/jsdoc-types.test.js +100 -0
- package/dist/compiler/jsdoc-types.test.js.map +1 -0
- package/dist/compiler/lazy-modules/compile-cache.d.ts +37 -0
- package/dist/compiler/lazy-modules/compile-cache.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/compile-cache.js +34 -0
- package/dist/compiler/lazy-modules/compile-cache.js.map +1 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.d.ts +2 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.js +65 -0
- package/dist/compiler/lazy-modules/compile-project.lazy.test.js.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.d.ts +18 -0
- package/dist/compiler/lazy-modules/create-loader.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.js +182 -0
- package/dist/compiler/lazy-modules/create-loader.js.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.test.d.ts +2 -0
- package/dist/compiler/lazy-modules/create-loader.test.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/create-loader.test.js +82 -0
- package/dist/compiler/lazy-modules/create-loader.test.js.map +1 -0
- package/dist/compiler/lazy-modules/manifest.d.ts +32 -0
- package/dist/compiler/lazy-modules/manifest.d.ts.map +1 -0
- package/dist/compiler/lazy-modules/manifest.js +11 -0
- package/dist/compiler/lazy-modules/manifest.js.map +1 -0
- package/dist/compiler/match-literals.d.ts +2 -0
- package/dist/compiler/match-literals.d.ts.map +1 -0
- package/dist/compiler/match-literals.js +42 -0
- package/dist/compiler/match-literals.js.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.d.ts +27 -0
- package/dist/compiler/output-structure/lazy-modules.d.ts.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.js +157 -0
- package/dist/compiler/output-structure/lazy-modules.js.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.test.d.ts +2 -0
- package/dist/compiler/output-structure/lazy-modules.test.d.ts.map +1 -0
- package/dist/compiler/output-structure/lazy-modules.test.js +128 -0
- package/dist/compiler/output-structure/lazy-modules.test.js.map +1 -0
- package/dist/compiler/output-structure/locale-modules.d.ts +4 -0
- package/dist/compiler/output-structure/locale-modules.d.ts.map +1 -0
- package/dist/compiler/output-structure/locale-modules.js +81 -0
- package/dist/compiler/output-structure/locale-modules.js.map +1 -0
- package/dist/compiler/output-structure/locale-modules.test.d.ts +1 -0
- package/dist/compiler/output-structure/locale-modules.test.d.ts.map +1 -0
- package/dist/compiler/output-structure/locale-modules.test.js +163 -0
- package/dist/compiler/output-structure/locale-modules.test.js.map +1 -0
- package/dist/compiler/output-structure/message-modules.d.ts +4 -0
- package/dist/compiler/output-structure/message-modules.d.ts.map +1 -0
- package/dist/compiler/output-structure/message-modules.js +100 -0
- package/dist/compiler/output-structure/message-modules.js.map +1 -0
- package/dist/compiler/output-structure/message-modules.test.d.ts +1 -0
- package/dist/compiler/output-structure/message-modules.test.d.ts.map +1 -0
- package/dist/compiler/output-structure/message-modules.test.js +148 -0
- package/dist/compiler/output-structure/message-modules.test.js.map +1 -0
- package/dist/compiler/per-locale-build.d.ts +2 -0
- package/dist/compiler/per-locale-build.d.ts.map +1 -0
- package/dist/compiler/per-locale-build.js +3 -0
- package/dist/compiler/per-locale-build.js.map +1 -0
- package/dist/compiler/registry.d.ts +13 -0
- package/dist/compiler/registry.d.ts.map +1 -0
- package/dist/compiler/registry.js +60 -0
- package/dist/compiler/registry.js.map +1 -0
- package/dist/compiler/resolve-tsc-js-path.d.ts +9 -0
- package/dist/compiler/resolve-tsc-js-path.d.ts.map +1 -0
- package/dist/compiler/resolve-tsc-js-path.js +23 -0
- package/dist/compiler/resolve-tsc-js-path.js.map +1 -0
- package/dist/compiler/runtime/check-locale.d.ts +31 -0
- package/dist/compiler/runtime/check-locale.d.ts.map +1 -0
- package/dist/compiler/runtime/check-locale.js +51 -0
- package/dist/compiler/runtime/check-locale.js.map +1 -0
- package/dist/compiler/runtime/check-locale.test.d.ts +1 -0
- package/dist/compiler/runtime/check-locale.test.d.ts.map +1 -0
- package/dist/compiler/runtime/check-locale.test.js +84 -0
- package/dist/compiler/runtime/check-locale.test.js.map +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts +35 -0
- package/dist/compiler/runtime/create-runtime.d.ts.map +1 -0
- package/dist/compiler/runtime/create-runtime.js +196 -0
- package/dist/compiler/runtime/create-runtime.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts +13 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.js +43 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js +149 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.d.ts +13 -0
- package/dist/compiler/runtime/extract-locale-from-header.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.js +45 -0
- package/dist/compiler/runtime/extract-locale-from-header.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.js +55 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts +12 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.js +33 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.js +45 -0
- package/dist/compiler/runtime/extract-locale-from-navigator.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts +34 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.js +70 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.js +119 -0
- package/dist/compiler/runtime/extract-locale-from-request-async.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.d.ts +41 -0
- package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.js +96 -0
- package/dist/compiler/runtime/extract-locale-from-request.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.js +351 -0
- package/dist/compiler/runtime/extract-locale-from-request.test.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.d.ts +11 -0
- package/dist/compiler/runtime/extract-locale-from-url.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.js +68 -0
- package/dist/compiler/runtime/extract-locale-from-url.js.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.d.ts +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.d.ts.map +1 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.js +127 -0
- package/dist/compiler/runtime/extract-locale-from-url.test.js.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts +44 -0
- package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.js +133 -0
- package/dist/compiler/runtime/generate-static-localized-urls.js.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts.map +1 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.js +159 -0
- package/dist/compiler/runtime/generate-static-localized-urls.test.js.map +1 -0
- package/dist/compiler/runtime/get-locale.d.ts +42 -0
- package/dist/compiler/runtime/get-locale.d.ts.map +1 -0
- package/dist/compiler/runtime/get-locale.js +158 -0
- package/dist/compiler/runtime/get-locale.js.map +1 -0
- package/dist/compiler/runtime/get-locale.test.d.ts +1 -0
- package/dist/compiler/runtime/get-locale.test.d.ts.map +1 -0
- package/dist/compiler/runtime/get-locale.test.js +295 -0
- package/dist/compiler/runtime/get-locale.test.js.map +1 -0
- package/dist/compiler/runtime/get-text-direction.d.ts +15 -0
- package/dist/compiler/runtime/get-text-direction.d.ts.map +1 -0
- package/dist/compiler/runtime/get-text-direction.js +46 -0
- package/dist/compiler/runtime/get-text-direction.js.map +1 -0
- package/dist/compiler/runtime/get-text-direction.test.d.ts +1 -0
- package/dist/compiler/runtime/get-text-direction.test.d.ts.map +1 -0
- package/dist/compiler/runtime/get-text-direction.test.js +40 -0
- package/dist/compiler/runtime/get-text-direction.test.js.map +1 -0
- package/dist/compiler/runtime/get-url-origin.d.ts +19 -0
- package/dist/compiler/runtime/get-url-origin.d.ts.map +1 -0
- package/dist/compiler/runtime/get-url-origin.js +31 -0
- package/dist/compiler/runtime/get-url-origin.js.map +1 -0
- package/dist/compiler/runtime/get-url-origin.test.d.ts +1 -0
- package/dist/compiler/runtime/get-url-origin.test.d.ts.map +1 -0
- package/dist/compiler/runtime/get-url-origin.test.js +18 -0
- package/dist/compiler/runtime/get-url-origin.test.js.map +1 -0
- package/dist/compiler/runtime/host-routing.d.ts +28 -0
- package/dist/compiler/runtime/host-routing.d.ts.map +1 -0
- package/dist/compiler/runtime/host-routing.js +79 -0
- package/dist/compiler/runtime/host-routing.js.map +1 -0
- package/dist/compiler/runtime/host-routing.test.d.ts +1 -0
- package/dist/compiler/runtime/host-routing.test.d.ts.map +1 -0
- package/dist/compiler/runtime/host-routing.test.js +128 -0
- package/dist/compiler/runtime/host-routing.test.js.map +1 -0
- package/dist/compiler/runtime/localize-href.d.ts +84 -0
- package/dist/compiler/runtime/localize-href.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-href.js +115 -0
- package/dist/compiler/runtime/localize-href.js.map +1 -0
- package/dist/compiler/runtime/localize-href.test.d.ts +1 -0
- package/dist/compiler/runtime/localize-href.test.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-href.test.js +139 -0
- package/dist/compiler/runtime/localize-href.test.js.map +1 -0
- package/dist/compiler/runtime/localize-url.d.ts +95 -0
- package/dist/compiler/runtime/localize-url.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-url.js +327 -0
- package/dist/compiler/runtime/localize-url.js.map +1 -0
- package/dist/compiler/runtime/localize-url.test.d.ts +1 -0
- package/dist/compiler/runtime/localize-url.test.d.ts.map +1 -0
- package/dist/compiler/runtime/localize-url.test.js +533 -0
- package/dist/compiler/runtime/localize-url.test.js.map +1 -0
- package/dist/compiler/runtime/route-strategy.d.ts +32 -0
- package/dist/compiler/runtime/route-strategy.d.ts.map +1 -0
- package/dist/compiler/runtime/route-strategy.js +72 -0
- package/dist/compiler/runtime/route-strategy.js.map +1 -0
- package/dist/compiler/runtime/set-locale.d.ts +46 -0
- package/dist/compiler/runtime/set-locale.d.ts.map +1 -0
- package/dist/compiler/runtime/set-locale.js +172 -0
- package/dist/compiler/runtime/set-locale.js.map +1 -0
- package/dist/compiler/runtime/set-locale.test.d.ts +1 -0
- package/dist/compiler/runtime/set-locale.test.d.ts.map +1 -0
- package/dist/compiler/runtime/set-locale.test.js +555 -0
- package/dist/compiler/runtime/set-locale.test.js.map +1 -0
- package/dist/compiler/runtime/should-redirect.d.ts +100 -0
- package/dist/compiler/runtime/should-redirect.d.ts.map +1 -0
- package/dist/compiler/runtime/should-redirect.js +155 -0
- package/dist/compiler/runtime/should-redirect.js.map +1 -0
- package/dist/compiler/runtime/should-redirect.test.d.ts +1 -0
- package/dist/compiler/runtime/should-redirect.test.d.ts.map +1 -0
- package/dist/compiler/runtime/should-redirect.test.js +270 -0
- package/dist/compiler/runtime/should-redirect.test.js.map +1 -0
- package/dist/compiler/runtime/strategy.d.ts +63 -0
- package/dist/compiler/runtime/strategy.d.ts.map +1 -0
- package/dist/compiler/runtime/strategy.js +65 -0
- package/dist/compiler/runtime/strategy.js.map +1 -0
- package/dist/compiler/runtime/strategy.test.d.ts +1 -0
- package/dist/compiler/runtime/strategy.test.d.ts.map +1 -0
- package/dist/compiler/runtime/strategy.test.js +90 -0
- package/dist/compiler/runtime/strategy.test.js.map +1 -0
- package/dist/compiler/runtime/track-message-call.d.ts +5 -0
- package/dist/compiler/runtime/track-message-call.d.ts.map +1 -0
- package/dist/compiler/runtime/track-message-call.js +14 -0
- package/dist/compiler/runtime/track-message-call.js.map +1 -0
- package/dist/compiler/runtime/track-message-call.test.d.ts +1 -0
- package/dist/compiler/runtime/track-message-call.test.d.ts.map +1 -0
- package/dist/compiler/runtime/track-message-call.test.js +22 -0
- package/dist/compiler/runtime/track-message-call.test.js.map +1 -0
- package/dist/compiler/runtime/type-definitions.d.ts +197 -0
- package/dist/compiler/runtime/type-definitions.d.ts.map +1 -0
- package/dist/compiler/runtime/type-definitions.js +150 -0
- package/dist/compiler/runtime/type-definitions.js.map +1 -0
- package/dist/compiler/runtime/type.d.ts +47 -0
- package/dist/compiler/runtime/type.d.ts.map +1 -0
- package/dist/compiler/runtime/type.js +2 -0
- package/dist/compiler/runtime/type.js.map +1 -0
- package/dist/compiler/runtime/type.test.d.ts +1 -0
- package/dist/compiler/runtime/type.test.d.ts.map +1 -0
- package/dist/compiler/runtime/type.test.js +153 -0
- package/dist/compiler/runtime/type.test.js.map +1 -0
- package/dist/compiler/runtime/url-pattern.d.ts +12 -0
- package/dist/compiler/runtime/url-pattern.d.ts.map +1 -0
- package/dist/compiler/runtime/url-pattern.js +35 -0
- package/dist/compiler/runtime/url-pattern.js.map +1 -0
- package/dist/compiler/runtime/variables.d.ts +128 -0
- package/dist/compiler/runtime/variables.d.ts.map +1 -0
- package/dist/compiler/runtime/variables.js +111 -0
- package/dist/compiler/runtime/variables.js.map +1 -0
- package/dist/compiler/safe-module-id.d.ts +7 -0
- package/dist/compiler/safe-module-id.d.ts.map +1 -0
- package/dist/compiler/safe-module-id.js +78 -0
- package/dist/compiler/safe-module-id.js.map +1 -0
- package/dist/compiler/safe-module-id.test.d.ts +1 -0
- package/dist/compiler/safe-module-id.test.d.ts.map +1 -0
- package/dist/compiler/safe-module-id.test.js +36 -0
- package/dist/compiler/safe-module-id.test.js.map +1 -0
- package/dist/compiler/seed-previous-compilation.d.ts +7 -0
- package/dist/compiler/seed-previous-compilation.d.ts.map +1 -0
- package/dist/compiler/seed-previous-compilation.js +9 -0
- package/dist/compiler/seed-previous-compilation.js.map +1 -0
- package/dist/compiler/server/create-server-file.d.ts +12 -0
- package/dist/compiler/server/create-server-file.d.ts.map +1 -0
- package/dist/compiler/server/create-server-file.js +91 -0
- package/dist/compiler/server/create-server-file.js.map +1 -0
- package/dist/compiler/server/create-server-file.test.d.ts +1 -0
- package/dist/compiler/server/create-server-file.test.d.ts.map +1 -0
- package/dist/compiler/server/create-server-file.test.js +48 -0
- package/dist/compiler/server/create-server-file.test.js.map +1 -0
- package/dist/compiler/server/middleware.d.ts +98 -0
- package/dist/compiler/server/middleware.d.ts.map +1 -0
- package/dist/compiler/server/middleware.js +278 -0
- package/dist/compiler/server/middleware.js.map +1 -0
- package/dist/compiler/server/middleware.test.d.ts +1 -0
- package/dist/compiler/server/middleware.test.d.ts.map +1 -0
- package/dist/compiler/server/middleware.test.js +1001 -0
- package/dist/compiler/server/middleware.test.js.map +1 -0
- package/dist/compiler/server/type.d.ts +6 -0
- package/dist/compiler/server/type.d.ts.map +1 -0
- package/dist/compiler/server/type.js +2 -0
- package/dist/compiler/server/type.js.map +1 -0
- package/dist/compiler/test-helpers.d.ts +30 -0
- package/dist/compiler/test-helpers.d.ts.map +1 -0
- package/dist/compiler/test-helpers.js +50 -0
- package/dist/compiler/test-helpers.js.map +1 -0
- package/dist/compiler/types.d.ts +7 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +2 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/compiler/variable-access.d.ts +3 -0
- package/dist/compiler/variable-access.d.ts.map +1 -0
- package/dist/compiler/variable-access.js +15 -0
- package/dist/compiler/variable-access.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/ast.d.ts +102 -0
- package/dist/messages/ast.d.ts.map +1 -0
- package/dist/messages/ast.js +8 -0
- package/dist/messages/ast.js.map +1 -0
- package/dist/messages/create-bundle-nested.d.ts +16 -0
- package/dist/messages/create-bundle-nested.d.ts.map +1 -0
- package/dist/messages/create-bundle-nested.js +22 -0
- package/dist/messages/create-bundle-nested.js.map +1 -0
- package/dist/messages/index.d.ts +5 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +5 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/load-messages.d.ts +19 -0
- package/dist/messages/load-messages.d.ts.map +1 -0
- package/dist/messages/load-messages.js +49 -0
- package/dist/messages/load-messages.js.map +1 -0
- package/dist/messages/message-format/flatten.d.ts +9 -0
- package/dist/messages/message-format/flatten.d.ts.map +1 -0
- package/dist/messages/message-format/flatten.js +32 -0
- package/dist/messages/message-format/flatten.js.map +1 -0
- package/dist/messages/message-format/import-files.d.ts +32 -0
- package/dist/messages/message-format/import-files.d.ts.map +1 -0
- package/dist/messages/message-format/import-files.js +53 -0
- package/dist/messages/message-format/import-files.js.map +1 -0
- package/dist/messages/message-format/import-files.test.d.ts +1 -0
- package/dist/messages/message-format/import-files.test.d.ts.map +1 -0
- package/dist/messages/message-format/import-files.test.js +145 -0
- package/dist/messages/message-format/import-files.test.js.map +1 -0
- package/dist/messages/message-format/index.d.ts +6 -0
- package/dist/messages/message-format/index.d.ts.map +1 -0
- package/dist/messages/message-format/index.js +7 -0
- package/dist/messages/message-format/index.js.map +1 -0
- package/dist/messages/message-format/parse-bundle.d.ts +31 -0
- package/dist/messages/message-format/parse-bundle.d.ts.map +1 -0
- package/dist/messages/message-format/parse-bundle.js +169 -0
- package/dist/messages/message-format/parse-bundle.js.map +1 -0
- package/dist/messages/message-format/parse-declaration.d.ts +2 -0
- package/dist/messages/message-format/parse-declaration.d.ts.map +1 -0
- package/dist/messages/message-format/parse-declaration.js +56 -0
- package/dist/messages/message-format/parse-declaration.js.map +1 -0
- package/dist/messages/message-format/parse-markup.d.ts +4 -0
- package/dist/messages/message-format/parse-markup.d.ts.map +1 -0
- package/dist/messages/message-format/parse-markup.js +167 -0
- package/dist/messages/message-format/parse-markup.js.map +1 -0
- package/dist/messages/message-format/parse-matches.d.ts +5 -0
- package/dist/messages/message-format/parse-matches.d.ts.map +1 -0
- package/dist/messages/message-format/parse-matches.js +31 -0
- package/dist/messages/message-format/parse-matches.js.map +1 -0
- package/dist/messages/message-format/parse-pattern.d.ts +5 -0
- package/dist/messages/message-format/parse-pattern.d.ts.map +1 -0
- package/dist/messages/message-format/parse-pattern.js +120 -0
- package/dist/messages/message-format/parse-pattern.js.map +1 -0
- package/dist/messages/message-format/unique.d.ts +2 -0
- package/dist/messages/message-format/unique.d.ts.map +1 -0
- package/dist/messages/message-format/unique.js +5 -0
- package/dist/messages/message-format/unique.js.map +1 -0
- package/dist/messages/nest-bundles.d.ts +19 -0
- package/dist/messages/nest-bundles.d.ts.map +1 -0
- package/dist/messages/nest-bundles.js +49 -0
- package/dist/messages/nest-bundles.js.map +1 -0
- package/dist/services/account/index.d.ts +14 -0
- package/dist/services/account/index.d.ts.map +1 -0
- package/dist/services/account/index.js +43 -0
- package/dist/services/account/index.js.map +1 -0
- package/dist/services/account/types.d.ts +4 -0
- package/dist/services/account/types.d.ts.map +1 -0
- package/dist/services/account/types.js +2 -0
- package/dist/services/account/types.js.map +1 -0
- package/dist/services/codegen/escape.d.ts +9 -0
- package/dist/services/codegen/escape.d.ts.map +1 -0
- package/dist/services/codegen/escape.js +19 -0
- package/dist/services/codegen/escape.js.map +1 -0
- package/dist/services/codegen/quotes.d.ts +4 -0
- package/dist/services/codegen/quotes.d.ts.map +1 -0
- package/dist/services/codegen/quotes.js +5 -0
- package/dist/services/codegen/quotes.js.map +1 -0
- package/dist/services/env-variables/create-index-file.d.ts +9 -0
- package/dist/services/env-variables/create-index-file.d.ts.map +1 -0
- package/dist/services/env-variables/create-index-file.js +28 -0
- package/dist/services/env-variables/create-index-file.js.map +1 -0
- package/dist/services/env-variables/index.d.ts +3 -0
- package/dist/services/env-variables/index.d.ts.map +1 -0
- package/dist/services/env-variables/index.js +4 -0
- package/dist/services/env-variables/index.js.map +1 -0
- package/dist/services/environment/package.d.ts +9 -0
- package/dist/services/environment/package.d.ts.map +1 -0
- package/dist/services/environment/package.js +31 -0
- package/dist/services/environment/package.js.map +1 -0
- package/dist/services/environment/package.test.d.ts +1 -0
- package/dist/services/environment/package.test.d.ts.map +1 -0
- package/dist/services/environment/package.test.js +21 -0
- package/dist/services/environment/package.test.js.map +1 -0
- package/dist/services/error-handling.d.ts +12 -0
- package/dist/services/error-handling.d.ts.map +1 -0
- package/dist/services/error-handling.js +27 -0
- package/dist/services/error-handling.js.map +1 -0
- package/dist/services/error-handling.test.d.ts +1 -0
- package/dist/services/error-handling.test.d.ts.map +1 -0
- package/dist/services/error-handling.test.js +10 -0
- package/dist/services/error-handling.test.js.map +1 -0
- package/dist/services/file-handling/content-hash.d.ts +9 -0
- package/dist/services/file-handling/content-hash.js +19 -0
- package/dist/services/file-handling/content-hash.js.map +1 -0
- package/dist/services/file-handling/exists.d.ts +7 -0
- package/dist/services/file-handling/exists.d.ts.map +1 -0
- package/dist/services/file-handling/exists.js +24 -0
- package/dist/services/file-handling/exists.js.map +1 -0
- package/dist/services/file-handling/exists.test.d.ts +1 -0
- package/dist/services/file-handling/exists.test.d.ts.map +1 -0
- package/dist/services/file-handling/exists.test.js +27 -0
- package/dist/services/file-handling/exists.test.js.map +1 -0
- package/dist/services/file-handling/types.d.ts +4 -0
- package/dist/services/file-handling/types.d.ts.map +1 -0
- package/dist/services/file-handling/types.js +2 -0
- package/dist/services/file-handling/types.js.map +1 -0
- package/dist/services/file-handling/write-output.d.ts +21 -0
- package/dist/services/file-handling/write-output.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.js +157 -0
- package/dist/services/file-handling/write-output.js.map +1 -0
- package/dist/services/file-handling/write-output.test.d.ts +1 -0
- package/dist/services/file-handling/write-output.test.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.test.js +217 -0
- package/dist/services/file-handling/write-output.test.js.map +1 -0
- package/dist/services/file-watching/tracked-fs.d.ts +25 -0
- package/dist/services/file-watching/tracked-fs.d.ts.map +1 -0
- package/dist/services/file-watching/tracked-fs.js +94 -0
- package/dist/services/file-watching/tracked-fs.js.map +1 -0
- package/dist/services/file-watching/tracked-fs.test.d.ts +1 -0
- package/dist/services/file-watching/tracked-fs.test.d.ts.map +1 -0
- package/dist/services/file-watching/tracked-fs.test.js +87 -0
- package/dist/services/file-watching/tracked-fs.test.js.map +1 -0
- package/dist/services/logger/index.d.ts +17 -0
- package/dist/services/logger/index.d.ts.map +1 -0
- package/dist/services/logger/index.js +58 -0
- package/dist/services/logger/index.js.map +1 -0
- package/dist/services/lookup.d.ts +14 -0
- package/dist/services/lookup.d.ts.map +1 -0
- package/dist/services/lookup.js +24 -0
- package/dist/services/lookup.js.map +1 -0
- package/dist/urlpattern-polyfill/index.d.ts +2 -0
- package/dist/urlpattern-polyfill/index.d.ts.map +1 -0
- package/dist/urlpattern-polyfill/index.js +2 -0
- package/dist/urlpattern-polyfill/index.js.map +1 -0
- package/dist/utilities/detect-json-formatting.d.ts +10 -0
- package/dist/utilities/detect-json-formatting.d.ts.map +1 -0
- package/dist/utilities/detect-json-formatting.js +80 -0
- package/dist/utilities/detect-json-formatting.js.map +1 -0
- package/dist/utilities/node-normalize-path.d.ts +1 -0
- package/dist/utilities/node-normalize-path.d.ts.map +1 -0
- package/dist/utilities/node-normalize-path.js +10 -0
- package/dist/utilities/node-normalize-path.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-bundle.js","sourceRoot":"","sources":["../../../src/messages/message-format/parse-bundle.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBrC,MAAM,UAAU,WAAW,CAC1B,GAAW,EACX,MAAc,EACd,KAAc;IAEd,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7D,sCAAsC,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAC3C,CAAC,QAAQ,EAAE,EAAE,CACZ,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS,CACjE,CAAC;IACF,KAAK,MAAM,kBAAkB,IAAI,mBAAmB,EAAE,CAAC;QACt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claration,\n\tMatch,\n\tPattern,\n\tVariableReference,\n} from \"../ast.js\";\nimport { parseDeclaration } from \"./parse-declaration.js\";\nimport { parseMatches } from \"./parse-matches.js\";\nimport { parsePattern } from \"./parse-pattern.js\";\nimport { unique } from \"./unique.js\";\n\nexport type FlatVariant = {\n\tmessageBundleId: string;\n\tmessageLocale: string;\n\tmatches: Match[];\n\tpattern: Pattern;\n};\n\nexport type ParsedBundle = {\n\tbundle: {\n\t\tid: string;\n\t\tdeclarations: Declaration[];\n\t};\n\tmessage: {\n\t\tbundleId: string;\n\t\tselectors: VariableReference[];\n\t\tlocale: string;\n\t};\n\tvariants: FlatVariant[];\n};\n\nexport function parseBundle(\n\tkey: string,\n\tlocale: string,\n\tvalue: unknown\n): ParsedBundle {\n\tconst parsed = parseVariants(key, locale, value);\n\tconst declarations = uniqueDeclarations(parsed.declarations);\n\taddInputDeclarationsForLocalReferences(declarations);\n\tconst selectors = uniqueSelectors(parsed.selectors);\n\tconst undeclaredSelectors = selectors.filter(\n\t\t(selector) =>\n\t\t\tdeclarations.find((d) => d.name === selector.name) === undefined\n\t);\n\tfor (const undeclaredSelector of undeclaredSelectors) {\n\t\tdeclarations.push({\n\t\t\ttype: \"input-variable\",\n\t\t\tname: undeclaredSelector.name,\n\t\t});\n\t}\n\n\treturn {\n\t\tbundle: {\n\t\t\tid: key,\n\t\t\tdeclarations,\n\t\t},\n\t\tmessage: {\n\t\t\tbundleId: key,\n\t\t\tselectors,\n\t\t\tlocale,\n\t\t},\n\t\tvariants: parsed.variants,\n\t};\n}\n\n/**\n * Parse one locale's message/variants for a bundle that already exists.\n *\n * Skips building a new bundle and first-seen selector/input finalization.\n * Callers still merge any newly discovered declarations into the existing bundle.\n */\nexport function parseLocaleContribution(\n\tkey: string,\n\tlocale: string,\n\tvalue: unknown\n): {\n\tdeclarations: Declaration[];\n\tmessage: ParsedBundle[\"message\"];\n\tvariants: FlatVariant[];\n} {\n\t// Simple string messages: parse the pattern only. Bundle-level input\n\t// finalization already ran when the key was first seen.\n\tif (typeof value === \"string\") {\n\t\tconst parsed = parsePattern(value);\n\t\treturn {\n\t\t\tdeclarations: uniqueDeclarations(parsed.declarations),\n\t\t\tmessage: {\n\t\t\t\tbundleId: key,\n\t\t\t\tselectors: [],\n\t\t\t\tlocale,\n\t\t\t},\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmessageBundleId: key,\n\t\t\t\t\tmessageLocale: locale,\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tpattern: parsed.pattern,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tconst parsed = parseVariants(key, locale, value);\n\tconst declarations = uniqueDeclarations(parsed.declarations);\n\taddInputDeclarationsForLocalReferences(declarations);\n\n\treturn {\n\t\tdeclarations,\n\t\tmessage: {\n\t\t\tbundleId: key,\n\t\t\tselectors: uniqueSelectors(parsed.selectors),\n\t\t\tlocale,\n\t\t},\n\t\tvariants: parsed.variants,\n\t};\n}\n\nfunction uniqueDeclarations(declarations: Declaration[]): Declaration[] {\n\tif (declarations.length <= 1) {\n\t\treturn declarations;\n\t}\n\treturn unique(declarations);\n}\n\nfunction uniqueSelectors(selectors: VariableReference[]): VariableReference[] {\n\tif (selectors.length <= 1) {\n\t\treturn selectors;\n\t}\n\treturn unique(selectors);\n}\n\nfunction addInputDeclarationsForLocalReferences(\n\tdeclarations: Declaration[]\n): void {\n\tconst declaredNames = new Set(\n\t\tdeclarations.map((declaration) => declaration.name)\n\t);\n\n\tfor (const declaration of declarations) {\n\t\tif (declaration.type !== \"local-variable\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst references: string[] = [];\n\t\tif (declaration.value.arg.type === \"variable-reference\") {\n\t\t\treferences.push(declaration.value.arg.name);\n\t\t}\n\t\tfor (const option of declaration.value.annotation?.options ?? []) {\n\t\t\tif (option.value.type === \"variable-reference\") {\n\t\t\t\treferences.push(option.value.name);\n\t\t\t}\n\t\t}\n\n\t\tfor (const name of references) {\n\t\t\tif (declaredNames.has(name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdeclarations.push({ type: \"input-variable\", name });\n\t\t\tdeclaredNames.add(name);\n\t\t}\n\t}\n}\n\nfunction parseVariants(\n\tbundleId: string,\n\tlocale: string,\n\tvalue: unknown\n): {\n\tvariants: FlatVariant[];\n\tdeclarations: Declaration[];\n\tselectors: VariableReference[];\n} {\n\tif (typeof value === \"string\") {\n\t\tconst parsed = parsePattern(value);\n\t\treturn {\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmessageBundleId: bundleId,\n\t\t\t\t\tmessageLocale: locale,\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tpattern: parsed.pattern,\n\t\t\t\t},\n\t\t\t],\n\t\t\tdeclarations: parsed.declarations,\n\t\t\tselectors: [],\n\t\t};\n\t}\n\n\tif (!Array.isArray(value) || value.length === 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid message value for \"${bundleId}\": expected string or complex message array`\n\t\t);\n\t}\n\n\tconst complexMessage = value[0] as {\n\t\tselectors?: string[];\n\t\tdeclarations?: string[];\n\t\tmatch: Record<string, string>;\n\t};\n\n\tconst variants: FlatVariant[] = [];\n\tconst selectors = (complexMessage.selectors ?? []).map((name) => ({\n\t\ttype: \"variable-reference\" as const,\n\t\tname,\n\t}));\n\n\tconst declarations = new Set<Declaration>();\n\tfor (const declaration of complexMessage.declarations ?? []) {\n\t\tdeclarations.add(parseDeclaration(declaration));\n\t}\n\n\tconst detectedSelectors = new Set<VariableReference>();\n\tfor (const [match, pattern] of Object.entries(complexMessage.match ?? {})) {\n\t\tconst parsed = parsePattern(pattern);\n\t\tconst parsedMatches = parseMatches(match);\n\n\t\tfor (const declaration of parsed.declarations) {\n\t\t\tlet isDuplicate = false;\n\t\t\tfor (const existingDeclaration of declarations) {\n\t\t\t\tif (existingDeclaration.name === declaration.name) {\n\t\t\t\t\tisDuplicate = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isDuplicate) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdeclarations.add(declaration);\n\t\t}\n\n\t\tfor (const selector of parsedMatches.selectors) {\n\t\t\tdetectedSelectors.add(selector);\n\t\t}\n\n\t\tvariants.push({\n\t\t\tmessageBundleId: bundleId,\n\t\t\tmessageLocale: locale,\n\t\t\tmatches: parsedMatches.matches,\n\t\t\tpattern: parsed.pattern,\n\t\t});\n\t}\n\n\treturn {\n\t\tvariants,\n\t\tdeclarations: Array.from(declarations),\n\t\tselectors: unique([...selectors, ...Array.from(detectedSelectors)]),\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-declaration.d.ts","sourceRoot":"","sources":["../../../src/messages/message-format/parse-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,WAAW,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CA+D3D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export function parseDeclaration(value) {
|
|
2
|
+
if (value.startsWith("input")) {
|
|
3
|
+
return {
|
|
4
|
+
type: "input-variable",
|
|
5
|
+
name: value.slice(6).trim(),
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
if (value.startsWith("local")) {
|
|
9
|
+
const match = value.match(/local (\w+) = (\w+): (\w+)(.*)/);
|
|
10
|
+
if (!match) {
|
|
11
|
+
throw new Error(`Unsupported declaration: ${value}`);
|
|
12
|
+
}
|
|
13
|
+
const [, name, ref, fn, optionsString] = match;
|
|
14
|
+
if (!name || !ref || !fn) {
|
|
15
|
+
throw new Error(`Unsupported declaration: ${value}`);
|
|
16
|
+
}
|
|
17
|
+
const options = [];
|
|
18
|
+
for (const optionMatch of (optionsString ?? "").matchAll(/(\w+)\s*=\s*([^\s]+)/g)) {
|
|
19
|
+
const optionName = optionMatch[1];
|
|
20
|
+
const optionValue = optionMatch[2];
|
|
21
|
+
if (!optionName || !optionValue) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
options.push({
|
|
25
|
+
name: optionName,
|
|
26
|
+
value: optionValue.startsWith("$") && optionValue.length > 1
|
|
27
|
+
? {
|
|
28
|
+
type: "variable-reference",
|
|
29
|
+
name: optionValue.slice(1),
|
|
30
|
+
}
|
|
31
|
+
: {
|
|
32
|
+
type: "literal",
|
|
33
|
+
value: optionValue,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
type: "local-variable",
|
|
39
|
+
name: name.trim(),
|
|
40
|
+
value: {
|
|
41
|
+
type: "expression",
|
|
42
|
+
arg: {
|
|
43
|
+
type: "variable-reference",
|
|
44
|
+
name: ref.trim(),
|
|
45
|
+
},
|
|
46
|
+
annotation: {
|
|
47
|
+
type: "function-reference",
|
|
48
|
+
name: fn.trim(),
|
|
49
|
+
options,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
throw new Error("Unsupported declaration type");
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=parse-declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-declaration.js","sourceRoot":"","sources":["../../../src/messages/message-format/parse-declaration.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC7C,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO;YACN,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;SAC3B,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,EAA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,UAAU,EAAE;oBACX,IAAI,EAAE,oBAAoB;oBAC1B,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;oBACf,OAAO;iBACP;aACD;SACD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Declaration, Option } from \"../ast.js\";\n\nexport function parseDeclaration(value: string): Declaration {\n\tif (value.startsWith(\"input\")) {\n\t\treturn {\n\t\t\ttype: \"input-variable\",\n\t\t\tname: value.slice(6).trim(),\n\t\t};\n\t}\n\n\tif (value.startsWith(\"local\")) {\n\t\tconst match = value.match(/local (\\w+) = (\\w+): (\\w+)(.*)/);\n\t\tif (!match) {\n\t\t\tthrow new Error(`Unsupported declaration: ${value}`);\n\t\t}\n\n\t\tconst [, name, ref, fn, optionsString] = match;\n\t\tif (!name || !ref || !fn) {\n\t\t\tthrow new Error(`Unsupported declaration: ${value}`);\n\t\t}\n\n\t\tconst options: Option[] = [];\n\t\tfor (const optionMatch of (optionsString ?? \"\").matchAll(\n\t\t\t/(\\w+)\\s*=\\s*([^\\s]+)/g\n\t\t)) {\n\t\t\tconst optionName = optionMatch[1];\n\t\t\tconst optionValue = optionMatch[2];\n\t\t\tif (!optionName || !optionValue) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions.push({\n\t\t\t\tname: optionName,\n\t\t\t\tvalue:\n\t\t\t\t\toptionValue.startsWith(\"$\") && optionValue.length > 1\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttype: \"variable-reference\",\n\t\t\t\t\t\t\t\tname: optionValue.slice(1),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\ttype: \"literal\",\n\t\t\t\t\t\t\t\tvalue: optionValue,\n\t\t\t\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\ttype: \"local-variable\",\n\t\t\tname: name.trim(),\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: {\n\t\t\t\t\ttype: \"variable-reference\",\n\t\t\t\t\tname: ref.trim(),\n\t\t\t\t},\n\t\t\t\tannotation: {\n\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\tname: fn.trim(),\n\t\t\t\t\toptions,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\tthrow new Error(\"Unsupported declaration type\");\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-markup.d.ts","sourceRoot":"","sources":["../../../src/messages/message-format/parse-markup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,SAAS,EACT,gBAAgB,EAChB,WAAW,EAGX,MAAM,WAAW,CAAC;AAEnB,KAAK,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAE7D,wBAAgB,sBAAsB,CACrC,WAAW,EAAE,MAAM,GACjB,UAAU,GAAG,SAAS,CA8BxB"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
export function parseMarkupPlaceholder(placeholder) {
|
|
2
|
+
if (placeholder.startsWith("#")) {
|
|
3
|
+
const parsed = parseMarkupBody(placeholder.slice(1), true);
|
|
4
|
+
if (!parsed) {
|
|
5
|
+
throw new Error(`Invalid markup placeholder: {${placeholder}}`);
|
|
6
|
+
}
|
|
7
|
+
const { name, options, attributes, standalone } = parsed;
|
|
8
|
+
return {
|
|
9
|
+
type: standalone ? "markup-standalone" : "markup-start",
|
|
10
|
+
name,
|
|
11
|
+
...(options.length > 0 ? { options } : {}),
|
|
12
|
+
...(attributes.length > 0 ? { attributes } : {}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (placeholder.startsWith("/")) {
|
|
16
|
+
const parsed = parseMarkupBody(placeholder.slice(1), false);
|
|
17
|
+
if (!parsed) {
|
|
18
|
+
throw new Error(`Invalid markup placeholder: {${placeholder}}`);
|
|
19
|
+
}
|
|
20
|
+
const { name, options, attributes } = parsed;
|
|
21
|
+
return {
|
|
22
|
+
type: "markup-end",
|
|
23
|
+
name,
|
|
24
|
+
...(options.length > 0 ? { options } : {}),
|
|
25
|
+
...(attributes.length > 0 ? { attributes } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
function parseMarkupBody(body, allowStandalone) {
|
|
31
|
+
let index = 0;
|
|
32
|
+
const options = [];
|
|
33
|
+
const attributes = [];
|
|
34
|
+
let standalone = false;
|
|
35
|
+
index = skipWhitespace(body, index);
|
|
36
|
+
const nameToken = readIdentifier(body, index);
|
|
37
|
+
if (!nameToken)
|
|
38
|
+
return undefined;
|
|
39
|
+
const name = nameToken.value;
|
|
40
|
+
index = nameToken.nextIndex;
|
|
41
|
+
while (index < body.length) {
|
|
42
|
+
index = skipWhitespace(body, index);
|
|
43
|
+
if (index >= body.length)
|
|
44
|
+
break;
|
|
45
|
+
if (allowStandalone && body[index] === "/") {
|
|
46
|
+
const trailing = body.slice(index + 1).trim();
|
|
47
|
+
if (trailing.length > 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
standalone = true;
|
|
50
|
+
index = body.length;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
if (body[index] === "@") {
|
|
54
|
+
index += 1;
|
|
55
|
+
const attributeName = readIdentifier(body, index);
|
|
56
|
+
if (!attributeName)
|
|
57
|
+
return undefined;
|
|
58
|
+
index = attributeName.nextIndex;
|
|
59
|
+
index = skipWhitespace(body, index);
|
|
60
|
+
if (body[index] === "=") {
|
|
61
|
+
index += 1;
|
|
62
|
+
index = skipWhitespace(body, index);
|
|
63
|
+
const attributeValue = parseMarkupValue(body, index);
|
|
64
|
+
if (!attributeValue)
|
|
65
|
+
return undefined;
|
|
66
|
+
if (attributeValue.value.type === "variable-reference") {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
attributes.push({
|
|
70
|
+
name: attributeName.value,
|
|
71
|
+
value: attributeValue.value,
|
|
72
|
+
});
|
|
73
|
+
index = attributeValue.nextIndex;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
attributes.push({ name: attributeName.value, value: true });
|
|
77
|
+
}
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const optionName = readIdentifier(body, index);
|
|
81
|
+
if (!optionName)
|
|
82
|
+
return undefined;
|
|
83
|
+
index = optionName.nextIndex;
|
|
84
|
+
index = skipWhitespace(body, index);
|
|
85
|
+
if (body[index] !== "=")
|
|
86
|
+
return undefined;
|
|
87
|
+
index += 1;
|
|
88
|
+
index = skipWhitespace(body, index);
|
|
89
|
+
const optionValue = parseMarkupValue(body, index);
|
|
90
|
+
if (!optionValue)
|
|
91
|
+
return undefined;
|
|
92
|
+
options.push({
|
|
93
|
+
name: optionName.value,
|
|
94
|
+
value: optionValue.value,
|
|
95
|
+
});
|
|
96
|
+
index = optionValue.nextIndex;
|
|
97
|
+
}
|
|
98
|
+
return { name, options, attributes, standalone };
|
|
99
|
+
}
|
|
100
|
+
function skipWhitespace(value, index) {
|
|
101
|
+
while (index < value.length && /\s/.test(value[index])) {
|
|
102
|
+
index += 1;
|
|
103
|
+
}
|
|
104
|
+
return index;
|
|
105
|
+
}
|
|
106
|
+
function readIdentifier(value, index) {
|
|
107
|
+
let cursor = index;
|
|
108
|
+
while (cursor < value.length &&
|
|
109
|
+
/\s/.test(value[cursor]) === false &&
|
|
110
|
+
value[cursor] !== "=" &&
|
|
111
|
+
value[cursor] !== "/" &&
|
|
112
|
+
value[cursor] !== "@") {
|
|
113
|
+
cursor += 1;
|
|
114
|
+
}
|
|
115
|
+
const parsed = value.slice(index, cursor);
|
|
116
|
+
if (parsed.length === 0)
|
|
117
|
+
return undefined;
|
|
118
|
+
return { value: parsed, nextIndex: cursor };
|
|
119
|
+
}
|
|
120
|
+
function parseMarkupValue(value, index) {
|
|
121
|
+
if (index >= value.length)
|
|
122
|
+
return undefined;
|
|
123
|
+
if (value[index] === "|") {
|
|
124
|
+
let cursor = index + 1;
|
|
125
|
+
let literal = "";
|
|
126
|
+
while (cursor < value.length) {
|
|
127
|
+
const char = value[cursor];
|
|
128
|
+
if (char === "\\") {
|
|
129
|
+
const next = value[cursor + 1];
|
|
130
|
+
if (next === "|" || next === "\\" || next === "}") {
|
|
131
|
+
literal += next;
|
|
132
|
+
cursor += 2;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
literal += char;
|
|
136
|
+
cursor += 1;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (char === "|") {
|
|
140
|
+
return {
|
|
141
|
+
value: { type: "literal", value: literal },
|
|
142
|
+
nextIndex: cursor + 1,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
literal += char;
|
|
146
|
+
cursor += 1;
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
if (value[index] === "$") {
|
|
151
|
+
const variable = readIdentifier(value, index + 1);
|
|
152
|
+
if (!variable)
|
|
153
|
+
return undefined;
|
|
154
|
+
return {
|
|
155
|
+
value: { type: "variable-reference", name: variable.value },
|
|
156
|
+
nextIndex: variable.nextIndex,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const literal = readIdentifier(value, index);
|
|
160
|
+
if (!literal)
|
|
161
|
+
return undefined;
|
|
162
|
+
return {
|
|
163
|
+
value: { type: "literal", value: literal.value },
|
|
164
|
+
nextIndex: literal.nextIndex,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=parse-markup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-markup.js","sourceRoot":"","sources":["../../../src/messages/message-format/parse-markup.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,sBAAsB,CACrC,WAAmB;IAEnB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,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D,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC7B,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO;QACN,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE;QAChD,SAAS,EAAE,OAAO,CAAC,SAAS;KAC5B,CAAC;AACH,CAAC","sourcesContent":["import type {\n\tAttribute,\n\tLiteral,\n\tMarkupEnd,\n\tMarkupStandalone,\n\tMarkupStart,\n\tOption,\n\tVariableReference,\n} from \"../ast.js\";\n\ntype MarkupNode = MarkupStart | MarkupEnd | MarkupStandalone;\n\nexport function parseMarkupPlaceholder(\n\tplaceholder: string\n): MarkupNode | undefined {\n\tif (placeholder.startsWith(\"#\")) {\n\t\tconst parsed = parseMarkupBody(placeholder.slice(1), true);\n\t\tif (!parsed) {\n\t\t\tthrow new Error(`Invalid markup placeholder: {${placeholder}}`);\n\t\t}\n\t\tconst { name, options, attributes, standalone } = parsed;\n\t\treturn {\n\t\t\ttype: standalone ? \"markup-standalone\" : \"markup-start\",\n\t\t\tname,\n\t\t\t...(options.length > 0 ? { options } : {}),\n\t\t\t...(attributes.length > 0 ? { attributes } : {}),\n\t\t};\n\t}\n\n\tif (placeholder.startsWith(\"/\")) {\n\t\tconst parsed = parseMarkupBody(placeholder.slice(1), false);\n\t\tif (!parsed) {\n\t\t\tthrow new Error(`Invalid markup placeholder: {${placeholder}}`);\n\t\t}\n\t\tconst { name, options, attributes } = parsed;\n\t\treturn {\n\t\t\ttype: \"markup-end\",\n\t\t\tname,\n\t\t\t...(options.length > 0 ? { options } : {}),\n\t\t\t...(attributes.length > 0 ? { attributes } : {}),\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\nfunction parseMarkupBody(\n\tbody: string,\n\tallowStandalone: boolean\n):\n\t| {\n\t\t\tname: string;\n\t\t\toptions: Option[];\n\t\t\tattributes: Attribute[];\n\t\t\tstandalone: boolean;\n\t }\n\t| undefined {\n\tlet index = 0;\n\tconst options: Option[] = [];\n\tconst attributes: Attribute[] = [];\n\tlet standalone = false;\n\n\tindex = skipWhitespace(body, index);\n\tconst nameToken = readIdentifier(body, index);\n\tif (!nameToken) return undefined;\n\tconst name = nameToken.value;\n\tindex = nameToken.nextIndex;\n\n\twhile (index < body.length) {\n\t\tindex = skipWhitespace(body, index);\n\t\tif (index >= body.length) break;\n\n\t\tif (allowStandalone && body[index] === \"/\") {\n\t\t\tconst trailing = body.slice(index + 1).trim();\n\t\t\tif (trailing.length > 0) return undefined;\n\t\t\tstandalone = true;\n\t\t\tindex = body.length;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (body[index] === \"@\") {\n\t\t\tindex += 1;\n\t\t\tconst attributeName = readIdentifier(body, index);\n\t\t\tif (!attributeName) return undefined;\n\t\t\tindex = attributeName.nextIndex;\n\t\t\tindex = skipWhitespace(body, index);\n\t\t\tif (body[index] === \"=\") {\n\t\t\t\tindex += 1;\n\t\t\t\tindex = skipWhitespace(body, index);\n\t\t\t\tconst attributeValue = parseMarkupValue(body, index);\n\t\t\t\tif (!attributeValue) return undefined;\n\t\t\t\tif (attributeValue.value.type === \"variable-reference\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tattributes.push({\n\t\t\t\t\tname: attributeName.value,\n\t\t\t\t\tvalue: attributeValue.value,\n\t\t\t\t});\n\t\t\t\tindex = attributeValue.nextIndex;\n\t\t\t} else {\n\t\t\t\tattributes.push({ name: attributeName.value, value: true });\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst optionName = readIdentifier(body, index);\n\t\tif (!optionName) return undefined;\n\t\tindex = optionName.nextIndex;\n\t\tindex = skipWhitespace(body, index);\n\t\tif (body[index] !== \"=\") return undefined;\n\t\tindex += 1;\n\t\tindex = skipWhitespace(body, index);\n\t\tconst optionValue = parseMarkupValue(body, index);\n\t\tif (!optionValue) return undefined;\n\t\toptions.push({\n\t\t\tname: optionName.value,\n\t\t\tvalue: optionValue.value,\n\t\t});\n\t\tindex = optionValue.nextIndex;\n\t}\n\n\treturn { name, options, attributes, standalone };\n}\n\nfunction skipWhitespace(value: string, index: number): number {\n\twhile (index < value.length && /\\s/.test(value[index]!)) {\n\t\tindex += 1;\n\t}\n\treturn index;\n}\n\nfunction readIdentifier(\n\tvalue: string,\n\tindex: number\n): { value: string; nextIndex: number } | undefined {\n\tlet cursor = index;\n\twhile (\n\t\tcursor < value.length &&\n\t\t/\\s/.test(value[cursor]!) === false &&\n\t\tvalue[cursor] !== \"=\" &&\n\t\tvalue[cursor] !== \"/\" &&\n\t\tvalue[cursor] !== \"@\"\n\t) {\n\t\tcursor += 1;\n\t}\n\tconst parsed = value.slice(index, cursor);\n\tif (parsed.length === 0) return undefined;\n\treturn { value: parsed, nextIndex: cursor };\n}\n\nfunction parseMarkupValue(\n\tvalue: string,\n\tindex: number\n):\n\t| {\n\t\t\tvalue: Literal | VariableReference;\n\t\t\tnextIndex: number;\n\t }\n\t| undefined {\n\tif (index >= value.length) return undefined;\n\n\tif (value[index] === \"|\") {\n\t\tlet cursor = index + 1;\n\t\tlet literal = \"\";\n\t\twhile (cursor < value.length) {\n\t\t\tconst char = value[cursor]!;\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tconst next = value[cursor + 1];\n\t\t\t\tif (next === \"|\" || next === \"\\\\\" || next === \"}\") {\n\t\t\t\t\tliteral += next;\n\t\t\t\t\tcursor += 2;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tliteral += char;\n\t\t\t\tcursor += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"|\") {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: { type: \"literal\", value: literal },\n\t\t\t\t\tnextIndex: cursor + 1,\n\t\t\t\t};\n\t\t\t}\n\t\t\tliteral += char;\n\t\t\tcursor += 1;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tif (value[index] === \"$\") {\n\t\tconst variable = readIdentifier(value, index + 1);\n\t\tif (!variable) return undefined;\n\t\treturn {\n\t\t\tvalue: { type: \"variable-reference\", name: variable.value },\n\t\t\tnextIndex: variable.nextIndex,\n\t\t};\n\t}\n\n\tconst literal = readIdentifier(value, index);\n\tif (!literal) return undefined;\n\treturn {\n\t\tvalue: { type: \"literal\", value: literal.value },\n\t\tnextIndex: literal.nextIndex,\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-matches.d.ts","sourceRoot":"","sources":["../../../src/messages/message-format/parse-matches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE1D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG;IAC5C,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAC/B,CAgCA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function parseMatches(value) {
|
|
2
|
+
const stripped = value.replaceAll(" ", "");
|
|
3
|
+
const matches = [];
|
|
4
|
+
const selectors = [];
|
|
5
|
+
const parts = stripped.split(",");
|
|
6
|
+
for (const part of parts) {
|
|
7
|
+
const [key, matchValue] = part.split("=");
|
|
8
|
+
if (!key || !matchValue) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (matchValue === "*") {
|
|
12
|
+
matches.push({
|
|
13
|
+
type: "catchall-match",
|
|
14
|
+
key,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
matches.push({
|
|
19
|
+
type: "literal-match",
|
|
20
|
+
key,
|
|
21
|
+
value: matchValue,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
selectors.push({
|
|
25
|
+
type: "variable-reference",
|
|
26
|
+
name: key,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return { matches, selectors };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=parse-matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-matches.js","sourceRoot":"","sources":["../../../src/messages/message-format/parse-matches.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,KAAa;IAIzC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAY,EAAE,CAAC;IAC5B,MAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YACzB,SAAS;QACV,CAAC;QAED,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,GAAG;aACH,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,eAAe;gBACrB,GAAG;gBACH,KAAK,EAAE,UAAU;aACjB,CAAC,CAAC;QACJ,CAAC;QAED,SAAS,CAAC,IAAI,CAAC;YACd,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,GAAG;SACT,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["import type { Match, VariableReference } from \"../ast.js\";\n\nexport function parseMatches(value: string): {\n\tmatches: Match[];\n\tselectors: VariableReference[];\n} {\n\tconst stripped = value.replaceAll(\" \", \"\");\n\tconst matches: Match[] = [];\n\tconst selectors: VariableReference[] = [];\n\tconst parts = stripped.split(\",\");\n\n\tfor (const part of parts) {\n\t\tconst [key, matchValue] = part.split(\"=\");\n\t\tif (!key || !matchValue) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (matchValue === \"*\") {\n\t\t\tmatches.push({\n\t\t\t\ttype: \"catchall-match\",\n\t\t\t\tkey,\n\t\t\t});\n\t\t} else {\n\t\t\tmatches.push({\n\t\t\t\ttype: \"literal-match\",\n\t\t\t\tkey,\n\t\t\t\tvalue: matchValue,\n\t\t\t});\n\t\t}\n\n\t\tselectors.push({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname: key,\n\t\t});\n\t}\n\n\treturn { matches, selectors };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-pattern.d.ts","sourceRoot":"","sources":["../../../src/messages/message-format/parse-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG;IAC5C,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;CACjB,CAoEA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { parseMarkupPlaceholder } from "./parse-markup.js";
|
|
2
|
+
export function parsePattern(value) {
|
|
3
|
+
// Fast path for the common case: plain text + `{name}` placeholders,
|
|
4
|
+
// no escapes, quoted literals, or markup tags.
|
|
5
|
+
if (!value.includes("\\") &&
|
|
6
|
+
!value.includes("|") &&
|
|
7
|
+
!value.includes("{#") &&
|
|
8
|
+
!value.includes("{/") &&
|
|
9
|
+
!value.includes("{@")) {
|
|
10
|
+
return parseSimplePattern(value);
|
|
11
|
+
}
|
|
12
|
+
return parseGeneralPattern(value);
|
|
13
|
+
}
|
|
14
|
+
function parseSimplePattern(value) {
|
|
15
|
+
const pattern = [];
|
|
16
|
+
const declarations = [];
|
|
17
|
+
let start = 0;
|
|
18
|
+
while (start < value.length) {
|
|
19
|
+
const open = value.indexOf("{", start);
|
|
20
|
+
if (open === -1) {
|
|
21
|
+
pattern.push({ type: "text", value: value.slice(start) });
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
if (open > start) {
|
|
25
|
+
pattern.push({ type: "text", value: value.slice(start, open) });
|
|
26
|
+
}
|
|
27
|
+
const close = value.indexOf("}", open + 1);
|
|
28
|
+
if (close === -1) {
|
|
29
|
+
pattern.push({ type: "text", value: value.slice(open) });
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const name = value.slice(open + 1, close);
|
|
33
|
+
declarations.push({ type: "input-variable", name });
|
|
34
|
+
pattern.push({
|
|
35
|
+
type: "expression",
|
|
36
|
+
arg: { type: "variable-reference", name },
|
|
37
|
+
});
|
|
38
|
+
start = close + 1;
|
|
39
|
+
}
|
|
40
|
+
return { declarations, pattern };
|
|
41
|
+
}
|
|
42
|
+
function parseGeneralPattern(value) {
|
|
43
|
+
const pattern = [];
|
|
44
|
+
const declarations = [];
|
|
45
|
+
let buffer = "";
|
|
46
|
+
const flushBuffer = () => {
|
|
47
|
+
if (buffer.length > 0) {
|
|
48
|
+
pattern.push({ type: "text", value: buffer });
|
|
49
|
+
buffer = "";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
53
|
+
const char = value[index];
|
|
54
|
+
if (char === "\\") {
|
|
55
|
+
const next = value[index + 1];
|
|
56
|
+
if (next === "{" || next === "}" || next === "\\") {
|
|
57
|
+
buffer += next;
|
|
58
|
+
index += 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
buffer += char;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (char === "{") {
|
|
65
|
+
const closingIndex = findPlaceholderClosingIndex(value, index);
|
|
66
|
+
if (closingIndex === -1) {
|
|
67
|
+
buffer += char;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const placeholder = value.slice(index + 1, closingIndex);
|
|
71
|
+
const markupNode = parseMarkupPlaceholder(placeholder);
|
|
72
|
+
flushBuffer();
|
|
73
|
+
if (markupNode) {
|
|
74
|
+
for (const option of markupNode.options ?? []) {
|
|
75
|
+
if (option.value.type === "variable-reference") {
|
|
76
|
+
declarations.push({
|
|
77
|
+
type: "input-variable",
|
|
78
|
+
name: option.value.name,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
pattern.push(markupNode);
|
|
83
|
+
index = closingIndex;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
declarations.push({
|
|
87
|
+
type: "input-variable",
|
|
88
|
+
name: placeholder,
|
|
89
|
+
});
|
|
90
|
+
pattern.push({
|
|
91
|
+
type: "expression",
|
|
92
|
+
arg: { type: "variable-reference", name: placeholder },
|
|
93
|
+
});
|
|
94
|
+
index = closingIndex;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
buffer += char;
|
|
98
|
+
}
|
|
99
|
+
flushBuffer();
|
|
100
|
+
return { declarations, pattern };
|
|
101
|
+
}
|
|
102
|
+
function findPlaceholderClosingIndex(value, openingIndex) {
|
|
103
|
+
let inQuotedLiteral = false;
|
|
104
|
+
for (let cursor = openingIndex + 1; cursor < value.length; cursor += 1) {
|
|
105
|
+
const current = value[cursor];
|
|
106
|
+
if (inQuotedLiteral && current === "\\") {
|
|
107
|
+
cursor += 1;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (current === "|") {
|
|
111
|
+
inQuotedLiteral = !inQuotedLiteral;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (current === "}" && inQuotedLiteral === false) {
|
|
115
|
+
return cursor;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return -1;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=parse-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-pattern.js","sourceRoot":"","sources":["../../../src/messages/message-format/parse-pattern.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,UAAU,YAAY,CAAC,KAAa;IAIzC,qEAAqE;IACrE,+CAA+C;IAC/C,IACC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACrB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACrB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACrB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EACpB,CAAC;QACF,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IAIxC,MAAM,OAAO,GAAY,EAAE,CAAC;IAC5B,MAAM,YAAY,GAAkB,EAAE,CAAC;IACvC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvC,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC1D,MAAM;QACP,CAAC;QACD,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,K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;gBACrB,SAAS;YACV,CAAC;YAED,YAAY,CAAC,IAAI,CAAC;gBACjB,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,WAAW;aACjB,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,YAAY;gBAClB,GAAG,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE;aACtD,CAAC,CAAC;YACH,KAAK,GAAG,YAAY,CAAC;YACrB,SAAS;QACV,CAAC;QAED,MAAM,IAAI,IAAI,CAAC;IAChB,CAAC;IAED,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,2BAA2B,CACnC,KAAa,EACb,YAAoB;IAEpB,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,KAAK,IAAI,MAAM,GAAG,YAAY,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;QACxE,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAE,CAAC;QAC/B,IAAI,eAAe,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,CAAC;YACZ,SAAS;QACV,CAAC;QACD,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;YACrB,eAAe,GAAG,CAAC,eAAe,CAAC;YACnC,SAAS;QACV,CAAC;QACD,IAAI,OAAO,KAAK,GAAG,IAAI,eAAe,KAAK,KAAK,EAAE,CAAC;YAClD,OAAO,MAAM,CAAC;QACf,CAAC;IACF,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACX,CAAC","sourcesContent":["import type { Declaration, Pattern } from \"../ast.js\";\nimport { parseMarkupPlaceholder } from \"./parse-markup.js\";\n\nexport function parsePattern(value: string): {\n\tdeclarations: Declaration[];\n\tpattern: Pattern;\n} {\n\t// Fast path for the common case: plain text + `{name}` placeholders,\n\t// no escapes, quoted literals, or markup tags.\n\tif (\n\t\t!value.includes(\"\\\\\") &&\n\t\t!value.includes(\"|\") &&\n\t\t!value.includes(\"{#\") &&\n\t\t!value.includes(\"{/\") &&\n\t\t!value.includes(\"{@\")\n\t) {\n\t\treturn parseSimplePattern(value);\n\t}\n\treturn parseGeneralPattern(value);\n}\n\nfunction parseSimplePattern(value: string): {\n\tdeclarations: Declaration[];\n\tpattern: Pattern;\n} {\n\tconst pattern: Pattern = [];\n\tconst declarations: Declaration[] = [];\n\tlet start = 0;\n\n\twhile (start < value.length) {\n\t\tconst open = value.indexOf(\"{\", start);\n\t\tif (open === -1) {\n\t\t\tpattern.push({ type: \"text\", value: value.slice(start) });\n\t\t\tbreak;\n\t\t}\n\t\tif (open > start) {\n\t\t\tpattern.push({ type: \"text\", value: value.slice(start, open) });\n\t\t}\n\t\tconst close = value.indexOf(\"}\", open + 1);\n\t\tif (close === -1) {\n\t\t\tpattern.push({ type: \"text\", value: value.slice(open) });\n\t\t\tbreak;\n\t\t}\n\t\tconst name = value.slice(open + 1, close);\n\t\tdeclarations.push({ type: \"input-variable\", name });\n\t\tpattern.push({\n\t\t\ttype: \"expression\",\n\t\t\targ: { type: \"variable-reference\", name },\n\t\t});\n\t\tstart = close + 1;\n\t}\n\n\treturn { declarations, pattern };\n}\n\nfunction parseGeneralPattern(value: string): {\n\tdeclarations: Declaration[];\n\tpattern: Pattern;\n} {\n\tconst pattern: Pattern = [];\n\tconst declarations: Declaration[] = [];\n\tlet buffer = \"\";\n\n\tconst flushBuffer = () => {\n\t\tif (buffer.length > 0) {\n\t\t\tpattern.push({ type: \"text\", value: buffer });\n\t\t\tbuffer = \"\";\n\t\t}\n\t};\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst char = value[index]!;\n\n\t\tif (char === \"\\\\\") {\n\t\t\tconst next = value[index + 1];\n\t\t\tif (next === \"{\" || next === \"}\" || next === \"\\\\\") {\n\t\t\t\tbuffer += next;\n\t\t\t\tindex += 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbuffer += char;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === \"{\") {\n\t\t\tconst closingIndex = findPlaceholderClosingIndex(value, index);\n\t\t\tif (closingIndex === -1) {\n\t\t\t\tbuffer += char;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst placeholder = value.slice(index + 1, closingIndex);\n\t\t\tconst markupNode = parseMarkupPlaceholder(placeholder);\n\t\t\tflushBuffer();\n\n\t\t\tif (markupNode) {\n\t\t\t\tfor (const option of markupNode.options ?? []) {\n\t\t\t\t\tif (option.value.type === \"variable-reference\") {\n\t\t\t\t\t\tdeclarations.push({\n\t\t\t\t\t\t\ttype: \"input-variable\",\n\t\t\t\t\t\t\tname: option.value.name,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpattern.push(markupNode);\n\t\t\t\tindex = closingIndex;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tdeclarations.push({\n\t\t\t\ttype: \"input-variable\",\n\t\t\t\tname: placeholder,\n\t\t\t});\n\t\t\tpattern.push({\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: placeholder },\n\t\t\t});\n\t\t\tindex = closingIndex;\n\t\t\tcontinue;\n\t\t}\n\n\t\tbuffer += char;\n\t}\n\n\tflushBuffer();\n\treturn { declarations, pattern };\n}\n\nfunction findPlaceholderClosingIndex(\n\tvalue: string,\n\topeningIndex: number\n): number {\n\tlet inQuotedLiteral = false;\n\tfor (let cursor = openingIndex + 1; cursor < value.length; cursor += 1) {\n\t\tconst current = value[cursor]!;\n\t\tif (inQuotedLiteral && current === \"\\\\\") {\n\t\t\tcursor += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (current === \"|\") {\n\t\t\tinQuotedLiteral = !inQuotedLiteral;\n\t\t\tcontinue;\n\t\t}\n\t\tif (current === \"}\" && inQuotedLiteral === false) {\n\t\t\treturn cursor;\n\t\t}\n\t}\n\treturn -1;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique.d.ts","sourceRoot":"","sources":["../../../src/messages/message-format/unique.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAIvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique.js","sourceRoot":"","sources":["../../../src/messages/message-format/unique.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,UAAU,MAAM,CAAI,GAAQ;IACjC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAC/D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAC/B,CAAC;AACH,CAAC","sourcesContent":["/** Deduplicate values by JSON identity (order-preserving). */\nexport function unique<T>(arr: T[]): T[] {\n\treturn [...new Set(arr.map((item) => JSON.stringify(item)))].map(\n\t\t(item) => JSON.parse(item) as T\n\t);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Bundle, BundleNested, Message, Variant } from "./ast.js";
|
|
2
|
+
type FlatImport = {
|
|
3
|
+
bundles: Array<Pick<Bundle, "id" | "declarations">>;
|
|
4
|
+
messages: Array<Pick<Message, "bundleId" | "locale" | "selectors"> & {
|
|
5
|
+
selectors: Message["selectors"];
|
|
6
|
+
}>;
|
|
7
|
+
variants: Array<{
|
|
8
|
+
messageBundleId: string;
|
|
9
|
+
messageLocale: string;
|
|
10
|
+
matches: Variant["matches"];
|
|
11
|
+
pattern: Variant["pattern"];
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Converts the flat bundle/message/variant records produced by the message
|
|
16
|
+
* format importer into the nested structure the compiler expects.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nestBundles(flat: FlatImport): BundleNested[];
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-bundles.d.ts","sourceRoot":"","sources":["../../src/messages/nest-bundles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,YAAY,EAEZ,OAAO,EAEP,OAAO,EACP,MAAM,UAAU,CAAC;AAElB,KAAK,UAAU,GAAG;IACjB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC;IACpD,QAAQ,EAAE,KAAK,CACd,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC,GAAG;QACpD,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;KAChC,CACD,CAAC;IACF,QAAQ,EAAE,KAAK,CAAC;QACf,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAC5B,CAAC,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,EAAE,CA8D5D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the flat bundle/message/variant records produced by the message
|
|
3
|
+
* format importer into the nested structure the compiler expects.
|
|
4
|
+
*/
|
|
5
|
+
export function nestBundles(flat) {
|
|
6
|
+
const byBundleId = new Map();
|
|
7
|
+
for (const bundle of flat.bundles) {
|
|
8
|
+
byBundleId.set(bundle.id, {
|
|
9
|
+
declarations: [...bundle.declarations],
|
|
10
|
+
messages: new Map(),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
for (const message of flat.messages) {
|
|
14
|
+
const entry = byBundleId.get(message.bundleId);
|
|
15
|
+
if (entry === undefined) {
|
|
16
|
+
throw new Error(`Message references unknown bundle "${message.bundleId}"`);
|
|
17
|
+
}
|
|
18
|
+
const messageId = `${message.bundleId}_${message.locale}`;
|
|
19
|
+
entry.messages.set(message.locale, {
|
|
20
|
+
id: messageId,
|
|
21
|
+
bundleId: message.bundleId,
|
|
22
|
+
locale: message.locale,
|
|
23
|
+
selectors: message.selectors,
|
|
24
|
+
variants: [],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
for (const variant of flat.variants) {
|
|
28
|
+
const entry = byBundleId.get(variant.messageBundleId);
|
|
29
|
+
if (entry === undefined) {
|
|
30
|
+
throw new Error(`Variant references unknown bundle "${variant.messageBundleId}"`);
|
|
31
|
+
}
|
|
32
|
+
const message = entry.messages.get(variant.messageLocale);
|
|
33
|
+
if (message === undefined) {
|
|
34
|
+
throw new Error(`Variant references unknown message locale "${variant.messageLocale}" for bundle "${variant.messageBundleId}"`);
|
|
35
|
+
}
|
|
36
|
+
message.variants.push({
|
|
37
|
+
id: `${message.id}_${message.variants.length}`,
|
|
38
|
+
messageId: message.id,
|
|
39
|
+
matches: variant.matches,
|
|
40
|
+
pattern: variant.pattern,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return [...byBundleId.entries()].map(([id, entry]) => ({
|
|
44
|
+
id,
|
|
45
|
+
declarations: entry.declarations,
|
|
46
|
+
messages: [...entry.messages.values()],
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=nest-bundles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-bundles.js","sourceRoot":"","sources":["../../src/messages/nest-bundles.ts"],"names":[],"mappings":"AAwBA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC3C,MAAM,UAAU,GAAG,I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1D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACd,8CAA8C,OAAO,CAAC,aAAa,iBAAiB,OAAO,CAAC,eAAe,GAAG,CAC9G,CAAC;QACH,CAAC;QAED,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YACrB,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC9C,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;SACxB,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACtD,EAAE;QACF,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;KACtC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type {\n\tBundle,\n\tBundleNested,\n\tDeclaration,\n\tMessage,\n\tMessageNested,\n\tVariant,\n} from \"./ast.js\";\n\ntype FlatImport = {\n\tbundles: Array<Pick<Bundle, \"id\" | \"declarations\">>;\n\tmessages: Array<\n\t\tPick<Message, \"bundleId\" | \"locale\" | \"selectors\"> & {\n\t\t\tselectors: Message[\"selectors\"];\n\t\t}\n\t>;\n\tvariants: Array<{\n\t\tmessageBundleId: string;\n\t\tmessageLocale: string;\n\t\tmatches: Variant[\"matches\"];\n\t\tpattern: Variant[\"pattern\"];\n\t}>;\n};\n\n/**\n * Converts the flat bundle/message/variant records produced by the message\n * format importer into the nested structure the compiler expects.\n */\nexport function nestBundles(flat: FlatImport): BundleNested[] {\n\tconst byBundleId = new Map<\n\t\tstring,\n\t\t{\n\t\t\tdeclarations: Declaration[];\n\t\t\tmessages: Map<string, MessageNested>;\n\t\t}\n\t>();\n\n\tfor (const bundle of flat.bundles) {\n\t\tbyBundleId.set(bundle.id, {\n\t\t\tdeclarations: [...bundle.declarations],\n\t\t\tmessages: new Map(),\n\t\t});\n\t}\n\n\tfor (const message of flat.messages) {\n\t\tconst entry = byBundleId.get(message.bundleId);\n\t\tif (entry === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Message references unknown bundle \"${message.bundleId}\"`\n\t\t\t);\n\t\t}\n\n\t\tconst messageId = `${message.bundleId}_${message.locale}`;\n\t\tentry.messages.set(message.locale, {\n\t\t\tid: messageId,\n\t\t\tbundleId: message.bundleId,\n\t\t\tlocale: message.locale,\n\t\t\tselectors: message.selectors,\n\t\t\tvariants: [],\n\t\t});\n\t}\n\n\tfor (const variant of flat.variants) {\n\t\tconst entry = byBundleId.get(variant.messageBundleId);\n\t\tif (entry === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Variant references unknown bundle \"${variant.messageBundleId}\"`\n\t\t\t);\n\t\t}\n\n\t\tconst message = entry.messages.get(variant.messageLocale);\n\t\tif (message === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Variant references unknown message locale \"${variant.messageLocale}\" for bundle \"${variant.messageBundleId}\"`\n\t\t\t);\n\t\t}\n\n\t\tmessage.variants.push({\n\t\t\tid: `${message.id}_${message.variants.length}`,\n\t\t\tmessageId: message.id,\n\t\t\tmatches: variant.matches,\n\t\t\tpattern: variant.pattern,\n\t\t});\n\t}\n\n\treturn [...byBundleId.entries()].map(([id, entry]) => ({\n\t\tid,\n\t\tdeclarations: entry.declarations,\n\t\tmessages: [...entry.messages.values()],\n\t}));\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Account } from "./types.js";
|
|
2
|
+
export declare function getLocalAccount(args: {
|
|
3
|
+
fs: typeof import("node:fs");
|
|
4
|
+
}): Account | undefined;
|
|
5
|
+
export declare function saveLocalAccount(args: {
|
|
6
|
+
fs: typeof import("node:fs");
|
|
7
|
+
account: Account;
|
|
8
|
+
}): void;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the path to the local account file.
|
|
11
|
+
*
|
|
12
|
+
* Based on the env-paths package https://github.com/sindresorhus/env-paths/blob/main/index.js
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAccountFilePath(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/account/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACrC,EAAE,EAAE,cAAc,SAAS,CAAC,CAAC;CAC7B,GAAG,OAAO,GAAG,SAAS,CAYtB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACtC,EAAE,EAAE,cAAc,SAAS,CAAC,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;CACjB,GAAG,IAAI,CAQP;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,WAkBjC"}
|