From a5eec2485f8798ece493c00fce1cde4d8f8a8147 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 21 Aug 2024 16:43:21 -0700 Subject: [PATCH] Simplify handling of `node:`-prefixed modules in auto-imports (#59702) --- src/compiler/program.ts | 13 +- src/compiler/types.ts | 7 +- src/compiler/utilities.ts | 80 ++ src/jsTyping/jsTyping.ts | 59 +- src/services/codefixes/fixCannotFindModule.ts | 4 +- src/services/codefixes/importFixes.ts | 8 +- src/services/completions.ts | 23 +- src/services/exportInfoMap.ts | 47 +- src/services/utilities.ts | 23 +- .../unittests/tsserver/duplicatePackages.ts | 2 +- .../unittests/tsserver/typingsInstaller.ts | 2 +- ...ngs-should-return-node-for-core-modules.js | 764 ++++++++++++++++-- ...pletionsImport_uriStyleNodeCoreModules1.ts | 10 + ...pletionsImport_uriStyleNodeCoreModules3.ts | 58 +- ...ortNameCodeFix_uriStyleNodeCoreModules2.ts | 4 +- ...ortNameCodeFix_uriStyleNodeCoreModules3.ts | 26 +- 16 files changed, 941 insertions(+), 189 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 06bb19f84d158..198dfa0975457 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -75,6 +75,7 @@ import { ensureTrailingDirectorySeparator, equateStringsCaseInsensitive, equateStringsCaseSensitive, + exclusivelyPrefixedNodeCoreModules, explainIfFileIsRedirectAndImpliedFormat, ExportAssignment, ExportDeclaration, @@ -323,6 +324,7 @@ import { TypeChecker, typeDirectiveIsEqualTo, TypeReferenceDirectiveResolutionCache, + unprefixedNodeCoreModules, VariableDeclaration, VariableStatement, Version, @@ -1758,7 +1760,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg let sourceFileToPackageName = new Map(); // Key is a file name. Value is the (non-empty, or undefined) list of files that redirect to it. let redirectTargetsMap = createMultiMap(); - let usesUriStyleNodeCoreModules = false; + let usesUriStyleNodeCoreModules: boolean | undefined; /** * map with @@ -3499,7 +3501,14 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here imports = append(imports, moduleNameExpr); if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) { - usesUriStyleNodeCoreModules = startsWith(moduleNameExpr.text, "node:"); + if (startsWith(moduleNameExpr.text, "node:") && !exclusivelyPrefixedNodeCoreModules.has(moduleNameExpr.text)) { + // Presence of `node:` prefix takes precedence over unprefixed node core modules + usesUriStyleNodeCoreModules = true; + } + else if (usesUriStyleNodeCoreModules === undefined && unprefixedNodeCoreModules.has(moduleNameExpr.text)) { + // Avoid `unprefixedNodeCoreModules.has` for every import + usesUriStyleNodeCoreModules = false; + } } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0e76e1989bd21..ec5aa60564eac 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4866,11 +4866,14 @@ export interface Program extends ScriptReferenceHost { */ redirectTargetsMap: MultiMap; /** - * Whether any (non-external, non-declaration) source files use `node:`-prefixed module specifiers. + * Whether any (non-external, non-declaration) source files use `node:`-prefixed module specifiers + * (except for those that are not available without the prefix). + * `false` indicates that an unprefixed builtin module was seen; `undefined` indicates that no + * builtin modules (or only modules exclusively available with the prefix) were seen. * * @internal */ - readonly usesUriStyleNodeCoreModules: boolean; + readonly usesUriStyleNodeCoreModules: boolean | undefined; /** * Map from libFileName to actual resolved location of the lib * @internal diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 09ec24b505883..fb4da5887538d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -11796,3 +11796,83 @@ export function isSideEffectImport(node: Node): boolean { const ancestor = findAncestor(node, isImportDeclaration); return !!ancestor && !ancestor.importClause; } + +// require('module').builtinModules.filter(x => !x.startsWith('_')) +const unprefixedNodeCoreModulesList = [ + "assert", + "assert/strict", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "diagnostics_channel", + "dns", + "dns/promises", + "domain", + "events", + "fs", + "fs/promises", + "http", + "http2", + "https", + "inspector", + "inspector/promises", + "module", + "net", + "os", + "path", + "path/posix", + "path/win32", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "readline/promises", + "repl", + "stream", + "stream/consumers", + "stream/promises", + "stream/web", + "string_decoder", + "sys", + "test/mock_loader", + "timers", + "timers/promises", + "tls", + "trace_events", + "tty", + "url", + "util", + "util/types", + "v8", + "vm", + "wasi", + "worker_threads", + "zlib", +]; + +/** @internal */ +export const unprefixedNodeCoreModules = new Set(unprefixedNodeCoreModulesList); + +// await fetch('https://nodejs.org/docs/latest/api/all.json').then(r => r.text()).then(t => +// new Set(t.match(/(?<=')node:.+?(?=')/g)) +// .difference(new Set(require('module').builtinModules.map(x => `node:${x}`)))) +/** @internal */ +export const exclusivelyPrefixedNodeCoreModules = new Set([ + "node:sea", + "node:sqlite", + "node:test", + "node:test/reporters", +]); + +/** @internal */ +export const nodeCoreModules = new Set([ + ...unprefixedNodeCoreModulesList, + ...unprefixedNodeCoreModulesList.map(name => `node:${name}`), + ...exclusivelyPrefixedNodeCoreModules, +]); diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 48594168e9b80..cb38ce1d1af0b 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -19,6 +19,7 @@ import { hasJSFileExtension, mapDefined, MapLike, + nodeCoreModules, normalizePath, Path, readConfigFile, @@ -61,64 +62,6 @@ export function isTypingUpToDate(cachedTyping: CachedTyping, availableTypingVers return availableVersion.compareTo(cachedTyping.version) <= 0; } -const unprefixedNodeCoreModuleList = [ - "assert", - "assert/strict", - "async_hooks", - "buffer", - "child_process", - "cluster", - "console", - "constants", - "crypto", - "dgram", - "diagnostics_channel", - "dns", - "dns/promises", - "domain", - "events", - "fs", - "fs/promises", - "http", - "https", - "http2", - "inspector", - "module", - "net", - "os", - "path", - "perf_hooks", - "process", - "punycode", - "querystring", - "readline", - "repl", - "stream", - "stream/promises", - "string_decoder", - "timers", - "timers/promises", - "tls", - "trace_events", - "tty", - "url", - "util", - "util/types", - "v8", - "vm", - "wasi", - "worker_threads", - "zlib", -]; - -const prefixedNodeCoreModuleList = unprefixedNodeCoreModuleList.map(name => `node:${name}`); - -/** @internal */ -export const nodeCoreModuleList: readonly string[] = [...unprefixedNodeCoreModuleList, ...prefixedNodeCoreModuleList]; - -/** @internal */ -export const nodeCoreModules = new Set(nodeCoreModuleList); - /** @internal */ export function nonRelativeModuleNameForTypingCache(moduleName: string) { return nodeCoreModules.has(moduleName) ? "node" : moduleName; diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts index 4be66a264636b..d967dea3f188b 100644 --- a/src/services/codefixes/fixCannotFindModule.ts +++ b/src/services/codefixes/fixCannotFindModule.ts @@ -11,8 +11,8 @@ import { InstallPackageAction, isExternalModuleNameRelative, isStringLiteral, - JsTyping, LanguageServiceHost, + nodeCoreModules, parsePackageName, SourceFile, tryCast, @@ -71,6 +71,6 @@ function tryGetImportedPackageName(sourceFile: SourceFile, pos: number): string function getTypesPackageNameToInstall(packageName: string, host: LanguageServiceHost, diagCode: number): string | undefined { return diagCode === errorCodeCannotFindModule - ? (JsTyping.nodeCoreModules.has(packageName) ? "@types/node" : undefined) + ? (nodeCoreModules.has(packageName) ? "@types/node" : undefined) : (host.isKnownTypesPackageName?.(packageName) ? getTypesPackageName(packageName) : undefined); } diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 9940c1794ed9c..f2a38cb1b3946 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -35,7 +35,6 @@ import { ExportKind, ExportMapInfoKey, factory, - fileContainsPackageImport, findAncestor, first, firstDefined, @@ -84,7 +83,7 @@ import { isExternalModuleReference, isFullSourceFile, isIdentifier, - isImportableFile, + isImportable, isImportDeclaration, isImportEqualsDeclaration, isIntrinsicJsxName, @@ -1542,10 +1541,7 @@ function getExportInfos( }); function addSymbol(moduleSymbol: Symbol, toFile: SourceFile | undefined, exportedSymbol: Symbol, exportKind: ExportKind, program: Program, isFromPackageJson: boolean): void { const moduleSpecifierResolutionHost = getModuleSpecifierResolutionHost(isFromPackageJson); - if ( - toFile && isImportableFile(program, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || - (!toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost) || fileContainsPackageImport(fromFile, stripQuotes(moduleSymbol.name))) - ) { + if (isImportable(program, fromFile, toFile, moduleSymbol, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache)) { const checker = program.getTypeChecker(); originalSymbolToExportInfos.add(getUniqueSymbolId(exportedSymbol, checker).toString(), { symbol: exportedSymbol, moduleSymbol, moduleFileName: toFile?.fileName, exportKind, targetFlags: skipAlias(exportedSymbol, checker).flags, isFromPackageJson }); } diff --git a/src/services/completions.ts b/src/services/completions.ts index 93693b13db6e0..99c2becb47540 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -64,7 +64,6 @@ import { Expression, ExpressionWithTypeArguments, factory, - fileContainsPackageImport, filter, find, findAncestor, @@ -175,7 +174,7 @@ import { isIdentifierPart, isIdentifierStart, isIdentifierText, - isImportableFile, + isImportable, isImportAttributes, isImportDeclaration, isImportEqualsDeclaration, @@ -274,7 +273,6 @@ import { JSDocTypedefTag, JSDocTypeExpression, JSDocTypeTag, - JsTyping, JsxAttribute, JsxAttributes, JsxClosingElement, @@ -344,7 +342,6 @@ import { SemanticMeaning, setEmitFlags, setSnippetElement, - shouldUseUriStyleNodeCoreModules, SignatureHelp, SignatureKind, singleElementArray, @@ -4221,19 +4218,11 @@ function getCompletionData( ); function isImportableExportInfo(info: SymbolExportInfo) { - const moduleFile = tryCast(info.moduleSymbol.valueDeclaration, isSourceFile); - if (!moduleFile) { - const moduleName = stripQuotes(info.moduleSymbol.name); - if (JsTyping.nodeCoreModules.has(moduleName) && startsWith(moduleName, "node:") !== shouldUseUriStyleNodeCoreModules(sourceFile, program)) { - return false; - } - return (packageJsonFilter?.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson)) ?? true) - || fileContainsPackageImport(sourceFile, moduleName); - } - return isImportableFile( + return isImportable( info.isFromPackageJson ? packageJsonAutoImportProvider! : program, sourceFile, - moduleFile, + tryCast(info.moduleSymbol.valueDeclaration, isSourceFile), + info.moduleSymbol, preferences, packageJsonFilter, getModuleSpecifierResolutionHost(info.isFromPackageJson), @@ -4371,7 +4360,7 @@ function getCompletionData( // dprint-ignore switch (tokenKind) { case SyntaxKind.CommaToken: - switch (containingNodeKind) { + switch (containingNodeKind) { case SyntaxKind.CallExpression: // func( a, | case SyntaxKind.NewExpression: { // new C(a, | const expression = (contextToken.parent as CallExpression | NewExpression).expression; @@ -4454,7 +4443,7 @@ function getCompletionData( } case SyntaxKind.TemplateHead: - return { + return { defaultCommitCharacters: allCommitCharacters, isNewIdentifierLocation: containingNodeKind === SyntaxKind.TemplateExpression // `aa ${| }; diff --git a/src/services/exportInfoMap.ts b/src/services/exportInfoMap.ts index e551b2c81a777..821e855e76a36 100644 --- a/src/services/exportInfoMap.ts +++ b/src/services/exportInfoMap.ts @@ -38,12 +38,14 @@ import { ModuleSpecifierResolutionHost, moduleSpecifiers, moduleSymbolToValidIdentifier, + nodeCoreModules, nodeModulesPathPart, PackageJsonImportFilter, Path, pathContainsNodeModules, Program, ScriptTarget, + shouldUseUriStyleNodeCoreModules, skipAlias, SourceFile, startsWith, @@ -362,48 +364,61 @@ export function createCacheableExportInfoMap(host: CacheableExportInfoMapHost): } /** @internal */ -export function isImportableFile( +export function isImportable( program: Program, - from: SourceFile, - to: SourceFile, + fromFile: SourceFile, + toFile: SourceFile | undefined, + toModule: Symbol, preferences: UserPreferences, packageJsonFilter: PackageJsonImportFilter | undefined, moduleSpecifierResolutionHost: ModuleSpecifierResolutionHost, moduleSpecifierCache: ModuleSpecifierCache | undefined, ): boolean { - if (from === to) return false; - const cachedResult = moduleSpecifierCache?.get(from.path, to.path, preferences, {}); + if (!toFile) { + // Ambient module + let useNodePrefix; + const moduleName = stripQuotes(toModule.name); + if (nodeCoreModules.has(moduleName) && (useNodePrefix = shouldUseUriStyleNodeCoreModules(fromFile, program)) !== undefined) { + return useNodePrefix === startsWith(moduleName, "node:"); + } + return !packageJsonFilter + || packageJsonFilter.allowsImportingAmbientModule(toModule, moduleSpecifierResolutionHost) + || fileContainsPackageImport(fromFile, moduleName); + } + + Debug.assertIsDefined(toFile); + if (fromFile === toFile) return false; + const cachedResult = moduleSpecifierCache?.get(fromFile.path, toFile.path, preferences, {}); if (cachedResult?.isBlockedByPackageJsonDependencies !== undefined) { - return !cachedResult.isBlockedByPackageJsonDependencies || !!cachedResult.packageName && fileContainsPackageImport(from, cachedResult.packageName); + return !cachedResult.isBlockedByPackageJsonDependencies || !!cachedResult.packageName && fileContainsPackageImport(fromFile, cachedResult.packageName); } const getCanonicalFileName = hostGetCanonicalFileName(moduleSpecifierResolutionHost); const globalTypingsCache = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation?.(); const hasImportablePath = !!moduleSpecifiers.forEachFileNameOfModule( - from.fileName, - to.fileName, + fromFile.fileName, + toFile.fileName, moduleSpecifierResolutionHost, /*preferSymlinks*/ false, toPath => { - const toFile = program.getSourceFile(toPath); + const file = program.getSourceFile(toPath); // Determine to import using toPath only if toPath is what we were looking at // or there doesnt exist the file in the program by the symlink - return (toFile === to || !toFile) && - isImportablePath(from.fileName, toPath, getCanonicalFileName, globalTypingsCache); + return (file === toFile || !file) && + isImportablePath(fromFile.fileName, toPath, getCanonicalFileName, globalTypingsCache); }, ); if (packageJsonFilter) { - const importInfo = hasImportablePath ? packageJsonFilter.getSourceFileInfo(to, moduleSpecifierResolutionHost) : undefined; - moduleSpecifierCache?.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, importInfo?.packageName, !importInfo?.importable); - return !!importInfo?.importable || !!importInfo?.packageName && fileContainsPackageImport(from, importInfo.packageName); + const importInfo = hasImportablePath ? packageJsonFilter.getSourceFileInfo(toFile, moduleSpecifierResolutionHost) : undefined; + moduleSpecifierCache?.setBlockedByPackageJsonDependencies(fromFile.path, toFile.path, preferences, {}, importInfo?.packageName, !importInfo?.importable); + return !!importInfo?.importable || hasImportablePath && !!importInfo?.packageName && fileContainsPackageImport(fromFile, importInfo.packageName); } return hasImportablePath; } -/** @internal */ -export function fileContainsPackageImport(sourceFile: SourceFile, packageName: string) { +function fileContainsPackageImport(sourceFile: SourceFile, packageName: string) { return sourceFile.imports && sourceFile.imports.some(i => i.text === packageName || i.text.startsWith(packageName + "/")); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 4f5cbf8d7d467..0cabbecaa4c8b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -62,6 +62,7 @@ import { equateStringsCaseInsensitive, equateStringsCaseSensitive, escapeString, + exclusivelyPrefixedNodeCoreModules, ExportAssignment, ExportDeclaration, Expression, @@ -271,7 +272,6 @@ import { JSDocLinkDisplayPart, JSDocLinkPlain, JSDocTypedefTag, - JsTyping, JsxEmit, JsxOpeningLikeElement, JsxTagNameExpression, @@ -297,6 +297,7 @@ import { Node, NodeArray, NodeBuilderFlags, + nodeCoreModules, NodeFlags, nodeIsMissing, nodeIsPresent, @@ -3851,7 +3852,7 @@ export function createPackageJsonImportFilter(fromFile: SourceFile | FutureSourc // from Node core modules or not. We can start by seeing if the user is actually using // any node core modules, as opposed to simply having @types/node accidentally as a // dependency of a dependency. - if (isFullSourceFile(fromFile) && isSourceFileJS(fromFile) && JsTyping.nodeCoreModules.has(moduleSpecifier)) { + if (isFullSourceFile(fromFile) && isSourceFileJS(fromFile) && nodeCoreModules.has(moduleSpecifier)) { if (usesNodeCoreModules === undefined) { usesNodeCoreModules = consumesNodeCoreModules(fromFile); } @@ -3896,7 +3897,7 @@ export function createPackageJsonImportFilter(fromFile: SourceFile | FutureSourc /** @internal */ export function consumesNodeCoreModules(sourceFile: SourceFile): boolean { - return some(sourceFile.imports, ({ text }) => JsTyping.nodeCoreModules.has(text)); + return some(sourceFile.imports, ({ text }) => nodeCoreModules.has(text)); } /** @internal */ @@ -4123,12 +4124,18 @@ export function isDeprecatedDeclaration(decl: Declaration) { } /** @internal */ -export function shouldUseUriStyleNodeCoreModules(file: SourceFile | FutureSourceFile, program: Program): boolean { - const decisionFromFile = firstDefined(file.imports, node => { - if (JsTyping.nodeCoreModules.has(node.text)) { - return startsWith(node.text, "node:"); +export function shouldUseUriStyleNodeCoreModules(file: SourceFile | FutureSourceFile, program: Program): boolean | undefined { + let decisionFromFile; + for (const node of file.imports) { + if (nodeCoreModules.has(node.text) && !exclusivelyPrefixedNodeCoreModules.has(node.text)) { + if (startsWith(node.text, "node:")) { + return true; + } + else { + decisionFromFile = false; + } } - }); + } return decisionFromFile ?? program.usesUriStyleNodeCoreModules; } diff --git a/src/testRunner/unittests/tsserver/duplicatePackages.ts b/src/testRunner/unittests/tsserver/duplicatePackages.ts index 9997277e6977c..b208cfd7bf100 100644 --- a/src/testRunner/unittests/tsserver/duplicatePackages.ts +++ b/src/testRunner/unittests/tsserver/duplicatePackages.ts @@ -10,7 +10,7 @@ import { File, } from "../helpers/virtualFileSystemWithWatch.js"; -describe("unittests:: tsserver:: duplicate packages", () => { +describe("unittests:: tsserver:: duplicatePackages", () => { // Tests that 'moduleSpecifiers.ts' will import from the redirecting file, and not from the file it redirects to, if that can provide a global module specifier. it("works with import fixes", () => { const packageContent = "export const foo: number;"; diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 38d05aa1ee1b0..c9e06f1c58046 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1455,7 +1455,7 @@ describe("unittests:: tsserver:: typingsInstaller:: discover typings", () => { const { discoverTypings, baseline } = setup([f]); const cache = new Map(); - for (const name of ts.JsTyping.nodeCoreModuleList) { + for (const name of ts.nodeCoreModules) { discoverTypings( [f.path], ts.getDirectoryPath(f.path as ts.Path), diff --git a/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js b/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js index b1bc76d5a7f95..cb99f88ec8f13 100644 --- a/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js +++ b/tests/baselines/reference/tsserver/typingsInstaller/discover-typings-should-return-node-for-core-modules.js @@ -580,6 +580,38 @@ TI:: [hh:mm:ss:mss] Finished typings discovery: ] } +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "http2", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + ts.JsTyping.discoverTypings:: { "fileNames": [ @@ -624,7 +656,487 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "http2", + "inspector", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "inspector/promises", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "module", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "net", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "os", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "path", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "path/posix", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "path/win32", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "perf_hooks", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "process", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "punycode", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "querystring", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "readline", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "readline/promises", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "repl", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "stream", "somename" ], "typesRegistry": {}, @@ -656,7 +1168,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "inspector", + "stream/consumers", "somename" ], "typesRegistry": {}, @@ -688,7 +1200,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "module", + "stream/promises", "somename" ], "typesRegistry": {}, @@ -720,7 +1232,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "net", + "stream/web", "somename" ], "typesRegistry": {}, @@ -752,7 +1264,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "os", + "string_decoder", "somename" ], "typesRegistry": {}, @@ -784,7 +1296,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "path", + "sys", "somename" ], "typesRegistry": {}, @@ -816,7 +1328,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "perf_hooks", + "test/mock_loader", "somename" ], "typesRegistry": {}, @@ -848,7 +1360,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "process", + "timers", "somename" ], "typesRegistry": {}, @@ -880,7 +1392,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "punycode", + "timers/promises", "somename" ], "typesRegistry": {}, @@ -912,7 +1424,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "querystring", + "tls", "somename" ], "typesRegistry": {}, @@ -944,7 +1456,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "readline", + "trace_events", "somename" ], "typesRegistry": {}, @@ -976,7 +1488,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "repl", + "tty", "somename" ], "typesRegistry": {}, @@ -1008,7 +1520,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "stream", + "url", "somename" ], "typesRegistry": {}, @@ -1040,7 +1552,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "stream/promises", + "util", "somename" ], "typesRegistry": {}, @@ -1072,7 +1584,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "string_decoder", + "util/types", "somename" ], "typesRegistry": {}, @@ -1104,7 +1616,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "timers", + "v8", "somename" ], "typesRegistry": {}, @@ -1136,7 +1648,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "timers/promises", + "vm", "somename" ], "typesRegistry": {}, @@ -1168,7 +1680,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "tls", + "wasi", "somename" ], "typesRegistry": {}, @@ -1200,7 +1712,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "trace_events", + "worker_threads", "somename" ], "typesRegistry": {}, @@ -1232,7 +1744,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "tty", + "zlib", "somename" ], "typesRegistry": {}, @@ -1264,7 +1776,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "url", + "node:assert", "somename" ], "typesRegistry": {}, @@ -1296,7 +1808,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "util", + "node:assert/strict", "somename" ], "typesRegistry": {}, @@ -1328,7 +1840,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "util/types", + "node:async_hooks", "somename" ], "typesRegistry": {}, @@ -1360,7 +1872,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "v8", + "node:buffer", "somename" ], "typesRegistry": {}, @@ -1392,7 +1904,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "vm", + "node:child_process", "somename" ], "typesRegistry": {}, @@ -1424,7 +1936,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "wasi", + "node:cluster", "somename" ], "typesRegistry": {}, @@ -1456,7 +1968,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "worker_threads", + "node:console", "somename" ], "typesRegistry": {}, @@ -1488,7 +2000,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "zlib", + "node:constants", "somename" ], "typesRegistry": {}, @@ -1520,7 +2032,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:assert", + "node:crypto", "somename" ], "typesRegistry": {}, @@ -1552,7 +2064,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:assert/strict", + "node:dgram", "somename" ], "typesRegistry": {}, @@ -1584,7 +2096,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:async_hooks", + "node:diagnostics_channel", "somename" ], "typesRegistry": {}, @@ -1616,7 +2128,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:buffer", + "node:dns", "somename" ], "typesRegistry": {}, @@ -1648,7 +2160,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:child_process", + "node:dns/promises", "somename" ], "typesRegistry": {}, @@ -1680,7 +2192,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:cluster", + "node:domain", "somename" ], "typesRegistry": {}, @@ -1712,7 +2224,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:console", + "node:events", "somename" ], "typesRegistry": {}, @@ -1744,7 +2256,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:constants", + "node:fs", "somename" ], "typesRegistry": {}, @@ -1776,7 +2288,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:crypto", + "node:fs/promises", "somename" ], "typesRegistry": {}, @@ -1808,7 +2320,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:dgram", + "node:http", "somename" ], "typesRegistry": {}, @@ -1840,7 +2352,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:diagnostics_channel", + "node:http2", "somename" ], "typesRegistry": {}, @@ -1872,7 +2384,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:dns", + "node:https", "somename" ], "typesRegistry": {}, @@ -1904,7 +2416,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:dns/promises", + "node:inspector", "somename" ], "typesRegistry": {}, @@ -1936,7 +2448,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:domain", + "node:inspector/promises", "somename" ], "typesRegistry": {}, @@ -1968,7 +2480,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:events", + "node:module", "somename" ], "typesRegistry": {}, @@ -2000,7 +2512,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:fs", + "node:net", "somename" ], "typesRegistry": {}, @@ -2032,7 +2544,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:fs/promises", + "node:os", "somename" ], "typesRegistry": {}, @@ -2064,7 +2576,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:http", + "node:path", "somename" ], "typesRegistry": {}, @@ -2096,7 +2608,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:https", + "node:path/posix", "somename" ], "typesRegistry": {}, @@ -2128,7 +2640,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:http2", + "node:path/win32", "somename" ], "typesRegistry": {}, @@ -2160,7 +2672,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:inspector", + "node:perf_hooks", "somename" ], "typesRegistry": {}, @@ -2192,7 +2704,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:module", + "node:process", "somename" ], "typesRegistry": {}, @@ -2224,7 +2736,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:net", + "node:punycode", "somename" ], "typesRegistry": {}, @@ -2256,7 +2768,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:os", + "node:querystring", "somename" ], "typesRegistry": {}, @@ -2288,7 +2800,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:path", + "node:readline", "somename" ], "typesRegistry": {}, @@ -2320,7 +2832,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:perf_hooks", + "node:readline/promises", "somename" ], "typesRegistry": {}, @@ -2352,7 +2864,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:process", + "node:repl", "somename" ], "typesRegistry": {}, @@ -2384,7 +2896,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:punycode", + "node:stream", "somename" ], "typesRegistry": {}, @@ -2416,7 +2928,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:querystring", + "node:stream/consumers", "somename" ], "typesRegistry": {}, @@ -2448,7 +2960,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:readline", + "node:stream/promises", "somename" ], "typesRegistry": {}, @@ -2480,7 +2992,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:repl", + "node:stream/web", "somename" ], "typesRegistry": {}, @@ -2512,7 +3024,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:stream", + "node:string_decoder", "somename" ], "typesRegistry": {}, @@ -2544,7 +3056,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:stream/promises", + "node:sys", "somename" ], "typesRegistry": {}, @@ -2576,7 +3088,7 @@ ts.JsTyping.discoverTypings:: "enable": true }, "unresolvedImports": [ - "node:string_decoder", + "node:test/mock_loader", "somename" ], "typesRegistry": {}, @@ -3011,3 +3523,131 @@ TI:: [hh:mm:ss:mss] Finished typings discovery: "/a/b/node_modules" ] } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "node:sea", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "node:sqlite", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "node:test", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } + +ts.JsTyping.discoverTypings:: + { + "fileNames": [ + "/a/b/app.js" + ], + "projectRootPath": "/a/b", + "safeList": {}, + "packageNameToTypingLocation": {}, + "typeAcquisition": { + "enable": true + }, + "unresolvedImports": [ + "node:test/reporters", + "somename" + ], + "typesRegistry": {}, + "compilerOptions": {} + } +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["node","somename"] +TI:: [hh:mm:ss:mss] Finished typings discovery: + { + "cachedTypingPaths": [], + "newTypingNames": [ + "node", + "somename" + ], + "filesToWatch": [ + "/a/b/bower_components", + "/a/b/node_modules" + ] + } diff --git a/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules1.ts b/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules1.ts index 0ebcb981d1d21..d8d1d89289b6d 100644 --- a/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules1.ts +++ b/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules1.ts @@ -18,11 +18,21 @@ verify.completions({ source: "fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions + }, { + name: "writeFile", + source: "node:fs", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", source: "fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions + }, { + name: "writeFile", + source: "node:fs/promises", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }]), preferences: { includeCompletionsForModuleExports: true, diff --git a/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules3.ts b/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules3.ts index e03b324f66df3..9e0748fadc433 100644 --- a/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules3.ts +++ b/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules3.ts @@ -31,6 +31,15 @@ //// import "path"; //// write/*mixed2*/ +// @Filename: /test1.ts +//// import "node:test"; +//// import "path"; +//// writeFile/*test1*/ + +// @Filename: /test2.ts +//// import "node:test"; +//// writeFile/*test2*/ + verify.completions({ marker: "noPrefix", exact: completion.globalsPlus([{ @@ -67,20 +76,18 @@ verify.completions({ }, }); -// We're doing as little work as possible to decide which module specifiers -// to use, so we just take the *first* recognized node core module in the file -// and copy its style. +// Prefixed imports take precedence over non-prefixed imports when mixed verify.completions({ marker: "mixed1", exact: completion.globalsPlus([{ name: "writeFile", - source: "fs", + source: "node:fs", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, { name: "writeFile", - source: "fs/promises", + source: "node:fs/promises", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }]), @@ -106,3 +113,44 @@ verify.completions({ includeCompletionsForModuleExports: true, }, }); + +// Unless the prefixed import is not available unprefixed + +verify.importFixModuleSpecifiers("test1", ["fs", "fs/promises"]); +verify.importFixModuleSpecifiers("test2", ["node:fs", "node:fs/promises"]); + +verify.completions({ + marker: "test1", + exact: completion.globalsPlus([{ + name: "writeFile", + source: "fs", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, { + name: "writeFile", + source: "fs/promises", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }]), + preferences: { + includeCompletionsForModuleExports: true, + }, +}); + +verify.completions({ + marker: "test2", + exact: completion.globalsPlus([{ + name: "writeFile", + source: "node:fs", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, { + name: "writeFile", + source: "node:fs/promises", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }]), + preferences: { + includeCompletionsForModuleExports: true, + }, +}); \ No newline at end of file diff --git a/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules2.ts b/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules2.ts index 3ca0e3f20bd31..3eb480c6db5c2 100644 --- a/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules2.ts +++ b/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules2.ts @@ -14,7 +14,7 @@ // @Filename: /index.ts //// writeFile/**/ -verify.importFixModuleSpecifiers("", ["node:fs", "node:fs/promises", "fs", "fs/promises"]); +verify.importFixModuleSpecifiers("", ["node:fs", "node:fs/promises"]); goTo.file("/other.ts"); edit.replaceLine(0, "\n"); @@ -26,4 +26,4 @@ goTo.file("/other.ts"); edit.replaceLine(0, `import "node:fs/promises";\n`); goTo.file("/index.ts"); -verify.importFixModuleSpecifiers("", ["node:fs", "node:fs/promises", "fs", "fs/promises"]); +verify.importFixModuleSpecifiers("", ["node:fs", "node:fs/promises"]); diff --git a/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules3.ts b/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules3.ts index 7f5e77f845a90..f9645371c6dc0 100644 --- a/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules3.ts +++ b/tests/cases/fourslash/importNameCodeFix_uriStyleNodeCoreModules3.ts @@ -31,12 +31,24 @@ //// import "path"; //// writeFile/*mixed2*/ -verify.importFixModuleSpecifiers("noPrefix", ["fs", "fs/promises", "node:fs", "node:fs/promises"]); -verify.importFixModuleSpecifiers("prefix", ["node:fs", "node:fs/promises", "fs", "fs/promises"]); +// @Filename: /test1.ts +//// import "node:test"; +//// import "path"; +//// writeFile/*test1*/ + +// @Filename: /test2.ts +//// import "node:test"; +//// writeFile/*test2*/ + +verify.importFixModuleSpecifiers("noPrefix", ["fs", "fs/promises"]); +verify.importFixModuleSpecifiers("prefix", ["node:fs", "node:fs/promises"]); + +// Prefixed imports take precedence over non-prefixed imports when mixed + +verify.importFixModuleSpecifiers("mixed1", ["node:fs", "node:fs/promises"]); +verify.importFixModuleSpecifiers("mixed2", ["node:fs", "node:fs/promises"]); -// We're doing as little work as possible to decide which module specifiers -// to use, so we just take the *first* recognized node core module in the file -// and copy its style. +// Unless the prefixed import is not available unprefixed -verify.importFixModuleSpecifiers("mixed1", ["fs", "fs/promises", "node:fs", "node:fs/promises"]); -verify.importFixModuleSpecifiers("mixed2", ["node:fs", "node:fs/promises", "fs", "fs/promises"]); \ No newline at end of file +verify.importFixModuleSpecifiers("test1", ["fs", "fs/promises"]); +verify.importFixModuleSpecifiers("test2", ["node:fs", "node:fs/promises"]);