@socketsecurity/lib 5.2.1 → 5.4.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/bin.d.ts +0 -9
  3. package/dist/bin.js +70 -48
  4. package/dist/constants/agents.js +2 -2
  5. package/dist/constants/platform.d.ts +21 -0
  6. package/dist/constants/platform.js +30 -6
  7. package/dist/cover/code.js +13 -5
  8. package/dist/debug.js +1 -1
  9. package/dist/dlx/binary.d.ts +1 -1
  10. package/dist/dlx/binary.js +49 -39
  11. package/dist/dlx/cache.js +10 -2
  12. package/dist/dlx/dir.js +1 -1
  13. package/dist/dlx/manifest.d.ts +2 -1
  14. package/dist/dlx/manifest.js +45 -41
  15. package/dist/dlx/package.js +39 -19
  16. package/dist/dlx/packages.js +1 -1
  17. package/dist/dlx/paths.js +1 -1
  18. package/dist/env/rewire.js +10 -2
  19. package/dist/external/@inquirer/checkbox.js +4 -2528
  20. package/dist/external/@inquirer/confirm.js +4 -2371
  21. package/dist/external/@inquirer/input.js +4 -2395
  22. package/dist/external/@inquirer/password.js +4 -2503
  23. package/dist/external/@inquirer/search.js +4 -2500
  24. package/dist/external/@inquirer/select.js +4 -2617
  25. package/dist/external/del.js +4 -7139
  26. package/dist/external/fast-glob.js +4 -5776
  27. package/dist/external/inquirer-pack.js +4610 -0
  28. package/dist/external/npm-core.js +3 -1
  29. package/dist/external/pico-pack.js +7162 -0
  30. package/dist/external/picomatch.js +4 -1523
  31. package/dist/external/spdx-correct.js +4 -1384
  32. package/dist/external/spdx-expression-parse.js +4 -1047
  33. package/dist/external/spdx-pack.js +1640 -0
  34. package/dist/external/validate-npm-package-name.js +4 -104
  35. package/dist/fs.js +3 -3
  36. package/dist/git.js +41 -38
  37. package/dist/http-request.js +12 -4
  38. package/dist/ipc.js +53 -29
  39. package/dist/json/edit.js +1 -1
  40. package/dist/json/format.js +1 -1
  41. package/dist/logger.js +1 -1
  42. package/dist/packages/edit.js +3 -3
  43. package/dist/packages/isolation.js +45 -23
  44. package/dist/packages/licenses.js +10 -2
  45. package/dist/paths/normalize.js +3 -3
  46. package/dist/paths/packages.js +1 -1
  47. package/dist/paths/socket.d.ts +2 -2
  48. package/dist/paths/socket.js +27 -21
  49. package/dist/process-lock.js +23 -14
  50. package/dist/promises.js +1 -1
  51. package/dist/releases/github.d.ts +82 -137
  52. package/dist/releases/github.js +91 -48
  53. package/dist/releases/socket-btm.d.ts +78 -192
  54. package/dist/releases/socket-btm.js +112 -50
  55. package/dist/signal-exit.js +1 -1
  56. package/dist/spawn.js +11 -4
  57. package/dist/stdio/mask.d.ts +6 -21
  58. package/dist/stdio/mask.js +18 -14
  59. package/dist/themes/context.js +10 -2
  60. package/package.json +3 -2
@@ -1,105 +1,5 @@
1
- "use strict";
2
- /**
3
- * Bundled from validate-npm-package-name
4
- * This is a zero-dependency bundle created by esbuild.
5
- */
6
- "use strict";
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __commonJS = (cb, mod) => function __require() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
1
+ 'use strict'
13
2
 
