typescript 5.0.0-dev.20230110 → 5.0.0-dev.20230111
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 +61 -32
- package/lib/tsserver.js +64 -32
- package/lib/tsserverlibrary.js +63 -32
- package/lib/typescript.js +62 -32
- package/lib/typingsInstaller.js +33 -25
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230111`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -6763,6 +6763,7 @@ var Diagnostics = {
|
|
|
6763
6763
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
6764
6764
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
6765
6765
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
6766
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
6766
6767
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
6767
6768
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
6768
6769
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -16637,6 +16638,10 @@ function isOptionalDeclaration(declaration) {
|
|
|
16637
16638
|
return false;
|
|
16638
16639
|
}
|
|
16639
16640
|
}
|
|
16641
|
+
function isNonNullAccess(node) {
|
|
16642
|
+
const kind = node.kind;
|
|
16643
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
16644
|
+
}
|
|
16640
16645
|
|
|
16641
16646
|
// src/compiler/factory/baseNodeFactory.ts
|
|
16642
16647
|
function createBaseNodeFactory() {
|
|
@@ -35772,7 +35777,8 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
35772
35777
|
conditions,
|
|
35773
35778
|
requestContainingDirectory: containingDirectory,
|
|
35774
35779
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
35775
|
-
isConfigLookup: false
|
|
35780
|
+
isConfigLookup: false,
|
|
35781
|
+
candidateIsFromPackageJsonField: false
|
|
35776
35782
|
};
|
|
35777
35783
|
let resolved = primaryLookup();
|
|
35778
35784
|
let primary = true;
|
|
@@ -36618,7 +36624,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
36618
36624
|
conditions,
|
|
36619
36625
|
requestContainingDirectory: containingDirectory,
|
|
36620
36626
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
36621
|
-
isConfigLookup
|
|
36627
|
+
isConfigLookup,
|
|
36628
|
+
candidateIsFromPackageJsonField: false
|
|
36622
36629
|
};
|
|
36623
36630
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
36624
36631
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -36842,7 +36849,7 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
36842
36849
|
}
|
|
36843
36850
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
36844
36851
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
36845
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
36852
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
36846
36853
|
}
|
|
36847
36854
|
}
|
|
36848
36855
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -36888,7 +36895,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
36888
36895
|
conditions: emptyArray,
|
|
36889
36896
|
requestContainingDirectory: void 0,
|
|
36890
36897
|
reportDiagnostic: noop,
|
|
36891
|
-
isConfigLookup: false
|
|
36898
|
+
isConfigLookup: false,
|
|
36899
|
+
candidateIsFromPackageJsonField: false
|
|
36892
36900
|
};
|
|
36893
36901
|
}
|
|
36894
36902
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -36976,6 +36984,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
36976
36984
|
}
|
|
36977
36985
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
36978
36986
|
const features = state2.features;
|
|
36987
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
36988
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
36979
36989
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
36980
36990
|
state2.features &= ~32 /* EsmMode */;
|
|
36981
36991
|
}
|
|
@@ -36988,6 +36998,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
36988
36998
|
false
|
|
36989
36999
|
);
|
|
36990
37000
|
state2.features = features;
|
|
37001
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
36991
37002
|
return result;
|
|
36992
37003
|
};
|
|
36993
37004
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -37061,7 +37072,10 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
|
|
|
37061
37072
|
return void 0;
|
|
37062
37073
|
}
|
|
37063
37074
|
const trailingParts = parts.slice(nameParts.length);
|
|
37064
|
-
|
|
37075
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
37076
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
37077
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
37078
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
37065
37079
|
}
|
|
37066
37080
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
37067
37081
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -37563,25 +37577,26 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
37563
37577
|
}
|
|
37564
37578
|
}
|
|
37565
37579
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
37566
|
-
var _a2;
|
|
37580
|
+
var _a2, _b, _c;
|
|
37567
37581
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
37582
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
37583
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
37584
|
+
let rootPackageInfo;
|
|
37568
37585
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
37569
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
37570
|
-
|
|
37571
|
-
|
|
37572
|
-
|
|
37573
|
-
return noPackageId(fromFile);
|
|
37574
|
-
}
|
|
37575
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
37576
|
-
extensions,
|
|
37577
|
-
candidate,
|
|
37578
|
-
!nodeModulesDirectoryExists,
|
|
37579
|
-
state,
|
|
37580
|
-
packageInfo.contents.packageJsonContent,
|
|
37581
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
37582
|
-
);
|
|
37583
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
37586
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
37587
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
37588
|
+
if (fromFile) {
|
|
37589
|
+
return noPackageId(fromFile);
|
|
37584
37590
|
}
|
|
37591
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
37592
|
+
extensions,
|
|
37593
|
+
candidate,
|
|
37594
|
+
!nodeModulesDirectoryExists,
|
|
37595
|
+
state,
|
|
37596
|
+
packageInfo.contents.packageJsonContent,
|
|
37597
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
37598
|
+
);
|
|
37599
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
37585
37600
|
}
|
|
37586
37601
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
37587
37602
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -37597,13 +37612,11 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
37597
37612
|
}
|
|
37598
37613
|
return withPackageId(packageInfo, pathAndExtension);
|
|
37599
37614
|
};
|
|
37600
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
37601
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
37602
37615
|
if (rest !== "") {
|
|
37603
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
37616
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
37604
37617
|
}
|
|
37605
37618
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
37606
|
-
return (
|
|
37619
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
37607
37620
|
}
|
|
37608
37621
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
37609
37622
|
if (versionPaths) {
|
|
@@ -37720,7 +37733,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
37720
37733
|
conditions: [],
|
|
37721
37734
|
requestContainingDirectory: containingDirectory,
|
|
37722
37735
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
37723
|
-
isConfigLookup: false
|
|
37736
|
+
isConfigLookup: false,
|
|
37737
|
+
candidateIsFromPackageJsonField: false
|
|
37724
37738
|
};
|
|
37725
37739
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
37726
37740
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -37799,7 +37813,8 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
37799
37813
|
conditions: [],
|
|
37800
37814
|
requestContainingDirectory: void 0,
|
|
37801
37815
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
37802
|
-
isConfigLookup: false
|
|
37816
|
+
isConfigLookup: false,
|
|
37817
|
+
candidateIsFromPackageJsonField: false
|
|
37803
37818
|
};
|
|
37804
37819
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
37805
37820
|
4 /* Declaration */,
|
|
@@ -50715,7 +50730,17 @@ function createTypeChecker(host) {
|
|
|
50715
50730
|
}
|
|
50716
50731
|
}
|
|
50717
50732
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
50718
|
-
|
|
50733
|
+
var _a2;
|
|
50734
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
50735
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
50736
|
+
return true;
|
|
50737
|
+
}
|
|
50738
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
50739
|
+
return false;
|
|
50740
|
+
}
|
|
50741
|
+
const initializer = decl.initializer;
|
|
50742
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
50743
|
+
});
|
|
50719
50744
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
50720
50745
|
return getOuterTypeParameters(declaration);
|
|
50721
50746
|
}
|
|
@@ -62060,7 +62085,7 @@ function createTypeChecker(host) {
|
|
|
62060
62085
|
if (signature) {
|
|
62061
62086
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
62062
62087
|
if (inference.contraCandidates) {
|
|
62063
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
62088
|
+
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
|
|
62064
62089
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
62065
62090
|
} else if (inferredCovariantType) {
|
|
62066
62091
|
inferredType = inferredCovariantType;
|
|
@@ -63536,12 +63561,13 @@ function createTypeChecker(host) {
|
|
|
63536
63561
|
if (propName === void 0) {
|
|
63537
63562
|
return type;
|
|
63538
63563
|
}
|
|
63539
|
-
const
|
|
63564
|
+
const optionalChain = isOptionalChain(access);
|
|
63565
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
63540
63566
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
63541
63567
|
if (!propType) {
|
|
63542
63568
|
return type;
|
|
63543
63569
|
}
|
|
63544
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
63570
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
63545
63571
|
const narrowedPropType = narrowType2(propType);
|
|
63546
63572
|
return filterType(type, (t) => {
|
|
63547
63573
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -99965,6 +99991,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
99965
99991
|
case 259 /* FunctionDeclaration */:
|
|
99966
99992
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
99967
99993
|
break;
|
|
99994
|
+
case 192 /* InferType */:
|
|
99995
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
99996
|
+
break;
|
|
99968
99997
|
case 262 /* TypeAliasDeclaration */:
|
|
99969
99998
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
99970
99999
|
break;
|
package/lib/tsserver.js
CHANGED
|
@@ -1735,6 +1735,7 @@ __export(server_exports, {
|
|
|
1735
1735
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
1736
1736
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
1737
1737
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
1738
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
1738
1739
|
isNonNullChain: () => isNonNullChain,
|
|
1739
1740
|
isNonNullExpression: () => isNonNullExpression,
|
|
1740
1741
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -2661,7 +2662,7 @@ __export(ts_server_exports3, {
|
|
|
2661
2662
|
|
|
2662
2663
|
// src/compiler/corePublic.ts
|
|
2663
2664
|
var versionMajorMinor = "5.0";
|
|
2664
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2665
|
+
var version = `${versionMajorMinor}.0-dev.20230111`;
|
|
2665
2666
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2666
2667
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2667
2668
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10567,6 +10568,7 @@ var Diagnostics = {
|
|
|
10567
10568
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
10568
10569
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
10569
10570
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
10571
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
10570
10572
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
10571
10573
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
10572
10574
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -21102,6 +21104,10 @@ function isOptionalDeclaration(declaration) {
|
|
|
21102
21104
|
return false;
|
|
21103
21105
|
}
|
|
21104
21106
|
}
|
|
21107
|
+
function isNonNullAccess(node) {
|
|
21108
|
+
const kind = node.kind;
|
|
21109
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
21110
|
+
}
|
|
21105
21111
|
|
|
21106
21112
|
// src/compiler/factory/baseNodeFactory.ts
|
|
21107
21113
|
function createBaseNodeFactory() {
|
|
@@ -40498,7 +40504,8 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
40498
40504
|
conditions,
|
|
40499
40505
|
requestContainingDirectory: containingDirectory,
|
|
40500
40506
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40501
|
-
isConfigLookup: false
|
|
40507
|
+
isConfigLookup: false,
|
|
40508
|
+
candidateIsFromPackageJsonField: false
|
|
40502
40509
|
};
|
|
40503
40510
|
let resolved = primaryLookup();
|
|
40504
40511
|
let primary = true;
|
|
@@ -41369,7 +41376,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
41369
41376
|
conditions,
|
|
41370
41377
|
requestContainingDirectory: containingDirectory,
|
|
41371
41378
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
41372
|
-
isConfigLookup
|
|
41379
|
+
isConfigLookup,
|
|
41380
|
+
candidateIsFromPackageJsonField: false
|
|
41373
41381
|
};
|
|
41374
41382
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
41375
41383
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -41593,7 +41601,7 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
41593
41601
|
}
|
|
41594
41602
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
41595
41603
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
41596
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
41604
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
41597
41605
|
}
|
|
41598
41606
|
}
|
|
41599
41607
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -41740,7 +41748,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
41740
41748
|
conditions: emptyArray,
|
|
41741
41749
|
requestContainingDirectory: void 0,
|
|
41742
41750
|
reportDiagnostic: noop,
|
|
41743
|
-
isConfigLookup: false
|
|
41751
|
+
isConfigLookup: false,
|
|
41752
|
+
candidateIsFromPackageJsonField: false
|
|
41744
41753
|
};
|
|
41745
41754
|
}
|
|
41746
41755
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -41828,6 +41837,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
41828
41837
|
}
|
|
41829
41838
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
41830
41839
|
const features = state2.features;
|
|
41840
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
41841
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
41831
41842
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
41832
41843
|
state2.features &= ~32 /* EsmMode */;
|
|
41833
41844
|
}
|
|
@@ -41840,6 +41851,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
41840
41851
|
false
|
|
41841
41852
|
);
|
|
41842
41853
|
state2.features = features;
|
|
41854
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
41843
41855
|
return result;
|
|
41844
41856
|
};
|
|
41845
41857
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -41913,7 +41925,10 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
|
|
|
41913
41925
|
return void 0;
|
|
41914
41926
|
}
|
|
41915
41927
|
const trailingParts = parts.slice(nameParts.length);
|
|
41916
|
-
|
|
41928
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
41929
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
41930
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
41931
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
41917
41932
|
}
|
|
41918
41933
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
41919
41934
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -42415,25 +42430,26 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
42415
42430
|
}
|
|
42416
42431
|
}
|
|
42417
42432
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
42418
|
-
var _a2;
|
|
42433
|
+
var _a2, _b, _c;
|
|
42419
42434
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
42435
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
42436
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
42437
|
+
let rootPackageInfo;
|
|
42420
42438
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
42421
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
42422
|
-
|
|
42423
|
-
|
|
42424
|
-
|
|
42425
|
-
return noPackageId(fromFile);
|
|
42426
|
-
}
|
|
42427
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
42428
|
-
extensions,
|
|
42429
|
-
candidate,
|
|
42430
|
-
!nodeModulesDirectoryExists,
|
|
42431
|
-
state,
|
|
42432
|
-
packageInfo.contents.packageJsonContent,
|
|
42433
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
42434
|
-
);
|
|
42435
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
42439
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
42440
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
42441
|
+
if (fromFile) {
|
|
42442
|
+
return noPackageId(fromFile);
|
|
42436
42443
|
}
|
|
42444
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
42445
|
+
extensions,
|
|
42446
|
+
candidate,
|
|
42447
|
+
!nodeModulesDirectoryExists,
|
|
42448
|
+
state,
|
|
42449
|
+
packageInfo.contents.packageJsonContent,
|
|
42450
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
42451
|
+
);
|
|
42452
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
42437
42453
|
}
|
|
42438
42454
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
42439
42455
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -42449,13 +42465,11 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
42449
42465
|
}
|
|
42450
42466
|
return withPackageId(packageInfo, pathAndExtension);
|
|
42451
42467
|
};
|
|
42452
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
42453
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
42454
42468
|
if (rest !== "") {
|
|
42455
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
42469
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
42456
42470
|
}
|
|
42457
42471
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
42458
|
-
return (
|
|
42472
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
42459
42473
|
}
|
|
42460
42474
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
42461
42475
|
if (versionPaths) {
|
|
@@ -42572,7 +42586,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
42572
42586
|
conditions: [],
|
|
42573
42587
|
requestContainingDirectory: containingDirectory,
|
|
42574
42588
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42575
|
-
isConfigLookup: false
|
|
42589
|
+
isConfigLookup: false,
|
|
42590
|
+
candidateIsFromPackageJsonField: false
|
|
42576
42591
|
};
|
|
42577
42592
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
42578
42593
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -42651,7 +42666,8 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
42651
42666
|
conditions: [],
|
|
42652
42667
|
requestContainingDirectory: void 0,
|
|
42653
42668
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42654
|
-
isConfigLookup: false
|
|
42669
|
+
isConfigLookup: false,
|
|
42670
|
+
candidateIsFromPackageJsonField: false
|
|
42655
42671
|
};
|
|
42656
42672
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
42657
42673
|
4 /* Declaration */,
|
|
@@ -55621,7 +55637,17 @@ function createTypeChecker(host) {
|
|
|
55621
55637
|
}
|
|
55622
55638
|
}
|
|
55623
55639
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
55624
|
-
|
|
55640
|
+
var _a2;
|
|
55641
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
55642
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
55643
|
+
return true;
|
|
55644
|
+
}
|
|
55645
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
55646
|
+
return false;
|
|
55647
|
+
}
|
|
55648
|
+
const initializer = decl.initializer;
|
|
55649
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
55650
|
+
});
|
|
55625
55651
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
55626
55652
|
return getOuterTypeParameters(declaration);
|
|
55627
55653
|
}
|
|
@@ -66966,7 +66992,7 @@ function createTypeChecker(host) {
|
|
|
66966
66992
|
if (signature) {
|
|
66967
66993
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
66968
66994
|
if (inference.contraCandidates) {
|
|
66969
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
66995
|
+
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
|
|
66970
66996
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
66971
66997
|
} else if (inferredCovariantType) {
|
|
66972
66998
|
inferredType = inferredCovariantType;
|
|
@@ -68442,12 +68468,13 @@ function createTypeChecker(host) {
|
|
|
68442
68468
|
if (propName === void 0) {
|
|
68443
68469
|
return type;
|
|
68444
68470
|
}
|
|
68445
|
-
const
|
|
68471
|
+
const optionalChain = isOptionalChain(access);
|
|
68472
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
68446
68473
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
68447
68474
|
if (!propType) {
|
|
68448
68475
|
return type;
|
|
68449
68476
|
}
|
|
68450
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
68477
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
68451
68478
|
const narrowedPropType = narrowType2(propType);
|
|
68452
68479
|
return filterType(type, (t) => {
|
|
68453
68480
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -105048,6 +105075,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
105048
105075
|
case 259 /* FunctionDeclaration */:
|
|
105049
105076
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
105050
105077
|
break;
|
|
105078
|
+
case 192 /* InferType */:
|
|
105079
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
105080
|
+
break;
|
|
105051
105081
|
case 262 /* TypeAliasDeclaration */:
|
|
105052
105082
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
105053
105083
|
break;
|
|
@@ -124875,6 +124905,7 @@ __export(ts_exports3, {
|
|
|
124875
124905
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
124876
124906
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
124877
124907
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
124908
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
124878
124909
|
isNonNullChain: () => isNonNullChain,
|
|
124879
124910
|
isNonNullExpression: () => isNonNullExpression,
|
|
124880
124911
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -180453,6 +180484,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
180453
180484
|
isNonContextualKeyword,
|
|
180454
180485
|
isNonGlobalAmbientModule,
|
|
180455
180486
|
isNonGlobalDeclaration,
|
|
180487
|
+
isNonNullAccess,
|
|
180456
180488
|
isNonNullChain,
|
|
180457
180489
|
isNonNullExpression,
|
|
180458
180490
|
isNonStaticMethodOrAccessorWithPrivateName,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20230111`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8023,6 +8023,7 @@ ${lanes.join("\n")}
|
|
|
8023
8023
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
8024
8024
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
8025
8025
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
8026
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
8026
8027
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
8027
8028
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
8028
8029
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -18397,6 +18398,10 @@ ${lanes.join("\n")}
|
|
|
18397
18398
|
return false;
|
|
18398
18399
|
}
|
|
18399
18400
|
}
|
|
18401
|
+
function isNonNullAccess(node) {
|
|
18402
|
+
const kind = node.kind;
|
|
18403
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
18404
|
+
}
|
|
18400
18405
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
18401
18406
|
var init_utilities = __esm({
|
|
18402
18407
|
"src/compiler/utilities.ts"() {
|
|
@@ -38031,7 +38036,8 @@ ${lanes.join("\n")}
|
|
|
38031
38036
|
conditions,
|
|
38032
38037
|
requestContainingDirectory: containingDirectory,
|
|
38033
38038
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
38034
|
-
isConfigLookup: false
|
|
38039
|
+
isConfigLookup: false,
|
|
38040
|
+
candidateIsFromPackageJsonField: false
|
|
38035
38041
|
};
|
|
38036
38042
|
let resolved = primaryLookup();
|
|
38037
38043
|
let primary = true;
|
|
@@ -38889,7 +38895,8 @@ ${lanes.join("\n")}
|
|
|
38889
38895
|
conditions,
|
|
38890
38896
|
requestContainingDirectory: containingDirectory,
|
|
38891
38897
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
38892
|
-
isConfigLookup
|
|
38898
|
+
isConfigLookup,
|
|
38899
|
+
candidateIsFromPackageJsonField: false
|
|
38893
38900
|
};
|
|
38894
38901
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
38895
38902
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -39112,7 +39119,7 @@ ${lanes.join("\n")}
|
|
|
39112
39119
|
}
|
|
39113
39120
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
39114
39121
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
39115
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
39122
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
39116
39123
|
}
|
|
39117
39124
|
}
|
|
39118
39125
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -39259,7 +39266,8 @@ ${lanes.join("\n")}
|
|
|
39259
39266
|
conditions: emptyArray,
|
|
39260
39267
|
requestContainingDirectory: void 0,
|
|
39261
39268
|
reportDiagnostic: noop,
|
|
39262
|
-
isConfigLookup: false
|
|
39269
|
+
isConfigLookup: false,
|
|
39270
|
+
candidateIsFromPackageJsonField: false
|
|
39263
39271
|
};
|
|
39264
39272
|
}
|
|
39265
39273
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -39347,6 +39355,8 @@ ${lanes.join("\n")}
|
|
|
39347
39355
|
}
|
|
39348
39356
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
39349
39357
|
const features = state2.features;
|
|
39358
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
39359
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
39350
39360
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
39351
39361
|
state2.features &= ~32 /* EsmMode */;
|
|
39352
39362
|
}
|
|
@@ -39359,6 +39369,7 @@ ${lanes.join("\n")}
|
|
|
39359
39369
|
false
|
|
39360
39370
|
);
|
|
39361
39371
|
state2.features = features;
|
|
39372
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
39362
39373
|
return result;
|
|
39363
39374
|
};
|
|
39364
39375
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -39432,7 +39443,10 @@ ${lanes.join("\n")}
|
|
|
39432
39443
|
return void 0;
|
|
39433
39444
|
}
|
|
39434
39445
|
const trailingParts = parts.slice(nameParts.length);
|
|
39435
|
-
|
|
39446
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
39447
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
39448
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
39449
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
39436
39450
|
}
|
|
39437
39451
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
39438
39452
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -39934,25 +39948,26 @@ ${lanes.join("\n")}
|
|
|
39934
39948
|
}
|
|
39935
39949
|
}
|
|
39936
39950
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
39937
|
-
var _a2;
|
|
39951
|
+
var _a2, _b, _c;
|
|
39938
39952
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
39953
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
39954
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
39955
|
+
let rootPackageInfo;
|
|
39939
39956
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
39940
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
39941
|
-
|
|
39942
|
-
|
|
39943
|
-
|
|
39944
|
-
return noPackageId(fromFile);
|
|
39945
|
-
}
|
|
39946
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
39947
|
-
extensions,
|
|
39948
|
-
candidate,
|
|
39949
|
-
!nodeModulesDirectoryExists,
|
|
39950
|
-
state,
|
|
39951
|
-
packageInfo.contents.packageJsonContent,
|
|
39952
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39953
|
-
);
|
|
39954
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
39957
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
39958
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
39959
|
+
if (fromFile) {
|
|
39960
|
+
return noPackageId(fromFile);
|
|
39955
39961
|
}
|
|
39962
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
39963
|
+
extensions,
|
|
39964
|
+
candidate,
|
|
39965
|
+
!nodeModulesDirectoryExists,
|
|
39966
|
+
state,
|
|
39967
|
+
packageInfo.contents.packageJsonContent,
|
|
39968
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39969
|
+
);
|
|
39970
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
39956
39971
|
}
|
|
39957
39972
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
39958
39973
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -39968,13 +39983,11 @@ ${lanes.join("\n")}
|
|
|
39968
39983
|
}
|
|
39969
39984
|
return withPackageId(packageInfo, pathAndExtension);
|
|
39970
39985
|
};
|
|
39971
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
39972
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
39973
39986
|
if (rest !== "") {
|
|
39974
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
39987
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
39975
39988
|
}
|
|
39976
39989
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
39977
|
-
return (
|
|
39990
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
39978
39991
|
}
|
|
39979
39992
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
39980
39993
|
if (versionPaths) {
|
|
@@ -40090,7 +40103,8 @@ ${lanes.join("\n")}
|
|
|
40090
40103
|
conditions: [],
|
|
40091
40104
|
requestContainingDirectory: containingDirectory,
|
|
40092
40105
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40093
|
-
isConfigLookup: false
|
|
40106
|
+
isConfigLookup: false,
|
|
40107
|
+
candidateIsFromPackageJsonField: false
|
|
40094
40108
|
};
|
|
40095
40109
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
40096
40110
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -40169,7 +40183,8 @@ ${lanes.join("\n")}
|
|
|
40169
40183
|
conditions: [],
|
|
40170
40184
|
requestContainingDirectory: void 0,
|
|
40171
40185
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40172
|
-
isConfigLookup: false
|
|
40186
|
+
isConfigLookup: false,
|
|
40187
|
+
candidateIsFromPackageJsonField: false
|
|
40173
40188
|
};
|
|
40174
40189
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
40175
40190
|
4 /* Declaration */,
|
|
@@ -53064,7 +53079,17 @@ ${lanes.join("\n")}
|
|
|
53064
53079
|
}
|
|
53065
53080
|
}
|
|
53066
53081
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
53067
|
-
|
|
53082
|
+
var _a2;
|
|
53083
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
53084
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
53085
|
+
return true;
|
|
53086
|
+
}
|
|
53087
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
53088
|
+
return false;
|
|
53089
|
+
}
|
|
53090
|
+
const initializer = decl.initializer;
|
|
53091
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
53092
|
+
});
|
|
53068
53093
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
53069
53094
|
return getOuterTypeParameters(declaration);
|
|
53070
53095
|
}
|
|
@@ -64409,7 +64434,7 @@ ${lanes.join("\n")}
|
|
|
64409
64434
|
if (signature) {
|
|
64410
64435
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
64411
64436
|
if (inference.contraCandidates) {
|
|
64412
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
64437
|
+
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
|
|
64413
64438
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
64414
64439
|
} else if (inferredCovariantType) {
|
|
64415
64440
|
inferredType = inferredCovariantType;
|
|
@@ -65885,12 +65910,13 @@ ${lanes.join("\n")}
|
|
|
65885
65910
|
if (propName === void 0) {
|
|
65886
65911
|
return type;
|
|
65887
65912
|
}
|
|
65888
|
-
const
|
|
65913
|
+
const optionalChain = isOptionalChain(access);
|
|
65914
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
65889
65915
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
65890
65916
|
if (!propType) {
|
|
65891
65917
|
return type;
|
|
65892
65918
|
}
|
|
65893
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
65919
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
65894
65920
|
const narrowedPropType = narrowType2(propType);
|
|
65895
65921
|
return filterType(type, (t) => {
|
|
65896
65922
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -102777,6 +102803,9 @@ ${lanes.join("\n")}
|
|
|
102777
102803
|
case 259 /* FunctionDeclaration */:
|
|
102778
102804
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
102779
102805
|
break;
|
|
102806
|
+
case 192 /* InferType */:
|
|
102807
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
102808
|
+
break;
|
|
102780
102809
|
case 262 /* TypeAliasDeclaration */:
|
|
102781
102810
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
102782
102811
|
break;
|
|
@@ -176584,6 +176613,7 @@ ${e.message}`;
|
|
|
176584
176613
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
176585
176614
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
176586
176615
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
176616
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
176587
176617
|
isNonNullChain: () => isNonNullChain,
|
|
176588
176618
|
isNonNullExpression: () => isNonNullExpression,
|
|
176589
176619
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -179224,6 +179254,7 @@ ${e.message}`;
|
|
|
179224
179254
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
179225
179255
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
179226
179256
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
179257
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
179227
179258
|
isNonNullChain: () => isNonNullChain,
|
|
179228
179259
|
isNonNullExpression: () => isNonNullExpression,
|
|
179229
179260
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
package/lib/typescript.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20230111`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8023,6 +8023,7 @@ ${lanes.join("\n")}
|
|
|
8023
8023
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
8024
8024
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
8025
8025
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
8026
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
8026
8027
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
8027
8028
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
8028
8029
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -18397,6 +18398,10 @@ ${lanes.join("\n")}
|
|
|
18397
18398
|
return false;
|
|
18398
18399
|
}
|
|
18399
18400
|
}
|
|
18401
|
+
function isNonNullAccess(node) {
|
|
18402
|
+
const kind = node.kind;
|
|
18403
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
18404
|
+
}
|
|
18400
18405
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
18401
18406
|
var init_utilities = __esm({
|
|
18402
18407
|
"src/compiler/utilities.ts"() {
|
|
@@ -38031,7 +38036,8 @@ ${lanes.join("\n")}
|
|
|
38031
38036
|
conditions,
|
|
38032
38037
|
requestContainingDirectory: containingDirectory,
|
|
38033
38038
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
38034
|
-
isConfigLookup: false
|
|
38039
|
+
isConfigLookup: false,
|
|
38040
|
+
candidateIsFromPackageJsonField: false
|
|
38035
38041
|
};
|
|
38036
38042
|
let resolved = primaryLookup();
|
|
38037
38043
|
let primary = true;
|
|
@@ -38889,7 +38895,8 @@ ${lanes.join("\n")}
|
|
|
38889
38895
|
conditions,
|
|
38890
38896
|
requestContainingDirectory: containingDirectory,
|
|
38891
38897
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
38892
|
-
isConfigLookup
|
|
38898
|
+
isConfigLookup,
|
|
38899
|
+
candidateIsFromPackageJsonField: false
|
|
38893
38900
|
};
|
|
38894
38901
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
38895
38902
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -39112,7 +39119,7 @@ ${lanes.join("\n")}
|
|
|
39112
39119
|
}
|
|
39113
39120
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
39114
39121
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
39115
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
39122
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
39116
39123
|
}
|
|
39117
39124
|
}
|
|
39118
39125
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -39259,7 +39266,8 @@ ${lanes.join("\n")}
|
|
|
39259
39266
|
conditions: emptyArray,
|
|
39260
39267
|
requestContainingDirectory: void 0,
|
|
39261
39268
|
reportDiagnostic: noop,
|
|
39262
|
-
isConfigLookup: false
|
|
39269
|
+
isConfigLookup: false,
|
|
39270
|
+
candidateIsFromPackageJsonField: false
|
|
39263
39271
|
};
|
|
39264
39272
|
}
|
|
39265
39273
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -39347,6 +39355,8 @@ ${lanes.join("\n")}
|
|
|
39347
39355
|
}
|
|
39348
39356
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
39349
39357
|
const features = state2.features;
|
|
39358
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
39359
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
39350
39360
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
39351
39361
|
state2.features &= ~32 /* EsmMode */;
|
|
39352
39362
|
}
|
|
@@ -39359,6 +39369,7 @@ ${lanes.join("\n")}
|
|
|
39359
39369
|
false
|
|
39360
39370
|
);
|
|
39361
39371
|
state2.features = features;
|
|
39372
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
39362
39373
|
return result;
|
|
39363
39374
|
};
|
|
39364
39375
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -39432,7 +39443,10 @@ ${lanes.join("\n")}
|
|
|
39432
39443
|
return void 0;
|
|
39433
39444
|
}
|
|
39434
39445
|
const trailingParts = parts.slice(nameParts.length);
|
|
39435
|
-
|
|
39446
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
39447
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
39448
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
39449
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
39436
39450
|
}
|
|
39437
39451
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
39438
39452
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -39934,25 +39948,26 @@ ${lanes.join("\n")}
|
|
|
39934
39948
|
}
|
|
39935
39949
|
}
|
|
39936
39950
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
39937
|
-
var _a2;
|
|
39951
|
+
var _a2, _b, _c;
|
|
39938
39952
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
39953
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
39954
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
39955
|
+
let rootPackageInfo;
|
|
39939
39956
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
39940
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
39941
|
-
|
|
39942
|
-
|
|
39943
|
-
|
|
39944
|
-
return noPackageId(fromFile);
|
|
39945
|
-
}
|
|
39946
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
39947
|
-
extensions,
|
|
39948
|
-
candidate,
|
|
39949
|
-
!nodeModulesDirectoryExists,
|
|
39950
|
-
state,
|
|
39951
|
-
packageInfo.contents.packageJsonContent,
|
|
39952
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39953
|
-
);
|
|
39954
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
39957
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
39958
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
39959
|
+
if (fromFile) {
|
|
39960
|
+
return noPackageId(fromFile);
|
|
39955
39961
|
}
|
|
39962
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
39963
|
+
extensions,
|
|
39964
|
+
candidate,
|
|
39965
|
+
!nodeModulesDirectoryExists,
|
|
39966
|
+
state,
|
|
39967
|
+
packageInfo.contents.packageJsonContent,
|
|
39968
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39969
|
+
);
|
|
39970
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
39956
39971
|
}
|
|
39957
39972
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
39958
39973
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -39968,13 +39983,11 @@ ${lanes.join("\n")}
|
|
|
39968
39983
|
}
|
|
39969
39984
|
return withPackageId(packageInfo, pathAndExtension);
|
|
39970
39985
|
};
|
|
39971
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
39972
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
39973
39986
|
if (rest !== "") {
|
|
39974
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
39987
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
39975
39988
|
}
|
|
39976
39989
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
39977
|
-
return (
|
|
39990
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
39978
39991
|
}
|
|
39979
39992
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
39980
39993
|
if (versionPaths) {
|
|
@@ -40090,7 +40103,8 @@ ${lanes.join("\n")}
|
|
|
40090
40103
|
conditions: [],
|
|
40091
40104
|
requestContainingDirectory: containingDirectory,
|
|
40092
40105
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40093
|
-
isConfigLookup: false
|
|
40106
|
+
isConfigLookup: false,
|
|
40107
|
+
candidateIsFromPackageJsonField: false
|
|
40094
40108
|
};
|
|
40095
40109
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
40096
40110
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -40169,7 +40183,8 @@ ${lanes.join("\n")}
|
|
|
40169
40183
|
conditions: [],
|
|
40170
40184
|
requestContainingDirectory: void 0,
|
|
40171
40185
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40172
|
-
isConfigLookup: false
|
|
40186
|
+
isConfigLookup: false,
|
|
40187
|
+
candidateIsFromPackageJsonField: false
|
|
40173
40188
|
};
|
|
40174
40189
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
40175
40190
|
4 /* Declaration */,
|
|
@@ -53064,7 +53079,17 @@ ${lanes.join("\n")}
|
|
|
53064
53079
|
}
|
|
53065
53080
|
}
|
|
53066
53081
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
53067
|
-
|
|
53082
|
+
var _a2;
|
|
53083
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
53084
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
53085
|
+
return true;
|
|
53086
|
+
}
|
|
53087
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
53088
|
+
return false;
|
|
53089
|
+
}
|
|
53090
|
+
const initializer = decl.initializer;
|
|
53091
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
53092
|
+
});
|
|
53068
53093
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
53069
53094
|
return getOuterTypeParameters(declaration);
|
|
53070
53095
|
}
|
|
@@ -64409,7 +64434,7 @@ ${lanes.join("\n")}
|
|
|
64409
64434
|
if (signature) {
|
|
64410
64435
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
64411
64436
|
if (inference.contraCandidates) {
|
|
64412
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
64437
|
+
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
|
|
64413
64438
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
64414
64439
|
} else if (inferredCovariantType) {
|
|
64415
64440
|
inferredType = inferredCovariantType;
|
|
@@ -65885,12 +65910,13 @@ ${lanes.join("\n")}
|
|
|
65885
65910
|
if (propName === void 0) {
|
|
65886
65911
|
return type;
|
|
65887
65912
|
}
|
|
65888
|
-
const
|
|
65913
|
+
const optionalChain = isOptionalChain(access);
|
|
65914
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
65889
65915
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
65890
65916
|
if (!propType) {
|
|
65891
65917
|
return type;
|
|
65892
65918
|
}
|
|
65893
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
65919
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
65894
65920
|
const narrowedPropType = narrowType2(propType);
|
|
65895
65921
|
return filterType(type, (t) => {
|
|
65896
65922
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -102777,6 +102803,9 @@ ${lanes.join("\n")}
|
|
|
102777
102803
|
case 259 /* FunctionDeclaration */:
|
|
102778
102804
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
102779
102805
|
break;
|
|
102806
|
+
case 192 /* InferType */:
|
|
102807
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
102808
|
+
break;
|
|
102780
102809
|
case 262 /* TypeAliasDeclaration */:
|
|
102781
102810
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
102782
102811
|
break;
|
|
@@ -165751,6 +165780,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
165751
165780
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
165752
165781
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
165753
165782
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
165783
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
165754
165784
|
isNonNullChain: () => isNonNullChain,
|
|
165755
165785
|
isNonNullExpression: () => isNonNullExpression,
|
|
165756
165786
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.0";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230111`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -6207,6 +6207,7 @@ var Diagnostics = {
|
|
|
6207
6207
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
6208
6208
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
6209
6209
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
6210
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
6210
6211
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
6211
6212
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
6212
6213
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -28484,7 +28485,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
28484
28485
|
conditions,
|
|
28485
28486
|
requestContainingDirectory: containingDirectory,
|
|
28486
28487
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
28487
|
-
isConfigLookup
|
|
28488
|
+
isConfigLookup,
|
|
28489
|
+
candidateIsFromPackageJsonField: false
|
|
28488
28490
|
};
|
|
28489
28491
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
28490
28492
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -28708,7 +28710,7 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
28708
28710
|
}
|
|
28709
28711
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
28710
28712
|
const path2 = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
28711
|
-
return path2 === void 0 ? void 0 : { path: path2, ext, resolvedUsingTsExtension };
|
|
28713
|
+
return path2 === void 0 ? void 0 : { path: path2, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
28712
28714
|
}
|
|
28713
28715
|
}
|
|
28714
28716
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -28827,6 +28829,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
28827
28829
|
}
|
|
28828
28830
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
28829
28831
|
const features = state2.features;
|
|
28832
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
28833
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
28830
28834
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
28831
28835
|
state2.features &= ~32 /* EsmMode */;
|
|
28832
28836
|
}
|
|
@@ -28839,6 +28843,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
28839
28843
|
false
|
|
28840
28844
|
);
|
|
28841
28845
|
state2.features = features;
|
|
28846
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
28842
28847
|
return result;
|
|
28843
28848
|
};
|
|
28844
28849
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -28912,7 +28917,10 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
|
|
|
28912
28917
|
return void 0;
|
|
28913
28918
|
}
|
|
28914
28919
|
const trailingParts = parts.slice(nameParts.length);
|
|
28915
|
-
|
|
28920
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
28921
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
28922
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
28923
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
28916
28924
|
}
|
|
28917
28925
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
28918
28926
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -29414,25 +29422,26 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
29414
29422
|
}
|
|
29415
29423
|
}
|
|
29416
29424
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
29417
|
-
var _a2;
|
|
29425
|
+
var _a2, _b, _c;
|
|
29418
29426
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
29427
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
29428
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
29429
|
+
let rootPackageInfo;
|
|
29419
29430
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
29420
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
29421
|
-
|
|
29422
|
-
|
|
29423
|
-
|
|
29424
|
-
return noPackageId(fromFile);
|
|
29425
|
-
}
|
|
29426
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
29427
|
-
extensions,
|
|
29428
|
-
candidate,
|
|
29429
|
-
!nodeModulesDirectoryExists,
|
|
29430
|
-
state,
|
|
29431
|
-
packageInfo.contents.packageJsonContent,
|
|
29432
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
29433
|
-
);
|
|
29434
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
29431
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
29432
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
29433
|
+
if (fromFile) {
|
|
29434
|
+
return noPackageId(fromFile);
|
|
29435
29435
|
}
|
|
29436
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
29437
|
+
extensions,
|
|
29438
|
+
candidate,
|
|
29439
|
+
!nodeModulesDirectoryExists,
|
|
29440
|
+
state,
|
|
29441
|
+
packageInfo.contents.packageJsonContent,
|
|
29442
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
29443
|
+
);
|
|
29444
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
29436
29445
|
}
|
|
29437
29446
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
29438
29447
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -29448,13 +29457,11 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
29448
29457
|
}
|
|
29449
29458
|
return withPackageId(packageInfo, pathAndExtension);
|
|
29450
29459
|
};
|
|
29451
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
29452
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
29453
29460
|
if (rest !== "") {
|
|
29454
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
29461
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
29455
29462
|
}
|
|
29456
29463
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
29457
|
-
return (
|
|
29464
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
29458
29465
|
}
|
|
29459
29466
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
29460
29467
|
if (versionPaths) {
|
|
@@ -29558,7 +29565,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
29558
29565
|
conditions: [],
|
|
29559
29566
|
requestContainingDirectory: containingDirectory,
|
|
29560
29567
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
29561
|
-
isConfigLookup: false
|
|
29568
|
+
isConfigLookup: false,
|
|
29569
|
+
candidateIsFromPackageJsonField: false
|
|
29562
29570
|
};
|
|
29563
29571
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
29564
29572
|
return createResolvedModuleWithFailedLookupLocations(
|
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.20230111",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|