@socketsecurity/cli-with-sentry 0.14.99 → 0.14.101
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 +83 -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 +83 -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.101:26533ef:6809fc78: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=578e3a6a-a686-4c39-98eb-2a1a2c2085ec
|
|
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":"578e3a6a-a686-4c39-98eb-2a1a2c2085ec"}
|
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.101:26533ef:6809fc78: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'
|
|
@@ -3703,7 +3703,7 @@ const cmdDiffScan = {
|
|
|
3703
3703
|
|
|
3704
3704
|
const { GITHUB_REF_NAME } = constants
|
|
3705
3705
|
function formatBranchName(str) {
|
|
3706
|
-
return str.replace(/[-_.]+/g, '-').replace(/[
|
|
3706
|
+
return str.replace(/[-_.]+/g, '-').replace(/[^-a-zA-Z0-9]+/g, '') ?? ''
|
|
3707
3707
|
}
|
|
3708
3708
|
function getPkgNameFromPurlObj(purlObj) {
|
|
3709
3709
|
return `${purlObj.namespace ? `${purlObj.namespace}/` : ''}${purlObj.name}`
|
|
@@ -3965,6 +3965,8 @@ async function npmFix(
|
|
|
3965
3965
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
3966
3966
|
editable: true
|
|
3967
3967
|
})
|
|
3968
|
+
// Lazily access constants.ENV[CI].
|
|
3969
|
+
const isCi = constants.ENV[CI$1]
|
|
3968
3970
|
await arb.buildIdealTree()
|
|
3969
3971
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
3970
3972
|
const hasUpgrade = !!registry.getManifestData(NPM$f, name)
|
|
@@ -4010,8 +4012,8 @@ async function npmFix(
|
|
|
4010
4012
|
if (
|
|
4011
4013
|
!shadowNpmInject.updateNode(node, packument, vulnerableVersionRange)
|
|
4012
4014
|
) {
|
|
4013
|
-
spinner?.
|
|
4014
|
-
|
|
4015
|
+
spinner?.fail(`Could not patch ${fromSpec}`)
|
|
4016
|
+
continue
|
|
4015
4017
|
}
|
|
4016
4018
|
const toVersion = node.package.version
|
|
4017
4019
|
const toVersionRange = shadowNpmInject.applyRange(
|
|
@@ -4020,21 +4022,17 @@ async function npmFix(
|
|
|
4020
4022
|
rangeStyle
|
|
4021
4023
|
)
|
|
4022
4024
|
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
|
-
}
|
|
4025
|
+
const branch = isCi ? getSocketBranchName(fromPurl, toVersion) : ''
|
|
4026
|
+
const { owner, repo } = isCi
|
|
4027
|
+
? getGitHubEnvRepoInfo()
|
|
4028
|
+
: {
|
|
4029
|
+
owner: '',
|
|
4030
|
+
repo: ''
|
|
4031
|
+
}
|
|
4032
|
+
const shouldOpenPr = isCi
|
|
4033
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4034
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4035
|
+
: false
|
|
4038
4036
|
const revertData = {
|
|
4039
4037
|
...(editablePkgJson.content.dependencies
|
|
4040
4038
|
? {
|
|
@@ -4058,6 +4056,8 @@ async function npmFix(
|
|
|
4058
4056
|
|
|
4059
4057
|
// eslint-disable-next-line no-await-in-loop
|
|
4060
4058
|
await checkoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4059
|
+
let error
|
|
4060
|
+
let errored = false
|
|
4061
4061
|
let installed = false
|
|
4062
4062
|
let saved = false
|
|
4063
4063
|
try {
|
|
@@ -4087,23 +4087,11 @@ async function npmFix(
|
|
|
4087
4087
|
}
|
|
4088
4088
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4089
4089
|
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
|
|
4090
|
+
} catch (e) {
|
|
4091
|
+
error = e
|
|
4092
|
+
errored = true
|
|
4105
4093
|
}
|
|
4106
|
-
if (shouldOpenPr) {
|
|
4094
|
+
if (!errored && shouldOpenPr) {
|
|
4107
4095
|
// eslint-disable-next-line no-await-in-loop
|
|
4108
4096
|
await createAndPushBranchIfNeeded(
|
|
4109
4097
|
branch,
|
|
@@ -4125,6 +4113,25 @@ async function npmFix(
|
|
|
4125
4113
|
await enableAutoMerge(prResponse.data)
|
|
4126
4114
|
}
|
|
4127
4115
|
}
|
|
4116
|
+
if (errored || isCi) {
|
|
4117
|
+
if (errored) {
|
|
4118
|
+
spinner?.error(`Reverting ${toSpec}`, error)
|
|
4119
|
+
}
|
|
4120
|
+
if (saved) {
|
|
4121
|
+
editablePkgJson.update(revertData)
|
|
4122
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4123
|
+
await editablePkgJson.save()
|
|
4124
|
+
}
|
|
4125
|
+
if (installed) {
|
|
4126
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4127
|
+
await install$1(revertTree, {
|
|
4128
|
+
cwd
|
|
4129
|
+
})
|
|
4130
|
+
}
|
|
4131
|
+
if (errored) {
|
|
4132
|
+
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4128
4135
|
}
|
|
4129
4136
|
}
|
|
4130
4137
|
}
|
|
@@ -4379,6 +4386,8 @@ async function pnpmFix(
|
|
|
4379
4386
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
4380
4387
|
editable: true
|
|
4381
4388
|
})
|
|
4389
|
+
// Lazily access constants.ENV[CI].
|
|
4390
|
+
const isCi = constants.ENV[CI]
|
|
4382
4391
|
let actualTree = await getActualTree(cwd)
|
|
4383
4392
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4384
4393
|
if (registry.getManifestData(NPM$c, name)) {
|
|
@@ -4426,8 +4435,8 @@ async function pnpmFix(
|
|
|
4426
4435
|
? packument.versions[toVersion]
|
|
4427
4436
|
: undefined
|
|
4428
4437
|
if (!(toVersion && targetPackument)) {
|
|
4429
|
-
spinner?.
|
|
4430
|
-
|
|
4438
|
+
spinner?.fail(`Could not patch ${fromSpec}`)
|
|
4439
|
+
continue
|
|
4431
4440
|
}
|
|
4432
4441
|
const oldPnpm = editablePkgJson.content[PNPM$9]
|
|
4433
4442
|
const oldPnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
|
|
@@ -4442,21 +4451,17 @@ async function pnpmFix(
|
|
|
4442
4451
|
rangeStyle
|
|
4443
4452
|
)
|
|
4444
4453
|
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
|
-
}
|
|
4454
|
+
const branch = isCi ? getSocketBranchName(fromPurl, toVersion) : ''
|
|
4455
|
+
const { owner, repo } = isCi
|
|
4456
|
+
? getGitHubEnvRepoInfo()
|
|
4457
|
+
: {
|
|
4458
|
+
owner: '',
|
|
4459
|
+
repo: ''
|
|
4460
|
+
}
|
|
4461
|
+
const shouldOpenPr = isCi
|
|
4462
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4463
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4464
|
+
: false
|
|
4460
4465
|
const updateData = {
|
|
4461
4466
|
[PNPM$9]: {
|
|
4462
4467
|
...oldPnpm,
|
|
@@ -4501,6 +4506,8 @@ async function pnpmFix(
|
|
|
4501
4506
|
|
|
4502
4507
|
// eslint-disable-next-line no-await-in-loop
|
|
4503
4508
|
await checkoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4509
|
+
let error
|
|
4510
|
+
let errored = false
|
|
4504
4511
|
let installed = false
|
|
4505
4512
|
let saved = false
|
|
4506
4513
|
try {
|
|
@@ -4532,22 +4539,10 @@ async function pnpmFix(
|
|
|
4532
4539
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4533
4540
|
spinner?.start()
|
|
4534
4541
|
} 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
|
|
4542
|
+
error = e
|
|
4543
|
+
errored = true
|
|
4549
4544
|
}
|
|
4550
|
-
if (shouldOpenPr) {
|
|
4545
|
+
if (!errored && shouldOpenPr) {
|
|
4551
4546
|
// eslint-disable-next-line no-await-in-loop
|
|
4552
4547
|
await createAndPushBranchIfNeeded(
|
|
4553
4548
|
branch,
|
|
@@ -4569,6 +4564,25 @@ async function pnpmFix(
|
|
|
4569
4564
|
await enableAutoMerge(prResponse.data)
|
|
4570
4565
|
}
|
|
4571
4566
|
}
|
|
4567
|
+
if (errored || isCi) {
|
|
4568
|
+
if (errored) {
|
|
4569
|
+
spinner?.error(`Reverting ${toSpec}`, error)
|
|
4570
|
+
}
|
|
4571
|
+
if (saved) {
|
|
4572
|
+
editablePkgJson.update(revertData)
|
|
4573
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4574
|
+
await editablePkgJson.save()
|
|
4575
|
+
}
|
|
4576
|
+
if (installed) {
|
|
4577
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4578
|
+
actualTree = await install(pkgEnvDetails, {
|
|
4579
|
+
spinner
|
|
4580
|
+
})
|
|
4581
|
+
}
|
|
4582
|
+
if (errored) {
|
|
4583
|
+
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4572
4586
|
}
|
|
4573
4587
|
}
|
|
4574
4588
|
}
|
|
@@ -11488,7 +11502,7 @@ void (async () => {
|
|
|
11488
11502
|
await vendor.updater({
|
|
11489
11503
|
name: SOCKET_CLI_BIN_NAME,
|
|
11490
11504
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
11491
|
-
version: '0.14.
|
|
11505
|
+
version: '0.14.101',
|
|
11492
11506
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
11493
11507
|
})
|
|
11494
11508
|
try {
|
|
@@ -11556,5 +11570,5 @@ void (async () => {
|
|
|
11556
11570
|
await shadowNpmInject.captureException(e)
|
|
11557
11571
|
}
|
|
11558
11572
|
})()
|
|
11559
|
-
//# debugId=
|
|
11573
|
+
//# debugId=44651632-7756-496b-8acd-9d65810541dd
|
|
11560
11574
|
//# sourceMappingURL=cli.js.map
|