@socketsecurity/cli 0.14.86 → 0.14.88

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