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
|
@@ -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.20220421";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -94890,7 +94890,7 @@ var ts;
|
|
|
94890
94890
|
}
|
|
94891
94891
|
resumeLexicalEnvironment();
|
|
94892
94892
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94893
|
-
var
|
|
94893
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94894
94894
|
var prologueStatementCount = 0;
|
|
94895
94895
|
var superStatementIndex = -1;
|
|
94896
94896
|
var statements = [];
|
|
@@ -94899,8 +94899,11 @@ var ts;
|
|
|
94899
94899
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94900
94900
|
// If there was a super call, visit existing statements up to and including it
|
|
94901
94901
|
if (superStatementIndex >= 0) {
|
|
94902
|
-
|
|
94903
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94902
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94903
|
+
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);
|
|
94904
|
+
}
|
|
94905
|
+
else if (prologueStatementCount >= 0) {
|
|
94906
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94904
94907
|
}
|
|
94905
94908
|
}
|
|
94906
94909
|
if (needsSyntheticConstructor) {
|
|
@@ -94936,22 +94939,20 @@ var ts;
|
|
|
94936
94939
|
}
|
|
94937
94940
|
}
|
|
94938
94941
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94939
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94942
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94940
94943
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94941
94944
|
if (superStatementIndex >= 0) {
|
|
94942
94945
|
ts.addRange(statements, parameterProperties);
|
|
94943
94946
|
}
|
|
94944
|
-
// If a synthetic super() call was added, add them just after it
|
|
94945
|
-
else if (needsSyntheticConstructor) {
|
|
94946
|
-
statements = __spreadArray(__spreadArray([
|
|
94947
|
-
statements[0]
|
|
94948
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94949
|
-
}
|
|
94950
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94951
94947
|
else {
|
|
94952
|
-
|
|
94948
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94949
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94950
|
+
// If a synthetic super() call was added, need to account for that
|
|
94951
|
+
if (needsSyntheticConstructor)
|
|
94952
|
+
superAndPrologueStatementCount++;
|
|
94953
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94953
94954
|
}
|
|
94954
|
-
|
|
94955
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94955
94956
|
}
|
|
94956
94957
|
}
|
|
94957
94958
|
}
|
|
@@ -94961,7 +94962,7 @@ var ts;
|
|
|
94961
94962
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94962
94963
|
// Add existing statements after the initial prologues and super call
|
|
94963
94964
|
if (constructor) {
|
|
94964
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94965
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94965
94966
|
}
|
|
94966
94967
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94967
94968
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -119978,6 +119979,18 @@ var ts;
|
|
|
119978
119979
|
}
|
|
119979
119980
|
return undefined;
|
|
119980
119981
|
}
|
|
119982
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
119983
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
119984
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119985
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119986
|
+
var options_2 = program_1.getCompilerOptions();
|
|
119987
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119988
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119989
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119990
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119991
|
+
});
|
|
119992
|
+
}
|
|
119993
|
+
}
|
|
119981
119994
|
/**
|
|
119982
119995
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119983
119996
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119987,28 +120000,17 @@ var ts;
|
|
|
119987
120000
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119988
120001
|
// If affected files is everything except default library, then nothing more to do
|
|
119989
120002
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119990
|
-
|
|
119991
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119992
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119993
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119994
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119995
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119996
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119997
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119998
|
-
});
|
|
119999
|
-
}
|
|
120003
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
120000
120004
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
120001
120005
|
// That means when affected file is handled, its signature can be out of date
|
|
120002
120006
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
120003
120007
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
120004
120008
|
return;
|
|
120005
120009
|
}
|
|
120006
|
-
|
|
120007
|
-
|
|
120008
|
-
|
|
120009
|
-
|
|
120010
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
120011
|
-
}
|
|
120010
|
+
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);
|
|
120011
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
120012
|
+
return;
|
|
120013
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
120012
120014
|
}
|
|
120013
120015
|
/**
|
|
120014
120016
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -120050,16 +120052,41 @@ var ts;
|
|
|
120050
120052
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
120051
120053
|
return newSignature !== oldSignature;
|
|
120052
120054
|
}
|
|
120055
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
120056
|
+
// Go through exported modules from cache first
|
|
120057
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
120058
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
120059
|
+
if (result)
|
|
120060
|
+
return result;
|
|
120061
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
120062
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
120063
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
120064
|
+
var _a;
|
|
120065
|
+
// If the cache had an updated value, skip
|
|
120066
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
120067
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
120068
|
+
fn(exportedFromPath) :
|
|
120069
|
+
undefined;
|
|
120070
|
+
});
|
|
120071
|
+
}
|
|
120072
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
120073
|
+
var _a;
|
|
120074
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
120075
|
+
return false;
|
|
120076
|
+
// Every file needs to be handled
|
|
120077
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
120078
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
120079
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
120080
|
+
return true;
|
|
120081
|
+
}
|
|
120053
120082
|
/**
|
|
120054
|
-
* Iterate on referencing modules that export entities from affected file
|
|
120083
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
120055
120084
|
*/
|
|
120056
|
-
function
|
|
120057
|
-
var _a, _b;
|
|
120085
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
120058
120086
|
// If there was change in signature (dts output) for the changed file,
|
|
120059
120087
|
// then only we need to handle pending file emit
|
|
120060
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
120088
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
120061
120089
|
return;
|
|
120062
|
-
}
|
|
120063
120090
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
120064
120091
|
return;
|
|
120065
120092
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -120072,7 +120099,9 @@ var ts;
|
|
|
120072
120099
|
var currentPath = queue.pop();
|
|
120073
120100
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
120074
120101
|
seenFileNamesMap.set(currentPath, true);
|
|
120075
|
-
|
|
120102
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
120103
|
+
return;
|
|
120104
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
120076
120105
|
if (isChangedSignature(state, currentPath)) {
|
|
120077
120106
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
120078
120107
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -120084,56 +120113,38 @@ var ts;
|
|
|
120084
120113
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
120085
120114
|
// Go through exported modules from cache first
|
|
120086
120115
|
// If exported modules has path, all files referencing file exported from are affected
|
|
120087
|
-
(
|
|
120088
|
-
|
|
120089
|
-
|
|
120090
|
-
|
|
120091
|
-
|
|
120092
|
-
|
|
120093
|
-
|
|
120094
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
120095
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
120096
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
120116
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
120117
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
120118
|
+
return true;
|
|
120119
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
120120
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
120121
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
120122
|
+
});
|
|
120097
120123
|
});
|
|
120098
120124
|
}
|
|
120099
120125
|
/**
|
|
120100
|
-
*
|
|
120126
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
120127
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
120101
120128
|
*/
|
|
120102
|
-
function
|
|
120129
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
120103
120130
|
var _a;
|
|
120104
|
-
|
|
120105
|
-
return
|
|
120106
|
-
|
|
120107
|
-
|
|
120108
|
-
|
|
120109
|
-
* fn on file and iterate on anything that exports this file
|
|
120110
|
-
*/
|
|
120111
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
120112
|
-
var _a, _b, _c;
|
|
120113
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
120114
|
-
return;
|
|
120115
|
-
}
|
|
120116
|
-
fn(state, filePath);
|
|
120131
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
120132
|
+
return undefined;
|
|
120133
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
120134
|
+
return true;
|
|
120135
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
120117
120136
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
120118
|
-
// Go through exported modules from cache first
|
|
120119
120137
|
// If exported modules has path, all files referencing file exported from are affected
|
|
120120
|
-
(
|
|
120121
|
-
return
|
|
120122
|
-
});
|
|
120123
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
120124
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
120125
|
-
var _a;
|
|
120126
|
-
// If the cache had an updated value, skip
|
|
120127
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
120128
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
120129
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
120138
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
120139
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
120130
120140
|
});
|
|
120131
120141
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
120132
|
-
(
|
|
120142
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
120133
120143
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
120134
|
-
|
|
120135
|
-
|
|
120136
|
-
);
|
|
120144
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
120145
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
120146
|
+
});
|
|
120147
|
+
return undefined;
|
|
120137
120148
|
}
|
|
120138
120149
|
/**
|
|
120139
120150
|
* This is called after completing operation on the next affected file.
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220421";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -94685,7 +94685,7 @@ var ts;
|
|
|
94685
94685
|
}
|
|
94686
94686
|
resumeLexicalEnvironment();
|
|
94687
94687
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94688
|
-
var
|
|
94688
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94689
94689
|
var prologueStatementCount = 0;
|
|
94690
94690
|
var superStatementIndex = -1;
|
|
94691
94691
|
var statements = [];
|
|
@@ -94694,8 +94694,11 @@ var ts;
|
|
|
94694
94694
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94695
94695
|
// If there was a super call, visit existing statements up to and including it
|
|
94696
94696
|
if (superStatementIndex >= 0) {
|
|
94697
|
-
|
|
94698
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94697
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94698
|
+
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);
|
|
94699
|
+
}
|
|
94700
|
+
else if (prologueStatementCount >= 0) {
|
|
94701
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94699
94702
|
}
|
|
94700
94703
|
}
|
|
94701
94704
|
if (needsSyntheticConstructor) {
|
|
@@ -94731,22 +94734,20 @@ var ts;
|
|
|
94731
94734
|
}
|
|
94732
94735
|
}
|
|
94733
94736
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94734
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94737
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94735
94738
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94736
94739
|
if (superStatementIndex >= 0) {
|
|
94737
94740
|
ts.addRange(statements, parameterProperties);
|
|
94738
94741
|
}
|
|
94739
|
-
// If a synthetic super() call was added, add them just after it
|
|
94740
|
-
else if (needsSyntheticConstructor) {
|
|
94741
|
-
statements = __spreadArray(__spreadArray([
|
|
94742
|
-
statements[0]
|
|
94743
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94744
|
-
}
|
|
94745
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94746
94742
|
else {
|
|
94747
|
-
|
|
94743
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94744
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94745
|
+
// If a synthetic super() call was added, need to account for that
|
|
94746
|
+
if (needsSyntheticConstructor)
|
|
94747
|
+
superAndPrologueStatementCount++;
|
|
94748
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94748
94749
|
}
|
|
94749
|
-
|
|
94750
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94750
94751
|
}
|
|
94751
94752
|
}
|
|
94752
94753
|
}
|
|
@@ -94756,7 +94757,7 @@ var ts;
|
|
|
94756
94757
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94757
94758
|
// Add existing statements after the initial prologues and super call
|
|
94758
94759
|
if (constructor) {
|
|
94759
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94760
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94760
94761
|
}
|
|
94761
94762
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94762
94763
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -119773,6 +119774,18 @@ var ts;
|
|
|
119773
119774
|
}
|
|
119774
119775
|
return undefined;
|
|
119775
119776
|
}
|
|
119777
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
119778
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
119779
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119780
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119781
|
+
var options_2 = program_1.getCompilerOptions();
|
|
119782
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119783
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119784
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119785
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119786
|
+
});
|
|
119787
|
+
}
|
|
119788
|
+
}
|
|
119776
119789
|
/**
|
|
119777
119790
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119778
119791
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119782,28 +119795,17 @@ var ts;
|
|
|
119782
119795
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119783
119796
|
// If affected files is everything except default library, then nothing more to do
|
|
119784
119797
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119785
|
-
|
|
119786
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119787
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119788
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119789
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119790
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119791
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119792
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119793
|
-
});
|
|
119794
|
-
}
|
|
119798
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119795
119799
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
119796
119800
|
// That means when affected file is handled, its signature can be out of date
|
|
119797
119801
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
119798
119802
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
119799
119803
|
return;
|
|
119800
119804
|
}
|
|
119801
|
-
|
|
119802
|
-
|
|
119803
|
-
|
|
119804
|
-
|
|
119805
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119806
|
-
}
|
|
119805
|
+
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);
|
|
119806
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
119807
|
+
return;
|
|
119808
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119807
119809
|
}
|
|
119808
119810
|
/**
|
|
119809
119811
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -119845,16 +119847,41 @@ var ts;
|
|
|
119845
119847
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
119846
119848
|
return newSignature !== oldSignature;
|
|
119847
119849
|
}
|
|
119850
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
119851
|
+
// Go through exported modules from cache first
|
|
119852
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
119853
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
119854
|
+
if (result)
|
|
119855
|
+
return result;
|
|
119856
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119857
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
119858
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
119859
|
+
var _a;
|
|
119860
|
+
// If the cache had an updated value, skip
|
|
119861
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119862
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
119863
|
+
fn(exportedFromPath) :
|
|
119864
|
+
undefined;
|
|
119865
|
+
});
|
|
119866
|
+
}
|
|
119867
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
119868
|
+
var _a;
|
|
119869
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
119870
|
+
return false;
|
|
119871
|
+
// Every file needs to be handled
|
|
119872
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
119873
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
119874
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119875
|
+
return true;
|
|
119876
|
+
}
|
|
119848
119877
|
/**
|
|
119849
|
-
* Iterate on referencing modules that export entities from affected file
|
|
119878
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
119850
119879
|
*/
|
|
119851
|
-
function
|
|
119852
|
-
var _a, _b;
|
|
119880
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119853
119881
|
// If there was change in signature (dts output) for the changed file,
|
|
119854
119882
|
// then only we need to handle pending file emit
|
|
119855
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119883
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119856
119884
|
return;
|
|
119857
|
-
}
|
|
119858
119885
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119859
119886
|
return;
|
|
119860
119887
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -119867,7 +119894,9 @@ var ts;
|
|
|
119867
119894
|
var currentPath = queue.pop();
|
|
119868
119895
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
119869
119896
|
seenFileNamesMap.set(currentPath, true);
|
|
119870
|
-
|
|
119897
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
119898
|
+
return;
|
|
119899
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
119871
119900
|
if (isChangedSignature(state, currentPath)) {
|
|
119872
119901
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
119873
119902
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -119879,56 +119908,38 @@ var ts;
|
|
|
119879
119908
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
119880
119909
|
// Go through exported modules from cache first
|
|
119881
119910
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119882
|
-
(
|
|
119883
|
-
|
|
119884
|
-
|
|
119885
|
-
|
|
119886
|
-
|
|
119887
|
-
|
|
119888
|
-
|
|
119889
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119890
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119891
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119911
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
119912
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
119913
|
+
return true;
|
|
119914
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
119915
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
119916
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119917
|
+
});
|
|
119892
119918
|
});
|
|
119893
119919
|
}
|
|
119894
119920
|
/**
|
|
119895
|
-
*
|
|
119921
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
119922
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
119896
119923
|
*/
|
|
119897
|
-
function
|
|
119924
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
119898
119925
|
var _a;
|
|
119899
|
-
|
|
119900
|
-
return
|
|
119901
|
-
|
|
119902
|
-
|
|
119903
|
-
|
|
119904
|
-
* fn on file and iterate on anything that exports this file
|
|
119905
|
-
*/
|
|
119906
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
119907
|
-
var _a, _b, _c;
|
|
119908
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
119909
|
-
return;
|
|
119910
|
-
}
|
|
119911
|
-
fn(state, filePath);
|
|
119926
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
119927
|
+
return undefined;
|
|
119928
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
119929
|
+
return true;
|
|
119930
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
119912
119931
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
119913
|
-
// Go through exported modules from cache first
|
|
119914
119932
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119915
|
-
(
|
|
119916
|
-
return
|
|
119917
|
-
});
|
|
119918
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119919
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
119920
|
-
var _a;
|
|
119921
|
-
// If the cache had an updated value, skip
|
|
119922
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119923
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119924
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119933
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
119934
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119925
119935
|
});
|
|
119926
119936
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
119927
|
-
(
|
|
119937
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
119928
119938
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
119929
|
-
|
|
119930
|
-
|
|
119931
|
-
);
|
|
119939
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
119940
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
119941
|
+
});
|
|
119942
|
+
return undefined;
|
|
119932
119943
|
}
|
|
119933
119944
|
/**
|
|
119934
119945
|
* This is called after completing operation on the next affected file.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.7.0-dev.
|
|
5
|
+
"version": "4.7.0-dev.20220421",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|