@formatjs/cli 6.11.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 +157 -128
  2. package/package.json +5 -9
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
  }
@@ -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);
@@ -17747,9 +17747,9 @@ var init_printer = __esm({
17747
17747
  }
17748
17748
  });
17749
17749
 
17750
- // 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
17751
17751
  var require_typescript = __commonJS({
17752
- "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) {
17753
17753
  var ts2 = {};
17754
17754
  ((module3) => {
17755
17755
  "use strict";
@@ -19912,7 +19912,7 @@ var require_typescript = __commonJS({
19912
19912
  tracing: () => tracing,
19913
19913
  tracingEnabled: () => tracingEnabled,
19914
19914
  transferSourceFileChildren: () => transferSourceFileChildren,
19915
- transform: () => transform2,
19915
+ transform: () => transform,
19916
19916
  transformClassFields: () => transformClassFields,
19917
19917
  transformDeclarations: () => transformDeclarations,
19918
19918
  transformECMAScriptModule: () => transformECMAScriptModule,
@@ -20019,7 +20019,7 @@ var require_typescript = __commonJS({
20019
20019
  });
20020
20020
  module3.exports = __toCommonJS(typescript_exports);
20021
20021
  var versionMajorMinor = "5.8";
20022
- var version = "5.8.3";
20022
+ var version = "5.8.2";
20023
20023
  var Comparison = ((Comparison3) => {
20024
20024
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
20025
20025
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -36210,8 +36210,8 @@ ${lanes.join("\n")}
36210
36210
  return isJSDocImplementsTag(node.parent) || isJSDocAugmentsTag(node.parent) || isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
36211
36211
  }
36212
36212
  function forEachReturnStatement(body, visitor) {
36213
- return traverse(body);
36214
- function traverse(node) {
36213
+ return traverse2(body);
36214
+ function traverse2(node) {
36215
36215
  switch (node.kind) {
36216
36216
  case 253:
36217
36217
  return visitor(node);
@@ -36230,19 +36230,19 @@ ${lanes.join("\n")}
36230
36230
  case 256:
36231
36231
  case 258:
36232
36232
  case 299:
36233
- return forEachChild(node, traverse);
36233
+ return forEachChild(node, traverse2);
36234
36234
  }
36235
36235
  }
36236
36236
  }
36237
36237
  function forEachYieldExpression(body, visitor) {
36238
- return traverse(body);
36239
- function traverse(node) {
36238
+ return traverse2(body);
36239
+ function traverse2(node) {
36240
36240
  switch (node.kind) {
36241
36241
  case 229:
36242
36242
  visitor(node);
36243
36243
  const operand = node.expression;
36244
36244
  if (operand) {
36245
- traverse(operand);
36245
+ traverse2(operand);
36246
36246
  }
36247
36247
  return;
36248
36248
  case 266:
@@ -36253,11 +36253,11 @@ ${lanes.join("\n")}
36253
36253
  default:
36254
36254
  if (isFunctionLike(node)) {
36255
36255
  if (node.name && node.name.kind === 167) {
36256
- traverse(node.name.expression);
36256
+ traverse2(node.name.expression);
36257
36257
  return;
36258
36258
  }
36259
36259
  } else if (!isPartOfTypeNode(node)) {
36260
- forEachChild(node, traverse);
36260
+ forEachChild(node, traverse2);
36261
36261
  }
36262
36262
  }
36263
36263
  }
@@ -77036,11 +77036,10 @@ ${lanes.join("\n")}
77036
77036
  serializeExistingTypeNode(context, typeNode, addUndefined) {
77037
77037
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
77038
77038
  },
77039
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
77039
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
77040
77040
  const context = syntacticContext;
77041
77041
  const signature = getSignatureFromDeclaration(signatureDeclaration);
77042
- symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
77043
- 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);
77044
77043
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
77045
77044
  },
77046
77045
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -77054,7 +77053,7 @@ ${lanes.join("\n")}
77054
77053
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
77055
77054
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
77056
77055
  if (type === void 0) {
77057
- 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;
77058
77057
  }
77059
77058
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
77060
77059
  if (addUndefinedForParameter) {
@@ -77121,7 +77120,6 @@ ${lanes.join("\n")}
77121
77120
  const context = syntacticContext;
77122
77121
  if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
77123
77122
  let name = lit.text;
77124
- const originalName = name;
77125
77123
  const nodeSymbol = getNodeLinks(parent2).resolvedSymbol;
77126
77124
  const meaning = parent2.isTypeOf ? 111551 : 788968;
77127
77125
  const parentSymbol = nodeSymbol && isSymbolAccessible(
@@ -77151,9 +77149,7 @@ ${lanes.join("\n")}
77151
77149
  context.tracker.reportLikelyUnsafeImportRequiredError(name);
77152
77150
  }
77153
77151
  }
77154
- if (name !== originalName) {
77155
- return name;
77156
- }
77152
+ return name;
77157
77153
  }
77158
77154
  },
77159
77155
  canReuseTypeNode(context, typeNode) {
@@ -77862,7 +77858,7 @@ ${lanes.join("\n")}
77862
77858
  }
77863
77859
  }
77864
77860
  }
77865
- function visitAndTransformType(type2, transform22) {
77861
+ function visitAndTransformType(type2, transform2) {
77866
77862
  var _a2, _b2, _c;
77867
77863
  const typeId = type2.id;
77868
77864
  const isConstructorObject = getObjectFlags(type2) & 16 && type2.symbol && type2.symbol.flags & 32;
@@ -77905,7 +77901,7 @@ ${lanes.join("\n")}
77905
77901
  const prevTrackedSymbols = context.trackedSymbols;
77906
77902
  context.trackedSymbols = void 0;
77907
77903
  const startLength = context.approximateLength;
77908
- const result = transform22(type2);
77904
+ const result = transform2(type2);
77909
77905
  const addedLength = context.approximateLength - startLength;
77910
77906
  if (!context.reportedDiagnostic && !context.encounteredError) {
77911
77907
  (_c = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _c.set(key, {
@@ -78343,7 +78339,6 @@ ${lanes.join("\n")}
78343
78339
  if (propertySymbol.flags & 98304) {
78344
78340
  const writeType = getWriteTypeOfSymbol(propertySymbol);
78345
78341
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
78346
- const symbolMapper = getSymbolLinks(propertySymbol).mapper;
78347
78342
  const getterDeclaration = getDeclarationOfKind(
78348
78343
  propertySymbol,
78349
78344
  177
@@ -78353,7 +78348,7 @@ ${lanes.join("\n")}
78353
78348
  typeElements.push(
78354
78349
  setCommentRange2(
78355
78350
  context,
78356
- signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177, context, { name: propertyName }),
78351
+ signatureToSignatureDeclarationHelper(getterSignature, 177, context, { name: propertyName }),
78357
78352
  getterDeclaration
78358
78353
  )
78359
78354
  );
@@ -78366,7 +78361,7 @@ ${lanes.join("\n")}
78366
78361
  typeElements.push(
78367
78362
  setCommentRange2(
78368
78363
  context,
78369
- signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178, context, { name: propertyName }),
78364
+ signatureToSignatureDeclarationHelper(setterSignature, 178, context, { name: propertyName }),
78370
78365
  setterDeclaration
78371
78366
  )
78372
78367
  );
@@ -79641,13 +79636,13 @@ ${lanes.join("\n")}
79641
79636
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
79642
79637
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
79643
79638
  if (decl) {
79644
- const restore = addSymbolTypeToContext(context, symbol, type);
79645
79639
  if (isAccessor(decl)) {
79646
79640
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
79647
79641
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608)) {
79642
+ const restore = addSymbolTypeToContext(context, symbol, type);
79648
79643
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
79644
+ restore();
79649
79645
  }
79650
- restore();
79651
79646
  }
79652
79647
  if (!result) {
79653
79648
  if (addUndefinedForParameter) {
@@ -79820,7 +79815,10 @@ ${lanes.join("\n")}
79820
79815
  /*context*/
79821
79816
  void 0
79822
79817
  );
79823
- return setTextRange2(context, updated, node2);
79818
+ if (updated !== node2) {
79819
+ setTextRange2(context, updated, node2);
79820
+ }
79821
+ return updated;
79824
79822
  }
79825
79823
  }
79826
79824
  function serializeTypeName(context, node, isTypeOf, typeArguments) {
@@ -86103,11 +86101,11 @@ ${lanes.join("\n")}
86103
86101
  if (links.flags & 512) {
86104
86102
  links.containsArgumentsReference = true;
86105
86103
  } else {
86106
- links.containsArgumentsReference = traverse(declaration.body);
86104
+ links.containsArgumentsReference = traverse2(declaration.body);
86107
86105
  }
86108
86106
  }
86109
86107
  return links.containsArgumentsReference;
86110
- function traverse(node) {
86108
+ function traverse2(node) {
86111
86109
  if (!node)
86112
86110
  return false;
86113
86111
  switch (node.kind) {
@@ -86117,14 +86115,14 @@ ${lanes.join("\n")}
86117
86115
  case 174:
86118
86116
  case 177:
86119
86117
  case 178:
86120
- return node.name.kind === 167 && traverse(node.name);
86118
+ return node.name.kind === 167 && traverse2(node.name);
86121
86119
  case 211:
86122
86120
  case 212:
86123
- return traverse(node.expression);
86121
+ return traverse2(node.expression);
86124
86122
  case 303:
86125
- return traverse(node.initializer);
86123
+ return traverse2(node.initializer);
86126
86124
  default:
86127
- return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node, traverse);
86125
+ return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node, traverse2);
86128
86126
  }
86129
86127
  }
86130
86128
  }
@@ -105523,11 +105521,6 @@ ${lanes.join("\n")}
105523
105521
  ])) {
105524
105522
  grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
105525
105523
  }
105526
- if (compilerOptions.erasableSyntaxOnly) {
105527
- const start = skipTrivia(file.text, node.pos);
105528
- const end = node.expression.pos;
105529
- diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
105530
- }
105531
105524
  }
105532
105525
  return checkAssertionWorker(node, checkMode);
105533
105526
  }
@@ -146445,8 +146438,8 @@ ${lanes.join("\n")}
146445
146438
  mark("beforeTransform");
146446
146439
  const transformersWithContext = transformers.map((t) => t(context));
146447
146440
  const transformation = (node) => {
146448
- for (const transform22 of transformersWithContext) {
146449
- node = transform22(node);
146441
+ for (const transform2 of transformersWithContext) {
146442
+ node = transform2(node);
146450
146443
  }
146451
146444
  return node;
146452
146445
  };
@@ -147059,7 +147052,7 @@ ${lanes.join("\n")}
147059
147052
  markLinkedReferences(sourceFile);
147060
147053
  }
147061
147054
  );
