socket 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/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
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,37 +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
|
-
await Promise.all([
|
|
4496
|
-
shadowNpmInject.removeNodeModules(cwd),
|
|
4497
|
-
...(isRepo ? [gitHardReset(cwd)] : [])
|
|
4498
|
-
])
|
|
4499
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4500
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4501
|
-
spinner
|
|
4502
|
-
})
|
|
4503
4491
|
const oldVersions = arrays.arrayUnique(
|
|
4504
4492
|
shadowNpmInject
|
|
4505
4493
|
.findPackageNodes(actualTree, name)
|
|
4506
|
-
.map(n => n.version)
|
|
4494
|
+
.map(n => n.target?.version ?? n.version)
|
|
4507
4495
|
.filter(Boolean)
|
|
4508
4496
|
)
|
|
4509
|
-
debug.debugLog(name, 'oldVersions', oldVersions)
|
|
4510
4497
|
const packument =
|
|
4511
4498
|
oldVersions.length && infos.length
|
|
4512
4499
|
? // eslint-disable-next-line no-await-in-loop
|
|
@@ -4529,15 +4516,6 @@ async function pnpmFix(
|
|
|
4529
4516
|
firstPatchedVersionIdentifier,
|
|
4530
4517
|
vulnerableVersionRange
|
|
4531
4518
|
} of infos) {
|
|
4532
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4533
|
-
await Promise.all([
|
|
4534
|
-
shadowNpmInject.removeNodeModules(cwd),
|
|
4535
|
-
...(isRepo ? [gitHardReset(cwd)] : [])
|
|
4536
|
-
])
|
|
4537
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4538
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4539
|
-
spinner
|
|
4540
|
-
})
|
|
4541
4519
|
const node = shadowNpmInject.findPackageNode(
|
|
4542
4520
|
actualTree,
|
|
4543
4521
|
name,
|
|
@@ -4640,21 +4618,10 @@ async function pnpmFix(
|
|
|
4640
4618
|
const branch = isCi
|
|
4641
4619
|
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4642
4620
|
: ''
|
|
4643
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4644
|
-
const { owner, repo } = isCi
|
|
4645
|
-
? getGitHubEnvRepoInfo()
|
|
4646
|
-
: {
|
|
4647
|
-
owner: '',
|
|
4648
|
-
repo: ''
|
|
4649
|
-
}
|
|
4650
4621
|
const shouldOpenPr = isCi
|
|
4651
4622
|
? // eslint-disable-next-line no-await-in-loop
|
|
4652
4623
|
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4653
4624
|
: false
|
|
4654
|
-
if (isCi) {
|
|
4655
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4656
|
-
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4657
|
-
}
|
|
4658
4625
|
if (updateData) {
|
|
4659
4626
|
editablePkgJson.update(updateData)
|
|
4660
4627
|
}
|
|
@@ -4750,11 +4717,10 @@ async function pnpmFix(
|
|
|
4750
4717
|
// eslint-disable-next-line no-await-in-loop
|
|
4751
4718
|
await Promise.all([
|
|
4752
4719
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4753
|
-
...(
|
|
4754
|
-
? [
|
|
4755
|
-
:
|
|
4756
|
-
|
|
4757
|
-
: [])
|
|
4720
|
+
...(isCi
|
|
4721
|
+
? [gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)]
|
|
4722
|
+
: []),
|
|
4723
|
+
...(installed && !isCi ? [editablePkgJson.save()] : [])
|
|
4758
4724
|
])
|
|
4759
4725
|
// eslint-disable-next-line no-await-in-loop
|
|
4760
4726
|
actualTree = await install(pkgEnvDetails, {
|
|
@@ -12341,7 +12307,7 @@ void (async () => {
|
|
|
12341
12307
|
await vendor.updater({
|
|
12342
12308
|
name: SOCKET_CLI_BIN_NAME,
|
|
12343
12309
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12344
|
-
version: '0.14.
|
|
12310
|
+
version: '0.14.124',
|
|
12345
12311
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12346
12312
|
})
|
|
12347
12313
|
try {
|
|
@@ -12409,5 +12375,5 @@ void (async () => {
|
|
|
12409
12375
|
await shadowNpmInject.captureException(e)
|
|
12410
12376
|
}
|
|
12411
12377
|
})()
|
|
12412
|
-
//# debugId=
|
|
12378
|
+
//# debugId=bf160d06-cec8-4139-929e-f01e353b895b
|
|
12413
12379
|
//# sourceMappingURL=cli.js.map
|