@formatjs/cli-lib 6.4.5 → 6.5.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 +4 -4
- package/src/cli.js +2 -0
- package/src/compile.d.ts +7 -0
- package/src/compile.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/cli-lib",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1",
|
|
4
4
|
"description": "Lib for CLI for formatjs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/estree": "^1.0.0",
|
|
35
35
|
"@types/fs-extra": "^9.0.1",
|
|
36
36
|
"@types/json-stable-stringify": "^1.0.32",
|
|
37
|
-
"@types/node": "14 || 16 || 17 || 18",
|
|
37
|
+
"@types/node": "14 || 16 || 17 || 18 || 20",
|
|
38
38
|
"chalk": "^4.0.0",
|
|
39
39
|
"commander": "8",
|
|
40
40
|
"fast-glob": "^3.2.7",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"loud-rejection": "^2.2.0",
|
|
44
44
|
"tslib": "^2.7.0",
|
|
45
45
|
"typescript": "5",
|
|
46
|
-
"@formatjs/icu-messageformat-parser": "2.
|
|
47
|
-
"@formatjs/ts-transformer": "3.13.
|
|
46
|
+
"@formatjs/icu-messageformat-parser": "2.8.0",
|
|
47
|
+
"@formatjs/ts-transformer": "3.13.17",
|
|
48
48
|
"@formatjs/icu-skeleton-parser": "1.8.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
package/src/cli.js
CHANGED
|
@@ -118,6 +118,8 @@ for more information`)
|
|
|
118
118
|
.option('--skip-errors', `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`)
|
|
119
119
|
.option('--pseudo-locale <pseudoLocale>', `Whether to generate pseudo-locale files. See https://formatjs.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values.
|
|
120
120
|
"--ast" is required for this to work.`)
|
|
121
|
+
.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
|
|
122
|
+
simple tags without any attributes.`)
|
|
121
123
|
.action(async (filePatterns, opts) => {
|
|
122
124
|
(0, console_utils_1.debug)('File pattern:', filePatterns);
|
|
123
125
|
(0, console_utils_1.debug)('Options:', opts);
|
package/src/compile.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export interface Opts {
|
|
|
26
26
|
* Whether to compile to pseudo locale
|
|
27
27
|
*/
|
|
28
28
|
pseudoLocale?: PseudoLocale;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the parser to treat HTML/XML tags as string literal
|
|
31
|
+
* instead of parsing them as tag token.
|
|
32
|
+
* When this is false we only allow simple tags without
|
|
33
|
+
* any attributes
|
|
34
|
+
*/
|
|
35
|
+
ignoreTag?: boolean;
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* Aggregate `inputFiles` into a single JSON blob and compile.
|
package/src/compile.js
CHANGED
|
@@ -20,7 +20,7 @@ const pseudo_locale_1 = require("./pseudo_locale");
|
|
|
20
20
|
*/
|
|
21
21
|
async function compile(inputFiles, opts = {}) {
|
|
22
22
|
(0, console_utils_1.debug)('Compiling files:', inputFiles);
|
|
23
|
-
const { ast, format, pseudoLocale, skipErrors } = opts;
|
|
23
|
+
const { ast, format, pseudoLocale, skipErrors, ignoreTag } = opts;
|
|
24
24
|
const formatter = await (0, formatters_1.resolveBuiltinFormatter)(format);
|
|
25
25
|
const messages = {};
|
|
26
26
|
const messageAsts = {};
|
|
@@ -40,7 +40,7 @@ Message from ${inputFile}: ${compiled[id]}
|
|
|
40
40
|
`);
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
const msgAst = (0, icu_messageformat_parser_1.parse)(compiled[id]);
|
|
43
|
+
const msgAst = (0, icu_messageformat_parser_1.parse)(compiled[id], { ignoreTag });
|
|
44
44
|
messages[id] = compiled[id];
|
|
45
45
|
switch (pseudoLocale) {
|
|
46
46
|
case 'xx-LS':
|