147062
- const transform22 = transformNodes(
147055
+ const transform2 = transformNodes(
147063
147056
  resolver,
147064
147057
  host,
147065
147058
  factory,
@@ -147085,13 +147078,13 @@ ${lanes.join("\n")}
147085
147078
  // resolver hooks
147086
147079
  hasGlobalName: resolver.hasGlobalName,
147087
147080
  // transform hooks
147088
- onEmitNode: transform22.emitNodeWithNotification,
147089
- isEmitNotificationEnabled: transform22.isEmitNotificationEnabled,
147090
- substituteNode: transform22.substituteNode
147081
+ onEmitNode: transform2.emitNodeWithNotification,
147082
+ isEmitNotificationEnabled: transform2.isEmitNotificationEnabled,
147083
+ substituteNode: transform2.substituteNode
147091
147084
  });
147092
- Debug.assert(transform22.transformed.length === 1, "Should only see one output from the transform");
147093
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform22, printer, compilerOptions);
147094
- 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();
147095
147088
  if (emittedFilesList) {
147096
147089
  emittedFilesList.push(jsFilePath);
147097
147090
  if (sourceMapFilePath) {
@@ -147209,8 +147202,8 @@ ${lanes.join("\n")}
147209
147202
  resolver.markLinkedReferences(n);
147210
147203
  });
