@lingui/cli 4.8.0-next.1 → 4.10.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/README.md +1 -2
- package/dist/api/catalog/getCatalogs.js +3 -1
- package/dist/api/catalog.js +10 -8
- package/dist/api/extractors/babel.js +10 -4
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ node_modules/.bin/lingui compile
|
|
|
60
60
|
|
|
61
61
|
## Usage
|
|
62
62
|
|
|
63
|
-
See the [
|
|
63
|
+
See the [reference][reference] documentation.
|
|
64
64
|
|
|
65
65
|
## License
|
|
66
66
|
|
|
@@ -69,7 +69,6 @@ This package is licensed under [MIT][license] license.
|
|
|
69
69
|
[license]: https://github.com/lingui/js-lingui/blob/main/LICENSE
|
|
70
70
|
[linguijs]: https://github.com/lingui/js-lingui
|
|
71
71
|
[documentation]: https://lingui.dev
|
|
72
|
-
[tutorial]: https://lingui.dev/tutorials/cli
|
|
73
72
|
[reference]: https://lingui.dev/ref/cli
|
|
74
73
|
[package]: https://www.npmjs.com/package/@lingui/cli
|
|
75
74
|
[badge-downloads]: https://img.shields.io/npm/dw/@lingui/cli.svg
|
|
@@ -95,7 +95,9 @@ function getCatalogForFile(file, catalogs) {
|
|
|
95
95
|
const catalogGlob = (0, utils_1.replacePlaceholders)(catalogFile, { locale: "*" });
|
|
96
96
|
const matchPattern = (0, utils_1.normalizeRelativePath)(path_1.default.relative(catalog.config.rootDir, catalogGlob))
|
|
97
97
|
.replace("(", "\\(")
|
|
98
|
-
.replace(")", "\\)")
|
|
98
|
+
.replace(")", "\\)")
|
|
99
|
+
.replace("[", "\\[")
|
|
100
|
+
.replace("]", "\\]");
|
|
99
101
|
const match = micromatch_1.default.capture(matchPattern, (0, utils_1.normalizeRelativePath)(file));
|
|
100
102
|
if (match) {
|
|
101
103
|
return {
|
package/dist/api/catalog.js
CHANGED
|
@@ -134,14 +134,16 @@ class Catalog {
|
|
|
134
134
|
}
|
|
135
135
|
async writeCompiled(locale, compiledCatalog, namespace) {
|
|
136
136
|
let ext;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
switch (namespace) {
|
|
138
|
+
case "es":
|
|
139
|
+
ext = "mjs";
|
|
140
|
+
break;
|
|
141
|
+
case "ts":
|
|
142
|
+
case "json":
|
|
143
|
+
ext = namespace;
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
ext = "js";
|
|
145
147
|
}
|
|
146
148
|
const filename = `${(0, utils_1.replacePlaceholders)(this.path, { locale })}.${ext}`;
|
|
147
149
|
await (0, utils_1.writeFile)(filename, compiledCatalog);
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.extractFromFileWithBabel = void 0;
|
|
7
7
|
const core_1 = require("@babel/core");
|
|
8
8
|
const babel_plugin_extract_messages_1 = __importDefault(require("@lingui/babel-plugin-extract-messages"));
|
|
9
|
-
const plugin_1 = __importDefault(require("@lingui/macro/plugin"));
|
|
10
9
|
const babelRe = new RegExp("\\.(" +
|
|
11
10
|
[...core_1.DEFAULT_EXTENSIONS, ".ts", ".mts", ".cts", ".tsx"]
|
|
12
11
|
.map((ext) => ext.slice(1))
|
|
@@ -89,10 +88,17 @@ async function extractFromFileWithBabel(filename, code, onMessageExtracted, ctx,
|
|
|
89
88
|
parserOpts,
|
|
90
89
|
plugins: [
|
|
91
90
|
[
|
|
92
|
-
|
|
91
|
+
"macros",
|
|
93
92
|
{
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
// macro plugin uses package `resolve` to find a path of macro file
|
|
94
|
+
// this will not follow jest pathMapping and will resolve path from ./build
|
|
95
|
+
// instead of ./src which makes testing & developing hard.
|
|
96
|
+
// here we override resolve and provide correct path for testing
|
|
97
|
+
resolvePath: (source) => require.resolve(source),
|
|
98
|
+
lingui: {
|
|
99
|
+
extract: true,
|
|
100
|
+
linguiConfig: ctx.linguiConfig,
|
|
101
|
+
},
|
|
96
102
|
},
|
|
97
103
|
],
|
|
98
104
|
[
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -53,19 +53,18 @@
|
|
|
53
53
|
"@babel/parser": "^7.21.2",
|
|
54
54
|
"@babel/runtime": "^7.21.0",
|
|
55
55
|
"@babel/types": "^7.21.2",
|
|
56
|
-
"@lingui/babel-plugin-extract-messages": "
|
|
57
|
-
"@lingui/conf": "
|
|
58
|
-
"@lingui/core": "
|
|
59
|
-
"@lingui/format-po": "
|
|
60
|
-
"@lingui/
|
|
61
|
-
"@lingui/message-utils": "^4.8.0-next.1",
|
|
56
|
+
"@lingui/babel-plugin-extract-messages": "4.10.0",
|
|
57
|
+
"@lingui/conf": "4.10.0",
|
|
58
|
+
"@lingui/core": "4.10.0",
|
|
59
|
+
"@lingui/format-po": "4.10.0",
|
|
60
|
+
"@lingui/message-utils": "4.10.0",
|
|
62
61
|
"babel-plugin-macros": "^3.0.1",
|
|
63
62
|
"chalk": "^4.1.0",
|
|
64
63
|
"chokidar": "3.5.1",
|
|
65
64
|
"cli-table": "0.3.6",
|
|
66
65
|
"commander": "^10.0.0",
|
|
67
66
|
"convert-source-map": "^2.0.0",
|
|
68
|
-
"date-fns": "^
|
|
67
|
+
"date-fns": "^3.6.0",
|
|
69
68
|
"esbuild": "^0.17.10",
|
|
70
69
|
"glob": "^7.1.4",
|
|
71
70
|
"inquirer": "^7.3.3",
|
|
@@ -80,7 +79,8 @@
|
|
|
80
79
|
"source-map": "^0.8.0-beta.0"
|
|
81
80
|
},
|
|
82
81
|
"devDependencies": {
|
|
83
|
-
"@lingui/jest-mocks": "
|
|
82
|
+
"@lingui/jest-mocks": "*",
|
|
83
|
+
"@lingui/macro": "4.10.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": "5088feb92de2a669659e85067c2849331122e830"
|
|
92
92
|
}
|