@socketsecurity/lib 4.1.0 → 4.3.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v4.3.0) - 2025-11-20
9
+
10
+ ### Added
11
+
12
+ - **globs**: New `glob()` and `globSync()` wrapper functions for fast-glob
13
+ - Provides convenient wrappers around fast-glob with normalized options
14
+ - Maintains consistent API with existing glob functionality
15
+ - Export: `@socketsecurity/lib/globs`
16
+
8
17
  ## [4.1.0](https://github.com/SocketDev/socket-lib/releases/tag/v4.1.0) - 2025-11-17
9
18
 
10
19
  ### Added
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Socket Badge](https://socket.dev/api/badge/npm/package/@socketsecurity/lib)](https://socket.dev/npm/package/@socketsecurity/lib)
4
4
  [![CI](https://github.com/SocketDev/socket-lib/actions/workflows/ci.yml/badge.svg)](https://github.com/SocketDev/socket-lib/actions/workflows/ci.yml)
5
- ![Coverage](https://img.shields.io/badge/coverage-83.95%25-brightgreen)
5
+ ![Coverage](https://img.shields.io/badge/coverage-84.12%25-brightgreen)
6
6
 
7
7
  [![Follow @SocketSecurity](https://img.shields.io/twitter/follow/SocketSecurity?style=social)](https://twitter.com/SocketSecurity)
8
8
  [![Follow @socket.dev on Bluesky](https://img.shields.io/badge/Follow-@socket.dev-1DA1F2?style=social&logo=bluesky)](https://bsky.app/profile/socket.dev)
@@ -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);
@@ -5723,7 +5723,11 @@ var require_out4 = __commonJS({
5723
5723
 
5724
5724
  // src/external/fast-glob.js
5725
5725
  var fastGlob = require_out4();
5726
- module.exports = fastGlob.globStream ? { globStream: fastGlob.globStream } : fastGlob;
5726
+ module.exports = fastGlob.globStream ? {
5727
+ glob: fastGlob,
5728
+ globStream: fastGlob.globStream,
5729
+ globSync: fastGlob.sync
5730
+ } : fastGlob;
5727
5731
  /*! Bundled license information:
5728
5732
 
5729
5733
  is-extglob/index.js:
package/dist/globs.d.ts CHANGED
@@ -44,3 +44,15 @@ export declare function getGlobMatcher(glob: Pattern | Pattern[], options?: {
44
44
  nocase?: boolean;
45
45
  ignore?: string[];
46
46
  }): (path: string) => boolean;
47
+ /**
48
+ * Asynchronously find files matching glob patterns.
49
+ * Wrapper around fast-glob.
50
+ */
51
+ /*@__NO_SIDE_EFFECTS__*/
52
+ export declare function glob(patterns: Pattern | Pattern[], options?: FastGlobOptions): Promise<string[]>;
53
+ /**
54
+ * Synchronously find files matching glob patterns.
55
+ * Wrapper around fast-glob.sync.
56
+ */
57
+ /*@__NO_SIDE_EFFECTS__*/
58
+ export declare function globSync(patterns: Pattern | Pattern[], options?: FastGlobOptions): string[];
package/dist/globs.js CHANGED
@@ -31,7 +31,9 @@ var globs_exports = {};
31
31
  __export(globs_exports, {
32
32
  defaultIgnore: () => defaultIgnore,
33
33
  getGlobMatcher: () => getGlobMatcher,
34
- globStreamLicenses: () => globStreamLicenses
34
+ glob: () => glob,
35
+ globStreamLicenses: () => globStreamLicenses,
36
+ globSync: () => globSync
35
37
  });
36
38
  module.exports = __toCommonJS(globs_exports);
37
39
  var fastGlob = __toESM(require("./external/fast-glob.js"));
@@ -107,8 +109,8 @@ function globStreamLicenses(dirname, options) {
107
109
  }
108
110
  const matcherCache = /* @__PURE__ */ new Map();
109
111
  // @__NO_SIDE_EFFECTS__
110
- function getGlobMatcher(glob, options) {
111
- const patterns = Array.isArray(glob) ? glob : [glob];
112
+ function getGlobMatcher(glob2, options) {
113
+ const patterns = Array.isArray(glob2) ? glob2 : [glob2];
112
114
  const key = JSON.stringify({ patterns, options });
113
115
  let matcher = matcherCache.get(key);
114
116
  if (matcher) {
@@ -129,9 +131,19 @@ function getGlobMatcher(glob, options) {
129
131
  matcherCache.set(key, matcher);
130
132
  return matcher;
131
133
  }
134
+ // @__NO_SIDE_EFFECTS__
135
+ function glob(patterns, options) {
136
+ return fastGlob.glob(patterns, options);
137
+ }
138
+ // @__NO_SIDE_EFFECTS__
139
+ function globSync(patterns, options) {
140
+ return fastGlob.globSync(patterns, options);
141
+ }
132
142
  // Annotate the CommonJS export names for ESM import in node:
133
143
  0 && (module.exports = {
134
144
  defaultIgnore,
135
145
  getGlobMatcher,
136
- globStreamLicenses
146
+ glob,
147
+ globStreamLicenses,
148
+ globSync
137
149
  });
@@ -1,2 +1,3 @@
1
+ /* c8 ignore next - External semver call */
1
2
  declare const packageDefaultNodeRange: string;
2
3
  export { packageDefaultNodeRange };
@@ -36,6 +36,7 @@ var yarnPkgExtensions = __toESM(require("./external/@yarnpkg/extensions.js"));
36
36
  const { freeze: ObjectFreeze } = Object;
37
37
  const packageExtensions = ObjectFreeze(
38
38
  [
39
+ /* c8 ignore next - External @yarnpkg/extensions data */
39
40
  ...yarnPkgExtensions.packageExtensions,
40
41
  [
41
42
  "@yarnpkg/extensions@>=1.1.0",
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.3.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",