@socketsecurity/cli-with-sentry 0.14.100 → 0.14.102
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/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/cli.js +87 -69
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +2 -2
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/require/cli.js +87 -69
- package/dist/require/cli.js.map +1 -1
- package/dist/require/shadow-npm-inject.js +2 -2
- package/dist/require/shadow-npm-inject.js.map +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
44
|
+
'0.14.102:51e000d:4c8b52e6: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=
|
|
59
|
+
//# debugId=53e9e69e-32ef-4d48-a639-445fc330d92e
|
|
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":"
|
|
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":"53e9e69e-32ef-4d48-a639-445fc330d92e"}
|
package/dist/module-sync/cli.js
CHANGED
|
@@ -900,7 +900,7 @@ function emitBanner(name) {
|
|
|
900
900
|
logger.logger.error(getAsciiHeader(name))
|
|
901
901
|
}
|
|
902
902
|
function getAsciiHeader(command) {
|
|
903
|
-
const cliVersion = '0.14.
|
|
903
|
+
const cliVersion = '0.14.102:51e000d:4c8b52e6:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
904
904
|
const nodeVersion = process$1.version
|
|
905
905
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
906
906
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
|
|
@@ -3724,6 +3724,9 @@ async function branchExists(branch, cwd = process.cwd()) {
|
|
|
3724
3724
|
}
|
|
3725
3725
|
async function checkoutBaseBranchIfAvailable(baseBranch, cwd = process.cwd()) {
|
|
3726
3726
|
try {
|
|
3727
|
+
await spawn.spawn('git', ['fetch', '--depth=1', 'origin', baseBranch], {
|
|
3728
|
+
cwd
|
|
3729
|
+
})
|
|
3727
3730
|
await spawn.spawn('git', ['checkout', baseBranch], {
|
|
3728
3731
|
cwd
|
|
3729
3732
|
})
|
|
@@ -3731,10 +3734,11 @@ async function checkoutBaseBranchIfAvailable(baseBranch, cwd = process.cwd()) {
|
|
|
3731
3734
|
cwd
|
|
3732
3735
|
})
|
|
3733
3736
|
logger.logger.info(`Checked out and reset to ${baseBranch}`)
|
|
3734
|
-
} catch {
|
|
3737
|
+
} catch (e) {
|
|
3735
3738
|
logger.logger.warn(
|
|
3736
3739
|
`Could not switch to ${baseBranch}. Proceeding with HEAD.`
|
|
3737
3740
|
)
|
|
3741
|
+
debug.debugLog(e)
|
|
3738
3742
|
}
|
|
3739
3743
|
}
|
|
3740
3744
|
async function createAndPushBranchIfNeeded(
|
|
@@ -3965,6 +3969,8 @@ async function npmFix(
|
|
|
3965
3969
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
3966
3970
|
editable: true
|
|
3967
3971
|
})
|
|
3972
|
+
// Lazily access constants.ENV[CI].
|
|
3973
|
+
const isCi = constants.ENV[CI$1]
|
|
3968
3974
|
await arb.buildIdealTree()
|
|
3969
3975
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
3970
3976
|
const hasUpgrade = !!registry.getManifestData(NPM$f, name)
|
|
@@ -4010,8 +4016,8 @@ async function npmFix(
|
|
|
4010
4016
|
if (
|
|
4011
4017
|
!shadowNpmInject.updateNode(node, packument, vulnerableVersionRange)
|
|
4012
4018
|
) {
|
|
4013
|
-
spinner?.
|
|
4014
|
-
|
|
4019
|
+
spinner?.fail(`Could not patch ${fromSpec}`)
|
|
4020
|
+
continue
|
|
4015
4021
|
}
|
|
4016
4022
|
const toVersion = node.package.version
|
|
4017
4023
|
const toVersionRange = shadowNpmInject.applyRange(
|
|
@@ -4020,21 +4026,17 @@ async function npmFix(
|
|
|
4020
4026
|
rangeStyle
|
|
4021
4027
|
)
|
|
4022
4028
|
const toSpec = `${name}@${toVersionRange}`
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
repo,
|
|
4035
|
-
branch
|
|
4036
|
-
))
|
|
4037
|
-
}
|
|
4029
|
+
const branch = isCi ? getSocketBranchName(fromPurl, toVersion) : ''
|
|
4030
|
+
const { owner, repo } = isCi
|
|
4031
|
+
? getGitHubEnvRepoInfo()
|
|
4032
|
+
: {
|
|
4033
|
+
owner: '',
|
|
4034
|
+
repo: ''
|
|
4035
|
+
}
|
|
4036
|
+
const shouldOpenPr = isCi
|
|
4037
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4038
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4039
|
+
: false
|
|
4038
4040
|
const revertData = {
|
|
4039
4041
|
...(editablePkgJson.content.dependencies
|
|
4040
4042
|
? {
|
|
@@ -4058,6 +4060,8 @@ async function npmFix(
|
|
|
4058
4060
|
|
|
4059
4061
|
// eslint-disable-next-line no-await-in-loop
|
|
4060
4062
|
await checkoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4063
|
+
let error
|
|
4064
|
+
let errored = false
|
|
4061
4065
|
let installed = false
|
|
4062
4066
|
let saved = false
|
|
4063
4067
|
try {
|
|
@@ -4087,23 +4091,11 @@ async function npmFix(
|
|
|
4087
4091
|
}
|
|
4088
4092
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4089
4093
|
spinner?.start()
|
|
4090
|
-
} catch {
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
editablePkgJson.update(revertData)
|
|
4094
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4095
|
-
await editablePkgJson.save()
|
|
4096
|
-
}
|
|
4097
|
-
if (installed) {
|
|
4098
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4099
|
-
await install$1(revertTree, {
|
|
4100
|
-
cwd
|
|
4101
|
-
})
|
|
4102
|
-
}
|
|
4103
|
-
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4104
|
-
return
|
|
4094
|
+
} catch (e) {
|
|
4095
|
+
error = e
|
|
4096
|
+
errored = true
|
|
4105
4097
|
}
|
|
4106
|
-
if (shouldOpenPr) {
|
|
4098
|
+
if (!errored && shouldOpenPr) {
|
|
4107
4099
|
// eslint-disable-next-line no-await-in-loop
|
|
4108
4100
|
await createAndPushBranchIfNeeded(
|
|
4109
4101
|
branch,
|
|
@@ -4125,6 +4117,25 @@ async function npmFix(
|
|
|
4125
4117
|
await enableAutoMerge(prResponse.data)
|
|
4126
4118
|
}
|
|
4127
4119
|
}
|
|
4120
|
+
if (errored || isCi) {
|
|
4121
|
+
if (errored) {
|
|
4122
|
+
spinner?.error(`Reverting ${toSpec}`, error)
|
|
4123
|
+
}
|
|
4124
|
+
if (saved) {
|
|
4125
|
+
editablePkgJson.update(revertData)
|
|
4126
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4127
|
+
await editablePkgJson.save()
|
|
4128
|
+
}
|
|
4129
|
+
if (installed) {
|
|
4130
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4131
|
+
await install$1(revertTree, {
|
|
4132
|
+
cwd
|
|
4133
|
+
})
|
|
4134
|
+
}
|
|
4135
|
+
if (errored) {
|
|
4136
|
+
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4128
4139
|
}
|
|
4129
4140
|
}
|
|
4130
4141
|
}
|
|
@@ -4379,6 +4390,8 @@ async function pnpmFix(
|
|
|
4379
4390
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
4380
4391
|
editable: true
|
|
4381
4392
|
})
|
|
4393
|
+
// Lazily access constants.ENV[CI].
|
|
4394
|
+
const isCi = constants.ENV[CI]
|
|
4382
4395
|
let actualTree = await getActualTree(cwd)
|
|
4383
4396
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4384
4397
|
if (registry.getManifestData(NPM$c, name)) {
|
|
@@ -4426,8 +4439,8 @@ async function pnpmFix(
|
|
|
4426
4439
|
? packument.versions[toVersion]
|
|
4427
4440
|
: undefined
|
|
4428
4441
|
if (!(toVersion && targetPackument)) {
|
|
4429
|
-
spinner?.
|
|
4430
|
-
|
|
4442
|
+
spinner?.fail(`Could not patch ${fromSpec}`)
|
|
4443
|
+
continue
|
|
4431
4444
|
}
|
|
4432
4445
|
const oldPnpm = editablePkgJson.content[PNPM$9]
|
|
4433
4446
|
const oldPnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
|
|
@@ -4442,21 +4455,17 @@ async function pnpmFix(
|
|
|
4442
4455
|
rangeStyle
|
|
4443
4456
|
)
|
|
4444
4457
|
const toSpec = `${name}@${toVersionRange}`
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
repo,
|
|
4457
|
-
branch
|
|
4458
|
-
))
|
|
4459
|
-
}
|
|
4458
|
+
const branch = isCi ? getSocketBranchName(fromPurl, toVersion) : ''
|
|
4459
|
+
const { owner, repo } = isCi
|
|
4460
|
+
? getGitHubEnvRepoInfo()
|
|
4461
|
+
: {
|
|
4462
|
+
owner: '',
|
|
4463
|
+
repo: ''
|
|
4464
|
+
}
|
|
4465
|
+
const shouldOpenPr = isCi
|
|
4466
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4467
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4468
|
+
: false
|
|
4460
4469
|
const updateData = {
|
|
4461
4470
|
[PNPM$9]: {
|
|
4462
4471
|
...oldPnpm,
|
|
@@ -4501,6 +4510,8 @@ async function pnpmFix(
|
|
|
4501
4510
|
|
|
4502
4511
|
// eslint-disable-next-line no-await-in-loop
|
|
4503
4512
|
await checkoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4513
|
+
let error
|
|
4514
|
+
let errored = false
|
|
4504
4515
|
let installed = false
|
|
4505
4516
|
let saved = false
|
|
4506
4517
|
try {
|
|
@@ -4532,22 +4543,10 @@ async function pnpmFix(
|
|
|
4532
4543
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4533
4544
|
spinner?.start()
|
|
4534
4545
|
} catch (e) {
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
editablePkgJson.update(revertData)
|
|
4538
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4539
|
-
await editablePkgJson.save()
|
|
4540
|
-
}
|
|
4541
|
-
if (installed) {
|
|
4542
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4543
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4544
|
-
spinner
|
|
4545
|
-
})
|
|
4546
|
-
}
|
|
4547
|
-
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4548
|
-
return
|
|
4546
|
+
error = e
|
|
4547
|
+
errored = true
|
|
4549
4548
|
}
|
|
4550
|
-
if (shouldOpenPr) {
|
|
4549
|
+
if (!errored && shouldOpenPr) {
|
|
4551
4550
|
// eslint-disable-next-line no-await-in-loop
|
|
4552
4551
|
await createAndPushBranchIfNeeded(
|
|
4553
4552
|
branch,
|
|
@@ -4569,6 +4568,25 @@ async function pnpmFix(
|
|
|
4569
4568
|
await enableAutoMerge(prResponse.data)
|
|
4570
4569
|
}
|
|
4571
4570
|
}
|
|
4571
|
+
if (errored || isCi) {
|
|
4572
|
+
if (errored) {
|
|
4573
|
+
spinner?.error(`Reverting ${toSpec}`, error)
|
|
4574
|
+
}
|
|
4575
|
+
if (saved) {
|
|
4576
|
+
editablePkgJson.update(revertData)
|
|
4577
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4578
|
+
await editablePkgJson.save()
|
|
4579
|
+
}
|
|
4580
|
+
if (installed) {
|
|
4581
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4582
|
+
actualTree = await install(pkgEnvDetails, {
|
|
4583
|
+
spinner
|
|
4584
|
+
})
|
|
4585
|
+
}
|
|
4586
|
+
if (errored) {
|
|
4587
|
+
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4588
|
+
}
|
|
4589
|
+
}
|
|
4572
4590
|
}
|
|
4573
4591
|
}
|
|
4574
4592
|
}
|
|
@@ -11488,7 +11506,7 @@ void (async () => {
|
|
|
11488
11506
|
await vendor.updater({
|
|
11489
11507
|
name: SOCKET_CLI_BIN_NAME,
|
|
11490
11508
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
11491
|
-
version: '0.14.
|
|
11509
|
+
version: '0.14.102',
|
|
11492
11510
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
11493
11511
|
})
|
|
11494
11512
|
try {
|
|
@@ -11556,5 +11574,5 @@ void (async () => {
|
|
|
11556
11574
|
await shadowNpmInject.captureException(e)
|
|
11557
11575
|
}
|
|
11558
11576
|
})()
|
|
11559
|
-
//# debugId=
|
|
11577
|
+
//# debugId=522cbad6-7bef-48c2-95d7-5233b81e92ca
|
|
11560
11578
|
//# sourceMappingURL=cli.js.map
|