@formatjs/cli-lib 8.2.1 → 8.2.2

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.2.1",
4
+ "version": "8.2.2",
5
5
  "license": "MIT",
6
6
  "author": "Linjie Ding <linjie@airtable.com>",
7
7
  "type": "module",
@@ -20,9 +20,9 @@
20
20
  "loud-rejection": "^2",
21
21
  "tslib": "^2.8.1",
22
22
  "typescript": "^5.6.0",
23
- "@formatjs/icu-messageformat-parser": "3.5.0",
24
- "@formatjs/icu-skeleton-parser": "2.1.0",
25
- "@formatjs/ts-transformer": "4.3.1"
23
+ "@formatjs/ts-transformer": "4.3.2",
24
+ "@formatjs/icu-skeleton-parser": "2.1.1",
25
+ "@formatjs/icu-messageformat-parser": "3.5.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@glimmer/syntax": "^0.84.3 || ^0.95.0",
package/src/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { program } from "commander";
2
- import { sync as globSync } from "fast-glob";
2
+ import * as glob from "fast-glob";
3
+ const globSync = glob.sync;
3
4
  import loudRejection from "loud-rejection";
4
5
  import compile from "./compile.js";
5
6
  import compileFolder from "./compile_folder.js";
package/src/extract.js CHANGED
@@ -102,11 +102,28 @@ export async function extract(files, extractOpts) {
102
102
  const stdinSource = await getStdinAsString();
103
103
  rawResults = [await processFile(stdinSource, "dummy", opts)];
104
104
  } else {
105
- rawResults = await Promise.all(files.map(async (fn) => {
106
- debug("Extracting file:", fn);
107
- const source = await readFile(fn, "utf8");
108
- return processFile(source, fn, opts);
109
- }));
105
+ // Use Promise.allSettled when throws is false to collect partial results
106
+ if (throws === false) {
107
+ const settledResults = await Promise.allSettled(files.map(async (fn) => {
108
+ debug("Extracting file:", fn);
109
+ const source = await readFile(fn, "utf8");
110
+ return processFile(source, fn, opts);
111
+ }));
112
+ rawResults = settledResults.map((result) => {
113
+ if (result.status === "fulfilled") {
114
+ return result.value;
115
+ } else {
116
+ warn(String(result.reason));
117
+ return undefined;
118
+ }
119
+ });
120
+ } else {
121
+ rawResults = await Promise.all(files.map(async (fn) => {
122
+ debug("Extracting file:", fn);
123
+ const source = await readFile(fn, "utf8");
124
+ return processFile(source, fn, opts);
125
+ }));
126
+ }
110
127
  }
111
128
  } catch (e) {
112
129
  if (throws) {