typescript 5.6.0-dev.20240716 → 5.6.0-dev.20240717
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/lib.es2023.array.d.ts +5 -5
- package/lib/tsc.js +61 -67
- package/lib/typescript.js +74 -75
- package/package.json +2 -2
|
@@ -203,7 +203,7 @@ interface Int8Array {
|
|
|
203
203
|
/**
|
|
204
204
|
* Copies the array and returns the copy with the elements in reverse order.
|
|
205
205
|
*/
|
|
206
|
-
toReversed():
|
|
206
|
+
toReversed(): Int8Array;
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
* Copies and sorts the array.
|
|
@@ -211,11 +211,11 @@ interface Int8Array {
|
|
|
211
211
|
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
212
212
|
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
213
213
|
* ```ts
|
|
214
|
-
* const myNums =
|
|
215
|
-
* myNums.toSorted((a, b) => a - b) //
|
|
214
|
+
* const myNums = Int8Array.from([11, 2, 22, 1]);
|
|
215
|
+
* myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
|
|
216
216
|
* ```
|
|
217
217
|
*/
|
|
218
|
-
toSorted(compareFn?: (a: number, b: number) => number):
|
|
218
|
+
toSorted(compareFn?: (a: number, b: number) => number): Int8Array;
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* Copies the array and inserts the given number at the provided index.
|
|
@@ -224,7 +224,7 @@ interface Int8Array {
|
|
|
224
224
|
* @param value The value to insert into the copied array.
|
|
225
225
|
* @returns A copy of the original array with the inserted value.
|
|
226
226
|
*/
|
|
227
|
-
with(index: number, value: number):
|
|
227
|
+
with(index: number, value: number): Int8Array;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
interface Uint8Array {
|
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240717`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -2515,10 +2515,12 @@ function tryGetPerformance() {
|
|
|
2515
2515
|
if (isNodeLikeSystem()) {
|
|
2516
2516
|
try {
|
|
2517
2517
|
const { performance: performance2 } = require("perf_hooks");
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2518
|
+
if (performance2) {
|
|
2519
|
+
return {
|
|
2520
|
+
shouldWriteNativeEvents: false,
|
|
2521
|
+
performance: performance2
|
|
2522
|
+
};
|
|
2523
|
+
}
|
|
2522
2524
|
} catch {
|
|
2523
2525
|
}
|
|
2524
2526
|
}
|
|
@@ -12585,6 +12587,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
12585
12587
|
if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
|
|
12586
12588
|
return result;
|
|
12587
12589
|
}
|
|
12590
|
+
function createModeMismatchDetails(currentSourceFile) {
|
|
12591
|
+
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
12592
|
+
const scope = currentSourceFile.packageJsonScope;
|
|
12593
|
+
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
12594
|
+
const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
|
|
12595
|
+
/*details*/
|
|
12596
|
+
void 0,
|
|
12597
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
12598
|
+
targetExt,
|
|
12599
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
12600
|
+
) : chainDiagnosticMessages(
|
|
12601
|
+
/*details*/
|
|
12602
|
+
void 0,
|
|
12603
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
12604
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
12605
|
+
) : targetExt ? chainDiagnosticMessages(
|
|
12606
|
+
/*details*/
|
|
12607
|
+
void 0,
|
|
12608
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
12609
|
+
targetExt
|
|
12610
|
+
) : chainDiagnosticMessages(
|
|
12611
|
+
/*details*/
|
|
12612
|
+
void 0,
|
|
12613
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
12614
|
+
);
|
|
12615
|
+
result.repopulateInfo = () => true;
|
|
12616
|
+
return result;
|
|
12617
|
+
}
|
|
12588
12618
|
function packageIdIsEqual(a, b) {
|
|
12589
12619
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
|
|
12590
12620
|
}
|
|
@@ -40133,22 +40163,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
40133
40163
|
resolvedPackageDirectory: false
|
|
40134
40164
|
};
|
|
40135
40165
|
}
|
|
40136
|
-
function getPackageScopeForPath(
|
|
40137
|
-
|
|
40138
|
-
|
|
40139
|
-
|
|
40140
|
-
|
|
40141
|
-
getPathFromPathComponents(parts),
|
|
40166
|
+
function getPackageScopeForPath(directory, state) {
|
|
40167
|
+
return forEachAncestorDirectory(
|
|
40168
|
+
directory,
|
|
40169
|
+
(dir) => getPackageJsonInfo(
|
|
40170
|
+
dir,
|
|
40142
40171
|
/*onlyRecordFailures*/
|
|
40143
40172
|
false,
|
|
40144
40173
|
state
|
|
40145
|
-
)
|
|
40146
|
-
|
|
40147
|
-
return pkg;
|
|
40148
|
-
}
|
|
40149
|
-
parts.pop();
|
|
40150
|
-
}
|
|
40151
|
-
return void 0;
|
|
40174
|
+
)
|
|
40175
|
+
);
|
|
40152
40176
|
}
|
|
40153
40177
|
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
40154
40178
|
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
@@ -40311,7 +40335,7 @@ function noKeyStartsWithDot(obj) {
|
|
|
40311
40335
|
}
|
|
40312
40336
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
40313
40337
|
var _a, _b;
|
|
40314
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
40338
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
40315
40339
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
40316
40340
|
if (!scope || !scope.contents.packageJsonContent.exports) {
|
|
40317
40341
|
return void 0;
|
|
@@ -40407,7 +40431,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
|
|
|
40407
40431
|
void 0
|
|
40408
40432
|
);
|
|
40409
40433
|
}
|
|
40410
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
40434
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
40411
40435
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
40412
40436
|
if (!scope) {
|
|
40413
40437
|
if (state.traceEnabled) {
|
|
@@ -44518,7 +44542,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
|
|
|
44518
44542
|
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
44519
44543
|
Debug.type(host);
|
|
44520
44544
|
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
44521
|
-
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
44545
|
+
const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
|
|
44522
44546
|
if (packageJson) {
|
|
44523
44547
|
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
44524
44548
|
for (const depName of toResolve || emptyArray) {
|
|
@@ -48187,41 +48211,7 @@ function createTypeChecker(host) {
|
|
|
48187
48211
|
let diagnosticDetails;
|
|
48188
48212
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
48189
48213
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
48190
|
-
|
|
48191
|
-
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
48192
|
-
if (scope && !scope.contents.packageJsonContent.type) {
|
|
48193
|
-
if (targetExt) {
|
|
48194
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48195
|
-
/*details*/
|
|
48196
|
-
void 0,
|
|
48197
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
48198
|
-
targetExt,
|
|
48199
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
48200
|
-
);
|
|
48201
|
-
} else {
|
|
48202
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48203
|
-
/*details*/
|
|
48204
|
-
void 0,
|
|
48205
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
48206
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
48207
|
-
);
|
|
48208
|
-
}
|
|
48209
|
-
} else {
|
|
48210
|
-
if (targetExt) {
|
|
48211
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48212
|
-
/*details*/
|
|
48213
|
-
void 0,
|
|
48214
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
48215
|
-
targetExt
|
|
48216
|
-
);
|
|
48217
|
-
} else {
|
|
48218
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48219
|
-
/*details*/
|
|
48220
|
-
void 0,
|
|
48221
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
48222
|
-
);
|
|
48223
|
-
}
|
|
48224
|
-
}
|
|
48214
|
+
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
48225
48215
|
}
|
|
48226
48216
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
48227
48217
|
getSourceFileOfNode(errorNode),
|
|
@@ -52081,7 +52071,7 @@ function createTypeChecker(host) {
|
|
|
52081
52071
|
if (result) {
|
|
52082
52072
|
if (result.pos !== -1 || result.end !== -1) {
|
|
52083
52073
|
if (result === nodes) {
|
|
52084
|
-
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
52074
|
+
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
|
|
52085
52075
|
}
|
|
52086
52076
|
setTextRangePosEnd(result, -1, -1);
|
|
52087
52077
|
}
|
|
@@ -72574,7 +72564,7 @@ function createTypeChecker(host) {
|
|
|
72574
72564
|
checkGrammarJsxElement(node);
|
|
72575
72565
|
}
|
|
72576
72566
|
checkJsxPreconditions(node);
|
|
72577
|
-
|
|
72567
|
+
markJsxAliasReferenced(node);
|
|
72578
72568
|
if (isNodeOpeningLikeElement) {
|
|
72579
72569
|
const jsxOpeningLikeNode = node;
|
|
72580
72570
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -85423,15 +85413,14 @@ function createTypeChecker(host) {
|
|
|
85423
85413
|
function checkChildIdentifiers(node2) {
|
|
85424
85414
|
forEachNodeRecursively(node2, checkIdentifiers);
|
|
85425
85415
|
}
|
|
85416
|
+
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
|
|
85417
|
+
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
|
|
85418
|
+
}
|
|
85426
85419
|
function checkSingleIdentifier(node2) {
|
|
85427
85420
|
const nodeLinks2 = getNodeLinks(node2);
|
|
85428
85421
|
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
85429
|
-
if (isIdentifier(node2) &&
|
|
85430
|
-
const s =
|
|
85431
|
-
node2,
|
|
85432
|
-
/*ignoreErrors*/
|
|
85433
|
-
true
|
|
85434
|
-
);
|
|
85422
|
+
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
85423
|
+
const s = getResolvedSymbol(node2);
|
|
85435
85424
|
if (s && s !== unknownSymbol) {
|
|
85436
85425
|
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
85437
85426
|
}
|
|
@@ -119161,7 +119150,7 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
|
|
|
119161
119150
|
const packageJsonLocations = [];
|
|
119162
119151
|
state.failedLookupLocations = packageJsonLocations;
|
|
119163
119152
|
state.affectingLocations = packageJsonLocations;
|
|
119164
|
-
const packageJsonScope = getPackageScopeForPath(fileName, state);
|
|
119153
|
+
const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
|
|
119165
119154
|
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
119166
119155
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
119167
119156
|
}
|
|
@@ -123076,7 +123065,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
|
|
|
123076
123065
|
}
|
|
123077
123066
|
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
|
|
123078
123067
|
const info = repopulateInfo(chain);
|
|
123079
|
-
if (info) {
|
|
123068
|
+
if (info === true) {
|
|
123069
|
+
return {
|
|
123070
|
+
...createModeMismatchDetails(sourceFile),
|
|
123071
|
+
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
123072
|
+
};
|
|
123073
|
+
} else if (info) {
|
|
123080
123074
|
return {
|
|
123081
123075
|
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
|
|
123082
123076
|
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
@@ -124807,7 +124801,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124807
124801
|
cleanupLibResolutionWatching(newProgram);
|
|
124808
124802
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
124809
124803
|
var _a;
|
|
124810
|
-
const expected =
|
|
124804
|
+
const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
|
|
124811
124805
|
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
124812
124806
|
for (let i = existing.length; i < expected; i++) {
|
|
124813
124807
|
createFileWatcherOfAffectingLocation(
|
package/lib/typescript.js
CHANGED
|
@@ -410,6 +410,7 @@ __export(typescript_exports, {
|
|
|
410
410
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
411
411
|
createModeAwareCache: () => createModeAwareCache,
|
|
412
412
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
413
|
+
createModeMismatchDetails: () => createModeMismatchDetails,
|
|
413
414
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
414
415
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
415
416
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
@@ -2251,7 +2252,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2251
2252
|
|
|
2252
2253
|
// src/compiler/corePublic.ts
|
|
2253
2254
|
var versionMajorMinor = "5.6";
|
|
2254
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2255
|
+
var version = `${versionMajorMinor}.0-dev.20240717`;
|
|
2255
2256
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2256
2257
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2257
2258
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5051,10 +5052,12 @@ function tryGetPerformance() {
|
|
|
5051
5052
|
if (isNodeLikeSystem()) {
|
|
5052
5053
|
try {
|
|
5053
5054
|
const { performance: performance2 } = require("perf_hooks");
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5055
|
+
if (performance2) {
|
|
5056
|
+
return {
|
|
5057
|
+
shouldWriteNativeEvents: false,
|
|
5058
|
+
performance: performance2
|
|
5059
|
+
};
|
|
5060
|
+
}
|
|
5058
5061
|
} catch {
|
|
5059
5062
|
}
|
|
5060
5063
|
}
|
|
@@ -16169,6 +16172,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
16169
16172
|
if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
|
|
16170
16173
|
return result;
|
|
16171
16174
|
}
|
|
16175
|
+
function createModeMismatchDetails(currentSourceFile) {
|
|
16176
|
+
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
16177
|
+
const scope = currentSourceFile.packageJsonScope;
|
|
16178
|
+
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
16179
|
+
const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
|
|
16180
|
+
/*details*/
|
|
16181
|
+
void 0,
|
|
16182
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
16183
|
+
targetExt,
|
|
16184
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
16185
|
+
) : chainDiagnosticMessages(
|
|
16186
|
+
/*details*/
|
|
16187
|
+
void 0,
|
|
16188
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
16189
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
16190
|
+
) : targetExt ? chainDiagnosticMessages(
|
|
16191
|
+
/*details*/
|
|
16192
|
+
void 0,
|
|
16193
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
16194
|
+
targetExt
|
|
16195
|
+
) : chainDiagnosticMessages(
|
|
16196
|
+
/*details*/
|
|
16197
|
+
void 0,
|
|
16198
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
16199
|
+
);
|
|
16200
|
+
result.repopulateInfo = () => true;
|
|
16201
|
+
return result;
|
|
16202
|
+
}
|
|
16172
16203
|
function packageIdIsEqual(a, b) {
|
|
16173
16204
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
|
|
16174
16205
|
}
|
|
@@ -44617,22 +44648,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
44617
44648
|
resolvedPackageDirectory: false
|
|
44618
44649
|
};
|
|
44619
44650
|
}
|
|
44620
|
-
function getPackageScopeForPath(
|
|
44621
|
-
|
|
44622
|
-
|
|
44623
|
-
|
|
44624
|
-
|
|
44625
|
-
getPathFromPathComponents(parts),
|
|
44651
|
+
function getPackageScopeForPath(directory, state) {
|
|
44652
|
+
return forEachAncestorDirectory(
|
|
44653
|
+
directory,
|
|
44654
|
+
(dir) => getPackageJsonInfo(
|
|
44655
|
+
dir,
|
|
44626
44656
|
/*onlyRecordFailures*/
|
|
44627
44657
|
false,
|
|
44628
44658
|
state
|
|
44629
|
-
)
|
|
44630
|
-
|
|
44631
|
-
return pkg;
|
|
44632
|
-
}
|
|
44633
|
-
parts.pop();
|
|
44634
|
-
}
|
|
44635
|
-
return void 0;
|
|
44659
|
+
)
|
|
44660
|
+
);
|
|
44636
44661
|
}
|
|
44637
44662
|
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
44638
44663
|
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
@@ -44795,7 +44820,7 @@ function noKeyStartsWithDot(obj) {
|
|
|
44795
44820
|
}
|
|
44796
44821
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
44797
44822
|
var _a, _b;
|
|
44798
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
44823
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
44799
44824
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
44800
44825
|
if (!scope || !scope.contents.packageJsonContent.exports) {
|
|
44801
44826
|
return void 0;
|
|
@@ -44891,7 +44916,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
|
|
|
44891
44916
|
void 0
|
|
44892
44917
|
);
|
|
44893
44918
|
}
|
|
44894
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
44919
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
44895
44920
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
44896
44921
|
if (!scope) {
|
|
44897
44922
|
if (state.traceEnabled) {
|
|
@@ -49120,7 +49145,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
|
|
|
49120
49145
|
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
49121
49146
|
Debug.type(host);
|
|
49122
49147
|
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
49123
|
-
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
49148
|
+
const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
|
|
49124
49149
|
if (packageJson) {
|
|
49125
49150
|
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
49126
49151
|
for (const depName of toResolve || emptyArray) {
|
|
@@ -52789,41 +52814,7 @@ function createTypeChecker(host) {
|
|
|
52789
52814
|
let diagnosticDetails;
|
|
52790
52815
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
52791
52816
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
52792
|
-
|
|
52793
|
-
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
52794
|
-
if (scope && !scope.contents.packageJsonContent.type) {
|
|
52795
|
-
if (targetExt) {
|
|
52796
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52797
|
-
/*details*/
|
|
52798
|
-
void 0,
|
|
52799
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
52800
|
-
targetExt,
|
|
52801
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
52802
|
-
);
|
|
52803
|
-
} else {
|
|
52804
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52805
|
-
/*details*/
|
|
52806
|
-
void 0,
|
|
52807
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
52808
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
52809
|
-
);
|
|
52810
|
-
}
|
|
52811
|
-
} else {
|
|
52812
|
-
if (targetExt) {
|
|
52813
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52814
|
-
/*details*/
|
|
52815
|
-
void 0,
|
|
52816
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
52817
|
-
targetExt
|
|
52818
|
-
);
|
|
52819
|
-
} else {
|
|
52820
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52821
|
-
/*details*/
|
|
52822
|
-
void 0,
|
|
52823
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
52824
|
-
);
|
|
52825
|
-
}
|
|
52826
|
-
}
|
|
52817
|
+
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
52827
52818
|
}
|
|
52828
52819
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
52829
52820
|
getSourceFileOfNode(errorNode),
|
|
@@ -56683,7 +56674,7 @@ function createTypeChecker(host) {
|
|
|
56683
56674
|
if (result) {
|
|
56684
56675
|
if (result.pos !== -1 || result.end !== -1) {
|
|
56685
56676
|
if (result === nodes) {
|
|
56686
|
-
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
56677
|
+
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
|
|
56687
56678
|
}
|
|
56688
56679
|
setTextRangePosEnd(result, -1, -1);
|
|
56689
56680
|
}
|
|
@@ -77176,7 +77167,7 @@ function createTypeChecker(host) {
|
|
|
77176
77167
|
checkGrammarJsxElement(node);
|
|
77177
77168
|
}
|
|
77178
77169
|
checkJsxPreconditions(node);
|
|
77179
|
-
|
|
77170
|
+
markJsxAliasReferenced(node);
|
|
77180
77171
|
if (isNodeOpeningLikeElement) {
|
|
77181
77172
|
const jsxOpeningLikeNode = node;
|
|
77182
77173
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -90025,15 +90016,14 @@ function createTypeChecker(host) {
|
|
|
90025
90016
|
function checkChildIdentifiers(node2) {
|
|
90026
90017
|
forEachNodeRecursively(node2, checkIdentifiers);
|
|
90027
90018
|
}
|
|
90019
|
+
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
|
|
90020
|
+
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
|
|
90021
|
+
}
|
|
90028
90022
|
function checkSingleIdentifier(node2) {
|
|
90029
90023
|
const nodeLinks2 = getNodeLinks(node2);
|
|
90030
90024
|
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
90031
|
-
if (isIdentifier(node2) &&
|
|
90032
|
-
const s =
|
|
90033
|
-
node2,
|
|
90034
|
-
/*ignoreErrors*/
|
|
90035
|
-
true
|
|
90036
|
-
);
|
|
90025
|
+
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
90026
|
+
const s = getResolvedSymbol(node2);
|
|
90037
90027
|
if (s && s !== unknownSymbol) {
|
|
90038
90028
|
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
90039
90029
|
}
|
|
@@ -123999,7 +123989,7 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
|
|
|
123999
123989
|
const packageJsonLocations = [];
|
|
124000
123990
|
state.failedLookupLocations = packageJsonLocations;
|
|
124001
123991
|
state.affectingLocations = packageJsonLocations;
|
|
124002
|
-
const packageJsonScope = getPackageScopeForPath(fileName, state);
|
|
123992
|
+
const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
|
|
124003
123993
|
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
124004
123994
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
124005
123995
|
}
|
|
@@ -127943,7 +127933,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
|
|
|
127943
127933
|
}
|
|
127944
127934
|
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
|
|
127945
127935
|
const info = repopulateInfo(chain);
|
|
127946
|
-
if (info) {
|
|
127936
|
+
if (info === true) {
|
|
127937
|
+
return {
|
|
127938
|
+
...createModeMismatchDetails(sourceFile),
|
|
127939
|
+
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
127940
|
+
};
|
|
127941
|
+
} else if (info) {
|
|
127947
127942
|
return {
|
|
127948
127943
|
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
|
|
127949
127944
|
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
@@ -129706,7 +129701,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129706
129701
|
cleanupLibResolutionWatching(newProgram);
|
|
129707
129702
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
129708
129703
|
var _a;
|
|
129709
|
-
const expected =
|
|
129704
|
+
const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
|
|
129710
129705
|
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
129711
129706
|
for (let i = existing.length; i < expected; i++) {
|
|
129712
129707
|
createFileWatcherOfAffectingLocation(
|
|
@@ -162073,7 +162068,7 @@ var errorCodes54 = [Diagnostics.require_call_may_be_converted_to_an_import.code]
|
|
|
162073
162068
|
registerCodeFix({
|
|
162074
162069
|
errorCodes: errorCodes54,
|
|
162075
162070
|
getCodeActions(context) {
|
|
162076
|
-
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
162071
|
+
const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences);
|
|
162077
162072
|
if (!info) {
|
|
162078
162073
|
return void 0;
|
|
162079
162074
|
}
|
|
@@ -162082,14 +162077,14 @@ registerCodeFix({
|
|
|
162082
162077
|
},
|
|
162083
162078
|
fixIds: [fixId42],
|
|
162084
162079
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
162085
|
-
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
162080
|
+
const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences);
|
|
162086
162081
|
if (info) {
|
|
162087
162082
|
doChange35(changes, context.sourceFile, info);
|
|
162088
162083
|
}
|
|
162089
162084
|
})
|
|
162090
162085
|
});
|
|
162091
162086
|
function doChange35(changes, sourceFile, info) {
|
|
162092
|
-
const { allowSyntheticDefaults, defaultImportName, namedImports, statement,
|
|
162087
|
+
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, moduleSpecifier } = info;
|
|
162093
162088
|
changes.replaceNode(
|
|
162094
162089
|
sourceFile,
|
|
162095
162090
|
statement,
|
|
@@ -162099,7 +162094,7 @@ function doChange35(changes, sourceFile, info) {
|
|
|
162099
162094
|
/*isTypeOnly*/
|
|
162100
162095
|
false,
|
|
162101
162096
|
defaultImportName,
|
|
162102
|
-
factory.createExternalModuleReference(
|
|
162097
|
+
factory.createExternalModuleReference(moduleSpecifier)
|
|
162103
162098
|
) : factory.createImportDeclaration(
|
|
162104
162099
|
/*modifiers*/
|
|
162105
162100
|
void 0,
|
|
@@ -162109,13 +162104,13 @@ function doChange35(changes, sourceFile, info) {
|
|
|
162109
162104
|
defaultImportName,
|
|
162110
162105
|
namedImports
|
|
162111
162106
|
),
|
|
162112
|
-
|
|
162107
|
+
moduleSpecifier,
|
|
162113
162108
|
/*attributes*/
|
|
162114
162109
|
void 0
|
|
162115
162110
|
)
|
|
162116
162111
|
);
|
|
162117
162112
|
}
|
|
162118
|
-
function getInfo18(sourceFile, program, pos) {
|
|
162113
|
+
function getInfo18(sourceFile, program, pos, preferences) {
|
|
162119
162114
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
162120
162115
|
if (!isRequireCall(
|
|
162121
162116
|
parent2,
|
|
@@ -162125,15 +162120,17 @@ function getInfo18(sourceFile, program, pos) {
|
|
|
162125
162120
|
Debug.failBadSyntaxKind(parent2);
|
|
162126
162121
|
}
|
|
162127
162122
|
const decl = cast(parent2.parent, isVariableDeclaration);
|
|
162123
|
+
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
162128
162124
|
const defaultImportName = tryCast(decl.name, isIdentifier);
|
|
162129
162125
|
const namedImports = isObjectBindingPattern(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0;
|
|
162130
162126
|
if (defaultImportName || namedImports) {
|
|
162127
|
+
const moduleSpecifier = first(parent2.arguments);
|
|
162131
162128
|
return {
|
|
162132
162129
|
allowSyntheticDefaults: getAllowSyntheticDefaultImports(program.getCompilerOptions()),
|
|
162133
162130
|
defaultImportName,
|
|
162134
162131
|
namedImports,
|
|
162135
162132
|
statement: cast(decl.parent.parent, isVariableStatement),
|
|
162136
|
-
|
|
162133
|
+
moduleSpecifier: isNoSubstitutionTemplateLiteral(moduleSpecifier) ? factory.createStringLiteral(moduleSpecifier.text, quotePreference === 0 /* Single */) : moduleSpecifier
|
|
162137
162134
|
};
|
|
162138
162135
|
}
|
|
162139
162136
|
}
|
|
@@ -178898,6 +178895,7 @@ __export(ts_exports2, {
|
|
|
178898
178895
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
178899
178896
|
createModeAwareCache: () => createModeAwareCache,
|
|
178900
178897
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
178898
|
+
createModeMismatchDetails: () => createModeMismatchDetails,
|
|
178901
178899
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
178902
178900
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
178903
178901
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
@@ -190217,7 +190215,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
190217
190215
|
const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
190218
190216
|
const packageJsonCache = (_a2 = project.getModuleResolutionCache()) == null ? void 0 : _a2.getPackageJsonInfoCache();
|
|
190219
190217
|
const compilerOptions = project.getCompilationSettings();
|
|
190220
|
-
const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory
|
|
190218
|
+
const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
190221
190219
|
if (!packageJson) return void 0;
|
|
190222
190220
|
const entrypoints = getEntrypointsFromPackageJsonInfo(
|
|
190223
190221
|
packageJson,
|
|
@@ -193256,6 +193254,7 @@ if (typeof console !== "undefined") {
|
|
|
193256
193254
|
createMemberAccessForPropertyName,
|
|
193257
193255
|
createModeAwareCache,
|
|
193258
193256
|
createModeAwareCacheKey,
|
|
193257
|
+
createModeMismatchDetails,
|
|
193259
193258
|
createModuleNotFoundChain,
|
|
193260
193259
|
createModuleResolutionCache,
|
|
193261
193260
|
createModuleResolutionLoader,
|
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.6.0-dev.
|
|
5
|
+
"version": "5.6.0-dev.20240717",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "f37482cd16118409284e015409deaf14b416b4a0"
|
|
117
117
|
}
|