@socketsecurity/lib 5.3.0 → 5.4.1

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 (48) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cover/code.js +12 -4
  3. package/dist/dlx/cache.js +10 -2
  4. package/dist/dlx/manifest.js +45 -41
  5. package/dist/env/rewire.js +10 -2
  6. package/dist/external/@inquirer/checkbox.js +4 -2528
  7. package/dist/external/@inquirer/confirm.js +4 -2371
  8. package/dist/external/@inquirer/input.js +4 -2395
  9. package/dist/external/@inquirer/password.js +4 -2503
  10. package/dist/external/@inquirer/search.js +4 -2500
  11. package/dist/external/@inquirer/select.js +4 -2617
  12. package/dist/external/@npmcli/package-json.js +11 -7
  13. package/dist/external/debug.js +670 -15
  14. package/dist/external/del.js +4 -7139
  15. package/dist/external/external-pack.js +4795 -0
  16. package/dist/external/fast-glob.js +4 -5776
  17. package/dist/external/has-flag.js +6 -0
  18. package/dist/external/libnpmexec.js +2 -2
  19. package/dist/external/normalize-package-data.js +2 -2
  20. package/dist/external/npm-pack.js +1698 -3337
  21. package/dist/external/npm-package-arg.js +2 -2
  22. package/dist/external/pico-pack.js +7162 -0
  23. package/dist/external/picomatch.js +4 -1523
  24. package/dist/external/semver.js +2 -2
  25. package/dist/external/signal-exit.js +5 -0
  26. package/dist/external/spdx-correct.js +4 -1384
  27. package/dist/external/spdx-expression-parse.js +4 -1047
  28. package/dist/external/spdx-pack.js +1640 -0
  29. package/dist/external/supports-color.js +8 -0
  30. package/dist/external/validate-npm-package-name.js +4 -104
  31. package/dist/external/yoctocolors-cjs.js +5 -92
  32. package/dist/http-request.js +10 -2
  33. package/dist/ipc.js +53 -29
  34. package/dist/packages/isolation.js +45 -23
  35. package/dist/packages/licenses.js +10 -2
  36. package/dist/paths/socket.d.ts +2 -2
  37. package/dist/paths/socket.js +27 -21
  38. package/dist/process-lock.js +23 -14
  39. package/dist/releases/github.d.ts +67 -41
  40. package/dist/releases/github.js +142 -100
  41. package/dist/releases/socket-btm.d.ts +40 -33
  42. package/dist/releases/socket-btm.js +45 -5
  43. package/dist/spawn.js +10 -3
  44. package/dist/stdio/mask.d.ts +6 -21
  45. package/dist/stdio/mask.js +18 -14
  46. package/dist/themes/context.js +10 -2
  47. package/package.json +16 -3
  48. package/dist/external/npm-core.js +0 -6588
