@formatjs/cli 6.13.2 → 6.13.4

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 +188 -53
  2. package/package.json +2 -2
package/bin/formatjs CHANGED
@@ -4654,7 +4654,7 @@ var require_parse = __commonJS({
4654
4654
  CHAR_NO_BREAK_SPACE,
4655
4655
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
4656
4656
  } = require_constants();
4657
- var parse4 = (input, options = {}) => {
4657
+ var parse5 = (input, options = {}) => {
4658
4658
  if (typeof input !== "string") {
4659
4659
  throw new TypeError("Expected a string");
4660
4660
  }
@@ -4858,7 +4858,7 @@ var require_parse = __commonJS({
4858
4858
  push({ type: "eos" });
4859
4859
  return ast;
4860
4860
  };
4861
- module2.exports = parse4;
4861
+ module2.exports = parse5;
4862
4862
  }
4863
4863
  });
4864
4864
 
@@ -4869,7 +4869,7 @@ var require_braces = __commonJS({
4869
4869
  var stringify4 = require_stringify();
4870
4870
  var compile8 = require_compile();
4871
4871
  var expand = require_expand();
4872
- var parse4 = require_parse();
4872
+ var parse5 = require_parse();
4873
4873
  var braces = (input, options = {}) => {
4874
4874
  let output = [];
4875
4875
  if (Array.isArray(input)) {
@@ -4889,7 +4889,7 @@ var require_braces = __commonJS({
4889
4889
  }
4890
4890
  return output;
4891
4891
  };
4892
- braces.parse = (input, options = {}) => parse4(input, options);
4892
+ braces.parse = (input, options = {}) => parse5(input, options);
4893
4893
  braces.stringify = (input, options = {}) => {
4894
4894
  if (typeof input === "string") {
4895
4895
  return stringify4(braces.parse(input, options), options);
@@ -5547,7 +5547,7 @@ var require_parse2 = __commonJS({
5547
5547
  var syntaxError = (type, char) => {
5548
5548
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
5549
5549
  };
5550
- var parse4 = (input, options) => {
5550
+ var parse5 = (input, options) => {
5551
5551
  if (typeof input !== "string") {
5552
5552
  throw new TypeError("Expected a string");
5553
5553
  }
@@ -5697,7 +5697,7 @@ var require_parse2 = __commonJS({
5697
5697
  output = token.close = `)$))${extglobStar}`;
5698
5698
  }
5699
5699
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
5700
- const expression = parse4(rest, { ...options, fastpaths: false }).output;
5700
+ const expression = parse5(rest, { ...options, fastpaths: false }).output;
5701
5701
  output = token.close = `)${expression})${extglobStar})`;
5702
5702
  }
5703
5703
  if (token.prev.type === "bos") {
@@ -6226,7 +6226,7 @@ var require_parse2 = __commonJS({
6226
6226
  }
6227
6227
  return state;
6228
6228
  };
6229
- parse4.fastpaths = (input, options) => {
6229
+ parse5.fastpaths = (input, options) => {
6230
6230
  const opts = { ...options };
6231
6231
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6232
6232
  const len = input.length;
@@ -6295,7 +6295,7 @@ var require_parse2 = __commonJS({
6295
6295
  }
6296
6296
  return source;
6297
6297
  };
6298
- module2.exports = parse4;
6298
+ module2.exports = parse5;
6299
6299
  }
6300
6300
  });
6301
6301
 
@@ -6305,7 +6305,7 @@ var require_picomatch = __commonJS({
6305
6305
  "use strict";
6306
6306
  var path2 = require("path");
6307
6307
  var scan = require_scan();
6308
- var parse4 = require_parse2();
6308
+ var parse5 = require_parse2();
6309
6309
  var utils = require_utils2();
6310
6310
  var constants = require_constants2();
6311
6311
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -6395,7 +6395,7 @@ var require_picomatch = __commonJS({
6395
6395
  picomatch.parse = (pattern, options) => {
6396
6396
  if (Array.isArray(pattern))
6397
6397
  return pattern.map((p2) => picomatch.parse(p2, options));
6398
- return parse4(pattern, { ...options, fastpaths: false });
6398
+ return parse5(pattern, { ...options, fastpaths: false });
6399
6399
  };
6400
6400
  picomatch.scan = (input, options) => scan(input, options);
6401
6401
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -6421,10 +6421,10 @@ var require_picomatch = __commonJS({
6421
6421
  }
6422
6422
  let parsed = { negated: false, fastpaths: true };
6423
6423
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
6424
- parsed.output = parse4.fastpaths(input, options);
6424
+ parsed.output = parse5.fastpaths(input, options);
6425
6425
  }
6426
6426
  if (!parsed.output) {
6427
- parsed = parse4(input, options);
6427
+ parsed = parse5(input, options);
6428
6428
  }
6429
6429
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
6430
6430
  };
@@ -12719,8 +12719,8 @@ var require_graceful_fs = __commonJS({
12719
12719
  fs2.createReadStream = createReadStream;
12720
12720
  fs2.createWriteStream = createWriteStream;
12721
12721
  var fs$readFile = fs2.readFile;
12722
- fs2.readFile = readFile2;
12723
- function readFile2(path2, options, cb) {
12722
+ fs2.readFile = readFile3;
12723
+ function readFile3(path2, options, cb) {
12724
12724
  if (typeof options === "function")
12725
12725
  cb = options, options = null;
12726
12726
  return go$readFile(path2, options, cb);
@@ -14156,7 +14156,7 @@ var require_jsonfile = __commonJS({
14156
14156
  }
14157
14157
  return obj;
14158
14158
  }
14159
- var readFile2 = universalify.fromPromise(_readFile);
14159
+ var readFile3 = universalify.fromPromise(_readFile);
14160
14160
  function readFileSync2(file, options = {}) {
14161
14161
  if (typeof options === "string") {
14162
14162
  options = { encoding: options };
@@ -14188,7 +14188,7 @@ var require_jsonfile = __commonJS({
14188
14188
  return fs.writeFileSync(file, str, options);
14189
14189
  }
14190
14190
  module2.exports = {
14191
- readFile: readFile2,
14191
+ readFile: readFile3,
14192
14192
  readFileSync: readFileSync2,
14193
14193
  writeFile,
14194
14194
  writeFileSync
@@ -24931,7 +24931,7 @@ ${lanes.join("\n")}
24931
24931
  writeOutputIsTTY() {
24932
24932
  return process.stdout.isTTY;
24933
24933
  },
24934
- readFile: readFile2,
24934
+ readFile: readFile3,
24935
24935
  writeFile: writeFile2,
24936
24936
  watchFile: watchFile2,
24937
24937
  watchDirectory,
@@ -25137,7 +25137,7 @@ ${lanes.join("\n")}
25137
25137
  callback
25138
25138
  );
25139
25139
  }
25140
- function readFile2(fileName, _encoding) {
25140
+ function readFile3(fileName, _encoding) {
25141
25141
  let buffer;
25142
25142
  try {
25143
25143
  buffer = _fs.readFileSync(fileName);
@@ -61783,7 +61783,7 @@ ${lanes.join("\n")}
61783
61783
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
61784
61784
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
61785
61785
  }
61786
- function parseCommandLineWorker(diagnostics, commandLine, readFile2) {
61786
+ function parseCommandLineWorker(diagnostics, commandLine, readFile3) {
61787
61787
  const options = {};
61788
61788
  let watchOptions;
61789
61789
  const fileNames = [];
@@ -61831,7 +61831,7 @@ ${lanes.join("\n")}
61831
61831
  }
61832
61832
  }
61833
61833
  function parseResponseFile(fileName) {
61834
- const text = tryReadFile(fileName, readFile2 || ((fileName2) => sys2.readFile(fileName2)));
61834
+ const text = tryReadFile(fileName, readFile3 || ((fileName2) => sys2.readFile(fileName2)));
61835
61835
  if (!isString(text)) {
61836
61836
  errors.push(text);
61837
61837
  return;
@@ -61939,8 +61939,8 @@ ${lanes.join("\n")}
61939
61939
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
61940
61940
  optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
61941
61941
  };
61942
- function parseCommandLine(commandLine, readFile2) {
61943
- return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile2);
61942
+ function parseCommandLine(commandLine, readFile3) {
61943
+ return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile3);
61944
61944
  }
61945
61945
  function getOptionFromName(optionName, allowShort) {
61946
61946
  return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
@@ -62022,8 +62022,8 @@ ${lanes.join("\n")}
62022
62022
  watchOptionsToExtend
62023
62023
  );
62024
62024
  }
62025
- function readConfigFile(fileName, readFile2) {
62026
- const textOrDiagnostic = tryReadFile(fileName, readFile2);
62025
+ function readConfigFile(fileName, readFile3) {
62026
+ const textOrDiagnostic = tryReadFile(fileName, readFile3);
62027
62027
  return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
62028
62028
  }
62029
62029
  function parseConfigFileTextToJson(fileName, jsonText) {
@@ -62038,14 +62038,14 @@ ${lanes.join("\n")}
62038
62038
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
62039
62039
  };
62040
62040
  }
62041
- function readJsonConfigFile(fileName, readFile2) {
62042
- const textOrDiagnostic = tryReadFile(fileName, readFile2);
62041
+ function readJsonConfigFile(fileName, readFile3) {
62042
+ const textOrDiagnostic = tryReadFile(fileName, readFile3);
62043
62043
  return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
62044
62044
  }
62045
- function tryReadFile(fileName, readFile2) {
62045
+ function tryReadFile(fileName, readFile3) {
62046
62046
  let text;
62047
62047
  try {
62048
- text = readFile2(fileName);
62048
+ text = readFile3(fileName);
62049
62049
  } catch (e) {
62050
62050
  return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
62051
62051
  }
@@ -152233,12 +152233,12 @@ ${lanes.join("\n")}
152233
152233
  function createCompilerHost(options, setParentNodes) {
152234
152234
  return createCompilerHostWorker(options, setParentNodes);
152235
152235
  }
152236
- function createGetSourceFile(readFile2, setParentNodes) {
152236
+ function createGetSourceFile(readFile3, setParentNodes) {
152237
152237
  return (fileName, languageVersionOrOptions, onError) => {
152238
152238
  let text;
152239
152239
  try {
152240
152240
  mark("beforeIORead");
152241
- text = readFile2(fileName);
152241
+ text = readFile3(fileName);
152242
152242
  mark("afterIORead");
152243
152243
  measure("I/O Read", "beforeIORead", "afterIORead");
152244
152244
  } catch (e) {
@@ -153165,7 +153165,7 @@ ${lanes.join("\n")}
153165
153165
  getRedirectFromOutput,
153166
153166
  forEachResolvedProjectReference: forEachResolvedProjectReference2
153167
153167
  });
153168
- const readFile2 = host.readFile.bind(host);
153168
+ const readFile3 = host.readFile.bind(host);
153169
153169
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
153170
153170
  const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
153171
153171
  (_f = tracing) == null ? void 0 : _f.pop();
@@ -153392,7 +153392,7 @@ ${lanes.join("\n")}
153392
153392
  shouldTransformImportCall,
153393
153393
  emitBuildInfo,
153394
153394
  fileExists,
153395
- readFile: readFile2,
153395
+ readFile: readFile3,
153396
153396
  directoryExists,
153397
153397
  getSymlinkCache,
153398
153398
  realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
@@ -190752,7 +190752,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
190752
190752
  var fixId37 = "fixMissingTypeAnnotationOnExports";
190753
190753
  var addAnnotationFix = "add-annotation";
190754
190754
  var addInlineTypeAssertion = "add-type-assertion";
190755
- var extractExpression = "extract-expression";
190755
+ var extractExpression2 = "extract-expression";
190756
190756
  var errorCodes48 = [
190757
190757
  Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
190758
190758
  Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
@@ -190804,7 +190804,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
190804
190804
  addCodeAction(addInlineTypeAssertion, fixes, context, 0, (f) => f.addInlineAssertion(context.span));
190805
190805
  addCodeAction(addInlineTypeAssertion, fixes, context, 1, (f) => f.addInlineAssertion(context.span));
190806
190806
  addCodeAction(addInlineTypeAssertion, fixes, context, 2, (f) => f.addInlineAssertion(context.span));
190807
- addCodeAction(extractExpression, fixes, context, 0, (f) => f.extractAsVariable(context.span));
190807
+ addCodeAction(extractExpression2, fixes, context, 0, (f) => f.extractAsVariable(context.span));
190808
190808
  return fixes;
190809
190809
  },
190810
190810
  getAllCodeActions: (context) => {
@@ -204693,7 +204693,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204693
204693
  return ts_textChanges_exports.ChangeTracker.with(
204694
204694
  { host, formatContext, preferences },
204695
204695
  (changeTracker) => {
204696
- const parsed = contents.map((c) => parse4(sourceFile, c));
204696
+ const parsed = contents.map((c) => parse5(sourceFile, c));
204697
204697
  const flattenedLocations = focusLocations && flatten2(focusLocations);
204698
204698
  for (const nodes of parsed) {
204699
204699
  placeNodeGroup(
@@ -204706,7 +204706,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204706
204706
  }
204707
204707
  );
204708
204708
  }
204709
- function parse4(sourceFile, content) {
204709
+ function parse5(sourceFile, content) {
204710
204710
  const nodeKinds = [
204711
204711
  {
204712
204712
  parse: () => createSourceFile(
@@ -229505,10 +229505,137 @@ var init_vue_extractor = __esm({
229505
229505
  }
229506
229506
  });
229507
229507
 
229508
+ // packages/cli-lib/src/svelte_extractor.ts
229509
+ var svelte_extractor_exports = {};
229510
+ __export(svelte_extractor_exports, {
229511
+ parseFile: () => parseFile2
229512
+ });
229513
+ function walkFragment(fragment, source, parseScriptFn) {
229514
+ if (!fragment || !fragment.nodes) {
229515
+ return;
229516
+ }
229517
+ for (const node of fragment.nodes) {
229518
+ walkNode(node, source, parseScriptFn);
229519
+ }
229520
+ }
229521
+ function extractExpression(expression, source, parseScriptFn) {
229522
+ if (!expression || expression.start == null || expression.end == null) {
229523
+ return;
229524
+ }
229525
+ const content = source.slice(expression.start, expression.end);
229526
+ try {
229527
+ parseScriptFn(`(${content})`);
229528
+ } catch (e) {
229529
+ console.warn(
229530
+ `Failed to parse "${content}". Ignore this if content has no extractable message`,
229531
+ e
229532
+ );
229533
+ }
229534
+ }
229535
+ function walkNode(node, source, parseScriptFn) {
229536
+ switch (node.type) {
229537
+ case "ExpressionTag":
229538
+ extractExpression(node.expression, source, parseScriptFn);
229539
+ break;
229540
+ case "ConstTag":
229541
+ if (node.declaration) {
229542
+ const content = source.slice(
229543
+ node.declaration.start,
229544
+ node.declaration.end
229545
+ );
229546
+ try {
229547
+ parseScriptFn(content);
229548
+ } catch (e) {
229549
+ console.warn(
229550
+ `Failed to parse const declaration. Ignore this if content has no extractable message`,
229551
+ e
229552
+ );
229553
+ }
229554
+ }
229555
+ break;
229556
+ case "IfBlock":
229557
+ extractExpression(node.test, source, parseScriptFn);
229558
+ walkFragment(node.consequent, source, parseScriptFn);
229559
+ walkFragment(node.alternate, source, parseScriptFn);
229560
+ break;
229561
+ case "EachBlock":
229562
+ extractExpression(node.expression, source, parseScriptFn);
229563
+ if (node.key) {
229564
+ extractExpression(node.key, source, parseScriptFn);
229565
+ }
229566
+ walkFragment(node.body, source, parseScriptFn);
229567
+ walkFragment(node.fallback, source, parseScriptFn);
229568
+ break;
229569
+ case "AwaitBlock":
229570
+ extractExpression(node.expression, source, parseScriptFn);
229571
+ walkFragment(node.pending, source, parseScriptFn);
229572
+ walkFragment(node.then, source, parseScriptFn);
229573
+ walkFragment(node.catch, source, parseScriptFn);
229574
+ break;
229575
+ case "KeyBlock":
229576
+ extractExpression(node.expression, source, parseScriptFn);
229577
+ walkFragment(node.fragment, source, parseScriptFn);
229578
+ break;
229579
+ case "SnippetBlock":
229580
+ walkFragment(node.body, source, parseScriptFn);
229581
+ break;
229582
+ case "RegularElement":
229583
+ case "Component":
229584
+ case "SvelteComponent":
229585
+ case "SvelteElement":
229586
+ case "SvelteHead":
229587
+ case "SvelteBody":
229588
+ case "SvelteWindow":
229589
+ case "SvelteDocument":
229590
+ case "SlotElement":
229591
+ case "SvelteSelf":
229592
+ case "SvelteFragment":
229593
+ if (node.attributes) {
229594
+ for (const attr of node.attributes) {
229595
+ if (attr.type === "Attribute") {
229596
+ if (Array.isArray(attr.value)) {
229597
+ for (const v of attr.value) {
229598
+ if (v.type === "ExpressionTag") {
229599
+ extractExpression(v.expression, source, parseScriptFn);
229600
+ }
229601
+ }
229602
+ } else if (typeof attr.value === "object" && attr.value !== null && attr.value.type === "ExpressionTag") {
229603
+ extractExpression(attr.value.expression, source, parseScriptFn);
229604
+ }
229605
+ } else if (attr.type === "SpreadAttribute") {
229606
+ extractExpression(attr.expression, source, parseScriptFn);
229607
+ } else if (attr.expression) {
229608
+ extractExpression(attr.expression, source, parseScriptFn);
229609
+ }
229610
+ }
229611
+ }
229612
+ walkFragment(node.fragment, source, parseScriptFn);
229613
+ break;
229614
+ }
229615
+ }
229616
+ function parseFile2(source, filename, parseScriptFn) {
229617
+ const ast = (0, import_compiler.parse)(source, { modern: true, filename });
229618
+ walkFragment(ast.fragment, source, parseScriptFn);
229619
+ if (ast.instance) {
229620
+ const program2 = ast.instance.content;
229621
+ parseScriptFn(source.slice(program2.start, program2.end));
229622
+ }
229623
+ if (ast.module) {
229624
+ const program2 = ast.module.content;
229625
+ parseScriptFn(source.slice(program2.start, program2.end));
229626
+ }
229627
+ }
229628
+ var import_compiler;
229629
+ var init_svelte_extractor = __esm({
229630
+ "packages/cli-lib/src/svelte_extractor.ts"() {
229631
+ import_compiler = require("svelte/compiler");
229632
+ }
229633
+ });
229634
+
229508
229635
  // packages/cli-lib/src/hbs_extractor.ts
229509
229636
  var hbs_extractor_exports = {};
229510
229637
  __export(hbs_extractor_exports, {
229511
- parseFile: () => parseFile2
229638
+ parseFile: () => parseFile3
229512
229639
  });
229513
229640
  function extractText(node, fileName, options) {
229514
229641
  var _a;
@@ -229538,7 +229665,7 @@ function extractText(node, fileName, options) {
229538
229665
  ]);
229539
229666
  }
229540
229667
  }
229541
- function parseFile2(source, fileName, options) {
229668
+ function parseFile3(source, fileName, options) {
229542
229669
  const ast = (0, import_syntax.preprocess)(source);
229543
229670
  (0, import_syntax.traverse)(ast, {
229544
229671
  MustacheStatement(node) {
@@ -229559,15 +229686,15 @@ var init_hbs_extractor = __esm({
229559
229686
  // packages/cli-lib/src/gts_extractor.ts
229560
229687
  var gts_extractor_exports = {};
229561
229688
  __export(gts_extractor_exports, {
229562
- parseFile: () => parseFile3
229689
+ parseFile: () => parseFile4
229563
229690
  });
229564
- function parseFile3(source, fileName, options) {
229691
+ function parseFile4(source, fileName, options) {
229565
229692
  const scriptParseFn = parseScript(options, fileName);
229566
229693
  const transformedSource = p.process(source, { filename: fileName });
229567
229694
  scriptParseFn(transformedSource.code);
229568
229695
  const parseResult = p.parse(source, { filename: fileName });
229569
229696
  for (let parsed of parseResult) {
229570
- parseFile2(parsed.contents, fileName, options);
229697
+ parseFile3(parsed.contents, fileName, options);
229571
229698
  }
229572
229699
  }
229573
229700
  var import_content_tag, p;
@@ -229671,6 +229798,7 @@ var esm_default = {
229671
229798
  };
229672
229799
 
229673
229800
  // packages/cli-lib/src/compile.ts
229801
+ var import_promises = require("fs/promises");
229674
229802
  var stringifyNs = __toESM(require_json_stable_stringify());
229675
229803
  init_console_utils();
229676
229804
 
@@ -229958,13 +230086,16 @@ function generateENXB(msg) {
229958
230086
  var stringify = stringifyNs.default || stringifyNs;
229959
230087
  async function compile7(inputFiles, opts = {}) {
229960
230088
  debug("Compiling files:", inputFiles);
229961
- const { ast, format: format9, pseudoLocale, skipErrors, ignoreTag } = opts;
230089
+ const { ast, format: format9, pseudoLocale, skipErrors, ignoreTag, signal } = opts;
230090
+ signal == null ? void 0 : signal.throwIfAborted();
229962
230091
  const formatter = await resolveBuiltinFormatter(format9);
229963
230092
  const messages = {};
229964
230093
  const messageAsts = {};
229965
230094
  const idsWithFileName = {};
229966
230095
  const compiledFiles = await Promise.all(
229967
- inputFiles.map((f) => readJSON(f).then(formatter.compile))
230096
+ inputFiles.map(
230097
+ (f) => (0, import_promises.readFile)(f, { encoding: "utf8", signal }).then((content) => JSON.parse(content)).then(formatter.compile)
230098
+ )
229968
230099
  );
229969
230100
  debug("Compiled files:", compiledFiles);
229970
230101
  for (let i = 0; i < inputFiles.length; i++) {
@@ -230049,7 +230180,7 @@ init_ts_transformer();
230049
230180
  init_console_utils();
230050
230181
  var stringifyNs3 = __toESM(require_json_stable_stringify());
230051
230182
  init_parse_script();
230052
- var import_promises = require("fs/promises");
230183
+ var import_promises2 = require("fs/promises");
230053
230184
  var stringify3 = stringifyNs3.default || stringifyNs3;
230054
230185
  function calculateLineColFromOffset(text, start) {
230055
230186
  if (!start) {
@@ -230108,16 +230239,20 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
230108
230239
  const scriptParseFn = parseScript(opts, fn);
230109
230240
  if (fn.endsWith(".vue")) {
230110
230241
  debug("Processing %s using vue extractor", fn);
230111
- const { parseFile: parseFile4 } = await Promise.resolve().then(() => (init_vue_extractor(), vue_extractor_exports));
230112
- parseFile4(source, fn, scriptParseFn);
230242
+ const { parseFile: parseFile5 } = await Promise.resolve().then(() => (init_vue_extractor(), vue_extractor_exports));
230243
+ parseFile5(source, fn, scriptParseFn);
230244
+ } else if (fn.endsWith(".svelte")) {
230245
+ debug("Processing %s using svelte extractor", fn);
230246
+ const { parseFile: parseFile5 } = await Promise.resolve().then(() => (init_svelte_extractor(), svelte_extractor_exports));
230247
+ parseFile5(source, fn, scriptParseFn);
230113
230248
  } else if (fn.endsWith(".hbs")) {
230114
230249
  debug("Processing %s using hbs extractor", fn);
230115
- const { parseFile: parseFile4 } = await Promise.resolve().then(() => (init_hbs_extractor(), hbs_extractor_exports));
230116
- parseFile4(source, fn, opts);
230250
+ const { parseFile: parseFile5 } = await Promise.resolve().then(() => (init_hbs_extractor(), hbs_extractor_exports));
230251
+ parseFile5(source, fn, opts);
230117
230252
  } else if (fn.endsWith(".gts") || fn.endsWith(".gjs")) {
230118
230253
  debug("Processing %s as gts/gjs file", fn);
230119
- const { parseFile: parseFile4 } = await Promise.resolve().then(() => (init_gts_extractor(), gts_extractor_exports));
230120
- parseFile4(source, fn, opts);
230254
+ const { parseFile: parseFile5 } = await Promise.resolve().then(() => (init_gts_extractor(), gts_extractor_exports));
230255
+ parseFile5(source, fn, opts);
230121
230256
  } else {
230122
230257
  debug("Processing %s using typescript extractor", fn);
230123
230258
  scriptParseFn(source);
@@ -230130,7 +230265,7 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
230130
230265
  return { messages, meta };
230131
230266
  }
230132
230267
  async function extract(files, extractOpts) {
230133
- const { throws, readFromStdin, ...opts } = extractOpts;
230268
+ const { throws, readFromStdin, signal, ...opts } = extractOpts;
230134
230269
  const shouldThrow = throws === true;
230135
230270
  const optsWithThrows = {
230136
230271
  ...opts,
@@ -230151,7 +230286,7 @@ async function extract(files, extractOpts) {
230151
230286
  const settledResults = await Promise.allSettled(
230152
230287
  files.map(async (fn) => {
230153
230288
  debug("Extracting file:", fn);
230154
- const source = await (0, import_promises.readFile)(fn, "utf8");
230289
+ const source = await (0, import_promises2.readFile)(fn, { encoding: "utf8", signal });
230155
230290
  return processFile(source, fn, optsWithThrows);
230156
230291
  })
230157
230292
  );
@@ -230167,7 +230302,7 @@ async function extract(files, extractOpts) {
230167
230302
  rawResults = await Promise.all(
230168
230303
  files.map(async (fn) => {
230169
230304
  debug("Extracting file:", fn);
230170
- const source = await (0, import_promises.readFile)(fn, "utf8");
230305
+ const source = await (0, import_promises2.readFile)(fn, { encoding: "utf8", signal });
230171
230306
  return processFile(source, fn, optsWithThrows);
230172
230307
  })
230173
230308
  );
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.13.2",
4
+ "version": "6.13.4",
5
5
  "license": "MIT",
6
6
  "author": "Linjie Ding <linjie@airtable.com>",
7
7
  "engines": {
8
8
  "node": ">= 20.12.0"
9
9
  },
10
10
  "devDependencies": {
11
- "@formatjs/cli-lib": "8.3.2"
11
+ "@formatjs/cli-lib": "8.4.1"
12
12
  },
13
13
  "peerDependencies": {
14
14
  "@glimmer/syntax": "^0.84.3 || ^0.95.0",