File tree Expand file tree Collapse file tree 4 files changed +19
-12
lines changed
packages/nx/src/utils/lock-file Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ export function transitiveDependencyNpmLookup(
378378 parentPackage : string ,
379379 versions : PackageVersions ,
380380 version : string
381- ) : string {
381+ ) : PackageDependency {
382382 const nestedVersion = Object . values ( versions ) . find ( ( v ) =>
383383 v . packageMeta . some (
384384 ( p ) =>
@@ -387,11 +387,11 @@ export function transitiveDependencyNpmLookup(
387387 ) ;
388388
389389 if ( nestedVersion ) {
390- return nestedVersion . version ;
390+ return nestedVersion ;
391391 }
392392
393393 // otherwise search for the matching version
394- return Object . values ( versions ) . find ( ( v ) => v . rootVersion ) ?. version ;
394+ return Object . values ( versions ) . find ( ( v ) => v . rootVersion ) ;
395395}
396396
397397/**
Original file line number Diff line number Diff line change @@ -281,10 +281,9 @@ export function transitiveDependencyPnpmLookup(
281281 parentPackage : string ,
282282 versions : PackageVersions ,
283283 version : string
284- ) : string {
284+ ) : PackageDependency {
285285 // pnpm's dependencies always point to the exact version so this block is only for insurrance
286- return Object . values ( versions ) . find ( ( v ) => satisfies ( v . version , version ) )
287- ?. version ;
286+ return Object . values ( versions ) . find ( ( v ) => satisfies ( v . version , version ) ) ;
288287}
289288
290289/**
Original file line number Diff line number Diff line change 11import { satisfies } from 'semver' ;
22import { defaultHashing } from '../../hasher/hashing-impl' ;
3- import { LockFileData , PackageVersions } from './lock-file-type' ;
3+ import {
4+ LockFileData ,
5+ PackageDependency ,
6+ PackageVersions ,
7+ } from './lock-file-type' ;
48import { workspaceRoot } from '../workspace-root' ;
59import { existsSync , readFileSync } from 'fs' ;
610import {
@@ -84,7 +88,7 @@ type TransitiveLookupFunction = (
8488 parentPackage : string ,
8589 versions : PackageVersions ,
8690 version : string
87- ) => string ;
91+ ) => PackageDependency ;
8892
8993export function mapExternalNodes (
9094 lockFileData : LockFileData ,
@@ -182,7 +186,7 @@ function mapTransitiveDependencies(
182186 parentPackage ,
183187 packages [ packageName ] ,
184188 cleanVersion
185- ) ;
189+ ) ?. version ;
186190 // for some peer dependencies, we won't find installed version so we'll just ignore these
187191 if ( version ) {
188192 const nodeName = getNodeName (
Original file line number Diff line number Diff line change @@ -160,10 +160,14 @@ export function transitiveDependencyYarnLookup(
160160 parentPackage : string ,
161161 versions : PackageVersions ,
162162 version : string
163- ) : string {
163+ ) : PackageDependency {
164164 return Object . values ( versions ) . find ( ( v ) =>
165- v . packageMeta . some ( ( p ) => p === `${ packageName } @${ version } ` )
166- ) ?. version ;
165+ v . packageMeta . some (
166+ ( p ) =>
167+ p === `${ packageName } @${ version } ` ||
168+ p === `${ packageName } @npm:${ version } `
169+ )
170+ ) ;
167171}
168172
169173/**
You can’t perform that action at this time.
0 commit comments