@formatjs/cli 6.11.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.
- package/bin/formatjs +98 -88
- 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
|
|
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 ||
|
|
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
|
}
|
|
@@ -17747,9 +17747,9 @@ var init_printer = __esm({
|
|
|
17747
17747
|
}
|
|
17748
17748
|
});
|
|
17749
17749
|
|
|
17750
|
-
// node_modules/.aspect_rules_js/typescript@5.8.
|
|
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.
|
|
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: () =>
|
|
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.
|
|
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
|
|
36214
|
-
function
|
|
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,
|
|
36233
|
+
return forEachChild(node, traverse2);
|
|
36234
36234
|
}
|
|
36235
36235
|
}
|
|
36236
36236
|
}
|
|
36237
36237
|
function forEachYieldExpression(body, visitor) {
|
|
36238
|
-
return
|
|
36239
|
-
function
|
|
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
|
-
|
|
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
|
-
|
|
36256
|
+
traverse2(node.name.expression);
|
|
36257
36257
|
return;
|
|
36258
36258
|
}
|
|
36259
36259
|
} else if (!isPartOfTypeNode(node)) {
|
|
36260
|
-
forEachChild(node,
|
|
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
|
|
77039
|
+
serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
|
|
77040
77040
|
const context = syntacticContext;
|
|
77041
77041
|
const signature = getSignatureFromDeclaration(signatureDeclaration);
|
|
77042
|
-
|
|
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
|
|
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
|
-
|
|
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,
|
|
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 =
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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 =
|
|
86104
|
+
links.containsArgumentsReference = traverse2(declaration.body);
|
|
86107
86105
|
}
|
|
86108
86106
|
}
|
|
86109
86107
|
return links.containsArgumentsReference;
|
|
86110
|
-
function
|
|
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 &&
|
|
86118
|
+
return node.name.kind === 167 && traverse2(node.name);
|
|
86121
86119
|
case 211:
|
|
86122
86120
|
case 212:
|
|
86123
|
-
return
|
|
86121
|
+
return traverse2(node.expression);
|
|
86124
86122
|
case 303:
|
|
86125
|
-
return
|
|
86123
|
+
return traverse2(node.initializer);
|
|
86126
86124
|
default:
|
|
86127
|
-
return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node,
|
|
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
|
|
146449
|
-
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
|
|
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:
|
|
147089
|
-
isEmitNotificationEnabled:
|
|
147090
|
-
substituteNode:
|
|
147081
|
+
onEmitNode: transform2.emitNodeWithNotification,
|
|
147082
|
+
isEmitNotificationEnabled: transform2.isEmitNotificationEnabled,
|
|
147083
|
+
substituteNode: transform2.substituteNode
|
|
147091
147084
|
});
|
|
147092
|
-
Debug.assert(
|
|
147093
|
-
printSourceFileOrBundle(jsFilePath, sourceMapFilePath,
|
|
147094
|
-
|
|
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,
|
|
147213
|
-
const sourceFileOrBundle =
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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,
|
|
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
|
|
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(
|
|
165772
|
-
|
|
165773
|
-
|
|
165774
|
-
|
|
165775
|
-
|
|
165776
|
-
|
|
165777
|
-
|
|
165778
|
-
|
|
165779
|
-
|
|
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,
|
|
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
|
|
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: () =>
|
|
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
|
-
|
|
229851
|
-
|
|
229852
|
-
|
|
229853
|
-
|
|
229854
|
-
|
|
229855
|
-
|
|
229856
|
-
|
|
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
|
|
229863
|
+
var import_syntax;
|
|
229863
229864
|
var init_hbs_extractor = __esm({
|
|
229864
229865
|
"packages/cli-lib/src/hbs_extractor.ts"() {
|
|
229865
|
-
|
|
229866
|
+
import_syntax = require("@glimmer/syntax");
|
|
229866
229867
|
}
|
|
229867
229868
|
});
|
|
229868
229869
|
|
|
@@ -230860,6 +230861,15 @@ This is especially useful to convert from a TMS-specific format back to react-in
|
|
|
230860
230861
|
).option(
|
|
230861
230862
|
"--ast",
|
|
230862
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.`
|
|
230863
230873
|
).action(async (folder, outFolder, opts) => {
|
|
230864
230874
|
debug("Folder:", folder);
|
|
230865
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.
|
|
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.2.
|
|
11
|
+
"@formatjs/cli-lib": "8.2.1"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@glimmer/syntax": "^0.95.0",
|
|
15
|
-
"@vue/compiler-core": "3.5.
|
|
14
|
+
"@glimmer/syntax": "^0.84.3 || ^0.95.0",
|
|
15
|
+
"@vue/compiler-core": "3.5.27",
|
|
16
16
|
"content-tag": "^4.1.0",
|
|
17
|
-
"
|
|
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
|
}
|