@inlang/paraglide-js 2.24.1 → 2.25.1
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/dist/bundler-plugins/esbuild.d.ts +1 -1
- package/dist/bundler-plugins/per-locale-build/index.d.ts +3 -3
- package/dist/bundler-plugins/per-locale-build/index.js +59 -15
- package/dist/bundler-plugins/per-locale-build/index.js.map +1 -1
- package/dist/bundler-plugins/rolldown.d.ts +1 -1
- package/dist/bundler-plugins/rollup.d.ts +1 -1
- package/dist/bundler-plugins/rspack.d.ts +1 -1
- package/dist/bundler-plugins/unplugin.d.ts +35 -1
- package/dist/bundler-plugins/unplugin.js +404 -123
- package/dist/bundler-plugins/unplugin.js.map +1 -1
- package/dist/bundler-plugins/unplugin.test.js +357 -202
- package/dist/bundler-plugins/unplugin.test.js.map +1 -1
- package/dist/bundler-plugins/vite.d.ts +2 -2
- package/dist/bundler-plugins/vite.js.map +1 -1
- package/dist/bundler-plugins/vite.test.js +2 -1
- package/dist/bundler-plugins/vite.test.js.map +1 -1
- package/dist/bundler-plugins/webpack.d.ts +1 -1
- package/dist/cli/commands/compile/command.js +156 -36
- package/dist/cli/commands/compile/command.js.map +1 -1
- package/dist/cli/commands/compile/command.test.js +311 -7
- package/dist/cli/commands/compile/command.test.js.map +1 -1
- package/dist/cli/defaults.d.ts +0 -2
- package/dist/cli/defaults.js +0 -2
- package/dist/cli/defaults.js.map +1 -1
- package/dist/cli/steps/initialize-inlang-project.js +2 -1
- package/dist/cli/steps/initialize-inlang-project.js.map +1 -1
- package/dist/cli/steps/prompt-for-outdir.js +1 -1
- package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
- package/dist/compiler/compile-annotation.d.ts +2 -2
- package/dist/compiler/compile-annotation.js +9 -9
- package/dist/compiler/compile-annotation.js.map +1 -1
- package/dist/compiler/compile-local-variable.d.ts +2 -1
- package/dist/compiler/compile-local-variable.js +4 -4
- package/dist/compiler/compile-local-variable.js.map +1 -1
- package/dist/compiler/compile-local-variable.test.js +82 -0
- package/dist/compiler/compile-local-variable.test.js.map +1 -1
- package/dist/compiler/compile-message.js +10 -2
- package/dist/compiler/compile-message.js.map +1 -1
- package/dist/compiler/compile-message.test.js +132 -2
- package/dist/compiler/compile-message.test.js.map +1 -1
- package/dist/compiler/compile-pattern.js +4 -2
- package/dist/compiler/compile-pattern.js.map +1 -1
- package/dist/compiler/compile-pattern.test.js +31 -0
- package/dist/compiler/compile-pattern.test.js.map +1 -1
- package/dist/compiler/compiler-options.d.ts +1 -1
- package/dist/compiler/compiler-options.js.map +1 -1
- package/dist/compiler/server/create-server-file.js +18 -4
- package/dist/compiler/server/create-server-file.js.map +1 -1
- package/dist/compiler/server/create-server-file.test.js +76 -0
- package/dist/compiler/server/create-server-file.test.js.map +1 -1
- package/dist/compiler/variable-access.d.ts +2 -0
- package/dist/compiler/variable-access.js +6 -0
- package/dist/compiler/variable-access.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/config/config-schema.d.ts +69 -0
- package/dist/services/config/config-schema.js +78 -0
- package/dist/services/config/config-schema.js.map +1 -0
- package/dist/services/config/defaults.d.ts +11 -0
- package/dist/services/config/defaults.js +12 -0
- package/dist/services/config/defaults.js.map +1 -0
- package/dist/services/config/discover-config-file.d.ts +19 -0
- package/dist/services/config/discover-config-file.js +39 -0
- package/dist/services/config/discover-config-file.js.map +1 -0
- package/dist/services/config/index.d.ts +24 -0
- package/dist/services/config/index.js +25 -0
- package/dist/services/config/index.js.map +1 -0
- package/dist/services/config/load-paraglide-config.d.ts +44 -0
- package/dist/services/config/load-paraglide-config.js +109 -0
- package/dist/services/config/load-paraglide-config.js.map +1 -0
- package/dist/services/config/load-paraglide-config.test.d.ts +1 -0
- package/dist/services/config/load-paraglide-config.test.js +201 -0
- package/dist/services/config/load-paraglide-config.test.js.map +1 -0
- package/dist/services/config/resolve-compiler-options.d.ts +24 -0
- package/dist/services/config/resolve-compiler-options.js +51 -0
- package/dist/services/config/resolve-compiler-options.js.map +1 -0
- package/dist/services/config/resolve-compiler-options.test.d.ts +1 -0
- package/dist/services/config/resolve-compiler-options.test.js +60 -0
- package/dist/services/config/resolve-compiler-options.test.js.map +1 -0
- package/dist/services/env-variables/index.js +1 -1
- package/dist/services/env-variables/index.js.map +1 -1
- package/dist/services/logger/index.js +2 -0
- package/dist/services/logger/index.js.map +1 -1
- package/package.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const paraglideEsbuildPlugin: (options: import("
|
|
1
|
+
export declare const paraglideEsbuildPlugin: (options: import("./unplugin.js").ParaglidePluginOptions) => import("unplugin").EsbuildPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ParaglidePluginOptions } from "../unplugin.js";
|
|
3
3
|
export declare function createPerLocaleBuildPlugins(args: {
|
|
4
|
-
compilerOptions:
|
|
5
|
-
createCompilerPlugin: (options:
|
|
4
|
+
compilerOptions: ParaglidePluginOptions;
|
|
5
|
+
createCompilerPlugin: (options: ParaglidePluginOptions) => Plugin;
|
|
6
6
|
}): Plugin[];
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import nodeFs from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
2
3
|
import { loadProjectFromDirectory } from "@inlang/sdk";
|
|
3
4
|
import { perLocaleBuildStaticLocaleExpression } from "../../compiler/per-locale-build.js";
|
|
4
5
|
import { createViteLocaleEnvironmentPlugin } from "./vite-environments.js";
|
|
6
|
+
import { loadParaglideConfig, resolveCompilerOptions, } from "../../services/config/index.js";
|
|
5
7
|
export function createPerLocaleBuildPlugins(args) {
|
|
6
|
-
|
|
8
|
+
// Config file values are not known yet — they are validated in
|
|
9
|
+
// loadSettings once the config has been loaded.
|
|
10
|
+
validateExplicitCompilerOptions(args.compilerOptions, undefined);
|
|
7
11
|
const compilerOptions = createPerLocaleCompilerOptions(args.compilerOptions);
|
|
12
|
+
// Project root as reported by vite. Config file discovery starts here.
|
|
13
|
+
let discoveryRoot;
|
|
8
14
|
return [
|
|
15
|
+
{
|
|
16
|
+
name: "paraglide-config-discovery-root",
|
|
17
|
+
enforce: "pre",
|
|
18
|
+
// The locale-environment plugin loads settings from its own
|
|
19
|
+
// `config` hook, which runs BEFORE any `configResolved`. Capture
|
|
20
|
+
// an explicitly configured root here so it is available in time;
|
|
21
|
+
// `configResolved` still overwrites it with Vite's final value
|
|
22
|
+
// (covering roots supplied via CLI flags).
|
|
23
|
+
config(config) {
|
|
24
|
+
if (config.root !== undefined)
|
|
25
|
+
discoveryRoot = config.root;
|
|
26
|
+
},
|
|
27
|
+
configResolved(config) {
|
|
28
|
+
discoveryRoot = config.root;
|
|
29
|
+
},
|
|
30
|
+
},
|
|
9
31
|
args.createCompilerPlugin(compilerOptions),
|
|
10
32
|
createViteLocaleEnvironmentPlugin({
|
|
11
|
-
settings: () => loadSettings(compilerOptions),
|
|
33
|
+
settings: () => loadSettings(args.compilerOptions, discoveryRoot),
|
|
12
34
|
}),
|
|
13
35
|
];
|
|
14
36
|
}
|
|
@@ -17,37 +39,59 @@ function createPerLocaleCompilerOptions(compilerOptions) {
|
|
|
17
39
|
...compilerOptions,
|
|
18
40
|
outputStructure: compilerOptions.outputStructure ?? "locale-modules",
|
|
19
41
|
experimentalStaticLocale: perLocaleBuildStaticLocaleExpression,
|
|
20
|
-
additionalFiles
|
|
21
|
-
|
|
22
|
-
|
|
42
|
+
// Only forward additionalFiles when explicitly supplied — an empty
|
|
43
|
+
// object would override files provided by paraglide.config.*.
|
|
44
|
+
...(compilerOptions.additionalFiles !== undefined
|
|
45
|
+
? { additionalFiles: { ...compilerOptions.additionalFiles } }
|
|
46
|
+
: {}),
|
|
23
47
|
};
|
|
24
48
|
}
|
|
25
|
-
|
|
26
|
-
|
|
49
|
+
// Values that come from the paraglide config file are only known after
|
|
50
|
+
// loading it, so conflicts are checked against both sources here. Only
|
|
51
|
+
// explicitly set values conflict; unset ones fall back to the per-locale
|
|
52
|
+
// defaults.
|
|
53
|
+
function validateExplicitCompilerOptions(options, config) {
|
|
54
|
+
const explicit = {
|
|
55
|
+
experimentalStaticLocale: options.experimentalStaticLocale ?? config?.experimentalStaticLocale,
|
|
56
|
+
experimentalMiddlewareLocaleSplitting: options.experimentalMiddlewareLocaleSplitting ??
|
|
57
|
+
config?.experimentalMiddlewareLocaleSplitting,
|
|
58
|
+
outputStructure: options.outputStructure ?? config?.outputStructure,
|
|
59
|
+
};
|
|
60
|
+
if (explicit.experimentalStaticLocale !== undefined) {
|
|
27
61
|
throw new Error("experimentalPerLocaleBuild cannot be combined with experimentalStaticLocale because it controls the compiler's static locale expression.");
|
|
28
62
|
}
|
|
29
|
-
if (
|
|
63
|
+
if (explicit.experimentalMiddlewareLocaleSplitting) {
|
|
30
64
|
throw new Error("experimentalPerLocaleBuild cannot be combined with experimentalMiddlewareLocaleSplitting.");
|
|
31
65
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
66
|
+
if (explicit.outputStructure !== undefined &&
|
|
67
|
+
explicit.outputStructure !== "locale-modules") {
|
|
34
68
|
throw new Error('experimentalPerLocaleBuild requires outputStructure: "locale-modules".');
|
|
35
69
|
}
|
|
36
70
|
}
|
|
37
|
-
async function loadSettings(options) {
|
|
38
|
-
const
|
|
39
|
-
|
|
71
|
+
async function loadSettings(options, discoveryRoot) {
|
|
72
|
+
const root = discoveryRoot ?? process.cwd();
|
|
73
|
+
const loaded = await loadParaglideConfig({
|
|
74
|
+
projectDir: resolve(root, options.project),
|
|
75
|
+
});
|
|
76
|
+
validateExplicitCompilerOptions(options, loaded?.config);
|
|
77
|
+
const { project } = resolveCompilerOptions({
|
|
78
|
+
config: loaded?.config,
|
|
79
|
+
overrides: options,
|
|
80
|
+
root,
|
|
81
|
+
});
|
|
82
|
+
const loadedProject = await loadProjectFromDirectory({
|
|
83
|
+
path: project,
|
|
40
84
|
fs: options.fs ?? nodeFs,
|
|
41
85
|
});
|
|
42
86
|
try {
|
|
43
|
-
const settings = await
|
|
87
|
+
const settings = await loadedProject.settings.get();
|
|
44
88
|
return {
|
|
45
89
|
baseLocale: settings.baseLocale,
|
|
46
90
|
locales: [...settings.locales],
|
|
47
91
|
};
|
|
48
92
|
}
|
|
49
93
|
finally {
|
|
50
|
-
await
|
|
94
|
+
await loadedProject.close();
|
|
51
95
|
}
|
|
52
96
|
}
|
|
53
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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;
|
|
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,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EACN,mBAAmB,EACnB,sBAAsB,GAEtB,MAAM,gCAAgC,CAAC;AAGxC,MAAM,UAAU,2BAA2B,CAAC,IAG3C;IACA,+DAA+D;IAC/D,gDAAgD;IAChD,+BAA+B,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACjE,MAAM,eAAe,GAAG,8BAA8B,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7E,uEAAuE;IACvE,IAAI,aAAiC,CAAC;IACtC,OAAO;QACN;YACC,IAAI,EAAE,iCAAiC;YACvC,OAAO,EAAE,KAAK;YACd,4DAA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";\nimport { loadProjectFromDirectory } from \"@inlang/sdk\";\nimport type { Plugin } from \"vite\";\nimport { perLocaleBuildStaticLocaleExpression } from \"../../compiler/per-locale-build.js\";\nimport type { PerLocaleBuildSettings } from \"./types.js\";\nimport { createViteLocaleEnvironmentPlugin } from \"./vite-environments.js\";\nimport {\n\tloadParaglideConfig,\n\tresolveCompilerOptions,\n\ttype ParaglideConfig,\n} from \"../../services/config/index.js\";\nimport type { ParaglidePluginOptions } from \"../unplugin.js\";\n\nexport function createPerLocaleBuildPlugins(args: {\n\tcompilerOptions: ParaglidePluginOptions;\n\tcreateCompilerPlugin: (options: ParaglidePluginOptions) => Plugin;\n}): Plugin[] {\n\t// Config file values are not known yet — they are validated in\n\t// loadSettings once the config has been loaded.\n\tvalidateExplicitCompilerOptions(args.compilerOptions, undefined);\n\tconst compilerOptions = createPerLocaleCompilerOptions(args.compilerOptions);\n\t// Project root as reported by vite. Config file discovery starts here.\n\tlet discoveryRoot: string | undefined;\n\treturn [\n\t\t{\n\t\t\tname: \"paraglide-config-discovery-root\",\n\t\t\tenforce: \"pre\",\n\t\t\t// The locale-environment plugin loads settings from its own\n\t\t\t// `config` hook, which runs BEFORE any `configResolved`. Capture\n\t\t\t// an explicitly configured root here so it is available in time;\n\t\t\t// `configResolved` still overwrites it with Vite's final value\n\t\t\t// (covering roots supplied via CLI flags).\n\t\t\tconfig(config) {\n\t\t\t\tif (config.root !== undefined) discoveryRoot = config.root;\n\t\t\t},\n\t\t\tconfigResolved(config) {\n\t\t\t\tdiscoveryRoot = config.root;\n\t\t\t},\n\t\t},\n\t\targs.createCompilerPlugin(compilerOptions),\n\t\tcreateViteLocaleEnvironmentPlugin({\n\t\t\tsettings: () => loadSettings(args.compilerOptions, discoveryRoot),\n\t\t}),\n\t];\n}\n\nfunction createPerLocaleCompilerOptions(\n\tcompilerOptions: ParaglidePluginOptions\n): ParaglidePluginOptions {\n\treturn {\n\t\t...compilerOptions,\n\t\toutputStructure: compilerOptions.outputStructure ?? \"locale-modules\",\n\t\texperimentalStaticLocale: perLocaleBuildStaticLocaleExpression,\n\t\t// Only forward additionalFiles when explicitly supplied — an empty\n\t\t// object would override files provided by paraglide.config.*.\n\t\t...(compilerOptions.additionalFiles !== undefined\n\t\t\t? { additionalFiles: { ...compilerOptions.additionalFiles } }\n\t\t\t: {}),\n\t};\n}\n\n// Values that come from the paraglide config file are only known after\n// loading it, so conflicts are checked against both sources here. Only\n// explicitly set values conflict; unset ones fall back to the per-locale\n// defaults.\nfunction validateExplicitCompilerOptions(\n\toptions: ParaglidePluginOptions,\n\tconfig: ParaglideConfig | undefined\n): void {\n\tconst explicit = {\n\t\texperimentalStaticLocale:\n\t\t\toptions.experimentalStaticLocale ?? config?.experimentalStaticLocale,\n\t\texperimentalMiddlewareLocaleSplitting:\n\t\t\toptions.experimentalMiddlewareLocaleSplitting ??\n\t\t\tconfig?.experimentalMiddlewareLocaleSplitting,\n\t\toutputStructure: options.outputStructure ?? config?.outputStructure,\n\t};\n\tif (explicit.experimentalStaticLocale !== undefined) {\n\t\tthrow new Error(\n\t\t\t\"experimentalPerLocaleBuild cannot be combined with experimentalStaticLocale because it controls the compiler's static locale expression.\"\n\t\t);\n\t}\n\tif (explicit.experimentalMiddlewareLocaleSplitting) {\n\t\tthrow new Error(\n\t\t\t\"experimentalPerLocaleBuild cannot be combined with experimentalMiddlewareLocaleSplitting.\"\n\t\t);\n\t}\n\tif (\n\t\texplicit.outputStructure !== undefined &&\n\t\texplicit.outputStructure !== \"locale-modules\"\n\t) {\n\t\tthrow new Error(\n\t\t\t'experimentalPerLocaleBuild requires outputStructure: \"locale-modules\".'\n\t\t);\n\t}\n}\n\nasync function loadSettings(\n\toptions: ParaglidePluginOptions,\n\tdiscoveryRoot?: string | undefined\n): Promise<PerLocaleBuildSettings> {\n\tconst root = discoveryRoot ?? process.cwd();\n\tconst loaded = await loadParaglideConfig({\n\t\tprojectDir: resolve(root, options.project),\n\t});\n\tvalidateExplicitCompilerOptions(options, loaded?.config);\n\tconst { project } = resolveCompilerOptions({\n\t\tconfig: loaded?.config,\n\t\toverrides: options,\n\t\troot,\n\t});\n\tconst loadedProject = await loadProjectFromDirectory({\n\t\tpath: project,\n\t\tfs: options.fs ?? nodeFs,\n\t});\n\ttry {\n\t\tconst settings = await loadedProject.settings.get();\n\t\treturn {\n\t\t\tbaseLocale: settings.baseLocale,\n\t\t\tlocales: [...settings.locales],\n\t\t};\n\t} finally {\n\t\tawait loadedProject.close();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const paraglideRolldownPlugin: (options: import("
|
|
1
|
+
export declare const paraglideRolldownPlugin: (options: import("./unplugin.js").ParaglidePluginOptions) => import("unplugin").RolldownPlugin<any>[] | import("unplugin").RolldownPlugin<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const paraglideRollupPlugin: (options: import("
|
|
1
|
+
export declare const paraglideRollupPlugin: (options: import("./unplugin.js").ParaglidePluginOptions) => import("unplugin").RollupPlugin<any>[] | import("unplugin").RollupPlugin<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const paraglideRspackPlugin: (options: import("
|
|
1
|
+
export declare const paraglideRspackPlugin: (options: import("./unplugin.js").ParaglidePluginOptions) => RspackPluginInstance;
|
|
@@ -1,3 +1,37 @@
|
|
|
1
1
|
import type { UnpluginFactory } from "unplugin";
|
|
2
2
|
import type { CompilerOptions } from "../compiler/compiler-options.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The options accepted by the paraglide bundler plugins.
|
|
5
|
+
*
|
|
6
|
+
* `project` is required — the path to your inlang project directory, which
|
|
7
|
+
* also hosts the paraglide config file (`<project>/paraglide.config.*`).
|
|
8
|
+
* Relative paths are resolved against the tool's project root (Vite `root`,
|
|
9
|
+
* webpack/rspack `context`, else the process working directory).
|
|
10
|
+
*
|
|
11
|
+
* Every other property is optional: values that are not provided are read
|
|
12
|
+
* from the config file, and anything still missing falls back to the
|
|
13
|
+
* built-in defaults.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* paraglideVitePlugin({ project: "./project.inlang" })
|
|
18
|
+
*
|
|
19
|
+
* // Explicit options win over the config file
|
|
20
|
+
* paraglideVitePlugin({
|
|
21
|
+
* project: "./project.inlang",
|
|
22
|
+
* outdir: "./src/paraglide-custom",
|
|
23
|
+
* })
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type ParaglidePluginOptions = Omit<Partial<CompilerOptions>, "project"> & {
|
|
27
|
+
/**
|
|
28
|
+
* Required — the path to your inlang project directory, which also
|
|
29
|
+
* hosts the paraglide config file (`<project>/paraglide.config.*`).
|
|
30
|
+
* Relative paths are resolved against the tool's project root (Vite
|
|
31
|
+
* `root`, webpack/rspack `context`, else the process working directory).
|
|
32
|
+
*/
|
|
33
|
+
project: string;
|
|
34
|
+
};
|
|
35
|
+
type UnpluginFactoryWithOptions = (userArgs: ParaglidePluginOptions) => ReturnType<UnpluginFactory<ParaglidePluginOptions>>;
|
|
36
|
+
export declare const unpluginFactory: UnpluginFactoryWithOptions;
|
|
37
|
+
export {};
|