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