@lingui/cli 5.3.2 → 5.3.3
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/catalog/extractFromFiles.js +4 -4
- package/dist/api/messages.js +3 -3
- package/dist/api/stats.js +2 -2
- package/dist/extract-experimental/writeCatalogs.js +2 -2
- package/dist/lingui-compile.js +9 -9
- package/dist/lingui-extract-experimental.js +2 -2
- package/dist/lingui-extract-template.js +2 -2
- package/dist/lingui-extract.js +9 -9
- package/package.json +14 -14
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.extractFromFiles = extractFromFiles;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const extractors_1 = __importDefault(require("../extractors"));
|
|
10
10
|
const utils_1 = require("../utils");
|
|
@@ -42,9 +42,9 @@ async function extractFromFiles(paths, config) {
|
|
|
42
42
|
: "";
|
|
43
43
|
const origin = [filename, next.origin[1]];
|
|
44
44
|
if (prev.message && next.message && prev.message !== next.message) {
|
|
45
|
-
throw new Error(`Encountered different default translations for message ${
|
|
46
|
-
`\n${
|
|
47
|
-
`\n${
|
|
45
|
+
throw new Error(`Encountered different default translations for message ${picocolors_1.default.yellow(next.id)}` +
|
|
46
|
+
`\n${picocolors_1.default.yellow((0, utils_1.prettyOrigin)(prev.origin))} ${prev.message}` +
|
|
47
|
+
`\n${picocolors_1.default.yellow((0, utils_1.prettyOrigin)([origin]))} ${next.message}`);
|
|
48
48
|
}
|
|
49
49
|
messages[next.id] = Object.assign(Object.assign({}, prev), { message: (_a = prev.message) !== null && _a !== void 0 ? _a : next.message, comments: next.comment
|
|
50
50
|
? [...prev.comments, next.comment]
|
package/dist/api/messages.js
CHANGED
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createMissingErrorMessage = createMissingErrorMessage;
|
|
7
7
|
exports.createCompilationErrorMessage = createCompilationErrorMessage;
|
|
8
|
-
const
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
function createMissingErrorMessage(locale, missingMessages, configurationMsg) {
|
|
10
|
-
let message = `Failed to compile catalog for locale ${
|
|
10
|
+
let message = `Failed to compile catalog for locale ${picocolors_1.default.bold(locale)}!
|
|
11
11
|
|
|
12
12
|
Missing ${missingMessages.length} translation(s):
|
|
13
13
|
\n`;
|
|
@@ -20,7 +20,7 @@ Missing ${missingMessages.length} translation(s):
|
|
|
20
20
|
return message;
|
|
21
21
|
}
|
|
22
22
|
function createCompilationErrorMessage(locale, errors) {
|
|
23
|
-
let message = `Failed to compile catalog for locale ${
|
|
23
|
+
let message = `Failed to compile catalog for locale ${picocolors_1.default.bold(locale)}!
|
|
24
24
|
|
|
25
25
|
Compilation error for ${errors.length} translation(s):
|
|
26
26
|
\n`;
|
package/dist/api/stats.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.printStats = printStats;
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
const cli_table_1 = __importDefault(require("cli-table"));
|
|
11
|
-
const
|
|
11
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
12
12
|
function getStats(catalog) {
|
|
13
13
|
return [
|
|
14
14
|
Object.keys(catalog).length,
|
|
@@ -33,7 +33,7 @@ function printStats(config, catalogs) {
|
|
|
33
33
|
// was not extracted due to a `--locale` filter
|
|
34
34
|
const [all, translated] = catalog ? getStats(catalog) : ["-", "-"];
|
|
35
35
|
if (config.sourceLocale === locale) {
|
|
36
|
-
table.push({ [`${
|
|
36
|
+
table.push({ [`${picocolors_1.default.bold(locale)} (source)`]: [all, "-"] });
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
39
|
table.push({ [locale]: [all, translated] });
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.writeCatalogs = writeCatalogs;
|
|
7
7
|
exports.writeTemplate = writeTemplate;
|
|
8
8
|
const resolveTemplatePath_1 = require("./resolveTemplatePath");
|
|
9
|
-
const
|
|
9
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
10
10
|
const resolveCatalogPath_1 = require("./resolveCatalogPath");
|
|
11
11
|
const mergeCatalog_1 = require("../api/catalog/mergeCatalog");
|
|
12
12
|
const stats_1 = require("../api/stats");
|
|
@@ -35,6 +35,6 @@ async function writeTemplate(params) {
|
|
|
35
35
|
const catalogOutput = (0, resolveTemplatePath_1.resolveTemplatePath)(entryPoint, outputPattern, linguiConfig.rootDir, format.getTemplateExtension());
|
|
36
36
|
await format.write(catalogOutput, cleanAndSort(messages, clean, linguiConfig.orderBy), undefined);
|
|
37
37
|
return {
|
|
38
|
-
statMessage: `${
|
|
38
|
+
statMessage: `${picocolors_1.default.bold(Object.keys(messages).length)} message(s) extracted`,
|
|
39
39
|
};
|
|
40
40
|
}
|
package/dist/lingui-compile.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.command = command;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
9
|
const commander_1 = require("commander");
|
|
10
10
|
const conf_1 = require("@lingui/conf");
|
|
@@ -29,9 +29,9 @@ async function command(config, options) {
|
|
|
29
29
|
if (!options.allowEmpty &&
|
|
30
30
|
locale !== config.pseudoLocale &&
|
|
31
31
|
missingMessages.length > 0) {
|
|
32
|
-
console.error(
|
|
32
|
+
console.error(picocolors_1.default.red(`Error: Failed to compile catalog for locale ${picocolors_1.default.bold(locale)}!`));
|
|
33
33
|
if (options.verbose) {
|
|
34
|
-
console.error(
|
|
34
|
+
console.error(picocolors_1.default.red("Missing translations:"));
|
|
35
35
|
missingMessages.forEach((missing) => {
|
|
36
36
|
const source = missing.source || missing.source === missing.id
|
|
37
37
|
? `: (${missing.source})`
|
|
@@ -40,7 +40,7 @@ async function command(config, options) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
console.error(
|
|
43
|
+
console.error(picocolors_1.default.red(`Missing ${missingMessages.length} translation(s)`));
|
|
44
44
|
}
|
|
45
45
|
console.error();
|
|
46
46
|
return false;
|
|
@@ -77,17 +77,17 @@ async function compileAndWrite(locale, config, options, catalogToWrite, messages
|
|
|
77
77
|
let message = (0, api_1.createCompilationErrorMessage)(locale, errors);
|
|
78
78
|
if (options.failOnCompileError) {
|
|
79
79
|
message += `These errors fail command execution because \`--strict\` option passed`;
|
|
80
|
-
console.error(
|
|
80
|
+
console.error(picocolors_1.default.red(message));
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
84
|
message += `You can fail command execution on these errors by passing \`--strict\` option`;
|
|
85
|
-
console.error(
|
|
85
|
+
console.error(picocolors_1.default.red(message));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
let compiledPath = await catalogToWrite.writeCompiled(locale, compiledCatalog, namespace);
|
|
89
89
|
compiledPath = (0, normalize_path_1.default)(path_1.default.relative(config.rootDir, compiledPath));
|
|
90
|
-
options.verbose && console.error(
|
|
90
|
+
options.verbose && console.error(picocolors_1.default.green(`${locale} ⇒ ${compiledPath}`));
|
|
91
91
|
return true;
|
|
92
92
|
}
|
|
93
93
|
if (require.main === module) {
|
|
@@ -135,7 +135,7 @@ if (require.main === module) {
|
|
|
135
135
|
};
|
|
136
136
|
// Check if Watch Mode is enabled
|
|
137
137
|
if (options.watch) {
|
|
138
|
-
console.info(
|
|
138
|
+
console.info(picocolors_1.default.bold("Initializing Watch Mode..."));
|
|
139
139
|
(async function initWatch() {
|
|
140
140
|
const format = await (0, api_1.getFormat)(config.format, config.formatOptions, config.sourceLocale);
|
|
141
141
|
const catalogs = await (0, api_1.getCatalogs)(config);
|
|
@@ -151,7 +151,7 @@ if (require.main === module) {
|
|
|
151
151
|
persistent: true,
|
|
152
152
|
});
|
|
153
153
|
const onReady = () => {
|
|
154
|
-
console.info(
|
|
154
|
+
console.info(picocolors_1.default.green(picocolors_1.default.bold("Watcher is ready!")));
|
|
155
155
|
watcher
|
|
156
156
|
.on("add", () => dispatchCompile())
|
|
157
157
|
.on("change", () => dispatchCompile());
|
|
@@ -15,7 +15,7 @@ const normalize_path_1 = __importDefault(require("normalize-path"));
|
|
|
15
15
|
const bundleSource_1 = require("./extract-experimental/bundleSource");
|
|
16
16
|
const writeCatalogs_1 = require("./extract-experimental/writeCatalogs");
|
|
17
17
|
const getEntryPoints_1 = require("./extract-experimental/getEntryPoints");
|
|
18
|
-
const
|
|
18
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
19
19
|
const babel_1 = require("./api/extractors/babel");
|
|
20
20
|
async function command(linguiConfig, options) {
|
|
21
21
|
var _a;
|
|
@@ -24,7 +24,7 @@ async function command(linguiConfig, options) {
|
|
|
24
24
|
if (!config) {
|
|
25
25
|
throw new Error("The configuration for experimental extractor is empty. Please read the docs.");
|
|
26
26
|
}
|
|
27
|
-
console.log(
|
|
27
|
+
console.log(picocolors_1.default.yellow([
|
|
28
28
|
"You have using an experimental feature",
|
|
29
29
|
"Experimental features are not covered by semver, and may cause unexpected or broken application behavior." +
|
|
30
30
|
" Use at your own risk.",
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = command;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const commander_1 = require("commander");
|
|
9
9
|
const conf_1 = require("@lingui/conf");
|
|
10
10
|
const api_1 = require("./api");
|
|
@@ -23,7 +23,7 @@ async function command(config, options) {
|
|
|
23
23
|
commandSuccess && (commandSuccess = Boolean(result));
|
|
24
24
|
}));
|
|
25
25
|
Object.entries(catalogStats).forEach(([key, value]) => {
|
|
26
|
-
console.log(`Catalog statistics for ${
|
|
26
|
+
console.log(`Catalog statistics for ${picocolors_1.default.bold(key)}: ${picocolors_1.default.green(value)} messages`);
|
|
27
27
|
console.log();
|
|
28
28
|
});
|
|
29
29
|
return commandSuccess;
|
package/dist/lingui-extract.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = command;
|
|
7
|
-
const
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
8
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
9
|
const commander_1 = require("commander");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
@@ -37,8 +37,8 @@ async function command(config, options) {
|
|
|
37
37
|
console.log();
|
|
38
38
|
});
|
|
39
39
|
if (!options.watch) {
|
|
40
|
-
console.log(`(Use "${
|
|
41
|
-
console.log(`(Use "${
|
|
40
|
+
console.log(`(Use "${picocolors_1.default.yellow((0, help_1.helpRun)("extract"))}" to update catalogs with new messages.)`);
|
|
41
|
+
console.log(`(Use "${picocolors_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)`);
|
|
42
42
|
}
|
|
43
43
|
// If service key is present in configuration, synchronize with cloud translation platform
|
|
44
44
|
if (typeof config.service === "object" &&
|
|
@@ -83,18 +83,18 @@ if (require.main === module) {
|
|
|
83
83
|
if (prevFormat && config.format === prevFormat) {
|
|
84
84
|
hasErrors = true;
|
|
85
85
|
console.error("Trying to migrate message catalog to the same format");
|
|
86
|
-
console.error(`Set ${
|
|
87
|
-
` and ${
|
|
86
|
+
console.error(`Set ${picocolors_1.default.bold("new")} format in LinguiJS configuration\n` +
|
|
87
|
+
` and ${picocolors_1.default.bold("previous")} format using --convert-from option.`);
|
|
88
88
|
console.log();
|
|
89
89
|
console.log(`Example: Convert from lingui format to minimal`);
|
|
90
|
-
console.log(
|
|
90
|
+
console.log(picocolors_1.default.yellow((0, help_1.helpRun)(`extract --convert-from lingui`)));
|
|
91
91
|
process.exit(1);
|
|
92
92
|
}
|
|
93
93
|
if (options.locale) {
|
|
94
94
|
const missingLocale = options.locale.find((l) => !config.locales.includes(l));
|
|
95
95
|
if (missingLocale) {
|
|
96
96
|
hasErrors = true;
|
|
97
|
-
console.error(`Locale ${
|
|
97
|
+
console.error(`Locale ${picocolors_1.default.bold(missingLocale)} does not exist.`);
|
|
98
98
|
console.error();
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -132,7 +132,7 @@ if (require.main === module) {
|
|
|
132
132
|
};
|
|
133
133
|
// Check if Watch Mode is enabled
|
|
134
134
|
if (options.watch) {
|
|
135
|
-
console.info(
|
|
135
|
+
console.info(picocolors_1.default.bold("Initializing Watch Mode..."));
|
|
136
136
|
(async function initWatch() {
|
|
137
137
|
const catalogs = await (0, api_1.getCatalogs)(config);
|
|
138
138
|
const paths = [];
|
|
@@ -146,7 +146,7 @@ if (require.main === module) {
|
|
|
146
146
|
persistent: true,
|
|
147
147
|
});
|
|
148
148
|
const onReady = () => {
|
|
149
|
-
console.info(
|
|
149
|
+
console.info(picocolors_1.default.green(picocolors_1.default.bold("Watcher is ready!")));
|
|
150
150
|
watcher
|
|
151
151
|
.on("add", (path) => dispatchExtract([path]))
|
|
152
152
|
.on("change", (path) => dispatchExtract([path]));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"translation",
|
|
13
13
|
"multilingual"
|
|
14
14
|
],
|
|
15
|
-
"repository":
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/lingui/js-lingui.git",
|
|
18
|
+
"directory": "packages/cli"
|
|
19
|
+
},
|
|
16
20
|
"bugs": "https://github.com/lingui/js-lingui/issues",
|
|
17
21
|
"license": "MIT",
|
|
18
22
|
"author": {
|
|
@@ -57,14 +61,12 @@
|
|
|
57
61
|
"@babel/parser": "^7.22.0",
|
|
58
62
|
"@babel/runtime": "^7.21.0",
|
|
59
63
|
"@babel/types": "^7.21.2",
|
|
60
|
-
"@lingui/babel-plugin-extract-messages": "5.3.
|
|
61
|
-
"@lingui/babel-plugin-lingui-macro": "5.3.
|
|
62
|
-
"@lingui/conf": "5.3.
|
|
63
|
-
"@lingui/core": "5.3.
|
|
64
|
-
"@lingui/format-po": "5.3.
|
|
65
|
-
"@lingui/message-utils": "5.3.
|
|
66
|
-
"babel-plugin-macros": "^3.0.1",
|
|
67
|
-
"chalk": "^4.1.0",
|
|
64
|
+
"@lingui/babel-plugin-extract-messages": "5.3.3",
|
|
65
|
+
"@lingui/babel-plugin-lingui-macro": "5.3.3",
|
|
66
|
+
"@lingui/conf": "5.3.3",
|
|
67
|
+
"@lingui/core": "5.3.3",
|
|
68
|
+
"@lingui/format-po": "5.3.3",
|
|
69
|
+
"@lingui/message-utils": "5.3.3",
|
|
68
70
|
"chokidar": "3.5.1",
|
|
69
71
|
"cli-table": "^0.3.11",
|
|
70
72
|
"commander": "^10.0.0",
|
|
@@ -72,12 +74,10 @@
|
|
|
72
74
|
"date-fns": "^3.6.0",
|
|
73
75
|
"esbuild": "^0.25.1",
|
|
74
76
|
"glob": "^11.0.0",
|
|
75
|
-
"inquirer": "^7.3.3",
|
|
76
77
|
"micromatch": "^4.0.7",
|
|
77
78
|
"normalize-path": "^3.0.0",
|
|
78
79
|
"ora": "^5.1.0",
|
|
79
|
-
"
|
|
80
|
-
"pkg-up": "^3.1.0",
|
|
80
|
+
"picocolors": "^1.1.1",
|
|
81
81
|
"pofile": "^1.1.4",
|
|
82
82
|
"pseudolocale": "^2.0.0",
|
|
83
83
|
"source-map": "^0.8.0-beta.0"
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"mock-fs": "^5.2.0",
|
|
91
91
|
"mockdate": "^3.0.5"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "f8dc4af3d9110f53613bb1b2fb303d6751e7a7b1"
|
|
94
94
|
}
|