@socketsecurity/lib 4.1.0 → 4.2.0

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.
@@ -1,7 +1,2 @@
1
- /**
2
- * Process control: abort signals and UI utilities.
3
- */
4
- import type { Spinner } from '../spinner';
5
1
  export declare function getAbortController(): AbortController;
6
2
  export declare function getAbortSignal(): AbortSignal;
7
- export declare function getSpinner(): Spinner | null;
@@ -20,11 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var process_exports = {};
21
21
  __export(process_exports, {
22
22
  getAbortController: () => getAbortController,
23
- getAbortSignal: () => getAbortSignal,
24
- getSpinner: () => getSpinner
23
+ getAbortSignal: () => getAbortSignal
25
24
  });
26
25
  module.exports = __toCommonJS(process_exports);
27
- var import_spinner = require("../spinner");
28
26
  let _abortController;
29
27
  function getAbortController() {
30
28
  if (_abortController === void 0) {
@@ -35,16 +33,8 @@ function getAbortController() {
35
33
  function getAbortSignal() {
36
34
  return getAbortController().signal;
37
35
  }
38
- let _spinner;
39
- function getSpinner() {
40
- if (_spinner === void 0) {
41
- _spinner = (0, import_spinner.Spinner)() ?? null;
42
- }
43
- return _spinner ?? null;
44
- }
45
36
  // Annotate the CommonJS export names for ESM import in node:
46
37
  0 && (module.exports = {
47
38
  getAbortController,
48
- getAbortSignal,
49
- getSpinner
39
+ getAbortSignal
50
40
  });
package/dist/debug.js CHANGED
@@ -43,16 +43,16 @@ __export(debug_exports, {
43
43
  isDebugNs: () => isDebugNs
44
44
  });
45
45
  module.exports = __toCommonJS(debug_exports);
46
- var import_process = require("./constants/process");
47
46
  var import_debug = require("./env/debug");
48
47
  var import_socket = require("./env/socket");
49
48
  var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is-unicode-supported"));
50
49
  var import_debug2 = __toESM(require("./external/debug"));
51
50
  var import_logger = require("./logger");
52
51
  var import_objects = require("./objects");
52
+ var import_spinner = require("./spinner");
53
53
  var import_strings = require("./strings");
54
- const logger = (0, import_logger.getDefaultLogger)();
55
54
  const ReflectApply = Reflect.apply;
55
+ const logger = (0, import_logger.getDefaultLogger)();
56
56
  const debugByNamespace = /* @__PURE__ */ new Map();
57
57
  // @__NO_SIDE_EFFECTS__
58
58
  function getDebugJsInstance(namespace) {
@@ -176,7 +176,7 @@ function debugDirNs(namespacesOrOpts, obj, inspectOpts) {
176
176
  };
177
177
  }
178
178
  }
179
- const spinnerInstance = options.spinner || (0, import_process.getSpinner)();
179
+ const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
180
180
  const wasSpinning = spinnerInstance?.isSpinning;
181
181
  spinnerInstance?.stop();
182
182
  logger.info(`[DEBUG] ${callerName} ${pointingTriangle} object inspection:`);
@@ -205,7 +205,7 @@ function debugNs(namespacesOrOpts, ...args) {
205
205
  ),
206
206
  ...args.slice(1)
207
207
  ] : args;
208
- const spinnerInstance = options.spinner || (0, import_process.getSpinner)();
208
+ const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
209
209
  const wasSpinning = spinnerInstance?.isSpinning;
210
210
  spinnerInstance?.stop();
211
211
  ReflectApply(logger.info, logger, logArgs);
@@ -232,7 +232,7 @@ function debugLogNs(namespacesOrOpts, ...args) {
232
232
  ),
233
233
  ...args.slice(1)
234
234
  ] : [`[DEBUG] ${callerName} ${pointingTriangle}`, ...args];
235
- const spinnerInstance = options.spinner || (0, import_process.getSpinner)();
235
+ const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
236
236
  const wasSpinning = spinnerInstance?.isSpinning;
237
237
  spinnerInstance?.stop();
238
238
  ReflectApply(logger.info, logger, logArgs);
@@ -253,7 +253,7 @@ function debugCacheNs(namespacesOrOpts, operation, key, meta) {
253
253
  }
254
254
  const prefix = `[CACHE] ${callerName} ${pointingTriangle} ${operation}: ${key}`;
255
255
  const logArgs = meta !== void 0 ? [prefix, meta] : [prefix];