14
- // node_modules/.pnpm/validate-npm-package-name@6.0.2/node_modules/validate-npm-package-name/lib/index.js
15
- var require_lib = __commonJS({
16
- "node_modules/.pnpm/validate-npm-package-name@6.0.2/node_modules/validate-npm-package-name/lib/index.js"(exports2, module2) {
17
- "use strict";
18
- var { builtinModules: builtins } = require("module");
19
- var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
20
- var exclusionList = [
21
- "node_modules",
22
- "favicon.ico"
23
- ];
24
- function validate(name) {
25
- var warnings = [];
26
- var errors = [];
27
- if (name === null) {
28
- errors.push("name cannot be null");
29
- return done(warnings, errors);
30
- }
31
- if (name === void 0) {
32
- errors.push("name cannot be undefined");
33
- return done(warnings, errors);
34
- }
35
- if (typeof name !== "string") {
36
- errors.push("name must be a string");
37
- return done(warnings, errors);
38
- }
39
- if (!name.length) {
40
- errors.push("name length must be greater than zero");
41
- }
42
- if (name.startsWith(".")) {
43
- errors.push("name cannot start with a period");
44
- }
45
- if (name.match(/^_/)) {
46
- errors.push("name cannot start with an underscore");
47
- }
48
- if (name.trim() !== name) {
49
- errors.push("name cannot contain leading or trailing spaces");
50
- }
51
- exclusionList.forEach(function(excludedName) {
52
- if (name.toLowerCase() === excludedName) {
53
- errors.push(excludedName + " is not a valid package name");
54
- }
55
- });
56
- if (builtins.includes(name.toLowerCase())) {
57
- warnings.push(name + " is a core module name");
58
- }
59
- if (name.length > 214) {
60
- warnings.push("name can no longer contain more than 214 characters");
61
- }
62
- if (name.toLowerCase() !== name) {
63
- warnings.push("name can no longer contain capital letters");
64
- }
65
- if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) {
66
- warnings.push(`name can no longer contain special characters ("~'!()*")`);
67
- }
68
- if (encodeURIComponent(name) !== name) {
69
- var nameMatch = name.match(scopedPackagePattern);
70
- if (nameMatch) {
71
- var user = nameMatch[1];
72
- var pkg = nameMatch[2];
73
- if (pkg.startsWith(".")) {
74
- errors.push("name cannot start with a period");
75
- }
76
- if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) {
77
- return done(warnings, errors);
78
- }
79
- }
80
- errors.push("name can only contain URL-friendly characters");
81
- }
82
- return done(warnings, errors);
83
- }
84
- __name(validate, "validate");
85
- var done = /* @__PURE__ */ __name(function(warnings, errors) {
86
- var result = {
87
- validForNewPackages: errors.length === 0 && warnings.length === 0,
88
- validForOldPackages: errors.length === 0,
89
- warnings,
90
- errors
91
- };
92
- if (!result.warnings.length) {
93
- delete result.warnings;
94
- }
95
- if (!result.errors.length) {
96
- delete result.errors;
97
- }
98
- return result;
99
- }, "done");
100
- module2.exports = validate;
101
- }
102
- });
103
-
104
- // src/external/validate-npm-package-name.js
105
- module.exports = require_lib();
3
+ // Re-export from npm-core bundle for better deduplication.
4
+ const { validateNpmPackageName } = require('./npm-core')
5
+ module.exports = validateNpmPackageName
package/dist/fs.js CHANGED
@@ -84,7 +84,7 @@ let _buffer;
84
84
  // @__NO_SIDE_EFFECTS__
85
85
  function getBuffer() {
86
86
  if (_buffer === void 0) {
87
- _buffer = require("node:buffer");
87
+ _buffer = require("buffer");
88
88
  }
89
89
  return _buffer;
90
90
  }
@@ -92,7 +92,7 @@ let _fs;
92
92
  // @__NO_SIDE_EFFECTS__
93
93
  function getFs() {
94
94
  if (_fs === void 0) {
95
- _fs = require("node:fs");
95
+ _fs = require("fs");
96
96
  }
97
97
  return _fs;
98
98
  }
@@ -100,7 +100,7 @@ let _path;
100
100
  // @__NO_SIDE_EFFECTS__
101
101
  function getPath() {
102
102
  if (_path === void 0) {
103
- _path = require("node:path");
103
+ _path = require("path");
104
104
  }
105
105
  return _path;
106
106
  }
package/dist/git.js CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
- var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
7
  var __export = (target, all) => {
10
8
  for (var name in all)
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
18
16
  }
