socket 0.14.122 → 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/module-sync/cli.js +34 -54
- 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 -54
- 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
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:da70cd14: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)
|
|
@@ -4476,30 +4466,34 @@ async function pnpmFix(
|
|
|
4476
4466
|
|
|
4477
4467
|
// Lazily access constants.ENV[CI].
|
|
4478
4468
|
const isCi = constants.ENV[CI]
|
|
4479
|
-
const
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4469
|
+
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4470
|
+
pkgEnvDetails.agent,
|
|
4471
|
+
rootPath
|
|
4472
|
+
)
|
|
4473
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4474
|
+
const { owner, repo } = isCi
|
|
4475
|
+
? getGitHubEnvRepoInfo()
|
|
4476
|
+
: {
|
|
4477
|
+
owner: '',
|
|
4478
|
+
repo: ''
|
|
4479
|
+
}
|
|
4483
4480
|
const pkgJsonPaths = [
|
|
4484
4481
|
...workspacePkgJsonPaths,
|
|
4485
4482
|
// Process the workspace root last since it will add an override to package.json.
|
|
4486
4483
|
pkgEnvDetails.editablePkgJson.filename
|
|
4487
4484
|
]
|
|
4488
|
-
let actualTree
|
|
4485
|
+
let actualTree = await getActualTree(cwd)
|
|
4489
4486
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4490
4487
|
if (registry.getManifestData(NPM$c, name)) {
|
|
4491
4488
|
spinner?.info(`Skipping ${name}. Socket Optimize package exists.`)
|
|
4492
4489
|
continue
|
|
4493
4490
|
}
|
|
4494
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4495
|
-
actualTree = await getActualTree(cwd)
|
|
4496
4491
|
const oldVersions = arrays.arrayUnique(
|
|
4497
4492
|
shadowNpmInject
|
|
4498
4493
|
.findPackageNodes(actualTree, name)
|
|
4499
|
-
.map(n => n.version)
|
|
4494
|
+
.map(n => n.target?.version ?? n.version)
|
|
4500
4495
|
.filter(Boolean)
|
|
4501
4496
|
)
|
|
4502
|
-
debug.debugLog(name, 'oldVersions', oldVersions)
|
|
4503
4497
|
const packument =
|
|
4504
4498
|
oldVersions.length && infos.length
|
|
4505
4499
|
? // eslint-disable-next-line no-await-in-loop
|
|
@@ -4522,8 +4516,6 @@ async function pnpmFix(
|
|
|
4522
4516
|
firstPatchedVersionIdentifier,
|
|
4523
4517
|
vulnerableVersionRange
|
|
4524
4518
|
} of infos) {
|
|
4525
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4526
|
-
actualTree = await getActualTree()
|
|
4527
4519
|
const node = shadowNpmInject.findPackageNode(
|
|
4528
4520
|
actualTree,
|
|
4529
4521
|
name,
|
|
@@ -4626,21 +4618,10 @@ async function pnpmFix(
|
|
|
4626
4618
|
const branch = isCi
|
|
4627
4619
|
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4628
4620
|
: ''
|
|
4629
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4630
|
-
const { owner, repo } = isCi
|
|
4631
|
-
? getGitHubEnvRepoInfo()
|
|
4632
|
-
: {
|
|
4633
|
-
owner: '',
|
|
4634
|
-
repo: ''
|
|
4635
|
-
}
|
|
4636
4621
|
const shouldOpenPr = isCi
|
|
4637
4622
|
? // eslint-disable-next-line no-await-in-loop
|
|
4638
4623
|
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4639
4624
|
: false
|
|
4640
|
-
if (isCi) {
|
|
4641
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4642
|
-
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4643
|
-
}
|
|
4644
4625
|
if (updateData) {
|
|
4645
4626
|
editablePkgJson.update(updateData)
|
|
4646
4627
|
}
|
|
@@ -4736,11 +4717,10 @@ async function pnpmFix(
|
|
|
4736
4717
|
// eslint-disable-next-line no-await-in-loop
|
|
4737
4718
|
await Promise.all([
|
|
4738
4719
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4739
|
-
...(
|
|
4740
|
-
? [
|
|
4741
|
-
:
|
|
4742
|
-
|
|
4743
|
-
: [])
|
|
4720
|
+
...(isCi
|
|
4721
|
+
? [gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)]
|
|
4722
|
+
: []),
|
|
4723
|
+
...(installed && !isCi ? [editablePkgJson.save()] : [])
|
|
4744
4724
|
])
|
|
4745
4725
|
// eslint-disable-next-line no-await-in-loop
|
|
4746
4726
|
actualTree = await install(pkgEnvDetails, {
|
|
@@ -12327,7 +12307,7 @@ void (async () => {
|
|
|
12327
12307
|
await vendor.updater({
|
|
12328
12308
|
name: SOCKET_CLI_BIN_NAME,
|
|
12329
12309
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12330
|
-
version: '0.14.
|
|
12310
|
+
version: '0.14.124',
|
|
12331
12311
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12332
12312
|
})
|
|
12333
12313
|
try {
|
|
@@ -12395,5 +12375,5 @@ void (async () => {
|
|
|
12395
12375
|
await shadowNpmInject.captureException(e)
|
|
12396
12376
|
}
|
|
12397
12377
|
})()
|
|
12398
|
-
//# debugId=
|
|
12378
|
+
//# debugId=bf160d06-cec8-4139-929e-f01e353b895b
|
|
12399
12379
|
//# sourceMappingURL=cli.js.map
|