@lingui/cli 5.4.1 → 5.5.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/dist/api/ProgramExit.d.ts +3 -0
- package/dist/api/ProgramExit.js +10 -0
- package/dist/api/catalog/extractFromFiles.d.ts +4 -1
- package/dist/api/catalog/extractFromFiles.js +56 -29
- package/dist/api/catalog/getCatalogs.d.ts +1 -1
- package/dist/api/catalog/getCatalogs.js +6 -9
- package/dist/api/catalog/getTranslationsForCatalog.d.ts +4 -2
- package/dist/api/catalog/getTranslationsForCatalog.js +18 -6
- package/dist/api/catalog.d.ts +16 -9
- package/dist/api/catalog.js +29 -29
- package/dist/api/compile/compileLocale.d.ts +5 -0
- package/dist/api/compile/compileLocale.js +84 -0
- package/dist/api/extractWorkerPool.d.ts +1 -0
- package/dist/api/extractWorkerPool.js +8 -0
- package/dist/api/extractors/babel.js +1 -0
- package/dist/api/extractors/index.d.ts +2 -6
- package/dist/api/extractors/index.js +2 -2
- package/dist/api/logger.d.ts +3 -0
- package/dist/api/logger.js +2 -0
- package/dist/api/resolveWorkersOptions.d.ts +6 -0
- package/dist/api/resolveWorkersOptions.js +21 -0
- package/dist/api/stats.js +9 -1
- package/dist/api/workerLogger.d.ts +9 -0
- package/dist/api/workerLogger.js +19 -0
- package/dist/extract-experimental/extractFromBundleAndWrite.d.ts +19 -0
- package/dist/extract-experimental/extractFromBundleAndWrite.js +63 -0
- package/dist/extract-experimental/workers/extractWorker.d.ts +6 -0
- package/dist/extract-experimental/workers/extractWorker.js +32 -0
- package/dist/lingui-compile.d.ts +2 -0
- package/dist/lingui-compile.js +48 -84
- package/dist/lingui-extract-experimental.d.ts +4 -2
- package/dist/lingui-extract-experimental.js +48 -46
- package/dist/lingui-extract-template.d.ts +2 -0
- package/dist/lingui-extract-template.js +23 -6
- package/dist/lingui-extract.d.ts +2 -0
- package/dist/lingui-extract.js +32 -8
- package/dist/workers/compileWorker.d.ts +11 -0
- package/dist/workers/compileWorker.js +39 -0
- package/dist/workers/extractWorker.d.ts +7 -0
- package/dist/workers/extractWorker.js +24 -0
- package/package.json +14 -10
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const worker_1 = require("threads/worker");
|
|
4
|
+
const compileLocale_1 = require("../api/compile/compileLocale");
|
|
5
|
+
const conf_1 = require("@lingui/conf");
|
|
6
|
+
const workerLogger_1 = require("../api/workerLogger");
|
|
7
|
+
const ProgramExit_1 = require("../api/ProgramExit");
|
|
8
|
+
const getCatalogs_1 = require("../api/catalog/getCatalogs");
|
|
9
|
+
let linguiConfig;
|
|
10
|
+
let catalogs;
|
|
11
|
+
const compileWorker = {
|
|
12
|
+
compileLocale: async (locale, options, doMerge, linguiConfigPath) => {
|
|
13
|
+
if (!linguiConfig) {
|
|
14
|
+
// initialize config once per worker, speed up workers follow execution
|
|
15
|
+
linguiConfig = (0, conf_1.getConfig)({
|
|
16
|
+
configPath: linguiConfigPath,
|
|
17
|
+
skipValidation: true,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!catalogs) {
|
|
21
|
+
// catalogs holds path to the files and message catalogs, so it's kinda configuration object
|
|
22
|
+
// it depends only on the config, so we can initialize it once per program execution
|
|
23
|
+
catalogs = await (0, getCatalogs_1.getCatalogs)(linguiConfig);
|
|
24
|
+
}
|
|
25
|
+
const logger = new workerLogger_1.WorkerLogger();
|
|
26
|
+
try {
|
|
27
|
+
await (0, compileLocale_1.compileLocale)(catalogs, locale, options, linguiConfig, doMerge, logger);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
logs: logger.flush(),
|
|
32
|
+
error,
|
|
33
|
+
exitProgram: error instanceof ProgramExit_1.ProgramExit,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return { logs: logger.flush() };
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
(0, worker_1.expose)(compileWorker);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExtractedMessage } from "@lingui/conf";
|
|
2
|
+
export type ExtractWorkerFunction = typeof extractWorker;
|
|
3
|
+
declare const extractWorker: (filename: string, linguiConfigPath: string) => Promise<{
|
|
4
|
+
messages?: ExtractedMessage[];
|
|
5
|
+
success: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
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"));
|
|
9
|
+
let linguiConfig;
|
|
10
|
+
const extractWorker = async (filename, linguiConfigPath) => {
|
|
11
|
+
if (!linguiConfig) {
|
|
12
|
+
// initialize config once per worker, speed up workers follow execution
|
|
13
|
+
linguiConfig = (0, conf_1.getConfig)({
|
|
14
|
+
configPath: linguiConfigPath,
|
|
15
|
+
skipValidation: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const messages = [];
|
|
19
|
+
const success = await (0, extractors_1.default)(filename, (msg) => {
|
|
20
|
+
messages.push(msg);
|
|
21
|
+
}, linguiConfig);
|
|
22
|
+
return { success, messages };
|
|
23
|
+
};
|
|
24
|
+
(0, worker_1.expose)(extractWorker);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"@babel/parser": "^7.22.0",
|
|
63
63
|
"@babel/runtime": "^7.21.0",
|
|
64
64
|
"@babel/types": "^7.21.2",
|
|
65
|
-
"@lingui/babel-plugin-extract-messages": "5.
|
|
66
|
-
"@lingui/babel-plugin-lingui-macro": "5.
|
|
67
|
-
"@lingui/conf": "5.
|
|
68
|
-
"@lingui/core": "5.
|
|
69
|
-
"@lingui/format-po": "5.
|
|
70
|
-
"@lingui/message-utils": "5.
|
|
65
|
+
"@lingui/babel-plugin-extract-messages": "5.5.0",
|
|
66
|
+
"@lingui/babel-plugin-lingui-macro": "5.5.0",
|
|
67
|
+
"@lingui/conf": "5.5.0",
|
|
68
|
+
"@lingui/core": "5.5.0",
|
|
69
|
+
"@lingui/format-po": "5.5.0",
|
|
70
|
+
"@lingui/message-utils": "5.5.0",
|
|
71
71
|
"chokidar": "3.5.1",
|
|
72
72
|
"cli-table": "^0.3.11",
|
|
73
73
|
"commander": "^10.0.0",
|
|
@@ -76,20 +76,24 @@
|
|
|
76
76
|
"esbuild": "^0.25.1",
|
|
77
77
|
"glob": "^11.0.0",
|
|
78
78
|
"micromatch": "^4.0.7",
|
|
79
|
+
"ms": "^2.1.3",
|
|
79
80
|
"normalize-path": "^3.0.0",
|
|
80
81
|
"ora": "^5.1.0",
|
|
81
82
|
"picocolors": "^1.1.1",
|
|
82
83
|
"pofile": "^1.1.4",
|
|
83
84
|
"pseudolocale": "^2.0.0",
|
|
84
|
-
"source-map": "^0.8.0-beta.0"
|
|
85
|
+
"source-map": "^0.8.0-beta.0",
|
|
86
|
+
"threads": "^1.7.0"
|
|
85
87
|
},
|
|
86
88
|
"devDependencies": {
|
|
87
89
|
"@lingui/jest-mocks": "*",
|
|
88
90
|
"@types/convert-source-map": "^2.0.0",
|
|
89
91
|
"@types/micromatch": "^4.0.1",
|
|
92
|
+
"@types/ms": "^2.1.0",
|
|
90
93
|
"@types/normalize-path": "^3.0.0",
|
|
91
94
|
"mock-fs": "^5.2.0",
|
|
92
|
-
"mockdate": "^3.0.5"
|
|
95
|
+
"mockdate": "^3.0.5",
|
|
96
|
+
"ts-node": "^10.9.2"
|
|
93
97
|
},
|
|
94
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "26700f071cd540651822b7f786d3c1d07c9d8625"
|
|
95
99
|
}
|