@@ -12,29 +12,29 @@ function toRepoUrl(resolved: string): string {
12
12
return ''
13
13
}
14
14
15
- export type InstallEffect = {
15
+ export type PackageDetail = {
16
16
pkgid : SafeNode [ 'pkgid' ]
17
17
repository_url : string
18
18
existing ?: SafeNode [ 'pkgid' ] | undefined
19
19
}
20
20
21
- export type WalkOptions = { fix ?: boolean }
21
+ type GetPackagesToQueryFromDiffOptions = { includeUnchanged ?: boolean }
22
22
23
- export function walk (
23
+ export function getPackagesToQueryFromDiff (
24
24
diff_ : Diff | null ,
25
- options ?: WalkOptions
26
- ) : InstallEffect [ ] {
25
+ options ?: GetPackagesToQueryFromDiffOptions
26
+ ) : PackageDetail [ ] {
27
27
const {
28
28
// 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 > {
31
31
__proto__ : null ,
32
32
...options
33
33
}
34
- const needInfoOn : InstallEffect [ ] = [ ]
34
+ const details : PackageDetail [ ] = [ ]
35
35
// `diff_` is `null` when `npm install --package-lock-only` is passed.
36
36
if ( ! diff_ ) {
37
- return needInfoOn
37
+ return details
38
38
}
39
39
const queue : Diff [ ] = [ ...diff_ . children ]
40
40
let pos = 0
@@ -70,7 +70,7 @@ export function walk(
70
70
keep = action !== 'REMOVE'
71
71
}
72
72
if ( keep && pkgNode ?. resolved && ( ! oldNode || oldNode . resolved ) ) {
73
- needInfoOn . push ( {
73
+ details . push ( {
74
74
existing,
75
75
pkgid : pkgNode . pkgid ,
76
76
repository_url : toRepoUrl ( pkgNode . resolved )
@@ -81,16 +81,16 @@ export function walk(
81
81
queue [ queueLength ++ ] = child
82
82
}
83
83
}
84
- if ( fix ) {
84
+ if ( includeUnchanged ) {
85
85
const { unchanged } = diff_ !
86
86
for ( let i = 0 , { length } = unchanged ; i < length ; i += 1 ) {
87
87
const pkgNode = unchanged [ i ] !
88
- needInfoOn . push ( {
88
+ details . push ( {
89
89
existing : pkgNode . pkgid ,
90
90
pkgid : pkgNode . pkgid ,
91
91
repository_url : toRepoUrl ( pkgNode . resolved ! )
92
92
} )
93
93
}
94
94
}
95
- return needInfoOn
95
+ return details
96
96
}
0 commit comments