@formatjs/cli-lib 8.2.0 → 8.2.1
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/package.json +6 -10
- package/src/cli.js +1 -1
- package/src/hbs_extractor.js +10 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/cli-lib",
|
|
3
3
|
"description": "Lib for CLI for formatjs.",
|
|
4
|
-
"version": "8.2.
|
|
4
|
+
"version": "8.2.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Linjie Ding <linjie@airtable.com>",
|
|
7
7
|
"type": "module",
|
|
@@ -20,16 +20,15 @@
|
|
|
20
20
|
"loud-rejection": "^2",
|
|
21
21
|
"tslib": "^2.8.1",
|
|
22
22
|
"typescript": "^5.6.0",
|
|
23
|
-
"@formatjs/icu-messageformat-parser": "3.
|
|
23
|
+
"@formatjs/icu-messageformat-parser": "3.5.0",
|
|
24
24
|
"@formatjs/icu-skeleton-parser": "2.1.0",
|
|
25
|
-
"@formatjs/ts-transformer": "4.3.
|
|
25
|
+
"@formatjs/ts-transformer": "4.3.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@glimmer/syntax": "^0.95.0",
|
|
29
|
-
"@vue/compiler-core": "3.5.
|
|
28
|
+
"@glimmer/syntax": "^0.84.3 || ^0.95.0",
|
|
29
|
+
"@vue/compiler-core": "3.5.27",
|
|
30
30
|
"content-tag": "^4.1.0",
|
|
31
|
-
"
|
|
32
|
-
"vue": "3.5.26"
|
|
31
|
+
"vue": "3.5.27"
|
|
33
32
|
},
|
|
34
33
|
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
35
34
|
"homepage": "https://github.com/formatjs/formatjs",
|
|
@@ -70,9 +69,6 @@
|
|
|
70
69
|
"@glimmer/validator": {
|
|
71
70
|
"optional": true
|
|
72
71
|
},
|
|
73
|
-
"ember-template-recast": {
|
|
74
|
-
"optional": true
|
|
75
|
-
},
|
|
76
72
|
"content-tag": {
|
|
77
73
|
"optional": true
|
|
78
74
|
}
|
package/src/cli.js
CHANGED
|
@@ -104,7 +104,7 @@ type CompileFn = <T = Record<string, MessageDescriptor>>(
|
|
|
104
104
|
) => Record<string, string>;
|
|
105
105
|
\`\`\`
|
|
106
106
|
This is especially useful to convert from a TMS-specific format back to react-intl format
|
|
107
|
-
`).option("--ast", `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`).action(async (folder, outFolder, opts) => {
|
|
107
|
+
`).option("--ast", `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`).option("--skip-errors", `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`).option("--pseudo-locale <pseudoLocale>", `Whether to generate pseudo-locale files. See https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.`).option("--ignore-tag", `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow simple tags without any attributes.`).action(async (folder, outFolder, opts) => {
|
|
108
108
|
debug("Folder:", folder);
|
|
109
109
|
debug("Options:", opts);
|
|
110
110
|
// fast-glob expect `/` in Windows as well
|
package/src/hbs_extractor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@formatjs/ts-transformer";
|
|
2
|
-
import {
|
|
2
|
+
import { preprocess, traverse } from "@glimmer/syntax";
|
|
3
3
|
function extractText(node, fileName, options) {
|
|
4
4
|
if (!options.onMsgExtracted) return;
|
|
5
5
|
if (!options.overrideIdFn) return;
|
|
@@ -22,17 +22,13 @@ function extractText(node, fileName, options) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export function parseFile(source, fileName, options) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
// SAFETY: ember-template-recast's types are out of date,
|
|
36
|
-
// but it does not affect runtime
|
|
37
|
-
transform(source, visitor);
|
|
25
|
+
const ast = preprocess(source);
|
|
26
|
+
traverse(ast, {
|
|
27
|
+
MustacheStatement(node) {
|
|
28
|
+
extractText(node, fileName, options);
|
|
29
|
+
},
|
|
30
|
+
SubExpression(node) {
|
|
31
|
+
extractText(node, fileName, options);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
38
34
|
}
|