socket 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.
@@ -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.88:959a4cc:36314b87: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
@@ -4451,6 +4457,7 @@ async function pnpmFix(
4451
4457
  // eslint-disable-next-line no-await-in-loop
4452
4458
  prResponse = await openGitHubPullRequest(name, targetVersion, cwd)
4453
4459
  } catch (e) {
4460
+ console.log(e)
4454
4461
  logger.logger.error('Failed to open pull request', e)
4455
4462
  }
4456
4463
  if (prResponse && autoMerge) {
@@ -6396,13 +6403,13 @@ const depsIncludesByAgent = new Map([
6396
6403
  [YARN_CLASSIC$5, matchLsCmdViewHumanStdout]
6397
6404
  ])
6398
6405
 
6399
- function getDependencyEntries(pkgJson) {
6406
+ function getDependencyEntries(editablePkgJson) {
6400
6407
  const {
6401
6408
  dependencies,
6402
6409
  devDependencies,
6403
6410
  optionalDependencies,
6404
6411
  peerDependencies
6405
- } = pkgJson
6412
+ } = editablePkgJson.content
6406
6413
  return [
6407
6414
  [
6408
6415
  'dependencies',
@@ -6453,8 +6460,8 @@ const {
6453
6460
  YARN_BERRY: YARN_BERRY$3,
6454
6461
  YARN_CLASSIC: YARN_CLASSIC$4
6455
6462
  } = constants
6456
- function getOverridesDataBun(pkgJson) {
6457
- const overrides = pkgJson?.[RESOLUTIONS$1] ?? {}
6463
+ function getOverridesDataBun(editablePkgJson) {
6464
+ const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
6458
6465
  return {
6459
6466
  type: YARN_BERRY$3,
6460
6467
  overrides
@@ -6463,8 +6470,8 @@ function getOverridesDataBun(pkgJson) {
6463
6470
 
6464
6471
  // npm overrides documentation:
6465
6472
  // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides
6466
- function getOverridesDataNpm(pkgJson) {
6467
- const overrides = pkgJson?.[OVERRIDES$1] ?? {}
6473
+ function getOverridesDataNpm(editablePkgJson) {
6474
+ const overrides = editablePkgJson.content?.[OVERRIDES$1] ?? {}
6468
6475
  return {
6469
6476
  type: NPM$5,
6470
6477
  overrides
@@ -6473,15 +6480,15 @@ function getOverridesDataNpm(pkgJson) {
6473
6480
 
6474
6481
  // pnpm overrides documentation:
6475
6482
  // https://pnpm.io/package_json#pnpmoverrides
6476
- function getOverridesDataPnpm(pkgJson) {
6477
- const overrides = pkgJson?.pnpm?.[OVERRIDES$1] ?? {}
6483
+ function getOverridesDataPnpm(editablePkgJson) {
6484
+ const overrides = editablePkgJson.content?.[PNPM$5]?.[OVERRIDES$1] ?? {}
6478
6485
  return {
6479
6486
  type: PNPM$5,
6480
6487
  overrides
6481
6488
  }
6482
6489
  }
6483
- function getOverridesDataVlt(pkgJson) {
6484
- const overrides = pkgJson?.[OVERRIDES$1] ?? {}
6490
+ function getOverridesDataVlt(editablePkgJson) {
6491
+ const overrides = editablePkgJson.content?.[OVERRIDES$1] ?? {}
6485
6492
  return {
6486
6493
  type: VLT$3,
6487
6494
  overrides
@@ -6490,8 +6497,8 @@ function getOverridesDataVlt(pkgJson) {
6490
6497
 
6491
6498
  // Yarn resolutions documentation:
6492
6499
  // https://yarnpkg.com/configuration/manifest#resolutions
6493
- function getOverridesDataYarn(pkgJson) {
6494
- const overrides = pkgJson?.[RESOLUTIONS$1] ?? {}
6500
+ function getOverridesDataYarn(editablePkgJson) {
6501
+ const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
6495
6502
  return {
6496
6503
  type: YARN_BERRY$3,
6497
6504
  overrides
@@ -6500,8 +6507,8 @@ function getOverridesDataYarn(pkgJson) {
6500
6507
 
6501
6508
  // Yarn resolutions documentation:
6502
6509
  // https://classic.yarnpkg.com/en/docs/selective-version-resolutions
6503
- function getOverridesDataClassic(pkgJson) {
6504
- const overrides = pkgJson?.[RESOLUTIONS$1] ?? {}
6510
+ function getOverridesDataYarnClassic(editablePkgJson) {
6511
+ const overrides = editablePkgJson.content?.[RESOLUTIONS$1] ?? {}
6505
6512
  return {
6506
6513
  type: YARN_CLASSIC$4,
6507
6514
  overrides
@@ -6513,12 +6520,12 @@ const overridesDataByAgent = new Map([
6513
6520
  [PNPM$5, getOverridesDataPnpm],
6514
6521
  [VLT$3, getOverridesDataVlt],
6515
6522
  [YARN_BERRY$3, getOverridesDataYarn],
6516
- [YARN_CLASSIC$4, getOverridesDataClassic]
6523
+ [YARN_CLASSIC$4, getOverridesDataYarnClassic]
6517
6524
  ])
6518
6525
 
6519
6526
  const { PNPM: PNPM$4 } = constants
6520
6527
  const PNPM_WORKSPACE = `${PNPM$4}-workspace`
6521
- async function getWorkspaceGlobs(agent, pkgPath, pkgJson) {
6528
+ async function getWorkspaceGlobs(agent, pkgPath, editablePkgJson) {
6522
6529
  let workspacePatterns
6523
6530
  if (agent === PNPM$4) {
6524
6531
  for (const workspacePath of [
@@ -6537,7 +6544,7 @@ async function getWorkspaceGlobs(agent, pkgPath, pkgJson) {
6537
6544
  }
6538
6545
  }
6539
6546
  } else {
6540
- workspacePatterns = pkgJson['workspaces']
6547
+ workspacePatterns = editablePkgJson.content['workspaces']
6541
6548
  }
6542
6549
  return Array.isArray(workspacePatterns)
6543
6550
  ? workspacePatterns
@@ -6810,8 +6817,7 @@ function getHighestEntryIndex(entries, keys) {
6810
6817
  return getEntryIndexes(entries, keys).at(-1) ?? -1
6811
6818
  }
6812
6819
  function updatePkgJsonField(editablePkgJson, field, value) {
6813
- const { content: pkgJson } = editablePkgJson
6814
- const oldValue = pkgJson[field]
6820
+ const oldValue = editablePkgJson.content[field]
6815
6821
  if (oldValue) {
6816
6822
  // The field already exists so we simply update the field value.
6817
6823
  if (field === PNPM$1) {
@@ -6862,7 +6868,7 @@ function updatePkgJsonField(editablePkgJson, field, value) {
6862
6868
  // Since the field doesn't exist we want to insert it into the package.json
6863
6869
  // in a place that makes sense, e.g. close to the "dependencies" field. If
6864
6870
  // we can't find a place to insert the field we'll add it to the bottom.
6865
- const entries = Object.entries(pkgJson)
6871
+ const entries = Object.entries(editablePkgJson.content)
6866
6872
  let insertIndex = -1
6867
6873
  let isPlacingHigher = false
6868
6874
  if (field === OVERRIDES) {
@@ -6961,9 +6967,12 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
6961
6967
  editable: true
6962
6968
  })
6963
6969
  }
6964
- const { content: pkgJson } = editablePkgJson
6965
6970
  const workspaceName = path$1.relative(rootPath, pkgPath)
6966
- const workspaceGlobs = await getWorkspaceGlobs(agent, pkgPath, pkgJson)
6971
+ const workspaceGlobs = await getWorkspaceGlobs(
6972
+ agent,
6973
+ pkgPath,
6974
+ editablePkgJson
6975
+ )
6967
6976
  const isRoot = pkgPath === rootPath
6968
6977
  const isLockScanned = isRoot && !prod
6969
6978
  const isWorkspace = !!workspaceGlobs
@@ -6983,19 +6992,19 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
6983
6992
  )
6984
6993
  }
6985
6994
  const overridesDataObjects = []
6986
- if (pkgJson['private'] || isWorkspace) {
6987
- overridesDataObjects.push(overridesDataByAgent.get(agent)(pkgJson))
6995
+ if (editablePkgJson.content['private'] || isWorkspace) {
6996
+ overridesDataObjects.push(overridesDataByAgent.get(agent)(editablePkgJson))
6988
6997
  } else {
6989
6998
  overridesDataObjects.push(
6990
- overridesDataByAgent.get(NPM$1)(pkgJson),
6991
- overridesDataByAgent.get(YARN_CLASSIC)(pkgJson)
6999
+ overridesDataByAgent.get(NPM$1)(editablePkgJson),
7000
+ overridesDataByAgent.get(YARN_CLASSIC)(editablePkgJson)
6992
7001
  )
6993
7002
  }
6994
7003
  spinner?.setText(
6995
7004
  `Adding overrides${workspaceName ? ` to ${workspaceName}` : ''}...`
6996
7005
  )
6997
7006
  const depAliasMap = new Map()
6998
- const depEntries = getDependencyEntries(pkgJson)
7007
+ const depEntries = getDependencyEntries(editablePkgJson)
6999
7008
  const manifestEntries = manifestNpmOverrides.filter(({ 1: data }) =>
7000
7009
  semver.satisfies(
7001
7010
  // Roughly check Node range as semver.coerce will strip leading
@@ -11338,7 +11347,7 @@ void (async () => {
11338
11347
  await updateNotifier({
11339
11348
  name: SOCKET_CLI_BIN_NAME,
11340
11349
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11341
- version: '0.14.86',
11350
+ version: '0.14.88',
11342
11351
  ttl: 86_400_000 /* 24 hours in milliseconds */
11343
11352
  })
11344
11353
  try {
@@ -11406,5 +11415,5 @@ void (async () => {
11406
11415
  await shadowNpmInject.captureException(e)
11407
11416
  }
11408
11417
  })()
11409
- //# debugId=b44c2f38-222e-45b9-a2a0-1f9508a26ae9
11418
+ //# debugId=eec863e4-d08e-4c10-95e0-e8ee481e4e70
11410
11419
  //# sourceMappingURL=cli.js.map