@socketsecurity/cli-with-sentry 0.14.114 → 0.14.116

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.
@@ -41,7 +41,7 @@ const relConstantsPath = './constants'
41
41
  Sentry.setTag(
42
42
  'version',
43
43
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
44
- '0.14.114:6709538:d8784340:pub'
44
+ '0.14.116:0dae31b:5f34e003:pub'
45
45
  )
46
46
  const constants = require(relConstantsPath)
47
47
  if (constants.ENV.SOCKET_CLI_DEBUG) {
@@ -56,5 +56,5 @@ const relConstantsPath = './constants'
56
56
  } = constants
57
57
  setSentry(Sentry)
58
58
  }
59
- //# debugId=e2a7e44f-121f-464d-9f46-d3200dfb95e9
59
+ //# debugId=5faf840a-2ab6-4ffd-9f14-7c1948cda203
60
60
  //# sourceMappingURL=instrument-with-sentry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrument-with-sentry.js","sources":["../../src/instrument-with-sentry.ts"],"sourcesContent":["// This should ONLY be included in the special Sentry build!\n// Otherwise the Sentry dependency won't even be present in the manifest.\n\nimport { logger } from '@socketsecurity/registry/lib/logger'\n\n// Require constants with require(relConstantsPath) instead of require('./constants')\n// so Rollup doesn't generate a constants2.js chunk.\nconst relConstantsPath = './constants'\n// The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\nif (process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']) {\n const Sentry = require('@sentry/node')\n Sentry.init({\n onFatalError(error: Error) {\n // Defer module loads until after Sentry.init is called.\n if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.fail('[DEBUG] [Sentry onFatalError]:', error)\n }\n },\n dsn: 'https://66736701db8e4ffac046bd09fa6aaced@o555220.ingest.us.sentry.io/4508846967619585',\n enabled: true,\n integrations: []\n })\n Sentry.setTag(\n 'environment',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\n ? 'pub'\n : // The NODE_ENV convention is used by apps to define the runtime environment.\n // https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production\n process.env['NODE_ENV']\n )\n Sentry.setTag(\n 'version',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n process.env['INLINED_SOCKET_CLI_VERSION_HASH']\n )\n const constants = require(relConstantsPath)\n if (constants.ENV.SOCKET_CLI_DEBUG) {\n Sentry.setTag('debugging', true)\n logger.log('[DEBUG] Set up Sentry.')\n } else {\n Sentry.setTag('debugging', false)\n }\n const {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: { setSentry }\n } = constants\n setSentry(Sentry)\n} else if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.log('[DEBUG] Sentry disabled explicitly.')\n}\n"],"names":["logger","dsn","enabled","integrations","process","Sentry","setSentry"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;;AAIA;AACA;AACA;AACA;AACoD;AAClD;;;AAGI;;AAEEA;AACF;;AAEFC;AACAC;AACAC;AACF;;AAGE;AACAC;;AAQA;AACAA;AAEF;AACA;AACEC;AACAL;AACF;AACEK;AACF;;;AAGE;AAA+DC;AAAU;AAC3E;;AAEF","debugId":"e2a7e44f-121f-464d-9f46-d3200dfb95e9"}
