@formatjs/cli 6.12.0 → 6.12.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.
Files changed (2) hide show
  1. package/bin/formatjs +59 -40
  2. package/package.json +2 -2
package/bin/formatjs CHANGED
@@ -5431,7 +5431,7 @@ var require_scan = __commonJS({
5431
5431
  }
5432
5432
  let base = str;
5433
5433
  let prefix = "";
5434
- let glob = "";
5434
+ let glob2 = "";
5435
5435
  if (start > 0) {
5436
5436
  prefix = str.slice(0, start);
5437
5437
  str = str.slice(start);
@@ -5439,10 +5439,10 @@ var require_scan = __commonJS({
5439
5439
  }
5440
5440
  if (base && isGlob === true && lastIndex > 0) {
5441
5441
  base = str.slice(0, lastIndex);
5442
- glob = str.slice(lastIndex);
5442
+ glob2 = str.slice(lastIndex);
5443
5443
  } else if (isGlob === true) {
5444
5444
  base = "";
5445
- glob = str;
5445
+ glob2 = str;
5446
5446
  } else {
5447
5447
  base = str;
5448
5448
  }
@@ -5452,8 +5452,8 @@ var require_scan = __commonJS({
5452
5452
  }
5453
5453
  }
5454
5454
  if (opts.unescape === true) {
5455
- if (glob)
5456
- glob = utils.removeBackslashes(glob);
5455
+ if (glob2)
5456
+ glob2 = utils.removeBackslashes(glob2);
5457
5457
  if (base && backslashes === true) {
5458
5458
  base = utils.removeBackslashes(base);
5459
5459
  }
@@ -5463,7 +5463,7 @@ var require_scan = __commonJS({
5463
5463
  input,
5464
5464
  start,
5465
5465
  base,
5466
- glob,
5466
+ glob: glob2,
5467
5467
  isBrace,
5468
5468
  isBracket,
5469
5469
  isGlob,
@@ -6309,9 +6309,9 @@ var require_picomatch = __commonJS({
6309
6309
  var utils = require_utils2();
6310
6310
  var constants = require_constants2();
6311
6311
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
6312
- var picomatch = (glob, options, returnState = false) => {
6313
- if (Array.isArray(glob)) {
6314
- const fns = glob.map((input) => picomatch(input, options, returnState));
6312
+ var picomatch = (glob2, options, returnState = false) => {
6313
+ if (Array.isArray(glob2)) {
6314
+ const fns = glob2.map((input) => picomatch(input, options, returnState));
6315
6315
  const arrayMatcher = (str) => {
6316
6316
  for (const isMatch of fns) {
6317
6317
  const state2 = isMatch(str);
@@ -6322,13 +6322,13 @@ var require_picomatch = __commonJS({
6322
6322
  };
6323
6323
  return arrayMatcher;
6324
6324
  }
6325
- const isState = isObject(glob) && glob.tokens && glob.input;
6326
- if (glob === "" || typeof glob !== "string" && !isState) {
6325
+ const isState = isObject(glob2) && glob2.tokens && glob2.input;
6326
+ if (glob2 === "" || typeof glob2 !== "string" && !isState) {
6327
6327
  throw new TypeError("Expected pattern to be a non-empty string");
6328
6328
  }
6329
6329
  const opts = options || {};
6330
6330
  const posix = utils.isWindows(options);
6331
- const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
6331
+ const regex = isState ? picomatch.compileRe(glob2, options) : picomatch.makeRe(glob2, options, false, true);
6332
6332
  const state = regex.state;
6333
6333
  delete regex.state;
6334
6334
  let isIgnored = () => false;
@@ -6337,8 +6337,8 @@ var require_picomatch = __commonJS({
6337
6337
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
6338
6338
  }
6339
6339
  const matcher = (input, returnObject = false) => {
6340
- const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
6341
- const result = { glob, state, regex, posix, input, output, match, isMatch };
6340
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob: glob2, posix });
6341
+ const result = { glob: glob2, state, regex, posix, input, output, match, isMatch };
6342
6342
  if (typeof opts.onResult === "function") {
6343
6343
  opts.onResult(result);
6344
6344
  }
@@ -6363,7 +6363,7 @@ var require_picomatch = __commonJS({
6363
6363
  }
6364
6364
  return matcher;
6365
6365
  };
6366
- picomatch.test = (input, regex, options, { glob, posix } = {}) => {
6366
+ picomatch.test = (input, regex, options, { glob: glob2, posix } = {}) => {
6367
6367
  if (typeof input !== "string") {
6368
6368
  throw new TypeError("Expected input to be a string");
6369
6369
  }
@@ -6372,11 +6372,11 @@ var require_picomatch = __commonJS({
6372
6372
  }
6373
6373
  const opts = options || {};
6374
6374
  const format9 = opts.format || (posix ? utils.toPosixSlashes : null);
6375
- let match = input === glob;
6375
+ let match = input === glob2;
6376
6376
  let output = match && format9 ? format9(input) : input;
6377
6377
  if (match === false) {
6378
6378
  output = format9 ? format9(input) : input;
6379
- match = output === glob;
6379
+ match = output === glob2;
6380
6380
  }
6381
6381
  if (match === false || opts.capture === true) {
6382
6382
  if (opts.matchBase === true || opts.basename === true) {
@@ -6387,8 +6387,8 @@ var require_picomatch = __commonJS({
6387
6387
  }
6388
6388
  return { isMatch: Boolean(match), match, output };
6389
6389
  };
6390
- picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
6391
- const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
6390
+ picomatch.matchBase = (input, glob2, options, posix = utils.isWindows(options)) => {
6391
+ const regex = glob2 instanceof RegExp ? glob2 : picomatch.makeRe(glob2, options);
6392
6392
  return regex.test(path2.basename(input));
6393
6393
  };
6394
6394
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
@@ -6581,9 +6581,9 @@ var require_micromatch = __commonJS({
6581
6581
  }
6582
6582
  return [].concat(patterns).every((p2) => picomatch(p2, options)(str));
6583
6583
  };
6584
- micromatch.capture = (glob, input, options) => {
6584
+ micromatch.capture = (glob2, input, options) => {
6585
6585
  let posix = utils.isWindows(options);
6586
- let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
6586
+ let regex = picomatch.makeRe(String(glob2), { ...options, capture: true });
6587
6587
  let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
6588
6588
  if (match) {
6589
6589
  return match.slice(1).map((v) => v === void 0 ? "" : v);
@@ -7183,7 +7183,7 @@ var require_out = __commonJS({
7183
7183
  Object.defineProperty(exports, "__esModule", { value: true });
7184
7184
  exports.statSync = exports.stat = exports.Settings = void 0;
7185
7185
  var async = require_async();
7186
- var sync = require_sync();
7186
+ var sync2 = require_sync();
7187
7187
  var settings_1 = require_settings();
7188
7188
  exports.Settings = settings_1.default;
7189
7189
  function stat(path2, optionsOrSettingsOrCallback, callback) {
@@ -7196,7 +7196,7 @@ var require_out = __commonJS({
7196
7196
  exports.stat = stat;
7197
7197
  function statSync(path2, optionsOrSettings) {
7198
7198
  const settings = getSettings(optionsOrSettings);
7199
- return sync.read(path2, settings);
7199
+ return sync2.read(path2, settings);
7200
7200
  }
7201
7201
  exports.statSync = statSync;
7202
7202
  function getSettings(settingsOrOptions = {}) {
@@ -7574,7 +7574,7 @@ var require_out2 = __commonJS({
7574
7574
  Object.defineProperty(exports, "__esModule", { value: true });
7575
7575
  exports.Settings = exports.scandirSync = exports.scandir = void 0;
7576
7576
  var async = require_async2();
7577
- var sync = require_sync2();
7577
+ var sync2 = require_sync2();
7578
7578
  var settings_1 = require_settings2();
7579
7579
  exports.Settings = settings_1.default;
7580
7580
  function scandir(path2, optionsOrSettingsOrCallback, callback) {
@@ -7587,7 +7587,7 @@ var require_out2 = __commonJS({
7587
7587
  exports.scandir = scandir;
7588
7588
  function scandirSync(path2, optionsOrSettings) {
7589
7589
  const settings = getSettings(optionsOrSettings);
7590
- return sync.read(path2, settings);
7590
+ return sync2.read(path2, settings);
7591
7591
  }
7592
7592
  exports.scandirSync = scandirSync;
7593
7593
  function getSettings(settingsOrOptions = {}) {
@@ -9005,15 +9005,15 @@ var require_out4 = __commonJS({
9005
9005
  }
9006
9006
  (function(FastGlob2) {
9007
9007
  FastGlob2.glob = FastGlob2;
9008
- FastGlob2.globSync = sync;
9008
+ FastGlob2.globSync = sync2;
9009
9009
  FastGlob2.globStream = stream;
9010
9010
  FastGlob2.async = FastGlob2;
9011
- function sync(source, options) {
9011
+ function sync2(source, options) {
9012
9012
  assertPatternsInput(source);
9013
9013
  const works = getWorks(source, sync_1.default, options);
9014
9014
  return utils.array.flatten(works);
9015
9015
  }
9016
- FastGlob2.sync = sync;
9016
+ FastGlob2.sync = sync2;
9017
9017
  function stream(source, options) {
9018
9018
  assertPatternsInput(source);
9019
9019
  const works = getWorks(source, stream_1.default, options);
@@ -229909,7 +229909,7 @@ var {
229909
229909
  } = import_index.default;
229910
229910
 
229911
229911
  // packages/cli-lib/src/cli.ts
229912
- var import_fast_glob = __toESM(require_out4());
229912
+ var glob = __toESM(require_out4());
229913
229913
  var import_loud_rejection = __toESM(require_loud_rejection());
229914
229914
 
229915
229915
  // packages/cli-lib/src/compile.ts
@@ -230452,13 +230452,31 @@ async function extract(files, extractOpts) {
230452
230452
  const stdinSource = await getStdinAsString();
230453
230453
  rawResults = [await processFile(stdinSource, "dummy", opts)];
230454
230454
  } else {
230455
- rawResults = await Promise.all(
230456
- files.map(async (fn) => {
230457
- debug("Extracting file:", fn);
230458
- const source = await (0, import_promises.readFile)(fn, "utf8");
230459
- return processFile(source, fn, opts);
230460
- })
230461
- );
230455
+ if (throws === false) {
230456
+ const settledResults = await Promise.allSettled(
230457
+ files.map(async (fn) => {
230458
+ debug("Extracting file:", fn);
230459
+ const source = await (0, import_promises.readFile)(fn, "utf8");
230460
+ return processFile(source, fn, opts);
230461
+ })
230462
+ );
230463
+ rawResults = settledResults.map((result) => {
230464
+ if (result.status === "fulfilled") {
230465
+ return result.value;
230466
+ } else {
230467
+ warn(String(result.reason));
230468
+ return void 0;
230469
+ }
230470
+ });
230471
+ } else {
230472
+ rawResults = await Promise.all(
230473
+ files.map(async (fn) => {
230474
+ debug("Extracting file:", fn);
230475
+ const source = await (0, import_promises.readFile)(fn, "utf8");
230476
+ return processFile(source, fn, opts);
230477
+ })
230478
+ );
230479
+ }
230462
230480
  }
230463
230481
  } catch (e) {
230464
230482
  if (throws) {
@@ -230689,6 +230707,7 @@ async function verify(files, { sourceLocale, missingKeys, extraKeys, structuralE
230689
230707
  // packages/cli-lib/src/cli.ts
230690
230708
  var import_path4 = require("path");
230691
230709
  var import_fs = require("fs");
230710
+ var globSync = glob.sync;
230692
230711
  var KNOWN_COMMANDS = ["extract"];
230693
230712
  async function main(argv) {
230694
230713
  (0, import_loud_rejection.default)();
@@ -230778,7 +230797,7 @@ sentences are not translator-friendly.`
230778
230797
  const files = [];
230779
230798
  if (filePatterns.length) {
230780
230799
  files.push(
230781
- ...(0, import_fast_glob.sync)(filePatterns, {
230800
+ ...globSync(filePatterns, {
230782
230801
  ignore: cmdObj.ignore
230783
230802
  })
230784
230803
  );
@@ -230839,7 +230858,7 @@ This is especially useful to convert from a TMS-specific format back to react-in
230839
230858
  ).action(async (filePatterns, opts) => {
230840
230859
  debug("File pattern:", filePatterns);
230841
230860
  debug("Options:", opts);
230842
- const files = (0, import_fast_glob.sync)(filePatterns);
230861
+ const files = globSync(filePatterns);
230843
230862
  if (!files.length) {
230844
230863
  throw new Error(`No input file found with pattern ${filePatterns}`);
230845
230864
  }
@@ -230873,7 +230892,7 @@ This is especially useful to convert from a TMS-specific format back to react-in
230873
230892
  ).action(async (folder, outFolder, opts) => {
230874
230893
  debug("Folder:", folder);
230875
230894
  debug("Options:", opts);
230876
- const files = (0, import_fast_glob.sync)(`${folder}/*.json`);
230895
+ const files = globSync(`${folder}/*.json`);
230877
230896
  if (!files.length) {
230878
230897
  throw new Error(`No JSON file found in ${folder}`);
230879
230898
  }
@@ -230901,7 +230920,7 @@ This is especially useful to convert from a TMS-specific format back to react-in
230901
230920
  ).action(async (filePatterns, opts) => {
230902
230921
  debug("File pattern:", filePatterns);
230903
230922
  debug("Options:", opts);
230904
- const files = (0, import_fast_glob.sync)(filePatterns, {
230923
+ const files = globSync(filePatterns, {
230905
230924
  ignore: opts.ignore
230906
230925
  });
230907
230926
  if (!files.length) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@formatjs/cli",
3
3
  "description": "A CLI for formatjs.",
4
- "version": "6.12.0",
4
+ "version": "6.12.1",
5
5
  "license": "MIT",
6
6
  "author": "Linjie Ding <linjie@airtable.com>",
7
7
  "engines": {
8
8
  "node": ">= 16"
9
9
  },
10
10
  "devDependencies": {
11
- "@formatjs/cli-lib": "8.2.1"
11
+ "@formatjs/cli-lib": "8.2.2"
12
12
  },
13
13
  "peerDependencies": {
14
14
  "@glimmer/syntax": "^0.84.3 || ^0.95.0",