19
17
  return to;
20
18
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
20
  var git_exports = {};
31
21
  __export(git_exports, {
@@ -44,18 +34,16 @@ __export(git_exports, {
44
34
  isUnstagedSync: () => isUnstagedSync
45
35
  });
46
36
  module.exports = __toCommonJS(git_exports);
47
- var import_path = __toESM(require("path"));
48
37
  var import_debug = require("./debug");
49
38
  var import_globs = require("./globs");
50
39
  var import_normalize = require("./paths/normalize");
51
40
  var import_spawn = require("./spawn");
52
41
  var import_strings = require("./strings");
53
- const gitDiffCache = /* @__PURE__ */ new Map();
54
42
  let _fs;
55
43
  // @__NO_SIDE_EFFECTS__
56
44
  function getFs() {
57
45
  if (_fs === void 0) {
58
- _fs = require("node:fs");
46
+ _fs = require("fs");
59
47
  }
60
48
  return _fs;
61
49
  }
@@ -63,10 +51,11 @@ let _path;
63
51
  // @__NO_SIDE_EFFECTS__
64
52
  function getPath() {
65
53
  if (_path === void 0) {
66
- _path = require("node:path");
54
+ _path = require("path");
67
55
  }
68
56
  return _path;
69
57
  }
58
+ const gitDiffCache = /* @__PURE__ */ new Map();
70
59
  function getGitPath() {
71
60
  return "git";
72
61
  }
@@ -161,17 +150,17 @@ function innerDiffSync(args, options) {
161
150
  }
162
151
  function findGitRoot(startPath) {
163
152
  const fs = /* @__PURE__ */ getFs();
164
- const path2 = /* @__PURE__ */ getPath();
153
+ const path = /* @__PURE__ */ getPath();
165
154
  let currentPath = startPath;
166
155
  while (true) {
167
156
  try {
168
- const gitPath = path2.join(currentPath, ".git");
157
+ const gitPath = path.join(currentPath, ".git");
169
158
  if (fs.existsSync(gitPath)) {
170
159
  return currentPath;
171
160
  }
172
161
  } catch {
173
162
  }
174
- const parentPath = path2.dirname(currentPath);
163
+ const parentPath = path.dirname(currentPath);
175
164
  if (parentPath === currentPath) {
176
165
  return startPath;
177
166
  }
@@ -186,7 +175,9 @@ function parseGitDiffStdout(stdout, options, spawnCwd) {
186
175
  porcelain = false,
187
176
  ...matcherOptions
188
177
  } = { __proto__: null, ...options };
189
- const cwd = cwdOption === defaultRoot ? defaultRoot : (/* @__PURE__ */ getFs()).realpathSync(cwdOption);
178
+ const fs = /* @__PURE__ */ getFs();
179
+ const path = /* @__PURE__ */ getPath();
180
+ const cwd = cwdOption === defaultRoot ? defaultRoot : fs.realpathSync(cwdOption);
190
181
  const rootPath = defaultRoot;
191
182
  let rawFiles = stdout ? (0, import_strings.stripAnsi)(stdout).split("\n").map((line) => line.trimEnd()).filter((line) => line) : [];
192
183
  if (porcelain) {
@@ -194,11 +185,11 @@ function parseGitDiffStdout(stdout, options, spawnCwd) {
194
185
  return line.length > 3 ? line.substring(3) : line;
195
186
  });
196
187
  }
197
- const files = absolute ? rawFiles.map((relPath2) => (0, import_normalize.normalizePath)(import_path.default.join(rootPath, relPath2))) : rawFiles.map((relPath2) => (0, import_normalize.normalizePath)(relPath2));
188
+ const files = absolute ? rawFiles.map((relPath2) => (0, import_normalize.normalizePath)(path.join(rootPath, relPath2))) : rawFiles.map((relPath2) => (0, import_normalize.normalizePath)(relPath2));
198
189
  if (cwd === rootPath) {
199
190
  return files;
200
191
  }
201
- const relPath = (0, import_normalize.normalizePath)(import_path.default.relative(rootPath, cwd));
192
+ const relPath = (0, import_normalize.normalizePath)(path.relative(rootPath, cwd));
202
193
  const matcher = (0, import_globs.getGlobMatcher)([`${relPath}/**`], {
203
194
  ...matcherOptions,
204
195
  absolute,
@@ -250,9 +241,11 @@ async function isChanged(pathname, options) {
250
241
  ...options,
251
242
  absolute: false
252
243
  });
253
- const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
254
- const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
255
- const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
244
+ const fs = /* @__PURE__ */ getFs();
245
+ const path = /* @__PURE__ */ getPath();
246
+ const resolvedPathname = fs.realpathSync(pathname);
247
+ const baseCwd = options?.cwd ? fs.realpathSync(options["cwd"]) : getCwd();
248
+ const relativePath = (0, import_normalize.normalizePath)(path.relative(baseCwd, resolvedPathname));
256
249
  return files.includes(relativePath);
257
250
  }
258
251
  function isChangedSync(pathname, options) {
@@ -261,9 +254,11 @@ function isChangedSync(pathname, options) {
261
254
  ...options,
262
255
  absolute: false
263
256
  });
264
- const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
265
- const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
266
- const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
257
+ const fs = /* @__PURE__ */ getFs();
258
+ const path = /* @__PURE__ */ getPath();
259
+ const resolvedPathname = fs.realpathSync(pathname);
260
+ const baseCwd = options?.cwd ? fs.realpathSync(options["cwd"]) : getCwd();
261
+ const relativePath = (0, import_normalize.normalizePath)(path.relative(baseCwd, resolvedPathname));
267
262
  return files.includes(relativePath);
268
263
  }
269
264
  async function isUnstaged(pathname, options) {
@@ -272,9 +267,11 @@ async function isUnstaged(pathname, options) {
272
267
  ...options,
273
268
  absolute: false
274
269
  });
275
- const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
276
- const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
277
- const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
270
+ const fs = /* @__PURE__ */ getFs();
271
+ const path = /* @__PURE__ */ getPath();
272
+ const resolvedPathname = fs.realpathSync(pathname);
273
+ const baseCwd = options?.cwd ? fs.realpathSync(options["cwd"]) : getCwd();
274
+ const relativePath = (0, import_normalize.normalizePath)(path.relative(baseCwd, resolvedPathname));
278
275
  return files.includes(relativePath);
279
276
  }
280
277
  function isUnstagedSync(pathname, options) {
@@ -283,9 +280,11 @@ function isUnstagedSync(pathname, options) {
283
280
  ...options,
284
281
  absolute: false
285
282
  });
286
- const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
287
- const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
288
- const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
283
+ const fs = /* @__PURE__ */ getFs();
284
+ const path = /* @__PURE__ */ getPath();
285
+ const resolvedPathname = fs.realpathSync(pathname);
286
+ const baseCwd = options?.cwd ? fs.realpathSync(options["cwd"]) : getCwd();
287
+ const relativePath = (0, import_normalize.normalizePath)(path.relative(baseCwd, resolvedPathname));
289
288
  return files.includes(relativePath);
290
289
  }