@@ -0,0 +1,8 @@
1
+ 'use strict'
2
+
3
+ // Re-export from external-pack bundle for better deduplication.
4
+ const { supportsColor } = require('./external-pack')
5
+ // supports-color is an ESM module, re-export all properties.
6
+ const exported = supportsColor.default || supportsColor
7
+ Object.assign(module.exports, exported)
8
+ module.exports.default = exported
@@ -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-pack bundle for better deduplication.
4
+ const { validateNpmPackageName } = require('./npm-pack')
5
+ module.exports = validateNpmPackageName
@@ -1,93 +1,6 @@
1
- "use strict";
2
- /**
3
- * Bundled from yoctocolors-cjs
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/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js
15
- var require_yoctocolors_cjs = __commonJS({
16
- "node_modules/.pnpm/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js"(exports2, module2) {
17
- var tty = require("node:tty");
18
- var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
19
- var format = /* @__PURE__ */ __name((open, close) => {
20
- if (!hasColors) {
21
- return (input) => input;
22
- }
23
- const openCode = `\x1B[${open}m`;
24
- const closeCode = `\x1B[${close}m`;
25
- return (input) => {
26
- const string = input + "";
27
- let index = string.indexOf(closeCode);
28
- if (index === -1) {
29
- return openCode + string + closeCode;
30
- }
31
- let result = openCode;
32
- let lastIndex = 0;
33
- const reopenOnNestedClose = close === 22;
34
- const replaceCode = (reopenOnNestedClose ? closeCode : "") + openCode;
35
- while (index !== -1) {
36
- result += string.slice(lastIndex, index) + replaceCode;
37
- lastIndex = index + closeCode.length;
38
- index = string.indexOf(closeCode, lastIndex);
39
- }
40
- result += string.slice(lastIndex) + closeCode;
41
- return result;
42
- };
43
- }, "format");
44
- var colors2 = {};
45
- colors2.reset = format(0, 0);
46
- colors2.bold = format(1, 22);
47
- colors2.dim = format(2, 22);
48
- colors2.italic = format(3, 23);
49
- colors2.underline = format(4, 24);
50
- colors2.overline = format(53, 55);
51
- colors2.inverse = format(7, 27);
52
- colors2.hidden = format(8, 28);
53
- colors2.strikethrough = format(9, 29);
54
- colors2.black = format(30, 39);
55
- colors2.red = format(31, 39);
56
- colors2.green = format(32, 39);
57
- colors2.yellow = format(33, 39);
58
- colors2.blue = format(34, 39);
59
- colors2.magenta = format(35, 39);
60
- colors2.cyan = format(36, 39);
61
- colors2.white = format(37, 39);
62
- colors2.gray = format(90, 39);
63
- colors2.bgBlack = format(40, 49);
64
- colors2.bgRed = format(41, 49);
65
- colors2.bgGreen = format(42, 49);
66
- colors2.bgYellow = format(43, 49);
67
- colors2.bgBlue = format(44, 49);
68
- colors2.bgMagenta = format(45, 49);
69
- colors2.bgCyan = format(46, 49);
70
- colors2.bgWhite = format(47, 49);
71
- colors2.bgGray = format(100, 49);
72
- colors2.redBright = format(91, 39);
73
- colors2.greenBright = format(92, 39);
74
- colors2.yellowBright = format(93, 39);
75
- colors2.blueBright = format(94, 39);
76
- colors2.magentaBright = format(95, 39);
77
- colors2.cyanBright = format(96, 39);
78
- colors2.whiteBright = format(97, 39);
79
- colors2.bgRedBright = format(101, 49);
80
- colors2.bgGreenBright = format(102, 49);
81
- colors2.bgYellowBright = format(103, 49);
82
- colors2.bgBlueBright = format(104, 49);
83
- colors2.bgMagentaBright = format(105, 49);
84
- colors2.bgCyanBright = format(106, 49);
85
- colors2.bgWhiteBright = format(107, 49);
86
- module2.exports = colors2;
87
- }
88
- });
89
-
90
- // src/external/yoctocolors-cjs.js
91
- var colors = require_yoctocolors_cjs();
92
- module.exports = colors;
93
- module.exports.default = colors;
3
+ // Re-export from external-pack bundle for better deduplication.
4
+ const { yoctocolorsCjs } = require('./external-pack')
5
+ module.exports = yoctocolorsCjs
6
+ module.exports.default = yoctocolorsCjs
@@ -25,7 +25,14 @@ __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__
@@ -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
@@ -32,14 +32,28 @@ __export(isolation_exports, {
32
32
  isolatePackage: () => isolatePackage
33
33
  });
34
34
  module.exports = __toCommonJS(isolation_exports);
35
- var import_fs = require("fs");
36
35
  var import_platform = require("../constants/platform");
37
- var import_node_path = __toESM(require("node:path"));
38
36
  var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
39
37
  var import_spawn = require("../spawn");
40
38
  var import_normalize = require("../paths/normalize");
41
39
  var import_operations = require("./operations");
42
40
  var import_socket = require("../paths/socket");
41
+ let _fs;
42
+ // @__NO_SIDE_EFFECTS__
43
+ function getFs() {
44
+ if (_fs === void 0) {
45
+ _fs = require("fs");
46
+ }
47
+ return _fs;
48
+ }
49
+ let _path;
50
+ // @__NO_SIDE_EFFECTS__
51
+ function getPath() {
52
+ if (_path === void 0) {
53
+ _path = require("path");
54
+ }
55
+ return _path;
56
+ }
43
57
  const FS_CP_OPTIONS = {
44
58
  dereference: true,
45
59
  errorOnExist: false,
@@ -49,14 +63,19 @@ const FS_CP_OPTIONS = {
49
63
  ...import_platform.WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}
50
64
  };
51
65
  async function resolveRealPath(pathStr) {
52
- return await import_fs.promises.realpath(pathStr).catch(() => import_node_path.default.resolve(pathStr));
66
+ const fs = /* @__PURE__ */ getFs();
67
+ const path = /* @__PURE__ */ getPath();
68
+ return await fs.promises.realpath(pathStr).catch(() => path.resolve(pathStr));
53
69
  }
54
70
  async function mergePackageJson(pkgJsonPath, originalPkgJson) {
55
- const pkgJson = JSON.parse(await import_fs.promises.readFile(pkgJsonPath, "utf8"));
71
+ const fs = /* @__PURE__ */ getFs();
72
+ const pkgJson = JSON.parse(await fs.promises.readFile(pkgJsonPath, "utf8"));
56
73
  const mergedPkgJson = originalPkgJson ? { ...originalPkgJson, ...pkgJson } : pkgJson;
57
74
  return mergedPkgJson;
58
75
  }
