typescript 5.0.0-dev.20221206 → 5.0.0-dev.20221208
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 +213 -186
- package/lib/tsserver.js +153266 -150999
- package/lib/tsserverlibrary.d.ts +19 -6
- package/lib/tsserverlibrary.js +255 -219
- package/lib/typescript.d.ts +19 -6
- package/lib/typescript.js +255 -219
- package/lib/typingsInstaller.js +55 -74
- package/package.json +2 -2
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.20221208`;
|
|
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
|
}
|
|
@@ -25891,8 +25875,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
25891
25875
|
}
|
|
25892
25876
|
}
|
|
25893
25877
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
25894
|
-
|
|
25895
|
-
let result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
25878
|
+
let result = cache == null ? void 0 : cache.getFromDirectoryCache(moduleName, resolutionMode, containingDirectory, redirectedReference);
|
|
25896
25879
|
if (result) {
|
|
25897
25880
|
if (traceEnabled) {
|
|
25898
25881
|
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -25942,11 +25925,9 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
25942
25925
|
if (result && result.resolvedModule)
|
|
25943
25926
|
perfLogger.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
25944
25927
|
perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
|
|
25948
|
-
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
25949
|
-
}
|
|
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);
|
|
25950
25931
|
}
|
|
25951
25932
|
}
|
|
25952
25933
|
if (traceEnabled) {
|
|
@@ -26829,7 +26810,7 @@ function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directo
|
|
|
26829
26810
|
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
|
|
26830
26811
|
}
|
|
26831
26812
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
26832
|
-
const
|
|
26813
|
+
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
26833
26814
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
26834
26815
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
26835
26816
|
if (priorityExtensions) {
|
|
@@ -26843,7 +26824,7 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
|
|
|
26843
26824
|
function lookup(extensions2) {
|
|
26844
26825
|
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
26845
26826
|
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
26846
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
26827
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
26847
26828
|
if (resolutionFromCache) {
|
|
26848
26829
|
return resolutionFromCache;
|
|
26849
26830
|
}
|
|
@@ -26976,8 +26957,8 @@ function mangleScopedPackageName(packageName) {
|
|
|
26976
26957
|
}
|
|
26977
26958
|
return packageName;
|
|
26978
26959
|
}
|
|
26979
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
26980
|
-
const result = cache && cache.
|
|
26960
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
26961
|
+
const result = cache && cache.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
26981
26962
|
if (result) {
|
|
26982
26963
|
if (state.traceEnabled) {
|
|
26983
26964
|
trace(state.host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -27020,9 +27001,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
27020
27001
|
return { value: resolvedUsingSettings };
|
|
27021
27002
|
}
|
|
27022
27003
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
27023
|
-
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, void 0, redirectedReference);
|
|
27024
27004
|
const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
|
|
27025
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
27005
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, void 0, directory, redirectedReference, state);
|
|
27026
27006
|
if (resolutionFromCache) {
|
|
27027
27007
|
return resolutionFromCache;
|
|
27028
27008
|
}
|
|
@@ -31745,14 +31725,13 @@ var BuilderState;
|
|
|
31745
31725
|
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
31746
31726
|
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
31747
31727
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
31748
|
-
const getCanonicalFileName = createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
31749
31728
|
newProgram.getTypeChecker();
|
|
31750
31729
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
31751
31730
|
const version2 = Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
|
|
31752
31731
|
const oldUncommittedSignature = useOldState ? (_a2 = oldState.oldSignatures) == null ? void 0 : _a2.get(sourceFile.resolvedPath) : void 0;
|
|
31753
31732
|
const signature = oldUncommittedSignature === void 0 ? useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) == null ? void 0 : _b.signature : void 0 : oldUncommittedSignature || void 0;
|
|
31754
31733
|
if (referencedMap) {
|
|
31755
|
-
const newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
|
|
31734
|
+
const newReferences = getReferencedFiles(newProgram, sourceFile, newProgram.getCanonicalFileName);
|
|
31756
31735
|
if (newReferences) {
|
|
31757
31736
|
referencedMap.set(sourceFile.resolvedPath, newReferences);
|
|
31758
31737
|
}
|
|
@@ -31814,6 +31793,26 @@ var BuilderState;
|
|
|
31814
31793
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path2);
|
|
31815
31794
|
}
|
|
31816
31795
|
BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
|
|
31796
|
+
function computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, onNewSignature) {
|
|
31797
|
+
programOfThisState.emit(
|
|
31798
|
+
sourceFile,
|
|
31799
|
+
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
31800
|
+
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
31801
|
+
onNewSignature(computeSignatureWithDiagnostics(
|
|
31802
|
+
programOfThisState,
|
|
31803
|
+
sourceFile,
|
|
31804
|
+
text,
|
|
31805
|
+
host,
|
|
31806
|
+
data
|
|
31807
|
+
), sourceFiles);
|
|
31808
|
+
},
|
|
31809
|
+
cancellationToken,
|
|
31810
|
+
true,
|
|
31811
|
+
void 0,
|
|
31812
|
+
true
|
|
31813
|
+
);
|
|
31814
|
+
}
|
|
31815
|
+
BuilderState2.computeDtsSignature = computeDtsSignature;
|
|
31817
31816
|
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
|
|
31818
31817
|
var _a2;
|
|
31819
31818
|
if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
|
|
@@ -31822,26 +31821,12 @@ var BuilderState;
|
|
|
31822
31821
|
const prevSignature = info.signature;
|
|
31823
31822
|
let latestSignature;
|
|
31824
31823
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
31825
|
-
programOfThisState
|
|
31826
|
-
|
|
31827
|
-
(
|
|
31828
|
-
|
|
31829
|
-
|
|
31830
|
-
|
|
31831
|
-
sourceFile,
|
|
31832
|
-
text,
|
|
31833
|
-
host,
|
|
31834
|
-
data
|
|
31835
|
-
);
|
|
31836
|
-
if (latestSignature !== prevSignature) {
|
|
31837
|
-
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
31838
|
-
}
|
|
31839
|
-
},
|
|
31840
|
-
cancellationToken,
|
|
31841
|
-
true,
|
|
31842
|
-
void 0,
|
|
31843
|
-
true
|
|
31844
|
-
);
|
|
31824
|
+
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature, sourceFiles) => {
|
|
31825
|
+
latestSignature = signature;
|
|
31826
|
+
if (latestSignature !== prevSignature) {
|
|
31827
|
+
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
31828
|
+
}
|
|
31829
|
+
});
|
|
31845
31830
|
}
|
|
31846
31831
|
if (latestSignature === void 0) {
|
|
31847
31832
|
latestSignature = sourceFile.version;
|
|
@@ -31865,27 +31850,24 @@ var BuilderState;
|
|
|
31865
31850
|
if (!state.exportedModulesMap)
|
|
31866
31851
|
return;
|
|
31867
31852
|
(state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
|
|
31868
|
-
|
|
31869
|
-
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
31870
|
-
return;
|
|
31871
|
-
}
|
|
31872
|
-
let exportedModules;
|
|
31873
|
-
exportedModulesFromDeclarationEmit.forEach((symbol) => addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)));
|
|
31853
|
+
const exportedModules = getExportedModules(exportedModulesFromDeclarationEmit);
|
|
31874
31854
|
if (exportedModules) {
|
|
31875
31855
|
state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
|
|
31876
31856
|
} else {
|
|
31877
31857
|
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
31878
31858
|
}
|
|
31879
|
-
function addExportedModule(exportedModulePaths) {
|
|
31880
|
-
if (exportedModulePaths == null ? void 0 : exportedModulePaths.length) {
|
|
31881
|
-
if (!exportedModules) {
|
|
31882
|
-
exportedModules = /* @__PURE__ */ new Set();
|
|
31883
|
-
}
|
|
31884
|
-
exportedModulePaths.forEach((path2) => exportedModules.add(path2));
|
|
31885
|
-
}
|
|
31886
|
-
}
|
|
31887
31859
|
}
|
|
31888
31860
|
BuilderState2.updateExportedModules = updateExportedModules;
|
|
31861
|
+
function getExportedModules(exportedModulesFromDeclarationEmit) {
|
|
31862
|
+
let exportedModules;
|
|
31863
|
+
exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach(
|
|
31864
|
+
(symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach(
|
|
31865
|
+
(path2) => (exportedModules != null ? exportedModules : exportedModules = /* @__PURE__ */ new Set()).add(path2)
|
|
31866
|
+
)
|
|
31867
|
+
);
|
|
31868
|
+
return exportedModules;
|
|
31869
|
+
}
|
|
31870
|
+
BuilderState2.getExportedModules = getExportedModules;
|
|
31889
31871
|
function getAllDependencies(state, programOfThisState, sourceFile) {
|
|
31890
31872
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
31891
31873
|
if (outFile(compilerOptions)) {
|
|
@@ -32000,7 +31982,6 @@ function getTextHandlingSourceMapForSignature(text, data) {
|
|
|
32000
31982
|
}
|
|
32001
31983
|
function computeSignatureWithDiagnostics(program, sourceFile, text, host, data) {
|
|
32002
31984
|
var _a2, _b;
|
|
32003
|
-
let getCanonicalFileName;
|
|
32004
31985
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
32005
31986
|
let sourceFileDirectory;
|
|
32006
31987
|
if ((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length) {
|
|
@@ -32020,7 +32001,7 @@ function computeSignatureWithDiagnostics(program, sourceFile, text, host, data)
|
|
|
32020
32001
|
return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
|
|
32021
32002
|
sourceFileDirectory,
|
|
32022
32003
|
diagnostic.file.resolvedPath,
|
|
32023
|
-
|
|
32004
|
+
program.getCanonicalFileName
|
|
32024
32005
|
))}(${diagnostic.start},${diagnostic.length})`;
|
|
32025
32006
|
}
|
|
32026
32007
|
}
|
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.20221208",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"chokidar": "^3.5.3",
|
|
61
61
|
"del": "^6.1.1",
|
|
62
62
|
"diff": "^5.1.0",
|
|
63
|
-
"esbuild": "^0.
|
|
63
|
+
"esbuild": "^0.16.1",
|
|
64
64
|
"eslint": "^8.22.0",
|
|
65
65
|
"eslint-formatter-autolinkable-stylish": "^1.2.0",
|
|
66
66
|
"eslint-plugin-import": "^2.26.0",
|