291
290
  async function isStaged(pathname, options) {
@@ -294,9 +293,11 @@ async function isStaged(pathname, options) {
294
293
  ...options,
295
294
  absolute: false
296
295
  });
297
- const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
298
- const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
299
- const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
296
+ const fs = /* @__PURE__ */ getFs();
297
+ const path = /* @__PURE__ */ getPath();
298
+ const resolvedPathname = fs.realpathSync(pathname);
299
+ const baseCwd = options?.cwd ? fs.realpathSync(options["cwd"]) : getCwd();
300
+ const relativePath = (0, import_normalize.normalizePath)(path.relative(baseCwd, resolvedPathname));
300
301
  return files.includes(relativePath);
301
302
  }
302
303
  function isStagedSync(pathname, options) {
@@ -305,9 +306,11 @@ function isStagedSync(pathname, options) {
305
306
  ...options,
306
307
  absolute: false
307
308
  });
308
- const resolvedPathname = (/* @__PURE__ */ getFs()).realpathSync(pathname);
309
- const baseCwd = options?.cwd ? (/* @__PURE__ */ getFs()).realpathSync(options["cwd"]) : getCwd();
310
- const relativePath = (0, import_normalize.normalizePath)(import_path.default.relative(baseCwd, resolvedPathname));
309
+ const fs = /* @__PURE__ */ getFs();
310
+ const path = /* @__PURE__ */ getPath();
311
+ const resolvedPathname = fs.realpathSync(pathname);
312
+ const baseCwd = options?.cwd ? fs.realpathSync(options["cwd"]) : getCwd();
313
+ const relativePath = (0, import_normalize.normalizePath)(path.relative(baseCwd, resolvedPathname));
311
314
  return files.includes(relativePath);
