diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 86e0157d847..f37b8ed1a19 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -14,6 +14,11 @@ namespace ts { return compilerOptions.traceResolution && host.trace !== undefined; } + /** Array that is only intended to be pushed to, never read. */ + interface Push { + push(value: T): void; + } + /** * Result of trying to resolve a module. * At least one of `ts` and `js` should be defined, or the whole thing should be `undefined`. @@ -62,8 +67,7 @@ namespace ts { interface ModuleResolutionState { host: ModuleResolutionHost; - // We only use this subset of the compiler options. - compilerOptions: { rootDirs?: string[], baseUrl?: string, paths?: MapLike }; + compilerOptions: CompilerOptions; traceEnabled: boolean; } @@ -128,7 +132,9 @@ namespace ts { currentDirectory = host.getCurrentDirectory(); } - return currentDirectory !== undefined && getDefaultTypeRoots(currentDirectory, host); + if (currentDirectory !== undefined) { + return getDefaultTypeRoots(currentDirectory, host); + } } /** @@ -142,20 +148,12 @@ namespace ts { } let typeRoots: string[]; - - while (true) { - const atTypes = combinePaths(currentDirectory, nodeModulesAtTypes); + forEachAncestorDirectory(currentDirectory, directory => { + const atTypes = combinePaths(directory, nodeModulesAtTypes); if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } - - const parent = getDirectoryPath(currentDirectory); - if (parent === currentDirectory) { - break; - } - currentDirectory = parent; - } - + }); return typeRoots; } const nodeModulesAtTypes = combinePaths("node_modules", "@types"); @@ -233,7 +231,7 @@ namespace ts { if (traceEnabled) { trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*checkOneLevel*/ false)); + resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); if (traceEnabled) { if (resolvedFile) { trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); @@ -341,7 +339,7 @@ namespace ts { * 'typings' entry or file 'index' with some supported extension * - Classic loader will only try to interpret '/a/b/c' as file. */ - type ResolutionKindSpecificLoader = (extensions: Extensions, candidate: string, failedLookupLocations: string[], onlyRecordFailures: boolean, state: ModuleResolutionState) => Resolved | undefined; + type ResolutionKindSpecificLoader = (extensions: Extensions, candidate: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState) => Resolved | undefined; /** * Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to @@ -404,7 +402,7 @@ namespace ts { * entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location. */ function tryLoadModuleUsingOptionalResolutionSettings(extensions: Extensions, moduleName: string, containingDirectory: string, loader: ResolutionKindSpecificLoader, - failedLookupLocations: string[], state: ModuleResolutionState): Resolved | undefined { + failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { if (moduleHasNonRelativeName(moduleName)) { return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state); @@ -415,7 +413,7 @@ namespace ts { } function tryLoadModuleUsingRootDirs(extensions: Extensions, moduleName: string, containingDirectory: string, loader: ResolutionKindSpecificLoader, - failedLookupLocations: string[], state: ModuleResolutionState): Resolved | undefined { + failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { if (!state.compilerOptions.rootDirs) { return undefined; @@ -491,7 +489,7 @@ namespace ts { return undefined; } - function tryLoadModuleUsingBaseUrl(extensions: Extensions, moduleName: string, loader: ResolutionKindSpecificLoader, failedLookupLocations: string[], state: ModuleResolutionState): Resolved | undefined { + function tryLoadModuleUsingBaseUrl(extensions: Extensions, moduleName: string, loader: ResolutionKindSpecificLoader, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { if (!state.compilerOptions.baseUrl) { return undefined; } @@ -562,7 +560,7 @@ namespace ts { if (traceEnabled) { trace(host, Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); } - const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, /*checkOneLevel*/ false); + const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); return resolved && { resolved, isExternalLibraryImport: true }; } else { @@ -585,7 +583,7 @@ namespace ts { return { path: real, extension: resolved.extension }; } - function nodeLoadModuleByRelativeName(extensions: Extensions, candidate: string, failedLookupLocations: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { + function nodeLoadModuleByRelativeName(extensions: Extensions, candidate: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { if (state.traceEnabled) { trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); } @@ -604,7 +602,7 @@ namespace ts { * @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary * in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations. */ - function loadModuleFromFile(extensions: Extensions, candidate: string, failedLookupLocations: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { + function loadModuleFromFile(extensions: Extensions, candidate: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { // First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts" const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); if (resolvedByAddingExtension) { @@ -624,7 +622,7 @@ namespace ts { } /** Try to return an existing file that adds one of the `extensions` to `candidate`. */ - function tryAddingExtensions(candidate: string, extensions: Extensions, failedLookupLocations: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { + function tryAddingExtensions(candidate: string, extensions: Extensions, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { if (!onlyRecordFailures) { // check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing const directory = getDirectoryPath(candidate); @@ -649,7 +647,7 @@ namespace ts { } /** Return the file if it exists. */ - function tryFile(fileName: string, failedLookupLocation: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): string | undefined { + function tryFile(fileName: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): string | undefined { if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (state.traceEnabled) { trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); @@ -660,12 +658,12 @@ namespace ts { if (state.traceEnabled) { trace(state.host, Diagnostics.File_0_does_not_exist, fileName); } - failedLookupLocation.push(fileName); + failedLookupLocations.push(fileName); return undefined; } } - function loadNodeModuleFromDirectory(extensions: Extensions, candidate: string, failedLookupLocation: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { + function loadNodeModuleFromDirectory(extensions: Extensions, candidate: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { const packageJsonPath = pathToPackageJson(candidate); const directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); @@ -677,12 +675,12 @@ namespace ts { if (typesFile) { const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(typesFile), state.host); // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - const fromFile = tryFile(typesFile, failedLookupLocation, onlyRecordFailures, state); + const fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures, state); if (fromFile) { // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden. return resolvedFromAnyFile(fromFile); } - const x = tryAddingExtensions(typesFile, Extensions.TypeScript, failedLookupLocation, onlyRecordFailures, state); + const x = tryAddingExtensions(typesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state); if (x) { return x; } @@ -698,17 +696,17 @@ namespace ts { trace(state.host, Diagnostics.File_0_does_not_exist, packageJsonPath); } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results - failedLookupLocation.push(packageJsonPath); + failedLookupLocations.push(packageJsonPath); } - return loadModuleFromFile(extensions, combinePaths(candidate, "index"), failedLookupLocation, !directoryExists, state); + return loadModuleFromFile(extensions, combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } function pathToPackageJson(directory: string): string { return combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState): Resolved | undefined { + function loadModuleFromNodeModulesFolder(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { const nodeModulesFolder = combinePaths(directory, "node_modules"); const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); const candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); @@ -717,34 +715,30 @@ namespace ts { loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState, checkOneLevel: boolean): Resolved | undefined { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, checkOneLevel, /*typesOnly*/ false); + function loadModuleFromNodeModules(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false); } - function loadModuleFromNodeModulesAtTypes(moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState): Resolved | undefined { - return loadModuleFromNodeModulesWorker(Extensions.TypeScript, moduleName, directory, failedLookupLocations, state, /*checkOneLevel*/ false, /*typesOnly*/ true); + function loadModuleFromNodeModulesAtTypes(moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { + // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true); } - function loadModuleFromNodeModulesWorker(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState, checkOneLevel: boolean, typesOnly: boolean): Resolved | undefined { - directory = normalizeSlashes(directory); - while (true) { - if (getBaseFileName(directory) !== "node_modules") { - const resolved = tryInDirectory(); - if (resolved) { - return resolved; - } + function loadModuleFromNodeModulesWorker(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState, typesOnly: boolean): Resolved | undefined { + return forEachAncestorDirectory(normalizeSlashes(directory), ancestorDirectory => { + if (getBaseFileName(ancestorDirectory) !== "node_modules") { + return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); } + }); + } - const parentPath = getDirectoryPath(directory); - if (parentPath === directory || checkOneLevel) { - return undefined; - } - - directory = parentPath; + /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ + function loadModuleFromNodeModulesOneLevel(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState, typesOnly = false): Resolved | undefined { + const packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + if (packageResult) { + return packageResult; } - - function tryInDirectory(): Resolved | undefined { - const packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); - return packageResult || loadModuleFromNodeModulesFolder(extensions, combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, combinePaths("@types", moduleName), directory, failedLookupLocations, state); } } @@ -764,7 +758,11 @@ namespace ts { } if (moduleHasNonRelativeName(moduleName)) { - const resolved = loadModuleFromAncestorDirectories(extensions, moduleName, containingDirectory, failedLookupLocations, state); + // Climb up parent directories looking for a module. + const resolved = forEachAncestorDirectory(containingDirectory, directory => { + const searchName = normalizePath(combinePaths(directory, moduleName)); + return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); + }); if (resolved) { return resolved; } @@ -780,22 +778,6 @@ namespace ts { } } - /** Climb up parent directories looking for a module. */ - function loadModuleFromAncestorDirectories(extensions: Extensions, moduleName: string, containingDirectory: string, failedLookupLocations: string[], state: ModuleResolutionState): Resolved | undefined { - while (true) { - const searchName = normalizePath(combinePaths(containingDirectory, moduleName)); - const referencedSourceFile = loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); - if (referencedSourceFile) { - return referencedSourceFile; - } - const parentPath = getDirectoryPath(containingDirectory); - if (parentPath === containingDirectory) { - return undefined; - } - containingDirectory = parentPath; - } - } - /** * LSHost may load a module from a global cache of typings. * This is the minumum code needed to expose that functionality; the rest is in LSHost. @@ -808,8 +790,24 @@ namespace ts { } const state: ModuleResolutionState = { compilerOptions, host, traceEnabled }; const failedLookupLocations: string[] = []; - const resolved = loadModuleFromNodeModules(Extensions.TypeScript, moduleName, globalCache, failedLookupLocations, state, /*checkOneLevel*/ true) || - loadModuleFromNodeModules(Extensions.JavaScript, moduleName, globalCache, failedLookupLocations, state, /*checkOneLevel*/ true); + const resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); } + + /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ + function forEachAncestorDirectory(directory: string, callback: (directory: string) => T | undefined): T | undefined { + while (true) { + const result = callback(directory); + if (result !== undefined) { + return result; + } + + const parentPath = getDirectoryPath(directory); + if (parentPath === directory) { + return undefined; + } + + directory = parentPath; + } + } } \ No newline at end of file diff --git a/src/harness/unittests/moduleResolution.ts b/src/harness/unittests/moduleResolution.ts index 0e391445eba..35313e15308 100644 --- a/src/harness/unittests/moduleResolution.ts +++ b/src/harness/unittests/moduleResolution.ts @@ -197,13 +197,9 @@ namespace ts { "/a/b/c/d/node_modules/foo/index.tsx", "/a/b/c/d/node_modules/foo/index.d.ts", - "/a/b/c/d/node_modules/@types/foo.ts", - "/a/b/c/d/node_modules/@types/foo.tsx", "/a/b/c/d/node_modules/@types/foo.d.ts", "/a/b/c/d/node_modules/@types/foo/package.json", - "/a/b/c/d/node_modules/@types/foo/index.ts", - "/a/b/c/d/node_modules/@types/foo/index.tsx", "/a/b/c/d/node_modules/@types/foo/index.d.ts", "/a/b/c/node_modules/foo.ts", @@ -215,13 +211,9 @@ namespace ts { "/a/b/c/node_modules/foo/index.tsx", "/a/b/c/node_modules/foo/index.d.ts", - "/a/b/c/node_modules/@types/foo.ts", - "/a/b/c/node_modules/@types/foo.tsx", "/a/b/c/node_modules/@types/foo.d.ts", "/a/b/c/node_modules/@types/foo/package.json", - "/a/b/c/node_modules/@types/foo/index.ts", - "/a/b/c/node_modules/@types/foo/index.tsx", "/a/b/c/node_modules/@types/foo/index.d.ts", ]); } @@ -257,13 +249,9 @@ namespace ts { "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.d.ts", "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/package.json", - "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.ts", - "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.d.ts", "/a/node_modules/b/c/node_modules/foo.ts", @@ -275,13 +263,9 @@ namespace ts { "/a/node_modules/b/c/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/foo/index.d.ts", - "/a/node_modules/b/c/node_modules/@types/foo.ts", - "/a/node_modules/b/c/node_modules/@types/foo.tsx", "/a/node_modules/b/c/node_modules/@types/foo.d.ts", "/a/node_modules/b/c/node_modules/@types/foo/package.json", - "/a/node_modules/b/c/node_modules/@types/foo/index.ts", - "/a/node_modules/b/c/node_modules/@types/foo/index.tsx", "/a/node_modules/b/c/node_modules/@types/foo/index.d.ts", "/a/node_modules/b/node_modules/foo.ts", @@ -293,13 +277,9 @@ namespace ts { "/a/node_modules/b/node_modules/foo/index.tsx", "/a/node_modules/b/node_modules/foo/index.d.ts", - "/a/node_modules/b/node_modules/@types/foo.ts", - "/a/node_modules/b/node_modules/@types/foo.tsx", "/a/node_modules/b/node_modules/@types/foo.d.ts", "/a/node_modules/b/node_modules/@types/foo/package.json", - "/a/node_modules/b/node_modules/@types/foo/index.ts", - "/a/node_modules/b/node_modules/@types/foo/index.tsx", "/a/node_modules/b/node_modules/@types/foo/index.d.ts", "/a/node_modules/foo.ts", @@ -709,13 +689,9 @@ import b = require("./moduleB"); "/root/folder1/node_modules/file6/index.tsx", "/root/folder1/node_modules/file6/index.d.ts", - "/root/folder1/node_modules/@types/file6.ts", - "/root/folder1/node_modules/@types/file6.tsx", "/root/folder1/node_modules/@types/file6.d.ts", "/root/folder1/node_modules/@types/file6/package.json", - "/root/folder1/node_modules/@types/file6/index.ts", - "/root/folder1/node_modules/@types/file6/index.tsx", "/root/folder1/node_modules/@types/file6/index.d.ts", // success on /root/node_modules/file6.ts ], /*isExternalLibraryImport*/ true); diff --git a/src/harness/unittests/reuseProgramStructure.ts b/src/harness/unittests/reuseProgramStructure.ts index 386e02e2450..6dbd74e71d2 100644 --- a/src/harness/unittests/reuseProgramStructure.ts +++ b/src/harness/unittests/reuseProgramStructure.ts @@ -394,26 +394,14 @@ namespace ts { "File '/fs.ts' does not exist.", "File '/fs.tsx' does not exist.", "File '/fs.d.ts' does not exist.", - "File '/a/b/node_modules/@types/fs.ts' does not exist.", - "File '/a/b/node_modules/@types/fs.tsx' does not exist.", "File '/a/b/node_modules/@types/fs.d.ts' does not exist.", "File '/a/b/node_modules/@types/fs/package.json' does not exist.", - "File '/a/b/node_modules/@types/fs/index.ts' does not exist.", - "File '/a/b/node_modules/@types/fs/index.tsx' does not exist.", "File '/a/b/node_modules/@types/fs/index.d.ts' does not exist.", - "File '/a/node_modules/@types/fs.ts' does not exist.", - "File '/a/node_modules/@types/fs.tsx' does not exist.", "File '/a/node_modules/@types/fs.d.ts' does not exist.", "File '/a/node_modules/@types/fs/package.json' does not exist.", - "File '/a/node_modules/@types/fs/index.ts' does not exist.", - "File '/a/node_modules/@types/fs/index.tsx' does not exist.", "File '/a/node_modules/@types/fs/index.d.ts' does not exist.", - "File '/node_modules/@types/fs.ts' does not exist.", - "File '/node_modules/@types/fs.tsx' does not exist.", "File '/node_modules/@types/fs.d.ts' does not exist.", "File '/node_modules/@types/fs/package.json' does not exist.", - "File '/node_modules/@types/fs/index.ts' does not exist.", - "File '/node_modules/@types/fs/index.tsx' does not exist.", "File '/node_modules/@types/fs/index.d.ts' does not exist.", "File '/a/b/fs.js' does not exist.", "File '/a/b/fs.jsx' does not exist.", @@ -448,26 +436,14 @@ namespace ts { "File '/fs.ts' does not exist.", "File '/fs.tsx' does not exist.", "File '/fs.d.ts' does not exist.", - "File '/a/b/node_modules/@types/fs.ts' does not exist.", - "File '/a/b/node_modules/@types/fs.tsx' does not exist.", "File '/a/b/node_modules/@types/fs.d.ts' does not exist.", "File '/a/b/node_modules/@types/fs/package.json' does not exist.", - "File '/a/b/node_modules/@types/fs/index.ts' does not exist.", - "File '/a/b/node_modules/@types/fs/index.tsx' does not exist.", "File '/a/b/node_modules/@types/fs/index.d.ts' does not exist.", - "File '/a/node_modules/@types/fs.ts' does not exist.", - "File '/a/node_modules/@types/fs.tsx' does not exist.", "File '/a/node_modules/@types/fs.d.ts' does not exist.", "File '/a/node_modules/@types/fs/package.json' does not exist.", - "File '/a/node_modules/@types/fs/index.ts' does not exist.", - "File '/a/node_modules/@types/fs/index.tsx' does not exist.", "File '/a/node_modules/@types/fs/index.d.ts' does not exist.", - "File '/node_modules/@types/fs.ts' does not exist.", - "File '/node_modules/@types/fs.tsx' does not exist.", "File '/node_modules/@types/fs.d.ts' does not exist.", "File '/node_modules/@types/fs/package.json' does not exist.", - "File '/node_modules/@types/fs/index.ts' does not exist.", - "File '/node_modules/@types/fs/index.tsx' does not exist.", "File '/node_modules/@types/fs/index.d.ts' does not exist.", "File '/a/b/fs.js' does not exist.", "File '/a/b/fs.jsx' does not exist.", diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 7986137ca43..9c3c7a4cd5b 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1662,12 +1662,8 @@ namespace ts.projectSystem { "File '/a/b/node_modules/lib/index.ts' does not exist.", "File '/a/b/node_modules/lib/index.tsx' does not exist.", "File '/a/b/node_modules/lib/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/lib.ts' does not exist.", - "File '/a/b/node_modules/@types/lib.tsx' does not exist.", "File '/a/b/node_modules/@types/lib.d.ts' does not exist.", "File '/a/b/node_modules/@types/lib/package.json' does not exist.", - "File '/a/b/node_modules/@types/lib/index.ts' does not exist.", - "File '/a/b/node_modules/@types/lib/index.tsx' does not exist.", "File '/a/b/node_modules/@types/lib/index.d.ts' does not exist.", "File '/a/node_modules/lib.ts' does not exist.", "File '/a/node_modules/lib.tsx' does not exist.", @@ -1676,12 +1672,8 @@ namespace ts.projectSystem { "File '/a/node_modules/lib/index.ts' does not exist.", "File '/a/node_modules/lib/index.tsx' does not exist.", "File '/a/node_modules/lib/index.d.ts' does not exist.", - "File '/a/node_modules/@types/lib.ts' does not exist.", - "File '/a/node_modules/@types/lib.tsx' does not exist.", "File '/a/node_modules/@types/lib.d.ts' does not exist.", "File '/a/node_modules/@types/lib/package.json' does not exist.", - "File '/a/node_modules/@types/lib/index.ts' does not exist.", - "File '/a/node_modules/@types/lib/index.tsx' does not exist.", "File '/a/node_modules/@types/lib/index.d.ts' does not exist.", "File '/node_modules/lib.ts' does not exist.", "File '/node_modules/lib.tsx' does not exist.", @@ -1690,12 +1682,8 @@ namespace ts.projectSystem { "File '/node_modules/lib/index.ts' does not exist.", "File '/node_modules/lib/index.tsx' does not exist.", "File '/node_modules/lib/index.d.ts' does not exist.", - "File '/node_modules/@types/lib.ts' does not exist.", - "File '/node_modules/@types/lib.tsx' does not exist.", "File '/node_modules/@types/lib.d.ts' does not exist.", "File '/node_modules/@types/lib/package.json' does not exist.", - "File '/node_modules/@types/lib/index.ts' does not exist.", - "File '/node_modules/@types/lib/index.tsx' does not exist.", "File '/node_modules/@types/lib/index.d.ts' does not exist.", "Loading module 'lib' from 'node_modules' folder.", "File '/a/b/node_modules/lib.js' does not exist.", @@ -1703,46 +1691,23 @@ namespace ts.projectSystem { "File '/a/b/node_modules/lib/package.json' does not exist.", "File '/a/b/node_modules/lib/index.js' does not exist.", "File '/a/b/node_modules/lib/index.jsx' does not exist.", - "File '/a/b/node_modules/@types/lib.js' does not exist.", - "File '/a/b/node_modules/@types/lib.jsx' does not exist.", - "File '/a/b/node_modules/@types/lib/package.json' does not exist.", - "File '/a/b/node_modules/@types/lib/index.js' does not exist.", - "File '/a/b/node_modules/@types/lib/index.jsx' does not exist.", "File '/a/node_modules/lib.js' does not exist.", "File '/a/node_modules/lib.jsx' does not exist.", "File '/a/node_modules/lib/package.json' does not exist.", "File '/a/node_modules/lib/index.js' does not exist.", "File '/a/node_modules/lib/index.jsx' does not exist.", - "File '/a/node_modules/@types/lib.js' does not exist.", - "File '/a/node_modules/@types/lib.jsx' does not exist.", - "File '/a/node_modules/@types/lib/package.json' does not exist.", - "File '/a/node_modules/@types/lib/index.js' does not exist.", - "File '/a/node_modules/@types/lib/index.jsx' does not exist.", "File '/node_modules/lib.js' does not exist.", "File '/node_modules/lib.jsx' does not exist.", "File '/node_modules/lib/package.json' does not exist.", "File '/node_modules/lib/index.js' does not exist.", "File '/node_modules/lib/index.jsx' does not exist.", - "File '/node_modules/@types/lib.js' does not exist.", - "File '/node_modules/@types/lib.jsx' does not exist.", - "File '/node_modules/@types/lib/package.json' does not exist.", - "File '/node_modules/@types/lib/index.js' does not exist.", - "File '/node_modules/@types/lib/index.jsx' does not exist.", "======== Module name 'lib' was not resolved. ========", `Auto discovery for typings is enabled in project '${proj.getProjectName()}'. Running extra resolution pass for module 'lib' using cache location '/a/cache'.`, - "File '/a/cache/node_modules/lib.ts' does not exist.", - "File '/a/cache/node_modules/lib.tsx' does not exist.", "File '/a/cache/node_modules/lib.d.ts' does not exist.", "File '/a/cache/node_modules/lib/package.json' does not exist.", - "File '/a/cache/node_modules/lib/index.ts' does not exist.", - "File '/a/cache/node_modules/lib/index.tsx' does not exist.", "File '/a/cache/node_modules/lib/index.d.ts' does not exist.", - "File '/a/cache/node_modules/@types/lib.ts' does not exist.", - "File '/a/cache/node_modules/@types/lib.tsx' does not exist.", "File '/a/cache/node_modules/@types/lib.d.ts' does not exist.", "File '/a/cache/node_modules/@types/lib/package.json' does not exist.", - "File '/a/cache/node_modules/@types/lib/index.ts' does not exist.", - "File '/a/cache/node_modules/@types/lib/index.tsx' does not exist.", "File '/a/cache/node_modules/@types/lib/index.d.ts' exist - use it as a name resolution result.", ]); checkProjectActualFiles(proj, [file1.path, lib.path]); diff --git a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json index 3a9d8c4ea79..f6df1476088 100644 --- a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json +++ b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json @@ -9,12 +9,8 @@ "File '/node_modules/shortid/index.ts' does not exist.", "File '/node_modules/shortid/index.tsx' does not exist.", "File '/node_modules/shortid/index.d.ts' does not exist.", - "File '/node_modules/@types/shortid.ts' does not exist.", - "File '/node_modules/@types/shortid.tsx' does not exist.", "File '/node_modules/@types/shortid.d.ts' does not exist.", "File '/node_modules/@types/shortid/package.json' does not exist.", - "File '/node_modules/@types/shortid/index.ts' does not exist.", - "File '/node_modules/@types/shortid/index.tsx' does not exist.", "File '/node_modules/@types/shortid/index.d.ts' does not exist.", "Loading module 'shortid' from 'node_modules' folder.", "File '/node_modules/shortid.js' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json index 9c6d96fc190..8d4217a92bd 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json @@ -9,12 +9,8 @@ "File '/node_modules/js/index.ts' does not exist.", "File '/node_modules/js/index.tsx' does not exist.", "File '/node_modules/js/index.d.ts' does not exist.", - "File '/node_modules/@types/js.ts' does not exist.", - "File '/node_modules/@types/js.tsx' does not exist.", "File '/node_modules/@types/js.d.ts' does not exist.", "File '/node_modules/@types/js/package.json' does not exist.", - "File '/node_modules/@types/js/index.ts' does not exist.", - "File '/node_modules/@types/js/index.tsx' does not exist.", "File '/node_modules/@types/js/index.d.ts' does not exist.", "Loading module 'js' from 'node_modules' folder.", "File '/node_modules/js.js' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json index ab7210d7d02..f468d864eef 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json @@ -33,12 +33,8 @@ "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.", "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.", "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/root/node_modules/file4.ts' does not exist.", "File 'c:/root/node_modules/file4.tsx' does not exist.", @@ -47,12 +43,8 @@ "File 'c:/root/node_modules/file4/index.ts' does not exist.", "File 'c:/root/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/node_modules/file4.ts' does not exist.", "File 'c:/node_modules/file4.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json index ab7210d7d02..f468d864eef 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json @@ -33,12 +33,8 @@ "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.", "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.", "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/root/node_modules/file4.ts' does not exist.", "File 'c:/root/node_modules/file4.tsx' does not exist.", @@ -47,12 +43,8 @@ "File 'c:/root/node_modules/file4/index.ts' does not exist.", "File 'c:/root/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/node_modules/file4.ts' does not exist.", "File 'c:/node_modules/file4.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json index 2efeefa24e5..92a98a1067c 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json @@ -75,12 +75,8 @@ "File 'c:/root/folder1/node_modules/file4/index.ts' does not exist.", "File 'c:/root/folder1/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/folder1/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4.ts' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4.tsx' does not exist.", "File 'c:/root/folder1/node_modules/@types/file4.d.ts' does not exist.", "File 'c:/root/folder1/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4/index.ts' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4/index.tsx' does not exist.", "File 'c:/root/folder1/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/root/node_modules/file4.ts' does not exist.", "File 'c:/root/node_modules/file4.tsx' does not exist.", @@ -89,12 +85,8 @@ "File 'c:/root/node_modules/file4/index.ts' does not exist.", "File 'c:/root/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/node_modules/file4.ts' exist - use it as a name resolution result.", "Resolving real path for 'c:/node_modules/file4.ts', result 'c:/node_modules/file4.ts'", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json index 48633c85e3b..cc33d8d1c37 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json @@ -51,12 +51,8 @@ "File 'c:/root/src/node_modules/module3/index.ts' does not exist.", "File 'c:/root/src/node_modules/module3/index.tsx' does not exist.", "File 'c:/root/src/node_modules/module3/index.d.ts' does not exist.", - "File 'c:/root/src/node_modules/@types/module3.ts' does not exist.", - "File 'c:/root/src/node_modules/@types/module3.tsx' does not exist.", "File 'c:/root/src/node_modules/@types/module3.d.ts' does not exist.", "File 'c:/root/src/node_modules/@types/module3/package.json' does not exist.", - "File 'c:/root/src/node_modules/@types/module3/index.ts' does not exist.", - "File 'c:/root/src/node_modules/@types/module3/index.tsx' does not exist.", "File 'c:/root/src/node_modules/@types/module3/index.d.ts' does not exist.", "File 'c:/root/node_modules/module3.ts' does not exist.", "File 'c:/root/node_modules/module3.tsx' does not exist.", @@ -65,12 +61,8 @@ "File 'c:/root/node_modules/module3/index.ts' does not exist.", "File 'c:/root/node_modules/module3/index.tsx' does not exist.", "File 'c:/root/node_modules/module3/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/module3.ts' does not exist.", - "File 'c:/root/node_modules/@types/module3.tsx' does not exist.", "File 'c:/root/node_modules/@types/module3.d.ts' does not exist.", "File 'c:/root/node_modules/@types/module3/package.json' does not exist.", - "File 'c:/root/node_modules/@types/module3/index.ts' does not exist.", - "File 'c:/root/node_modules/@types/module3/index.tsx' does not exist.", "File 'c:/root/node_modules/@types/module3/index.d.ts' does not exist.", "File 'c:/node_modules/module3.ts' does not exist.", "File 'c:/node_modules/module3.tsx' does not exist.", diff --git a/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json b/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json index eec78e40192..2befbbde729 100644 --- a/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json +++ b/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json @@ -9,12 +9,8 @@ "File '/foo/bar/node_modules/xyz/index.ts' does not exist.", "File '/foo/bar/node_modules/xyz/index.tsx' does not exist.", "File '/foo/bar/node_modules/xyz/index.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/xyz.ts' does not exist.", - "File '/foo/bar/node_modules/@types/xyz.tsx' does not exist.", "File '/foo/bar/node_modules/@types/xyz.d.ts' does not exist.", "File '/foo/bar/node_modules/@types/xyz/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/index.ts' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/index.tsx' does not exist.", "File '/foo/bar/node_modules/@types/xyz/index.d.ts' does not exist.", "File '/foo/node_modules/xyz.ts' does not exist.", "File '/foo/node_modules/xyz.tsx' does not exist.", @@ -23,12 +19,8 @@ "File '/foo/node_modules/xyz/index.ts' does not exist.", "File '/foo/node_modules/xyz/index.tsx' does not exist.", "File '/foo/node_modules/xyz/index.d.ts' does not exist.", - "File '/foo/node_modules/@types/xyz.ts' does not exist.", - "File '/foo/node_modules/@types/xyz.tsx' does not exist.", "File '/foo/node_modules/@types/xyz.d.ts' does not exist.", "File '/foo/node_modules/@types/xyz/package.json' does not exist.", - "File '/foo/node_modules/@types/xyz/index.ts' does not exist.", - "File '/foo/node_modules/@types/xyz/index.tsx' does not exist.", "File '/foo/node_modules/@types/xyz/index.d.ts' does not exist.", "File '/node_modules/xyz.ts' does not exist.", "File '/node_modules/xyz.tsx' does not exist.", @@ -37,12 +29,8 @@ "File '/node_modules/xyz/index.ts' does not exist.", "File '/node_modules/xyz/index.tsx' does not exist.", "File '/node_modules/xyz/index.d.ts' does not exist.", - "File '/node_modules/@types/xyz.ts' does not exist.", - "File '/node_modules/@types/xyz.tsx' does not exist.", "File '/node_modules/@types/xyz.d.ts' does not exist.", "File '/node_modules/@types/xyz/package.json' does not exist.", - "File '/node_modules/@types/xyz/index.ts' does not exist.", - "File '/node_modules/@types/xyz/index.tsx' does not exist.", "File '/node_modules/@types/xyz/index.d.ts' does not exist.", "Loading module 'xyz' from 'node_modules' folder.", "File '/foo/bar/node_modules/xyz.js' does not exist.", @@ -50,31 +38,16 @@ "File '/foo/bar/node_modules/xyz/package.json' does not exist.", "File '/foo/bar/node_modules/xyz/index.js' does not exist.", "File '/foo/bar/node_modules/xyz/index.jsx' does not exist.", - "File '/foo/bar/node_modules/@types/xyz.js' does not exist.", - "File '/foo/bar/node_modules/@types/xyz.jsx' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/index.js' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/index.jsx' does not exist.", "File '/foo/node_modules/xyz.js' does not exist.", "File '/foo/node_modules/xyz.jsx' does not exist.", "File '/foo/node_modules/xyz/package.json' does not exist.", "File '/foo/node_modules/xyz/index.js' does not exist.", "File '/foo/node_modules/xyz/index.jsx' does not exist.", - "File '/foo/node_modules/@types/xyz.js' does not exist.", - "File '/foo/node_modules/@types/xyz.jsx' does not exist.", - "File '/foo/node_modules/@types/xyz/package.json' does not exist.", - "File '/foo/node_modules/@types/xyz/index.js' does not exist.", - "File '/foo/node_modules/@types/xyz/index.jsx' does not exist.", "File '/node_modules/xyz.js' does not exist.", "File '/node_modules/xyz.jsx' does not exist.", "File '/node_modules/xyz/package.json' does not exist.", "File '/node_modules/xyz/index.js' does not exist.", "File '/node_modules/xyz/index.jsx' does not exist.", - "File '/node_modules/@types/xyz.js' does not exist.", - "File '/node_modules/@types/xyz.jsx' does not exist.", - "File '/node_modules/@types/xyz/package.json' does not exist.", - "File '/node_modules/@types/xyz/index.js' does not exist.", - "File '/node_modules/@types/xyz/index.jsx' does not exist.", "======== Module name 'xyz' was not resolved. ========", "======== Resolving module 'pdq' from '/foo/bar/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -86,12 +59,8 @@ "File '/foo/bar/node_modules/pdq/index.ts' does not exist.", "File '/foo/bar/node_modules/pdq/index.tsx' does not exist.", "File '/foo/bar/node_modules/pdq/index.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/pdq.ts' does not exist.", - "File '/foo/bar/node_modules/@types/pdq.tsx' does not exist.", "File '/foo/bar/node_modules/@types/pdq.d.ts' does not exist.", "File '/foo/bar/node_modules/@types/pdq/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/index.ts' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/index.tsx' does not exist.", "File '/foo/bar/node_modules/@types/pdq/index.d.ts' does not exist.", "File '/foo/node_modules/pdq.ts' does not exist.", "File '/foo/node_modules/pdq.tsx' does not exist.", @@ -100,12 +69,8 @@ "File '/foo/node_modules/pdq/index.ts' does not exist.", "File '/foo/node_modules/pdq/index.tsx' does not exist.", "File '/foo/node_modules/pdq/index.d.ts' does not exist.", - "File '/foo/node_modules/@types/pdq.ts' does not exist.", - "File '/foo/node_modules/@types/pdq.tsx' does not exist.", "File '/foo/node_modules/@types/pdq.d.ts' does not exist.", "File '/foo/node_modules/@types/pdq/package.json' does not exist.", - "File '/foo/node_modules/@types/pdq/index.ts' does not exist.", - "File '/foo/node_modules/@types/pdq/index.tsx' does not exist.", "File '/foo/node_modules/@types/pdq/index.d.ts' does not exist.", "File '/node_modules/pdq.ts' does not exist.", "File '/node_modules/pdq.tsx' does not exist.", @@ -114,12 +79,8 @@ "File '/node_modules/pdq/index.ts' does not exist.", "File '/node_modules/pdq/index.tsx' does not exist.", "File '/node_modules/pdq/index.d.ts' does not exist.", - "File '/node_modules/@types/pdq.ts' does not exist.", - "File '/node_modules/@types/pdq.tsx' does not exist.", "File '/node_modules/@types/pdq.d.ts' does not exist.", "File '/node_modules/@types/pdq/package.json' does not exist.", - "File '/node_modules/@types/pdq/index.ts' does not exist.", - "File '/node_modules/@types/pdq/index.tsx' does not exist.", "File '/node_modules/@types/pdq/index.d.ts' does not exist.", "Loading module 'pdq' from 'node_modules' folder.", "File '/foo/bar/node_modules/pdq.js' does not exist.", @@ -127,31 +88,16 @@ "File '/foo/bar/node_modules/pdq/package.json' does not exist.", "File '/foo/bar/node_modules/pdq/index.js' does not exist.", "File '/foo/bar/node_modules/pdq/index.jsx' does not exist.", - "File '/foo/bar/node_modules/@types/pdq.js' does not exist.", - "File '/foo/bar/node_modules/@types/pdq.jsx' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/index.js' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/index.jsx' does not exist.", "File '/foo/node_modules/pdq.js' does not exist.", "File '/foo/node_modules/pdq.jsx' does not exist.", "File '/foo/node_modules/pdq/package.json' does not exist.", "File '/foo/node_modules/pdq/index.js' does not exist.", "File '/foo/node_modules/pdq/index.jsx' does not exist.", - "File '/foo/node_modules/@types/pdq.js' does not exist.", - "File '/foo/node_modules/@types/pdq.jsx' does not exist.", - "File '/foo/node_modules/@types/pdq/package.json' does not exist.", - "File '/foo/node_modules/@types/pdq/index.js' does not exist.", - "File '/foo/node_modules/@types/pdq/index.jsx' does not exist.", "File '/node_modules/pdq.js' does not exist.", "File '/node_modules/pdq.jsx' does not exist.", "File '/node_modules/pdq/package.json' does not exist.", "File '/node_modules/pdq/index.js' does not exist.", "File '/node_modules/pdq/index.jsx' does not exist.", - "File '/node_modules/@types/pdq.js' does not exist.", - "File '/node_modules/@types/pdq.jsx' does not exist.", - "File '/node_modules/@types/pdq/package.json' does not exist.", - "File '/node_modules/@types/pdq/index.js' does not exist.", - "File '/node_modules/@types/pdq/index.jsx' does not exist.", "======== Module name 'pdq' was not resolved. ========", "======== Resolving module 'abc' from '/foo/bar/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -163,12 +109,8 @@ "File '/foo/bar/node_modules/abc/index.ts' does not exist.", "File '/foo/bar/node_modules/abc/index.tsx' does not exist.", "File '/foo/bar/node_modules/abc/index.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/abc.ts' does not exist.", - "File '/foo/bar/node_modules/@types/abc.tsx' does not exist.", "File '/foo/bar/node_modules/@types/abc.d.ts' does not exist.", "File '/foo/bar/node_modules/@types/abc/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/abc/index.ts' does not exist.", - "File '/foo/bar/node_modules/@types/abc/index.tsx' does not exist.", "File '/foo/bar/node_modules/@types/abc/index.d.ts' does not exist.", "File '/foo/node_modules/abc.ts' does not exist.", "File '/foo/node_modules/abc.tsx' does not exist.", @@ -177,12 +119,8 @@ "File '/foo/node_modules/abc/index.ts' does not exist.", "File '/foo/node_modules/abc/index.tsx' does not exist.", "File '/foo/node_modules/abc/index.d.ts' does not exist.", - "File '/foo/node_modules/@types/abc.ts' does not exist.", - "File '/foo/node_modules/@types/abc.tsx' does not exist.", "File '/foo/node_modules/@types/abc.d.ts' does not exist.", "File '/foo/node_modules/@types/abc/package.json' does not exist.", - "File '/foo/node_modules/@types/abc/index.ts' does not exist.", - "File '/foo/node_modules/@types/abc/index.tsx' does not exist.", "File '/foo/node_modules/@types/abc/index.d.ts' does not exist.", "File '/node_modules/abc.ts' does not exist.", "File '/node_modules/abc.tsx' does not exist.", @@ -191,12 +129,8 @@ "File '/node_modules/abc/index.ts' does not exist.", "File '/node_modules/abc/index.tsx' does not exist.", "File '/node_modules/abc/index.d.ts' does not exist.", - "File '/node_modules/@types/abc.ts' does not exist.", - "File '/node_modules/@types/abc.tsx' does not exist.", "File '/node_modules/@types/abc.d.ts' does not exist.", "File '/node_modules/@types/abc/package.json' does not exist.", - "File '/node_modules/@types/abc/index.ts' does not exist.", - "File '/node_modules/@types/abc/index.tsx' does not exist.", "File '/node_modules/@types/abc/index.d.ts' does not exist.", "Loading module 'abc' from 'node_modules' folder.", "File '/foo/bar/node_modules/abc.js' does not exist.", @@ -204,31 +138,16 @@ "File '/foo/bar/node_modules/abc/package.json' does not exist.", "File '/foo/bar/node_modules/abc/index.js' does not exist.", "File '/foo/bar/node_modules/abc/index.jsx' does not exist.", - "File '/foo/bar/node_modules/@types/abc.js' does not exist.", - "File '/foo/bar/node_modules/@types/abc.jsx' does not exist.", - "File '/foo/bar/node_modules/@types/abc/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/abc/index.js' does not exist.", - "File '/foo/bar/node_modules/@types/abc/index.jsx' does not exist.", "File '/foo/node_modules/abc.js' does not exist.", "File '/foo/node_modules/abc.jsx' does not exist.", "File '/foo/node_modules/abc/package.json' does not exist.", "File '/foo/node_modules/abc/index.js' does not exist.", "File '/foo/node_modules/abc/index.jsx' does not exist.", - "File '/foo/node_modules/@types/abc.js' does not exist.", - "File '/foo/node_modules/@types/abc.jsx' does not exist.", - "File '/foo/node_modules/@types/abc/package.json' does not exist.", - "File '/foo/node_modules/@types/abc/index.js' does not exist.", - "File '/foo/node_modules/@types/abc/index.jsx' does not exist.", "File '/node_modules/abc.js' does not exist.", "File '/node_modules/abc.jsx' does not exist.", "File '/node_modules/abc/package.json' does not exist.", "File '/node_modules/abc/index.js' does not exist.", "File '/node_modules/abc/index.jsx' does not exist.", - "File '/node_modules/@types/abc.js' does not exist.", - "File '/node_modules/@types/abc.jsx' does not exist.", - "File '/node_modules/@types/abc/package.json' does not exist.", - "File '/node_modules/@types/abc/index.js' does not exist.", - "File '/node_modules/@types/abc/index.jsx' does not exist.", "======== Module name 'abc' was not resolved. ========", "======== Resolving type reference directive 'grumpy', containing file '/src/__inferred type names__.ts', root directory '/foo/node_modules/@types,/node_modules/@types'. ========", "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'", diff --git a/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json b/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json index 4bb62bc255a..421c47d30ec 100644 --- a/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json +++ b/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json @@ -9,12 +9,8 @@ "File '/src/node_modules/xyz/index.ts' does not exist.", "File '/src/node_modules/xyz/index.tsx' does not exist.", "File '/src/node_modules/xyz/index.d.ts' does not exist.", - "File '/src/node_modules/@types/xyz.ts' does not exist.", - "File '/src/node_modules/@types/xyz.tsx' does not exist.", "File '/src/node_modules/@types/xyz.d.ts' does not exist.", "File '/src/node_modules/@types/xyz/package.json' does not exist.", - "File '/src/node_modules/@types/xyz/index.ts' does not exist.", - "File '/src/node_modules/@types/xyz/index.tsx' does not exist.", "File '/src/node_modules/@types/xyz/index.d.ts' does not exist.", "File '/node_modules/xyz.ts' does not exist.", "File '/node_modules/xyz.tsx' does not exist.", @@ -23,12 +19,8 @@ "File '/node_modules/xyz/index.ts' does not exist.", "File '/node_modules/xyz/index.tsx' does not exist.", "File '/node_modules/xyz/index.d.ts' does not exist.", - "File '/node_modules/@types/xyz.ts' does not exist.", - "File '/node_modules/@types/xyz.tsx' does not exist.", "File '/node_modules/@types/xyz.d.ts' does not exist.", "File '/node_modules/@types/xyz/package.json' does not exist.", - "File '/node_modules/@types/xyz/index.ts' does not exist.", - "File '/node_modules/@types/xyz/index.tsx' does not exist.", "File '/node_modules/@types/xyz/index.d.ts' does not exist.", "Loading module 'xyz' from 'node_modules' folder.", "File '/src/node_modules/xyz.js' does not exist.", @@ -36,21 +28,11 @@ "File '/src/node_modules/xyz/package.json' does not exist.", "File '/src/node_modules/xyz/index.js' does not exist.", "File '/src/node_modules/xyz/index.jsx' does not exist.", - "File '/src/node_modules/@types/xyz.js' does not exist.", - "File '/src/node_modules/@types/xyz.jsx' does not exist.", - "File '/src/node_modules/@types/xyz/package.json' does not exist.", - "File '/src/node_modules/@types/xyz/index.js' does not exist.", - "File '/src/node_modules/@types/xyz/index.jsx' does not exist.", "File '/node_modules/xyz.js' does not exist.", "File '/node_modules/xyz.jsx' does not exist.", "File '/node_modules/xyz/package.json' does not exist.", "File '/node_modules/xyz/index.js' does not exist.", "File '/node_modules/xyz/index.jsx' does not exist.", - "File '/node_modules/@types/xyz.js' does not exist.", - "File '/node_modules/@types/xyz.jsx' does not exist.", - "File '/node_modules/@types/xyz/package.json' does not exist.", - "File '/node_modules/@types/xyz/index.js' does not exist.", - "File '/node_modules/@types/xyz/index.jsx' does not exist.", "======== Module name 'xyz' was not resolved. ========", "======== Resolving type reference directive 'foo', containing file '/src/__inferred type names__.ts', root directory '/node_modules/@types'. ========", "Resolving with primary search path '/node_modules/@types'", diff --git a/tests/baselines/reference/typingsLookup4.trace.json b/tests/baselines/reference/typingsLookup4.trace.json index bb9d94f43b5..d1c29b1f11b 100644 --- a/tests/baselines/reference/typingsLookup4.trace.json +++ b/tests/baselines/reference/typingsLookup4.trace.json @@ -9,8 +9,6 @@ "File '/node_modules/jquery/index.ts' does not exist.", "File '/node_modules/jquery/index.tsx' does not exist.", "File '/node_modules/jquery/index.d.ts' does not exist.", - "File '/node_modules/@types/jquery.ts' does not exist.", - "File '/node_modules/@types/jquery.tsx' does not exist.", "File '/node_modules/@types/jquery.d.ts' does not exist.", "Found 'package.json' at '/node_modules/@types/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.", @@ -27,8 +25,6 @@ "File '/node_modules/kquery/index.ts' does not exist.", "File '/node_modules/kquery/index.tsx' does not exist.", "File '/node_modules/kquery/index.d.ts' does not exist.", - "File '/node_modules/@types/kquery.ts' does not exist.", - "File '/node_modules/@types/kquery.tsx' does not exist.", "File '/node_modules/@types/kquery.d.ts' does not exist.", "Found 'package.json' at '/node_modules/@types/kquery/package.json'.", "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", @@ -48,8 +44,6 @@ "File '/node_modules/lquery/index.ts' does not exist.", "File '/node_modules/lquery/index.tsx' does not exist.", "File '/node_modules/lquery/index.d.ts' does not exist.", - "File '/node_modules/@types/lquery.ts' does not exist.", - "File '/node_modules/@types/lquery.tsx' does not exist.", "File '/node_modules/@types/lquery.d.ts' does not exist.", "Found 'package.json' at '/node_modules/@types/lquery/package.json'.", "'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.", diff --git a/tests/baselines/reference/typingsLookupAmd.trace.json b/tests/baselines/reference/typingsLookupAmd.trace.json index 496166926a8..843f16fe8c6 100644 --- a/tests/baselines/reference/typingsLookupAmd.trace.json +++ b/tests/baselines/reference/typingsLookupAmd.trace.json @@ -10,19 +10,11 @@ "File '/b.ts' does not exist.", "File '/b.tsx' does not exist.", "File '/b.d.ts' does not exist.", - "File '/x/y/node_modules/@types/b.ts' does not exist.", - "File '/x/y/node_modules/@types/b.tsx' does not exist.", "File '/x/y/node_modules/@types/b.d.ts' does not exist.", "File '/x/y/node_modules/@types/b/package.json' does not exist.", - "File '/x/y/node_modules/@types/b/index.ts' does not exist.", - "File '/x/y/node_modules/@types/b/index.tsx' does not exist.", "File '/x/y/node_modules/@types/b/index.d.ts' does not exist.", - "File '/x/node_modules/@types/b.ts' does not exist.", - "File '/x/node_modules/@types/b.tsx' does not exist.", "File '/x/node_modules/@types/b.d.ts' does not exist.", "File '/x/node_modules/@types/b/package.json' does not exist.", - "File '/x/node_modules/@types/b/index.ts' does not exist.", - "File '/x/node_modules/@types/b/index.tsx' does not exist.", "File '/x/node_modules/@types/b/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'b' was successfully resolved to '/x/node_modules/@types/b/index.d.ts'. ========", "======== Resolving module 'a' from '/x/node_modules/@types/b/index.d.ts'. ========", @@ -42,33 +34,17 @@ "File '/a.ts' does not exist.", "File '/a.tsx' does not exist.", "File '/a.d.ts' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a.ts' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a.tsx' does not exist.", "File '/x/node_modules/@types/b/node_modules/@types/a.d.ts' does not exist.", "File '/x/node_modules/@types/b/node_modules/@types/a/package.json' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a/index.ts' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a/index.tsx' does not exist.", "File '/x/node_modules/@types/b/node_modules/@types/a/index.d.ts' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a.ts' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a.tsx' does not exist.", "File '/x/node_modules/@types/node_modules/@types/a.d.ts' does not exist.", "File '/x/node_modules/@types/node_modules/@types/a/package.json' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a/index.ts' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a/index.tsx' does not exist.", "File '/x/node_modules/@types/node_modules/@types/a/index.d.ts' does not exist.", - "File '/x/node_modules/@types/a.ts' does not exist.", - "File '/x/node_modules/@types/a.tsx' does not exist.", "File '/x/node_modules/@types/a.d.ts' does not exist.", "File '/x/node_modules/@types/a/package.json' does not exist.", - "File '/x/node_modules/@types/a/index.ts' does not exist.", - "File '/x/node_modules/@types/a/index.tsx' does not exist.", "File '/x/node_modules/@types/a/index.d.ts' does not exist.", - "File '/node_modules/@types/a.ts' does not exist.", - "File '/node_modules/@types/a.tsx' does not exist.", "File '/node_modules/@types/a.d.ts' does not exist.", "File '/node_modules/@types/a/package.json' does not exist.", - "File '/node_modules/@types/a/index.ts' does not exist.", - "File '/node_modules/@types/a/index.tsx' does not exist.", "File '/node_modules/@types/a/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'a' was successfully resolved to '/node_modules/@types/a/index.d.ts'. ========", "======== Resolving type reference directive 'a', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",