@@ -650,7 +650,7 @@ function resolveWithNewModule (pkg, tree, log, next) {
650
650
return isInstallable ( pkg , ( err ) => {
651
651
let installable = ! err
652
652
addBundled ( pkg , ( bundleErr ) => {
653
- var parent = earliestInstallable ( tree , tree , pkg , log , null ) || tree
653
+ var parent = earliestInstallable ( tree , tree , pkg , log ) || tree
654
654
var isLink = pkg . _requested . type === 'directory'
655
655
var child = createChild ( {
656
656
package : pkg ,
@@ -755,11 +755,11 @@ function preserveSymlinks () {
755
755
// Find the highest level in the tree that we can install this module in.
756
756
// If the module isn't installed above us yet, that'd be the very top.
757
757
// If it is, then it's the level below where its installed.
758
- var earliestInstallable = exports . earliestInstallable = function ( requiredBy , tree , pkg , log , ignoreChild ) {
759
- validate ( 'OOOOZ|OOOOO ' , arguments )
758
+ var earliestInstallable = exports . earliestInstallable = function ( requiredBy , tree , pkg , log ) {
759
+ validate ( 'OOOO ' , arguments )
760
760
761
761
function undeletedModuleMatches ( child ) {
762
- return child !== ignoreChild && ! child . removed && moduleName ( child ) === pkg . name
762
+ return ! child . removed && moduleName ( child ) === pkg . name
763
763
}
764
764
const undeletedMatches = tree . children . filter ( undeletedModuleMatches )
765
765
if ( undeletedMatches . length ) {
@@ -778,7 +778,7 @@ var earliestInstallable = exports.earliestInstallable = function (requiredBy, tr
778
778
// If any of the children of this tree have conflicting
779
779
// binaries then we need to decline to install this package here.
780
780
var binaryMatches = pkg . bin && tree . children . some ( function ( child ) {
781
- if ( child === ignoreChild || child . removed || ! child . package . bin ) return false
781
+ if ( child . removed || ! child . package . bin ) return false
782
782
return Object . keys ( child . package . bin ) . some ( function ( bin ) {
783
783
return pkg . bin [ bin ]
784
784
} )
@@ -804,23 +804,6 @@ var earliestInstallable = exports.earliestInstallable = function (requiredBy, tr
804
804
805
805
if ( tree . phantomChildren && tree . phantomChildren [ pkg . name ] ) return null
806
806
807
- // if any of the peer dependencies is a dependency of the current
808
- // tree locations, we place the package here. This is a safe location
809
- // where we don't violate the peer dependencies contract.
810
- // It may not be the perfect location in some cases, but we don't know
811
- // if dependencies are hoisted to another location yet, as they
812
- // may not be loaded into the tree yet.
813
- // We can ignore dev deps here as they are only installed on top-level
814
- // and we can't hoist further than that anyway.
815
- var peerDeps = pkg . peerDependencies
816
- if ( peerDeps ) {
817
- if ( Object . keys ( peerDeps ) . some ( function ( name ) {
818
- return deps [ name ]
819
- } ) ) {
820
- return tree
821
- }
822
- }
823
-
824
807
if ( tree . isTop ) return tree
825
808
if ( tree . isGlobal ) return tree
826
809
@@ -829,5 +812,5 @@ var earliestInstallable = exports.earliestInstallable = function (requiredBy, tr
829
812
830
813
if ( ! preserveSymlinks ( ) && / ^ [ . ] [ . ] [ \\ / ] / . test ( path . relative ( tree . parent . realpath , tree . realpath ) ) ) return tree
831
814
832
- return ( earliestInstallable ( requiredBy , tree . parent , pkg , log , ignoreChild ) || tree )
815
+ return ( earliestInstallable ( requiredBy , tree . parent , pkg , log ) || tree )
833
816
}
0 commit comments