@socketsecurity/cli 0.14.26 → 0.14.28

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.
@@ -5,7 +5,7 @@ declare const logSymbols: {
5
5
  warning: string;
6
6
  error: string;
7
7
  };
8
- declare class ChalkOrMarkdown {
8
+ declare class ColorOrMarkdown {
9
9
  useMarkdown: boolean;
10
10
  constructor(useMarkdown: boolean);
11
11
  header(text: string, level?: number): string;
@@ -20,4 +20,4 @@ declare class ChalkOrMarkdown {
20
20
  indent(text: string, level?: number): string;
21
21
  json(value: unknown): string;
22
22
  }
23
- export { logSymbols, ChalkOrMarkdown };
23
+ export { logSymbols, ColorOrMarkdown };
@@ -3,18 +3,18 @@
3
3
  var vendor = require('./vendor.js');
4
4
  var require$$0 = require('node:fs');
5
5
  var require$$1$1 = require('node:path');
6
- var require$$2 = require('node:events');
7
- var require$$4 = require('node:https');
6
+ var require$$1$3 = require('node:events');
7
+ var require$$3$3 = require('node:https');
8
8
  var require$$3 = require('node:readline');
9
9
  var require$$5 = require('node:stream');
10
- var require$$8 = require('node:timers/promises');
10
+ var require$$7$1 = require('node:timers/promises');
11
11
  var require$$5$1 = require('npm-package-arg');
12
+ var require$$3$2 = require('@socketregistry/yocto-spinner');
12
13
  var require$$3$1 = require('semver');
13
14
  var require$$6$1 = require('@socketsecurity/config');
14
15
  var require$$7 = require('@socketsecurity/registry/lib/objects');
15
16
  var require$$1$2 = require('node:net');
16
17
  var require$$1 = require('node:os');
17
- var require$$6 = require('../package.json');
18
18
  var sdk = require('./sdk.js');
19
19
  var pathResolve = require('./path-resolve.js');
20
20
  var link = require('./link.js');
@@ -27,6 +27,208 @@ var arborist = {};
27
27
 
28
28
  var ttyServer$1 = {};
29
29
 
30
+ var name = "@socketsecurity/cli";
31
+ var version = "0.14.28";
32
+ var description = "CLI tool for Socket.dev";
33
+ var homepage = "http://github.com/SocketDev/socket-cli";
34
+ var license = "MIT";
35
+ var repository = {
36
+ type: "git",
37
+ url: "git+https://github.com/SocketDev/socket-cli.git"
38
+ };
39
+ var author = {
40
+ name: "Socket Inc",
41
+ email: "eng@socket.dev",
42
+ url: "https://socket.dev"
43
+ };
44
+ var bin = {
45
+ cli: "dist/cli.js",
46
+ socket: "dist/cli.js",
47
+ "socket-npm": "dist/npm-cli.js",
48
+ "socket-npx": "dist/npx-cli.js"
49
+ };
50
+ var scripts = {
51
+ build: "run-s build:*",
52
+ "build:dist": "rollup -c .config/rollup.dist.config.mjs",
53
+ "build:test": "rollup -c .config/rollup.test.config.mjs",
54
+ check: "run-p -c --aggregate-output check:*",
55
+ "check:lint": "eslint --report-unused-disable-directives .",
56
+ "check:tsc": "tsc",
57
+ "check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'",
58
+ "knip:dependencies": "knip --dependencies",
59
+ "knip:exports": "knip --include exports,duplicates",
60
+ lint: "oxlint -c=./.oxlintrc.json --ignore-path=./.prettierignore --tsconfig=./tsconfig.json .",
61
+ "lint:fix": "npm run lint -- --fix && npm run lint:fix:fast",
62
+ "lint:fix:fast": "prettier --cache --log-level warn --write .",
63
+ prepare: "husky",
64
+ test: "run-s check build:* test:*",
65
+ "test:c8": "c8 --reporter=none node --test 'test/socket-npm.test.cjs'",
66
+ "test-ci": "run-s build:* test:*",
67
+ "test:unit": "tap",
68
+ "test:coverage": "cp -r .tap/coverage/*.json coverage/tmp && c8 --reporter=lcov --reporter=text --include 'dist/*.js' --exclude 'dist/vendor.js' report"
69
+ };
70
+ var dependencies = {
71
+ "@apideck/better-ajv-errors": "^0.3.6",
72
+ "@cyclonedx/cdxgen": "^11.0.3",
73
+ "@inquirer/prompts": "^7.1.0",
74
+ "@npmcli/promise-spawn": "^8.0.2",
75
+ "@socketregistry/hyrious__bun.lockb": "1.0.5",
76
+ "@socketregistry/yocto-spinner": "^1.0.1",
77
+ "@socketsecurity/config": "^2.1.3",
78
+ "@socketsecurity/registry": "^1.0.32",
79
+ "@socketsecurity/sdk": "^1.3.0",
80
+ blessed: "^0.1.81",
81
+ "blessed-contrib": "^4.11.0",
82
+ browserslist: "4.24.2",
83
+ "chalk-table": "^1.0.2",
84
+ "has-flag": "^4.0.0",
85
+ hpagent: "^1.2.0",
86
+ ignore: "^6.0.2",
87
+ micromatch: "^4.0.8",
88
+ "npm-package-arg": "^12.0.0",
89
+ "pony-cause": "^2.1.11",
90
+ semver: "^7.6.3",
91
+ synp: "^1.9.14",
92
+ tinyglobby: "^0.2.10",
93
+ which: "^5.0.0",
94
+ yaml: "^2.6.1",
95
+ "yargs-parser": "^21.1.1",
96
+ "yoctocolors-cjs": "^2.1.2"
97
+ };
98
+ var devDependencies = {
99
+ "@babel/core": "^7.26.0",
100
+ "@babel/plugin-proposal-export-default-from": "^7.25.9",
101
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
102
+ "@babel/plugin-transform-export-namespace-from": "^7.25.9",
103
+ "@babel/plugin-transform-modules-commonjs": "^7.25.9",
104
+ "@babel/plugin-transform-runtime": "^7.25.9",
105
+ "@babel/preset-env": "^7.26.0",
106
+ "@babel/preset-typescript": "^7.26.0",
107
+ "@babel/runtime": "^7.26.0",
108
+ "@eslint/compat": "^1.2.3",
109
+ "@eslint/js": "^9.16.0",
110
+ "@rollup/plugin-commonjs": "^28.0.1",
111
+ "@rollup/plugin-json": "^6.1.0",
112
+ "@rollup/plugin-node-resolve": "^15.3.0",
113
+ "@rollup/plugin-replace": "^6.0.1",
114
+ "@rollup/pluginutils": "^5.1.3",
115
+ "@types/blessed": "^0.1.25",
116
+ "@types/micromatch": "^4.0.9",
117
+ "@types/mocha": "^10.0.10",
118
+ "@types/mock-fs": "^4.13.4",
119
+ "@types/node": "^22.10.1",
120
+ "@types/npmcli__arborist": "^5.6.11",
121
+ "@types/npmcli__promise-spawn": "^6.0.3",
122
+ "@types/proc-log": "^3.0.4",
123
+ "@types/semver": "^7.5.8",
124
+ "@types/update-notifier": "^6.0.8",
125
+ "@types/which": "^3.0.4",
126
+ "@types/yargs-parser": "^21.0.3",
127
+ "@typescript-eslint/eslint-plugin": "^8.17.0",
128
+ "@typescript-eslint/parser": "^8.17.0",
129
+ c8: "^10.1.2",
130
+ eslint: "^9.16.0",
131
+ "eslint-import-resolver-oxc": "^0.5.0",
132
+ "eslint-plugin-depend": "^0.12.0",
133
+ "eslint-plugin-import-x": "^4.4.3",
134
+ "eslint-plugin-n": "^17.14.0",
135
+ "eslint-plugin-sort-destructure-keys": "^2.0.0",
136
+ "eslint-plugin-unicorn": "^56.0.1",
137
+ husky: "^9.1.7",
138
+ "is-interactive": "^2.0.0",
139
+ "is-unicode-supported": "^2.1.0",
140
+ knip: "^5.39.0",
141
+ "magic-string": "^0.30.14",
142
+ meow: "^13.2.0",
143
+ "mock-fs": "^5.4.1",
144
+ nock: "^13.5.6",
145
+ "npm-run-all2": "^7.0.1",
146
+ open: "^10.1.0",
147
+ oxlint: "0.14.0",
148
+ prettier: "3.4.1",
149
+ "read-package-up": "^11.0.0",
150
+ rollup: "4.28.0",
151
+ "rollup-plugin-ts": "^3.4.5",
152
+ tap: "^21.0.1",
153
+ "terminal-link": "^3.0.0",
154
+ "tiny-updater": "^3.5.2",
155
+ "type-coverage": "^2.29.7",
156
+ typescript: "5.4.5",
157
+ "typescript-eslint": "^8.17.0",
158
+ "unplugin-purge-polyfills": "^0.0.7"
159
+ };
160
+ var overrides = {
161
+ "aggregate-error": "npm:@socketregistry/aggregate-error@^1",
162
+ "es-define-property": "npm:@socketregistry/es-define-property@^1",
163
+ "function-bind": "npm:@socketregistry/function-bind@^1",
164
+ globalthis: "npm:@socketregistry/globalthis@^1",
165
+ gopd: "npm:@socketregistry/gopd@^1",
166
+ "has-property-descriptors": "npm:@socketregistry/has-property-descriptors@^1",
167
+ "has-proto": "npm:@socketregistry/has-proto@^1",
168
+ "has-symbols": "npm:@socketregistry/has-symbols@^1",
169
+ hasown: "npm:@socketregistry/hasown@^1",
170
+ "indent-string": "npm:@socketregistry/indent-string@^1",
171
+ "is-core-module": "npm:@socketregistry/is-core-module@^1",
172
+ isarray: "npm:@socketregistry/isarray@^1",
173
+ "npm-package-arg": "$npm-package-arg",
174
+ "packageurl-js": "npm:@socketregistry/packageurl-js@^1",
175
+ "path-parse": "npm:@socketregistry/path-parse@^1",
176
+ "safe-buffer": "npm:@socketregistry/safe-buffer@^1",
177
+ "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
178
+ semver: "$semver",
179
+ "set-function-length": "npm:@socketregistry/set-function-length@^1",
180
+ "side-channel": "npm:@socketregistry/side-channel@^1",
181
+ yaml: "$yaml"
182
+ };
183
+ var resolutions = {
184
+ "aggregate-error": "npm:@socketregistry/aggregate-error@^1",
185
+ "es-define-property": "npm:@socketregistry/es-define-property@^1",
186
+ "function-bind": "npm:@socketregistry/function-bind@^1",
187
+ globalthis: "npm:@socketregistry/globalthis@^1",
188
+ gopd: "npm:@socketregistry/gopd@^1",
189
+ "has-property-descriptors": "npm:@socketregistry/has-property-descriptors@^1",
190
+ "has-proto": "npm:@socketregistry/has-proto@^1",
191
+ "has-symbols": "npm:@socketregistry/has-symbols@^1",
192
+ hasown: "npm:@socketregistry/hasown@^1",
193
+ "indent-string": "npm:@socketregistry/indent-string@^1",
194
+ "is-core-module": "npm:@socketregistry/is-core-module@^1",
195
+ isarray: "npm:@socketregistry/isarray@^1",
196
+ "npm-package-arg": "^12.0.0",
197
+ "packageurl-js": "npm:@socketregistry/packageurl-js@^1",
198
+ "path-parse": "npm:@socketregistry/path-parse@^1",
199
+ "safe-buffer": "npm:@socketregistry/safe-buffer@^1",
200
+ "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
201
+ semver: "^7.6.3",
202
+ "set-function-length": "npm:@socketregistry/set-function-length@^1",
203
+ "side-channel": "npm:@socketregistry/side-channel@^1",
204
+ yaml: "^2.6.0"
205
+ };
206
+ var engines = {
207
+ node: "^18.20.4 || ^20.9.0 || >=22.0.0"
208
+ };
209
+ var files = [
210
+ "bin/**",
211
+ "dist/**",
212
+ "translations.json"
213
+ ];
214
+ var require$$6 = {
215
+ name: name,
216
+ version: version,
217
+ description: description,
218
+ homepage: homepage,
219
+ license: license,
220
+ repository: repository,
221
+ author: author,
222
+ bin: bin,
223
+ scripts: scripts,
224
+ dependencies: dependencies,
225
+ devDependencies: devDependencies,
226
+ overrides: overrides,
227
+ resolutions: resolutions,
228
+ engines: engines,
229
+ files: files
230
+ };
231
+
30
232
  Object.defineProperty(ttyServer$1, "__esModule", {
31
233
  value: true
32
234
  });
@@ -64,12 +266,11 @@ function createNonStandardTTYServer() {
64
266
  conn.push(lineBuff.slice(eolIndex + 1));
65
267
  const {
66
268
  capabilities: {
67
- colorLevel: ipcColorLevel,
68
269
  input: hasInput,
69
270
  output: hasOutput
70
271
  },
71
272
  ipc_version: remote_ipc_version
72
- } = JSON.parse(lineBuff.slice(0, eolIndex).toString('utf-8'));
273
+ } = JSON.parse(lineBuff.subarray(0, eolIndex).toString('utf-8'));
73
274
  lineBuff = null;
74
275
  captured = true;
75
276
  if (remote_ipc_version !== _package.version) {
@@ -91,7 +292,7 @@ function createNonStandardTTYServer() {
91
292
  _nodeReadline$1.clearLine(this, dir, callback);
92
293
  };
93
294
  }
94
- mutexFn(ipcColorLevel, hasInput ? input : undefined, hasOutput ? output : undefined).then(resolve, reject).finally(() => {
295
+ mutexFn(hasInput ? input : undefined, hasOutput ? output : undefined).then(resolve, reject).finally(() => {
95
296
  conn.unref();
96
297
  conn.end();
97
298
  input?.end();
@@ -107,7 +308,7 @@ function createNonStandardTTYServer() {
107
308
  }
108
309
  };
109
310
  }
110
- function createIPCServer(colorLevel, captureState, npmlog) {
311
+ function createIPCServer(captureState, npmlog) {
111
312
  const input = process.stdin;
112
313
  const output = process.stderr;
113
314
  return new Promise((resolve, reject) => {
@@ -134,8 +335,7 @@ function createIPCServer(colorLevel, captureState, npmlog) {
134
335
  ipc_version: _package.version,
135
336
  capabilities: {
136
337
  input: Boolean(input),
137
- output: true,
138
- colorLevel
338
+ output: true
139
339
  }
140
340
  })}\n`);
141
341
  conn.on('data', data => {
@@ -163,7 +363,7 @@ function createIPCServer(colorLevel, captureState, npmlog) {
163
363
  resolve(server);
164
364
  });
165
365
  }
166
- function createStandardTTYServer(colorLevel, isInteractive, npmlog) {
366
+ function createStandardTTYServer(isInteractive, npmlog) {
167
367
  const captureState = {
168
368
  captured: false,
169
369
  nextCapture: () => {
@@ -181,7 +381,7 @@ function createStandardTTYServer(colorLevel, isInteractive, npmlog) {
181
381
  const output = process.stderr;
182
382
  let ipcServerPromise;
183
383
  if (input) {
184
- ipcServerPromise = createIPCServer(colorLevel, captureState, npmlog);
384
+ ipcServerPromise = createIPCServer(captureState, npmlog);
185
385
  }
186
386
  return {
187
387
  async captureTTY(mutexFn) {
@@ -204,7 +404,7 @@ function createStandardTTYServer(colorLevel, isInteractive, npmlog) {
204
404
  if (wasProgressEnabled) {
205
405
  npmlog.disableProgress();
206
406
  }
207
- return await mutexFn(colorLevel, input, output);
407
+ return await mutexFn(input, output);
208
408
  } finally {
209
409
  if (wasProgressEnabled) {
210
410
  npmlog.enableProgress();
@@ -224,8 +424,8 @@ function tryUnlinkSync(filepath) {
224
424
  }
225
425
  }
226
426
  }
227
- function createTTYServer(colorLevel, isInteractive, npmlog) {
228
- return !isInteractive && TTY_IPC ? createNonStandardTTYServer() : createStandardTTYServer(colorLevel, isInteractive, npmlog);
427
+ function createTTYServer(isInteractive, npmlog) {
428
+ return !isInteractive && TTY_IPC ? createNonStandardTTYServer() : createStandardTTYServer(isInteractive, npmlog);
229
429
  }
230
430
 
231
431
  var issueRules = {};
@@ -376,30 +576,28 @@ function createIssueUXLookup(settings) {
376
576
  };
377
577
  }
378
578
 
379
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
380
579
  var _interopRequireDefault = vendor.interopRequireDefault.default;
381
580
  Object.defineProperty(arborist, "__esModule", {
382
581
  value: true
383
582
  });
384
583
  arborist.SafeArborist = void 0;
385
584
  arborist.installSafeArborist = installSafeArborist;
386
- var _nodeEvents = require$$2;
585
+ var _nodeEvents = require$$1$3;
387
586
  var _nodeFs$1 = require$$0;
388
- var _nodeHttps = require$$4;
587
+ var _nodeHttps = require$$3$3;
389
588
  var _nodePath$1 = require$$1$1;
390
589
  var _nodeReadline = require$$3;
391
590
  var _nodeStream = require$$5;
392
- var _promises = require$$8;
393
- var _chalk = _interopRequireDefault(vendor.source);
591
+ var _promises = require$$7$1;
394
592
  var _isInteractive = _interopRequireDefault(vendor.isInteractive);
395
593
  var _npmPackageArg = require$$5$1;
396
- var _ora = _interopRequireWildcard(vendor.ora);
594
+ var _yoctoSpinner = require$$3$2;
397
595
  var _semver = require$$3$1;
398
596
  var _config = require$$6$1;
399
597
  var _objects = require$$7;
400
598
  var _ttyServer = ttyServer$1;
401
599
  var _constants = sdk.constants;
402
- var _chalkMarkdown = sdk.chalkMarkdown;
600
+ var _colorOrMarkdown = sdk.colorOrMarkdown;
403
601
  var _issueRules = issueRules;
404
602
  var _misc = sdk.misc;
405
603
  var _pathResolve = pathResolve.pathResolve;
@@ -440,11 +638,12 @@ if (npmRootPath === undefined) {
440
638
  const LOOP_SENTINEL = 1_000_000;
441
639
  const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
442
640
  const npmNmPath = _nodePath$1.join(npmRootPath, 'node_modules');
443
- const arboristClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/arborist/index.js');
444
- const arboristDepValidPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/dep-valid.js');
445
- const arboristEdgeClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/edge.js');
446
- const arboristNodeClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/node.js');
447
- const arboristOverrideSetClassPatch = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/override-set.js');
641
+ const arboristPkgPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist');
642
+ const arboristClassPath = _nodePath$1.join(arboristPkgPath, 'lib/arborist/index.js');
643
+ const arboristDepValidPath = _nodePath$1.join(arboristPkgPath, 'lib/dep-valid.js');
644
+ const arboristEdgeClassPath = _nodePath$1.join(arboristPkgPath, 'lib/edge.js');
645
+ const arboristNodeClassPath = _nodePath$1.join(arboristPkgPath, 'lib/node.js');
646
+ const arboristOverrideSetClassPatch = _nodePath$1.join(arboristPkgPath, 'lib/override-set.js');
448
647
  const log = tryRequire([_nodePath$1.join(npmNmPath, 'proc-log/lib/index.js'),
449
648
  // The proc-log DefinitelyTyped definition is incorrect. The type definition
450
649
  // is really that of its export log.
@@ -469,9 +668,9 @@ const Node = require(arboristNodeClassPath);
469
668
  const OverrideSet = require(arboristOverrideSetClassPatch);
470
669
  const kCtorArgs = Symbol('ctorArgs');
471
670
  const kRiskyReify = Symbol('riskyReify');
472
- const formatter = new _chalkMarkdown.ChalkOrMarkdown(false);
671
+ const formatter = new _colorOrMarkdown.ColorOrMarkdown(false);
473
672
  const pubToken = (0, _sdk.getDefaultKey)() ?? _sdk.FREE_API_KEY;
474
- const ttyServer = (0, _ttyServer.createTTYServer)(_chalk.default.level, (0, _isInteractive.default)({
673
+ const ttyServer = (0, _ttyServer.createTTYServer)((0, _isInteractive.default)({
475
674
  stream: process.stdin
476
675
  }), log);
477
676
  let _uxLookup;
@@ -523,6 +722,9 @@ async function* batchScan(pkgIds) {
523
722
  // Patch adding doOverrideSetsConflict is based on
524
723
  // https://github.com/npm/cli/pull/7025.
525
724
  function doOverrideSetsConflict(first, second) {
725
+ // If override sets contain one another then we can try to use the more specific
726
+ // one. However, if neither one is more specific, then we consider them to be
727
+ // in conflict.
526
728
  return findSpecificOverrideSet(first, second) === undefined;
527
729
  }
528
730
  function findSocketYmlSync() {
@@ -568,6 +770,7 @@ function findSpecificOverrideSet(first, second) {
568
770
  }
569
771
  overrideSet = overrideSet.parent;
570
772
  }
773
+ // The override sets are incomparable. Neither one contains the other.
571
774
  log.silly('Conflicting override sets', first, second);
572
775
  return undefined;
573
776
  }
@@ -581,18 +784,12 @@ async function packagesHaveRiskyIssues(safeArb, _registry, pkgs, output) {
581
784
  let result = false;
582
785
  let remaining = pkgs.length;
583
786
  if (!remaining) {
584
- (0, _ora.default)('').succeed('No changes detected');
787
+ _yoctoSpinner().success('No changes detected');
585
788
  return result;
586
789
  }
587
790
  const getText = () => `Looking up data for ${remaining} packages`;
588
- const spinner = (0, _ora.default)({
589
- color: 'cyan',
590
- stream: output,
591
- isEnabled: true,
592
- isSilent: false,
593
- hideCursor: true,
594
- discardStdin: true,
595
- spinner: _ora.spinners.dots
791
+ const spinner = _yoctoSpinner({
792
+ stream: output
596
793
  }).start(getText());
597
794
  try {
598
795
  for await (const pkgData of batchScan(pkgs.map(pkg => pkg.pkgid))) {
@@ -1436,8 +1633,7 @@ class SafeArborist extends Arborist {
1436
1633
  }
1437
1634
  let proceed = _constants.ENV.UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE;
1438
1635
  if (!proceed) {
1439
- proceed = await ttyServer.captureTTY(async (colorLevel, input, output) => {
1440
- _chalk.default.level = colorLevel;
1636
+ proceed = await ttyServer.captureTTY(async (input, output) => {
1441
1637
  if (input && output) {
1442
1638
  const risky = await packagesHaveRiskyIssues(this, this['registry'], diff, output);
1443
1639
  if (!risky) {
@@ -1483,10 +1679,19 @@ class SafeArborist extends Arborist {
1483
1679
  }
1484
1680
  arborist.SafeArborist = SafeArborist;
1485
1681
  function installSafeArborist() {
1486
- require.cache[arboristClassPath].exports = SafeArborist;
1487
- require.cache[arboristEdgeClassPath].exports = SafeEdge;
1488
- require.cache[arboristNodeClassPath].exports = SafeNode;
1489
- require.cache[arboristOverrideSetClassPatch].exports = SafeOverrideSet;
1682
+ const cache = require.cache;
1683
+ cache[arboristClassPath] = {
1684
+ exports: SafeArborist
1685
+ };
1686
+ cache[arboristEdgeClassPath] = {
1687
+ exports: SafeEdge
1688
+ };
1689
+ cache[arboristNodeClassPath] = {
1690
+ exports: SafeNode
1691
+ };
1692
+ cache[arboristOverrideSetClassPatch] = {
1693
+ exports: SafeOverrideSet
1694
+ };
1490
1695
  }
1491
1696
  void (async () => {
1492
1697
  const remoteSettings = await (async () => {
package/dist/sdk.js CHANGED
@@ -2,13 +2,15 @@
2
2
 
3
3
  var require$$0 = require('@socketsecurity/registry/lib/env');
4
4
  var vendor = require('./vendor.js');
5
- var require$$1$2 = require('node:fs/promises');
6
- var require$$1$1 = require('node:path');
7
- var require$$1$3 = require('@inquirer/prompts');
5
+ var require$$1 = require('yoctocolors-cjs');
6
+ var require$$1$3 = require('node:fs/promises');
7
+ var require$$1$2 = require('node:path');
8
+ var require$$1$4 = require('@inquirer/prompts');
8
9
  var require$$4 = require('hpagent');
9
10
  var require$$6 = require('@socketsecurity/sdk');
10
11
  var require$$0$1 = require('node:fs');
11
- var require$$1 = require('node:os');
12
+ var require$$1$1 = require('node:os');
13
+ var require$$3 = require('@socketregistry/yocto-spinner');
12
14
 
13
15
  var errors = {};
14
16
 
@@ -39,36 +41,36 @@ constants.ENV = Object.freeze({
39
41
  UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: (0, _env.envAsBoolean)(process.env['UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE'])
40
42
  });
41
43
 
42
- var chalkMarkdown = {};
44
+ var colorOrMarkdown = {};
43
45
 
44
- var _interopRequireDefault$2 = vendor.interopRequireDefault.default;
45
- Object.defineProperty(chalkMarkdown, "__esModule", {
46
+ var _interopRequireDefault$1 = vendor.interopRequireDefault.default;
47
+ Object.defineProperty(colorOrMarkdown, "__esModule", {
46
48
  value: true
47
49
  });
48
- chalkMarkdown.logSymbols = chalkMarkdown.ChalkOrMarkdown = void 0;
49
- var _chalk = _interopRequireDefault$2(vendor.source);
50
- var _isUnicodeSupported = _interopRequireDefault$2(vendor.isUnicodeSupported);
51
- var _terminalLink = _interopRequireDefault$2(vendor.terminalLink);
50
+ colorOrMarkdown.logSymbols = colorOrMarkdown.ColorOrMarkdown = void 0;
51
+ var _yoctocolorsCjs = require$$1;
52
+ var _isUnicodeSupported = _interopRequireDefault$1(vendor.isUnicodeSupported);
53
+ var _terminalLink = _interopRequireDefault$1(vendor.terminalLink);
52
54
  // From the 'log-symbols' module
53
55
  const unicodeLogSymbols = {
54
56
  __proto__: null,
55
- info: _chalk.default.blue('ℹ'),
56
- success: _chalk.default.green('✔'),
57
- warning: _chalk.default.yellow('⚠'),
58
- error: _chalk.default.red('✖')
57
+ info: _yoctocolorsCjs.blue('ℹ'),
58
+ success: _yoctocolorsCjs.green('✔'),
59
+ warning: _yoctocolorsCjs.yellow('⚠'),
60
+ error: _yoctocolorsCjs.red('✖')
59
61
  };
60
62
 
61
63
  // From the 'log-symbols' module
62
64
  const fallbackLogSymbols = {
63
65
  __proto__: null,
64
- info: _chalk.default.blue('i'),
65
- success: _chalk.default.green('√'),
66
- warning: _chalk.default.yellow('‼'),
67
- error: _chalk.default.red('×')
66
+ info: _yoctocolorsCjs.blue('i'),
67
+ success: _yoctocolorsCjs.green('√'),
68
+ warning: _yoctocolorsCjs.yellow('‼'),
69
+ error: _yoctocolorsCjs.red('×')
68
70
  };
69
71
 
70
72
  // From the 'log-symbols' module
71
- const logSymbols = chalkMarkdown.logSymbols = (0, _isUnicodeSupported.default)() ? unicodeLogSymbols : fallbackLogSymbols;
73
+ const logSymbols = colorOrMarkdown.logSymbols = (0, _isUnicodeSupported.default)() ? unicodeLogSymbols : fallbackLogSymbols;
72
74
  const markdownLogSymbols = {
73
75
  __proto__: null,
74
76
  info: ':information_source:',
@@ -76,18 +78,18 @@ const markdownLogSymbols = {
76
78
  success: ':white_check_mark:',
77
79
  warning: ':warning:'
78
80
  };
79
- class ChalkOrMarkdown {
81
+ class ColorOrMarkdown {
80
82
  constructor(useMarkdown) {
81
83
  this.useMarkdown = !!useMarkdown;
82
84
  }
83
85
  header(text, level = 1) {
84
- return this.useMarkdown ? `\n${''.padStart(level, '#')} ${text}\n` : _chalk.default.underline(`\n${level === 1 ? _chalk.default.bold(text) : text}\n`);
86
+ return this.useMarkdown ? `\n${''.padStart(level, '#')} ${text}\n` : _yoctocolorsCjs.underline(`\n${level === 1 ? _yoctocolorsCjs.bold(text) : text}\n`);
85
87
  }
86
88
  bold(text) {
87
- return this.useMarkdown ? `**${text}**` : _chalk.default.bold(`${text}`);
89
+ return this.useMarkdown ? `**${text}**` : _yoctocolorsCjs.bold(`${text}`);
88
90
  }
89
91
  italic(text) {
90
- return this.useMarkdown ? `_${text}_` : _chalk.default.italic(`${text}`);
92
+ return this.useMarkdown ? `_${text}_` : _yoctocolorsCjs.italic(`${text}`);
91
93
  }
92
94
  hyperlink(text, url, {
93
95
  fallback = true,
@@ -113,7 +115,7 @@ class ChalkOrMarkdown {
113
115
  return this.useMarkdown ? '```json\n' + JSON.stringify(value) + '\n```' : JSON.stringify(value);
114
116
  }
115
117
  }
116
- chalkMarkdown.ChalkOrMarkdown = ChalkOrMarkdown;
118
+ colorOrMarkdown.ColorOrMarkdown = ColorOrMarkdown;
117
119
 
118
120
  var misc = {};
119
121
 
@@ -123,9 +125,9 @@ Object.defineProperty(misc, "__esModule", {
123
125
  misc.createDebugLogger = createDebugLogger;
124
126
  misc.isErrnoException = isErrnoException;
125
127
  misc.stringJoinWithSeparateFinalSeparator = stringJoinWithSeparateFinalSeparator;
126
- var _chalkMarkdown = chalkMarkdown;
128
+ var _colorOrMarkdown = colorOrMarkdown;
127
129
  function createDebugLogger(printDebugLogs) {
128
- return printDebugLogs ? (...params) => console.error(_chalkMarkdown.logSymbols.info, ...params) : () => {};
130
+ return printDebugLogs ? (...params) => console.error(_colorOrMarkdown.logSymbols.info, ...params) : () => {};
129
131
  }
130
132
  function isErrnoException(value) {
131
133
  if (!(value instanceof Error)) {
@@ -146,16 +148,15 @@ var sdk = {};
146
148
 
147
149
  var settings$1 = {};
148
150
 
149
- var _interopRequireDefault$1 = vendor.interopRequireDefault.default;
150
151
  Object.defineProperty(settings$1, "__esModule", {
151
152
  value: true
152
153
  });
153
154
  settings$1.getSetting = getSetting;
154
155
  settings$1.updateSetting = updateSetting;
155
156
  var _nodeFs = require$$0$1;
156
- var _nodeOs = require$$1;
157
- var _nodePath$1 = require$$1$1;
158
- var _ora = _interopRequireDefault$1(vendor.ora);
157
+ var _nodeOs = require$$1$1;
158
+ var _nodePath$1 = require$$1$2;
159
+ var _yoctoSpinner = require$$3;
159
160
  let dataHome = process.platform === 'win32' ? process.env['LOCALAPPDATA'] : process.env['XDG_DATA_HOME'];
160
161
  if (!dataHome) {
161
162
  if (process.platform === 'win32') throw new Error('missing %LOCALAPPDATA%');
@@ -169,7 +170,7 @@ if ((0, _nodeFs.existsSync)(settingsPath)) {
169
170
  try {
170
171
  settings = JSON.parse(Buffer.from(raw, 'base64').toString());
171
172
  } catch {
172
- (0, _ora.default)(`Failed to parse settings at ${settingsPath}`).warn();
173
+ _yoctoSpinner().warning(`Failed to parse settings at ${settingsPath}`);
173
174
  }
174
175
  } else {
175
176
  (0, _nodeFs.mkdirSync)(_nodePath$1.dirname(settingsPath), {
@@ -198,9 +199,9 @@ Object.defineProperty(sdk, "__esModule", {
198
199
  sdk.FREE_API_KEY = void 0;
199
200
  sdk.getDefaultKey = getDefaultKey;
200
201
  sdk.setupSdk = setupSdk;
201
- var _promises = require$$1$2;
202
- var _nodePath = require$$1$1;
203
- var _prompts = require$$1$3;
202
+ var _promises = require$$1$3;
203
+ var _nodePath = require$$1$2;
204
+ var _prompts = require$$1$4;
204
205
  var _hpagent = require$$4;
205
206
  var _isInteractive = _interopRequireDefault(vendor.isInteractive);
206
207
  var _sdk = require$$6;
@@ -261,7 +262,7 @@ async function setupSdk(apiKey = getDefaultKey(), apiBaseUrl = getDefaultAPIBase
261
262
  return new _sdk.SocketSdk(apiKey || '', sdkOptions);
262
263
  }
263
264
 
264
- exports.chalkMarkdown = chalkMarkdown;
265
+ exports.colorOrMarkdown = colorOrMarkdown;
265
266
  exports.constants = constants;
266
267
  exports.errors = errors;
267
268
  exports.misc = misc;