@formatjs/cli-lib 8.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formatjs/cli-lib",
3
3
  "description": "Lib for CLI for formatjs.",
4
- "version": "8.1.1",
4
+ "version": "8.2.1",
5
5
  "license": "MIT",
6
6
  "author": "Linjie Ding <linjie@airtable.com>",
7
7
  "type": "module",
@@ -9,27 +9,26 @@
9
9
  "node": ">= 16"
10
10
  },
11
11
  "dependencies": {
12
- "@types/estree": "^1.0.6",
12
+ "@types/estree": "^1.0.8",
13
13
  "@types/fs-extra": "^11.0.4",
14
- "@types/node": "^22.0.0",
14
+ "@types/node": "^22.19.5",
15
15
  "chalk": "^4.1.2",
16
16
  "commander": "^14.0.0",
17
- "fast-glob": "^3.3.2",
18
- "fs-extra": "^11.2.0",
17
+ "fast-glob": "^3.3.3",
18
+ "fs-extra": "^11.3.3",
19
19
  "json-stable-stringify": "^1.3.0",
20
20
  "loud-rejection": "^2",
21
- "tslib": "^2.8.0",
21
+ "tslib": "^2.8.1",
22
22
  "typescript": "^5.6.0",
23
- "@formatjs/icu-messageformat-parser": "3.3.0",
24
- "@formatjs/icu-skeleton-parser": "2.0.8",
25
- "@formatjs/ts-transformer": "4.2.0"
23
+ "@formatjs/icu-messageformat-parser": "3.5.0",
24
+ "@formatjs/icu-skeleton-parser": "2.1.0",
25
+ "@formatjs/ts-transformer": "4.3.1"
26
26
  },
27
27
  "peerDependencies": {
28
- "@glimmer/syntax": "^0.95.0",
29
- "@vue/compiler-core": "^3.5.12",
30
- "content-tag": "4",
31
- "ember-template-recast": "^6.1.5",
32
- "vue": "^3.5.12"
28
+ "@glimmer/syntax": "^0.84.3 || ^0.95.0",
29
+ "@vue/compiler-core": "3.5.27",
30
+ "content-tag": "^4.1.0",
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
@@ -1,7 +1,5 @@
1
1
  export declare const writeStderr: (arg1: string | Uint8Array) => Promise<void>;
2
2
  export declare const writeStdout: (arg1: string | Uint8Array) => Promise<void>;
3
- // From:
4
- // https://github.com/yarnpkg/yarn/blob/53d8004229f543f342833310d5af63a4b6e59c8a/src/reporters/console/util.js
5
3
  export declare function clearLine(terminal: (typeof process)["stderr"]): Promise<void>;
6
4
  export declare function debug(message: string, ...args: any[]): Promise<void>;
7
5
  export declare function warn(message: string, ...args: any[]): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import "@formatjs/ts-transformer";
2
- import { transform } from "ember-template-recast";
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
- let visitor = function() {
26
- return {
27
- MustacheStatement(node) {
28
- extractText(node, fileName, options);
29
- },
30
- SubExpression(node) {
31
- extractText(node, fileName, options);
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
  }