147211
147204
  }
147212
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform22, printer, mapOptions) {
147213
- const sourceFileOrBundle = transform22.transformed[0];
147205
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, mapOptions) {
147206
+ const sourceFileOrBundle = transform2.transformed[0];
147214
147207
  const bundle = sourceFileOrBundle.kind === 308 ? sourceFileOrBundle : void 0;
147215
147208
  const sourceFile = sourceFileOrBundle.kind === 307 ? sourceFileOrBundle : void 0;
147216
147209
  const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -147266,7 +147259,7 @@ ${lanes.join("\n")}
147266
147259
  writer.writeLine();
147267
147260
  }
147268
147261
  const text = writer.getText();
147269
- const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
147262
+ const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
147270
147263
  writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
147271
147264
  writer.clear();
147272
147265
  return !data.skippedDtsWrite;
@@ -164982,11 +164975,9 @@ ${lanes.join("\n")}
164982
164975
  if (!resolver.canReuseTypeNode(context, node)) {
164983
164976
  return resolver.serializeExistingTypeNode(context, node);
164984
164977
  }
164985
- const specifier = rewriteModuleSpecifier2(node, node.argument.literal);
164986
- const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
164987
164978
  return factory.updateImportTypeNode(
164988
164979
  node,
164989
- literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
164980
+ factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier2(node, node.argument.literal)),
164990
164981
  visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
