@@ -12,29 +12,29 @@ function toRepoUrl(resolved: string): string {
1212 return ''
1313}
1414
15- export type InstallEffect = {
15+ export type PackageDetail = {
1616 pkgid : SafeNode [ 'pkgid' ]
1717 repository_url : string
1818 existing ?: SafeNode [ 'pkgid' ] | undefined
1919}
2020
21- export type WalkOptions = { fix ?: boolean }
21+ type GetPackagesToQueryFromDiffOptions = { includeUnchanged ?: boolean }
2222
23- export function walk (
23+ export function getPackagesToQueryFromDiff (
2424 diff_ : Diff | null ,
25- options ?: WalkOptions
26- ) : InstallEffect [ ] {
25+ options ?: GetPackagesToQueryFromDiffOptions
26+ ) : PackageDetail [ ] {
2727 const {
2828 // Lazily access constants.IPC.
29- fix = constants . IPC [ SOCKET_CLI_FIX_PACKAGE_LOCK_FILE ]
30- } = < WalkOptions > {
29+ includeUnchanged = constants . IPC [ SOCKET_CLI_FIX_PACKAGE_LOCK_FILE ]
30+ } = < GetPackagesToQueryFromDiffOptions > {
3131 __proto__ : null ,
3232 ...options
3333 }
34- const needInfoOn : InstallEffect [ ] = [ ]
34+ const details : PackageDetail [ ] = [ ]
3535 // `diff_` is `null` when `npm install --package-lock-only` is passed.
3636 if ( ! diff_ ) {
37- return needInfoOn
37+ return details
3838 }
3939 const queue : Diff [ ] = [ ...diff_ . children ]
4040 let pos = 0
@@ -70,7 +70,7 @@ export function walk(
7070 keep = action !== 'REMOVE'
7171 }
7272 if ( keep && pkgNode ?. resolved && ( ! oldNode || oldNode . resolved ) ) {
73- needInfoOn . push ( {
73+ details . push ( {
7474 existing,
7575 pkgid : pkgNode . pkgid ,
7676 repository_url : toRepoUrl ( pkgNode . resolved )
@@ -81,16 +81,16 @@ export function walk(
8181 queue [ queueLength ++ ] = child
8282 }
8383 }
84- if ( fix ) {
84+ if ( includeUnchanged ) {
8585 const { unchanged } = diff_ !
8686 for ( let i = 0 , { length } = unchanged ; i < length ; i += 1 ) {
8787 const pkgNode = unchanged [ i ] !
88- needInfoOn . push ( {
88+ details . push ( {
8989 existing : pkgNode . pkgid ,
9090 pkgid : pkgNode . pkgid ,
9191 repository_url : toRepoUrl ( pkgNode . resolved ! )
9292 } )
9393 }
9494 }
95- return needInfoOn
95+ return details
9696}
0 commit comments