@inlang/paraglide-js 2.21.0 → 2.23.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/README.md +13 -4
- package/dist/bundler-plugins/index.d.ts +1 -1
- package/dist/bundler-plugins/index.d.ts.map +1 -1
- package/dist/bundler-plugins/index.js +1 -1
- package/dist/bundler-plugins/index.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/constants.d.ts +3 -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 +7 -0
- package/dist/bundler-plugins/per-locale-build/index.d.ts.map +1 -0
- package/dist/bundler-plugins/per-locale-build/index.js +53 -0
- package/dist/bundler-plugins/per-locale-build/index.js.map +1 -0
- package/dist/bundler-plugins/per-locale-build/locale-id.d.ts +9 -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 +5 -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 +52 -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 +2 -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 +260 -0
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -0
- package/dist/bundler-plugins/vite.d.ts +17 -1
- package/dist/bundler-plugins/vite.d.ts.map +1 -1
- package/dist/bundler-plugins/vite.js +12 -1
- package/dist/bundler-plugins/vite.js.map +1 -1
- package/dist/bundler-plugins/vite.test.d.ts +2 -0
- package/dist/bundler-plugins/vite.test.d.ts.map +1 -0
- package/dist/bundler-plugins/vite.test.js +72 -0
- package/dist/bundler-plugins/vite.test.js.map +1 -0
- package/dist/compiler/compile-bundle.d.ts +2 -0
- package/dist/compiler/compile-bundle.d.ts.map +1 -1
- package/dist/compiler/compile-bundle.js +26 -5
- package/dist/compiler/compile-bundle.js.map +1 -1
- package/dist/compiler/compile-bundle.test.js +106 -4
- package/dist/compiler/compile-bundle.test.js.map +1 -1
- package/dist/compiler/compile-project.d.ts.map +1 -1
- package/dist/compiler/compile-project.js +7 -3
- package/dist/compiler/compile-project.js.map +1 -1
- package/dist/compiler/compile-project.test.js +20 -3
- package/dist/compiler/compile-project.test.js.map +1 -1
- package/dist/compiler/compiler-options.d.ts +2 -1
- package/dist/compiler/compiler-options.d.ts.map +1 -1
- package/dist/compiler/output-structure/message-modules.test.js.map +1 -1
- package/dist/compiler/per-locale-build.d.ts +3 -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/runtime/create-runtime.d.ts.map +1 -1
- package/dist/compiler/runtime/create-runtime.js +7 -1
- package/dist/compiler/runtime/create-runtime.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.js +1 -1
- package/dist/compiler/runtime/extract-locale-from-request-async.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-request.js +2 -1
- package/dist/compiler/runtime/extract-locale-from-request.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-url.js +1 -1
- package/dist/compiler/runtime/extract-locale-from-url.js.map +1 -1
- package/dist/compiler/runtime/get-locale.js +2 -1
- package/dist/compiler/runtime/get-locale.js.map +1 -1
- package/dist/compiler/runtime/get-url-origin.d.ts +1 -1
- package/dist/compiler/runtime/get-url-origin.js +1 -1
- package/dist/compiler/runtime/route-strategy.d.ts +33 -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 +6 -3
- package/dist/compiler/runtime/set-locale.d.ts.map +1 -1
- package/dist/compiler/runtime/set-locale.js +14 -4
- package/dist/compiler/runtime/set-locale.js.map +1 -1
- package/dist/compiler/runtime/set-locale.test.js +31 -0
- package/dist/compiler/runtime/set-locale.test.js.map +1 -1
- package/dist/compiler/runtime/should-redirect.d.ts.map +1 -1
- package/dist/compiler/runtime/should-redirect.js +5 -3
- package/dist/compiler/runtime/should-redirect.js.map +1 -1
- package/dist/compiler/runtime/type.d.ts +2 -2
- package/dist/compiler/runtime/type.d.ts.map +1 -1
- package/dist/compiler/runtime/variables.d.ts +0 -17
- package/dist/compiler/runtime/variables.d.ts.map +1 -1
- package/dist/compiler/runtime/variables.js +0 -56
- package/dist/compiler/runtime/variables.js.map +1 -1
- package/dist/compiler/server/middleware.test.js +27 -0
- package/dist/compiler/server/middleware.test.js.map +1 -1
- package/dist/services/env-variables/index.js +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
<a href="https://www.idealista.com/"><img src="https://github.com/opral/paraglide-js/blob/main/assets/used-by/idealista.svg?raw=true" alt="idealista" height="18"></a>
|
|
28
28
|
<a href="https://www.architonic.com/"><img src="https://github.com/opral/paraglide-js/blob/main/assets/used-by/architonic.png?raw=true" alt="Architonic" height="18"></a>
|
|
29
29
|
<a href="https://lovable.dev/"><img src="https://github.com/opral/paraglide-js/blob/main/assets/used-by/lovable.svg?raw=true" alt="Lovable" height="18"></a>
|
|
30
|
-
<a href="https://www.klaviyo.com/"><img src="https://github.com/opral/paraglide-js/blob/main/assets/used-by/klaviyo.svg?raw=true" alt="Klaviyo" height="18"></a
|
|
30
|
+
<a href="https://www.klaviyo.com/"><img src="https://github.com/opral/paraglide-js/blob/main/assets/used-by/klaviyo.svg?raw=true" alt="Klaviyo" height="18"></a>
|
|
31
|
+
<a href="https://reland.com.br/"><img src="https://github.com/opral/paraglide-js/blob/main/assets/used-by/reland.svg?raw=true" alt="Reland" height="18"></a>
|
|
31
32
|
</p>
|
|
32
33
|
|
|
33
34
|
<p align="center">
|
|
@@ -114,12 +115,20 @@ import { paraglideVitePlugin } from "@inlang/paraglide-js";
|
|
|
114
115
|
export default defineConfig({
|
|
115
116
|
plugins: [
|
|
116
117
|
react(),
|
|
117
|
-
paraglideVitePlugin({
|
|
118
|
+
paraglideVitePlugin({
|
|
119
|
+
project: "./project.inlang",
|
|
120
|
+
outdir: "./src/paraglide",
|
|
121
|
+
emitTsDeclarations: true,
|
|
122
|
+
}),
|
|
118
123
|
],
|
|
119
124
|
});
|
|
120
125
|
```
|
|
121
126
|
|
|
122
|
-
|
|
127
|
+
`emitTsDeclarations` requires TypeScript 5.6 or newer and keeps editor types in sync when message files change. Set it to `false` to use the faster JavaScript/JSDoc inference path instead.
|
|
128
|
+
|
|
129
|
+
The `Greeting` component shown above is all the app code you need. By default, `setLocale()` updates the selection through your configured strategies and performs a full document navigation: it navigates to the localized URL when URL routing is enabled, or reloads the current document otherwise. The new document renders the app and any document-level locale settings together, with no i18n provider or framework reactivity to wire up.
|
|
130
|
+
|
|
131
|
+
For the deliberately narrow browser-only `setLocale(locale, { reload: false })` escape hatch, see [the warning in Basics](https://paraglidejs.com/basics#advanced-stay-on-the-current-document). It is for a fully client-rendered, non-URL surface that must preserve non-restorable in-memory work and transfers all reactive and document-state updates to the application.
|
|
123
132
|
|
|
124
133
|
**[Full React + Vite example →](https://github.com/opral/paraglide-js/tree/main/examples/react)** · **[React Router (SSR) guide →](https://paraglidejs.com/react-router)**
|
|
125
134
|
|
|
@@ -214,7 +223,7 @@ m.greeting({ name: "Ada" });
|
|
|
214
223
|
|
|
215
224
|
// Get/set locale
|
|
216
225
|
getLocale(); // "en"
|
|
217
|
-
setLocale("de"); //
|
|
226
|
+
setLocale("de"); // loads the German document
|
|
218
227
|
```
|
|
219
228
|
|
|
220
229
|
**[Full Getting Started Guide →](https://paraglidejs.com)**
|
|
@@ -2,6 +2,6 @@ export { paraglideEsbuildPlugin } from "./esbuild.js";
|
|
|
2
2
|
export { paraglideRolldownPlugin } from "./rolldown.js";
|
|
3
3
|
export { paraglideRollupPlugin } from "./rollup.js";
|
|
4
4
|
export { paraglideRspackPlugin } from "./rspack.js";
|
|
5
|
-
export { paraglideVitePlugin } from "./vite.js";
|
|
5
|
+
export { paraglideVitePlugin, type ParaglideVitePluginOptions, } from "./vite.js";
|
|
6
6
|
export { paraglideWebpackPlugin } from "./webpack.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACN,mBAAmB,EACnB,KAAK,0BAA0B,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -2,6 +2,6 @@ export { paraglideEsbuildPlugin } from "./esbuild.js";
|
|
|
2
2
|
export { paraglideRolldownPlugin } from "./rolldown.js";
|
|
3
3
|
export { paraglideRollupPlugin } from "./rollup.js";
|
|
4
4
|
export { paraglideRspackPlugin } from "./rspack.js";
|
|
5
|
-
export { paraglideVitePlugin } from "./vite.js";
|
|
5
|
+
export { paraglideVitePlugin, } from "./vite.js";
|
|
6
6
|
export { paraglideWebpackPlugin } from "./webpack.js";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bundler-plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bundler-plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACN,mBAAmB,GAEnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AACrE,eAAO,MAAM,uBAAuB,2CAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,6BAA6B,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import type { CompilerOptions } from "../../compiler/compiler-options.js";
|
|
3
|
+
export declare function createPerLocaleBuildPlugins(args: {
|
|
4
|
+
compilerOptions: CompilerOptions;
|
|
5
|
+
createCompilerPlugin: (options: CompilerOptions) => Plugin;
|
|
6
|
+
}): Plugin[];
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAK1E,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IACjD,eAAe,EAAE,eAAe,CAAC;IACjC,oBAAoB,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;CAC3D,GAAG,MAAM,EAAE,CASX"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import nodeFs from "node:fs";
|
|
2
|
+
import { loadProjectFromDirectory } from "@inlang/sdk";
|
|
3
|
+
import { perLocaleBuildStaticLocaleExpression } from "../../compiler/per-locale-build.js";
|
|
4
|
+
import { createViteLocaleEnvironmentPlugin } from "./vite-environments.js";
|
|
5
|
+
export function createPerLocaleBuildPlugins(args) {
|
|
6
|
+
validateCompilerOptions(args.compilerOptions);
|
|
7
|
+
const compilerOptions = createPerLocaleCompilerOptions(args.compilerOptions);
|
|
8
|
+
return [
|
|
9
|
+
args.createCompilerPlugin(compilerOptions),
|
|
10
|
+
createViteLocaleEnvironmentPlugin({
|
|
11
|
+
settings: () => loadSettings(compilerOptions),
|
|
12
|
+
}),
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
function createPerLocaleCompilerOptions(compilerOptions) {
|
|
16
|
+
return {
|
|
17
|
+
...compilerOptions,
|
|
18
|
+
outputStructure: compilerOptions.outputStructure ?? "locale-modules",
|
|
19
|
+
experimentalStaticLocale: perLocaleBuildStaticLocaleExpression,
|
|
20
|
+
additionalFiles: {
|
|
21
|
+
...compilerOptions.additionalFiles,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function validateCompilerOptions(options) {
|
|
26
|
+
if (options.experimentalStaticLocale !== undefined) {
|
|
27
|
+
throw new Error("experimentalPerLocaleBuild cannot be combined with experimentalStaticLocale because it controls the compiler's static locale expression.");
|
|
28
|
+
}
|
|
29
|
+
if (options.experimentalMiddlewareLocaleSplitting) {
|
|
30
|
+
throw new Error("experimentalPerLocaleBuild cannot be combined with experimentalMiddlewareLocaleSplitting.");
|
|
31
|
+
}
|
|
32
|
+
if (options.outputStructure !== undefined &&
|
|
33
|
+
options.outputStructure !== "locale-modules") {
|
|
34
|
+
throw new Error('experimentalPerLocaleBuild requires outputStructure: "locale-modules".');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function loadSettings(options) {
|
|
38
|
+
const project = await loadProjectFromDirectory({
|
|
39
|
+
path: options.project,
|
|
40
|
+
fs: options.fs ?? nodeFs,
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
const settings = await project.settings.get();
|
|
44
|
+
return {
|
|
45
|
+
baseLocale: settings.baseLocale,
|
|
46
|
+
locales: [...settings.locales],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await project.close();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAE3E,MAAM,UAAU,2BAA2B,CAAC,IAG3C;IACA,uBAAuB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,8BAA8B,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7E,OAAO;QACN,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;QAC1C,iCAAiC,CAAC;YACjC,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC;SAC7C,CAAC;KACF,CAAC;AACH,CAAC;AAED,SAAS,8BAA8B,CACtC,eAAgC;IAEhC,OAAO;QACN,GAAG,eAAe;QAClB,eAAe,EAAE,eAAe,CAAC,eAAe,IAAI,gBAAgB;QACpE,wBAAwB,EAAE,oCAAoC;QAC9D,eAAe,EAAE;YAChB,GAAG,eAAe,CAAC,eAAe;SAClC;KACD,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAwB;IACxD,IAAI,OAAO,CAAC,wBAAwB,KAAK,SAAS,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACd,0IAA0I,CAC1I,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,qCAAqC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACd,2FAA2F,CAC3F,CAAC;IACH,CAAC;IACD,IACC,OAAO,CAAC,eAAe,KAAK,SAAS;QACrC,OAAO,CAAC,eAAe,KAAK,gBAAgB,EAC3C,CAAC;QACF,MAAM,IAAI,KAAK,CACd,wEAAwE,CACxE,CAAC;IACH,CAAC;AACF,CAAC;AAED,KAAK,UAAU,YAAY,CAC1B,OAAgD;IAEhD,MAAM,OAAO,GAAG,MAAM,wBAAwB,CAAC;QAC9C,IAAI,EAAE,OAAO,CAAC,OAAO;QACrB,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,MAAM;KACxB,CAAC,CAAC;IACH,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC9C,OAAO;YACN,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;SAC9B,CAAC;IACH,CAAC;YAAS,CAAC;QACV,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a readable, filesystem-safe, collision-free identifier for a locale.
|
|
3
|
+
*
|
|
4
|
+
* The readable part is only for diagnostics. The complete UTF-8 hex suffix is
|
|
5
|
+
* what guarantees that two different locale strings never share an output
|
|
6
|
+
* directory, including locales which differ only by punctuation or Unicode.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPerLocaleBuildLocaleId(locale: string): string;
|
|
9
|
+
//# sourceMappingURL=locale-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-id.d.ts","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/locale-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMhE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a readable, filesystem-safe, collision-free identifier for a locale.
|
|
3
|
+
*
|
|
4
|
+
* The readable part is only for diagnostics. The complete UTF-8 hex suffix is
|
|
5
|
+
* what guarantees that two different locale strings never share an output
|
|
6
|
+
* directory, including locales which differ only by punctuation or Unicode.
|
|
7
|
+
*/
|
|
8
|
+
export function getPerLocaleBuildLocaleId(locale) {
|
|
9
|
+
const readable = locale.replace(/[^A-Za-z0-9_-]/g, "_") || "locale";
|
|
10
|
+
const hex = Array.from(new TextEncoder().encode(locale), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
11
|
+
return `${readable}-${hex}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=locale-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-id.js","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/locale-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACvD,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,IAAI,QAAQ,CAAC;IACpE,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CACjE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAClC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,GAAG,QAAQ,IAAI,GAAG,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import type { PerLocaleBuildSettings } from "./types.js";
|
|
3
|
+
export declare const VITE_LOCALE_BUILD_MANIFEST = "paraglide-vite-locales.json";
|
|
4
|
+
export declare const VITE_LOCALE_ENVIRONMENT_PREFIX = "paraglide_client_";
|
|
5
|
+
export type ViteLocaleBuildPlan = {
|
|
6
|
+
outputDirectory: string;
|
|
7
|
+
variants: Array<{
|
|
8
|
+
locale: string;
|
|
9
|
+
environmentName: string;
|
|
10
|
+
directory: string;
|
|
11
|
+
outputDirectory: string;
|
|
12
|
+
define: Record<string, string>;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export type ViteLocaleBuildManifest = {
|
|
16
|
+
version: 1;
|
|
17
|
+
backend: "vite-rolldown-environments";
|
|
18
|
+
viteVersion: string;
|
|
19
|
+
rolldownVersion: string;
|
|
20
|
+
baseLocale: string;
|
|
21
|
+
locales: Record<string, {
|
|
22
|
+
environment: string;
|
|
23
|
+
directory: string;
|
|
24
|
+
entries: Record<string, string>;
|
|
25
|
+
files: Array<{
|
|
26
|
+
fileName: string;
|
|
27
|
+
type: "asset" | "chunk";
|
|
28
|
+
bytes: number;
|
|
29
|
+
entry?: boolean;
|
|
30
|
+
dynamicEntry?: boolean;
|
|
31
|
+
imports?: string[];
|
|
32
|
+
dynamicImports?: string[];
|
|
33
|
+
externalImports?: string[];
|
|
34
|
+
externalDynamicImports?: string[];
|
|
35
|
+
}>;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
export declare function createViteLocaleBuildPlan(args: {
|
|
39
|
+
settings: PerLocaleBuildSettings;
|
|
40
|
+
outputDirectory?: string;
|
|
41
|
+
}): ViteLocaleBuildPlan;
|
|
42
|
+
/**
|
|
43
|
+
* Build one untouched Rolldown client graph per locale.
|
|
44
|
+
*
|
|
45
|
+
* This plugin owns app-build orchestration. It deliberately rejects another
|
|
46
|
+
* custom buildApp orchestrator rather than guessing how a framework builds.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createViteLocaleEnvironmentPlugin(args: {
|
|
49
|
+
settings: () => Promise<PerLocaleBuildSettings>;
|
|
50
|
+
outputDirectory?: string;
|
|
51
|
+
}): Plugin;
|
|
52
|
+
//# sourceMappingURL=vite-environments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-environments.d.ts","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/vite-environments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,MAAM,EAA2B,MAAM,MAAM,CAAC;AAIhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,0BAA0B,gCAAgC,CAAC;AACxE,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAMlE,MAAM,MAAM,mBAAmB,GAAG;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,CAAC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,4BAA4B,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CACd,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,KAAK,EAAE,KAAK,CAAC;YACZ,QAAQ,EAAE,MAAM,CAAC;YACjB,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;YACxB,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,CAAC,EAAE,OAAO,CAAC;YAChB,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;YACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;YAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;YAC3B,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;SAClC,CAAC,CAAC;KACH,CACD,CAAC;CACF,CAAC;AAQF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC/C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,mBAAmB,CAoBtB;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE;IACvD,QAAQ,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAuET"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import nodeFs from "node:fs/promises";
|
|
2
|
+
import nodePath from "node:path";
|
|
3
|
+
import * as vite from "vite";
|
|
4
|
+
import { PER_LOCALE_BUILD_DEFINE } from "./constants.js";
|
|
5
|
+
import { getPerLocaleBuildLocaleId } from "./locale-id.js";
|
|
6
|
+
export const VITE_LOCALE_BUILD_MANIFEST = "paraglide-vite-locales.json";
|
|
7
|
+
export const VITE_LOCALE_ENVIRONMENT_PREFIX = "paraglide_client_";
|
|
8
|
+
const viteVersion = vite.version;
|
|
9
|
+
const detectedRolldownVersion = vite.rolldownVersion;
|
|
10
|
+
export function createViteLocaleBuildPlan(args) {
|
|
11
|
+
const outputDirectory = normalizeOutputDirectory(args.outputDirectory ?? "dist");
|
|
12
|
+
return {
|
|
13
|
+
outputDirectory,
|
|
14
|
+
variants: args.settings.locales.map((locale) => {
|
|
15
|
+
const localeId = getPerLocaleBuildLocaleId(locale);
|
|
16
|
+
const directory = nodePath.posix.join("__paraglide", localeId);
|
|
17
|
+
return {
|
|
18
|
+
locale,
|
|
19
|
+
environmentName: `${VITE_LOCALE_ENVIRONMENT_PREFIX}${localeId.replaceAll(/[^a-zA-Z0-9_$]/g, "_")}`,
|
|
20
|
+
directory,
|
|
21
|
+
outputDirectory: nodePath.posix.join(outputDirectory, directory),
|
|
22
|
+
define: {
|
|
23
|
+
[PER_LOCALE_BUILD_DEFINE]: JSON.stringify(locale),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build one untouched Rolldown client graph per locale.
|
|
31
|
+
*
|
|
32
|
+
* This plugin owns app-build orchestration. It deliberately rejects another
|
|
33
|
+
* custom buildApp orchestrator rather than guessing how a framework builds.
|
|
34
|
+
*/
|
|
35
|
+
export function createViteLocaleEnvironmentPlugin(args) {
|
|
36
|
+
let plan;
|
|
37
|
+
let settings;
|
|
38
|
+
let buildApp;
|
|
39
|
+
return {
|
|
40
|
+
name: "paraglide-vite-locale-environments",
|
|
41
|
+
enforce: "post",
|
|
42
|
+
async config(config, env) {
|
|
43
|
+
if (env.command !== "build")
|
|
44
|
+
return;
|
|
45
|
+
if (Number.parseInt(viteVersion, 10) < 8) {
|
|
46
|
+
throw new Error(`experimentalPerLocaleBuild Vite environments require Vite 8 or newer; found ${viteVersion}.`);
|
|
47
|
+
}
|
|
48
|
+
if (config.builder?.buildApp !== undefined) {
|
|
49
|
+
throw new Error("experimentalPerLocaleBuild Vite environments cannot compose with an existing builder.buildApp orchestrator. A framework must expose a public client-variant API before using this backend.");
|
|
50
|
+
}
|
|
51
|
+
settings = await args.settings();
|
|
52
|
+
validateViteLocaleBuildSettings(settings);
|
|
53
|
+
plan = createViteLocaleBuildPlan({
|
|
54
|
+
settings,
|
|
55
|
+
outputDirectory: args.outputDirectory ?? config.build?.outDir,
|
|
56
|
+
});
|
|
57
|
+
for (const variant of plan.variants) {
|
|
58
|
+
if (config.environments?.[variant.environmentName] !== undefined) {
|
|
59
|
+
throw new Error(`experimentalPerLocaleBuild cannot create Vite environment ${JSON.stringify(variant.environmentName)} because the application already defines it.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
buildApp = async (builder) => {
|
|
63
|
+
await buildViteLocaleEnvironments({
|
|
64
|
+
builder,
|
|
65
|
+
plan: plan,
|
|
66
|
+
settings: settings,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
builder: {
|
|
71
|
+
...config.builder,
|
|
72
|
+
buildApp,
|
|
73
|
+
},
|
|
74
|
+
environments: Object.fromEntries(plan.variants.map((variant) => [
|
|
75
|
+
variant.environmentName,
|
|
76
|
+
createLocaleEnvironment(variant),
|
|
77
|
+
])),
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
configResolved(config) {
|
|
81
|
+
if (config.command !== "build")
|
|
82
|
+
return;
|
|
83
|
+
if (config.builder?.buildApp !== buildApp) {
|
|
84
|
+
throw new Error("experimentalPerLocaleBuild Vite environments must own builder.buildApp. Another plugin replaced the locale build orchestrator.");
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
buildStart() {
|
|
88
|
+
if (!this.meta.rolldownVersion) {
|
|
89
|
+
throw new Error("experimentalPerLocaleBuild Vite environments require a Rolldown-powered Vite build (Vite 8 or newer).");
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function createLocaleEnvironment(variant) {
|
|
95
|
+
return {
|
|
96
|
+
consumer: "client",
|
|
97
|
+
define: variant.define,
|
|
98
|
+
build: {
|
|
99
|
+
outDir: variant.outputDirectory,
|
|
100
|
+
emptyOutDir: true,
|
|
101
|
+
manifest: true,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async function buildViteLocaleEnvironments(args) {
|
|
106
|
+
const outputRoot = nodePath.resolve(args.builder.config.root, args.plan.outputDirectory);
|
|
107
|
+
await Promise.all([
|
|
108
|
+
nodeFs.rm(nodePath.join(outputRoot, "__paraglide"), {
|
|
109
|
+
recursive: true,
|
|
110
|
+
force: true,
|
|
111
|
+
}),
|
|
112
|
+
nodeFs.rm(nodePath.join(outputRoot, VITE_LOCALE_BUILD_MANIFEST), {
|
|
113
|
+
force: true,
|
|
114
|
+
}),
|
|
115
|
+
]);
|
|
116
|
+
const results = [];
|
|
117
|
+
for (const variant of args.plan.variants) {
|
|
118
|
+
const environment = args.builder.environments[variant.environmentName];
|
|
119
|
+
if (!environment) {
|
|
120
|
+
throw new Error(`Vite did not create the locale environment ${JSON.stringify(variant.environmentName)}.`);
|
|
121
|
+
}
|
|
122
|
+
const result = await args.builder.build(environment);
|
|
123
|
+
results.push({
|
|
124
|
+
variant,
|
|
125
|
+
outputs: getRolldownOutputs(result),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const manifest = {
|
|
129
|
+
version: 1,
|
|
130
|
+
backend: "vite-rolldown-environments",
|
|
131
|
+
viteVersion,
|
|
132
|
+
rolldownVersion: typeof detectedRolldownVersion === "string"
|
|
133
|
+
? detectedRolldownVersion
|
|
134
|
+
: "unknown",
|
|
135
|
+
baseLocale: args.settings.baseLocale,
|
|
136
|
+
locales: {},
|
|
137
|
+
};
|
|
138
|
+
for (const { variant, outputs } of results) {
|
|
139
|
+
manifest.locales[variant.locale] = createLocaleManifest({
|
|
140
|
+
variant,
|
|
141
|
+
outputs,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
await nodeFs.mkdir(outputRoot, { recursive: true });
|
|
145
|
+
await nodeFs.writeFile(nodePath.join(outputRoot, VITE_LOCALE_BUILD_MANIFEST), JSON.stringify(manifest, undefined, "\t") + "\n");
|
|
146
|
+
}
|
|
147
|
+
function getRolldownOutputs(result) {
|
|
148
|
+
if (Array.isArray(result)) {
|
|
149
|
+
return result.filter((item) => "output" in item);
|
|
150
|
+
}
|
|
151
|
+
if ("output" in result)
|
|
152
|
+
return [result];
|
|
153
|
+
throw new Error("experimentalPerLocaleBuild Vite environments do not support watch-mode Rolldown output.");
|
|
154
|
+
}
|
|
155
|
+
function createLocaleManifest(args) {
|
|
156
|
+
const outputFiles = args.outputs.flatMap((output) => output.output);
|
|
157
|
+
const emittedFileNames = new Set(outputFiles.map((output) => output.fileName));
|
|
158
|
+
const files = outputFiles
|
|
159
|
+
.map((output) => {
|
|
160
|
+
if (output.type === "asset") {
|
|
161
|
+
return {
|
|
162
|
+
fileName: output.fileName,
|
|
163
|
+
type: "asset",
|
|
164
|
+
bytes: getByteLength(output.source),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const staticImports = partitionImports(output.imports, emittedFileNames);
|
|
168
|
+
const dynamicImports = partitionImports(output.dynamicImports, emittedFileNames);
|
|
169
|
+
return {
|
|
170
|
+
fileName: output.fileName,
|
|
171
|
+
type: "chunk",
|
|
172
|
+
bytes: getByteLength(output.code),
|
|
173
|
+
...(output.isEntry ? { entry: true } : {}),
|
|
174
|
+
...(output.isDynamicEntry ? { dynamicEntry: true } : {}),
|
|
175
|
+
...(staticImports.internal.length > 0
|
|
176
|
+
? { imports: staticImports.internal }
|
|
177
|
+
: {}),
|
|
178
|
+
...(dynamicImports.internal.length > 0
|
|
179
|
+
? { dynamicImports: dynamicImports.internal }
|
|
180
|
+
: {}),
|
|
181
|
+
...(staticImports.external.length > 0
|
|
182
|
+
? { externalImports: staticImports.external }
|
|
183
|
+
: {}),
|
|
184
|
+
...(dynamicImports.external.length > 0
|
|
185
|
+
? {
|
|
186
|
+
externalDynamicImports: dynamicImports.external,
|
|
187
|
+
}
|
|
188
|
+
: {}),
|
|
189
|
+
};
|
|
190
|
+
})
|
|
191
|
+
.sort((left, right) => left.fileName.localeCompare(right.fileName));
|
|
192
|
+
const fileNames = new Set(files.map((file) => file.fileName));
|
|
193
|
+
for (const file of files) {
|
|
194
|
+
for (const imported of [
|
|
195
|
+
...(file.imports ?? []),
|
|
196
|
+
...(file.dynamicImports ?? []),
|
|
197
|
+
]) {
|
|
198
|
+
if (!fileNames.has(imported)) {
|
|
199
|
+
throw new Error(`Vite emitted an open locale graph for ${JSON.stringify(args.variant.locale)}: ${file.fileName} imports missing ${imported}.`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const entryPairs = [];
|
|
204
|
+
for (const output of args.outputs.flatMap((result) => result.output)) {
|
|
205
|
+
if (output.type === "chunk" && output.isEntry) {
|
|
206
|
+
entryPairs.push([output.facadeModuleId ?? output.name, output.fileName]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const entries = Object.fromEntries(entryPairs.sort(([left], [right]) => left.localeCompare(right)));
|
|
210
|
+
return {
|
|
211
|
+
environment: args.variant.environmentName,
|
|
212
|
+
directory: args.variant.directory,
|
|
213
|
+
entries,
|
|
214
|
+
files,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function partitionImports(imports, emittedFileNames) {
|
|
218
|
+
const internal = [];
|
|
219
|
+
const external = [];
|
|
220
|
+
for (const imported of imports) {
|
|
221
|
+
(emittedFileNames.has(imported) ? internal : external).push(imported);
|
|
222
|
+
}
|
|
223
|
+
return { internal, external };
|
|
224
|
+
}
|
|
225
|
+
function getByteLength(source) {
|
|
226
|
+
return typeof source === "string"
|
|
227
|
+
? new TextEncoder().encode(source).byteLength
|
|
228
|
+
: source.byteLength;
|
|
229
|
+
}
|
|
230
|
+
function normalizeOutputDirectory(directory) {
|
|
231
|
+
const normalized = directory.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
232
|
+
if (normalized === "" ||
|
|
233
|
+
normalized === "." ||
|
|
234
|
+
normalized.startsWith("/") ||
|
|
235
|
+
normalized === ".." ||
|
|
236
|
+
normalized.startsWith("../")) {
|
|
237
|
+
throw new Error("experimentalPerLocaleBuild Vite environment outputDirectory must be a project-relative directory.");
|
|
238
|
+
}
|
|
239
|
+
return normalized;
|
|
240
|
+
}
|
|
241
|
+
function validateViteLocaleBuildSettings(settings) {
|
|
242
|
+
if (!settings.baseLocale || !settings.locales.includes(settings.baseLocale)) {
|
|
243
|
+
throw new Error("experimentalPerLocaleBuild Vite environments require baseLocale to be present in locales.");
|
|
244
|
+
}
|
|
245
|
+
if (settings.locales.length === 0 ||
|
|
246
|
+
new Set(settings.locales).size !== settings.locales.length) {
|
|
247
|
+
throw new Error("experimentalPerLocaleBuild Vite environments require at least one unique locale.");
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=vite-environments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-environments.js","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/vite-environments.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AACxE,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAClE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;AACjC,MAAM,uBAAuB,GAC5B,IACA,CAAC,eAAe,CAAC;AA8ClB,MAAM,UAAU,yBAAyB,CAAC,I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C/B,CAAC;AAED,SAAS,aAAa,CAAC,MAA2B;IACjD,OAAO,OAAO,MAAM,KAAK,QAAQ;QAChC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU;QAC7C,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;AACtB,CAAC;AAED,SAAS,wBAAwB,CAAC,SAAiB;IAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvE,IACC,UAAU,KAAK,EAAE;QACjB,UAAU,KAAK,GAAG;QAClB,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC;QAC1B,UAAU,KAAK,IAAI;QACnB,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAC3B,CAAC;QACF,MAAM,IAAI,KAAK,CACd,mGAAmG,CACnG,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,SAAS,+BAA+B,CACvC,QAAgC;IAEhC,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACd,2FAA2F,CAC3F,CAAC;IACH,CAAC;IACD,IACC,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAC7B,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,OAAO,CAAC,MAAM,EACzD,CAAC;QACF,MAAM,IAAI,KAAK,CACd,kFAAkF,CAClF,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-environments.test.d.ts","sourceRoot":"","sources":["../../../src/bundler-plugins/per-locale-build/vite-environments.test.ts"],"names":[],"mappings":""}
|