typescript 4.7.0-dev.20220420 → 4.7.0-dev.20220421
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 +77 -63
- package/lib/tsserver.js +88 -77
- package/lib/tsserverlibrary.js +88 -77
- package/lib/typescript.js +88 -77
- package/lib/typescriptServices.js +88 -77
- package/lib/typingsInstaller.js +88 -77
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220421";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -79085,7 +79085,7 @@ var ts;
|
|
|
79085
79085
|
}
|
|
79086
79086
|
resumeLexicalEnvironment();
|
|
79087
79087
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
79088
|
-
var
|
|
79088
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
79089
79089
|
var prologueStatementCount = 0;
|
|
79090
79090
|
var superStatementIndex = -1;
|
|
79091
79091
|
var statements = [];
|
|
@@ -79093,8 +79093,11 @@ var ts;
|
|
|
79093
79093
|
prologueStatementCount = factory.copyPrologue(constructor.body.statements, statements, false, visitor);
|
|
79094
79094
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
79095
79095
|
if (superStatementIndex >= 0) {
|
|
79096
|
-
|
|
79097
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
79096
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
79097
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
79098
|
+
}
|
|
79099
|
+
else if (prologueStatementCount >= 0) {
|
|
79100
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
79098
79101
|
}
|
|
79099
79102
|
}
|
|
79100
79103
|
if (needsSyntheticConstructor) {
|
|
@@ -79113,19 +79116,17 @@ var ts;
|
|
|
79113
79116
|
}
|
|
79114
79117
|
}
|
|
79115
79118
|
if (parameterPropertyDeclarationCount > 0) {
|
|
79116
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
79119
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
79117
79120
|
if (superStatementIndex >= 0) {
|
|
79118
79121
|
ts.addRange(statements, parameterProperties);
|
|
79119
79122
|
}
|
|
79120
|
-
else if (needsSyntheticConstructor) {
|
|
79121
|
-
statements = __spreadArray(__spreadArray([
|
|
79122
|
-
statements[0]
|
|
79123
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
79124
|
-
}
|
|
79125
79123
|
else {
|
|
79126
|
-
|
|
79124
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
79125
|
+
if (needsSyntheticConstructor)
|
|
79126
|
+
superAndPrologueStatementCount++;
|
|
79127
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
79127
79128
|
}
|
|
79128
|
-
|
|
79129
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
79129
79130
|
}
|
|
79130
79131
|
}
|
|
79131
79132
|
}
|
|
@@ -79133,7 +79134,7 @@ var ts;
|
|
|
79133
79134
|
addMethodStatements(statements, privateMethodsAndAccessors, receiver);
|
|
79134
79135
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
79135
79136
|
if (constructor) {
|
|
79136
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
79137
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
79137
79138
|
}
|
|
79138
79139
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
79139
79140
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined);
|
|
@@ -98965,29 +98966,30 @@ var ts;
|
|
|
98965
98966
|
}
|
|
98966
98967
|
return undefined;
|
|
98967
98968
|
}
|
|
98969
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
98970
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
98971
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
98972
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
98973
|
+
var options_2 = program_1.getCompilerOptions();
|
|
98974
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
98975
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
98976
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
98977
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
98978
|
+
});
|
|
98979
|
+
}
|
|
98980
|
+
}
|
|
98968
98981
|
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
98969
98982
|
var _a;
|
|
98970
98983
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
98971
98984
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
98972
|
-
|
|
98973
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
98974
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
98975
|
-
var options_2 = program_1.getCompilerOptions();
|
|
98976
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
98977
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
98978
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
98979
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
98980
|
-
});
|
|
98981
|
-
}
|
|
98985
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
98982
98986
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
98983
98987
|
return;
|
|
98984
98988
|
}
|
|
98985
|
-
|
|
98986
|
-
|
|
98987
|
-
|
|
98988
|
-
|
|
98989
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
98990
|
-
}
|
|
98989
|
+
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
98990
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
98991
|
+
return;
|
|
98992
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
98991
98993
|
}
|
|
98992
98994
|
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
98993
98995
|
removeSemanticDiagnosticsOf(state, path);
|
|
@@ -99015,11 +99017,32 @@ var ts;
|
|
|
99015
99017
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
99016
99018
|
return newSignature !== oldSignature;
|
|
99017
99019
|
}
|
|
99018
|
-
function
|
|
99019
|
-
var
|
|
99020
|
-
|
|
99020
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
99021
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
99022
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
99023
|
+
if (result)
|
|
99024
|
+
return result;
|
|
99025
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
99026
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
99027
|
+
var _a;
|
|
99028
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
99029
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
99030
|
+
fn(exportedFromPath) :
|
|
99031
|
+
undefined;
|
|
99032
|
+
});
|
|
99033
|
+
}
|
|
99034
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
99035
|
+
var _a;
|
|
99036
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
99037
|
+
return false;
|
|
99038
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
|
|
99039
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
99040
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
99041
|
+
return true;
|
|
99042
|
+
}
|
|
99043
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
99044
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
99021
99045
|
return;
|
|
99022
|
-
}
|
|
99023
99046
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
99024
99047
|
return;
|
|
99025
99048
|
if (state.compilerOptions.isolatedModules) {
|
|
@@ -99030,7 +99053,9 @@ var ts;
|
|
|
99030
99053
|
var currentPath = queue.pop();
|
|
99031
99054
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
99032
99055
|
seenFileNamesMap.set(currentPath, true);
|
|
99033
|
-
|
|
99056
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
99057
|
+
return;
|
|
99058
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
99034
99059
|
if (isChangedSignature(state, currentPath)) {
|
|
99035
99060
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
99036
99061
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -99040,42 +99065,31 @@ var ts;
|
|
|
99040
99065
|
}
|
|
99041
99066
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
99042
99067
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
99043
|
-
(
|
|
99044
|
-
|
|
99045
|
-
|
|
99046
|
-
|
|
99047
|
-
|
|
99048
|
-
|
|
99049
|
-
|
|
99050
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
99068
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
99069
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
99070
|
+
return true;
|
|
99071
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
99072
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
99073
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
99074
|
+
});
|
|
99051
99075
|
});
|
|
99052
99076
|
}
|
|
99053
|
-
function
|
|
99077
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
99054
99078
|
var _a;
|
|
99055
|
-
|
|
99056
|
-
return
|
|
99057
|
-
|
|
99058
|
-
|
|
99059
|
-
|
|
99060
|
-
var _a, _b, _c;
|
|
99061
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
99062
|
-
return;
|
|
99063
|
-
}
|
|
99064
|
-
fn(state, filePath);
|
|
99079
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
99080
|
+
return undefined;
|
|
99081
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
99082
|
+
return true;
|
|
99083
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
99065
99084
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
99066
|
-
(
|
|
99067
|
-
return
|
|
99085
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
99086
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
99068
99087
|
});
|
|
99069
|
-
(
|
|
99070
|
-
var _a;
|
|
99071
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
99072
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
99073
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
99074
|
-
});
|
|
99075
|
-
(_c = state.referencedMap.getKeys(filePath)) === null || _c === void 0 ? void 0 : _c.forEach(function (referencingFilePath) {
|
|
99088
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
99076
99089
|
return !seenFileAndExportsOfFile.has(referencingFilePath) &&
|
|
99077
|
-
|
|
99090
|
+
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
|
|
99078
99091
|
});
|
|
99092
|
+
return undefined;
|
|
99079
99093
|
}
|
|
99080
99094
|
function doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit) {
|
|
99081
99095
|
if (isBuildInfoEmit) {
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220421";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -94696,7 +94696,7 @@ var ts;
|
|
|
94696
94696
|
}
|
|
94697
94697
|
resumeLexicalEnvironment();
|
|
94698
94698
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94699
|
-
var
|
|
94699
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94700
94700
|
var prologueStatementCount = 0;
|
|
94701
94701
|
var superStatementIndex = -1;
|
|
94702
94702
|
var statements = [];
|
|
@@ -94705,8 +94705,11 @@ var ts;
|
|
|
94705
94705
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94706
94706
|
// If there was a super call, visit existing statements up to and including it
|
|
94707
94707
|
if (superStatementIndex >= 0) {
|
|
94708
|
-
|
|
94709
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94708
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94709
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
94710
|
+
}
|
|
94711
|
+
else if (prologueStatementCount >= 0) {
|
|
94712
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94710
94713
|
}
|
|
94711
94714
|
}
|
|
94712
94715
|
if (needsSyntheticConstructor) {
|
|
@@ -94742,22 +94745,20 @@ var ts;
|
|
|
94742
94745
|
}
|
|
94743
94746
|
}
|
|
94744
94747
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94745
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94748
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94746
94749
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94747
94750
|
if (superStatementIndex >= 0) {
|
|
94748
94751
|
ts.addRange(statements, parameterProperties);
|
|
94749
94752
|
}
|
|
94750
|
-
// If a synthetic super() call was added, add them just after it
|
|
94751
|
-
else if (needsSyntheticConstructor) {
|
|
94752
|
-
statements = __spreadArray(__spreadArray([
|
|
94753
|
-
statements[0]
|
|
94754
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94755
|
-
}
|
|
94756
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94757
94753
|
else {
|
|
94758
|
-
|
|
94754
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94755
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94756
|
+
// If a synthetic super() call was added, need to account for that
|
|
94757
|
+
if (needsSyntheticConstructor)
|
|
94758
|
+
superAndPrologueStatementCount++;
|
|
94759
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94759
94760
|
}
|
|
94760
|
-
|
|
94761
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94761
94762
|
}
|
|
94762
94763
|
}
|
|
94763
94764
|
}
|
|
@@ -94767,7 +94768,7 @@ var ts;
|
|
|
94767
94768
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94768
94769
|
// Add existing statements after the initial prologues and super call
|
|
94769
94770
|
if (constructor) {
|
|
94770
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94771
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94771
94772
|
}
|
|
94772
94773
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94773
94774
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -119784,6 +119785,18 @@ var ts;
|
|
|
119784
119785
|
}
|
|
119785
119786
|
return undefined;
|
|
119786
119787
|
}
|
|
119788
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
119789
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
119790
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119791
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119792
|
+
var options_2 = program_1.getCompilerOptions();
|
|
119793
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119794
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119795
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119796
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119797
|
+
});
|
|
119798
|
+
}
|
|
119799
|
+
}
|
|
119787
119800
|
/**
|
|
119788
119801
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119789
119802
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119793,28 +119806,17 @@ var ts;
|
|
|
119793
119806
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119794
119807
|
// If affected files is everything except default library, then nothing more to do
|
|
119795
119808
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119796
|
-
|
|
119797
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119798
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119799
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119800
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119801
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119802
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119803
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119804
|
-
});
|
|
119805
|
-
}
|
|
119809
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119806
119810
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
119807
119811
|
// That means when affected file is handled, its signature can be out of date
|
|
119808
119812
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
119809
119813
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
119810
119814
|
return;
|
|
119811
119815
|
}
|
|
119812
|
-
|
|
119813
|
-
|
|
119814
|
-
|
|
119815
|
-
|
|
119816
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119817
|
-
}
|
|
119816
|
+
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
119817
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
119818
|
+
return;
|
|
119819
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119818
119820
|
}
|
|
119819
119821
|
/**
|
|
119820
119822
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -119856,16 +119858,41 @@ var ts;
|
|
|
119856
119858
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
119857
119859
|
return newSignature !== oldSignature;
|
|
119858
119860
|
}
|
|
119861
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
119862
|
+
// Go through exported modules from cache first
|
|
119863
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
119864
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
119865
|
+
if (result)
|
|
119866
|
+
return result;
|
|
119867
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119868
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
119869
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
119870
|
+
var _a;
|
|
119871
|
+
// If the cache had an updated value, skip
|
|
119872
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119873
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
119874
|
+
fn(exportedFromPath) :
|
|
119875
|
+
undefined;
|
|
119876
|
+
});
|
|
119877
|
+
}
|
|
119878
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
119879
|
+
var _a;
|
|
119880
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
119881
|
+
return false;
|
|
119882
|
+
// Every file needs to be handled
|
|
119883
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
119884
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
119885
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119886
|
+
return true;
|
|
119887
|
+
}
|
|
119859
119888
|
/**
|
|
119860
|
-
* Iterate on referencing modules that export entities from affected file
|
|
119889
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
119861
119890
|
*/
|
|
119862
|
-
function
|
|
119863
|
-
var _a, _b;
|
|
119891
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119864
119892
|
// If there was change in signature (dts output) for the changed file,
|
|
119865
119893
|
// then only we need to handle pending file emit
|
|
119866
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119894
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119867
119895
|
return;
|
|
119868
|
-
}
|
|
119869
119896
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119870
119897
|
return;
|
|
119871
119898
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -119878,7 +119905,9 @@ var ts;
|
|
|
119878
119905
|
var currentPath = queue.pop();
|
|
119879
119906
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
119880
119907
|
seenFileNamesMap.set(currentPath, true);
|
|
119881
|
-
|
|
119908
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
119909
|
+
return;
|
|
119910
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
119882
119911
|
if (isChangedSignature(state, currentPath)) {
|
|
119883
119912
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
119884
119913
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -119890,56 +119919,38 @@ var ts;
|
|
|
119890
119919
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
119891
119920
|
// Go through exported modules from cache first
|
|
119892
119921
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119893
|
-
(
|
|
119894
|
-
|
|
119895
|
-
|
|
119896
|
-
|
|
119897
|
-
|
|
119898
|
-
|
|
119899
|
-
|
|
119900
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119901
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119902
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119922
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
119923
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
119924
|
+
return true;
|
|
119925
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
119926
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
119927
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119928
|
+
});
|
|
119903
119929
|
});
|
|
119904
119930
|
}
|
|
119905
119931
|
/**
|
|
119906
|
-
*
|
|
119932
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
119933
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
119907
119934
|
*/
|
|
119908
|
-
function
|
|
119935
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
119909
119936
|
var _a;
|
|
119910
|
-
|
|
119911
|
-
return
|
|
119912
|
-
|
|
119913
|
-
|
|
119914
|
-
|
|
119915
|
-
* fn on file and iterate on anything that exports this file
|
|
119916
|
-
*/
|
|
119917
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
119918
|
-
var _a, _b, _c;
|
|
119919
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
119920
|
-
return;
|
|
119921
|
-
}
|
|
119922
|
-
fn(state, filePath);
|
|
119937
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
119938
|
+
return undefined;
|
|
119939
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
119940
|
+
return true;
|
|
119941
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
119923
119942
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
119924
|
-
// Go through exported modules from cache first
|
|
119925
119943
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119926
|
-
(
|
|
119927
|
-
return
|
|
119928
|
-
});
|
|
119929
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119930
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
119931
|
-
var _a;
|
|
119932
|
-
// If the cache had an updated value, skip
|
|
119933
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119934
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119935
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119944
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
119945
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119936
119946
|
});
|
|
119937
119947
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
119938
|
-
(
|
|
119948
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
119939
119949
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
119940
|
-
|
|
119941
|
-
|
|
119942
|
-
);
|
|
119950
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
119951
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
119952
|
+
});
|
|
119953
|
+
return undefined;
|
|
119943
119954
|
}
|
|
119944
119955
|
/**
|
|
119945
119956
|
* This is called after completing operation on the next affected file.
|