@@ -1865,7 +1865,6 @@ namespace ts {
18651865 interface VisibleModuleInfo {
18661866 moduleName : string ;
18671867 moduleDir : string ;
1868- canBeImported : boolean ;
18691868 }
18701869
18711870 export interface DisplayPartsSymbolWriter extends SymbolWriter {
@@ -4605,7 +4604,7 @@ namespace ts {
46054604 if ( ! duplicate ) {
46064605 result . push ( {
46074606 name : fileName ,
4608- kind : ScriptElementKind . directory ,
4607+ kind : ScriptElementKind . scriptElement ,
46094608 sortText : fileName
46104609 } ) ;
46114610 }
@@ -4618,7 +4617,7 @@ namespace ts {
46184617 const directoryName = getBaseFileName ( normalizePath ( d ) ) ;
46194618
46204619 result . push ( {
4621- name : ensureTrailingDirectorySeparator ( directoryName ) ,
4620+ name : directoryName ,
46224621 kind : ScriptElementKind . directory ,
46234622 sortText : directoryName
46244623 } ) ;
@@ -4750,7 +4749,7 @@ namespace ts {
47504749 if ( ! options . moduleResolution || options . moduleResolution === ModuleResolutionKind . NodeJs ) {
47514750 forEach ( enumerateNodeModulesVisibleToScript ( host , scriptPath ) , visibleModule => {
47524751 if ( ! isNestedModule ) {
4753- nonRelativeModules . push ( visibleModule . canBeImported ? visibleModule . moduleName : ensureTrailingDirectorySeparator ( visibleModule . moduleName ) ) ;
4752+ nonRelativeModules . push ( visibleModule . moduleName ) ;
47544753 }
47554754 else {
47564755 const nestedFiles = host . readDirectory ( visibleModule . moduleDir , supportedTypeScriptExtensions , /*exclude*/ undefined , /*include*/ [ "./*" ] ) ;
@@ -4904,8 +4903,7 @@ namespace ts {
49044903 const moduleDir = combinePaths ( nodeModulesDir , moduleName ) ;
49054904 result . push ( {
49064905 moduleName,
4907- moduleDir,
4908- canBeImported : moduleCanBeImported ( moduleDir )
4906+ moduleDir
49094907 } ) ;
49104908 } ) ;
49114909 } ) ;
@@ -4930,31 +4928,6 @@ namespace ts {
49304928 }
49314929 }
49324930 }
4933-
4934- /*
4935- * A module can be imported by name alone if one of the following is true:
4936- * It defines the "typings" property in its package.json
4937- * The module has a "main" export and an index.d.ts file
4938- * The module has an index.ts
4939- */
4940- function moduleCanBeImported ( modulePath : string ) : boolean {
4941- const packagePath = combinePaths ( modulePath , "package.json" ) ;
4942-
4943- let hasMainExport = false ;
4944- if ( host . fileExists ( packagePath ) ) {
4945- const package = tryReadingPackageJson ( packagePath ) ;
4946- if ( package ) {
4947- if ( package . typings ) {
4948- return true ;
4949- }
4950- hasMainExport = ! ! package . main ;
4951- }
4952- }
4953-
4954- hasMainExport = hasMainExport || host . fileExists ( combinePaths ( modulePath , "index.js" ) ) ;
4955-
4956- return ( hasMainExport && host . fileExists ( combinePaths ( modulePath , "index.d.ts" ) ) ) || host . fileExists ( combinePaths ( modulePath , "index.ts" ) ) ;
4957- }
49584931 }
49594932
49604933 function createCompletionEntryForModule ( name : string , kind : string ) : ImportCompletionEntry {
0 commit comments