@lingui/cli 4.11.3 → 4.12.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.
|
@@ -93,11 +93,7 @@ function getCatalogForFile(file, catalogs) {
|
|
|
93
93
|
for (const catalog of catalogs) {
|
|
94
94
|
const catalogFile = `${catalog.path}${catalog.format.getCatalogExtension()}`;
|
|
95
95
|
const catalogGlob = (0, utils_1.replacePlaceholders)(catalogFile, { locale: "*" });
|
|
96
|
-
const matchPattern = (0, utils_1.normalizeRelativePath)(path_1.default.relative(catalog.config.rootDir, catalogGlob))
|
|
97
|
-
.replace("(", "\\(")
|
|
98
|
-
.replace(")", "\\)")
|
|
99
|
-
.replace("[", "\\[")
|
|
100
|
-
.replace("]", "\\]");
|
|
96
|
+
const matchPattern = (0, utils_1.normalizeRelativePath)(path_1.default.relative(catalog.config.rootDir, catalogGlob)).replace(/(\(|\)|\[|\])/g, "\\$1");
|
|
101
97
|
const match = micromatch_1.default.capture(matchPattern, (0, utils_1.normalizeRelativePath)(file));
|
|
102
98
|
if (match) {
|
|
103
99
|
return {
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getTranslationsForCatalog = void 0;
|
|
4
4
|
const getFallbackListForLocale_1 = require("./getFallbackListForLocale");
|
|
5
5
|
async function getTranslationsForCatalog(catalog, locale, options) {
|
|
6
|
-
const catalogs = await
|
|
7
|
-
|
|
6
|
+
const [catalogs, template] = await Promise.all([
|
|
7
|
+
catalog.readAll(),
|
|
8
|
+
catalog.readTemplate(),
|
|
9
|
+
]);
|
|
8
10
|
const sourceLocaleCatalog = catalogs[options.sourceLocale] || {};
|
|
9
11
|
const input = Object.assign(Object.assign(Object.assign({}, template), sourceLocaleCatalog), catalogs[locale]);
|
|
10
12
|
return Object.keys(input).reduce((acc, key) => {
|
|
@@ -121,7 +121,10 @@ const extractor = {
|
|
|
121
121
|
async extract(filename, code, onMessageExtracted, ctx) {
|
|
122
122
|
const parserOptions = ctx.linguiConfig.extractorParserOptions;
|
|
123
123
|
// https://babeljs.io/docs/en/babel-parser#latest-ecmascript-features
|
|
124
|
-
const parserPlugins = [
|
|
124
|
+
const parserPlugins = [
|
|
125
|
+
"importAttributes",
|
|
126
|
+
"explicitResourceManagement", // stage3,
|
|
127
|
+
];
|
|
125
128
|
if ([/\.ts$/, /\.mts$/, /\.cts$/, /\.tsx$/].some((r) => filename.match(r))) {
|
|
126
129
|
parserPlugins.push("typescript");
|
|
127
130
|
if (parserOptions.tsExperimentalDecorators) {
|
package/dist/lingui-extract.js
CHANGED
|
@@ -36,8 +36,8 @@ async function command(config, options) {
|
|
|
36
36
|
console.log();
|
|
37
37
|
});
|
|
38
38
|
if (!options.watch) {
|
|
39
|
-
console.log(`(
|
|
40
|
-
console.log(`(
|
|
39
|
+
console.log(`(Use "${chalk_1.default.yellow((0, help_1.helpRun)("extract"))}" to update catalogs with new messages.)`);
|
|
40
|
+
console.log(`(Use "${chalk_1.default.yellow((0, help_1.helpRun)("compile"))}" to compile catalogs for production. Alternatively, use bundler plugins: https://lingui.dev/ref/cli#compiling-catalogs-in-ci)`);
|
|
41
41
|
}
|
|
42
42
|
// If service key is present in configuration, synchronize with cloud translation platform
|
|
43
43
|
if (typeof config.service === "object" &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/core": "^7.21.0",
|
|
52
52
|
"@babel/generator": "^7.21.1",
|
|
53
|
-
"@babel/parser": "^7.
|
|
53
|
+
"@babel/parser": "^7.22.0",
|
|
54
54
|
"@babel/runtime": "^7.21.0",
|
|
55
55
|
"@babel/types": "^7.21.2",
|
|
56
|
-
"@lingui/babel-plugin-extract-messages": "4.
|
|
57
|
-
"@lingui/conf": "4.
|
|
58
|
-
"@lingui/core": "4.
|
|
59
|
-
"@lingui/format-po": "4.
|
|
60
|
-
"@lingui/message-utils": "4.
|
|
56
|
+
"@lingui/babel-plugin-extract-messages": "4.12.0",
|
|
57
|
+
"@lingui/conf": "4.12.0",
|
|
58
|
+
"@lingui/core": "4.12.0",
|
|
59
|
+
"@lingui/format-po": "4.12.0",
|
|
60
|
+
"@lingui/message-utils": "4.12.0",
|
|
61
61
|
"babel-plugin-macros": "^3.0.1",
|
|
62
62
|
"chalk": "^4.1.0",
|
|
63
63
|
"chokidar": "3.5.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"esbuild": "^0.17.10",
|
|
69
69
|
"glob": "^7.1.4",
|
|
70
70
|
"inquirer": "^7.3.3",
|
|
71
|
-
"micromatch": "4.0.2",
|
|
71
|
+
"micromatch": "^4.0.2",
|
|
72
72
|
"normalize-path": "^3.0.0",
|
|
73
73
|
"ora": "^5.1.0",
|
|
74
74
|
"pathe": "^1.1.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@lingui/jest-mocks": "*",
|
|
83
|
-
"@lingui/macro": "4.
|
|
83
|
+
"@lingui/macro": "4.12.0",
|
|
84
84
|
"@types/convert-source-map": "^2.0.0",
|
|
85
85
|
"@types/glob": "^8.1.0",
|
|
86
86
|
"@types/micromatch": "^4.0.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"mock-fs": "^5.2.0",
|
|
89
89
|
"mockdate": "^3.0.5"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "83a6ea03f22d6284bdcf067bde7b406c4e3520bc"
|
|
92
92
|
}
|