164991
164982
  visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
164992
164983
  visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
@@ -165148,7 +165139,10 @@ ${lanes.join("\n")}
165148
165139
  }
165149
165140
  function rewriteModuleSpecifier2(parent2, lit) {
165150
165141
  const newName = resolver.getModuleSpecifierOverride(context, parent2, lit);
165151
- 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);
165152
165146
  }
165153
165147
  }
165154
165148
  }
@@ -165324,7 +165318,12 @@ ${lanes.join("\n")}
165324
165318
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
165325
165319
  }
165326
165320
  if (accessorDeclarations.getAccessor) {
165327
- 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
+ ));
165328
165327
  }
165329
165328
  return void 0;
165330
165329
  }
@@ -165443,7 +165442,7 @@ ${lanes.join("\n")}
165443
165442
  /* AnyKeyword */
165444
165443
  );
165445
165444
  }
165446
- function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
165445
+ function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
165447
165446
  if (reportFallback) {
165448
165447
  context.tracker.reportInferenceFallback(node);
165449
165448
  }
@@ -165453,7 +165452,7 @@ ${lanes.join("\n")}
165453
165452
  /* AnyKeyword */
165454
165453
  );
165455
165454
  }
165456
- return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(
165455
+ return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(
165457
165456
  133
165458
165457
  /* AnyKeyword */
165459
165458
  );
@@ -165768,17 +165767,18 @@ ${lanes.join("\n")}
165768
165767
  );
165769
165768
  }
165770
165769
  function reuseTypeParameters(typeParameters, context) {
165771
- return typeParameters == null ? void 0 : typeParameters.map((tp) => {
165772
- var _a;
165773
- const { node: tpName } = resolver.trackExistingEntityName(context, tp.name);
165774
- return factory.updateTypeParameterDeclaration(
165775
- tp,
165776
- (_a = tp.modifiers) == null ? void 0 : _a.map((m) => reuseNode(context, m)),
165777
- tpName,
165778
- serializeExistingTypeNodeWithFallback(tp.constraint, context),
165779
- serializeExistingTypeNodeWithFallback(tp.default, context)
165780
- );
165781
- });
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
+ );
165782
165782
  }
