@formatjs/cli 6.10.0 → 6.12.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/bin/formatjs +126 -93
  2. package/package.json +6 -10
package/bin/formatjs CHANGED
@@ -4171,7 +4171,7 @@ var require_fill_range = __commonJS({
4171
4171
  var util = require("util");
4172
4172
  var toRegexRange = require_to_regex_range();
4173
4173
  var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
4174
- var transform2 = (toNumber) => {
4174
+ var transform = (toNumber) => {
4175
4175
  return (value) => toNumber === true ? Number(value) : String(value);
4176
4176
  };
4177
4177
  var isValidValue = (value) => {
@@ -4292,7 +4292,7 @@ var require_fill_range = __commonJS({
4292
4292
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
4293
4293
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
4294
4294
  let toNumber = padded === false && stringify4(start, end, options) === false;
4295
- let format9 = options.transform || transform2(toNumber);
4295
+ let format9 = options.transform || transform(toNumber);
4296
4296
  if (options.toRegex && step === 1) {
4297
4297
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
4298
4298
  }
@@ -7599,9 +7599,9 @@ var require_out2 = __commonJS({
7599
7599
  }
7600
7600
  });
7601
7601
 
7602
- // node_modules/.aspect_rules_js/reusify@1.0.4/node_modules/reusify/reusify.js
7602
+ // node_modules/.aspect_rules_js/reusify@1.1.0/node_modules/reusify/reusify.js
7603
7603
  var require_reusify = __commonJS({
7604
- "node_modules/.aspect_rules_js/reusify@1.0.4/node_modules/reusify/reusify.js"(exports, module2) {
7604
+ "node_modules/.aspect_rules_js/reusify@1.1.0/node_modules/reusify/reusify.js"(exports, module2) {
7605
7605
  "use strict";
7606
7606
  function reusify(Constructor) {
7607
7607
  var head = new Constructor();
@@ -7630,9 +7630,9 @@ var require_reusify = __commonJS({
7630
7630
  }
7631
7631
  });
7632
7632
 
7633
- // node_modules/.aspect_rules_js/fastq@1.18.0/node_modules/fastq/queue.js
7633
+ // node_modules/.aspect_rules_js/fastq@1.20.1/node_modules/fastq/queue.js
7634
7634
  var require_queue = __commonJS({
7635
- "node_modules/.aspect_rules_js/fastq@1.18.0/node_modules/fastq/queue.js"(exports, module2) {
7635
+ "node_modules/.aspect_rules_js/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module2) {
7636
7636
  "use strict";
7637
7637
  var reusify = require_reusify();
7638
7638
  function fastqueue(context, worker, _concurrency) {
@@ -7679,7 +7679,8 @@ var require_queue = __commonJS({
7679
7679
  empty: noop,
7680
7680
  kill,
7681
7681
  killAndDrain,
7682
- error: error2
7682
+ error: error2,
7683
+ abort
7683
7684
  };
7684
7685
  return self;
7685
7686
  function running() {
@@ -7799,6 +7800,28 @@ var require_queue = __commonJS({
7799
7800
  self.drain();
7800
7801
  self.drain = noop;
7801
7802
  }
7803
+ function abort() {
7804
+ var current = queueHead;
7805
+ queueHead = null;
7806
+ queueTail = null;
7807
+ while (current) {
7808
+ var next = current.next;
7809
+ var callback = current.callback;
7810
+ var errorHandler2 = current.errorHandler;
7811
+ var val = current.value;
7812
+ var context2 = current.context;
7813
+ current.value = null;
7814
+ current.callback = noop;
7815
+ current.errorHandler = null;
7816
+ if (errorHandler2) {
7817
+ errorHandler2(new Error("abort"), val);
7818
+ }
7819
+ callback.call(context2, new Error("abort"));
7820
+ current.release(current);
7821
+ current = next;
7822
+ }
7823
+ self.drain = noop;
7824
+ }
7802
7825
  function error2(handler) {
7803
7826
  errorHandler = handler;
7804
7827
  }
@@ -17724,9 +17747,9 @@ var init_printer = __esm({
17724
17747
  }
17725
17748
  });
17726
17749
 
17727
- // node_modules/.aspect_rules_js/typescript@5.8.3/node_modules/typescript/lib/typescript.js
17750
+ // node_modules/.aspect_rules_js/typescript@5.8.2/node_modules/typescript/lib/typescript.js
17728
17751
  var require_typescript = __commonJS({
17729
- "node_modules/.aspect_rules_js/typescript@5.8.3/node_modules/typescript/lib/typescript.js"(exports, module2) {
17752
+ "node_modules/.aspect_rules_js/typescript@5.8.2/node_modules/typescript/lib/typescript.js"(exports, module2) {
17730
17753
  var ts2 = {};
17731
17754
  ((module3) => {
17732
17755
  "use strict";
@@ -19889,7 +19912,7 @@ var require_typescript = __commonJS({
19889
19912
  tracing: () => tracing,
19890
19913
  tracingEnabled: () => tracingEnabled,
19891
19914
  transferSourceFileChildren: () => transferSourceFileChildren,
19892
- transform: () => transform2,
19915
+ transform: () => transform,
19893
19916
  transformClassFields: () => transformClassFields,
19894
19917
  transformDeclarations: () => transformDeclarations,
19895
19918
  transformECMAScriptModule: () => transformECMAScriptModule,
@@ -19996,7 +20019,7 @@ var require_typescript = __commonJS({
19996
20019
  });
19997
20020
  module3.exports = __toCommonJS(typescript_exports);
19998
20021
  var versionMajorMinor = "5.8";
19999
- var version = "5.8.3";
20022
+ var version = "5.8.2";
20000
20023
  var Comparison = ((Comparison3) => {
20001
20024
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
20002
20025
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -36187,8 +36210,8 @@ ${lanes.join("\n")}
36187
36210
  return isJSDocImplementsTag(node.parent) || isJSDocAugmentsTag(node.parent) || isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
36188
36211
  }
36189
36212
  function forEachReturnStatement(body, visitor) {
36190
- return traverse(body);
36191
- function traverse(node) {
36213
+ return traverse2(body);
36214
+ function traverse2(node) {
36192
36215
  switch (node.kind) {
36193
36216
  case 253:
36194
36217
  return visitor(node);
@@ -36207,19 +36230,19 @@ ${lanes.join("\n")}
36207
36230
  case 256:
36208
36231
  case 258:
36209
36232
  case 299:
36210
- return forEachChild(node, traverse);
36233
+ return forEachChild(node, traverse2);
36211
36234
  }
36212
36235
  }
36213
36236
  }
36214
36237
  function forEachYieldExpression(body, visitor) {
36215
- return traverse(body);
36216
- function traverse(node) {
36238
+ return traverse2(body);
36239
+ function traverse2(node) {
36217
36240
  switch (node.kind) {
36218
36241
  case 229:
36219
36242
  visitor(node);
36220
36243
  const operand = node.expression;
36221
36244
  if (operand) {
36222
- traverse(operand);
36245
+ traverse2(operand);
36223
36246
  }
36224
36247
  return;
36225
36248
  case 266:
@@ -36230,11 +36253,11 @@ ${lanes.join("\n")}
36230
36253
  default:
36231
36254
  if (isFunctionLike(node)) {
36232
36255
  if (node.name && node.name.kind === 167) {
36233
- traverse(node.name.expression);
36256
+ traverse2(node.name.expression);
36234
36257
  return;
36235
36258
  }
36236
36259
  } else if (!isPartOfTypeNode(node)) {
36237
- forEachChild(node, traverse);
36260
+ forEachChild(node, traverse2);
36238
36261
  }
36239
36262
  }
36240
36263
  }
@@ -77013,11 +77036,10 @@ ${lanes.join("\n")}
77013
77036
  serializeExistingTypeNode(context, typeNode, addUndefined) {
77014
77037
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
77015
77038
  },
77016
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
77039
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
77017
77040
  const context = syntacticContext;
77018
77041
  const signature = getSignatureFromDeclaration(signatureDeclaration);
77019
- symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
77020
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
77042
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
77021
77043
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
77022
77044
  },
77023
77045
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -77031,7 +77053,7 @@ ${lanes.join("\n")}
77031
77053
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
77032
77054
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
77033
77055
  if (type === void 0) {
77034
- type = symbol.flags & 98304 && declaration.kind === 178 ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 | 131072)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
77056
+ type = symbol && !(symbol.flags & (2048 | 131072)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
77035
77057
  }
77036
77058
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
77037
77059
  if (addUndefinedForParameter) {
@@ -77098,7 +77120,6 @@ ${lanes.join("\n")}
77098
77120
  const context = syntacticContext;
77099
77121
  if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
77100
77122
  let name = lit.text;
77101
- const originalName = name;
77102
77123
  const nodeSymbol = getNodeLinks(parent2).resolvedSymbol;
77103
77124
  const meaning = parent2.isTypeOf ? 111551 : 788968;
77104
77125
  const parentSymbol = nodeSymbol && isSymbolAccessible(
@@ -77128,9 +77149,7 @@ ${lanes.join("\n")}
77128
77149
  context.tracker.reportLikelyUnsafeImportRequiredError(name);
77129
77150
  }
77130
77151
  }
77131
- if (name !== originalName) {
77132
- return name;
77133
- }
77152
+ return name;
77134
77153
  }
77135
77154
  },
77136
77155
  canReuseTypeNode(context, typeNode) {
@@ -77839,7 +77858,7 @@ ${lanes.join("\n")}
77839
77858
  }
77840
77859
  }
77841
77860
  }
77842
- function visitAndTransformType(type2, transform22) {
77861
+ function visitAndTransformType(type2, transform2) {
77843
77862
  var _a2, _b2, _c;
77844
77863
  const typeId = type2.id;
77845
77864
  const isConstructorObject = getObjectFlags(type2) & 16 && type2.symbol && type2.symbol.flags & 32;
@@ -77882,7 +77901,7 @@ ${lanes.join("\n")}
77882
77901
  const prevTrackedSymbols = context.trackedSymbols;
77883
77902
  context.trackedSymbols = void 0;
77884
77903
  const startLength = context.approximateLength;
77885
- const result = transform22(type2);
77904
+ const result = transform2(type2);
77886
77905
  const addedLength = context.approximateLength - startLength;
77887
77906
  if (!context.reportedDiagnostic && !context.encounteredError) {
77888
77907
  (_c = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _c.set(key, {
@@ -78320,7 +78339,6 @@ ${lanes.join("\n")}
78320
78339
  if (propertySymbol.flags & 98304) {
78321
78340
  const writeType = getWriteTypeOfSymbol(propertySymbol);
78322
78341
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
78323
- const symbolMapper = getSymbolLinks(propertySymbol).mapper;
78324
78342
  const getterDeclaration = getDeclarationOfKind(
78325
78343
  propertySymbol,
78326
78344
  177
@@ -78330,7 +78348,7 @@ ${lanes.join("\n")}
78330
78348
  typeElements.push(
78331
78349
  setCommentRange2(
78332
78350
  context,
78333
- signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177, context, { name: propertyName }),
78351
+ signatureToSignatureDeclarationHelper(getterSignature, 177, context, { name: propertyName }),
78334
78352
  getterDeclaration
78335
78353
  )
78336
78354
  );
@@ -78343,7 +78361,7 @@ ${lanes.join("\n")}
78343
78361
  typeElements.push(
78344
78362
  setCommentRange2(
78345
78363
  context,
78346
- signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178, context, { name: propertyName }),
78364
+ signatureToSignatureDeclarationHelper(setterSignature, 178, context, { name: propertyName }),
78347
78365
  setterDeclaration
78348
78366
  )
78349
78367
  );
@@ -79618,13 +79636,13 @@ ${lanes.join("\n")}
79618
79636
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
79619
79637
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
79620
79638
  if (decl) {
79621
- const restore = addSymbolTypeToContext(context, symbol, type);
79622
79639
  if (isAccessor(decl)) {
79623
79640
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
79624
79641
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608)) {
79642
+ const restore = addSymbolTypeToContext(context, symbol, type);
79625
79643
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
79644
+ restore();
79626
79645
  }
79627
- restore();
79628
79646
  }
79629
79647
  if (!result) {
79630
79648
  if (addUndefinedForParameter) {
@@ -79797,7 +79815,10 @@ ${lanes.join("\n")}
79797
79815
  /*context*/
79798
79816
  void 0
79799
79817
  );
79800
- return setTextRange2(context, updated, node2);
79818
+ if (updated !== node2) {
79819
+ setTextRange2(context, updated, node2);
79820
+ }
79821
+ return updated;
79801
79822
  }
79802
79823
  }
79803
79824
  function serializeTypeName(context, node, isTypeOf, typeArguments) {
@@ -86080,11 +86101,11 @@ ${lanes.join("\n")}
86080
86101
  if (links.flags & 512) {
86081
86102
  links.containsArgumentsReference = true;
86082
86103
  } else {
86083
- links.containsArgumentsReference = traverse(declaration.body);
86104
+ links.containsArgumentsReference = traverse2(declaration.body);
86084
86105
  }
86085
86106
  }
86086
86107
  return links.containsArgumentsReference;
86087
- function traverse(node) {
86108
+ function traverse2(node) {
86088
86109
  if (!node)
86089
86110
  return false;
86090
86111
  switch (node.kind) {
@@ -86094,14 +86115,14 @@ ${lanes.join("\n")}
86094
86115
  case 174:
86095
86116
  case 177:
86096
86117
  case 178:
86097
- return node.name.kind === 167 && traverse(node.name);
86118
+ return node.name.kind === 167 && traverse2(node.name);
86098
86119
  case 211:
86099
86120
  case 212:
86100
- return traverse(node.expression);
86121
+ return traverse2(node.expression);
86101
86122
  case 303:
86102
- return traverse(node.initializer);
86123
+ return traverse2(node.initializer);
86103
86124
  default:
86104
- return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node, traverse);
86125
+ return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node, traverse2);
86105
86126
  }
86106
86127
  }
86107
86128
  }
@@ -105500,11 +105521,6 @@ ${lanes.join("\n")}
105500
105521
  ])) {
105501
105522
  grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
105502
105523
  }
105503
- if (compilerOptions.erasableSyntaxOnly) {
105504
- const start = skipTrivia(file.text, node.pos);
105505
- const end = node.expression.pos;
105506
- diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
105507
- }
105508
105524
  }
105509
105525
  return checkAssertionWorker(node, checkMode);
105510
105526
  }
@@ -146422,8 +146438,8 @@ ${lanes.join("\n")}
146422
146438
  mark("beforeTransform");
146423
146439
  const transformersWithContext = transformers.map((t) => t(context));
146424
146440
  const transformation = (node) => {
146425
- for (const transform22 of transformersWithContext) {
146426
- node = transform22(node);
146441
+ for (const transform2 of transformersWithContext) {
146442
+ node = transform2(node);
146427
146443
  }
146428
146444
  return node;
146429
146445
  };
@@ -147036,7 +147052,7 @@ ${lanes.join("\n")}
147036
147052
  markLinkedReferences(sourceFile);
147037
147053
  }
147038
147054
  );
147039
- const transform22 = transformNodes(
147055
+ const transform2 = transformNodes(
147040
147056
  resolver,
147041
147057
  host,
147042
147058
  factory,
@@ -147062,13 +147078,13 @@ ${lanes.join("\n")}
147062
147078
  // resolver hooks
147063
147079
  hasGlobalName: resolver.hasGlobalName,
147064
147080
  // transform hooks
147065
- onEmitNode: transform22.emitNodeWithNotification,
147066
- isEmitNotificationEnabled: transform22.isEmitNotificationEnabled,
147067
- substituteNode: transform22.substituteNode
147081
+ onEmitNode: transform2.emitNodeWithNotification,
147082
+ isEmitNotificationEnabled: transform2.isEmitNotificationEnabled,
147083
+ substituteNode: transform2.substituteNode
147068
147084
  });
147069
- Debug.assert(transform22.transformed.length === 1, "Should only see one output from the transform");
147070
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform22, printer, compilerOptions);
147071
- transform22.dispose();
147085
+ Debug.assert(transform2.transformed.length === 1, "Should only see one output from the transform");
147086
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, compilerOptions);
147087
+ transform2.dispose();
147072
147088
  if (emittedFilesList) {
147073
147089
  emittedFilesList.push(jsFilePath);
147074
147090
  if (sourceMapFilePath) {
@@ -147186,8 +147202,8 @@ ${lanes.join("\n")}
147186
147202
  resolver.markLinkedReferences(n);
147187
147203
  });
147188
147204
  }
147189
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform22, printer, mapOptions) {
147190
- const sourceFileOrBundle = transform22.transformed[0];
147205
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, mapOptions) {
147206
+ const sourceFileOrBundle = transform2.transformed[0];
147191
147207
  const bundle = sourceFileOrBundle.kind === 308 ? sourceFileOrBundle : void 0;
147192
147208
  const sourceFile = sourceFileOrBundle.kind === 307 ? sourceFileOrBundle : void 0;
147193
147209
  const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -147243,7 +147259,7 @@ ${lanes.join("\n")}
147243
147259
  writer.writeLine();
147244
147260
  }
147245
147261
  const text = writer.getText();
147246
- const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
147262
+ const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
147247
147263
  writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
147248
147264
  writer.clear();
147249
147265
  return !data.skippedDtsWrite;
@@ -164959,11 +164975,9 @@ ${lanes.join("\n")}
164959
164975
  if (!resolver.canReuseTypeNode(context, node)) {
164960
164976
  return resolver.serializeExistingTypeNode(context, node);
164961
164977
  }
164962
- const specifier = rewriteModuleSpecifier2(node, node.argument.literal);
164963
- const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
164964
164978
  return factory.updateImportTypeNode(
164965
164979
  node,
164966
- literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
164980
+ factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier2(node, node.argument.literal)),
164967
164981
  visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
164968
164982
  visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
164969
164983
  visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
@@ -165125,7 +165139,10 @@ ${lanes.join("\n")}
165125
165139
  }
165126
165140
  function rewriteModuleSpecifier2(parent2, lit) {
165127
165141
  const newName = resolver.getModuleSpecifierOverride(context, parent2, lit);
165128
- return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
165142
+ if (newName) {
165143
+ return setOriginalNode(factory.createStringLiteral(newName), lit);
165144
+ }
165145
+ return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
165129
165146
  }
165130
165147
  }
165131
165148
  }
@@ -165301,7 +165318,12 @@ ${lanes.join("\n")}
165301
165318
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
165302
165319
  }
165303
165320
  if (accessorDeclarations.getAccessor) {
165304
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
165321
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
165322
+ accessorDeclarations.getAccessor,
165323
+ /*symbol*/
165324
+ void 0,
165325
+ context
165326
+ ));
165305
165327
  }
165306
165328
  return void 0;
165307
165329
  }
@@ -165420,7 +165442,7 @@ ${lanes.join("\n")}
165420
165442
  /* AnyKeyword */
165421
165443
  );
165422
165444
  }
165423
- function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
165445
+ function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
165424
165446
  if (reportFallback) {
165425
165447
  context.tracker.reportInferenceFallback(node);
165426
165448
  }
@@ -165430,7 +165452,7 @@ ${lanes.join("\n")}
165430
165452
  /* AnyKeyword */
165431
165453
  );
165432
165454
  }
165433
- return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(
165455
+ return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(
165434
165456
  133
165435
165457
  /* AnyKeyword */
165436
165458
  );
@@ -165745,17 +165767,18 @@ ${lanes.join("\n")}
165745
165767
  );
165746
165768
  }
165747
165769
  function reuseTypeParameters(typeParameters, context) {
165748
- return typeParameters == null ? void 0 : typeParameters.map((tp) => {
165749
- var _a;
165750
- const { node: tpName } = resolver.trackExistingEntityName(context, tp.name);
165751
- return factory.updateTypeParameterDeclaration(
165752
- tp,
165753
- (_a = tp.modifiers) == null ? void 0 : _a.map((m) => reuseNode(context, m)),
165754
- tpName,
165755
- serializeExistingTypeNodeWithFallback(tp.constraint, context),
165756
- serializeExistingTypeNodeWithFallback(tp.default, context)
165757
- );
165758
- });
165770
+ return typeParameters == null ? void 0 : typeParameters.map(
165771
+ (tp) => {
165772
+ var _a;
165773
+ return factory.updateTypeParameterDeclaration(
165774
+ tp,
165775
+ (_a = tp.modifiers) == null ? void 0 : _a.map((m) => reuseNode(context, m)),
165776
+ reuseNode(context, tp.name),
165777
+ serializeExistingTypeNodeWithFallback(tp.constraint, context),
165778
+ serializeExistingTypeNodeWithFallback(tp.default, context)
165779
+ );
165780
+ }
165781
+ );
165759
165782
  }
165760
165783
  function typeFromObjectLiteralMethod(method, name, context, isConstContext) {
165761
165784
  const returnType = createReturnFromSignature(
@@ -165910,7 +165933,7 @@ ${lanes.join("\n")}
165910
165933
  } else if (isValueSignatureDeclaration(fn)) {
165911
165934
  returnType = typeFromSingleReturnExpression(fn, context);
165912
165935
  }
165913
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
165936
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
165914
165937
  }
165915
165938
  function typeFromSingleReturnExpression(declaration, context) {
165916
165939
  let candidateExpr;
@@ -182233,7 +182256,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
182233
182256
  throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
182234
182257
  }
182235
182258
  setObjectAllocator(getServicesObjectAllocator());
182236
- function transform2(source, transformers, compilerOptions) {
182259
+ function transform(source, transformers, compilerOptions) {
182237
182260
  const diagnostics = [];
182238
182261
  compilerOptions = fixupCompilerOptions(compilerOptions, diagnostics);
182239
182262
  const nodes = isArray(source) ? source : [source];
@@ -215826,7 +215849,7 @@ ${options.prefix}` : "\n" : options.prefix
215826
215849
  tracing: () => tracing,
215827
215850
  tracingEnabled: () => tracingEnabled,
215828
215851
  transferSourceFileChildren: () => transferSourceFileChildren,
215829
- transform: () => transform2,
215852
+ transform: () => transform,
215830
215853
  transformClassFields: () => transformClassFields,
215831
215854
  transformDeclarations: () => transformDeclarations,
215832
215855
  transformECMAScriptModule: () => transformECMAScriptModule,
@@ -229456,7 +229479,10 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229456
229479
  if (flatten2 && msg.defaultMessage) {
229457
229480
  try {
229458
229481
  msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
229459
- } catch {
229482
+ } catch (e) {
229483
+ const { line, character } = sf.getLineAndCharacterOfPosition(node.pos);
229484
+ throw new Error(`[formatjs] Cannot flatten message in file "${sf.fileName}" at line ${line + 1}, column ${character + 1}${msg.id ? ` with id "${msg.id}"` : ""}: ${e.message}
229485
+ Message: ${msg.defaultMessage}`);
229460
229486
  }
229461
229487
  }
229462
229488
  if (msg.defaultMessage && overrideIdFn) {
@@ -229824,22 +229850,20 @@ function extractText(node, fileName, options) {
229824
229850
  }
229825
229851
  }
229826
229852
  function parseFile2(source, fileName, options) {
229827
- let visitor = function() {
229828
- return {
229829
- MustacheStatement(node) {
229830
- extractText(node, fileName, options);
229831
- },
229832
- SubExpression(node) {
229833
- extractText(node, fileName, options);
229834
- }
229835
- };
229836
- };
229837
- (0, import_ember_template_recast.transform)(source, visitor);
229853
+ const ast = (0, import_syntax.preprocess)(source);
229854
+ (0, import_syntax.traverse)(ast, {
229855
+ MustacheStatement(node) {
229856
+ extractText(node, fileName, options);
229857
+ },
229858
+ SubExpression(node) {
229859
+ extractText(node, fileName, options);
229860
+ }
229861
+ });
229838
229862
  }
229839
- var import_ember_template_recast;
229863
+ var import_syntax;
229840
229864
  var init_hbs_extractor = __esm({
229841
229865
  "packages/cli-lib/src/hbs_extractor.ts"() {
229842
- import_ember_template_recast = require("ember-template-recast");
229866
+ import_syntax = require("@glimmer/syntax");
229843
229867
  }
229844
229868
  });
229845
229869
 
@@ -230837,6 +230861,15 @@ This is especially useful to convert from a TMS-specific format back to react-in
230837
230861
  ).option(
230838
230862
  "--ast",
230839
230863
  `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`
230864
+ ).option(
230865
+ "--skip-errors",
230866
+ `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`
230867
+ ).option(
230868
+ "--pseudo-locale <pseudoLocale>",
230869
+ `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.`
230870
+ ).option(
230871
+ "--ignore-tag",
230872
+ `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.`
230840
230873
  ).action(async (folder, outFolder, opts) => {
230841
230874
  debug("Folder:", folder);
230842
230875
  debug("Options:", opts);
package/package.json CHANGED
@@ -1,21 +1,20 @@
1
1
  {
2
2
  "name": "@formatjs/cli",
3
3
  "description": "A CLI for formatjs.",
4
- "version": "6.10.0",
4
+ "version": "6.12.0",
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.1.1"
11
+ "@formatjs/cli-lib": "8.2.1"
12
12
  },
13
13
  "peerDependencies": {
14
- "@glimmer/syntax": "^0.95.0",
15
- "@vue/compiler-core": "^3.5.12",
16
- "content-tag": "4",
17
- "ember-template-recast": "^6.1.5",
18
- "vue": "^3.5.12"
14
+ "@glimmer/syntax": "^0.84.3 || ^0.95.0",
15
+ "@vue/compiler-core": "3.5.27",
16
+ "content-tag": "^4.1.0",
17
+ "vue": "3.5.27"
19
18
  },
20
19
  "bin": {
21
20
  "formatjs": "bin/formatjs"
@@ -58,9 +57,6 @@
58
57
  "@glimmer/validator": {
59
58
  "optional": true
60
59
  },
61
- "ember-template-recast": {
62
- "optional": true
63
- },
64
60
  "content-tag": {
65
61
  "optional": true
66
62
  }