1
+ {"version":3,"file":"instrument-with-sentry.js","sources":["../../src/instrument-with-sentry.ts"],"sourcesContent":["// This should ONLY be included in the special Sentry build!\n// Otherwise the Sentry dependency won't even be present in the manifest.\n\nimport { logger } from '@socketsecurity/registry/lib/logger'\n\n// Require constants with require(relConstantsPath) instead of require('./constants')\n// so Rollup doesn't generate a constants2.js chunk.\nconst relConstantsPath = './constants'\n// The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\nif (process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']) {\n const Sentry = require('@sentry/node')\n Sentry.init({\n onFatalError(error: Error) {\n // Defer module loads until after Sentry.init is called.\n if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.fail('[DEBUG] [Sentry onFatalError]:', error)\n }\n },\n dsn: 'https://66736701db8e4ffac046bd09fa6aaced@o555220.ingest.us.sentry.io/4508846967619585',\n enabled: true,\n integrations: []\n })\n Sentry.setTag(\n 'environment',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\n ? 'pub'\n : // The NODE_ENV convention is used by apps to define the runtime environment.\n // https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production\n process.env['NODE_ENV']\n )\n Sentry.setTag(\n 'version',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n process.env['INLINED_SOCKET_CLI_VERSION_HASH']\n )\n const constants = require(relConstantsPath)\n if (constants.ENV.SOCKET_CLI_DEBUG) {\n Sentry.setTag('debugging', true)\n logger.log('[DEBUG] Set up Sentry.')\n } else {\n Sentry.setTag('debugging', false)\n }\n const {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: { setSentry }\n } = constants\n setSentry(Sentry)\n} else if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.log('[DEBUG] Sentry disabled explicitly.')\n}\n"],"names":["logger","dsn","enabled","integrations","process","Sentry","setSentry"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;;AAIA;AACA;AACA;AACA;AACoD;AAClD;;;AAGI;;AAEEA;AACF;;AAEFC;AACAC;AACAC;AACF;;AAGE;AACAC;;AAQA;AACAA;AAEF;AACA;AACEC;AACAL;AACF;AACEK;AACF;;;AAGE;AAA+DC;AAAU;AAC3E;;AAEF","debugId":"5faf840a-2ab6-4ffd-9f14-7c1948cda203"}
@@ -917,7 +917,7 @@ function emitBanner(name) {
917
917
  logger.logger.error(getAsciiHeader(name))
918
918
  }
919
919
  function getAsciiHeader(command) {
920
- const cliVersion = '0.14.114:6709538:d8784340:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
920
+ const cliVersion = '0.14.116:0dae31b:5f34e003:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
921
921
  const nodeVersion = process$1.version
922
922
  const apiToken = shadowNpmInject.getDefaultToken()
923
923
  const defaultOrg = shadowNpmInject.getConfigValue('defaultOrg')
@@ -3831,11 +3831,6 @@ async function gitCreateAndPushBranchIfNeeded(
3831
3831
  basename === 'pnpm-lock.yaml'
3832
3832
  )
3833
3833
  })
3834
- debug.debugLog('branch', branch)
3835
- debug.debugLog(
3836
- 'gitCreateAndPushBranchIfNeeded > moddedFilepaths',
3837
- moddedFilepaths
3838
- )
3839
3834
  if (moddedFilepaths.length) {
3840
3835
  await spawn.spawn('git', ['add', ...moddedFilepaths], {
3841
3836
  cwd
@@ -3905,7 +3900,6 @@ async function doesPullRequestExistForBranch(owner, repo, branch) {
3905
3900
  head: `${owner}:${branch}`,
3906
3901
  state: 'open'
3907
3902
  })
3908
- debug.debugLog('doesPullRequestExistForBranch > prs', prs)
3909
3903
  return prs.length > 0
3910
3904
  } catch {}
3911
3905
  return false
@@ -4030,9 +4024,10 @@ async function npmFix(
4030
4024
  pkgEnvDetails,
4031
4025
  { autoMerge, cwd, purls, rangeStyle, spinner, test, testScript }
4032
4026
  ) {
4027
+ const { pkgPath: rootPath } = pkgEnvDetails
4033
4028
  spinner?.start()
4034
4029
  const arb = new shadowNpmInject.SafeArborist({
4035
- path: pkgEnvDetails.pkgPath,
4030
+ path: rootPath,
4036
4031
  ...shadowNpmInject.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES
4037
4032
  })
4038
4033
  // Calling arb.reify() creates the arb.diff object and nulls-out arb.idealTree.
@@ -4057,14 +4052,14 @@ async function npmFix(
4057
4052
 
4058
4053
  // Lazily access constants.ENV[CI].
4059
4054
  const isCi = constants.ENV[CI$1]
4060
- const { pkgPath: rootPath } = pkgEnvDetails
4061
4055
  const { 0: isRepo, 1: workspacePkgJsonPaths } = await Promise.all([
4062
4056
  isInGitRepo(cwd),
4063
- shadowNpmPaths.globWorkspace(pkgEnvDetails)
4057
+ shadowNpmInject.globWorkspace(pkgEnvDetails.agent, rootPath)
4064
4058
  ])
4065
4059
  const pkgJsonPaths = [
4066
- pkgEnvDetails.editablePkgJson.filename,
4067
- ...workspacePkgJsonPaths
4060
+ ...workspacePkgJsonPaths,
4061
+ // Process the workspace root last since it will add an override to package.json.
4062
+ pkgEnvDetails.editablePkgJson.filename
4068
4063
  ]
4069
4064
  await arb.buildIdealTree()
4070
4065
  for (const { 0: name, 1: infos } of infoByPkg) {
@@ -4253,6 +4248,8 @@ async function npmFix(
4253
4248
  spinner?.error(`Reverting ${newSpec}${workspaceDetails}`, error)
4254
4249
  }
4255
4250
  }
4251
+ // eslint-disable-next-line no-await-in-loop
4252
+ await shadowNpmInject.removeNodeModules(cwd)
4256
4253
  if (isRepo) {
4257
4254
  // eslint-disable-next-line no-await-in-loop
4258
4255
  await gitHardReset(cwd)
@@ -4439,12 +4436,10 @@ async function pnpmFix(
4439
4436
  pkgEnvDetails,
4440
4437
  { autoMerge, cwd, purls, rangeStyle, spinner, test, testScript }
4441
4438
  ) {
4442
- const lockfile = await vendor.libExports$3.readWantedLockfile(
4443
- pkgEnvDetails.pkgPath,
4444
- {
4445
- ignoreIncompatible: false
4446
- }
4447
- )
4439
+ const { pkgPath: rootPath } = pkgEnvDetails
4440
+ const lockfile = await vendor.libExports$3.readWantedLockfile(rootPath, {
4441
+ ignoreIncompatible: false
4442
+ })
4448
4443
  if (!lockfile) {
4449
4444
  return
4450
4445
  }
@@ -4471,21 +4466,20 @@ async function pnpmFix(
4471
4466
 
4472
4467
  // Lazily access constants.ENV[CI].
4473
4468
  const isCi = constants.ENV[CI]
4474
- const { pkgPath: rootPath } = pkgEnvDetails
4475
4469
  const {
4476
4470
  0: isRepo,
4477
4471
  1: workspacePkgJsonPaths,
4478
4472
  2: initialTree
4479
4473
  } = await Promise.all([
4480
4474
  isInGitRepo(cwd),
4481
- shadowNpmPaths.globWorkspace(pkgEnvDetails),
4475
+ shadowNpmInject.globWorkspace(pkgEnvDetails.agent, rootPath),
4482
4476
  getActualTree(cwd)
4483
4477
  ])
4484
4478
  const pkgJsonPaths = [
4485
- pkgEnvDetails.editablePkgJson.filename,
4486
- ...workspacePkgJsonPaths
4479
+ ...workspacePkgJsonPaths,
4480
+ // Process the workspace root last since it will add an override to package.json.
4481
+ pkgEnvDetails.editablePkgJson.filename
4487
4482
  ]
4488
- debug.debugLog('workspacePkgJsonPaths', workspacePkgJsonPaths)
4489
4483
  let actualTree = initialTree
4490
4484
  for (const { 0: name, 1: infos } of infoByPkg) {
4491
4485
  if (registry.getManifestData(NPM$c, name)) {
@@ -4517,9 +4511,6 @@ async function pnpmFix(
4517
4511
  firstPatchedVersionIdentifier,
4518
4512
  vulnerableVersionRange
4519
4513
  } of infos) {
4520
- debug.debugLog('name', name)
4521
- debug.debugLog('oldVersion', oldVersion)
4522
- debug.debugLog('pkgJsonPath', pkgJsonPath)
4523
4514
  const node = shadowNpmInject.findPackageNode(
4524
4515
  actualTree,
4525
4516
  name,
@@ -4645,7 +4636,6 @@ async function pnpmFix(
4645
4636
  rangeStyle
4646
4637
  )
4647
4638
  debug.debugLog('updatePackageJsonFromNode', modded)
4648
- debug.debugLog(branch, editablePkgJson.filename)
4649
4639
  let error
4650
4640
  let errored = false
4651
4641
  let installed = false
@@ -4687,17 +4677,13 @@ async function pnpmFix(
4687
4677
  error = e
4688
4678
  errored = true
4689
4679
  }
4690
- debug.debugLog('check "shouldOpenPr":', shouldOpenPr)
4691
- debug.debugLog('check "errored":', errored)
4692
4680
  if (!errored && shouldOpenPr) {
4693
- debug.debugLog('1: gitCreateAndPushBranchIfNeeded')
4694
4681
  // eslint-disable-next-line no-await-in-loop
4695
4682
  await gitCreateAndPushBranchIfNeeded(
4696
4683
  branch,
4697
4684
  getSocketCommitMessage(oldPurl, newVersion, workspaceName),
4698
4685
  cwd
4699
4686
  )
4700
- debug.debugLog('2: openGitHubPullRequest')
4701
4687
  // eslint-disable-next-line no-await-in-loop
4702
4688
  const prResponse = await openGitHubPullRequest(
4703
4689
  owner,
@@ -4724,6 +4710,8 @@ async function pnpmFix(
4724
4710
  }
4725
4711
  }
4726
4712
  editablePkgJson.update(revertData)
4713
+ // eslint-disable-next-line no-await-in-loop
4714
+ await shadowNpmInject.removeNodeModules(cwd)
4727
4715
  if (isRepo) {
4728
4716
  // eslint-disable-next-line no-await-in-loop
4729
4717
  await gitHardReset(cwd)
@@ -7522,7 +7510,10 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
7522
7510
  updated: new Set(),
7523
7511
  updatedInWorkspaces: new Set(),
7524
7512
  warnedPnpmWorkspaceRequiresNpm: false,
7525
- workspacePkgJsonPaths: await shadowNpmPaths.globWorkspace(pkgEnvDetails)
7513
+ workspacePkgJsonPaths: await shadowNpmInject.globWorkspace(
7514
+ agent,
7515
+ rootPath
7516
+ )
7526
7517
  }
7527
7518
  } = {
7528
7519
  __proto__: null,
@@ -12315,7 +12306,7 @@ void (async () => {
12315
12306
  await vendor.updater({
12316
12307
  name: SOCKET_CLI_BIN_NAME,
12317
12308
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
12318
- version: '0.14.114',
12309
+ version: '0.14.116',
12319
12310
  ttl: 86_400_000 /* 24 hours in milliseconds */
12320
12311
  })
12321
12312
  try {
@@ -12383,5 +12374,5 @@ void (async () => {
12383
12374
  await shadowNpmInject.captureException(e)
12384
12375
  }
12385
12376
  })()
12386
- //# debugId=79766fe4-6a25-4f10-93af-69276e4074ab
12377
+ //# debugId=4ecd13c9-8788-41d3-b85a-e5558ed25ddf
12387
12378
  //# sourceMappingURL=cli.js.map