Skip to content

Commit 1926aa3

Browse files
committed
Remove unneeded pacote.tarball.stream use in src/shadow/arborist/lib/arborist/reify
1 parent b7cacd4 commit 1926aa3

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/shadow/arborist/lib/arborist/reify.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { confirm } from '@socketsecurity/registry/lib/prompts'
1313
import { Spinner } from '@socketsecurity/registry/lib/spinner'
1414

1515
import { getPackagesToQueryFromDiff } from './diff'
16-
import { kCtorArgs, kRiskyReify } from './index'
16+
import { kRiskyReify } from './index'
1717
import constants from '../../../../constants'
1818
import {
1919
batchScan,
@@ -24,7 +24,6 @@ import { uxLookup } from '../../../../utils/alert/rules'
2424
import { ColorOrMarkdown } from '../../../../utils/color-or-markdown'
2525
import { debugLog } from '../../../../utils/debug'
2626
import { getSocketDevPackageOverviewUrl } from '../../../../utils/socket-url'
27-
import { pacotePath } from '../../../npm-paths'
2827
import { Edge, SafeEdge } from '../edge'
2928

3029
import type { PackageDetail } from './diff'
@@ -43,8 +42,6 @@ type SocketPackageAlert = {
4342
raw?: any
4443
}
4544

46-
const pacote: typeof import('pacote') = require(pacotePath)
47-
4845
const {
4946
LOOP_SENTINEL,
5047
NPM,
@@ -107,7 +104,7 @@ type GetPackageAlertsOptions = {
107104
}
108105

109106
async function getPackagesAlerts(
110-
safeArb: SafeArborist,
107+
_safeArb: SafeArborist,
111108
details: PackageDetail[],
112109
options?: GetPackageAlertsOptions
113110
): Promise<SocketPackageAlert[]> {
@@ -138,7 +135,6 @@ async function getPackagesAlerts(
138135
const name = resolvePackageName(<any>artifact)
139136
const id = `${name}@${artifact.version}`
140137

141-
let blocked = false
142138
let displayWarning = false
143139
let alerts: SocketPackageAlert[] = []
144140
for (const alert of artifact.alerts) {
@@ -147,9 +143,6 @@ async function getPackagesAlerts(
147143
package: { name, version },
148144
alert: { type: alert.type }
149145
})
150-
if (ux.block) {
151-
blocked = true
152-
}
153146
if (ux.display && output) {
154147
displayWarning = true
155148
}
@@ -189,18 +182,6 @@ async function getPackagesAlerts(
189182
}
190183
}
191184
}
192-
if (!blocked) {
193-
if (details.find(d => d.pkgid === id)) {
194-
await pacote.tarball.stream(
195-
id,
196-
stream => {
197-
stream.resume()
198-
return (stream as any).promise()
199-
},
200-
{ ...(safeArb as any)[kCtorArgs][0] }
201-
)
202-
}
203-
}
204185
if (displayWarning && spinner) {
205186
spinner.stop(
206187
`(socket) ${formatter.hyperlink(id, getSocketDevPackageOverviewUrl(NPM, name, version))} contains risks:`

src/shadow/npm-paths.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ export const arboristOverrideSetClassPath = path.join(
3838
arboristPkgPath,
3939
'lib/override-set.js'
4040
)
41-
export const pacotePath = path.join(npmNmPath, 'pacote')

0 commit comments

Comments
 (0)