@socketsecurity/cli-with-sentry 0.14.50 → 0.14.52

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.
@@ -2,7 +2,7 @@
2
2
  import { SafeEdge } from "./edge.js";
3
3
  import { SafeNode } from "./node.js";
4
4
  import indentString from "@socketregistry/indent-string/index.cjs";
5
- import { LogSymbols } from "./logging.js";
5
+ import { LogSymbols } from "@socketsecurity/registry/lib/logger";
6
6
  import { SocketSdkResultType } from "@socketsecurity/sdk";
7
7
  import { Diff, ArboristClass } from "./types.js";
8
8
  import { ObjectEncodingOptions, OpenMode, PathLike } from "node:fs";
@@ -30,13 +30,15 @@ var registryConstants = require('@socketsecurity/registry/lib/constants');
30
30
  var strings = require('@socketsecurity/registry/lib/strings');
31
31
  var sdk = require('@socketsecurity/sdk');
32
32
  var promises = require('node:timers/promises');
33
- var npmPaths = require('./npm-paths.js');
33
+ var debug = require('@socketsecurity/registry/lib/debug');
34
34
  var fs = require('node:fs');
35
35
  var os = require('node:os');
36
36
  var config = require('@socketsecurity/config');
37
+ var logger = require('@socketsecurity/registry/lib/logger');
37
38
  var terminalLink = _socketInterop(require('terminal-link'));
38
39
  var colors = _socketInterop(require('yoctocolors-cjs'));
39
40
  var indentString = require('@socketregistry/indent-string/index.cjs');
41
+ var npmPaths = require('./npm-paths.js');
40
42
  var npa = _socketInterop(require('npm-package-arg'));
41
43
 
