@socketsecurity/cli-with-sentry 0.14.123 → 0.14.124
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 +34 -68
- 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 +34 -68
- 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.124:5b2103f:b9f122e3: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=a1b404f2-b282-4607-a7bd-16cca4be61f5
|
|
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":"a1b404f2-b282-4607-a7bd-16cca4be61f5"}
|
package/dist/module-sync/cli.js
CHANGED
|
@@ -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.
|
|
920
|
+
const cliVersion = '0.14.124:5b2103f:b9f122e3: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')
|
|
@@ -3739,7 +3739,7 @@ function getPkgNameFromPurlObj(purlObj) {
|
|
|
3739
3739
|
function getBaseGitBranch() {
|
|
3740
3740
|
// Lazily access constants.ENV[GITHUB_REF_NAME].
|
|
3741
3741
|
return (
|
|
3742
|
-
constants.ENV[GITHUB_REF_NAME]
|
|
3742
|
+
constants.ENV[GITHUB_REF_NAME] ||
|
|
3743
3743
|
// GitHub defaults to branch name "main"
|
|
3744
3744
|
// https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches#about-the-default-branch
|
|
3745
3745
|
'main'
|
|
@@ -3858,16 +3858,6 @@ async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
|
|
|
3858
3858
|
const rawFiles = stdout?.trim().split('\n') ?? []
|
|
3859
3859
|
return rawFiles.map(relPath => path.normalizePath(relPath))
|
|
3860
3860
|
}
|
|
3861
|
-
async function isInGitRepo(cwd = process.cwd()) {
|
|
3862
|
-
try {
|
|
3863
|
-
await spawn.spawn('git', ['rev-parse', '--is-inside-work-tree'], {
|
|
3864
|
-
cwd,
|
|
3865
|
-
stdio: 'ignore'
|
|
3866
|
-
})
|
|
3867
|
-
return true
|
|
3868
|
-
} catch {}
|
|
3869
|
-
return false
|
|
3870
|
-
}
|
|
3871
3861
|
|
|
3872
3862
|
const { GITHUB_ACTIONS, GITHUB_REPOSITORY, SOCKET_SECURITY_GITHUB_PAT } =
|
|
3873
3863
|
constants
|
|
@@ -4054,10 +4044,10 @@ async function npmFix(
|
|
|
4054
4044
|
|
|
4055
4045
|
// Lazily access constants.ENV[CI].
|
|
4056
4046
|
const isCi = constants.ENV[CI$1]
|
|
4057
|
-
const
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4047
|
+
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4048
|
+
pkgEnvDetails.agent,
|
|
4049
|
+
rootPath
|
|
4050
|
+
)
|
|
4061
4051
|
const pkgJsonPaths = [
|
|
4062
4052
|
...workspacePkgJsonPaths,
|
|
4063
4053
|
// Process the workspace root last since it will add an override to package.json.
|
|
@@ -4075,7 +4065,7 @@ async function npmFix(
|
|
|
4075
4065
|
const oldVersions = arrays.arrayUnique(
|
|
4076
4066
|
shadowNpmInject
|
|
4077
4067
|
.findPackageNodes(arb.idealTree, name)
|
|
4078
|
-
.map(n => n.version)
|
|
4068
|
+
.map(n => n.target?.version ?? n.version)
|
|
4079
4069
|
.filter(Boolean)
|
|
4080
4070
|
)
|
|
4081
4071
|
const packument =
|
|
@@ -4272,15 +4262,15 @@ async function npmFix(
|
|
|
4272
4262
|
// eslint-disable-next-line no-await-in-loop
|
|
4273
4263
|
await Promise.all([
|
|
4274
4264
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4275
|
-
...(
|
|
4276
|
-
|
|
4265
|
+
...(isCi
|
|
4266
|
+
? [gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)]
|
|
4267
|
+
: []),
|
|
4268
|
+
...(saved && !isCi ? [editablePkgJson.save()] : [])
|
|
4277
4269
|
])
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
})
|
|
4283
|
-
}
|
|
4270
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4271
|
+
await install$1(revertTree, {
|
|
4272
|
+
cwd
|
|
4273
|
+
})
|
|
4284
4274
|
if (errored) {
|
|
4285
4275
|
if (!failedSpecs.has(newSpecKey)) {
|
|
4286
4276
|
failedSpecs.add(newSpecKey)
|
|
@@ -4480,37 +4470,34 @@ async function pnpmFix(
|
|
|
4480
4470
|
|
|
4481
4471
|
// Lazily access constants.ENV[CI].
|
|
4482
4472
|
const isCi = constants.ENV[CI]
|
|
4483
|
-
const
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4473
|
+
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4474
|
+
pkgEnvDetails.agent,
|
|
4475
|
+
rootPath
|
|
4476
|
+
)
|
|
4477
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4478
|
+
const { owner, repo } = isCi
|
|
4479
|
+
? getGitHubEnvRepoInfo()
|
|
4480
|
+
: {
|
|
4481
|
+
owner: '',
|
|
4482
|
+
repo: ''
|
|
4483
|
+
}
|
|
4487
4484
|
const pkgJsonPaths = [
|
|
4488
4485
|
...workspacePkgJsonPaths,
|
|
4489
4486
|
// Process the workspace root last since it will add an override to package.json.
|
|
4490
4487
|
pkgEnvDetails.editablePkgJson.filename
|
|
4491
4488
|
]
|
|
4492
|
-
let actualTree
|
|
4489
|
+
let actualTree = await getActualTree(cwd)
|
|
4493
4490
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4494
4491
|
if (registry.getManifestData(NPM$c, name)) {
|
|
4495
4492
|
spinner?.info(`Skipping ${name}. Socket Optimize package exists.`)
|
|
4496
4493
|
continue
|
|
4497
4494
|
}
|
|
4498
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4499
|
-
await Promise.all([
|
|
4500
|
-
shadowNpmInject.removeNodeModules(cwd),
|
|
4501
|
-
...(isRepo ? [gitHardReset(cwd)] : [])
|
|
4502
|
-
])
|
|
4503
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4504
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4505
|
-
spinner
|
|
4506
|
-
})
|
|
4507
4495
|
const oldVersions = arrays.arrayUnique(
|
|
4508
4496
|
shadowNpmInject
|
|
4509
4497
|
.findPackageNodes(actualTree, name)
|
|
4510
|
-
.map(n => n.version)
|
|
4498
|
+
.map(n => n.target?.version ?? n.version)
|
|
4511
4499
|
.filter(Boolean)
|
|
4512
4500
|
)
|
|
4513
|
-
debug.debugLog(name, 'oldVersions', oldVersions)
|
|
4514
4501
|
const packument =
|
|
4515
4502
|
oldVersions.length && infos.length
|
|
4516
4503
|
? // eslint-disable-next-line no-await-in-loop
|
|
@@ -4533,15 +4520,6 @@ async function pnpmFix(
|
|
|
4533
4520
|
firstPatchedVersionIdentifier,
|
|
4534
4521
|
vulnerableVersionRange
|
|
4535
4522
|
} of infos) {
|
|
4536
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4537
|
-
await Promise.all([
|
|
4538
|
-
shadowNpmInject.removeNodeModules(cwd),
|
|
4539
|
-
...(isRepo ? [gitHardReset(cwd)] : [])
|
|
4540
|
-
])
|
|
4541
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4542
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4543
|
-
spinner
|
|
4544
|
-
})
|
|
4545
4523
|
const node = shadowNpmInject.findPackageNode(
|
|
4546
4524
|
actualTree,
|
|
4547
4525
|
name,
|
|
@@ -4644,21 +4622,10 @@ async function pnpmFix(
|
|
|
4644
4622
|
const branch = isCi
|
|
4645
4623
|
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4646
4624
|
: ''
|
|
4647
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4648
|
-
const { owner, repo } = isCi
|
|
4649
|
-
? getGitHubEnvRepoInfo()
|
|
4650
|
-
: {
|
|
4651
|
-
owner: '',
|
|
4652
|
-
repo: ''
|
|
4653
|
-
}
|
|
4654
4625
|
const shouldOpenPr = isCi
|
|
4655
4626
|
? // eslint-disable-next-line no-await-in-loop
|
|
4656
4627
|
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4657
4628
|
: false
|
|
4658
|
-
if (isCi) {
|
|
4659
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4660
|
-
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4661
|
-
}
|
|
4662
4629
|
if (updateData) {
|
|
4663
4630
|
editablePkgJson.update(updateData)
|
|
4664
4631
|
}
|
|
@@ -4754,11 +4721,10 @@ async function pnpmFix(
|
|
|
4754
4721
|
// eslint-disable-next-line no-await-in-loop
|
|
4755
4722
|
await Promise.all([
|
|
4756
4723
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4757
|
-
...(
|
|
4758
|
-
? [
|
|
4759
|
-
:
|
|
4760
|
-
|
|
4761
|
-
: [])
|
|
4724
|
+
...(isCi
|
|
4725
|
+
? [gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)]
|
|
4726
|
+
: []),
|
|
4727
|
+
...(installed && !isCi ? [editablePkgJson.save()] : [])
|
|
4762
4728
|
])
|
|
4763
4729
|
// eslint-disable-next-line no-await-in-loop
|
|
4764
4730
|
actualTree = await install(pkgEnvDetails, {
|
|
@@ -12345,7 +12311,7 @@ void (async () => {
|
|
|
12345
12311
|
await vendor.updater({
|
|
12346
12312
|
name: SOCKET_CLI_BIN_NAME,
|
|
12347
12313
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12348
|
-
version: '0.14.
|
|
12314
|
+
version: '0.14.124',
|
|
12349
12315
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12350
12316
|
})
|
|
12351
12317
|
try {
|
|
@@ -12413,5 +12379,5 @@ void (async () => {
|
|
|
12413
12379
|
await shadowNpmInject.captureException(e)
|
|
12414
12380
|
}
|
|
12415
12381
|
})()
|
|
12416
|
-
//# debugId=
|
|
12382
|
+
//# debugId=6c275bac-7bf4-4e55-8d6d-8b25adfc2eba
|
|
12417
12383
|
//# sourceMappingURL=cli.js.map
|