@formatjs/cli-lib 8.0.7 → 8.1.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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/extract.js +3 -7
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.0.7",
4
+ "version": "8.1.0",
5
5
  "license": "MIT",
6
6
  "author": "Linjie Ding <linjie@airtable.com>",
7
7
  "type": "module",
@@ -13,21 +13,21 @@
13
13
  "@types/fs-extra": "^11.0.4",
14
14
  "@types/node": "^22.0.0",
15
15
  "chalk": "^4.1.2",
16
- "commander": "^13",
16
+ "commander": "^14.0.0",
17
17
  "fast-glob": "^3.3.2",
18
18
  "fs-extra": "^11.2.0",
19
19
  "json-stable-stringify": "^1.3.0",
20
20
  "loud-rejection": "^2",
21
21
  "tslib": "^2.8.0",
22
22
  "typescript": "^5.6.0",
23
- "@formatjs/icu-messageformat-parser": "3.2.0",
24
- "@formatjs/icu-skeleton-parser": "2.0.6",
25
- "@formatjs/ts-transformer": "4.0.7"
23
+ "@formatjs/icu-messageformat-parser": "3.2.1",
24
+ "@formatjs/ts-transformer": "4.1.0",
25
+ "@formatjs/icu-skeleton-parser": "2.0.7"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@glimmer/syntax": "^0.95.0",
29
29
  "@vue/compiler-core": "^3.5.12",
30
- "content-tag": "^3.0.0",
30
+ "content-tag": "4",
31
31
  "ember-template-recast": "^6.1.5",
32
32
  "vue": "^3.5.12"
33
33
  },
package/src/extract.js CHANGED
@@ -2,9 +2,6 @@ import { interpolateName, } from '@formatjs/ts-transformer';
2
2
  import { outputFile } from 'fs-extra/esm';
3
3
  import { debug, getStdinAsString, warn, writeStdout } from './console_utils.js';
4
4
  import * as stringifyNs from 'json-stable-stringify';
5
- import { parse } from '@formatjs/icu-messageformat-parser';
6
- import { hoistSelectors } from '@formatjs/icu-messageformat-parser/manipulator.js';
7
- import { printAST } from '@formatjs/icu-messageformat-parser/printer.js';
8
5
  import { resolveBuiltinFormatter } from './formatters/index.js';
9
6
  import { parseScript } from './parse_script.js';
10
7
  import { readFile } from 'fs/promises';
@@ -99,7 +96,7 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
99
96
  * matters for some `format`
100
97
  */
101
98
  export async function extract(files, extractOpts) {
102
- const { throws, readFromStdin, flatten, ...opts } = extractOpts;
99
+ const { throws, readFromStdin, ...opts } = extractOpts;
103
100
  let rawResults = [];
104
101
  try {
105
102
  if (readFromStdin) {
@@ -164,9 +161,8 @@ ${JSON.stringify(message, undefined, 2)}`);
164
161
  const results = {};
165
162
  const messages = Array.from(extractedMessages.values());
166
163
  for (const { id, ...msg } of messages) {
167
- if (flatten && msg.defaultMessage) {
168
- msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
169
- }
164
+ // GH #3537: flatten is now applied during extraction in the babel plugin,
165
+ // so we don't need to apply it again here. The messages are already flattened.
170
166
  results[id] = msg;
171
167
  }
172
168
  if (typeof formatter.serialize === 'function') {