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/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -3309,6 +3309,22 @@ var ts;
|
|
|
3309
3309
|
return wrapFunction(deprecation, func);
|
|
3310
3310
|
}
|
|
3311
3311
|
Debug.deprecate = deprecate;
|
|
3312
|
+
function formatVariance(varianceFlags) {
|
|
3313
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3314
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3315
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3316
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3317
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3318
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3319
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3320
|
+
result += " (unmeasurable)";
|
|
3321
|
+
}
|
|
3322
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3323
|
+
result += " (unreliable)";
|
|
3324
|
+
}
|
|
3325
|
+
return result;
|
|
3326
|
+
}
|
|
3327
|
+
Debug.formatVariance = formatVariance;
|
|
3312
3328
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3313
3329
|
})(ts || (ts = {}));
|
|
3314
3330
|
/* @internal */
|
|
@@ -4050,9 +4066,9 @@ var ts;
|
|
|
4050
4066
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
4051
4067
|
}
|
|
4052
4068
|
tracingEnabled.push = push;
|
|
4053
|
-
function pop() {
|
|
4069
|
+
function pop(results) {
|
|
4054
4070
|
ts.Debug.assert(eventStack.length > 0);
|
|
4055
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
4071
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
4056
4072
|
eventStack.length--;
|
|
4057
4073
|
}
|
|
4058
4074
|
tracingEnabled.pop = pop;
|
|
@@ -4066,14 +4082,15 @@ var ts;
|
|
|
4066
4082
|
tracingEnabled.popAll = popAll;
|
|
4067
4083
|
// sample every 10ms
|
|
4068
4084
|
var sampleInterval = 1000 * 10;
|
|
4069
|
-
function writeStackEvent(index, endTime) {
|
|
4085
|
+
function writeStackEvent(index, endTime, results) {
|
|
4070
4086
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
4071
4087
|
if (separateBeginAndEnd) {
|
|
4088
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
4072
4089
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
4073
4090
|
}
|
|
4074
4091
|
// test if [time,endTime) straddles a sampling point
|
|
4075
4092
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
4076
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
4093
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
4077
4094
|
}
|
|
4078
4095
|
}
|
|
4079
4096
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -33144,7 +33161,7 @@ var ts;
|
|
|
33144
33161
|
}
|
|
33145
33162
|
return parseElement();
|
|
33146
33163
|
}
|
|
33147
|
-
function currentNode(parsingContext) {
|
|
33164
|
+
function currentNode(parsingContext, pos) {
|
|
33148
33165
|
// If we don't have a cursor or the parsing context isn't reusable, there's nothing to reuse.
|
|
33149
33166
|
//
|
|
33150
33167
|
// If there is an outstanding parse error that we've encountered, but not attached to
|
|
@@ -33157,7 +33174,7 @@ var ts;
|
|
|
33157
33174
|
if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
|
|
33158
33175
|
return undefined;
|
|
33159
33176
|
}
|
|
33160
|
-
var node = syntaxCursor.currentNode(scanner.getStartPos());
|
|
33177
|
+
var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos());
|
|
33161
33178
|
// Can't reuse a missing node.
|
|
33162
33179
|
// Can't reuse a node that intersected the change range.
|
|
33163
33180
|
// Can't reuse a node that contains a parse error. This is necessary so that we
|
|
@@ -36779,24 +36796,19 @@ var ts;
|
|
|
36779
36796
|
return modifier.kind === 135 /* DeclareKeyword */;
|
|
36780
36797
|
}
|
|
36781
36798
|
function parseDeclaration() {
|
|
36782
|
-
// TODO: Can we hold onto the parsed decorators/modifiers and advance the scanner
|
|
36783
|
-
// if we can't reuse the declaration, so that we don't do this work twice?
|
|
36784
|
-
//
|
|
36785
36799
|
// `parseListElement` attempted to get the reused node at this position,
|
|
36786
36800
|
// but the ambient context flag was not yet set, so the node appeared
|
|
36787
36801
|
// not reusable in that context.
|
|
36788
|
-
var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
|
|
36789
|
-
if (isAmbient) {
|
|
36790
|
-
var node = tryReuseAmbientDeclaration();
|
|
36791
|
-
if (node) {
|
|
36792
|
-
return node;
|
|
36793
|
-
}
|
|
36794
|
-
}
|
|
36795
36802
|
var pos = getNodePos();
|
|
36796
36803
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
36797
36804
|
var decorators = parseDecorators();
|
|
36798
36805
|
var modifiers = parseModifiers();
|
|
36806
|
+
var isAmbient = ts.some(modifiers, isDeclareModifier);
|
|
36799
36807
|
if (isAmbient) {
|
|
36808
|
+
var node = tryReuseAmbientDeclaration(pos);
|
|
36809
|
+
if (node) {
|
|
36810
|
+
return node;
|
|
36811
|
+
}
|
|
36800
36812
|
for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
|
|
36801
36813
|
var m = _a[_i];
|
|
36802
36814
|
m.flags |= 16777216 /* Ambient */;
|
|
@@ -36807,9 +36819,9 @@ var ts;
|
|
|
36807
36819
|
return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
|
|
36808
36820
|
}
|
|
36809
36821
|
}
|
|
36810
|
-
function tryReuseAmbientDeclaration() {
|
|
36822
|
+
function tryReuseAmbientDeclaration(pos) {
|
|
36811
36823
|
return doInsideOfContext(16777216 /* Ambient */, function () {
|
|
36812
|
-
var node = currentNode(parsingContext);
|
|
36824
|
+
var node = currentNode(parsingContext, pos);
|
|
36813
36825
|
if (node) {
|
|
36814
36826
|
return consumeNode(node);
|
|
36815
36827
|
}
|
|
@@ -67694,7 +67706,7 @@ var ts;
|
|
|
67694
67706
|
_loop_22(tp);
|
|
67695
67707
|
}
|
|
67696
67708
|
links.variances = variances;
|
|
67697
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67709
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67698
67710
|
}
|
|
67699
67711
|
return links.variances;
|
|
67700
67712
|
}
|
|
@@ -73567,8 +73579,8 @@ var ts;
|
|
|
73567
73579
|
var conditional = node.parent;
|
|
73568
73580
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
|
|
73569
73581
|
}
|
|
73570
|
-
function getContextualTypeForChildJsxExpression(node, child) {
|
|
73571
|
-
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
|
|
73582
|
+
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
73583
|
+
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
|
|
73572
73584
|
// JSX expression is in children of JSX Element, we will look for an "children" attribute (we get the name from JSX.ElementAttributesProperty)
|
|
73573
73585
|
var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
73574
73586
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
@@ -73586,27 +73598,27 @@ var ts;
|
|
|
73586
73598
|
}
|
|
73587
73599
|
}, /*noReductions*/ true));
|
|
73588
73600
|
}
|
|
73589
|
-
function getContextualTypeForJsxExpression(node) {
|
|
73601
|
+
function getContextualTypeForJsxExpression(node, contextFlags) {
|
|
73590
73602
|
var exprParent = node.parent;
|
|
73591
73603
|
return ts.isJsxAttributeLike(exprParent)
|
|
73592
|
-
? getContextualType(node)
|
|
73604
|
+
? getContextualType(node, contextFlags)
|
|
73593
73605
|
: ts.isJsxElement(exprParent)
|
|
73594
|
-
? getContextualTypeForChildJsxExpression(exprParent, node)
|
|
73606
|
+
? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags)
|
|
73595
73607
|
: undefined;
|
|
73596
73608
|
}
|
|
73597
|
-
function getContextualTypeForJsxAttribute(attribute) {
|
|
73609
|
+
function getContextualTypeForJsxAttribute(attribute, contextFlags) {
|
|
73598
73610
|
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
|
|
73599
73611
|
// which is a type of the parameter of the signature we are trying out.
|
|
73600
73612
|
// If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName
|
|
73601
73613
|
if (ts.isJsxAttribute(attribute)) {
|
|
73602
|
-
var attributesType = getApparentTypeOfContextualType(attribute.parent);
|
|
73614
|
+
var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags);
|
|
73603
73615
|
if (!attributesType || isTypeAny(attributesType)) {
|
|
73604
73616
|
return undefined;
|
|
73605
73617
|
}
|
|
73606
73618
|
return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
|
|
73607
73619
|
}
|
|
73608
73620
|
else {
|
|
73609
|
-
return getContextualType(attribute.parent);
|
|
73621
|
+
return getContextualType(attribute.parent, contextFlags);
|
|
73610
73622
|
}
|
|
73611
73623
|
}
|
|
73612
73624
|
// Return true if the given expression is possibly a discriminant value. We limit the kinds of
|
|
@@ -73767,10 +73779,10 @@ var ts;
|
|
|
73767
73779
|
case 271 /* ExportAssignment */:
|
|
73768
73780
|
return tryGetTypeFromEffectiveTypeNode(parent);
|
|
73769
73781
|
case 288 /* JsxExpression */:
|
|
73770
|
-
return getContextualTypeForJsxExpression(parent);
|
|
73782
|
+
return getContextualTypeForJsxExpression(parent, contextFlags);
|
|
73771
73783
|
case 285 /* JsxAttribute */:
|
|
73772
73784
|
case 287 /* JsxSpreadAttribute */:
|
|
73773
|
-
return getContextualTypeForJsxAttribute(parent);
|
|
73785
|
+
return getContextualTypeForJsxAttribute(parent, contextFlags);
|
|
73774
73786
|
case 280 /* JsxOpeningElement */:
|
|
73775
73787
|
case 279 /* JsxSelfClosingElement */:
|
|
73776
73788
|
return getContextualJsxElementAttributesType(parent, contextFlags);
|
|
@@ -80775,12 +80787,14 @@ var ts;
|
|
|
80775
80787
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80776
80788
|
}
|
|
80777
80789
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80790
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80778
80791
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80779
80792
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80780
80793
|
var saveVarianceTypeParameter = typeParameter;
|
|
80781
80794
|
varianceTypeParameter = typeParameter;
|
|
80782
80795
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80783
80796
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80797
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80784
80798
|
}
|
|
80785
80799
|
}
|
|
80786
80800
|
}
|
|
@@ -82176,8 +82190,17 @@ var ts;
|
|
|
82176
82190
|
}
|
|
82177
82191
|
// For a union, get a union of the awaited types of each constituent.
|
|
82178
82192
|
if (type.flags & 1048576 /* Union */) {
|
|
82193
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82194
|
+
if (errorNode) {
|
|
82195
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82196
|
+
}
|
|
82197
|
+
return undefined;
|
|
82198
|
+
}
|
|
82179
82199
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82180
|
-
|
|
82200
|
+
awaitedTypeStack.push(type.id);
|
|
82201
|
+
var mapped = mapType(type, mapper);
|
|
82202
|
+
awaitedTypeStack.pop();
|
|
82203
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82181
82204
|
}
|
|
82182
82205
|
var thisTypeForErrorOut = { value: undefined };
|
|
82183
82206
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -88245,13 +88268,20 @@ var ts;
|
|
|
88245
88268
|
if (!fileToDirective) {
|
|
88246
88269
|
return undefined;
|
|
88247
88270
|
}
|
|
88271
|
+
// computed property name should use node as value
|
|
88248
88272
|
// property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
|
|
88249
88273
|
// qualified names can only be used as types\namespaces
|
|
88250
88274
|
// identifiers are treated as values only if they appear in type queries
|
|
88251
|
-
var meaning
|
|
88252
|
-
if (
|
|
88275
|
+
var meaning;
|
|
88276
|
+
if (node.parent.kind === 162 /* ComputedPropertyName */) {
|
|
88253
88277
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
88254
88278
|
}
|
|
88279
|
+
else {
|
|
88280
|
+
meaning = 788968 /* Type */ | 1920 /* Namespace */;
|
|
88281
|
+
if ((node.kind === 79 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
|
|
88282
|
+
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
88283
|
+
}
|
|
88284
|
+
}
|
|
88255
88285
|
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
|
|
88256
88286
|
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
|
|
88257
88287
|
}
|
|
@@ -111363,7 +111393,6 @@ var ts;
|
|
|
111363
111393
|
var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
|
|
111364
111394
|
var bundleBuildInfo;
|
|
111365
111395
|
var emitSkipped = false;
|
|
111366
|
-
var exportedModulesFromDeclarationEmit;
|
|
111367
111396
|
// Emit each output file
|
|
111368
111397
|
enter();
|
|
111369
111398
|
forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
|
|
@@ -111373,7 +111402,6 @@ var ts;
|
|
|
111373
111402
|
diagnostics: emitterDiagnostics.getDiagnostics(),
|
|
111374
111403
|
emittedFiles: emittedFilesList,
|
|
111375
111404
|
sourceMaps: sourceMapDataList,
|
|
111376
|
-
exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
|
|
111377
111405
|
};
|
|
111378
111406
|
function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
|
|
111379
111407
|
var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
|
|
@@ -111465,7 +111493,7 @@ var ts;
|
|
|
111465
111493
|
substituteNode: transform.substituteNode,
|
|
111466
111494
|
});
|
|
111467
111495
|
ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
|
|
111468
|
-
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform
|
|
111496
|
+
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
|
|
111469
111497
|
// Clean up emit nodes on parse tree
|
|
111470
111498
|
transform.dispose();
|
|
111471
111499
|
if (bundleBuildInfo)
|
|
@@ -111501,7 +111529,7 @@ var ts;
|
|
|
111501
111529
|
noEmitHelpers: true,
|
|
111502
111530
|
module: compilerOptions.module,
|
|
111503
111531
|
target: compilerOptions.target,
|
|
111504
|
-
sourceMap: compilerOptions.
|
|
111532
|
+
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
111505
111533
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
111506
111534
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
111507
111535
|
onlyPrintJsDocStyle: true,
|
|
@@ -111521,17 +111549,13 @@ var ts;
|
|
|
111521
111549
|
emitSkipped = emitSkipped || declBlocked;
|
|
111522
111550
|
if (!declBlocked || forceDtsEmit) {
|
|
111523
111551
|
ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
|
|
111524
|
-
printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform
|
|
111525
|
-
sourceMap:
|
|
111552
|
+
printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
|
|
111553
|
+
sourceMap: printerOptions.sourceMap,
|
|
111526
111554
|
sourceRoot: compilerOptions.sourceRoot,
|
|
111527
111555
|
mapRoot: compilerOptions.mapRoot,
|
|
111528
111556
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
111529
111557
|
// Explicitly do not passthru either `inline` option
|
|
111530
111558
|
});
|
|
111531
|
-
if (forceDtsEmit && declarationTransform.transformed[0].kind === 305 /* SourceFile */) {
|
|
111532
|
-
var sourceFile = declarationTransform.transformed[0];
|
|
111533
|
-
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
|
|
111534
|
-
}
|
|
111535
111559
|
}
|
|
111536
111560
|
declarationTransform.dispose();
|
|
111537
111561
|
if (bundleBuildInfo)
|
|
@@ -111550,7 +111574,8 @@ var ts;
|
|
|
111550
111574
|
}
|
|
111551
111575
|
ts.forEachChild(node, collectLinkedAliases);
|
|
111552
111576
|
}
|
|
111553
|
-
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath,
|
|
111577
|
+
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
|
|
111578
|
+
var sourceFileOrBundle = transform.transformed[0];
|
|
111554
111579
|
var bundle = sourceFileOrBundle.kind === 306 /* Bundle */ ? sourceFileOrBundle : undefined;
|
|
111555
111580
|
var sourceFile = sourceFileOrBundle.kind === 305 /* SourceFile */ ? sourceFileOrBundle : undefined;
|
|
111556
111581
|
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
|
|
@@ -111584,7 +111609,7 @@ var ts;
|
|
|
111584
111609
|
var sourceMap = sourceMapGenerator.toString();
|
|
111585
111610
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
|
|
111586
111611
|
if (printer.bundleFileInfo)
|
|
111587
|
-
printer.bundleFileInfo.mapHash = ts.
|
|
111612
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
|
|
111588
111613
|
}
|
|
111589
111614
|
}
|
|
111590
111615
|
else {
|
|
@@ -111592,11 +111617,11 @@ var ts;
|
|
|
111592
111617
|
}
|
|
111593
111618
|
// Write the output file
|
|
111594
111619
|
var text = writer.getText();
|
|
111595
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
111620
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
|
|
111596
111621
|
// 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
|
|
111597
111622
|
// 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
|
|
111598
111623
|
if (printer.bundleFileInfo)
|
|
111599
|
-
printer.bundleFileInfo.hash = ts.
|
|
111624
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
|
|
111600
111625
|
// Reset state
|
|
111601
111626
|
writer.clear();
|
|
111602
111627
|
}
|
|
@@ -111761,25 +111786,25 @@ var ts;
|
|
|
111761
111786
|
if (!jsFileText)
|
|
111762
111787
|
return jsFilePath;
|
|
111763
111788
|
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
|
|
111764
|
-
if (ts.
|
|
111789
|
+
if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
|
|
111765
111790
|
return jsFilePath;
|
|
111766
111791
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
111767
111792
|
// error if no source map or for now if inline sourcemap
|
|
111768
111793
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
111769
111794
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
111770
|
-
if (sourceMapFilePath && ts.
|
|
111795
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
|
|
111771
111796
|
return sourceMapFilePath;
|
|
111772
111797
|
// read declaration text
|
|
111773
111798
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
111774
111799
|
if (declarationFilePath && !declarationText)
|
|
111775
111800
|
return declarationFilePath;
|
|
111776
|
-
if (declarationFilePath && ts.
|
|
111801
|
+
if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
|
|
111777
111802
|
return declarationFilePath;
|
|
111778
111803
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
111779
111804
|
// error if no source map or for now if inline sourcemap
|
|
111780
111805
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
111781
111806
|
return declarationMapPath || "inline sourcemap decoding";
|
|
111782
|
-
if (declarationMapPath && ts.
|
|
111807
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
111783
111808
|
return declarationMapPath;
|
|
111784
111809
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
111785
111810
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
|
|
@@ -111819,7 +111844,7 @@ var ts;
|
|
|
111819
111844
|
newBuildInfo.program = buildInfo.program;
|
|
111820
111845
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111821
111846
|
// Update the output signature
|
|
111822
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
111847
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111823
111848
|
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111824
111849
|
}
|
|
111825
111850
|
// Update sourceFileInfo
|
|
@@ -119625,7 +119650,7 @@ var ts;
|
|
|
119625
119650
|
}
|
|
119626
119651
|
}
|
|
119627
119652
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119628
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
119653
|
+
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 });
|
|
119629
119654
|
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
119630
119655
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
119631
119656
|
}
|
|
@@ -120704,8 +120729,8 @@ var ts;
|
|
|
120704
120729
|
(function (ts) {
|
|
120705
120730
|
function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
|
|
120706
120731
|
var outputFiles = [];
|
|
120707
|
-
var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics
|
|
120708
|
-
return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics
|
|
120732
|
+
var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
|
|
120733
|
+
return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
|
|
120709
120734
|
function writeFile(fileName, text, writeByteOrderMark) {
|
|
120710
120735
|
outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
|
|
120711
120736
|
}
|
|
@@ -120929,23 +120954,23 @@ var ts;
|
|
|
120929
120954
|
/**
|
|
120930
120955
|
* Gets the files affected by the path from the program
|
|
120931
120956
|
*/
|
|
120932
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
|
|
120957
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
120933
120958
|
var _a, _b;
|
|
120934
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
|
|
120959
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
|
|
120935
120960
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
120936
120961
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
120937
120962
|
return result;
|
|
120938
120963
|
}
|
|
120939
120964
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
120940
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
|
|
120965
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
120941
120966
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
120942
120967
|
if (!sourceFile) {
|
|
120943
120968
|
return ts.emptyArray;
|
|
120944
120969
|
}
|
|
120945
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
|
|
120970
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
120946
120971
|
return [sourceFile];
|
|
120947
120972
|
}
|
|
120948
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
|
|
120973
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
120949
120974
|
}
|
|
120950
120975
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
120951
120976
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -120956,7 +120981,7 @@ var ts;
|
|
|
120956
120981
|
/**
|
|
120957
120982
|
* Returns if the shape of the signature has changed since last emit
|
|
120958
120983
|
*/
|
|
120959
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
|
|
120984
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
|
|
120960
120985
|
var _a;
|
|
120961
120986
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
120962
120987
|
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
|
|
@@ -120966,18 +120991,16 @@ var ts;
|
|
|
120966
120991
|
var prevSignature = info.signature;
|
|
120967
120992
|
var latestSignature;
|
|
120968
120993
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
120969
|
-
|
|
120970
|
-
|
|
120971
|
-
|
|
120972
|
-
/*forceDtsEmit*/ true);
|
|
120973
|
-
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
120974
|
-
if (firstDts_1) {
|
|
120975
|
-
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; })); });
|
|
120976
|
-
latestSignature = computeSignature(firstDts_1.text, computeHash);
|
|
120994
|
+
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
120995
|
+
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
120996
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
|
|
120977
120997
|
if (latestSignature !== prevSignature) {
|
|
120978
|
-
updateExportedModules(state, sourceFile,
|
|
120998
|
+
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
120979
120999
|
}
|
|
120980
|
-
}
|
|
121000
|
+
}, cancellationToken,
|
|
121001
|
+
/*emitOnlyDtsFiles*/ true,
|
|
121002
|
+
/*customTransformers*/ undefined,
|
|
121003
|
+
/*forceDtsEmit*/ true);
|
|
120981
121004
|
}
|
|
120982
121005
|
// Default is to use file version as signature
|
|
120983
121006
|
if (latestSignature === undefined) {
|
|
@@ -121000,10 +121023,6 @@ var ts;
|
|
|
121000
121023
|
return latestSignature !== prevSignature;
|
|
121001
121024
|
}
|
|
121002
121025
|
BuilderState.updateShapeSignature = updateShapeSignature;
|
|
121003
|
-
function computeSignature(text, computeHash) {
|
|
121004
|
-
return (computeHash || ts.generateDjb2Hash)(text);
|
|
121005
|
-
}
|
|
121006
|
-
BuilderState.computeSignature = computeSignature;
|
|
121007
121026
|
/**
|
|
121008
121027
|
* Coverts the declaration emit result into exported modules map
|
|
121009
121028
|
*/
|
|
@@ -121153,7 +121172,7 @@ var ts;
|
|
|
121153
121172
|
/**
|
|
121154
121173
|
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
|
|
121155
121174
|
*/
|
|
121156
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
|
|
121175
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121157
121176
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
121158
121177
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
121159
121178
|
}
|
|
@@ -121173,7 +121192,7 @@ var ts;
|
|
|
121173
121192
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121174
121193
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
121175
121194
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
121176
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
|
|
121195
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121177
121196
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
121178
121197
|
}
|
|
121179
121198
|
}
|
|
@@ -121367,7 +121386,7 @@ var ts;
|
|
|
121367
121386
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
121368
121387
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
121369
121388
|
*/
|
|
121370
|
-
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
121389
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121371
121390
|
var _a, _b;
|
|
121372
121391
|
while (true) {
|
|
121373
121392
|
var affectedFiles = state.affectedFiles;
|
|
@@ -121379,7 +121398,7 @@ var ts;
|
|
|
121379
121398
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
121380
121399
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
121381
121400
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
121382
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
121401
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121383
121402
|
return affectedFile;
|
|
121384
121403
|
}
|
|
121385
121404
|
affectedFilesIndex++;
|
|
@@ -121407,7 +121426,7 @@ var ts;
|
|
|
121407
121426
|
return program;
|
|
121408
121427
|
}
|
|
121409
121428
|
// Get next batch of affected files
|
|
121410
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
|
|
121429
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
|
|
121411
121430
|
state.currentChangedFilePath = nextKey.value;
|
|
121412
121431
|
state.affectedFilesIndex = 0;
|
|
121413
121432
|
if (!state.seenAffectedFiles)
|
|
@@ -121458,7 +121477,7 @@ var ts;
|
|
|
121458
121477
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
121459
121478
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
121460
121479
|
*/
|
|
121461
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
121480
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121462
121481
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
121463
121482
|
// If affected files is everything except default library, then nothing more to do
|
|
121464
121483
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
@@ -121466,18 +121485,18 @@ var ts;
|
|
|
121466
121485
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
121467
121486
|
// That means when affected file is handled, its signature can be out of date
|
|
121468
121487
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
121469
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
|
|
121488
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121470
121489
|
return;
|
|
121471
121490
|
}
|
|
121472
121491
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
121473
121492
|
return;
|
|
121474
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
121493
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121475
121494
|
}
|
|
121476
121495
|
/**
|
|
121477
121496
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
121478
121497
|
* Also we need to make sure signature is updated for these files
|
|
121479
121498
|
*/
|
|
121480
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
121499
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121481
121500
|
removeSemanticDiagnosticsOf(state, path);
|
|
121482
121501
|
if (!state.changedFilesSet.has(path)) {
|
|
121483
121502
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -121488,7 +121507,7 @@ var ts;
|
|
|
121488
121507
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
121489
121508
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
121490
121509
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
121491
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
|
|
121510
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
|
|
121492
121511
|
// If not dts emit, nothing more to do
|
|
121493
121512
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
121494
121513
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -121513,20 +121532,20 @@ var ts;
|
|
|
121513
121532
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
121514
121533
|
return newSignature !== oldSignature;
|
|
121515
121534
|
}
|
|
121516
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
121535
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121517
121536
|
var _a;
|
|
121518
121537
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
121519
121538
|
return false;
|
|
121520
121539
|
// Every file needs to be handled
|
|
121521
121540
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
121522
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
121541
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
|
|
121523
121542
|
removeDiagnosticsOfLibraryFiles(state);
|
|
121524
121543
|
return true;
|
|
121525
121544
|
}
|
|
121526
121545
|
/**
|
|
121527
121546
|
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
121528
121547
|
*/
|
|
121529
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
121548
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121530
121549
|
var _a;
|
|
121531
121550
|
// If there was change in signature (dts output) for the changed file,
|
|
121532
121551
|
// then only we need to handle pending file emit
|
|
@@ -121544,9 +121563,9 @@ var ts;
|
|
|
121544
121563
|
var currentPath = queue.pop();
|
|
121545
121564
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121546
121565
|
seenFileNamesMap.set(currentPath, true);
|
|
121547
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
121566
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121548
121567
|
return;
|
|
121549
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
121568
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121550
121569
|
if (isChangedSignature(state, currentPath)) {
|
|
121551
121570
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
121552
121571
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -121558,11 +121577,11 @@ var ts;
|
|
|
121558
121577
|
// Go through exported modules from cache first
|
|
121559
121578
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121560
121579
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121561
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
121580
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121562
121581
|
return true;
|
|
121563
121582
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
121564
121583
|
return references && ts.forEachKey(references, function (filePath) {
|
|
121565
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
121584
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121566
121585
|
});
|
|
121567
121586
|
});
|
|
121568
121587
|
}
|
|
@@ -121570,22 +121589,22 @@ var ts;
|
|
|
121570
121589
|
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
121571
121590
|
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
121572
121591
|
*/
|
|
121573
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
121592
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121574
121593
|
var _a, _b;
|
|
121575
121594
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
121576
121595
|
return undefined;
|
|
121577
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
121596
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121578
121597
|
return true;
|
|
121579
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
121598
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121580
121599
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121581
121600
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121582
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
121601
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121583
121602
|
});
|
|
121584
121603
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
121585
121604
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
121586
121605
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
121587
121606
|
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
121588
|
-
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
121607
|
+
state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121589
121608
|
});
|
|
121590
121609
|
return undefined;
|
|
121591
121610
|
}
|
|
@@ -121904,8 +121923,39 @@ var ts;
|
|
|
121904
121923
|
return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
|
|
121905
121924
|
}
|
|
121906
121925
|
ts.getBuilderCreationParameters = getBuilderCreationParameters;
|
|
121907
|
-
function
|
|
121908
|
-
return
|
|
121926
|
+
function getTextHandlingSourceMapForSignature(text, data) {
|
|
121927
|
+
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
121928
|
+
}
|
|
121929
|
+
function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
|
|
121930
|
+
var _a;
|
|
121931
|
+
text = getTextHandlingSourceMapForSignature(text, data);
|
|
121932
|
+
var sourceFileDirectory;
|
|
121933
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
121934
|
+
text += data.diagnostics.map(function (diagnostic) {
|
|
121935
|
+
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
121936
|
+
}).join("\n");
|
|
121937
|
+
}
|
|
121938
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
|
|
121939
|
+
function flattenDiagnosticMessageText(diagnostic) {
|
|
121940
|
+
return ts.isString(diagnostic) ?
|
|
121941
|
+
diagnostic :
|
|
121942
|
+
diagnostic === undefined ?
|
|
121943
|
+
"" :
|
|
121944
|
+
!diagnostic.next ?
|
|
121945
|
+
diagnostic.messageText :
|
|
121946
|
+
diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText).join("\n");
|
|
121947
|
+
}
|
|
121948
|
+
function locationInfo(diagnostic) {
|
|
121949
|
+
if (diagnostic.file.resolvedPath === sourceFile.resolvedPath)
|
|
121950
|
+
return "(" + diagnostic.start + "," + diagnostic.length + ")";
|
|
121951
|
+
if (sourceFileDirectory === undefined)
|
|
121952
|
+
sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
|
|
121953
|
+
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)) + "(" + diagnostic.start + "," + diagnostic.length + ")";
|
|
121954
|
+
}
|
|
121955
|
+
}
|
|
121956
|
+
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
121957
|
+
function computeSignature(text, computeHash, data) {
|
|
121958
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
121909
121959
|
}
|
|
121910
121960
|
ts.computeSignature = computeSignature;
|
|
121911
121961
|
function createBuilderProgram(kind, _a) {
|
|
@@ -121966,7 +122016,7 @@ var ts;
|
|
|
121966
122016
|
* in that order would be used to write the files
|
|
121967
122017
|
*/
|
|
121968
122018
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
121969
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
122019
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121970
122020
|
var emitKind = 1 /* Full */;
|
|
121971
122021
|
var isPendingEmitFile = false;
|
|
121972
122022
|
if (!affected) {
|
|
@@ -122003,32 +122053,35 @@ var ts;
|
|
|
122003
122053
|
}
|
|
122004
122054
|
function getWriteFileCallback(writeFile, customTransformers) {
|
|
122005
122055
|
return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
122006
|
-
var _a, _b, _c;
|
|
122056
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
122007
122057
|
if (ts.isDeclarationFileName(fileName)) {
|
|
122008
122058
|
if (!ts.outFile(state.compilerOptions)) {
|
|
122009
122059
|
ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
|
|
122010
|
-
var
|
|
122060
|
+
var emitSignature = void 0;
|
|
122011
122061
|
if (!customTransformers) {
|
|
122012
122062
|
var file = sourceFiles[0];
|
|
122013
122063
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
122014
122064
|
if (info.signature === file.version) {
|
|
122015
|
-
|
|
122016
|
-
|
|
122065
|
+
var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
|
|
122066
|
+
// 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
|
|
122067
|
+
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
122068
|
+
emitSignature = signature;
|
|
122069
|
+
if (signature !== file.version) { // Update it
|
|
122017
122070
|
if (host.storeFilesChangingSignatureDuringEmit)
|
|
122018
|
-
(state.filesChangingSignature
|
|
122071
|
+
((_b = state.filesChangingSignature) !== null && _b !== void 0 ? _b : (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
|
|
122019
122072
|
if (state.exportedModulesMap)
|
|
122020
122073
|
ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
|
|
122021
122074
|
if (state.affectedFiles) {
|
|
122022
122075
|
// Keep old signature so we know what to undo if cancellation happens
|
|
122023
|
-
var existing = (
|
|
122076
|
+
var existing = (_c = state.oldSignatures) === null || _c === void 0 ? void 0 : _c.get(file.resolvedPath);
|
|
122024
122077
|
if (existing === undefined)
|
|
122025
|
-
(state.oldSignatures
|
|
122026
|
-
info.signature =
|
|
122078
|
+
((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
|
|
122079
|
+
info.signature = signature;
|
|
122027
122080
|
}
|
|
122028
122081
|
else {
|
|
122029
122082
|
// These are directly commited
|
|
122030
|
-
info.signature =
|
|
122031
|
-
(
|
|
122083
|
+
info.signature = signature;
|
|
122084
|
+
(_e = state.oldExportedModulesMap) === null || _e === void 0 ? void 0 : _e.clear();
|
|
122032
122085
|
}
|
|
122033
122086
|
}
|
|
122034
122087
|
}
|
|
@@ -122038,16 +122091,16 @@ var ts;
|
|
|
122038
122091
|
// and would need their d.ts change time in --build mode
|
|
122039
122092
|
if (state.compilerOptions.composite) {
|
|
122040
122093
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122041
|
-
var oldSignature = (
|
|
122042
|
-
|
|
122043
|
-
if (
|
|
122044
|
-
(state.emitSignatures
|
|
122094
|
+
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122095
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122096
|
+
if (emitSignature !== oldSignature) {
|
|
122097
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
122045
122098
|
state.hasChangedEmitSignature = true;
|
|
122046
122099
|
}
|
|
122047
122100
|
}
|
|
122048
122101
|
}
|
|
122049
122102
|
else if (state.compilerOptions.composite) {
|
|
122050
|
-
var newSignature = computeSignature(text,
|
|
122103
|
+
var newSignature = computeSignature(text, computeHash, data);
|
|
122051
122104
|
if (newSignature !== state.outSignature) {
|
|
122052
122105
|
state.outSignature = newSignature;
|
|
122053
122106
|
state.hasChangedEmitSignature = true;
|
|
@@ -122127,7 +122180,7 @@ var ts;
|
|
|
122127
122180
|
*/
|
|
122128
122181
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
122129
122182
|
while (true) {
|
|
122130
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
122183
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122131
122184
|
if (!affected) {
|
|
122132
122185
|
// Done
|
|
122133
122186
|
return undefined;
|
|
@@ -128992,12 +129045,18 @@ var ts;
|
|
|
128992
129045
|
// flag causes us to return the first node whose end position matches the position and which produces and acceptable token
|
|
128993
129046
|
// kind. Meanwhile, if includePrecedingTokenAtEndPosition is unset, we look for the first node whose start is <= the
|
|
128994
129047
|
// position and whose end is greater than the position.
|
|
129048
|
+
// There are more sophisticated end tests later, but this one is very fast
|
|
129049
|
+
// and allows us to skip a bunch of work
|
|
129050
|
+
var end = children[middle].getEnd();
|
|
129051
|
+
if (end < position) {
|
|
129052
|
+
return -1 /* LessThan */;
|
|
129053
|
+
}
|
|
128995
129054
|
var start = allowPositionInLeadingTrivia ? children[middle].getFullStart() : children[middle].getStart(sourceFile, /*includeJsDoc*/ true);
|
|
128996
129055
|
if (start > position) {
|
|
128997
129056
|
return 1 /* GreaterThan */;
|
|
128998
129057
|
}
|
|
128999
129058
|
// first element whose start position is before the input and whose end position is after or equal to the input
|
|
129000
|
-
if (nodeContainsPosition(children[middle])) {
|
|
129059
|
+
if (nodeContainsPosition(children[middle], start, end)) {
|
|
129001
129060
|
if (children[middle - 1]) {
|
|
129002
129061
|
// we want the _first_ element that contains the position, so left-recur if the prior node also contains the position
|
|
129003
129062
|
if (nodeContainsPosition(children[middle - 1])) {
|
|
@@ -129029,13 +129088,16 @@ var ts;
|
|
|
129029
129088
|
case "continue-outer": continue outer;
|
|
129030
129089
|
}
|
|
129031
129090
|
}
|
|
129032
|
-
function nodeContainsPosition(node) {
|
|
129033
|
-
|
|
129091
|
+
function nodeContainsPosition(node, start, end) {
|
|
129092
|
+
end !== null && end !== void 0 ? end : (end = node.getEnd());
|
|
129093
|
+
if (end < position) {
|
|
129094
|
+
return false;
|
|
129095
|
+
}
|
|
129096
|
+
start !== null && start !== void 0 ? start : (start = allowPositionInLeadingTrivia ? node.getFullStart() : node.getStart(sourceFile, /*includeJsDoc*/ true));
|
|
129034
129097
|
if (start > position) {
|
|
129035
129098
|
// If this child begins after position, then all subsequent children will as well.
|
|
129036
129099
|
return false;
|
|
129037
129100
|
}
|
|
129038
|
-
var end = node.getEnd();
|
|
129039
129101
|
if (position < end || (position === end && (node.kind === 1 /* EndOfFileToken */ || includeEndPosition))) {
|
|
129040
129102
|
return true;
|
|
129041
129103
|
}
|
|
@@ -133932,37 +133994,36 @@ var ts;
|
|
|
133932
133994
|
}
|
|
133933
133995
|
}
|
|
133934
133996
|
var entries = ts.createSortedArray();
|
|
133935
|
-
|
|
133936
|
-
|
|
133937
|
-
|
|
133938
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133939
|
-
}
|
|
133940
|
-
else {
|
|
133941
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133942
|
-
return undefined;
|
|
133943
|
-
}
|
|
133944
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133945
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133997
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
133998
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133999
|
+
return undefined;
|
|
133946
134000
|
}
|
|
134001
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134002
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133947
134003
|
if (keywordFilters !== 0 /* None */) {
|
|
133948
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133949
134004
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133950
134005
|
var keywordEntry = _a[_i];
|
|
133951
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134006
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134007
|
+
uniqueNames.add(keywordEntry.name);
|
|
133952
134008
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133953
134009
|
}
|
|
133954
134010
|
}
|
|
133955
134011
|
}
|
|
133956
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133957
134012
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
133958
134013
|
var keywordEntry = _c[_b];
|
|
133959
|
-
if (!
|
|
134014
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134015
|
+
uniqueNames.add(keywordEntry.name);
|
|
133960
134016
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133961
134017
|
}
|
|
133962
134018
|
}
|
|
133963
134019
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
133964
134020
|
var literal = literals_1[_d];
|
|
133965
|
-
|
|
134021
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134022
|
+
uniqueNames.add(literalEntry.name);
|
|
134023
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134024
|
+
}
|
|
134025
|
+
if (!isChecked) {
|
|
134026
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133966
134027
|
}
|
|
133967
134028
|
return {
|
|
133968
134029
|
flags: completionData.flags,
|
|
@@ -133974,8 +134035,8 @@ var ts;
|
|
|
133974
134035
|
entries: entries,
|
|
133975
134036
|
};
|
|
133976
134037
|
}
|
|
133977
|
-
function
|
|
133978
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134038
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134039
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
133979
134040
|
}
|
|
133980
134041
|
function isMemberCompletionKind(kind) {
|
|
133981
134042
|
switch (kind) {
|
|
@@ -134933,7 +134994,7 @@ var ts;
|
|
|
134933
134994
|
}
|
|
134934
134995
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134935
134996
|
var typeChecker = program.getTypeChecker();
|
|
134936
|
-
var
|
|
134997
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134937
134998
|
var start = ts.timestamp();
|
|
134938
134999
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134939
135000
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -135349,15 +135410,7 @@ var ts;
|
|
|
135349
135410
|
isNewIdentifierLocation = true;
|
|
135350
135411
|
}
|
|
135351
135412
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
135352
|
-
if (
|
|
135353
|
-
// In javascript files, for union types, we don't just get the members that
|
|
135354
|
-
// the individual types have in common, we also include all the members that
|
|
135355
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
135356
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
135357
|
-
// of the individual types to a higher status since we know what they are.
|
|
135358
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135359
|
-
}
|
|
135360
|
-
else {
|
|
135413
|
+
if (inCheckedFile) {
|
|
135361
135414
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135362
135415
|
var symbol = _a[_i];
|
|
135363
135416
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135365,6 +135418,14 @@ var ts;
|
|
|
135365
135418
|
}
|
|
135366
135419
|
}
|
|
135367
135420
|
}
|
|
135421
|
+
else {
|
|
135422
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135423
|
+
// the individual types have in common, we also include all the members that
|
|
135424
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135425
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135426
|
+
// of the individual types to a higher status since we know what they are.
|
|
135427
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135428
|
+
}
|
|
135368
135429
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135369
135430
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135370
135431
|
if (promiseType) {
|
|
@@ -155727,7 +155788,7 @@ var ts;
|
|
|
155727
155788
|
if (!newConstraint)
|
|
155728
155789
|
return;
|
|
155729
155790
|
var newConstraintText = newConstraint[1];
|
|
155730
|
-
changes.insertText(related.file,
|
|
155791
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155731
155792
|
}
|
|
155732
155793
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155733
155794
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|