typescript 4.8.0-dev.20220627 → 4.8.0-dev.20220630
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/lib/tsc.js +164 -110
- package/lib/tsserver.js +211 -150
- package/lib/tsserverlibrary.js +211 -150
- package/lib/typescript.js +210 -149
- package/lib/typescriptServices.js +210 -149
- package/lib/typingsInstaller.js +169 -116
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -3104,6 +3104,22 @@ var ts;
|
|
|
3104
3104
|
return wrapFunction(deprecation, func);
|
|
3105
3105
|
}
|
|
3106
3106
|
Debug.deprecate = deprecate;
|
|
3107
|
+
function formatVariance(varianceFlags) {
|
|
3108
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3109
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3110
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3111
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3112
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3113
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3114
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3115
|
+
result += " (unmeasurable)";
|
|
3116
|
+
}
|
|
3117
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3118
|
+
result += " (unreliable)";
|
|
3119
|
+
}
|
|
3120
|
+
return result;
|
|
3121
|
+
}
|
|
3122
|
+
Debug.formatVariance = formatVariance;
|
|
3107
3123
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3108
3124
|
})(ts || (ts = {}));
|
|
3109
3125
|
/* @internal */
|
|
@@ -3845,9 +3861,9 @@ var ts;
|
|
|
3845
3861
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
3846
3862
|
}
|
|
3847
3863
|
tracingEnabled.push = push;
|
|
3848
|
-
function pop() {
|
|
3864
|
+
function pop(results) {
|
|
3849
3865
|
ts.Debug.assert(eventStack.length > 0);
|
|
3850
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
3866
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
3851
3867
|
eventStack.length--;
|
|
3852
3868
|
}
|
|
3853
3869
|
tracingEnabled.pop = pop;
|
|
@@ -3861,14 +3877,15 @@ var ts;
|
|
|
3861
3877
|
tracingEnabled.popAll = popAll;
|
|
3862
3878
|
// sample every 10ms
|
|
3863
3879
|
var sampleInterval = 1000 * 10;
|
|
3864
|
-
function writeStackEvent(index, endTime) {
|
|
3880
|
+
function writeStackEvent(index, endTime, results) {
|
|
3865
3881
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
3866
3882
|
if (separateBeginAndEnd) {
|
|
3883
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
3867
3884
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
3868
3885
|
}
|
|
3869
3886
|
// test if [time,endTime) straddles a sampling point
|
|
3870
3887
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
3871
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
3888
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
3872
3889
|
}
|
|
3873
3890
|
}
|
|
3874
3891
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -32939,7 +32956,7 @@ var ts;
|
|
|
32939
32956
|
}
|
|
32940
32957
|
return parseElement();
|
|
32941
32958
|
}
|
|
32942
|
-
function currentNode(parsingContext) {
|
|
32959
|
+
function currentNode(parsingContext, pos) {
|
|
32943
32960
|
// If we don't have a cursor or the parsing context isn't reusable, there's nothing to reuse.
|
|
32944
32961
|
//
|
|
32945
32962
|
// If there is an outstanding parse error that we've encountered, but not attached to
|
|
@@ -32952,7 +32969,7 @@ var ts;
|
|
|
32952
32969
|
if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
|
|
32953
32970
|
return undefined;
|
|
32954
32971
|
}
|
|
32955
|
-
var node = syntaxCursor.currentNode(scanner.getStartPos());
|
|
32972
|
+
var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos());
|
|
32956
32973
|
// Can't reuse a missing node.
|
|
32957
32974
|
// Can't reuse a node that intersected the change range.
|
|
32958
32975
|
// Can't reuse a node that contains a parse error. This is necessary so that we
|
|
@@ -36574,24 +36591,19 @@ var ts;
|
|
|
36574
36591
|
return modifier.kind === 135 /* DeclareKeyword */;
|
|
36575
36592
|
}
|
|
36576
36593
|
function parseDeclaration() {
|
|
36577
|
-
// TODO: Can we hold onto the parsed decorators/modifiers and advance the scanner
|
|
36578
|
-
// if we can't reuse the declaration, so that we don't do this work twice?
|
|
36579
|
-
//
|
|
36580
36594
|
// `parseListElement` attempted to get the reused node at this position,
|
|
36581
36595
|
// but the ambient context flag was not yet set, so the node appeared
|
|
36582
36596
|
// not reusable in that context.
|
|
36583
|
-
var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
|
|
36584
|
-
if (isAmbient) {
|
|
36585
|
-
var node = tryReuseAmbientDeclaration();
|
|
36586
|
-
if (node) {
|
|
36587
|
-
return node;
|
|
36588
|
-
}
|
|
36589
|
-
}
|
|
36590
36597
|
var pos = getNodePos();
|
|
36591
36598
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
36592
36599
|
var decorators = parseDecorators();
|
|
36593
36600
|
var modifiers = parseModifiers();
|
|
36601
|
+
var isAmbient = ts.some(modifiers, isDeclareModifier);
|
|
36594
36602
|
if (isAmbient) {
|
|
36603
|
+
var node = tryReuseAmbientDeclaration(pos);
|
|
36604
|
+
if (node) {
|
|
36605
|
+
return node;
|
|
36606
|
+
}
|
|
36595
36607
|
for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
|
|
36596
36608
|
var m = _a[_i];
|
|
36597
36609
|
m.flags |= 16777216 /* Ambient */;
|
|
@@ -36602,9 +36614,9 @@ var ts;
|
|
|
36602
36614
|
return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
|
|
36603
36615
|
}
|
|
36604
36616
|
}
|
|
36605
|
-
function tryReuseAmbientDeclaration() {
|
|
36617
|
+
function tryReuseAmbientDeclaration(pos) {
|
|
36606
36618
|
return doInsideOfContext(16777216 /* Ambient */, function () {
|
|
36607
|
-
var node = currentNode(parsingContext);
|
|
36619
|
+
var node = currentNode(parsingContext, pos);
|
|
36608
36620
|
if (node) {
|
|
36609
36621
|
return consumeNode(node);
|
|
36610
36622
|
}
|
|
@@ -67489,7 +67501,7 @@ var ts;
|
|
|
67489
67501
|
_loop_22(tp);
|
|
67490
67502
|
}
|
|
67491
67503
|
links.variances = variances;
|
|
67492
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67504
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67493
67505
|
}
|
|
67494
67506
|
return links.variances;
|
|
67495
67507
|
}
|
|
@@ -73362,8 +73374,8 @@ var ts;
|
|
|
73362
73374
|
var conditional = node.parent;
|
|
73363
73375
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
|
|
73364
73376
|
}
|
|
73365
|
-
function getContextualTypeForChildJsxExpression(node, child) {
|
|
73366
|
-
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
|
|
73377
|
+
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
73378
|
+
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
|
|
73367
73379
|
// JSX expression is in children of JSX Element, we will look for an "children" attribute (we get the name from JSX.ElementAttributesProperty)
|
|
73368
73380
|
var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
73369
73381
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
@@ -73381,27 +73393,27 @@ var ts;
|
|
|
73381
73393
|
}
|
|
73382
73394
|
}, /*noReductions*/ true));
|
|
73383
73395
|
}
|
|
73384
|
-
function getContextualTypeForJsxExpression(node) {
|
|
73396
|
+
function getContextualTypeForJsxExpression(node, contextFlags) {
|
|
73385
73397
|
var exprParent = node.parent;
|
|
73386
73398
|
return ts.isJsxAttributeLike(exprParent)
|
|
73387
|
-
? getContextualType(node)
|
|
73399
|
+
? getContextualType(node, contextFlags)
|
|
73388
73400
|
: ts.isJsxElement(exprParent)
|
|
73389
|
-
? getContextualTypeForChildJsxExpression(exprParent, node)
|
|
73401
|
+
? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags)
|
|
73390
73402
|
: undefined;
|
|
73391
73403
|
}
|
|
73392
|
-
function getContextualTypeForJsxAttribute(attribute) {
|
|
73404
|
+
function getContextualTypeForJsxAttribute(attribute, contextFlags) {
|
|
73393
73405
|
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
|
|
73394
73406
|
// which is a type of the parameter of the signature we are trying out.
|
|
73395
73407
|
// If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName
|
|
73396
73408
|
if (ts.isJsxAttribute(attribute)) {
|
|
73397
|
-
var attributesType = getApparentTypeOfContextualType(attribute.parent);
|
|
73409
|
+
var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags);
|
|
73398
73410
|
if (!attributesType || isTypeAny(attributesType)) {
|
|
73399
73411
|
return undefined;
|
|
73400
73412
|
}
|
|
73401
73413
|
return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
|
|
73402
73414
|
}
|
|
73403
73415
|
else {
|
|
73404
|
-
return getContextualType(attribute.parent);
|
|
73416
|
+
return getContextualType(attribute.parent, contextFlags);
|
|
73405
73417
|
}
|
|
73406
73418
|
}
|
|
73407
73419
|
// Return true if the given expression is possibly a discriminant value. We limit the kinds of
|
|
@@ -73562,10 +73574,10 @@ var ts;
|
|
|
73562
73574
|
case 271 /* ExportAssignment */:
|
|
73563
73575
|
return tryGetTypeFromEffectiveTypeNode(parent);
|
|
73564
73576
|
case 288 /* JsxExpression */:
|
|
73565
|
-
return getContextualTypeForJsxExpression(parent);
|
|
73577
|
+
return getContextualTypeForJsxExpression(parent, contextFlags);
|
|
73566
73578
|
case 285 /* JsxAttribute */:
|
|
73567
73579
|
case 287 /* JsxSpreadAttribute */:
|
|
73568
|
-
return getContextualTypeForJsxAttribute(parent);
|
|
73580
|
+
return getContextualTypeForJsxAttribute(parent, contextFlags);
|
|
73569
73581
|
case 280 /* JsxOpeningElement */:
|
|
73570
73582
|
case 279 /* JsxSelfClosingElement */:
|
|
73571
73583
|
return getContextualJsxElementAttributesType(parent, contextFlags);
|
|
@@ -80570,12 +80582,14 @@ var ts;
|
|
|
80570
80582
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80571
80583
|
}
|
|
80572
80584
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80585
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80573
80586
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80574
80587
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80575
80588
|
var saveVarianceTypeParameter = typeParameter;
|
|
80576
80589
|
varianceTypeParameter = typeParameter;
|
|
80577
80590
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80578
80591
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80592
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80579
80593
|
}
|
|
80580
80594
|
}
|
|
80581
80595
|
}
|
|
@@ -81971,8 +81985,17 @@ var ts;
|
|
|
81971
81985
|
}
|
|
81972
81986
|
// For a union, get a union of the awaited types of each constituent.
|
|
81973
81987
|
if (type.flags & 1048576 /* Union */) {
|
|
81988
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
81989
|
+
if (errorNode) {
|
|
81990
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
81991
|
+
}
|
|
81992
|
+
return undefined;
|
|
81993
|
+
}
|
|
81974
81994
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81975
|
-
|
|
81995
|
+
awaitedTypeStack.push(type.id);
|
|
81996
|
+
var mapped = mapType(type, mapper);
|
|
81997
|
+
awaitedTypeStack.pop();
|
|
81998
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
81976
81999
|
}
|
|
81977
82000
|
var thisTypeForErrorOut = { value: undefined };
|
|
81978
82001
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -88040,13 +88063,20 @@ var ts;
|
|
|
88040
88063
|
if (!fileToDirective) {
|
|
88041
88064
|
return undefined;
|
|
88042
88065
|
}
|
|
88066
|
+
// computed property name should use node as value
|
|
88043
88067
|
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
|
|
88044
88068
|
// qualified names can only be used as types\namespaces
|
|
88045
88069
|
// identifiers are treated as values only if they appear in type queries
|
|
88046
|
-
var meaning
|
|
88047
|
-
if (
|
|
88070
|
+
var meaning;
|
|
88071
|
+
if (node.parent.kind === 162 /* ComputedPropertyName */) {
|
|
88048
88072
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
88049
88073
|
}
|
|
88074
|
+
else {
|
|
88075
|
+
meaning = 788968 /* Type */ | 1920 /* Namespace */;
|
|
88076
|
+
if ((node.kind === 79 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
|
|
88077
|
+
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
88078
|
+
}
|
|
88079
|
+
}
|
|
88050
88080
|
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
|
|
88051
88081
|
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
|
|
88052
88082
|
}
|
|
@@ -111158,7 +111188,6 @@ var ts;
|
|
|
111158
111188
|
var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
|
|
111159
111189
|
var bundleBuildInfo;
|
|
111160
111190
|
var emitSkipped = false;
|
|
111161
|
-
var exportedModulesFromDeclarationEmit;
|
|
111162
111191
|
// Emit each output file
|
|
111163
111192
|
enter();
|
|
111164
111193
|
forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
|
|
@@ -111168,7 +111197,6 @@ var ts;
|
|
|
111168
111197
|
diagnostics: emitterDiagnostics.getDiagnostics(),
|
|
111169
111198
|
emittedFiles: emittedFilesList,
|
|
111170
111199
|
sourceMaps: sourceMapDataList,
|
|
111171
|
-
exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
|
|
111172
111200
|
};
|
|
111173
111201
|
function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
|
|
111174
111202
|
var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
|
@@ -111260,7 +111288,7 @@ var ts;
|
|
|
111260
111288
|
substituteNode: transform.substituteNode,
|
|
111261
111289
|
});
|
|
111262
111290
|
ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
|
|
111263
|
-
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform
|
|
111291
|
+
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
|
|
111264
111292
|
// Clean up emit nodes on parse tree
|
|
111265
111293
|
transform.dispose();
|
|
111266
111294
|
if (bundleBuildInfo)
|
|
@@ -111296,7 +111324,7 @@ var ts;
|
|
|
111296
111324
|
noEmitHelpers: true,
|
|
111297
111325
|
module: compilerOptions.module,
|
|
111298
111326
|
target: compilerOptions.target,
|
|
111299
|
-
sourceMap: compilerOptions.
|
|
111327
|
+
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
111300
111328
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
111301
111329
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
111302
111330
|
onlyPrintJsDocStyle: true,
|
|
@@ -111316,17 +111344,13 @@ var ts;
|
|
|
111316
111344
|
emitSkipped = emitSkipped || declBlocked;
|
|
111317
111345
|
if (!declBlocked || forceDtsEmit) {
|
|
111318
111346
|
ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
|
|
111319
|
-
printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform
|
|
111320
|
-
sourceMap:
|
|
111347
|
+
printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
|
|
111348
|
+
sourceMap: printerOptions.sourceMap,
|
|
111321
111349
|
sourceRoot: compilerOptions.sourceRoot,
|
|
111322
111350
|
mapRoot: compilerOptions.mapRoot,
|
|
111323
111351
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
111324
111352
|
// Explicitly do not passthru either `inline` option
|
|
111325
111353
|
});
|
|
111326
|
-
if (forceDtsEmit && declarationTransform.transformed[0].kind === 305 /* SourceFile */) {
|
|
111327
|
-
var sourceFile = declarationTransform.transformed[0];
|
|
111328
|
-
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
|
|
111329
|
-
}
|
|
111330
111354
|
}
|
|
111331
111355
|
declarationTransform.dispose();
|
|
111332
111356
|
if (bundleBuildInfo)
|
|
@@ -111345,7 +111369,8 @@ var ts;
|
|
|
111345
111369
|
}
|
|
111346
111370
|
ts.forEachChild(node, collectLinkedAliases);
|
|
111347
111371
|
}
|
|
111348
|
-
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath,
|
|
111372
|
+
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
|
|
111373
|
+
var sourceFileOrBundle = transform.transformed[0];
|
|
111349
111374
|
var bundle = sourceFileOrBundle.kind === 306 /* Bundle */ ? sourceFileOrBundle : undefined;
|
|
111350
111375
|
var sourceFile = sourceFileOrBundle.kind === 305 /* SourceFile */ ? sourceFileOrBundle : undefined;
|
|
111351
111376
|
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
|
|
@@ -111379,7 +111404,7 @@ var ts;
|
|
|
111379
111404
|
var sourceMap = sourceMapGenerator.toString();
|
|
111380
111405
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
|
|
111381
111406
|
if (printer.bundleFileInfo)
|
|
111382
|
-
printer.bundleFileInfo.mapHash = ts.
|
|
111407
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
|
|
111383
111408
|
}
|
|
111384
111409
|
}
|
|
111385
111410
|
else {
|
|
@@ -111387,11 +111412,11 @@ var ts;
|
|
|
111387
111412
|
}
|
|
111388
111413
|
// Write the output file
|
|
111389
111414
|
var text = writer.getText();
|
|
111390
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
111415
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
|
|
111391
111416
|
// We store the hash of the text written in the buildinfo to ensure that text of the referenced d.ts file is same as whats in the buildinfo
|
|
111392
111417
|
// This is needed because incremental can be toggled between two runs and we might use stale file text to do text manipulation in prepend mode
|
|
111393
111418
|
if (printer.bundleFileInfo)
|
|
111394
|
-
printer.bundleFileInfo.hash = ts.
|
|
111419
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
|
|
111395
111420
|
// Reset state
|
|
111396
111421
|
writer.clear();
|
|
111397
111422
|
}
|
|
@@ -111556,25 +111581,25 @@ var ts;
|
|
|
111556
111581
|
if (!jsFileText)
|
|
111557
111582
|
return jsFilePath;
|
|
111558
111583
|
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
|
|
111559
|
-
if (ts.
|
|
111584
|
+
if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
|
|
111560
111585
|
return jsFilePath;
|
|
111561
111586
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
111562
111587
|
// error if no source map or for now if inline sourcemap
|
|
111563
111588
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
111564
111589
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
111565
|
-
if (sourceMapFilePath && ts.
|
|
111590
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
|
|
111566
111591
|
return sourceMapFilePath;
|
|
111567
111592
|
// read declaration text
|
|
111568
111593
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
111569
111594
|
if (declarationFilePath && !declarationText)
|
|
111570
111595
|
return declarationFilePath;
|
|
111571
|
-
if (declarationFilePath && ts.
|
|
111596
|
+
if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
|
|
111572
111597
|
return declarationFilePath;
|
|
111573
111598
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
111574
111599
|
// error if no source map or for now if inline sourcemap
|
|
111575
111600
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
111576
111601
|
return declarationMapPath || "inline sourcemap decoding";
|
|
111577
|
-
if (declarationMapPath && ts.
|
|
111602
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
111578
111603
|
return declarationMapPath;
|
|
111579
111604
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
111580
111605
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
|
|
@@ -111614,7 +111639,7 @@ var ts;
|
|
|
111614
111639
|
newBuildInfo.program = buildInfo.program;
|
|
111615
111640
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111616
111641
|
// Update the output signature
|
|
111617
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
111642
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111618
111643
|
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111619
111644
|
}
|
|
111620
111645
|
// Update sourceFileInfo
|
|
@@ -119420,7 +119445,7 @@ var ts;
|
|
|
119420
119445
|
}
|
|
119421
119446
|
}
|
|
119422
119447
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119423
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
119448
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
119424
119449
|
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
119425
119450
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
119426
119451
|
}
|
|
@@ -120499,8 +120524,8 @@ var ts;
|
|
|
120499
120524
|
(function (ts) {
|
|
120500
120525
|
function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
|
|
120501
120526
|
var outputFiles = [];
|
|
120502
|
-
var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics
|
|
120503
|
-
return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics
|
|
120527
|
+
var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
|
|
120528
|
+
return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
|
|
120504
120529
|
function writeFile(fileName, text, writeByteOrderMark) {
|
|
120505
120530
|
outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
|
|
120506
120531
|
}
|
|
@@ -120724,23 +120749,23 @@ var ts;
|
|
|
120724
120749
|
/**
|
|
120725
120750
|
* Gets the files affected by the path from the program
|
|
120726
120751
|
*/
|
|
120727
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
|
|
120752
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
120728
120753
|
var _a, _b;
|
|
120729
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
|
|
120754
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
|
|
120730
120755
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
120731
120756
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
120732
120757
|
return result;
|
|
120733
120758
|
}
|
|
120734
120759
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
120735
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
|
|
120760
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
120736
120761
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
120737
120762
|
if (!sourceFile) {
|
|
120738
120763
|
return ts.emptyArray;
|
|
120739
120764
|
}
|
|
120740
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
|
|
120765
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
120741
120766
|
return [sourceFile];
|
|
120742
120767
|
}
|
|
120743
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
|
|
120768
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
120744
120769
|
}
|
|
120745
120770
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
120746
120771
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -120751,7 +120776,7 @@ var ts;
|
|
|
120751
120776
|
/**
|
|
120752
120777
|
* Returns if the shape of the signature has changed since last emit
|
|
120753
120778
|
*/
|
|
120754
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
|
|
120779
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
|
|
120755
120780
|
var _a;
|
|
120756
120781
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
120757
120782
|
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
|
|
@@ -120761,18 +120786,16 @@ var ts;
|
|
|
120761
120786
|
var prevSignature = info.signature;
|
|
120762
120787
|
var latestSignature;
|
|
120763
120788
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
120764
|
-
|
|
120765
|
-
|
|
120766
|
-
|
|
120767
|
-
/*forceDtsEmit*/ true);
|
|
120768
|
-
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
120769
|
-
if (firstDts_1) {
|
|
120770
|
-
ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
120771
|
-
latestSignature = computeSignature(firstDts_1.text, computeHash);
|
|
120789
|
+
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
120790
|
+
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
120791
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
|
|
120772
120792
|
if (latestSignature !== prevSignature) {
|
|
120773
|
-
updateExportedModules(state, sourceFile,
|
|
120793
|
+
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
120774
120794
|
}
|
|
120775
|
-
}
|
|
120795
|
+
}, cancellationToken,
|
|
120796
|
+
/*emitOnlyDtsFiles*/ true,
|
|
120797
|
+
/*customTransformers*/ undefined,
|
|
120798
|
+
/*forceDtsEmit*/ true);
|
|
120776
120799
|
}
|
|
120777
120800
|
// Default is to use file version as signature
|
|
120778
120801
|
if (latestSignature === undefined) {
|
|
@@ -120795,10 +120818,6 @@ var ts;
|
|
|
120795
120818
|
return latestSignature !== prevSignature;
|
|
120796
120819
|
}
|
|
120797
120820
|
BuilderState.updateShapeSignature = updateShapeSignature;
|
|
120798
|
-
function computeSignature(text, computeHash) {
|
|
120799
|
-
return (computeHash || ts.generateDjb2Hash)(text);
|
|
120800
|
-
}
|
|
120801
|
-
BuilderState.computeSignature = computeSignature;
|
|
120802
120821
|
/**
|
|
120803
120822
|
* Coverts the declaration emit result into exported modules map
|
|
120804
120823
|
*/
|
|
@@ -120948,7 +120967,7 @@ var ts;
|
|
|
120948
120967
|
/**
|
|
120949
120968
|
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
|
|
120950
120969
|
*/
|
|
120951
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
|
|
120970
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
|
|
120952
120971
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
120953
120972
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
120954
120973
|
}
|
|
@@ -120968,7 +120987,7 @@ var ts;
|
|
|
120968
120987
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
120969
120988
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
120970
120989
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
120971
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
|
|
120990
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
120972
120991
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
120973
120992
|
}
|
|
120974
120993
|
}
|
|
@@ -121162,7 +121181,7 @@ var ts;
|
|
|
121162
121181
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
121163
121182
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
121164
121183
|
*/
|
|
121165
|
-
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
121184
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121166
121185
|
var _a, _b;
|
|
121167
121186
|
while (true) {
|
|
121168
121187
|
var affectedFiles = state.affectedFiles;
|
|
@@ -121174,7 +121193,7 @@ var ts;
|
|
|
121174
121193
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
121175
121194
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
121176
121195
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
121177
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
121196
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121178
121197
|
return affectedFile;
|
|
121179
121198
|
}
|
|
121180
121199
|
affectedFilesIndex++;
|
|
@@ -121202,7 +121221,7 @@ var ts;
|
|
|
121202
121221
|
return program;
|
|
121203
121222
|
}
|
|
121204
121223
|
// Get next batch of affected files
|
|
121205
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
|
|
121224
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
|
|
121206
121225
|
state.currentChangedFilePath = nextKey.value;
|
|
121207
121226
|
state.affectedFilesIndex = 0;
|
|
121208
121227
|
if (!state.seenAffectedFiles)
|
|
@@ -121253,7 +121272,7 @@ var ts;
|
|
|
121253
121272
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
121254
121273
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
121255
121274
|
*/
|
|
121256
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
121275
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121257
121276
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
121258
121277
|
// If affected files is everything except default library, then nothing more to do
|
|
121259
121278
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
@@ -121261,18 +121280,18 @@ var ts;
|
|
|
121261
121280
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
121262
121281
|
// That means when affected file is handled, its signature can be out of date
|
|
121263
121282
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
121264
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
|
|
121283
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121265
121284
|
return;
|
|
121266
121285
|
}
|
|
121267
121286
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
121268
121287
|
return;
|
|
121269
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
121288
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121270
121289
|
}
|
|
121271
121290
|
/**
|
|
121272
121291
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
121273
121292
|
* Also we need to make sure signature is updated for these files
|
|
121274
121293
|
*/
|
|
121275
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
121294
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121276
121295
|
removeSemanticDiagnosticsOf(state, path);
|
|
121277
121296
|
if (!state.changedFilesSet.has(path)) {
|
|
121278
121297
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -121283,7 +121302,7 @@ var ts;
|
|
|
121283
121302
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
121284
121303
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
121285
121304
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
121286
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
|
|
121305
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
|
|
121287
121306
|
// If not dts emit, nothing more to do
|
|
121288
121307
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
121289
121308
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -121308,20 +121327,20 @@ var ts;
|
|
|
121308
121327
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
121309
121328
|
return newSignature !== oldSignature;
|
|
121310
121329
|
}
|
|
121311
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
121330
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121312
121331
|
var _a;
|
|
121313
121332
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
121314
121333
|
return false;
|
|
121315
121334
|
// Every file needs to be handled
|
|
121316
121335
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
121317
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
121336
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
|
|
121318
121337
|
removeDiagnosticsOfLibraryFiles(state);
|
|
121319
121338
|
return true;
|
|
121320
121339
|
}
|
|
121321
121340
|
/**
|
|
121322
121341
|
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
121323
121342
|
*/
|
|
121324
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
121343
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121325
121344
|
var _a;
|
|
121326
121345
|
// If there was change in signature (dts output) for the changed file,
|
|
121327
121346
|
// then only we need to handle pending file emit
|
|
@@ -121339,9 +121358,9 @@ var ts;
|
|
|
121339
121358
|
var currentPath = queue.pop();
|
|
121340
121359
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121341
121360
|
seenFileNamesMap.set(currentPath, true);
|
|
121342
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
121361
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121343
121362
|
return;
|
|
121344
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
121363
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121345
121364
|
if (isChangedSignature(state, currentPath)) {
|
|
121346
121365
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
121347
121366
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -121353,11 +121372,11 @@ var ts;
|
|
|
121353
121372
|
// Go through exported modules from cache first
|
|
121354
121373
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121355
121374
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121356
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
121375
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121357
121376
|
return true;
|
|
121358
121377
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
121359
121378
|
return references && ts.forEachKey(references, function (filePath) {
|
|
121360
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
121379
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121361
121380
|
});
|
|
121362
121381
|
});
|
|
121363
121382
|
}
|
|
@@ -121365,22 +121384,22 @@ var ts;
|
|
|
121365
121384
|
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
121366
121385
|
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
121367
121386
|
*/
|
|
121368
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
121387
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121369
121388
|
var _a, _b;
|
|
121370
121389
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
121371
121390
|
return undefined;
|
|
121372
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
121391
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121373
121392
|
return true;
|
|
121374
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
121393
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121375
121394
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121376
121395
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121377
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
121396
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121378
121397
|
});
|
|
121379
121398
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
121380
121399
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
121381
121400
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
121382
121401
|
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
121383
|
-
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
121402
|
+
state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121384
121403
|
});
|
|
121385
121404
|
return undefined;
|
|
121386
121405
|
}
|
|
@@ -121699,8 +121718,39 @@ var ts;
|
|
|
121699
121718
|
return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
|
|
121700
121719
|
}
|
|
121701
121720
|
ts.getBuilderCreationParameters = getBuilderCreationParameters;
|
|
121702
|
-
function
|
|
121703
|
-
return
|
|
121721
|
+
function getTextHandlingSourceMapForSignature(text, data) {
|
|
121722
|
+
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
121723
|
+
}
|
|
121724
|
+
function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
|
|
121725
|
+
var _a;
|
|
121726
|
+
text = getTextHandlingSourceMapForSignature(text, data);
|
|
121727
|
+
var sourceFileDirectory;
|
|
121728
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
121729
|
+
text += data.diagnostics.map(function (diagnostic) {
|
|
121730
|
+
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
121731
|
+
}).join("\n");
|
|
121732
|
+
}
|
|
121733
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
|
|
121734
|
+
function flattenDiagnosticMessageText(diagnostic) {
|
|
121735
|
+
return ts.isString(diagnostic) ?
|
|
121736
|
+
diagnostic :
|
|
121737
|
+
diagnostic === undefined ?
|
|
121738
|
+
"" :
|
|
121739
|
+
!diagnostic.next ?
|
|
121740
|
+
diagnostic.messageText :
|
|
121741
|
+
diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText).join("\n");
|
|
121742
|
+
}
|
|
121743
|
+
function locationInfo(diagnostic) {
|
|
121744
|
+
if (diagnostic.file.resolvedPath === sourceFile.resolvedPath)
|
|
121745
|
+
return "(" + diagnostic.start + "," + diagnostic.length + ")";
|
|
121746
|
+
if (sourceFileDirectory === undefined)
|
|
121747
|
+
sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
|
|
121748
|
+
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)) + "(" + diagnostic.start + "," + diagnostic.length + ")";
|
|
121749
|
+
}
|
|
121750
|
+
}
|
|
121751
|
+
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
121752
|
+
function computeSignature(text, computeHash, data) {
|
|
121753
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
121704
121754
|
}
|
|
121705
121755
|
ts.computeSignature = computeSignature;
|
|
121706
121756
|
function createBuilderProgram(kind, _a) {
|
|
@@ -121761,7 +121811,7 @@ var ts;
|
|
|
121761
121811
|
* in that order would be used to write the files
|
|
121762
121812
|
*/
|
|
121763
121813
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
121764
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
121814
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121765
121815
|
var emitKind = 1 /* Full */;
|
|
121766
121816
|
var isPendingEmitFile = false;
|
|
121767
121817
|
if (!affected) {
|
|
@@ -121798,32 +121848,35 @@ var ts;
|
|
|
121798
121848
|
}
|
|
121799
121849
|
function getWriteFileCallback(writeFile, customTransformers) {
|
|
121800
121850
|
return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
121801
|
-
var _a, _b, _c;
|
|
121851
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
121802
121852
|
if (ts.isDeclarationFileName(fileName)) {
|
|
121803
121853
|
if (!ts.outFile(state.compilerOptions)) {
|
|
121804
121854
|
ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
|
|
121805
|
-
var
|
|
121855
|
+
var emitSignature = void 0;
|
|
121806
121856
|
if (!customTransformers) {
|
|
121807
121857
|
var file = sourceFiles[0];
|
|
121808
121858
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
121809
121859
|
if (info.signature === file.version) {
|
|
121810
|
-
|
|
121811
|
-
|
|
121860
|
+
var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
|
|
121861
|
+
// With d.ts diagnostics they are also part of the signature so emitSignature will be different from it since its just hash of d.ts
|
|
121862
|
+
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
121863
|
+
emitSignature = signature;
|
|
121864
|
+
if (signature !== file.version) { // Update it
|
|
121812
121865
|
if (host.storeFilesChangingSignatureDuringEmit)
|
|
121813
|
-
(state.filesChangingSignature
|
|
121866
|
+
((_b = state.filesChangingSignature) !== null && _b !== void 0 ? _b : (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
|
|
121814
121867
|
if (state.exportedModulesMap)
|
|
121815
121868
|
ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
|
|
121816
121869
|
if (state.affectedFiles) {
|
|
121817
121870
|
// Keep old signature so we know what to undo if cancellation happens
|
|
121818
|
-
var existing = (
|
|
121871
|
+
var existing = (_c = state.oldSignatures) === null || _c === void 0 ? void 0 : _c.get(file.resolvedPath);
|
|
121819
121872
|
if (existing === undefined)
|
|
121820
|
-
(state.oldSignatures
|
|
121821
|
-
info.signature =
|
|
121873
|
+
((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
|
|
121874
|
+
info.signature = signature;
|
|
121822
121875
|
}
|
|
121823
121876
|
else {
|
|
121824
121877
|
// These are directly commited
|
|
121825
|
-
info.signature =
|
|
121826
|
-
(
|
|
121878
|
+
info.signature = signature;
|
|
121879
|
+
(_e = state.oldExportedModulesMap) === null || _e === void 0 ? void 0 : _e.clear();
|
|
121827
121880
|
}
|
|
121828
121881
|
}
|
|
121829
121882
|
}
|
|
@@ -121833,16 +121886,16 @@ var ts;
|
|
|
121833
121886
|
// and would need their d.ts change time in --build mode
|
|
121834
121887
|
if (state.compilerOptions.composite) {
|
|
121835
121888
|
var filePath = sourceFiles[0].resolvedPath;
|
|
121836
|
-
var oldSignature = (
|
|
121837
|
-
|
|
121838
|
-
if (
|
|
121839
|
-
(state.emitSignatures
|
|
121889
|
+
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
121890
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
121891
|
+
if (emitSignature !== oldSignature) {
|
|
121892
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
121840
121893
|
state.hasChangedEmitSignature = true;
|
|
121841
121894
|
}
|
|
121842
121895
|
}
|
|
121843
121896
|
}
|
|
121844
121897
|
else if (state.compilerOptions.composite) {
|
|
121845
|
-
var newSignature = computeSignature(text,
|
|
121898
|
+
var newSignature = computeSignature(text, computeHash, data);
|
|
121846
121899
|
if (newSignature !== state.outSignature) {
|
|
121847
121900
|
state.outSignature = newSignature;
|
|
121848
121901
|
state.hasChangedEmitSignature = true;
|
|
@@ -121922,7 +121975,7 @@ var ts;
|
|
|
121922
121975
|
*/
|
|
121923
121976
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
121924
121977
|
while (true) {
|
|
121925
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
121978
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121926
121979
|
if (!affected) {
|
|
121927
121980
|
// Done
|
|
121928
121981
|
return undefined;
|