165783
165783
  function typeFromObjectLiteralMethod(method, name, context, isConstContext) {
165784
165784
  const returnType = createReturnFromSignature(
@@ -165933,7 +165933,7 @@ ${lanes.join("\n")}
165933
165933
  } else if (isValueSignatureDeclaration(fn)) {
165934
165934
  returnType = typeFromSingleReturnExpression(fn, context);
165935
165935
  }
165936
- 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);
165937
165937
  }
165938
165938
  function typeFromSingleReturnExpression(declaration, context) {
165939
165939
  let candidateExpr;
@@ -182256,7 +182256,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
182256
182256
  throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
182257
182257
  }
182258
182258
  setObjectAllocator(getServicesObjectAllocator());
182259
- function transform2(source, transformers, compilerOptions) {
182259
+ function transform(source, transformers, compilerOptions) {
182260
182260
  const diagnostics = [];
182261
182261
  compilerOptions = fixupCompilerOptions(compilerOptions, diagnostics);
182262
182262
  const nodes = isArray(source) ? source : [source];
@@ -215849,7 +215849,7 @@ ${options.prefix}` : "\n" : options.prefix
215849
215849
  tracing: () => tracing,
215850
215850
  tracingEnabled: () => tracingEnabled,
215851
215851
  transferSourceFileChildren: () => transferSourceFileChildren,
215852
- transform: () => transform2,
215852
+ transform: () => transform,
215853
215853
  transformClassFields: () => transformClassFields,
215854
215854
  transformDeclarations: () => transformDeclarations,
215855
215855
  transformECMAScriptModule: () => transformECMAScriptModule,
@@ -229479,7 +229479,10 @@ function extractMessageDescriptor(ts2, node, { overrideIdFn, extractSourceLocati
229479
229479
  if (flatten2 && msg.defaultMessage) {
229480
229480
  try {
229481
229481
  msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
229482
- } 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}`);
229483
229486
  }
229484
229487
  }
229485
229488
  if (msg.defaultMessage && overrideIdFn) {
@@ -229847,22 +229850,20 @@ function extractText(node, fileName, options) {
229847
229850
  }
229848
229851
  }
229849
229852
  function parseFile2(source, fileName, options) {
229850
- let visitor = function() {
229851
- return {
229852
- MustacheStatement(node) {
229853
- extractText(node, fileName, options);
229854
- },
229855
- SubExpression(node) {
229856
- extractText(node, fileName, options);
229857
- }
229858
- };
229859
- };
229860
- (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
+ });
229861
229862
  }
229862
- var import_ember_template_recast;
229863
+ var import_syntax;
229863
229864
  var init_hbs_extractor = __esm({
229864
229865
  "packages/cli-lib/src/hbs_extractor.ts"() {
229865
- import_ember_template_recast = require("ember-template-recast");
229866
+ import_syntax = require("@glimmer/syntax");
229866
229867
  }
229867
229868
  });
229868
229869
 
@@ -229908,7 +229909,7 @@ var {
229908
229909
  } = import_index.default;
229909
229910
 
229910
229911
  // packages/cli-lib/src/cli.ts
229911
- var import_fast_glob = __toESM(require_out4());
229912
+ var glob = __toESM(require_out4());
229912
229913
  var import_loud_rejection = __toESM(require_loud_rejection());
229913
229914
 
229914
229915
  // packages/cli-lib/src/compile.ts
