@@ -1005,19 +1005,13 @@ namespace ts {
1005
1005
}
1006
1006
1007
1007
let resolvedValue = resolved . value ;
1008
-
1009
- const isExternalLibraryImport = resolvedValue && isPnpAvailable ( )
1010
- ? checkPnpExternalLibraryImport ( resolvedValue )
1011
- : true ;
1012
-
1013
- // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files.
1014
1008
if ( ! compilerOptions . preserveSymlinks && resolvedValue && ! resolvedValue . originalPath ) {
1015
1009
const path = realPath ( resolvedValue . path , host , traceEnabled ) ;
1016
1010
const originalPath = path === resolvedValue . path ? undefined : resolvedValue . path ;
1017
1011
resolvedValue = { ...resolvedValue , path, originalPath } ;
1018
1012
}
1019
-
1020
- return { value : resolvedValue && { resolved : resolvedValue , isExternalLibraryImport } } ;
1013
+ // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files.
1014
+ return { value : resolvedValue && { resolved : resolvedValue , isExternalLibraryImport : true } } ;
1021
1015
}
1022
1016
else {
1023
1017
const { path : candidate , parts } = normalizePathAndParts ( combinePaths ( containingDirectory , moduleName ) ) ;
@@ -1596,13 +1590,7 @@ namespace ts {
1596
1590
}
1597
1591
1598
1592
function getPnpApi ( ) {
1599
- return require ( "pnpapi" ) as {
1600
- findPackageLocator : ( path : string ) => ( { name : string , reference : string } ) | null ,
1601
- resolveToUnqualified : ( request : string , issuer : string , opts : { considerBuiltins : boolean } ) => string ,
1602
- getLocator : ( name : string , reference : string ) => ( { name : string , reference : string } ) ,
1603
- getPackageInformation : ( locator : { name : string , reference : string } ) => any ,
1604
- getDependencyTreeRoots : ( ) => any [ ] ,
1605
- } ;
1593
+ return require ( "pnpapi" ) ;
1606
1594
}
1607
1595
1608
1596
function loadPnpPackageResolution ( packageName : string , containingDirectory : string ) {
@@ -1643,22 +1631,8 @@ namespace ts {
1643
1631
}
1644
1632
}
1645
1633
1646
- return toSearchResult ( resolved ) ;
1647
- }
1648
-
1649
- function checkPnpExternalLibraryImport ( resolvedValue : Resolved ) {
1650
- const pnpApi = getPnpApi ( ) ;
1651
-
1652
- const ownerPackage = pnpApi . findPackageLocator ( resolvedValue . path ) ;
1653
- if ( ! ownerPackage ) {
1654
- return true ;
1634
+ if ( resolved ) {
1635
+ return toSearchResult ( resolved ) ;
1655
1636
}
1656
-
1657
- const rootLocators = pnpApi . getDependencyTreeRoots ( ) ;
1658
-
1659
- // External if none of the root locators owns the file
1660
- return ! rootLocators . some ( root => {
1661
- return root . name === ownerPackage . name && root . reference === ownerPackage . reference ;
1662
- } ) ;
1663
1637
}
1664
1638
}
0 commit comments