socket 0.14.85 → 0.14.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module-sync/cli.js +139 -97
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +14 -7
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/require/cli.js +139 -97
- package/dist/require/cli.js.map +1 -1
- package/package.json +1 -1
- package/dist/module-sync/fs.d.ts +0 -61
package/dist/module-sync/cli.js
CHANGED
|
@@ -915,7 +915,7 @@ function emitBanner(name) {
|
|
|
915
915
|
logger.logger.error(getAsciiHeader(name))
|
|
916
916
|
}
|
|
917
917
|
function getAsciiHeader(command) {
|
|
918
|
-
const cliVersion = '0.14.
|
|
918
|
+
const cliVersion = '0.14.87:0330c30:fe025f7e:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
919
919
|
const nodeVersion = process$1.version
|
|
920
920
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
921
921
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
|
|
@@ -3903,7 +3903,6 @@ async function npmFix(
|
|
|
3903
3903
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
3904
3904
|
editable: true
|
|
3905
3905
|
})
|
|
3906
|
-
const { content: pkgJson } = editablePkgJson
|
|
3907
3906
|
await arb.buildIdealTree()
|
|
3908
3907
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
3909
3908
|
const hasUpgrade = !!registry.getManifestData(NPM$f, name)
|
|
@@ -3945,36 +3944,40 @@ async function npmFix(
|
|
|
3945
3944
|
continue
|
|
3946
3945
|
}
|
|
3947
3946
|
const oldSpec = `${name}@${oldVersion}`
|
|
3947
|
+
let targetVersion
|
|
3948
|
+
let failed = false
|
|
3949
|
+
let installed = false
|
|
3950
|
+
let saved = false
|
|
3948
3951
|
if (
|
|
3949
3952
|
shadowNpmInject.updateNode(node, packument, vulnerableVersionRange)
|
|
3950
3953
|
) {
|
|
3951
|
-
|
|
3954
|
+
targetVersion = node.package.version
|
|
3952
3955
|
const fixSpec = `${name}@^${targetVersion}`
|
|
3953
3956
|
const revertData = {
|
|
3954
|
-
...(
|
|
3957
|
+
...(editablePkgJson.content.dependencies
|
|
3955
3958
|
? {
|
|
3956
|
-
dependencies:
|
|
3959
|
+
dependencies: editablePkgJson.content.dependencies
|
|
3957
3960
|
}
|
|
3958
3961
|
: undefined),
|
|
3959
|
-
...(
|
|
3962
|
+
...(editablePkgJson.content.optionalDependencies
|
|
3960
3963
|
? {
|
|
3961
|
-
optionalDependencies:
|
|
3964
|
+
optionalDependencies:
|
|
3965
|
+
editablePkgJson.content.optionalDependencies
|
|
3962
3966
|
}
|
|
3963
3967
|
: undefined),
|
|
3964
|
-
...(
|
|
3968
|
+
...(editablePkgJson.content.peerDependencies
|
|
3965
3969
|
? {
|
|
3966
|
-
peerDependencies:
|
|
3970
|
+
peerDependencies: editablePkgJson.content.peerDependencies
|
|
3967
3971
|
}
|
|
3968
3972
|
: undefined)
|
|
3969
3973
|
}
|
|
3970
3974
|
spinner?.info(`Installing ${fixSpec}`)
|
|
3971
|
-
let saved = false
|
|
3972
|
-
let installed = false
|
|
3973
3975
|
try {
|
|
3974
3976
|
shadowNpmInject.updatePackageJsonFromNode(
|
|
3975
3977
|
editablePkgJson,
|
|
3976
3978
|
arb.idealTree,
|
|
3977
3979
|
node,
|
|
3980
|
+
targetVersion,
|
|
3978
3981
|
rangeStyle
|
|
3979
3982
|
)
|
|
3980
3983
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -3996,20 +3999,8 @@ async function npmFix(
|
|
|
3996
3999
|
}
|
|
3997
4000
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
3998
4001
|
spinner?.start()
|
|
3999
|
-
// Lazily access constants.ENV[CI].
|
|
4000
|
-
if (constants.ENV[CI$1]) {
|
|
4001
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4002
|
-
const prResponse = await openGitHubPullRequest(
|
|
4003
|
-
name,
|
|
4004
|
-
targetVersion,
|
|
4005
|
-
cwd
|
|
4006
|
-
)
|
|
4007
|
-
if (autoMerge) {
|
|
4008
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4009
|
-
await enableAutoMerge(prResponse.data)
|
|
4010
|
-
}
|
|
4011
|
-
}
|
|
4012
4002
|
} catch {
|
|
4003
|
+
failed = true
|
|
4013
4004
|
spinner?.error(`Reverting ${fixSpec}`)
|
|
4014
4005
|
if (saved) {
|
|
4015
4006
|
editablePkgJson.update(revertData)
|
|
@@ -4025,8 +4016,35 @@ async function npmFix(
|
|
|
4025
4016
|
spinner?.failAndStop(`Failed to fix ${oldSpec}`)
|
|
4026
4017
|
}
|
|
4027
4018
|
} else {
|
|
4019
|
+
failed = true
|
|
4028
4020
|
spinner?.failAndStop(`Could not patch ${oldSpec}`)
|
|
4029
4021
|
}
|
|
4022
|
+
if (
|
|
4023
|
+
!failed &&
|
|
4024
|
+
// Check targetVersion to make TypeScript happy.
|
|
4025
|
+
targetVersion &&
|
|
4026
|
+
// Lazily access constants.ENV[CI].
|
|
4027
|
+
constants.ENV[CI$1]
|
|
4028
|
+
) {
|
|
4029
|
+
let prResponse
|
|
4030
|
+
try {
|
|
4031
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4032
|
+
prResponse = await openGitHubPullRequest(name, targetVersion, cwd)
|
|
4033
|
+
} catch (e) {
|
|
4034
|
+
logger.logger.error('Failed to open pull request', e)
|
|
4035
|
+
}
|
|
4036
|
+
if (prResponse && autoMerge) {
|
|
4037
|
+
try {
|
|
4038
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4039
|
+
await enableAutoMerge(prResponse.data)
|
|
4040
|
+
} catch (e) {
|
|
4041
|
+
logger.logger.error(
|
|
4042
|
+
'Failed to enable auto-merge in pull request',
|
|
4043
|
+
e
|
|
4044
|
+
)
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4030
4048
|
}
|
|
4031
4049
|
}
|
|
4032
4050
|
}
|
|
@@ -4210,7 +4228,7 @@ function runAgentInstall(pkgEnvDetails, options) {
|
|
|
4210
4228
|
...options
|
|
4211
4229
|
}
|
|
4212
4230
|
const skipNodeHardenFlags =
|
|
4213
|
-
|
|
4231
|
+
agent === PNPM$a && pkgEnvDetails.agentVersion.major < 11
|
|
4214
4232
|
return spawn.spawn(agentExecPath, ['install', ...args], {
|
|
4215
4233
|
spinner,
|
|
4216
4234
|
stdio: 'inherit',
|
|
@@ -4231,8 +4249,15 @@ function runAgentInstall(pkgEnvDetails, options) {
|
|
|
4231
4249
|
}
|
|
4232
4250
|
|
|
4233
4251
|
const { CI, NPM: NPM$c, OVERRIDES: OVERRIDES$2, PNPM: PNPM$9 } = constants
|
|
4234
|
-
async function
|
|
4235
|
-
const
|
|
4252
|
+
async function getActualTree(cwd = process.cwd()) {
|
|
4253
|
+
const arb = new shadowNpmInject.SafeArborist({
|
|
4254
|
+
path: cwd,
|
|
4255
|
+
...shadowNpmInject.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES
|
|
4256
|
+
})
|
|
4257
|
+
return await arb.loadActual()
|
|
4258
|
+
}
|
|
4259
|
+
async function install(pkgEnvDetails, options) {
|
|
4260
|
+
const { cwd, spinner } = {
|
|
4236
4261
|
__proto__: null,
|
|
4237
4262
|
...options
|
|
4238
4263
|
}
|
|
@@ -4241,8 +4266,7 @@ async function install(pkgEnvDetails, arb, options) {
|
|
|
4241
4266
|
spinner,
|
|
4242
4267
|
stdio: debug.isDebug() ? 'inherit' : 'ignore'
|
|
4243
4268
|
})
|
|
4244
|
-
|
|
4245
|
-
await arb.loadActual()
|
|
4269
|
+
return await getActualTree(cwd)
|
|
4246
4270
|
}
|
|
4247
4271
|
async function pnpmFix(
|
|
4248
4272
|
pkgEnvDetails,
|
|
@@ -4271,12 +4295,7 @@ async function pnpmFix(
|
|
|
4271
4295
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
4272
4296
|
editable: true
|
|
4273
4297
|
})
|
|
4274
|
-
|
|
4275
|
-
const arb = new shadowNpmInject.SafeArborist({
|
|
4276
|
-
path: cwd,
|
|
4277
|
-
...shadowNpmInject.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES
|
|
4278
|
-
})
|
|
4279
|
-
await arb.loadActual()
|
|
4298
|
+
let actualTree = await getActualTree(cwd)
|
|
4280
4299
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4281
4300
|
if (registry.getManifestData(NPM$c, name)) {
|
|
4282
4301
|
spinner?.info(`Skipping ${name}. Socket Optimize package exists.`)
|
|
@@ -4284,7 +4303,7 @@ async function pnpmFix(
|
|
|
4284
4303
|
}
|
|
4285
4304
|
const specs = arrays.arrayUnique(
|
|
4286
4305
|
shadowNpmInject
|
|
4287
|
-
.findPackageNodes(
|
|
4306
|
+
.findPackageNodes(actualTree, name)
|
|
4288
4307
|
.map(n => `${n.name}@${n.version}`)
|
|
4289
4308
|
)
|
|
4290
4309
|
const packument =
|
|
@@ -4304,7 +4323,7 @@ async function pnpmFix(
|
|
|
4304
4323
|
vulnerableVersionRange
|
|
4305
4324
|
} of infos) {
|
|
4306
4325
|
const node = shadowNpmInject.findPackageNode(
|
|
4307
|
-
|
|
4326
|
+
actualTree,
|
|
4308
4327
|
name,
|
|
4309
4328
|
oldVersion
|
|
4310
4329
|
)
|
|
@@ -4321,15 +4340,22 @@ async function pnpmFix(
|
|
|
4321
4340
|
const targetPackument = targetVersion
|
|
4322
4341
|
? packument.versions[targetVersion]
|
|
4323
4342
|
: undefined
|
|
4343
|
+
let failed = false
|
|
4344
|
+
let installed = false
|
|
4345
|
+
let saved = false
|
|
4324
4346
|
if (targetVersion && targetPackument) {
|
|
4325
|
-
const oldPnpm =
|
|
4326
|
-
const
|
|
4347
|
+
const oldPnpm = editablePkgJson.content[PNPM$9]
|
|
4348
|
+
const oldPnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
|
|
4327
4349
|
const oldOverrides = oldPnpm?.[OVERRIDES$2]
|
|
4328
|
-
const
|
|
4350
|
+
const oldOverridesCount = oldOverrides
|
|
4329
4351
|
? Object.keys(oldOverrides).length
|
|
4330
4352
|
: 0
|
|
4331
4353
|
const overrideKey = `${node.name}@${vulnerableVersionRange}`
|
|
4332
|
-
const overrideRange =
|
|
4354
|
+
const overrideRange = shadowNpmInject.applyRange(
|
|
4355
|
+
oldOverrides?.[overrideKey] ?? targetVersion,
|
|
4356
|
+
targetVersion,
|
|
4357
|
+
rangeStyle
|
|
4358
|
+
)
|
|
4333
4359
|
const fixSpec = `${name}@${overrideRange}`
|
|
4334
4360
|
const updateData = {
|
|
4335
4361
|
[PNPM$9]: {
|
|
@@ -4341,11 +4367,11 @@ async function pnpmFix(
|
|
|
4341
4367
|
}
|
|
4342
4368
|
}
|
|
4343
4369
|
const revertData = {
|
|
4344
|
-
[PNPM$9]:
|
|
4370
|
+
[PNPM$9]: oldPnpmKeyCount
|
|
4345
4371
|
? {
|
|
4346
4372
|
...oldPnpm,
|
|
4347
4373
|
[OVERRIDES$2]:
|
|
4348
|
-
|
|
4374
|
+
oldOverridesCount === 1
|
|
4349
4375
|
? undefined
|
|
4350
4376
|
: {
|
|
4351
4377
|
[overrideKey]: undefined,
|
|
@@ -4353,31 +4379,31 @@ async function pnpmFix(
|
|
|
4353
4379
|
}
|
|
4354
4380
|
}
|
|
4355
4381
|
: undefined,
|
|
4356
|
-
...(
|
|
4382
|
+
...(editablePkgJson.content.dependencies
|
|
4357
4383
|
? {
|
|
4358
|
-
dependencies:
|
|
4384
|
+
dependencies: editablePkgJson.content.dependencies
|
|
4359
4385
|
}
|
|
4360
4386
|
: undefined),
|
|
4361
|
-
...(
|
|
4387
|
+
...(editablePkgJson.content.optionalDependencies
|
|
4362
4388
|
? {
|
|
4363
|
-
optionalDependencies:
|
|
4389
|
+
optionalDependencies:
|
|
4390
|
+
editablePkgJson.content.optionalDependencies
|
|
4364
4391
|
}
|
|
4365
4392
|
: undefined),
|
|
4366
|
-
...(
|
|
4393
|
+
...(editablePkgJson.content.peerDependencies
|
|
4367
4394
|
? {
|
|
4368
|
-
peerDependencies:
|
|
4395
|
+
peerDependencies: editablePkgJson.content.peerDependencies
|
|
4369
4396
|
}
|
|
4370
4397
|
: undefined)
|
|
4371
4398
|
}
|
|
4372
4399
|
spinner?.info(`Installing ${fixSpec}`)
|
|
4373
|
-
let saved = false
|
|
4374
|
-
let installed = false
|
|
4375
4400
|
try {
|
|
4376
4401
|
editablePkgJson.update(updateData)
|
|
4377
4402
|
shadowNpmInject.updatePackageJsonFromNode(
|
|
4378
4403
|
editablePkgJson,
|
|
4379
|
-
|
|
4404
|
+
actualTree,
|
|
4380
4405
|
node,
|
|
4406
|
+
targetVersion,
|
|
4381
4407
|
rangeStyle
|
|
4382
4408
|
)
|
|
4383
4409
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -4385,7 +4411,7 @@ async function pnpmFix(
|
|
|
4385
4411
|
saved = true
|
|
4386
4412
|
|
|
4387
4413
|
// eslint-disable-next-line no-await-in-loop
|
|
4388
|
-
await install(pkgEnvDetails,
|
|
4414
|
+
actualTree = await install(pkgEnvDetails, {
|
|
4389
4415
|
spinner
|
|
4390
4416
|
})
|
|
4391
4417
|
installed = true
|
|
@@ -4399,21 +4425,8 @@ async function pnpmFix(
|
|
|
4399
4425
|
}
|
|
4400
4426
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4401
4427
|
spinner?.start()
|
|
4402
|
-
|
|
4403
|
-
// Lazily access constants.ENV[CI].
|
|
4404
|
-
if (constants.ENV[CI]) {
|
|
4405
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4406
|
-
const prResponse = await openGitHubPullRequest(
|
|
4407
|
-
name,
|
|
4408
|
-
targetVersion,
|
|
4409
|
-
cwd
|
|
4410
|
-
)
|
|
4411
|
-
if (autoMerge) {
|
|
4412
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4413
|
-
await enableAutoMerge(prResponse.data)
|
|
4414
|
-
}
|
|
4415
|
-
}
|
|
4416
4428
|
} catch (e) {
|
|
4429
|
+
failed = true
|
|
4417
4430
|
spinner?.error(`Reverting ${fixSpec}`, e)
|
|
4418
4431
|
if (saved) {
|
|
4419
4432
|
editablePkgJson.update(revertData)
|
|
@@ -4422,15 +4435,42 @@ async function pnpmFix(
|
|
|
4422
4435
|
}
|
|
4423
4436
|
if (installed) {
|
|
4424
4437
|
// eslint-disable-next-line no-await-in-loop
|
|
4425
|
-
await install(pkgEnvDetails,
|
|
4438
|
+
actualTree = await install(pkgEnvDetails, {
|
|
4426
4439
|
spinner
|
|
4427
4440
|
})
|
|
4428
4441
|
}
|
|
4429
4442
|
spinner?.failAndStop(`Failed to fix ${oldSpec}`)
|
|
4430
4443
|
}
|
|
4431
4444
|
} else {
|
|
4445
|
+
failed = true
|
|
4432
4446
|
spinner?.failAndStop(`Could not patch ${oldSpec}`)
|
|
4433
4447
|
}
|
|
4448
|
+
if (
|
|
4449
|
+
!failed &&
|
|
4450
|
+
// Check targetVersion to make TypeScript happy.
|
|
4451
|
+
targetVersion &&
|
|
4452
|
+
// Lazily access constants.ENV[CI].
|
|
4453
|
+
constants.ENV[CI]
|
|
4454
|
+
) {
|
|
4455
|
+
let prResponse
|
|
4456
|
+
try {
|
|
4457
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4458
|
+
prResponse = await openGitHubPullRequest(name, targetVersion, cwd)
|
|
4459
|
+
} catch (e) {
|
|
4460
|
+
logger.logger.error('Failed to open pull request', e)
|
|
4461
|
+
}
|
|
4462
|
+
if (prResponse && autoMerge) {
|
|
4463
|
+
try {
|
|
4464
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4465
|
+
await enableAutoMerge(prResponse.data)
|
|
4466
|
+
} catch (e) {
|
|
4467
|
+
logger.logger.error(
|
|
4468
|
+
'Failed to enable auto-merge in pull request',
|
|
4469
|
+
e
|
|
4470
|
+
)
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4434
4474
|
}
|
|
4435
4475
|
}
|
|
4436
4476
|
}
|
|
@@ -6362,13 +6402,13 @@ const depsIncludesByAgent = new Map([
|
|
|
6362
6402
|
[YARN_CLASSIC$5, matchLsCmdViewHumanStdout]
|
|
6363
6403
|
])
|
|
6364
6404
|
|
|
6365
|
-
function getDependencyEntries(
|
|
6405
|
+
function getDependencyEntries(editablePkgJson) {
|
|
6366
6406
|
const {
|
|
6367
6407
|
dependencies,
|
|
6368
6408
|
devDependencies,
|
|
6369
6409
|
optionalDependencies,
|
|
6370
6410
|
peerDependencies
|
|
6371
|
-
} =
|
|
6411
|
+
} = editablePkgJson.content
|
|
6372
6412
|
return [
|
|
6373
6413
|
[
|
|
6374
6414
|
'dependencies',
|
|
@@ -6419,8 +6459,8 @@ const {
|
|
|
6419
6459
|
YARN_BERRY: YARN_BERRY$3,
|
|
6420
6460
|
YARN_CLASSIC: YARN_CLASSIC$4
|
|
6421
6461
|
} = constants
|
|
6422
|
-
function getOverridesDataBun(
|
|
6423
|
-
const overrides =
|
|
6462
|
+
function getOverridesDataBun(editablePkgJson) {
|
|
6463
|
+
const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
|
|
6424
6464
|
return {
|
|
6425
6465
|
type: YARN_BERRY$3,
|
|
6426
6466
|
overrides
|
|
@@ -6429,8 +6469,8 @@ function getOverridesDataBun(pkgJson) {
|
|
|
6429
6469
|
|
|
6430
6470
|
// npm overrides documentation:
|
|
6431
6471
|
// https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides
|
|
6432
|
-
function getOverridesDataNpm(
|
|
6433
|
-
const overrides =
|
|
6472
|
+
function getOverridesDataNpm(editablePkgJson) {
|
|
6473
|
+
const overrides = editablePkgJson.content?.[OVERRIDES$1] ?? {}
|
|
6434
6474
|
return {
|
|
6435
6475
|
type: NPM$5,
|
|
6436
6476
|
overrides
|
|
@@ -6439,15 +6479,15 @@ function getOverridesDataNpm(pkgJson) {
|
|
|
6439
6479
|
|
|
6440
6480
|
// pnpm overrides documentation:
|
|
6441
6481
|
// https://pnpm.io/package_json#pnpmoverrides
|
|
6442
|
-
function getOverridesDataPnpm(
|
|
6443
|
-
const overrides =
|
|
6482
|
+
function getOverridesDataPnpm(editablePkgJson) {
|
|
6483
|
+
const overrides = editablePkgJson.content?.[PNPM$5]?.[OVERRIDES$1] ?? {}
|
|
6444
6484
|
return {
|
|
6445
6485
|
type: PNPM$5,
|
|
6446
6486
|
overrides
|
|
6447
6487
|
}
|
|
6448
6488
|
}
|
|
6449
|
-
function getOverridesDataVlt(
|
|
6450
|
-
const overrides =
|
|
6489
|
+
function getOverridesDataVlt(editablePkgJson) {
|
|
6490
|
+
const overrides = editablePkgJson.content?.[OVERRIDES$1] ?? {}
|
|
6451
6491
|
return {
|
|
6452
6492
|
type: VLT$3,
|
|
6453
6493
|
overrides
|
|
@@ -6456,8 +6496,8 @@ function getOverridesDataVlt(pkgJson) {
|
|
|
6456
6496
|
|
|
6457
6497
|
// Yarn resolutions documentation:
|
|
6458
6498
|
// https://yarnpkg.com/configuration/manifest#resolutions
|
|
6459
|
-
function getOverridesDataYarn(
|
|
6460
|
-
const overrides =
|
|
6499
|
+
function getOverridesDataYarn(editablePkgJson) {
|
|
6500
|
+
const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
|
|
6461
6501
|
return {
|
|
6462
6502
|
type: YARN_BERRY$3,
|
|
6463
6503
|
overrides
|
|
@@ -6466,8 +6506,8 @@ function getOverridesDataYarn(pkgJson) {
|
|
|
6466
6506
|
|
|
6467
6507
|
// Yarn resolutions documentation:
|
|
6468
6508
|
// https://classic.yarnpkg.com/en/docs/selective-version-resolutions
|
|
6469
|
-
function
|
|
6470
|
-
const overrides =
|
|
6509
|
+
function getOverridesDataYarnClassic(editablePkgJson) {
|
|
6510
|
+
const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
|
|
6471
6511
|
return {
|
|
6472
6512
|
type: YARN_CLASSIC$4,
|
|
6473
6513
|
overrides
|
|
@@ -6479,12 +6519,12 @@ const overridesDataByAgent = new Map([
|
|
|
6479
6519
|
[PNPM$5, getOverridesDataPnpm],
|
|
6480
6520
|
[VLT$3, getOverridesDataVlt],
|
|
6481
6521
|
[YARN_BERRY$3, getOverridesDataYarn],
|
|
6482
|
-
[YARN_CLASSIC$4,
|
|
6522
|
+
[YARN_CLASSIC$4, getOverridesDataYarnClassic]
|
|
6483
6523
|
])
|
|
6484
6524
|
|
|
6485
6525
|
const { PNPM: PNPM$4 } = constants
|
|
6486
6526
|
const PNPM_WORKSPACE = `${PNPM$4}-workspace`
|
|
6487
|
-
async function getWorkspaceGlobs(agent, pkgPath,
|
|
6527
|
+
async function getWorkspaceGlobs(agent, pkgPath, editablePkgJson) {
|
|
6488
6528
|
let workspacePatterns
|
|
6489
6529
|
if (agent === PNPM$4) {
|
|
6490
6530
|
for (const workspacePath of [
|
|
@@ -6503,7 +6543,7 @@ async function getWorkspaceGlobs(agent, pkgPath, pkgJson) {
|
|
|
6503
6543
|
}
|
|
6504
6544
|
}
|
|
6505
6545
|
} else {
|
|
6506
|
-
workspacePatterns =
|
|
6546
|
+
workspacePatterns = editablePkgJson.content['workspaces']
|
|
6507
6547
|
}
|
|
6508
6548
|
return Array.isArray(workspacePatterns)
|
|
6509
6549
|
? workspacePatterns
|
|
@@ -6776,8 +6816,7 @@ function getHighestEntryIndex(entries, keys) {
|
|
|
6776
6816
|
return getEntryIndexes(entries, keys).at(-1) ?? -1
|
|
6777
6817
|
}
|
|
6778
6818
|
function updatePkgJsonField(editablePkgJson, field, value) {
|
|
6779
|
-
const
|
|
6780
|
-
const oldValue = pkgJson[field]
|
|
6819
|
+
const oldValue = editablePkgJson.content[field]
|
|
6781
6820
|
if (oldValue) {
|
|
6782
6821
|
// The field already exists so we simply update the field value.
|
|
6783
6822
|
if (field === PNPM$1) {
|
|
@@ -6828,7 +6867,7 @@ function updatePkgJsonField(editablePkgJson, field, value) {
|
|
|
6828
6867
|
// Since the field doesn't exist we want to insert it into the package.json
|
|
6829
6868
|
// in a place that makes sense, e.g. close to the "dependencies" field. If
|
|
6830
6869
|
// we can't find a place to insert the field we'll add it to the bottom.
|
|
6831
|
-
const entries = Object.entries(
|
|
6870
|
+
const entries = Object.entries(editablePkgJson.content)
|
|
6832
6871
|
let insertIndex = -1
|
|
6833
6872
|
let isPlacingHigher = false
|
|
6834
6873
|
if (field === OVERRIDES) {
|
|
@@ -6927,9 +6966,12 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
|
|
|
6927
6966
|
editable: true
|
|
6928
6967
|
})
|
|
6929
6968
|
}
|
|
6930
|
-
const { content: pkgJson } = editablePkgJson
|
|
6931
6969
|
const workspaceName = path$1.relative(rootPath, pkgPath)
|
|
6932
|
-
const workspaceGlobs = await getWorkspaceGlobs(
|
|
6970
|
+
const workspaceGlobs = await getWorkspaceGlobs(
|
|
6971
|
+
agent,
|
|
6972
|
+
pkgPath,
|
|
6973
|
+
editablePkgJson
|
|
6974
|
+
)
|
|
6933
6975
|
const isRoot = pkgPath === rootPath
|
|
6934
6976
|
const isLockScanned = isRoot && !prod
|
|
6935
6977
|
const isWorkspace = !!workspaceGlobs
|
|
@@ -6949,19 +6991,19 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
|
|
|
6949
6991
|
)
|
|
6950
6992
|
}
|
|
6951
6993
|
const overridesDataObjects = []
|
|
6952
|
-
if (
|
|
6953
|
-
overridesDataObjects.push(overridesDataByAgent.get(agent)(
|
|
6994
|
+
if (editablePkgJson.content['private'] || isWorkspace) {
|
|
6995
|
+
overridesDataObjects.push(overridesDataByAgent.get(agent)(editablePkgJson))
|
|
6954
6996
|
} else {
|
|
6955
6997
|
overridesDataObjects.push(
|
|
6956
|
-
overridesDataByAgent.get(NPM$1)(
|
|
6957
|
-
overridesDataByAgent.get(YARN_CLASSIC)(
|
|
6998
|
+
overridesDataByAgent.get(NPM$1)(editablePkgJson),
|
|
6999
|
+
overridesDataByAgent.get(YARN_CLASSIC)(editablePkgJson)
|
|
6958
7000
|
)
|
|
6959
7001
|
}
|
|
6960
7002
|
spinner?.setText(
|
|
6961
7003
|
`Adding overrides${workspaceName ? ` to ${workspaceName}` : ''}...`
|
|
6962
7004
|
)
|
|
6963
7005
|
const depAliasMap = new Map()
|
|
6964
|
-
const depEntries = getDependencyEntries(
|
|
7006
|
+
const depEntries = getDependencyEntries(editablePkgJson)
|
|
6965
7007
|
const manifestEntries = manifestNpmOverrides.filter(({ 1: data }) =>
|
|
6966
7008
|
semver.satisfies(
|
|
6967
7009
|
// Roughly check Node range as semver.coerce will strip leading
|
|
@@ -11304,7 +11346,7 @@ void (async () => {
|
|
|
11304
11346
|
await updateNotifier({
|
|
11305
11347
|
name: SOCKET_CLI_BIN_NAME,
|
|
11306
11348
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
11307
|
-
version: '0.14.
|
|
11349
|
+
version: '0.14.87',
|
|
11308
11350
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
11309
11351
|
})
|
|
11310
11352
|
try {
|
|
@@ -11372,5 +11414,5 @@ void (async () => {
|
|
|
11372
11414
|
await shadowNpmInject.captureException(e)
|
|
11373
11415
|
}
|
|
11374
11416
|
})()
|
|
11375
|
-
//# debugId=
|
|
11417
|
+
//# debugId=959e9b05-7132-4bc5-be44-3c41d6c6665b
|
|
11376
11418
|
//# sourceMappingURL=cli.js.map
|