typescript 5.0.0-dev.20221205 → 5.0.0-dev.20221207
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 +592 -435
- package/lib/tsserver.js +153270 -150849
- package/lib/tsserverlibrary.d.ts +46 -24
- package/lib/tsserverlibrary.js +683 -493
- package/lib/typescript.d.ts +46 -21
- package/lib/typescript.js +662 -476
- package/lib/typingsInstaller.js +72 -77
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
|
|
|
50
50
|
|
|
51
51
|
// src/compiler/corePublic.ts
|
|
52
52
|
var versionMajorMinor = "5.0";
|
|
53
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
53
|
+
var version = `${versionMajorMinor}.0-dev.20221207`;
|
|
54
54
|
|
|
55
55
|
// src/compiler/core.ts
|
|
56
56
|
var emptyArray = [];
|
|
@@ -1310,22 +1310,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1310
1310
|
function enableDebugInfo() {
|
|
1311
1311
|
if (isDebugInfoEnabled)
|
|
1312
1312
|
return;
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
function getWeakTypeTextMap() {
|
|
1316
|
-
if (weakTypeTextMap === void 0) {
|
|
1317
|
-
if (typeof WeakMap === "function")
|
|
1318
|
-
weakTypeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1319
|
-
}
|
|
1320
|
-
return weakTypeTextMap;
|
|
1321
|
-
}
|
|
1322
|
-
function getWeakNodeTextMap() {
|
|
1323
|
-
if (weakNodeTextMap === void 0) {
|
|
1324
|
-
if (typeof WeakMap === "function")
|
|
1325
|
-
weakNodeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1326
|
-
}
|
|
1327
|
-
return weakNodeTextMap;
|
|
1328
|
-
}
|
|
1313
|
+
const weakTypeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1314
|
+
const weakNodeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1329
1315
|
Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, {
|
|
1330
1316
|
__tsDebuggerDisplay: {
|
|
1331
1317
|
value() {
|
|
@@ -1354,11 +1340,10 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1354
1340
|
} },
|
|
1355
1341
|
__debugTypeToString: {
|
|
1356
1342
|
value() {
|
|
1357
|
-
|
|
1358
|
-
let text = map2 == null ? void 0 : map2.get(this);
|
|
1343
|
+
let text = weakTypeTextMap.get(this);
|
|
1359
1344
|
if (text === void 0) {
|
|
1360
1345
|
text = this.checker.typeToString(this);
|
|
1361
|
-
|
|
1346
|
+
weakTypeTextMap.set(this, text);
|
|
1362
1347
|
}
|
|
1363
1348
|
return text;
|
|
1364
1349
|
}
|
|
@@ -1410,13 +1395,12 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1410
1395
|
value(includeTrivia) {
|
|
1411
1396
|
if (nodeIsSynthesized(this))
|
|
1412
1397
|
return "";
|
|
1413
|
-
|
|
1414
|
-
let text = map2 == null ? void 0 : map2.get(this);
|
|
1398
|
+
let text = weakNodeTextMap.get(this);
|
|
1415
1399
|
if (text === void 0) {
|
|
1416
1400
|
const parseNode = getParseTreeNode(this);
|
|
1417
1401
|
const sourceFile = parseNode && getSourceFileOfNode(parseNode);
|
|
1418
1402
|
text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
|
|
1419
|
-
|
|
1403
|
+
weakNodeTextMap.set(this, text);
|
|
1420
1404
|
}
|
|
1421
1405
|
return text;
|
|
1422
1406
|
}
|
|
@@ -25757,17 +25741,29 @@ function formatExtensions(extensions) {
|
|
|
25757
25741
|
}
|
|
25758
25742
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
25759
25743
|
if (resultFromCache) {
|
|
25760
|
-
resultFromCache.failedLookupLocations.
|
|
25761
|
-
resultFromCache.affectingLocations.
|
|
25744
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
25745
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
25746
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
25762
25747
|
return resultFromCache;
|
|
25763
25748
|
}
|
|
25764
25749
|
return {
|
|
25765
25750
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? void 0 : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport, packageId: resolved.packageId },
|
|
25766
|
-
failedLookupLocations,
|
|
25767
|
-
affectingLocations,
|
|
25768
|
-
resolutionDiagnostics: diagnostics
|
|
25751
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
25752
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
25753
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
25769
25754
|
};
|
|
25770
25755
|
}
|
|
25756
|
+
function initializeResolutionField(value) {
|
|
25757
|
+
return value.length ? value : void 0;
|
|
25758
|
+
}
|
|
25759
|
+
function updateResolutionField(to, value) {
|
|
25760
|
+
if (!(value == null ? void 0 : value.length))
|
|
25761
|
+
return to;
|
|
25762
|
+
if (!(to == null ? void 0 : to.length))
|
|
25763
|
+
return value;
|
|
25764
|
+
to.push(...value);
|
|
25765
|
+
return to;
|
|
25766
|
+
}
|
|
25771
25767
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
25772
25768
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
25773
25769
|
if (state.traceEnabled) {
|
|
@@ -25879,8 +25875,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
25879
25875
|
}
|
|
25880
25876
|
}
|
|
25881
25877
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
25882
|
-
|
|
25883
|
-
let result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
25878
|
+
let result = cache == null ? void 0 : cache.getFromDirectoryCache(moduleName, resolutionMode, containingDirectory, redirectedReference);
|
|
25884
25879
|
if (result) {
|
|
25885
25880
|
if (traceEnabled) {
|
|
25886
25881
|
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -25930,11 +25925,9 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
25930
25925
|
if (result && result.resolvedModule)
|
|
25931
25926
|
perfLogger.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
25932
25927
|
perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
25933
|
-
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
25937
|
-
}
|
|
25928
|
+
cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
25929
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
25930
|
+
cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
25938
25931
|
}
|
|
25939
25932
|
}
|
|
25940
25933
|
if (traceEnabled) {
|
|
@@ -26051,7 +26044,7 @@ function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state) {
|
|
|
26051
26044
|
function resolveJSModule(moduleName, initialDir, host) {
|
|
26052
26045
|
const { resolvedModule, failedLookupLocations } = tryResolveJSModuleWorker(moduleName, initialDir, host);
|
|
26053
26046
|
if (!resolvedModule) {
|
|
26054
|
-
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations.join(", ")}`);
|
|
26047
|
+
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations == null ? void 0 : failedLookupLocations.join(", ")}`);
|
|
26055
26048
|
}
|
|
26056
26049
|
return resolvedModule.resolvedFileName;
|
|
26057
26050
|
}
|
|
@@ -26817,7 +26810,7 @@ function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directo
|
|
|
26817
26810
|
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
|
|
26818
26811
|
}
|
|
26819
26812
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
26820
|
-
const
|
|
26813
|
+
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
26821
26814
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
26822
26815
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
26823
26816
|
if (priorityExtensions) {
|
|
@@ -26831,7 +26824,7 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
|
|
|
26831
26824
|
function lookup(extensions2) {
|
|
26832
26825
|
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
26833
26826
|
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
26834
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
26827
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
26835
26828
|
if (resolutionFromCache) {
|
|
26836
26829
|
return resolutionFromCache;
|
|
26837
26830
|
}
|
|
@@ -26964,8 +26957,8 @@ function mangleScopedPackageName(packageName) {
|
|
|
26964
26957
|
}
|
|
26965
26958
|
return packageName;
|
|
26966
26959
|
}
|
|
26967
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
26968
|
-
const result = cache && cache.
|
|
26960
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
26961
|
+
const result = cache && cache.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
26969
26962
|
if (result) {
|
|
26970
26963
|
if (state.traceEnabled) {
|
|
26971
26964
|
trace(state.host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -27008,9 +27001,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
27008
27001
|
return { value: resolvedUsingSettings };
|
|
27009
27002
|
}
|
|
27010
27003
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
27011
|
-
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, void 0, redirectedReference);
|
|
27012
27004
|
const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
|
|
27013
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
27005
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, void 0, directory, redirectedReference, state);
|
|
27014
27006
|
if (resolutionFromCache) {
|
|
27015
27007
|
return resolutionFromCache;
|
|
27016
27008
|
}
|
|
@@ -31680,7 +31672,7 @@ var BuilderState;
|
|
|
31680
31672
|
}
|
|
31681
31673
|
}
|
|
31682
31674
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
31683
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach((resolvedTypeReferenceDirective) => {
|
|
31675
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
31684
31676
|
if (!resolvedTypeReferenceDirective) {
|
|
31685
31677
|
return;
|
|
31686
31678
|
}
|
|
@@ -31802,6 +31794,26 @@ var BuilderState;
|
|
|
31802
31794
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path2);
|
|
31803
31795
|
}
|
|
31804
31796
|
BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
|
|
31797
|
+
function computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, onNewSignature) {
|
|
31798
|
+
programOfThisState.emit(
|
|
31799
|
+
sourceFile,
|
|
31800
|
+
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
31801
|
+
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
31802
|
+
onNewSignature(computeSignatureWithDiagnostics(
|
|
31803
|
+
programOfThisState,
|
|
31804
|
+
sourceFile,
|
|
31805
|
+
text,
|
|
31806
|
+
host,
|
|
31807
|
+
data
|
|
31808
|
+
), sourceFiles);
|
|
31809
|
+
},
|
|
31810
|
+
cancellationToken,
|
|
31811
|
+
true,
|
|
31812
|
+
void 0,
|
|
31813
|
+
true
|
|
31814
|
+
);
|
|
31815
|
+
}
|
|
31816
|
+
BuilderState2.computeDtsSignature = computeDtsSignature;
|
|
31805
31817
|
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
|
|
31806
31818
|
var _a2;
|
|
31807
31819
|
if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
|
|
@@ -31810,26 +31822,12 @@ var BuilderState;
|
|
|
31810
31822
|
const prevSignature = info.signature;
|
|
31811
31823
|
let latestSignature;
|
|
31812
31824
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
31813
|
-
programOfThisState
|
|
31814
|
-
|
|
31815
|
-
(
|
|
31816
|
-
|
|
31817
|
-
|
|
31818
|
-
|
|
31819
|
-
sourceFile,
|
|
31820
|
-
text,
|
|
31821
|
-
host,
|
|
31822
|
-
data
|
|
31823
|
-
);
|
|
31824
|
-
if (latestSignature !== prevSignature) {
|
|
31825
|
-
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
31826
|
-
}
|
|
31827
|
-
},
|
|
31828
|
-
cancellationToken,
|
|
31829
|
-
true,
|
|
31830
|
-
void 0,
|
|
31831
|
-
true
|
|
31832
|
-
);
|
|
31825
|
+
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature, sourceFiles) => {
|
|
31826
|
+
latestSignature = signature;
|
|
31827
|
+
if (latestSignature !== prevSignature) {
|
|
31828
|
+
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
31829
|
+
}
|
|
31830
|
+
});
|
|
31833
31831
|
}
|
|
31834
31832
|
if (latestSignature === void 0) {
|
|
31835
31833
|
latestSignature = sourceFile.version;
|
|
@@ -31853,27 +31851,24 @@ var BuilderState;
|
|
|
31853
31851
|
if (!state.exportedModulesMap)
|
|
31854
31852
|
return;
|
|
31855
31853
|
(state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
|
|
31856
|
-
|
|
31857
|
-
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
31858
|
-
return;
|
|
31859
|
-
}
|
|
31860
|
-
let exportedModules;
|
|
31861
|
-
exportedModulesFromDeclarationEmit.forEach((symbol) => addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)));
|
|
31854
|
+
const exportedModules = getExportedModules(exportedModulesFromDeclarationEmit);
|
|
31862
31855
|
if (exportedModules) {
|
|
31863
31856
|
state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
|
|
31864
31857
|
} else {
|
|
31865
31858
|
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
31866
31859
|
}
|
|
31867
|
-
function addExportedModule(exportedModulePaths) {
|
|
31868
|
-
if (exportedModulePaths == null ? void 0 : exportedModulePaths.length) {
|
|
31869
|
-
if (!exportedModules) {
|
|
31870
|
-
exportedModules = /* @__PURE__ */ new Set();
|
|
31871
|
-
}
|
|
31872
|
-
exportedModulePaths.forEach((path2) => exportedModules.add(path2));
|
|
31873
|
-
}
|
|
31874
|
-
}
|
|
31875
31860
|
}
|
|
31876
31861
|
BuilderState2.updateExportedModules = updateExportedModules;
|
|
31862
|
+
function getExportedModules(exportedModulesFromDeclarationEmit) {
|
|
31863
|
+
let exportedModules;
|
|
31864
|
+
exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach(
|
|
31865
|
+
(symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach(
|
|
31866
|
+
(path2) => (exportedModules != null ? exportedModules : exportedModules = /* @__PURE__ */ new Set()).add(path2)
|
|
31867
|
+
)
|
|
31868
|
+
);
|
|
31869
|
+
return exportedModules;
|
|
31870
|
+
}
|
|
31871
|
+
BuilderState2.getExportedModules = getExportedModules;
|
|
31877
31872
|
function getAllDependencies(state, programOfThisState, sourceFile) {
|
|
31878
31873
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
31879
31874
|
if (outFile(compilerOptions)) {
|
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": "5.0.0-dev.
|
|
5
|
+
"version": "5.0.0-dev.20221207",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|