@@ -2199,6 +2199,8 @@ var ts;
2199
2199
return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs;
2200
2200
}
2201
2201
ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile;
2202
+ function assertTypeIsNever(_) { }
2203
+ ts.assertTypeIsNever = assertTypeIsNever;
2202
2204
})(ts || (ts = {}));
2203
2205
var ts;
2204
2206
(function (ts) {
@@ -18064,17 +18066,20 @@ var ts;
18064
18066
return ts.combinePaths(directory, "package.json");
18065
18067
}
18066
18068
function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) {
18067
- var _a = getNameOfTopDirectory (moduleName), top = _a.top , rest = _a.rest;
18068
- var packageRootPath = ts.combinePaths(nodeModulesFolder, top );
18069
+ var _a = getPackageName (moduleName), packageName = _a.packageName , rest = _a.rest;
18070
+ var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName );
18069
18071
var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId;
18070
18072
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName));
18071
18073
var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) ||
18072
18074
loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent);
18073
18075
return withPackageId(packageId, pathAndExtension);
18074
18076
}
18075
- function getNameOfTopDirectory(name) {
18076
- var idx = name.indexOf(ts.directorySeparator);
18077
- return idx === -1 ? { top: name, rest: "" } : { top: name.slice(0, idx), rest: name.slice(idx + 1) };
18077
+ function getPackageName(moduleName) {
18078
+ var idx = moduleName.indexOf(ts.directorySeparator);
18079
+ if (moduleName[0] === "@") {
18080
+ idx = moduleName.indexOf(ts.directorySeparator, idx + 1);
18081
+ }
18082
+ return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
18078
18083
}
18079
18084
function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) {
18080
18085
return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache);
0 commit comments