256
- const spinnerInstance = options.spinner || (0, import_process.getSpinner)();
256
+ const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
257
257
  const wasSpinning = spinnerInstance?.isSpinning;
258
258
  spinnerInstance?.stop();
259
259
  ReflectApply(logger.info, logger, logArgs);
package/dist/spawn.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { EventEmitter } from 'node:events';
1
2
  // Define BufferEncoding type for TypeScript compatibility.
2
3
  type BufferEncoding = globalThis.BufferEncoding;
3
4
  /**
@@ -31,7 +32,7 @@ export type PromiseSpawnOptions = {
31
32
  * This is a Promise that resolves with process exit information and output,
32
33
  * with additional properties for accessing the running process and stdin stream.
33
34
  *
34
- * @property {ChildProcessType} process - The running child process instance
35
+ * @property {ChildProcess} process - The running child process instance
35
36
  * @property {WritableStreamType | null} stdin - Writable stream for process stdin, or `null` if not piped
36
37
  *
37
38
  * @example
@@ -48,7 +49,7 @@ export type PromiseSpawnResult = Promise<{
48
49
  stdout: string | Buffer;
49
50
  stderr: string | Buffer;
50
51
  }> & {
51
- process: ChildProcessType;
52
+ process: ChildProcess;
52
53
  stdin: WritableStreamType | null;
53
54
  };
54
55
  /**
@@ -218,7 +219,7 @@ interface NodeSpawnOptions {
218
219
  }
219
220
  // Duplicated from Node.js child_process.ChildProcess
220
221
  // This represents a spawned child process
221
- interface ChildProcessType {
222
+ interface ChildProcess extends EventEmitter {
222
223
  stdin: NodeJS.WritableStream | null;
223
224
  stdout: NodeJS.ReadableStream | null;
224
225
  stderr: NodeJS.ReadableStream | null;
package/dist/spawn.js CHANGED
@@ -42,9 +42,10 @@ var import_arrays = require("./arrays");
42
42
  var import_bin = require("./bin");
43
43
  var import_normalize = require("./paths/normalize");
44
44
  var import_objects = require("./objects");
45
+ var import_spinner = require("./spinner");
45
46
  var import_strings = require("./strings");
46
47
  const abortSignal = (0, import_process.getAbortSignal)();
47
- const spinner = (0, import_process.getSpinner)();
48
+ const spinner = (0, import_spinner.getDefaultSpinner)();
48
49
  const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
49
50
  let _child_process;
50
51
  // @__NO_SIDE_EFFECTS__
@@ -48,12 +48,13 @@ var import_input = __toESM(require("../external/@inquirer/input"));
48
48
  var import_password = __toESM(require("../external/@inquirer/password"));
49
49
  var searchModule = __toESM(require("../external/@inquirer/search"));
50
50
  var selectModuleImport = __toESM(require("../external/@inquirer/select"));
51
+ var import_yoctocolors_cjs = __toESM(require("../external/yoctocolors-cjs"));
52
+ var import_spinner = require("../spinner");
51
53
  var import_context = require("../themes/context");
52
54
  var import_themes = require("../themes/themes");
53
55
  var import_utils = require("../themes/utils");
54
- var import_yoctocolors_cjs = __toESM(require("../external/yoctocolors-cjs"));
55
56
  const abortSignal = (0, import_process.getAbortSignal)();
56
- const spinner = (0, import_process.getSpinner)();
57
+ const spinner = (0, import_spinner.getDefaultSpinner)();
57
58
  const searchRaw = searchModule.default;
58
59
  const selectModule = selectModuleImport;
59
60
  const selectRaw = selectModule.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/lib",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "packageManager": "pnpm@10.22.0",
5
5
  "license": "MIT",
6
6
  "description": "Core utilities and infrastructure for Socket.dev security tools",
@@ -690,7 +690,7 @@
690
690
  "@socketregistry/is-unicode-supported": "1.0.5",
691
691
  "@socketregistry/packageurl-js": "1.3.5",
692
692
  "@socketregistry/yocto-spinner": "1.0.25",
693
- "@socketsecurity/lib-stable": "npm:@socketsecurity/lib@4.0.1",
693
+ "@socketsecurity/lib-stable": "npm:@socketsecurity/lib@4.1.0",
694
694
  "@types/node": "24.9.2",
695
695
  "@typescript/native-preview": "7.0.0-dev.20250920.1",
696
696
  "@vitest/coverage-v8": "4.0.3",