59
76
  async function isolatePackage(packageSpec, options) {
77
+ const fs = /* @__PURE__ */ getFs();
78
+ const path = /* @__PURE__ */ getPath();
60
79
  const opts = { __proto__: null, ...options };
61
80
  const { imports, install, onPackageJson, sourcePath: optSourcePath } = opts;
62
81
  let sourcePath = optSourcePath;
@@ -65,8 +84,8 @@ async function isolatePackage(packageSpec, options) {
65
84
  if ((0, import_normalize.isPath)(packageSpec)) {
66
85
  const trimmedPath = (0, import_normalize.trimLeadingDotSlash)(packageSpec);
67
86
  const pathToResolve = (0, import_normalize.isAbsolute)(trimmedPath) ? trimmedPath : packageSpec;
68
- sourcePath = import_node_path.default.resolve(pathToResolve);
69
- if (!(0, import_fs.existsSync)(sourcePath)) {
87
+ sourcePath = path.resolve(pathToResolve);
88
+ if (!fs.existsSync(sourcePath)) {
70
89
  throw new Error(`Source path does not exist: ${sourcePath}`);
71
90
  }
72
91
  const pkgJson = await (0, import_operations.readPackageJson)(sourcePath, { normalize: true });
@@ -79,7 +98,7 @@ async function isolatePackage(packageSpec, options) {
79
98
  packageName = parsed.name;
80
99
  if (parsed.type === "directory" || parsed.type === "file") {
81
100
  sourcePath = parsed.fetchSpec;
82
- if (!sourcePath || !(0, import_fs.existsSync)(sourcePath)) {
101
+ if (!sourcePath || !fs.existsSync(sourcePath)) {
83
102
  throw new Error(`Source path does not exist: ${sourcePath}`);
84
103
  }
85
104
  if (!packageName) {
@@ -97,16 +116,16 @@ async function isolatePackage(packageSpec, options) {
97
116
  throw new Error(`Could not determine package name from: ${packageSpec}`);
98
117
  }
99
118
  const sanitizedName = packageName.replace(/[@/]/g, "-");
100
- const tempDir = await import_fs.promises.mkdtemp(
101
- import_node_path.default.join((0, import_socket.getOsTmpDir)(), `socket-test-${sanitizedName}-`)
119
+ const tempDir = await fs.promises.mkdtemp(
120
+ path.join((0, import_socket.getOsTmpDir)(), `socket-test-${sanitizedName}-`)
102
121
  );
103
- const packageTempDir = import_node_path.default.join(tempDir, sanitizedName);
104
- await import_fs.promises.mkdir(packageTempDir, { recursive: true });
122
+ const packageTempDir = path.join(tempDir, sanitizedName);
123
+ await fs.promises.mkdir(packageTempDir, { recursive: true });
105
124
  let installedPath;
106
125
  let originalPackageJson;
107
126
  if (spec) {
108
- await import_fs.promises.writeFile(
109
- import_node_path.default.join(packageTempDir, "package.json"),
127
+ await fs.promises.writeFile(
128
+ path.join(packageTempDir, "package.json"),
110
129
  JSON.stringify(
111
130
  {
112
131
  name: "test-temp",
@@ -127,7 +146,7 @@ async function isolatePackage(packageSpec, options) {
127
146
  stdio: "pipe"
128
147
  });
129
148
  }
130
- installedPath = import_node_path.default.join(packageTempDir, "node_modules", packageName);
149
+ installedPath = path.join(packageTempDir, "node_modules", packageName);
131
150
  originalPackageJson = await (0, import_operations.readPackageJson)(installedPath, {
132
151
  normalize: true
133
152
  });
@@ -135,30 +154,33 @@ async function isolatePackage(packageSpec, options) {
135
154
  const realInstalledPath = await resolveRealPath(installedPath);
136
155
  const realSourcePath = await resolveRealPath(sourcePath);
137
156
  if (realSourcePath !== realInstalledPath) {
138
- await import_fs.promises.cp(sourcePath, installedPath, FS_CP_OPTIONS);
157
+ await fs.promises.cp(sourcePath, installedPath, FS_CP_OPTIONS);
139
158
  }
140
159
  }
141
160
  } else {
142
161
  if (!sourcePath) {
143
162
  throw new Error("sourcePath is required when no version spec provided");
144
163
  }
145
- const scopedPath = packageName.startsWith("@") ? import_node_path.default.join(
164
+ const scopedPath = packageName.startsWith("@") ? path.join(
146
165
  packageTempDir,
147
166
  "node_modules",
148
167
  packageName.split("/")[0] ?? ""
149
- ) : import_node_path.default.join(packageTempDir, "node_modules");
150
- await import_fs.promises.mkdir(scopedPath, { recursive: true });
151
- installedPath = import_node_path.default.join(packageTempDir, "node_modules", packageName);
152
- await import_fs.promises.cp(sourcePath, installedPath, FS_CP_OPTIONS);
168
+ ) : path.join(packageTempDir, "node_modules");
169
+ await fs.promises.mkdir(scopedPath, { recursive: true });
170
+ installedPath = path.join(packageTempDir, "node_modules", packageName);
171
+ await fs.promises.cp(sourcePath, installedPath, FS_CP_OPTIONS);
153
172
  }
154
173
  if (onPackageJson || originalPackageJson) {
155
- const pkgJsonPath = import_node_path.default.join(installedPath, "package.json");
174
+ const pkgJsonPath = path.join(installedPath, "package.json");
156
175
  const mergedPkgJson = await mergePackageJson(
157
176
  pkgJsonPath,
158
177
  originalPackageJson
159
178
  );
160
179
  const finalPkgJson = onPackageJson ? await onPackageJson(mergedPkgJson) : mergedPkgJson;
161
- await import_fs.promises.writeFile(pkgJsonPath, JSON.stringify(finalPkgJson, null, 2));
180
+ await fs.promises.writeFile(
181
+ pkgJsonPath,
182
+ JSON.stringify(finalPkgJson, null, 2)
183
+ );
162
184
  }
163
185
  if (install) {
164
186
  await install(installedPath);
@@ -172,7 +194,7 @@ async function isolatePackage(packageSpec, options) {
172
194
  const exports2 = imports ? { __proto__: null } : void 0;
173
195
  if (imports) {
174
196
  for (const { 0: key, 1: specifier } of Object.entries(imports)) {
175
- const fullPath = import_node_path.default.join(installedPath, specifier);
197
+ const fullPath = path.join(installedPath, specifier);
176
198
  exports2[key] = require(fullPath);
177
199
  }
178
200
  }
@@ -41,12 +41,19 @@ __export(licenses_exports, {
41
41
  module.exports = __toCommonJS(licenses_exports);
42
42
  var import_core = require("../constants/core");
43
43
  var import_licenses = require("../constants/licenses");
44
- var import_node_path = __toESM(require("node:path"));
45
44
  var import_spdx_correct = __toESM(require("../external/spdx-correct"));
46
45
  var import_spdx_expression_parse = __toESM(require("../external/spdx-expression-parse"));
47
46
  var import_objects = require("../objects");
48
47
  var import_normalize = require("../paths/normalize");
49
48
  const copyLeftLicenses = (0, import_licenses.getCopyLeftLicenses)();
49
+ let _path;
50
+ // @__NO_SIDE_EFFECTS__
51
+ function getPath() {
52
+ if (_path === void 0) {
53
+ _path = require("path");
54
+ }
55
+ return _path;
56
+ }
50
57
  const BINARY_OPERATION_NODE_TYPE = "BinaryOperation";
51
58
  const LICENSE_NODE_TYPE = "License";
52
59
  const fileReferenceRegExp = /^SEE LICEN[CS]E IN (.+)$/;
@@ -133,10 +140,11 @@ function resolvePackageLicenses(licenseFieldValue, where) {
133
140
  }
134
141
  const match = fileReferenceRegExp.exec(licenseFieldValue);
135
142
  if (match) {
143
+ const path = /* @__PURE__ */ getPath();
136
144
  return [
137
145
  {
138
146
  license: licenseFieldValue,
139
- inFile: (0, import_normalize.normalizePath)(import_node_path.default.relative(where, match[1] || ""))
147
+ inFile: (0, import_normalize.normalizePath)(path.relative(where, match[1] || ""))
140
148
  }
141
149
  ];
142
150
  }
@@ -81,7 +81,7 @@ export declare function getSocketRegistryGithubCacheDir(): string;
81
81
  * Priority order:
82
82
  * 1. HOME environment variable (Unix)
83
83
  * 2. USERPROFILE environment variable (Windows)
84
- * 3. os.homedir()
85
- * 4. Fallback: os.tmpdir() (rarely used, for restricted environments)
84
+ * 3. getOs().homedir()
85
+ * 4. Fallback: getOs().tmpdir() (rarely used, for restricted environments)
86
86
  */
87
87
  export declare function getUserHomeDir(): string;