42
44
  const {
@@ -63,7 +65,7 @@ function captureExceptionSync(exception, hint) {
63
65
  if (!Sentry) {
64
66
  return '';
65
67
  }
66
- npmPaths.debugLog('captureException: Sending exception to Sentry.');
68
+ debug.debugLog('captureException: Sending exception to Sentry.');
67
69
  return Sentry.captureException(exception, hint);
68
70
  }
69
71
  function isErrnoException(value) {
@@ -134,7 +136,7 @@ function getSettings() {
134
136
  try {
135
137
  Object.assign(_settings, JSON.parse(Buffer.from(raw, 'base64').toString()));
136
138
  } catch {
137
- npmPaths.logger.warn(`Failed to parse settings at ${settingsPath}`);
139
+ logger.logger.warn(`Failed to parse settings at ${settingsPath}`);
138
140
  }
139
141
  } else {
140
142
  fs.mkdirSync(path.dirname(settingsPath), {
@@ -158,7 +160,7 @@ function getSettingsPath() {
158
160
  if (WIN32) {
159
161
  if (!_warnedSettingPathWin32Missing) {
160
162
  _warnedSettingPathWin32Missing = true;
161
- npmPaths.logger.warn(`Missing %${LOCALAPPDATA}%`);
163
+ logger.logger.warn(`Missing %${LOCALAPPDATA}%`);
162
164
  }
163
165
  } else {
164
166
  dataHome = path.join(os.homedir(), ...(process.platform === 'darwin' ? ['Library', 'Application Support'] : ['.local', 'share']));
@@ -375,7 +377,7 @@ const {
375
377
  ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,
376
378
  CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER: CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER$1,
377
379
  CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,
378
- abortSignal: abortSignal$2
380
+ abortSignal: abortSignal$1
379
381
  } = constants;
380
382
  async function* createBatchGenerator(chunk) {
381
383
  // Adds the first 'abort' listener to abortSignal.
@@ -386,7 +388,7 @@ async function* createBatchGenerator(chunk) {
386
388
  headers: {
387
389
  Authorization: `Basic ${btoa(`${getPublicToken()}:`)}`
388
390
  },
389
- signal: abortSignal$2
391
+ signal: abortSignal$1
390
392
  }).end(JSON.stringify({
391
393
  components: chunk.map(id => ({
392
394
  purl: `pkg:npm/${id}`
@@ -396,7 +398,7 @@ async function* createBatchGenerator(chunk) {
396
398
  const {
397
399
  0: res
398
400
  } = await events.once(req, 'response', {
399
- signal: abortSignal$2
401
+ signal: abortSignal$1
400
402
  });
401
403
  const ok = res.statusCode >= 200 && res.statusCode <= 299;
402
404
  if (!ok) {
@@ -405,7 +407,7 @@ async function* createBatchGenerator(chunk) {
405
407
  const rli = readline.createInterface({
406
408
  input: res,
407
409
  crlfDelay: Infinity,
408
- signal: abortSignal$2
410
+ signal: abortSignal$1
409
411
  });
410
412
  for await (const line of rli) {
411
413
  yield JSON.parse(line);
@@ -416,11 +418,11 @@ async function* batchScan(pkgIds, concurrencyLimit = 50) {
416
418
  // abortSignal so we multiply the concurrencyLimit by 2.
417
419
  const neededMaxListeners = concurrencyLimit * 2;
418
420
  // Increase abortSignal max listeners count to avoid Node's MaxListenersExceededWarning.
419
- const oldAbortSignalMaxListeners = events.getMaxListeners(abortSignal$2);
421
+ const oldAbortSignalMaxListeners = events.getMaxListeners(abortSignal$1);
420
422
  let abortSignalMaxListeners = oldAbortSignalMaxListeners;
421
423
  if (oldAbortSignalMaxListeners < neededMaxListeners) {
422
424
  abortSignalMaxListeners = oldAbortSignalMaxListeners + neededMaxListeners;
423
- events.setMaxListeners(abortSignalMaxListeners, abortSignal$2);
425
+ events.setMaxListeners(abortSignalMaxListeners, abortSignal$1);
424
426
  }
425
427
  const {
426
428
  length: pkgIdsCount
@@ -471,7 +473,7 @@ async function* batchScan(pkgIds, concurrencyLimit = 50) {
471
473
  }
472
474
  // Reset abortSignal max listeners count.
473
475
  if (abortSignalMaxListeners > oldAbortSignalMaxListeners) {
474
- events.setMaxListeners(oldAbortSignalMaxListeners, abortSignal$2);
476
+ events.setMaxListeners(oldAbortSignalMaxListeners, abortSignal$1);
475
477
  }
476
478
  }
477
479
  function isArtifactAlertCveFixable(alert) {
@@ -485,7 +487,7 @@ function isArtifactAlertUpgradeFixable(alert) {
485
487
  }
486
488
 
487
489
  const {
488
- abortSignal: abortSignal$1
490
+ abortSignal
489
491
  } = constants;
490
492
  const ERROR_UX = {
491
493
  block: true,
@@ -622,7 +624,7 @@ async function uxLookup(settings) {
622
624
  while (_uxLookup === undefined) {
623
625
  // eslint-disable-next-line no-await-in-loop
624
626
  await promises.setTimeout(1, {
625
- signal: abortSignal$1
627
+ signal: abortSignal
626
628
  });
627
629
  }
628
630
  return _uxLookup(settings);
@@ -697,13 +699,13 @@ void (async () => {
697
699
  _uxLookup = createAlertUXLookup(settings);
698
700
  })();
699
701
 
700
- const markdownLogSymbols = {
702
+ const markdownLogSymbols = Object.freeze({
701
703
  __proto__: null,
702
704
  info: ':information_source:',
703
705
  error: ':stop_sign:',
704
706
  success: ':white_check_mark:',
705
707
  warning: ':warning:'
706
- };
708
+ });
707
709
  class ColorOrMarkdown {
708
710
  constructor(useMarkdown) {
709
711
  this.useMarkdown = !!useMarkdown;
@@ -739,7 +741,7 @@ class ColorOrMarkdown {
739
741
  return this.useMarkdown ? `* ${indentedContent.join('\n* ')}\n` : `${indentedContent.join('\n')}\n`;
740
742
  }
741
743
  get logSymbols() {
742
- return this.useMarkdown ? markdownLogSymbols : npmPaths.getLogSymbols();
744
+ return this.useMarkdown ? markdownLogSymbols : logger.Logger.LOG_SYMBOLS;
743
745
  }
744
746
  }
745
747
 
@@ -1455,8 +1457,7 @@ const {
1455
1457
  NPM_REGISTRY_URL,
1456
1458
  OVERRIDES,
1457
1459
  PNPM,
1458
- RESOLUTIONS,
1459
- abortSignal
1460
+ RESOLUTIONS
1460
1461
  } = constants;
1461
1462
  const formatter = new ColorOrMarkdown(false);
1462
1463
  function findBestPatchVersion(node, availableVersions, vulnerableVersionRange, _firstPatchedVersionIdentifier) {
@@ -1601,7 +1602,7 @@ async function getPackagesAlerts(arb, options) {
1601
1602
  remaining -= 1;
1602
1603
  if (spinner$1 && remaining > 0) {
1603
1604
  spinner$1.start();
1604
- spinner$1.text = getText();
1605
+ spinner$1.setText(getText());
1605
1606
  }
1606
1607
  };
1607
1608
  spinner$1?.start(getText());
@@ -1764,8 +1765,7 @@ async function reify(...args) {
1764
1765
  default: false
1765
1766
  }, {
1766
1767
  input,
1767
- output,
1768
- signal: abortSignal
1768
+ output
1769
1769
  }))) {
1770
1770
  throw new Error('Socket npm exiting due to risks');
1771
1771
  }
@@ -1867,5 +1867,5 @@ exports.safeReadFile = safeReadFile;
1867
1867
  exports.setupSdk = setupSdk;
1868
1868
  exports.updateNode = updateNode;
1869
1869
  exports.updateSetting = updateSetting;
1870
- //# debugId=521961e1-d301-401b-a39c-61acfe8de687
1870
+ //# debugId=30e57097-6100-437d-9b6d-904604eeaa8d
1871
1871
  //# sourceMappingURL=index.js.map