@@ -230451,13 +230452,31 @@ async function extract(files, extractOpts) {
230451
230452
  const stdinSource = await getStdinAsString();
230452
230453
  rawResults = [await processFile(stdinSource, "dummy", opts)];
230453
230454
  } else {
230454
- rawResults = await Promise.all(
230455
- files.map(async (fn) => {
230456
- debug("Extracting file:", fn);
230457
- const source = await (0, import_promises.readFile)(fn, "utf8");
230458
- return processFile(source, fn, opts);
230459
- })
230460
- );
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
+ }
230461
230480
  }
230462
230481
  } catch (e) {
230463
230482
  if (throws) {
@@ -230688,6 +230707,7 @@ async function verify(files, { sourceLocale, missingKeys, extraKeys, structuralE
230688
230707
  // packages/cli-lib/src/cli.ts
230689
230708
  var import_path4 = require("path");
230690
230709
  var import_fs = require("fs");
230710
+ var globSync = glob.sync;
230691
230711
  var KNOWN_COMMANDS = ["extract"];
230692
230712
  async function main(argv) {
230693
230713
  (0, import_loud_rejection.default)();
@@ -230777,7 +230797,7 @@ sentences are not translator-friendly.`
230777
230797
  const files = [];
230778
230798
  if (filePatterns.length) {
230779
230799
  files.push(
230780
- ...(0, import_fast_glob.sync)(filePatterns, {
230800
+ ...globSync(filePatterns, {
230781
230801
  ignore: cmdObj.ignore
230782
230802
  })
230783
230803
  );
@@ -230838,7 +230858,7 @@ This is especially useful to convert from a TMS-specific format back to react-in
230838
230858
  ).action(async (filePatterns, opts) => {
230839
230859
  debug("File pattern:", filePatterns);
230840
230860
  debug("Options:", opts);
230841
- const files = (0, import_fast_glob.sync)(filePatterns);
230861
+ const files = globSync(filePatterns);
230842
230862
  if (!files.length) {
230843
230863
  throw new Error(`No input file found with pattern ${filePatterns}`);
230844
230864
  }
@@ -230860,10 +230880,19 @@ This is especially useful to convert from a TMS-specific format back to react-in
230860
230880
  ).option(
230861
230881
  "--ast",
230862
230882
  `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`
230883
+ ).option(
230884
+ "--skip-errors",
230885
+ `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`
230886
+ ).option(
230887
+ "--pseudo-locale <pseudoLocale>",
230888
+ `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.`
230889
+ ).option(
230890
+ "--ignore-tag",
230891
+ `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.`
230863
230892
  ).action(async (folder, outFolder, opts) => {
230864
230893
  debug("Folder:", folder);
230865
230894
  debug("Options:", opts);
230866
- const files = (0, import_fast_glob.sync)(`${folder}/*.json`);
230895
+ const files = globSync(`${folder}/*.json`);
230867
230896
  if (!files.length) {
230868
230897
  throw new Error(`No JSON file found in ${folder}`);
230869
230898
  }
@@ -230891,7 +230920,7 @@ This is especially useful to convert from a TMS-specific format back to react-in
230891
230920
  ).action(async (filePatterns, opts) => {
230892
230921
  debug("File pattern:", filePatterns);
230893
230922
  debug("Options:", opts);
230894
- const files = (0, import_fast_glob.sync)(filePatterns, {
230923
+ const files = globSync(filePatterns, {
230895
230924
  ignore: opts.ignore
230896
230925
  });
230897
230926
  if (!files.length) {
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.11.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.0"
11
+ "@formatjs/cli-lib": "8.2.2"
12
12
  },
13
13
  "peerDependencies": {
14
- "@glimmer/syntax": "^0.95.0",
15
- "@vue/compiler-core": "3.5.26",
14
+ "@glimmer/syntax": "^0.84.3 || ^0.95.0",
15
+ "@vue/compiler-core": "3.5.27",
16
16
  "content-tag": "^4.1.0",
17
- "ember-template-recast": "^6.1.5",
18
- "vue": "3.5.26"
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
  }