@lingui/cli 5.9.3 → 6.0.0-next.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/api/ProgramExit.js +1 -5
- package/dist/api/catalog/extractFromFiles.d.ts +4 -4
- package/dist/api/catalog/extractFromFiles.js +38 -32
- package/dist/api/catalog/getCatalogDependentFiles.d.ts +1 -1
- package/dist/api/catalog/getCatalogDependentFiles.js +8 -47
- package/dist/api/catalog/getCatalogs.d.ts +2 -2
- package/dist/api/catalog/getCatalogs.js +35 -44
- package/dist/api/catalog/getFallbackListForLocale.js +5 -8
- package/dist/api/catalog/getTranslationsForCatalog.d.ts +1 -1
- package/dist/api/catalog/getTranslationsForCatalog.js +9 -13
- package/dist/api/catalog/mergeCatalog.d.ts +3 -3
- package/dist/api/catalog/mergeCatalog.js +13 -21
- package/dist/api/catalog.d.ts +15 -15
- package/dist/api/catalog.js +48 -45
- package/dist/api/compile/compileLocale.d.ts +3 -3
- package/dist/api/compile/compileLocale.js +28 -33
- package/dist/api/compile.js +13 -49
- package/dist/api/extractors/babel.d.ts +20 -4
- package/dist/api/extractors/babel.js +66 -56
- package/dist/api/extractors/index.js +16 -13
- package/dist/api/formats/formatterWrapper.d.ts +2 -2
- package/dist/api/formats/formatterWrapper.js +10 -12
- package/dist/api/formats/index.d.ts +3 -4
- package/dist/api/formats/index.js +5 -44
- package/dist/api/getPathsForCompileWatcher.d.ts +7 -0
- package/dist/api/getPathsForCompileWatcher.js +15 -0
- package/dist/api/getPathsForExtractWatcher.d.ts +8 -0
- package/dist/api/getPathsForExtractWatcher.js +14 -0
- package/dist/api/help.js +5 -7
- package/dist/api/index.d.ts +7 -7
- package/dist/api/index.js +7 -36
- package/dist/api/logger.d.ts +1 -1
- package/dist/api/logger.js +1 -2
- package/dist/api/messages.d.ts +2 -2
- package/dist/api/messages.js +5 -12
- package/dist/api/pseudoLocalize.js +3 -9
- package/dist/api/resolveWorkersOptions.js +3 -9
- package/dist/api/rethrownError.js +2 -5
- package/dist/api/stats.d.ts +3 -2
- package/dist/api/stats.js +7 -16
- package/dist/api/typedPool.d.ts +6 -0
- package/dist/api/typedPool.js +16 -0
- package/dist/api/types.js +1 -2
- package/dist/api/utils.d.ts +2 -2
- package/dist/api/utils.js +24 -41
- package/dist/api/workerLogger.d.ts +2 -2
- package/dist/api/workerLogger.js +2 -8
- package/dist/api/workerPools.d.ts +3 -0
- package/dist/api/workerPools.js +7 -0
- package/dist/extract-experimental/buildIncludeDepsFilter.js +1 -4
- package/dist/extract-experimental/bundleSource.d.ts +3 -2
- package/dist/extract-experimental/bundleSource.js +10 -13
- package/dist/extract-experimental/constants.js +2 -5
- package/dist/extract-experimental/extractFromBundleAndWrite.d.ts +3 -4
- package/dist/extract-experimental/extractFromBundleAndWrite.js +9 -22
- package/dist/extract-experimental/getExperimentalCatalogs.d.ts +4 -3
- package/dist/extract-experimental/getExperimentalCatalogs.js +10 -15
- package/dist/extract-experimental/linguiEsbuildPlugin.js +12 -19
- package/dist/extract-experimental/resolveCatalogPath.d.ts +1 -1
- package/dist/extract-experimental/resolveCatalogPath.js +7 -14
- package/dist/extract-experimental/resolveTemplatePath.js +7 -10
- package/dist/extract-experimental/workers/extractWorker.d.ts +5 -3
- package/dist/extract-experimental/workers/extractWorker.js +7 -10
- package/dist/extract-experimental/workers/extractWorkerWrapper.prod.d.ts +8 -0
- package/dist/extract-experimental/workers/extractWorkerWrapper.prod.js +2 -0
- package/dist/extract-experimental/writeCatalogs.d.ts +2 -2
- package/dist/extract-experimental/writeCatalogs.js +15 -22
- package/dist/index.js +1 -5
- package/dist/lingui-compile.d.ts +1 -1
- package/dist/lingui-compile.js +45 -59
- package/dist/lingui-extract-experimental.d.ts +3 -2
- package/dist/lingui-extract-experimental.js +58 -62
- package/dist/lingui-extract-template.d.ts +5 -4
- package/dist/lingui-extract-template.js +25 -27
- package/dist/lingui-extract.d.ts +3 -4
- package/dist/lingui-extract.js +62 -69
- package/dist/lingui.js +5 -10
- package/dist/services/translationIO/segment-converters.d.ts +1 -1
- package/dist/services/translationIO/segment-converters.js +16 -20
- package/dist/services/translationIO/translationio-api.d.ts +11 -7
- package/dist/services/translationIO/translationio-api.js +2 -19
- package/dist/services/translationIO.d.ts +4 -4
- package/dist/services/translationIO.js +28 -35
- package/dist/workers/compileWorker.d.ts +8 -11
- package/dist/workers/compileWorker.js +30 -36
- package/dist/workers/compileWorkerWrapper.prod.d.ts +7 -0
- package/dist/workers/compileWorkerWrapper.prod.js +2 -0
- package/dist/workers/extractWorker.d.ts +2 -3
- package/dist/workers/extractWorker.js +5 -12
- package/dist/workers/extractWorkerWrapper.prod.d.ts +6 -0
- package/dist/workers/extractWorkerWrapper.prod.js +2 -0
- package/package.json +26 -43
- package/dist/api/extractWorkerPool.d.ts +0 -1
- package/dist/api/extractWorkerPool.js +0 -8
- package/dist/api/extractors/typescript.d.ts +0 -3
- package/dist/api/extractors/typescript.js +0 -11
- package/dist/extract-experimental/getEntryPoints.d.ts +0 -1
- package/dist/extract-experimental/getEntryPoints.js +0 -7
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const workerLogger_1 = require("../api/workerLogger");
|
|
7
|
-
const ProgramExit_1 = require("../api/ProgramExit");
|
|
8
|
-
const getCatalogs_1 = require("../api/catalog/getCatalogs");
|
|
1
|
+
import { compileLocale } from "../api/compile/compileLocale.js";
|
|
2
|
+
import { getConfig } from "@lingui/conf";
|
|
3
|
+
import { WorkerLogger } from "../api/workerLogger.js";
|
|
4
|
+
import { ProgramExit } from "../api/ProgramExit.js";
|
|
5
|
+
import { getCatalogs } from "../api/catalog/getCatalogs.js";
|
|
9
6
|
let linguiConfig;
|
|
10
7
|
let catalogs;
|
|
11
|
-
const compileWorker = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return { logs: logger.flush() };
|
|
37
|
-
},
|
|
8
|
+
export const compileWorker = async (locale, options, doMerge, linguiConfigPath) => {
|
|
9
|
+
if (!linguiConfig) {
|
|
10
|
+
// initialize config once per worker, speed up workers follow execution
|
|
11
|
+
linguiConfig = getConfig({
|
|
12
|
+
configPath: linguiConfigPath,
|
|
13
|
+
skipValidation: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (!catalogs) {
|
|
17
|
+
// catalogs holds path to the files and message catalogs, so it's kinda configuration object
|
|
18
|
+
// it depends only on the config, so we can initialize it once per program execution
|
|
19
|
+
catalogs = await getCatalogs(linguiConfig);
|
|
20
|
+
}
|
|
21
|
+
const logger = new WorkerLogger();
|
|
22
|
+
try {
|
|
23
|
+
await compileLocale(catalogs, locale, options, linguiConfig, doMerge, logger);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return {
|
|
27
|
+
logs: logger.flush(),
|
|
28
|
+
error,
|
|
29
|
+
exitProgram: error instanceof ProgramExit,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return { logs: logger.flush() };
|
|
38
33
|
};
|
|
39
|
-
(0, worker_1.expose)(compileWorker);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExtractedMessage } from "@lingui/conf";
|
|
2
2
|
export type ExtractWorkerFunction = typeof extractWorker;
|
|
3
|
-
declare const extractWorker: (filename: string, linguiConfigPath: string) => Promise<{
|
|
4
|
-
messages
|
|
3
|
+
export declare const extractWorker: (filename: string, linguiConfigPath: string) => Promise<{
|
|
4
|
+
messages: ExtractedMessage[];
|
|
5
5
|
success: boolean;
|
|
6
6
|
}>;
|
|
7
|
-
export {};
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const worker_1 = require("threads/worker");
|
|
7
|
-
const conf_1 = require("@lingui/conf");
|
|
8
|
-
const extractors_1 = __importDefault(require("../api/extractors"));
|
|
1
|
+
import { getConfig, } from "@lingui/conf";
|
|
2
|
+
import extract from "../api/extractors/index.js";
|
|
9
3
|
let linguiConfig;
|
|
10
|
-
const extractWorker = async (filename, linguiConfigPath) => {
|
|
4
|
+
export const extractWorker = async (filename, linguiConfigPath) => {
|
|
11
5
|
if (!linguiConfig) {
|
|
12
6
|
// initialize config once per worker, speed up workers follow execution
|
|
13
|
-
linguiConfig =
|
|
7
|
+
linguiConfig = getConfig({
|
|
14
8
|
configPath: linguiConfigPath,
|
|
15
9
|
skipValidation: true,
|
|
16
10
|
});
|
|
17
11
|
}
|
|
18
12
|
const messages = [];
|
|
19
|
-
const success = await (
|
|
13
|
+
const success = await extract(filename, (msg) => {
|
|
20
14
|
messages.push(msg);
|
|
21
15
|
}, linguiConfig);
|
|
22
16
|
return { success, messages };
|
|
23
17
|
};
|
|
24
|
-
(0, worker_1.expose)(extractWorker);
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-next.1",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"cli",
|
|
7
8
|
"i18n",
|
|
@@ -28,28 +29,16 @@
|
|
|
28
29
|
"lingui": "./dist/lingui.js"
|
|
29
30
|
},
|
|
30
31
|
"exports": {
|
|
31
|
-
".":
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
"./api": {
|
|
36
|
-
"types": "./dist/api/index.d.ts",
|
|
37
|
-
"default": "./dist/api/index.js"
|
|
38
|
-
},
|
|
39
|
-
"./api/extractors/babel": {
|
|
40
|
-
"types": "./dist/api/extractors/babel.d.ts",
|
|
41
|
-
"default": "./dist/api/extractors/babel.js"
|
|
42
|
-
},
|
|
43
|
-
"./api/extractors/typescript": {
|
|
44
|
-
"types": "./dist/api/extractors/typescript.d.ts",
|
|
45
|
-
"default": "./dist/api/extractors/typescript.js"
|
|
46
|
-
}
|
|
32
|
+
".": "./dist/index.js",
|
|
33
|
+
"./api": "./dist/api/index.js",
|
|
34
|
+
"./api/extractors/babel": "./dist/api/extractors/babel.js"
|
|
47
35
|
},
|
|
48
36
|
"scripts": {
|
|
49
|
-
"build": "
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"check-types": "tsc --noEmit"
|
|
50
39
|
},
|
|
51
40
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
41
|
+
"node": ">=22.19.0"
|
|
53
42
|
},
|
|
54
43
|
"files": [
|
|
55
44
|
"LICENSE",
|
|
@@ -58,43 +47,37 @@
|
|
|
58
47
|
],
|
|
59
48
|
"dependencies": {
|
|
60
49
|
"@babel/core": "^7.21.0",
|
|
61
|
-
"@babel/generator": "^7.
|
|
50
|
+
"@babel/generator": "^7.28.5",
|
|
62
51
|
"@babel/parser": "^7.22.0",
|
|
63
|
-
"@babel/runtime": "^7.21.0",
|
|
64
52
|
"@babel/types": "^7.21.2",
|
|
65
|
-
"@lingui/babel-plugin-extract-messages": "
|
|
66
|
-
"@lingui/babel-plugin-lingui-macro": "
|
|
67
|
-
"@lingui/conf": "
|
|
68
|
-
"@lingui/core": "
|
|
69
|
-
"@lingui/format-po": "
|
|
70
|
-
"@lingui/message-utils": "
|
|
71
|
-
"chokidar": "
|
|
72
|
-
"cli-
|
|
73
|
-
"commander": "^
|
|
74
|
-
"convert-source-map": "^2.0.0",
|
|
75
|
-
"date-fns": "^3.6.0",
|
|
53
|
+
"@lingui/babel-plugin-extract-messages": "6.0.0-next.1",
|
|
54
|
+
"@lingui/babel-plugin-lingui-macro": "6.0.0-next.1",
|
|
55
|
+
"@lingui/conf": "6.0.0-next.1",
|
|
56
|
+
"@lingui/core": "6.0.0-next.1",
|
|
57
|
+
"@lingui/format-po": "6.0.0-next.1",
|
|
58
|
+
"@lingui/message-utils": "6.0.0-next.1",
|
|
59
|
+
"chokidar": "5.0.0",
|
|
60
|
+
"cli-table3": "^0.6.5",
|
|
61
|
+
"commander": "^14.0.2",
|
|
76
62
|
"esbuild": "^0.25.1",
|
|
77
|
-
"
|
|
63
|
+
"jiti": "^2.6.1",
|
|
78
64
|
"micromatch": "^4.0.7",
|
|
79
65
|
"ms": "^2.1.3",
|
|
80
66
|
"normalize-path": "^3.0.0",
|
|
81
|
-
"ora": "^
|
|
82
|
-
"
|
|
83
|
-
"pofile": "^1.1.4",
|
|
84
|
-
"pseudolocale": "^2.0.0",
|
|
67
|
+
"ora": "^9.1.0",
|
|
68
|
+
"pseudolocale": "^2.2.0",
|
|
85
69
|
"source-map": "^0.7.6",
|
|
86
|
-
"
|
|
70
|
+
"tinypool": "^2.1.0"
|
|
87
71
|
},
|
|
88
72
|
"devDependencies": {
|
|
89
|
-
"@lingui/
|
|
90
|
-
"@types/
|
|
73
|
+
"@lingui/test-utils": "3.0.3",
|
|
74
|
+
"@types/babel__generator": "^7.27.0",
|
|
91
75
|
"@types/micromatch": "^4.0.1",
|
|
92
76
|
"@types/ms": "^2.1.0",
|
|
93
77
|
"@types/normalize-path": "^3.0.0",
|
|
94
78
|
"mock-fs": "^5.2.0",
|
|
95
|
-
"mockdate": "^3.0.5",
|
|
96
79
|
"msw": "^2.12.7",
|
|
97
|
-
"
|
|
80
|
+
"vitest": "4.0.18"
|
|
98
81
|
},
|
|
99
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "783af0c0371c7795e1fc43316f49dd253e161221"
|
|
100
83
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ExtractWorkerPool = ReturnType<typeof createExtractWorkerPool>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createExtractWorkerPool = createExtractWorkerPool;
|
|
4
|
-
const threads_1 = require("threads");
|
|
5
|
-
/** @internal */
|
|
6
|
-
function createExtractWorkerPool(opts) {
|
|
7
|
-
return (0, threads_1.Pool)(() => (0, threads_1.spawn)(new threads_1.Worker("../workers/extractWorker")), { size: opts.poolSize });
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const extractor = {
|
|
4
|
-
match(filename) {
|
|
5
|
-
throw new Error("Typescript extractor was removed. " +
|
|
6
|
-
"Lingui CLI can parse typescript out of the box. " +
|
|
7
|
-
"Please remove it from your lingui.config.js");
|
|
8
|
-
},
|
|
9
|
-
extract() { },
|
|
10
|
-
};
|
|
11
|
-
exports.default = extractor;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getEntryPoints(entries: string[]): string[];
|