socket 0.14.86 → 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.
@@ -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.86:69093e9:cea7b31b:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
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)
@@ -3955,19 +3954,20 @@ async function npmFix(
3955
3954
  targetVersion = node.package.version
3956
3955
  const fixSpec = `${name}@^${targetVersion}`
3957
3956
  const revertData = {
3958
- ...(pkgJson.dependencies
3957
+ ...(editablePkgJson.content.dependencies
3959
3958
  ? {
3960
- dependencies: pkgJson.dependencies
3959
+ dependencies: editablePkgJson.content.dependencies
3961
3960
  }
3962
3961
  : undefined),
3963
- ...(pkgJson.optionalDependencies
3962
+ ...(editablePkgJson.content.optionalDependencies
3964
3963
  ? {
3965
- optionalDependencies: pkgJson.optionalDependencies
3964
+ optionalDependencies:
3965
+ editablePkgJson.content.optionalDependencies
3966
3966
  }
3967
3967
  : undefined),
3968
- ...(pkgJson.peerDependencies
3968
+ ...(editablePkgJson.content.peerDependencies
3969
3969
  ? {
3970
- peerDependencies: pkgJson.peerDependencies
3970
+ peerDependencies: editablePkgJson.content.peerDependencies
3971
3971
  }
3972
3972
  : undefined)
3973
3973
  }
@@ -3977,6 +3977,7 @@ async function npmFix(
3977
3977
  editablePkgJson,
3978
3978
  arb.idealTree,
3979
3979
  node,
3980
+ targetVersion,
3980
3981
  rangeStyle
3981
3982
  )
3982
3983
  // eslint-disable-next-line no-await-in-loop
@@ -4294,7 +4295,6 @@ async function pnpmFix(
4294
4295
  const editablePkgJson = await packages.readPackageJson(cwd, {
4295
4296
  editable: true
4296
4297
  })
4297
- const { content: pkgJson } = editablePkgJson
4298
4298
  let actualTree = await getActualTree(cwd)
4299
4299
  for (const { 0: name, 1: infos } of infoByPkg) {
4300
4300
  if (registry.getManifestData(NPM$c, name)) {
@@ -4344,14 +4344,18 @@ async function pnpmFix(
4344
4344
  let installed = false
4345
4345
  let saved = false
4346
4346
  if (targetVersion && targetPackument) {
4347
- const oldPnpm = pkgJson[PNPM$9]
4348
- const pnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
4347
+ const oldPnpm = editablePkgJson.content[PNPM$9]
4348
+ const oldPnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
4349
4349
  const oldOverrides = oldPnpm?.[OVERRIDES$2]
4350
- const overridesCount = oldOverrides
4350
+ const oldOverridesCount = oldOverrides
4351
4351
  ? Object.keys(oldOverrides).length
4352
4352
  : 0
4353
4353
  const overrideKey = `${node.name}@${vulnerableVersionRange}`
4354
- const overrideRange = `^${targetVersion}`
4354
+ const overrideRange = shadowNpmInject.applyRange(
4355
+ oldOverrides?.[overrideKey] ?? targetVersion,
4356
+ targetVersion,
4357
+ rangeStyle
4358
+ )
4355
4359
  const fixSpec = `${name}@${overrideRange}`
4356
4360
  const updateData = {
4357
4361
  [PNPM$9]: {
@@ -4363,11 +4367,11 @@ async function pnpmFix(
4363
4367
  }
4364
4368
  }
4365
4369
  const revertData = {
4366
- [PNPM$9]: pnpmKeyCount
4370
+ [PNPM$9]: oldPnpmKeyCount
4367
4371
  ? {
4368
4372
  ...oldPnpm,
4369
4373
  [OVERRIDES$2]:
4370
- overridesCount === 1
4374
+ oldOverridesCount === 1
4371
4375
  ? undefined
4372
4376
  : {
4373
4377
  [overrideKey]: undefined,
@@ -4375,19 +4379,20 @@ async function pnpmFix(
4375
4379
  }
4376
4380
  }
4377
4381
  : undefined,
4378
- ...(pkgJson.dependencies
4382
+ ...(editablePkgJson.content.dependencies
4379
4383
  ? {
4380
- dependencies: pkgJson.dependencies
4384
+ dependencies: editablePkgJson.content.dependencies
4381
4385
  }
4382
4386
  : undefined),
4383
- ...(pkgJson.optionalDependencies
4387
+ ...(editablePkgJson.content.optionalDependencies
4384
4388
  ? {
4385
- optionalDependencies: pkgJson.optionalDependencies
4389
+ optionalDependencies:
4390
+ editablePkgJson.content.optionalDependencies
4386
4391
  }
4387
4392
  : undefined),
4388
- ...(pkgJson.peerDependencies
4393
+ ...(editablePkgJson.content.peerDependencies
4389
4394
  ? {
4390
- peerDependencies: pkgJson.peerDependencies
4395
+ peerDependencies: editablePkgJson.content.peerDependencies
4391
4396
  }
4392
4397
  : undefined)
4393
4398
  }
@@ -4398,6 +4403,7 @@ async function pnpmFix(
4398
4403
  editablePkgJson,
4399
4404
  actualTree,
4400
4405
  node,
4406
+ targetVersion,
4401
4407
  rangeStyle
4402
4408
  )
4403
4409
  // eslint-disable-next-line no-await-in-loop
@@ -6396,13 +6402,13 @@ const depsIncludesByAgent = new Map([
6396
6402
  [YARN_CLASSIC$5, matchLsCmdViewHumanStdout]
6397
6403
  ])
6398
6404
 
6399
- function getDependencyEntries(pkgJson) {
6405
+ function getDependencyEntries(editablePkgJson) {
6400
6406
  const {
6401
6407
  dependencies,
6402
6408
  devDependencies,
6403
6409
  optionalDependencies,
6404
6410
  peerDependencies
6405
- } = pkgJson
6411
+ } = editablePkgJson.content
6406
6412
  return [
6407
6413
  [
6408
6414
  'dependencies',
@@ -6453,8 +6459,8 @@ const {
6453
6459
  YARN_BERRY: YARN_BERRY$3,
6454
6460
  YARN_CLASSIC: YARN_CLASSIC$4
6455
6461
  } = constants
6456
- function getOverridesDataBun(pkgJson) {
6457
- const overrides = pkgJson?.[RESOLUTIONS$1] ?? {}
6462
+ function getOverridesDataBun(editablePkgJson) {
6463
+ const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
6458
6464
  return {
6459
6465
  type: YARN_BERRY$3,
6460
6466
  overrides
@@ -6463,8 +6469,8 @@ function getOverridesDataBun(pkgJson) {
6463
6469
 
6464
6470
  // npm overrides documentation:
6465
6471
  // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides
6466
- function getOverridesDataNpm(pkgJson) {
6467
- const overrides = pkgJson?.[OVERRIDES$1] ?? {}
6472
+ function getOverridesDataNpm(editablePkgJson) {
6473
+ const overrides = editablePkgJson.content?.[OVERRIDES$1] ?? {}
6468
6474
  return {
6469
6475
  type: NPM$5,
6470
6476
  overrides
@@ -6473,15 +6479,15 @@ function getOverridesDataNpm(pkgJson) {
6473
6479
 
6474
6480
  // pnpm overrides documentation:
6475
6481
  // https://pnpm.io/package_json#pnpmoverrides
6476
- function getOverridesDataPnpm(pkgJson) {
6477
- const overrides = pkgJson?.pnpm?.[OVERRIDES$1] ?? {}
6482
+ function getOverridesDataPnpm(editablePkgJson) {
6483
+ const overrides = editablePkgJson.content?.[PNPM$5]?.[OVERRIDES$1] ?? {}
6478
6484
  return {
6479
6485
  type: PNPM$5,
6480
6486
  overrides
6481
6487
  }
6482
6488
  }
6483
- function getOverridesDataVlt(pkgJson) {
6484
- const overrides = pkgJson?.[OVERRIDES$1] ?? {}
6489
+ function getOverridesDataVlt(editablePkgJson) {
6490
+ const overrides = editablePkgJson.content?.[OVERRIDES$1] ?? {}
6485
6491
  return {
6486
6492
  type: VLT$3,
6487
6493
  overrides
@@ -6490,8 +6496,8 @@ function getOverridesDataVlt(pkgJson) {
6490
6496
 
6491
6497
  // Yarn resolutions documentation:
6492
6498
  // https://yarnpkg.com/configuration/manifest#resolutions
6493
- function getOverridesDataYarn(pkgJson) {
6494
- const overrides = pkgJson?.[RESOLUTIONS$1] ?? {}
6499
+ function getOverridesDataYarn(editablePkgJson) {
6500
+ const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
6495
6501
  return {
6496
6502
  type: YARN_BERRY$3,
6497
6503
  overrides
@@ -6500,8 +6506,8 @@ function getOverridesDataYarn(pkgJson) {
6500
6506
 
6501
6507
  // Yarn resolutions documentation:
6502
6508
  // https://classic.yarnpkg.com/en/docs/selective-version-resolutions
6503
- function getOverridesDataClassic(pkgJson) {
6504
- const overrides = pkgJson?.[RESOLUTIONS$1] ?? {}
6509
+ function getOverridesDataYarnClassic(editablePkgJson) {
6510
+ const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
6505
6511
  return {
6506
6512
  type: YARN_CLASSIC$4,
6507
6513
  overrides
@@ -6513,12 +6519,12 @@ const overridesDataByAgent = new Map([
6513
6519
  [PNPM$5, getOverridesDataPnpm],
6514
6520
  [VLT$3, getOverridesDataVlt],
6515
6521
  [YARN_BERRY$3, getOverridesDataYarn],
6516
- [YARN_CLASSIC$4, getOverridesDataClassic]
6522
+ [YARN_CLASSIC$4, getOverridesDataYarnClassic]
6517
6523
  ])
6518
6524
 
6519
6525
  const { PNPM: PNPM$4 } = constants
6520
6526
  const PNPM_WORKSPACE = `${PNPM$4}-workspace`
6521
- async function getWorkspaceGlobs(agent, pkgPath, pkgJson) {
6527
+ async function getWorkspaceGlobs(agent, pkgPath, editablePkgJson) {
6522
6528
  let workspacePatterns
6523
6529
  if (agent === PNPM$4) {
6524
6530
  for (const workspacePath of [
@@ -6537,7 +6543,7 @@ async function getWorkspaceGlobs(agent, pkgPath, pkgJson) {
6537
6543
  }
6538
6544
  }
6539
6545
  } else {
6540
- workspacePatterns = pkgJson['workspaces']
6546
+ workspacePatterns = editablePkgJson.content['workspaces']
6541
6547
  }
6542
6548
  return Array.isArray(workspacePatterns)
6543
6549
  ? workspacePatterns
@@ -6810,8 +6816,7 @@ function getHighestEntryIndex(entries, keys) {
6810
6816
  return getEntryIndexes(entries, keys).at(-1) ?? -1
6811
6817
  }
6812
6818
  function updatePkgJsonField(editablePkgJson, field, value) {
6813
- const { content: pkgJson } = editablePkgJson
6814
- const oldValue = pkgJson[field]
6819
+ const oldValue = editablePkgJson.content[field]
6815
6820
  if (oldValue) {
6816
6821
  // The field already exists so we simply update the field value.
6817
6822
  if (field === PNPM$1) {
@@ -6862,7 +6867,7 @@ function updatePkgJsonField(editablePkgJson, field, value) {
6862
6867
  // Since the field doesn't exist we want to insert it into the package.json
6863
6868
  // in a place that makes sense, e.g. close to the "dependencies" field. If
6864
6869
  // we can't find a place to insert the field we'll add it to the bottom.
6865
- const entries = Object.entries(pkgJson)
6870
+ const entries = Object.entries(editablePkgJson.content)
6866
6871
  let insertIndex = -1
6867
6872
  let isPlacingHigher = false
6868
6873
  if (field === OVERRIDES) {
@@ -6961,9 +6966,12 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
6961
6966
  editable: true
6962
6967
  })
6963
6968
  }
6964
- const { content: pkgJson } = editablePkgJson
6965
6969
  const workspaceName = path$1.relative(rootPath, pkgPath)
6966
- const workspaceGlobs = await getWorkspaceGlobs(agent, pkgPath, pkgJson)
6970
+ const workspaceGlobs = await getWorkspaceGlobs(
6971
+ agent,
6972
+ pkgPath,
6973
+ editablePkgJson
6974
+ )
6967
6975
  const isRoot = pkgPath === rootPath
6968
6976
  const isLockScanned = isRoot && !prod
6969
6977
  const isWorkspace = !!workspaceGlobs
@@ -6983,19 +6991,19 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
6983
6991
  )
6984
6992
  }
6985
6993
  const overridesDataObjects = []
6986
- if (pkgJson['private'] || isWorkspace) {
6987
- overridesDataObjects.push(overridesDataByAgent.get(agent)(pkgJson))
6994
+ if (editablePkgJson.content['private'] || isWorkspace) {
6995
+ overridesDataObjects.push(overridesDataByAgent.get(agent)(editablePkgJson))
6988
6996
  } else {
6989
6997
  overridesDataObjects.push(
6990
- overridesDataByAgent.get(NPM$1)(pkgJson),
6991
- overridesDataByAgent.get(YARN_CLASSIC)(pkgJson)
6998
+ overridesDataByAgent.get(NPM$1)(editablePkgJson),
6999
+ overridesDataByAgent.get(YARN_CLASSIC)(editablePkgJson)
6992
7000
  )
6993
7001
  }
6994
7002
  spinner?.setText(
6995
7003
  `Adding overrides${workspaceName ? ` to ${workspaceName}` : ''}...`
6996
7004
  )
6997
7005
  const depAliasMap = new Map()
6998
- const depEntries = getDependencyEntries(pkgJson)
7006
+ const depEntries = getDependencyEntries(editablePkgJson)
6999
7007
  const manifestEntries = manifestNpmOverrides.filter(({ 1: data }) =>
7000
7008
  semver.satisfies(
7001
7009
  // Roughly check Node range as semver.coerce will strip leading
@@ -11338,7 +11346,7 @@ void (async () => {
11338
11346
  await updateNotifier({
11339
11347
  name: SOCKET_CLI_BIN_NAME,
11340
11348
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11341
- version: '0.14.86',
11349
+ version: '0.14.87',
11342
11350
  ttl: 86_400_000 /* 24 hours in milliseconds */
11343
11351
  })
11344
11352
  try {
@@ -11406,5 +11414,5 @@ void (async () => {
11406
11414
  await shadowNpmInject.captureException(e)
11407
11415
  }
11408
11416
  })()
11409
- //# debugId=b44c2f38-222e-45b9-a2a0-1f9508a26ae9
11417
+ //# debugId=959e9b05-7132-4bc5-be44-3c41d6c6665b
11410
11418
  //# sourceMappingURL=cli.js.map