@@ -102,7 +102,8 @@ function findPackage(tree: SafeNode, packageName: string): SafeNode | null {
102
102
103
103
type GetPackageAlertsOptions = {
104
104
output ?: Writable
105
- fixable ?: boolean
105
+ includeExisting ?: boolean
106
+ includeUnfixable ?: boolean
106
107
}
107
108
108
109
async function getPackagesAlerts (
@@ -115,7 +116,11 @@ async function getPackagesAlerts(
115
116
if ( ! remaining ) {
116
117
return packageAlerts
117
118
}
118
- const { fixable, output } = < GetPackageAlertsOptions > {
119
+ const {
120
+ includeExisting = false ,
121
+ includeUnfixable = true ,
122
+ output
123
+ } = < GetPackageAlertsOptions > {
119
124
__proto__ : null ,
120
125
...options
121
126
}
@@ -149,24 +154,27 @@ async function getPackagesAlerts(
149
154
displayWarning = true
150
155
}
151
156
if ( ux . block || ux . display ) {
152
- const isFixable = isArtifactAlertFixable ( alert )
153
- if ( ! fixable || isFixable ) {
157
+ const fixable = isArtifactAlertFixable ( alert )
158
+ if ( includeUnfixable || fixable ) {
154
159
alerts . push ( {
155
160
name,
156
161
version,
157
162
key : alert . key ,
158
163
type : alert . type ,
159
164
block : ux . block ,
160
165
raw : alert ,
161
- fixable : isFixable
166
+ fixable
162
167
} )
163
168
}
164
169
// Lazily access constants.IPC.
165
- if ( ! fixable && ! constants . IPC [ SOCKET_CLI_FIX_PACKAGE_LOCK_FILE ] ) {
170
+ if (
171
+ includeExisting &&
172
+ ! constants . IPC [ SOCKET_CLI_FIX_PACKAGE_LOCK_FILE ]
173
+ ) {
166
174
// Before we ask about problematic issues, check to see if they
167
175
// already existed in the old version if they did, be quiet.
168
- const existing = pkgs . find ( p =>
169
- p . existing ?. startsWith ( `${ name } @` )
176
+ const existing = details . find ( d =>
177
+ d . existing ?. startsWith ( `${ name } @` )
170
178
) ?. existing
171
179
if ( existing ) {
172
180
const oldArtifact : SocketArtifact | undefined =
@@ -182,8 +190,7 @@ async function getPackagesAlerts(
182
190
}
183
191
}
184
192
if ( ! blocked ) {
185
- const pkg = pkgs . find ( p => p . pkgid === id )
186
- if ( pkg ) {
193
+ if ( details . find ( d => d . pkgid === id ) ) {
187
194
await pacote . tarball . stream (
188
195
id ,
189
196
stream => {
@@ -424,15 +431,16 @@ export async function reify(
424
431
ret = await this [ kRiskyReify ] ( ...args )
425
432
await this . loadActual ( )
426
433
await this . buildIdealTree ( )
427
- alerts = await getPackagesAlerts (
428
- this ,
429
- getPackagesToQueryFromDiff ( this . diff , { includeUnchanged : true } ) ,
430
- {
431
- fixable : true
432
- }
433
- )
434
- alerts = alerts . filter ( a => {
435
- const { key } = a
434
+ alerts = (
435
+ await getPackagesAlerts (
436
+ this ,
437
+ getPackagesToQueryFromDiff ( this . diff , { includeUnchanged : true } ) ,
438
+ {
439
+ includeExisting : true ,
440
+ includeUnfixable : true
441
+ }
442
+ )
443
+ ) . filter ( ( { key } ) => {
436
444
if ( prev . has ( key ) ) {
437
445
return false
438
446
}
0 commit comments