@lingui/cli 5.0.0-next.3 → 5.0.0-next.5
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 -51
- package/dist/api/catalog/mergeCatalog.js +1 -1
- package/dist/api/extractors/babel.js +2 -1
- package/dist/api/extractors/index.js +1 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/package.json +12 -8
package/README.md
CHANGED
|
@@ -8,57 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
`@lingui/cli` is part of [LinguiJS][linguijs]. See the [documentation][documentation] for all information, tutorials and examples.
|
|
10
10
|
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
The library can be installed globally or locally using `yarn` or `npm`. The recommended way is installing the package locally. This ensures that everyone who uses the project has the same version and does not need to install additional packages.
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
npm install --save-dev @lingui/cli
|
|
17
|
-
# or using yarn
|
|
18
|
-
yarn add --dev @lingui/cli
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
To run the library locally there are three options, with the first one been recommended one.
|
|
22
|
-
|
|
23
|
-
### 1) Add commands to scripts
|
|
24
|
-
|
|
25
|
-
Add these scripts to your `package.json`.
|
|
26
|
-
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
"scripts": {
|
|
30
|
-
"extract": "lingui extract",
|
|
31
|
-
"compile": "lingui compile"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Then you can use:
|
|
37
|
-
|
|
38
|
-
```sh
|
|
39
|
-
npm run extract
|
|
40
|
-
npm run compile
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 2) Use NPX
|
|
44
|
-
|
|
45
|
-
You can run the scripts directly using a tool for executing Node packages `NPX`. `NPX` is included in `NPM` version 5.2 and higher.
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
npx lingui extract
|
|
49
|
-
npx lingui compile
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 3) Run commands directly
|
|
53
|
-
|
|
54
|
-
You can run commands directly from `node_modules` folder.
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
node_modules/.bin/lingui extract
|
|
58
|
-
node_modules/.bin/lingui compile
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Usage
|
|
11
|
+
## Installation & Usage
|
|
62
12
|
|
|
63
13
|
See the [reference][reference] documentation.
|
|
64
14
|
|
|
@@ -48,7 +48,7 @@ function mergeCatalog(prevCatalog, nextCatalog, forSourceLocale, options) {
|
|
|
48
48
|
// Mark all remaining translations as obsolete
|
|
49
49
|
// Only if *options.files* is not provided
|
|
50
50
|
const obsoleteMessages = obsoleteKeys.map((key) => ({
|
|
51
|
-
[key]: Object.assign(Object.assign({}, prevCatalog[key]), { obsolete:
|
|
51
|
+
[key]: Object.assign(Object.assign({}, prevCatalog[key]), (!options.files && { obsolete: true })),
|
|
52
52
|
}));
|
|
53
53
|
return R.mergeAll([newMessages, ...mergedMessages, ...obsoleteMessages]);
|
|
54
54
|
}
|
|
@@ -117,7 +117,8 @@ function getBabelParserOptions(filename, parserOptions) {
|
|
|
117
117
|
// https://babeljs.io/docs/en/babel-parser#latest-ecmascript-features
|
|
118
118
|
const parserPlugins = [
|
|
119
119
|
"importAttributes",
|
|
120
|
-
"explicitResourceManagement",
|
|
120
|
+
"explicitResourceManagement",
|
|
121
|
+
"decoratorAutoAccessors", // stage3,
|
|
121
122
|
];
|
|
122
123
|
if ([/\.ts$/, /\.mts$/, /\.cts$/, /\.tsx$/].some((r) => filename.match(r))) {
|
|
123
124
|
parserPlugins.push("typescript");
|
|
@@ -9,15 +9,7 @@ const DEFAULT_EXTRACTORS = [babel_1.default];
|
|
|
9
9
|
async function extract(filename, onMessageExtracted, linguiConfig, options) {
|
|
10
10
|
var _a;
|
|
11
11
|
const extractorsToExtract = (_a = options.extractors) !== null && _a !== void 0 ? _a : DEFAULT_EXTRACTORS;
|
|
12
|
-
for (let
|
|
13
|
-
let ext = e;
|
|
14
|
-
if (typeof e === "string") {
|
|
15
|
-
// in case of the user using require.resolve in their extractors, we require that module
|
|
16
|
-
ext = require(e);
|
|
17
|
-
}
|
|
18
|
-
if (ext.default) {
|
|
19
|
-
ext = ext.default;
|
|
20
|
-
}
|
|
12
|
+
for (let ext of extractorsToExtract) {
|
|
21
13
|
if (!ext.match(filename))
|
|
22
14
|
continue;
|
|
23
15
|
try {
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineConfig } from "@lingui/conf";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineConfig = void 0;
|
|
4
|
+
var conf_1 = require("@lingui/conf");
|
|
5
|
+
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return conf_1.defineConfig; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.5",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"lingui": "./dist/lingui.js"
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
26
30
|
"./api": {
|
|
27
31
|
"types": "./dist/api/index.d.ts",
|
|
28
32
|
"default": "./dist/api/index.js"
|
|
@@ -53,12 +57,12 @@
|
|
|
53
57
|
"@babel/parser": "^7.22.0",
|
|
54
58
|
"@babel/runtime": "^7.21.0",
|
|
55
59
|
"@babel/types": "^7.21.2",
|
|
56
|
-
"@lingui/babel-plugin-extract-messages": "^5.0.0-next.
|
|
57
|
-
"@lingui/babel-plugin-lingui-macro": "^5.0.0-next.
|
|
58
|
-
"@lingui/conf": "^5.0.0-next.
|
|
59
|
-
"@lingui/core": "^5.0.0-next.
|
|
60
|
-
"@lingui/format-po": "^5.0.0-next.
|
|
61
|
-
"@lingui/message-utils": "^5.0.0-next.
|
|
60
|
+
"@lingui/babel-plugin-extract-messages": "^5.0.0-next.5",
|
|
61
|
+
"@lingui/babel-plugin-lingui-macro": "^5.0.0-next.5",
|
|
62
|
+
"@lingui/conf": "^5.0.0-next.5",
|
|
63
|
+
"@lingui/core": "^5.0.0-next.5",
|
|
64
|
+
"@lingui/format-po": "^5.0.0-next.5",
|
|
65
|
+
"@lingui/message-utils": "^5.0.0-next.5",
|
|
62
66
|
"babel-plugin-macros": "^3.0.1",
|
|
63
67
|
"chalk": "^4.1.0",
|
|
64
68
|
"chokidar": "3.5.1",
|
|
@@ -87,5 +91,5 @@
|
|
|
87
91
|
"mock-fs": "^5.2.0",
|
|
88
92
|
"mockdate": "^3.0.5"
|
|
89
93
|
},
|
|
90
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "3e342f7cca8772e54fc76fa90261bf52c6976b95"
|
|
91
95
|
}
|