@socketsecurity/cli-with-sentry 0.15.46 → 0.15.48

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/cli.js CHANGED
@@ -3702,10 +3702,10 @@ function getSocketBranchPattern(options) {
3702
3702
  ...options
3703
3703
  };
3704
3704
  const purlObj = purl ? utils.getPurlObject(purl) : null;
3705
- const escType = purlObj ? regexps.escapeRegExp(purlObj.type) : '[^_]+';
3706
- const escWorkspace = workspace ? `${regexps.escapeRegExp(formatBranchName(workspace))}` : '[^_]+';
3705
+ const escType = purlObj ? regexps.escapeRegExp(purlObj.type) : '[^/]+';
3706
+ const escWorkspace = workspace ? `${regexps.escapeRegExp(formatBranchName(workspace))}` : '.+';
3707
3707
  const escMaybeNamespace = purlObj?.namespace ? `${regexps.escapeRegExp(formatBranchName(purlObj.namespace))}--` : '';
3708
- const escFullName = purlObj ? `${escMaybeNamespace}${regexps.escapeRegExp(formatBranchName(purlObj.name))}` : '[^_]+';
3708
+ const escFullName = purlObj ? `${escMaybeNamespace}${regexps.escapeRegExp(formatBranchName(purlObj.name))}` : '[^/_]+';
3709
3709
  const escVersion = purlObj ? regexps.escapeRegExp(formatBranchName(purlObj.version)) : '[^_]+';
3710
3710
  const escNewVersion = newVersion ? regexps.escapeRegExp(formatBranchName(newVersion)) : '[^_]+';
3711
3711
  return new RegExp(`^socket/(${escType})/(${escWorkspace})/(${escFullName})_(${escVersion})_(${escNewVersion})$`);
@@ -4894,7 +4894,16 @@ async function pnpmFix(pkgEnvDetails, {
4894
4894
  } else if (openPrs.length) {
4895
4895
  debug.debugFn('miss: 0 active branches found');
4896
4896
  }
4897
- infos = infos.filter(info => !activeBranches.find(b => b.newVersion === info.firstPatchedVersionIdentifier));
4897
+ infos = infos.filter(info => {
4898
+ const found = activeBranches.find(b => b.newVersion === info.firstPatchedVersionIdentifier);
4899
+ if (found) {
4900
+ debug.debugFn(`found: active branch for ${name}@${info.firstPatchedVersionIdentifier}`);
4901
+ return false;
4902
+ } else {
4903
+ debug.debugFn(`miss: no active branch found for ${name}@${info.firstPatchedVersionIdentifier}`);
4904
+ return true;
4905
+ }
4906
+ });
4898
4907
  }
4899
4908
  if (!infos.length) {
4900
4909
  continue infoEntriesLoop;
@@ -11662,8 +11671,9 @@ async function testAndDownloadManifestFile({
11662
11671
  repoApiUrl,
11663
11672
  tmpDir
11664
11673
  }) {
11665
- debug.debugFn('test: file', file);
11674
+ debug.debugFn('testing: file', file);
11666
11675
  if (!SUPPORTED_FILE_PATTERNS.some(regex => regex.test(file))) {
11676
+ debug.debugFn(' - skip: not a known pattern');
11667
11677
  // Not an error.
11668
11678
  return {
11669
11679
  ok: true,
@@ -11672,7 +11682,7 @@ async function testAndDownloadManifestFile({
11672
11682
  }
11673
11683
  };
11674
11684
  }
11675
- debug.debugFn('found: manifest file', file);
11685
+ debug.debugFn('found: manifest file, going to attempt to download it;', file);
11676
11686
  const result = await downloadManifestFile({
11677
11687
  file,
11678
11688
  tmpDir,
@@ -11741,7 +11751,8 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11741
11751
  try {
11742
11752
  response = await fetch(downloadUrl);
11743
11753
  if (!response.ok) {
11744
- const errorMsg = `Download failed: ${response.status} ${response.statusText} for ${downloadUrl}`;
11754
+ const errorMsg = `Download failed due to bad server response: ${response.status} ${response.statusText} for ${downloadUrl}`;
11755
+ logger.logger.fail(errorMsg);
11745
11756
  return {
11746
11757
  ok: false,
11747
11758
  message: 'Download Failed',
@@ -11749,6 +11760,7 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11749
11760
  };
11750
11761
  }
11751
11762
  if (!response.body) {
11763
+ logger.logger.fail(`Download failed because the server response was empty, for ${downloadUrl}`);
11752
11764
  return {
11753
11765
  ok: false,
11754
11766
  message: 'Download Failed',
@@ -11767,7 +11779,10 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11767
11779
  data: localPath
11768
11780
  };
11769
11781
  } catch (error) {
11770
- logger.logger.fail('An error occurred trying to download the file...');
11782
+ logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
11783
+ debug.debugFn('Raw error:');
11784
+ debug.debugFn(error);
11785
+
11771
11786
  // If an error occurs and fileStream was created, attempt to clean up.
11772
11787
  if (fs$1.existsSync(localPath)) {
11773
11788
  // Check if fileStream was even opened before trying to delete
@@ -11788,6 +11803,7 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11788
11803
  // If error was due to bad HTTP status
11789
11804
  detailedError += ` (HTTP Status: ${response.status} ${response.statusText})`;
11790
11805
  }
11806
+ debug.debugFn(detailedError);
11791
11807
  return {
11792
11808
  ok: false,
11793
11809
  message: 'Download Failed',
@@ -14268,5 +14284,5 @@ void (async () => {
14268
14284
  await utils.captureException(e);
14269
14285
  }
14270
14286
  })();
14271
- //# debugId=ad52decd-77a1-456a-85fe-05c2c8c57de5
14287
+ //# debugId=d77f850e-4116-456a-acb9-b74d5a8977aa
14272
14288
  //# sourceMappingURL=cli.js.map