312
315
  }
313
316
  // Annotate the CommonJS export names for ESM import in node:
@@ -25,20 +25,27 @@ __export(http_request_exports, {
25
25
  httpRequest: () => httpRequest
26
26
  });
27
27
  module.exports = __toCommonJS(http_request_exports);
28
- var import_fs = require("fs");
28
+ let _fs;
29
+ // @__NO_SIDE_EFFECTS__
30
+ function getFs() {
31
+ if (_fs === void 0) {
32
+ _fs = require("fs");
33
+ }
34
+ return _fs;
35
+ }
29
36
  let _http;
30
37
  let _https;
31
38
  // @__NO_SIDE_EFFECTS__
32
39
  function getHttp() {
33
40
  if (_http === void 0) {
34
- _http = require("node:http");
41
+ _http = require("http");
35
42
  }
36
43
  return _http;
37
44
  }
38
45
  // @__NO_SIDE_EFFECTS__
39
46
  function getHttps() {
40
47
  if (_https === void 0) {
41
- _https = require("node:https");
48
+ _https = require("https");
42
49
  }
43
50
  return _https;
44
51
  }
@@ -252,6 +259,7 @@ async function httpDownloadAttempt(url, destPath, options) {
252
259
  port: parsedUrl.port,
253
260
  timeout
254
261
  };
262
+ const { createWriteStream } = /* @__PURE__ */ getFs();
255
263
  let fileStream;
256
264
  let streamClosed = false;
257
265
  const closeStream = () => {
@@ -298,7 +306,7 @@ async function httpDownloadAttempt(url, destPath, options) {
298
306
  10
299
307
  );
300
308
  let downloadedSize = 0;
301
- fileStream = (0, import_fs.createWriteStream)(destPath);
309
+ fileStream = createWriteStream(destPath);
302
310
  fileStream.on("error", (error) => {
303
311
  closeStream();
304
312
  const err = new Error(`Failed to write file: ${error.message}`, {
package/dist/ipc.js CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
- var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
7
  var __export = (target, all) => {
10
8
  for (var name in all)
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
18
16
  }
19
17
  return to;
20
18
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
20
  var ipc_exports = {};
31
21
  __export(ipc_exports, {
@@ -43,12 +33,33 @@ __export(ipc_exports, {
43
33
  writeIpcStub: () => writeIpcStub
44
34
  });
45
35
  module.exports = __toCommonJS(ipc_exports);
46
- var import_crypto = __toESM(require("crypto"));
47
- var import_fs = require("fs");
48
- var import_path = __toESM(require("path"));
49
- var import_fs2 = require("./fs");
36
+ var import_fs = require("./fs");
50
37
  var import_socket = require("./paths/socket");
51
38
  var import_zod = require("./zod");
39
+ let _crypto;
40
+ // @__NO_SIDE_EFFECTS__
41
+ function getCrypto() {
42
+ if (_crypto === void 0) {
43
+ _crypto = require("crypto");
44
+ }
45
+ return _crypto;
46
+ }
47
+ let _fs;
48
+ // @__NO_SIDE_EFFECTS__
49
+ function getFs() {
50
+ if (_fs === void 0) {
51
+ _fs = require("fs");
52
+ }
53
+ return _fs;
54
+ }
55
+ let _path;
56
+ // @__NO_SIDE_EFFECTS__
57
+ function getPath() {
58
+ if (_path === void 0) {
59
+ _path = require("path");
60
+ }
61
+ return _path;
62
+ }
52
63
  const IpcMessageSchema = import_zod.z.object({
53
64
  /** Unique identifier for message tracking and response correlation. */
54
65
  id: import_zod.z.string().min(1),
@@ -81,16 +92,20 @@ const IpcStubSchema = import_zod.z.object({
81
92
  data: import_zod.z.unknown()
82
93
  });
83
94
  function createIpcChannelId(prefix = "socket") {
84
- return `${prefix}-${process.pid}-${import_crypto.default.randomBytes(8).toString("hex")}`;
95
+ const crypto = /* @__PURE__ */ getCrypto();
96
+ return `${prefix}-${process.pid}-${crypto.randomBytes(8).toString("hex")}`;
85
97
  }
86
98
  function getIpcStubPath(appName) {
87
99
  const tempDir = (0, import_socket.getOsTmpDir)();
88
- const stubDir = import_path.default.join(tempDir, ".socket-ipc", appName);
89
- return import_path.default.join(stubDir, `stub-${process.pid}.json`);
100
+ const path = /* @__PURE__ */ getPath();
101
+ const stubDir = path.join(tempDir, ".socket-ipc", appName);
102
+ return path.join(stubDir, `stub-${process.pid}.json`);
90
103
  }
91
104
  async function ensureIpcDirectory(filePath) {
92
- const dir = import_path.default.dirname(filePath);
93
- await import_fs.promises.mkdir(dir, { recursive: true });
105
+ const fs = /* @__PURE__ */ getFs();
106
+ const path = /* @__PURE__ */ getPath();
107
+ const dir = path.dirname(filePath);
108
+ await fs.promises.mkdir(dir, { recursive: true });
94
109
  }
95
110
  async function writeIpcStub(appName, data) {
96
111
  const stubPath = getIpcStubPath(appName);
@@ -101,19 +116,25 @@ async function writeIpcStub(appName, data) {
101
116
  timestamp: Date.now()
102
117
  };
103
118
  const validated = IpcStubSchema.parse(ipcData);
104
- await import_fs.promises.writeFile(stubPath, JSON.stringify(validated, null, 2), "utf8");
119
+ const fs = /* @__PURE__ */ getFs();
120
+ await fs.promises.writeFile(
121
+ stubPath,
122
+ JSON.stringify(validated, null, 2),
123
+ "utf8"
124
+ );
105
125
  return stubPath;
106
126
  }
107
127
  async function readIpcStub(stubPath) {
108
128
  try {
109
- const content = await import_fs.promises.readFile(stubPath, "utf8");
129
+ const fs = /* @__PURE__ */ getFs();
130
+ const content = await fs.promises.readFile(stubPath, "utf8");
110
131
  const parsed = JSON.parse(content);
111
132
  const validated = IpcStubSchema.parse(parsed);
112
133
  const ageMs = Date.now() - validated.timestamp;
113
134
  const maxAgeMs = 5 * 60 * 1e3;
114
135
  if (ageMs > maxAgeMs) {
115
136
  try {
116
- (0, import_fs2.safeDeleteSync)(stubPath, { force: true });
137
+ (0, import_fs.safeDeleteSync)(stubPath, { force: true });
117
138
  } catch {
118
139
  }
119
140
  return null;
@@ -125,21 +146,23 @@ async function readIpcStub(stubPath) {
125
146
  }
126
147
  async function cleanupIpcStubs(appName) {
127
148
  const tempDir = (0, import_socket.getOsTmpDir)();
128
- const stubDir = import_path.default.join(tempDir, ".socket-ipc", appName);
149
+ const fs = /* @__PURE__ */ getFs();
150
+ const path = /* @__PURE__ */ getPath();
151
+ const stubDir = path.join(tempDir, ".socket-ipc", appName);
129
152
  try {
130
- const files = await import_fs.promises.readdir(stubDir);
153
+ const files = await fs.promises.readdir(stubDir);
131
154
  const now = Date.now();
132
155
  const maxAgeMs = 5 * 60 * 1e3;
133
156
  await Promise.allSettled(
134
157
  files.map(async (file) => {
135
158
  if (file.startsWith("stub-") && file.endsWith(".json")) {
136
- const filePath = import_path.default.join(stubDir, file);
159
+ const filePath = path.join(stubDir, file);
137
160
  try {
138
- const stats = await import_fs.promises.stat(filePath);
161
+ const stats = await fs.promises.stat(filePath);
139
162
  const mtimeAge = now - stats.mtimeMs;
140
163
  let isStale = mtimeAge > maxAgeMs;
141
164
  try {
142
- const content = await import_fs.promises.readFile(filePath, "utf8");
165
+ const content = await fs.promises.readFile(filePath, "utf8");
143
166
  const parsed = JSON.parse(content);
144
167
  const validated = IpcStubSchema.parse(parsed);
145
168
  const contentAge = now - validated.timestamp;
@@ -147,7 +170,7 @@ async function cleanupIpcStubs(appName) {
147
170
  } catch {
148
171
  }
149
172
  if (isStale) {
150
- (0, import_fs2.safeDeleteSync)(filePath, { force: true });
173
+ (0, import_fs.safeDeleteSync)(filePath, { force: true });
151
174
  }
152
175
  } catch {
153
176
  }
@@ -209,8 +232,9 @@ function waitForIpc(messageType, options = {}) {
209
232
  });
210
233
  }
211
234
  function createIpcMessage(type, data) {
235
+ const crypto = /* @__PURE__ */ getCrypto();
212
236
  return {
213
- id: import_crypto.default.randomBytes(16).toString("hex"),
237
+ id: crypto.randomBytes(16).toString("hex"),
214
238
  timestamp: Date.now(),
215
239
  type,
216
240
  data
package/dist/json/edit.js CHANGED
@@ -32,7 +32,7 @@ let _fs;
32
32
  // @__NO_SIDE_EFFECTS__
33
33
  function getFs() {
34
34
  if (_fs === void 0) {
35
- _fs = require("node:fs");
35
+ _fs = require("fs");
36
36
  }
37
37
  return _fs;
38
38
  }
@@ -98,7 +98,7 @@ function shouldSave(currentContent, originalContent, originalFileContent, option
98
98
  const sortedContent = sortFn ? sortFn(content) : sort ? sortKeys(content) : content;
99
99
  const origContent = originalContent ? stripFormattingSymbols(originalContent) : {};
100
100
  if (ignoreWhitespace) {
101
- const util = require("node:util");
101
+ const util = require("util");
102
102
  return !util.isDeepStrictEqual(sortedContent, origContent);
103
103
  }
104
104
  const formatting = getFormattingFromContent(currentContent);
package/dist/logger.js CHANGED
@@ -48,7 +48,7 @@ let _Console;
48
48
  // @__NO_SIDE_EFFECTS__
49
49
  function constructConsole(...args) {
50
50
  if (_Console === void 0) {
51
- const nodeConsole = require("node:console");
51
+ const nodeConsole = require("console");
52
52
  _Console = nodeConsole.Console;
53
53
  }
54
54
  return ReflectConstruct(
@@ -47,7 +47,7 @@ let _fs;
47
47
  // @__NO_SIDE_EFFECTS__
48
48
  function getFs() {
49
49
  if (_fs === void 0) {
50
- _fs = require("node:fs");
50
+ _fs = require("fs");
51
51
  }
52
52
  return _fs;
53
53
  }
@@ -55,7 +55,7 @@ let _path;
55
55
  // @__NO_SIDE_EFFECTS__
56
56
  function getPath() {
57
57
  if (_path === void 0) {
58
- _path = require("node:path");
58
+ _path = require("path");
59
59
  }
60
60
  return _path;
61
61
  }
@@ -63,7 +63,7 @@ let _util;
63
63
  // @__NO_SIDE_EFFECTS__
64
64
  function getUtil() {
65
65
  if (_util === void 0) {
66
- _util = require("node:util");
66
+ _util = require("util");
67
67
  }
68
68
  return _util;
69
69
  }