@socketsecurity/lib 3.5.0 → 4.0.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 (102) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +8 -8
  3. package/dist/agent.js +12 -25
  4. package/dist/bin.d.ts +97 -40
  5. package/dist/bin.js +133 -138
  6. package/dist/cacache.d.ts +5 -2
  7. package/dist/cacache.js +29 -18
  8. package/dist/cache-with-ttl.js +1 -1
  9. package/dist/constants/agents.d.ts +0 -4
  10. package/dist/constants/agents.js +13 -4
  11. package/dist/constants/node.d.ts +1 -0
  12. package/dist/constants/node.js +2 -5
  13. package/dist/constants/packages.js +23 -11
  14. package/dist/constants/process.d.ts +1 -1
  15. package/dist/constants/process.js +2 -2
  16. package/dist/debug.js +3 -3
  17. package/dist/dlx-binary.js +10 -18
  18. package/dist/dlx-manifest.js +2 -2
  19. package/dist/dlx-package.js +22 -62
  20. package/dist/dlx.js +14 -14
  21. package/dist/effects/text-shimmer.js +1 -1
  22. package/dist/env/ci.js +2 -2
  23. package/dist/env/debug.js +1 -1
  24. package/dist/env/github.js +1 -1
  25. package/dist/env/home.js +1 -1
  26. package/dist/env/locale.js +1 -1
  27. package/dist/env/node-auth-token.js +1 -1
  28. package/dist/env/node-env.js +1 -1
  29. package/dist/env/npm.js +1 -1
  30. package/dist/env/package-manager.js +1 -1
  31. package/dist/env/path.js +1 -1
  32. package/dist/env/pre-commit.js +2 -2
  33. package/dist/env/rewire.d.ts +7 -7
  34. package/dist/env/rewire.js +1 -1
  35. package/dist/env/shell.js +1 -1
  36. package/dist/env/socket-cli-shadow.js +2 -2
  37. package/dist/env/socket-cli.js +2 -2
  38. package/dist/env/socket.js +2 -2
  39. package/dist/env/temp-dir.js +1 -1
  40. package/dist/env/term.js +1 -1
  41. package/dist/env/test.js +3 -3
  42. package/dist/env/windows.js +1 -1
  43. package/dist/env/xdg.js +1 -1
  44. package/dist/fs.js +20 -25
  45. package/dist/git.d.ts +6 -6
  46. package/dist/git.js +11 -14
  47. package/dist/github.js +2 -2
  48. package/dist/globs.js +16 -29
  49. package/dist/ipc.d.ts +4 -4
  50. package/dist/ipc.js +3 -3
  51. package/dist/logger.d.ts +0 -25
  52. package/dist/logger.js +0 -26
  53. package/dist/objects.js +1 -1
  54. package/dist/package-default-node-range.js +13 -3
  55. package/dist/package-extensions.d.ts +2 -1
  56. package/dist/package-extensions.js +12 -2
  57. package/dist/packages/editable.d.ts +0 -3
  58. package/dist/packages/editable.js +34 -24
  59. package/dist/packages/exports.js +1 -1
  60. package/dist/packages/isolation.js +33 -33
  61. package/dist/packages/licenses.js +20 -34
  62. package/dist/packages/manifest.js +21 -36
  63. package/dist/packages/normalize.js +20 -52
  64. package/dist/packages/operations.js +39 -103
  65. package/dist/packages/provenance.js +15 -5
  66. package/dist/packages/specs.js +13 -12
  67. package/dist/packages/validation.js +12 -10
  68. package/dist/packages.d.ts +2 -2
  69. package/dist/packages.js +3 -3
  70. package/dist/paths/dirnames.d.ts +13 -0
  71. package/dist/paths/dirnames.js +50 -0
  72. package/dist/paths/exts.d.ts +18 -0
  73. package/dist/paths/exts.js +68 -0
  74. package/dist/paths/filenames.d.ts +16 -0
  75. package/dist/paths/filenames.js +62 -0
  76. package/dist/paths/globs.d.ts +10 -0
  77. package/dist/{argv/quote.js → paths/globs.js} +21 -19
  78. package/dist/{path.d.ts → paths/normalize.d.ts} +41 -0
  79. package/dist/{path.js → paths/normalize.js} +18 -5
  80. package/dist/{packages/paths.js → paths/packages.js} +8 -8
  81. package/dist/paths/rewire.d.ts +1 -1
  82. package/dist/{paths.js → paths/socket.js} +31 -67
  83. package/dist/promises.js +2 -2
  84. package/dist/sea.js +2 -2
  85. package/dist/shadow.js +3 -3
  86. package/dist/sorts.js +12 -2
  87. package/dist/spawn.d.ts +15 -12
  88. package/dist/spawn.js +43 -31
  89. package/dist/spinner.d.ts +2 -6
  90. package/dist/spinner.js +9 -41
  91. package/dist/stdio/prompts.d.ts +8 -10
  92. package/dist/stdio/prompts.js +15 -13
  93. package/dist/streams.d.ts +0 -4
  94. package/dist/streams.js +3 -12
  95. package/dist/temporary-executor.js +4 -4
  96. package/dist/versions.js +31 -28
  97. package/package.json +28 -29
  98. package/dist/argv/quote.d.ts +0 -49
  99. package/dist/constants/paths.d.ts +0 -51
  100. package/dist/constants/paths.js +0 -152
  101. /package/dist/{packages/paths.d.ts → paths/packages.d.ts} +0 -0
  102. /package/dist/{paths.d.ts → paths/socket.d.ts} +0 -0
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var agents_exports = {};
21
31
  __export(agents_exports, {
@@ -44,6 +54,7 @@ __export(agents_exports, {
44
54
  YARN_LOCK: () => YARN_LOCK
45
55
  });
46
56
  module.exports = __toCommonJS(agents_exports);
57
+ var import_which = __toESM(require("../external/which"));
47
58
  const NPM = "npm";
48
59
  const PNPM = "pnpm";
49
60
  const YARN = "yarn";
@@ -52,8 +63,7 @@ const VLT = "vlt";
52
63
  const NPX = "npx";
53
64
  const NPM_BIN_PATH = /* @__PURE__ */ (() => {
54
65
  try {
55
- const which = require("../external/which");
56
- return which.sync("npm", { nothrow: true }) || "npm";
66
+ return import_which.default.sync("npm", { nothrow: true }) || "npm";
57
67
  } catch {
58
68
  return "npm";
59
69
  }
@@ -62,8 +72,7 @@ const NPM_REAL_EXEC_PATH = /* @__PURE__ */ (() => {
62
72
  try {
63
73
  const { existsSync } = require("node:fs");
64
74
  const path = require("node:path");
65
- const which = require("../external/which");
66
- const npmBin = which.sync("npm", { nothrow: true });
75
+ const npmBin = import_which.default.sync("npm", { nothrow: true });
67
76
  if (!npmBin) {
68
77
  return void 0;
69
78
  }
@@ -1,6 +1,7 @@
1
1
  // Version detection.
2
2
  export declare function getNodeVersion(): string;
3
3
  export declare function getNodeMajorVersion(): number;
4
+ // Maintained Node.js versions.
4
5
  export declare function getMaintainedNodeVersions(): readonly string[] & {
5
6
  current: string;
6
7
  last: string;
@@ -39,6 +39,7 @@ __export(node_exports, {
39
39
  supportsProcessSend: () => supportsProcessSend
40
40
  });
41
41
  module.exports = __toCommonJS(node_exports);
42
+ var import_maintained_node_versions = require("../maintained-node-versions");
42
43
  const NODE_VERSION = process.version;
43
44
  function getNodeVersion() {
44
45
  return NODE_VERSION;
@@ -46,12 +47,8 @@ function getNodeVersion() {
46
47
  function getNodeMajorVersion() {
47
48
  return Number.parseInt(NODE_VERSION.slice(1).split(".")[0] || "0", 10);
48
49
  }
49
- let _maintainedNodeVersions;
50
50
  function getMaintainedNodeVersions() {
51
- if (_maintainedNodeVersions === void 0) {
52
- _maintainedNodeVersions = require("#lib/maintained-node-versions").maintainedNodeVersions;
53
- }
54
- return _maintainedNodeVersions;
51
+ return import_maintained_node_versions.maintainedNodeVersions;
55
52
  }
56
53
  function supportsNodeCompileCacheApi() {
57
54
  const major = getNodeMajorVersion();
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var packages_exports = {};
21
31
  __export(packages_exports, {
@@ -32,7 +42,13 @@ __export(packages_exports, {
32
42
  getPacoteCachePath: () => getPacoteCachePath
33
43
  });
34
44
  module.exports = __toCommonJS(packages_exports);
35
- var import_npm = require("#env/npm");
45
+ var import_npm = require("../env/npm");
46
+ var import_lifecycle_script_names = require("../lifecycle-script-names");
47
+ var import_package_default_node_range = require("../package-default-node-range");
48
+ var import_package_default_socket_categories = require("../package-default-socket-categories");
49
+ var import_package_extensions = require("../package-extensions");
50
+ var import_pacote = __toESM(require("../external/pacote"));
51
+ var import_normalize = require("../paths/normalize");
36
52
  let _lifecycleScriptNames;
37
53
  let _packageDefaultNodeRange;
38
54
  let _packageDefaultSocketCategories;
@@ -46,22 +62,21 @@ const PACKAGE_DEFAULT_VERSION = "1.0.0";
46
62
  // @__NO_SIDE_EFFECTS__
47
63
  function getPackageDefaultNodeRange() {
48
64
  if (_packageDefaultNodeRange === void 0) {
49
- _packageDefaultNodeRange = require("#lib/package-default-node-range").packageDefaultNodeRange;
65
+ _packageDefaultNodeRange = import_package_default_node_range.packageDefaultNodeRange;
50
66
  }
51
67
  return _packageDefaultNodeRange;
52
68
  }
53
69
  // @__NO_SIDE_EFFECTS__
54
70
  function getPackageDefaultSocketCategories() {
55
71
  if (_packageDefaultSocketCategories === void 0) {
56
- _packageDefaultSocketCategories = require("#lib/package-default-socket-categories").packageDefaultSocketCategories;
72
+ _packageDefaultSocketCategories = import_package_default_socket_categories.packageDefaultSocketCategories;
57
73
  }
58
74
  return _packageDefaultSocketCategories;
59
75
  }
60
76
  // @__NO_SIDE_EFFECTS__
61
77
  function getPackageExtensions() {
62
78
  if (_packageExtensions === void 0) {
63
- const { packageExtensions } = require("#lib/package-extensions");
64
- _packageExtensions = Object.entries(packageExtensions);
79
+ _packageExtensions = Object.entries(import_package_extensions.packageExtensions);
65
80
  }
66
81
  return _packageExtensions;
67
82
  }
@@ -72,8 +87,7 @@ function getNpmLifecycleEvent() {
72
87
  // @__NO_SIDE_EFFECTS__
73
88
  function getLifecycleScriptNames() {
74
89
  if (_lifecycleScriptNames === void 0) {
75
- const { lifecycleScriptNames } = require("#lib/lifecycle-script-names");
76
- _lifecycleScriptNames = Array.from(lifecycleScriptNames);
90
+ _lifecycleScriptNames = Array.from(import_lifecycle_script_names.lifecycleScriptNames);
77
91
  }
78
92
  return _lifecycleScriptNames;
79
93
  }
@@ -88,10 +102,8 @@ function getPackumentCache() {
88
102
  function getPacoteCachePath() {
89
103
  if (_pacoteCachePath === void 0) {
90
104
  try {
91
- const pacote = require("../external/pacote");
92
- const { normalizePath } = require("#lib/path");
93
105
  const proto = Reflect.getPrototypeOf(
94
- pacote.RegistryFetcher.prototype
106
+ import_pacote.default.RegistryFetcher.prototype
95
107
  );
96
108
  const PacoteFetcherBase = proto?.constructor;
97
109
  const cachePath = PacoteFetcherBase ? new PacoteFetcherBase(
@@ -99,7 +111,7 @@ function getPacoteCachePath() {
99
111
  "x",
100
112
  {}
101
113
  ).cache : "";
102
- _pacoteCachePath = normalizePath(cachePath);
114
+ _pacoteCachePath = (0, import_normalize.normalizePath)(cachePath);
103
115
  } catch {
104
116
  _pacoteCachePath = "";
105
117
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Process control: abort signals and UI utilities.
3
3
  */
4
- import type { Spinner } from '#lib/spinner';
4
+ import type { Spinner } from '../spinner';
5
5
  export declare function getAbortController(): AbortController;
6
6
  export declare function getAbortSignal(): AbortSignal;
7
7
  export declare function getSpinner(): Spinner | null;
@@ -24,6 +24,7 @@ __export(process_exports, {
24
24
  getSpinner: () => getSpinner
25
25
  });
26
26
  module.exports = __toCommonJS(process_exports);
27
+ var import_spinner = require("../spinner");
27
28
  let _abortController;
28
29
  function getAbortController() {
29
30
  if (_abortController === void 0) {
@@ -37,8 +38,7 @@ function getAbortSignal() {
37
38
  let _spinner;
38
39
  function getSpinner() {
39
40
  if (_spinner === void 0) {
40
- const { Spinner: SpinnerFn } = require("#lib/spinner");
41
- _spinner = SpinnerFn() ?? null;
41
+ _spinner = (0, import_spinner.Spinner)() ?? null;
42
42
  }
43
43
  return _spinner ?? null;
44
44
  }
package/dist/debug.js CHANGED
@@ -43,9 +43,9 @@ __export(debug_exports, {
43
43
  isDebugNs: () => isDebugNs
44
44
  });
45
45
  module.exports = __toCommonJS(debug_exports);
46
- var import_process = require("#constants/process");
47
- var import_debug = require("#env/debug");
48
- var import_socket = require("#env/socket");
46
+ var import_process = require("./constants/process");
47
+ var import_debug = require("./env/debug");
48
+ var import_socket = require("./env/socket");
49
49
  var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is-unicode-supported"));
50
50
  var import_debug2 = __toESM(require("./external/debug"));
51
51
  var import_logger = require("./logger");
@@ -40,14 +40,15 @@ module.exports = __toCommonJS(dlx_binary_exports);
40
40
  var import_crypto = require("crypto");
41
41
  var import_os = __toESM(require("os"));
42
42
  var import_path = __toESM(require("path"));
43
- var import_platform = require("#constants/platform");
43
+ var import_platform = require("./constants/platform");
44
+ var import_time = require("./constants/time");
44
45
  var import_dlx = require("./dlx");
45
46
  var import_dlx_manifest = require("./dlx-manifest");
46
47
  var import_http_request = require("./http-request");
47
48
  var import_fs = require("./fs");
48
49
  var import_objects = require("./objects");
49
- var import_path2 = require("./path");
50
- var import_paths = require("./paths");
50
+ var import_normalize = require("./paths/normalize");
51
+ var import_socket = require("./paths/socket");
51
52
  var import_process_lock = require("./process-lock");
52
53
  var import_spawn = require("./spawn");
53
54
  let _fs;
@@ -165,10 +166,7 @@ async function writeMetadata(cacheEntryPath, cacheKey, url, binaryName, checksum
165
166
  } catch {
166
167
  }
167
168
  }
168
- async function cleanDlxCache(maxAge = (
169
- /*@__INLINE__*/
170
- require("#constants/time").DLX_BINARY_CACHE_TTL
171
- )) {
169
+ async function cleanDlxCache(maxAge = import_time.DLX_BINARY_CACHE_TTL) {
172
170
  const cacheDir = getDlxCachePath();
173
171
  const fs = /* @__PURE__ */ getFs();
174
172
  if (!fs.existsSync(cacheDir)) {
@@ -209,10 +207,7 @@ async function cleanDlxCache(maxAge = (
209
207
  }
210
208
  async function dlxBinary(args, options, spawnExtra) {
211
209
  const {
212
- cacheTtl = (
213
- /*@__INLINE__*/
214
- require("#constants/time").DLX_BINARY_CACHE_TTL
215
- ),
210
+ cacheTtl = import_time.DLX_BINARY_CACHE_TTL,
216
211
  checksum,
217
212
  force: userForce = false,
218
213
  name,
@@ -226,7 +221,7 @@ async function dlxBinary(args, options, spawnExtra) {
226
221
  const spec = `${url}:${binaryName}`;
227
222
  const cacheKey = (0, import_dlx.generateCacheKey)(spec);
228
223
  const cacheEntryDir = import_path.default.join(cacheDir, cacheKey);
229
- const binaryPath = (0, import_path2.normalizePath)(import_path.default.join(cacheEntryDir, binaryName));
224
+ const binaryPath = (0, import_normalize.normalizePath)(import_path.default.join(cacheEntryDir, binaryName));
230
225
  const fs = /* @__PURE__ */ getFs();
231
226
  let downloaded = false;
232
227
  let computedChecksum = checksum;
@@ -298,10 +293,7 @@ Ensure the filesystem is writable or set SOCKET_DLX_DIR to a writable location.`
298
293
  }
299
294
  async function downloadBinary(options) {
300
295
  const {
301
- cacheTtl = (
302
- /*@__INLINE__*/
303
- require("#constants/time").DLX_BINARY_CACHE_TTL
304
- ),
296
+ cacheTtl = import_time.DLX_BINARY_CACHE_TTL,
305
297
  checksum,
306
298
  force = false,
307
299
  name,
@@ -312,7 +304,7 @@ async function downloadBinary(options) {
312
304
  const spec = `${url}:${binaryName}`;
313
305
  const cacheKey = (0, import_dlx.generateCacheKey)(spec);
314
306
  const cacheEntryDir = import_path.default.join(cacheDir, cacheKey);
315
- const binaryPath = (0, import_path2.normalizePath)(import_path.default.join(cacheEntryDir, binaryName));
307
+ const binaryPath = (0, import_normalize.normalizePath)(import_path.default.join(cacheEntryDir, binaryName));
316
308
  const fs = /* @__PURE__ */ getFs();
317
309
  let downloaded = false;
318
310
  if (!force && fs.existsSync(cacheEntryDir) && await isCacheValid(cacheEntryDir, cacheTtl)) {
@@ -372,7 +364,7 @@ function executeBinary(binaryPath, args, spawnOptions, spawnExtra) {
372
364
  return (0, import_spawn.spawn)(binaryPath, args, finalSpawnOptions, spawnExtra);
373
365
  }
374
366
  function getDlxCachePath() {
375
- return (0, import_paths.getSocketDlxDir)();
367
+ return (0, import_socket.getSocketDlxDir)();
376
368
  }
377
369
  async function listDlxCache() {
378
370
  const cacheDir = getDlxCachePath();
@@ -39,7 +39,7 @@ var import_fs = require("fs");
39
39
  var import_path = __toESM(require("path"));
40
40
  var import_fs2 = require("./fs");
41
41
  var import_logger = require("./logger");
42
- var import_paths = require("./paths");
42
+ var import_socket = require("./paths/socket");
43
43
  var import_process_lock = require("./process-lock");
44
44
  const logger = (0, import_logger.getDefaultLogger)();
45
45
  const MANIFEST_FILE_NAME = ".dlx-manifest.json";
@@ -53,7 +53,7 @@ class DlxManifest {
53
53
  manifestPath;
54
54
  lockPath;
55
55
  constructor(options = {}) {
56
- this.manifestPath = options.manifestPath ?? import_path.default.join((0, import_paths.getSocketDlxDir)(), MANIFEST_FILE_NAME);
56
+ this.manifestPath = options.manifestPath ?? import_path.default.join((0, import_socket.getSocketDlxDir)(), MANIFEST_FILE_NAME);
57
57
  this.lockPath = `${this.manifestPath}.lock`;
58
58
  }
59
59
  /**
@@ -34,60 +34,24 @@ __export(dlx_package_exports, {
34
34
  executePackage: () => executePackage
35
35
  });
36
36
  module.exports = __toCommonJS(dlx_package_exports);
37
+ var import_node_fs = __toESM(require("node:fs"));
37
38
  var import_path = __toESM(require("path"));
38
39
  var import_platform = require("./constants/platform");
39
40
  var import_packages = require("./constants/packages");
40
41
  var import_dlx = require("./dlx");
42
+ var import_arborist = __toESM(require("./external/@npmcli/arborist"));
43
+ var import_libnpmexec = __toESM(require("./external/libnpmexec"));
44
+ var import_npm_package_arg = __toESM(require("./external/npm-package-arg"));
45
+ var import_pacote = __toESM(require("./external/pacote"));
41
46
  var import_fs = require("./fs");
42
- var import_path2 = require("./path");
43
- var import_paths = require("./paths");
47
+ var import_normalize = require("./paths/normalize");
48
+ var import_socket = require("./paths/socket");
44
49
  var import_process_lock = require("./process-lock");
45
50
  var import_spawn = require("./spawn");
46
- let _fs;
47
- // @__NO_SIDE_EFFECTS__
48
- function getFs() {
49
- if (_fs === void 0) {
50
- _fs = require("node:fs");
51
- }
52
- return _fs;
53
- }
54
- let _npmPackageArg;
55
- // @__NO_SIDE_EFFECTS__
56
- function getNpmPackageArg() {
57
- if (_npmPackageArg === void 0) {
58
- _npmPackageArg = require("./external/npm-package-arg.js");
59
- }
60
- return _npmPackageArg;
61
- }
62
- let _libnpmexec;
63
- // @__NO_SIDE_EFFECTS__
64
- function getLibnpmexec() {
65
- if (_libnpmexec === void 0) {
66
- _libnpmexec = require("./external/libnpmexec.js");
67
- }
68
- return _libnpmexec;
69
- }
70
- let _pacote;
71
- // @__NO_SIDE_EFFECTS__
72
- function getPacote() {
73
- if (_pacote === void 0) {
74
- _pacote = require("./external/pacote.js");
75
- }
76
- return _pacote;
77
- }
78
- let _arborist;
79
- // @__NO_SIDE_EFFECTS__
80
- function getArborist() {
81
- if (_arborist === void 0) {
82
- _arborist = require("./external/@npmcli/arborist.js");
83
- }
84
- return _arborist;
85
- }
86
51
  const rangeOperatorsRegExp = /[~^><=xX* ]|\|\|/;
87
52
  function parsePackageSpec(spec) {
88
53
  try {
89
- const npa = /* @__PURE__ */ getNpmPackageArg();
90
- const parsed = npa(spec);
54
+ const parsed = (0, import_npm_package_arg.default)(spec);
91
55
  const version = parsed.type === "tag" ? parsed.fetchSpec : parsed.type === "version" || parsed.type === "range" ? parsed.fetchSpec : void 0;
92
56
  return {
93
57
  name: parsed.name || spec,
@@ -106,8 +70,8 @@ function parsePackageSpec(spec) {
106
70
  }
107
71
  async function ensurePackageInstalled(packageName, packageSpec, force) {
108
72
  const cacheKey = (0, import_dlx.generateCacheKey)(packageSpec);
109
- const packageDir = (0, import_path2.normalizePath)(import_path.default.join((0, import_paths.getSocketDlxDir)(), cacheKey));
110
- const installedDir = (0, import_path2.normalizePath)(
73
+ const packageDir = (0, import_normalize.normalizePath)(import_path.default.join((0, import_socket.getSocketDlxDir)(), cacheKey));
74
+ const installedDir = (0, import_normalize.normalizePath)(
111
75
  import_path.default.join(packageDir, "node_modules", packageName)
112
76
  );
113
77
  try {
@@ -136,21 +100,19 @@ Ensure the filesystem is writable or set SOCKET_DLX_DIR to a writable location.`
136
100
  return await import_process_lock.processLock.withLock(
137
101
  lockPath,
138
102
  async () => {
139
- const fs = /* @__PURE__ */ getFs();
140
- if (!force && fs.existsSync(installedDir)) {
103
+ if (!force && import_node_fs.default.existsSync(installedDir)) {
141
104
  const pkgJsonPath = import_path.default.join(installedDir, "package.json");
142
- if (fs.existsSync(pkgJsonPath)) {
105
+ if (import_node_fs.default.existsSync(pkgJsonPath)) {
143
106
  return { installed: false, packageDir };
144
107
  }
145
108
  }
146
109
  const pacoteCachePath = (0, import_packages.getPacoteCachePath)();
147
110
  try {
148
- await (/* @__PURE__ */ getPacote()).extract(packageSpec, installedDir, {
111
+ await import_pacote.default.extract(packageSpec, installedDir, {
149
112
  // Use consistent pacote cache path (respects npm cache locations when available).
150
113
  cache: pacoteCachePath || import_path.default.join(packageDir, ".cache")
151
114
  });
152
- const Arborist = /* @__PURE__ */ getArborist();
153
- const arb = new Arborist({
115
+ const arb = new import_arborist.default({
154
116
  path: installedDir,
155
117
  cache: pacoteCachePath || import_path.default.join(packageDir, ".cache"),
156
118
  // Skip devDependencies (production-only like npx).
@@ -202,21 +164,20 @@ Check npm registry connectivity or package name.`,
202
164
  );
203
165
  }
204
166
  function resolveBinaryPath(basePath) {
205
- const fs = /* @__PURE__ */ getFs();
206
167
  if (!import_platform.WIN32) {
207
168
  return basePath;
208
169
  }
209
170
  const extensions = [".cmd", ".bat", ".ps1", ".exe", ""];
210
171
  for (const ext of extensions) {
211
172
  const testPath = basePath + ext;
212
- if (fs.existsSync(testPath)) {
173
+ if (import_node_fs.default.existsSync(testPath)) {
213
174
  return testPath;
214
175
  }
215
176
  }
216
177
  return basePath;
217
178
  }
218
179
  function findBinaryPath(packageDir, packageName, binaryName) {
219
- const installedDir = (0, import_path2.normalizePath)(
180
+ const installedDir = (0, import_normalize.normalizePath)(
220
181
  import_path.default.join(packageDir, "node_modules", packageName)
221
182
  );
222
183
  const pkgJsonPath = import_path.default.join(installedDir, "package.json");
@@ -234,7 +195,7 @@ function findBinaryPath(packageDir, packageName, binaryName) {
234
195
  binPath = binObj[binName];
235
196
  } else {
236
197
  try {
237
- const { getBinFromManifest } = /* @__PURE__ */ getLibnpmexec();
198
+ const { getBinFromManifest } = import_libnpmexec.default;
238
199
  binName = getBinFromManifest({
239
200
  name: packageName,
240
201
  bin: binObj,
@@ -265,7 +226,7 @@ function findBinaryPath(packageDir, packageName, binaryName) {
265
226
  if (!binPath) {
266
227
  throw new Error(`No binary found for package "${packageName}"`);
267
228
  }
268
- const rawPath = (0, import_path2.normalizePath)(import_path.default.join(installedDir, binPath));
229
+ const rawPath = (0, import_normalize.normalizePath)(import_path.default.join(installedDir, binPath));
269
230
  return resolveBinaryPath(rawPath);
270
231
  }
271
232
  async function dlxPackage(args, options, spawnExtra) {
@@ -285,8 +246,7 @@ function makePackageBinsExecutable(packageDir, packageName) {
285
246
  if (import_platform.WIN32) {
286
247
  return;
287
248
  }
288
- const fs = /* @__PURE__ */ getFs();
289
- const installedDir = (0, import_path2.normalizePath)(
249
+ const installedDir = (0, import_normalize.normalizePath)(
290
250
  import_path.default.join(packageDir, "node_modules", packageName)
291
251
  );
292
252
  const pkgJsonPath = import_path.default.join(installedDir, "package.json");
@@ -304,10 +264,10 @@ function makePackageBinsExecutable(packageDir, packageName) {
304
264
  binPaths.push(...Object.values(binObj));
305
265
  }
306
266
  for (const binPath of binPaths) {
307
- const fullPath = (0, import_path2.normalizePath)(import_path.default.join(installedDir, binPath));
308
- if (fs.existsSync(fullPath)) {
267
+ const fullPath = (0, import_normalize.normalizePath)(import_path.default.join(installedDir, binPath));
268
+ if (import_node_fs.default.existsSync(fullPath)) {
309
269
  try {
310
- fs.chmodSync(fullPath, 493);
270
+ import_node_fs.default.chmodSync(fullPath, 493);
311
271
  } catch {
312
272
  }
313
273
  }
package/dist/dlx.js CHANGED
@@ -41,8 +41,8 @@ __export(dlx_exports, {
41
41
  module.exports = __toCommonJS(dlx_exports);
42
42
  var import_crypto = require("crypto");
43
43
  var import_fs = require("./fs");
44
- var import_path = require("./path");
45
- var import_paths = require("./paths");
44
+ var import_normalize = require("./paths/normalize");
45
+ var import_socket = require("./paths/socket");
46
46
  var import_promises = require("./promises");
47
47
  let _fs;
48
48
  // @__NO_SIDE_EFFECTS__
@@ -75,50 +75,50 @@ function clearDlxSync() {
75
75
  }
76
76
  function dlxDirExists() {
77
77
  const fs = /* @__PURE__ */ getFs();
78
- return fs.existsSync((0, import_paths.getSocketDlxDir)());
78
+ return fs.existsSync((0, import_socket.getSocketDlxDir)());
79
79
  }
80
80
  async function dlxDirExistsAsync() {
81
81
  const fs = /* @__PURE__ */ getFs();
82
82
  try {
83
- await fs.promises.access((0, import_paths.getSocketDlxDir)());
83
+ await fs.promises.access((0, import_socket.getSocketDlxDir)());
84
84
  return true;
85
85
  } catch {
86
86
  return false;
87
87
  }
88
88
  }
89
89
  async function ensureDlxDir() {
90
- await (0, import_fs.safeMkdir)((0, import_paths.getSocketDlxDir)());
90
+ await (0, import_fs.safeMkdir)((0, import_socket.getSocketDlxDir)());
91
91
  }
92
92
  function ensureDlxDirSync() {
93
- (0, import_fs.safeMkdirSync)((0, import_paths.getSocketDlxDir)());
93
+ (0, import_fs.safeMkdirSync)((0, import_socket.getSocketDlxDir)());
94
94
  }
95
95
  function getDlxInstalledPackageDir(packageName) {
96
96
  const path = /* @__PURE__ */ getPath();
97
- return (0, import_path.normalizePath)(
97
+ return (0, import_normalize.normalizePath)(
98
98
  path.join(getDlxPackageNodeModulesDir(packageName), packageName)
99
99
  );
100
100
  }
101
101
  function getDlxPackageDir(packageName) {
102
102
  const path = /* @__PURE__ */ getPath();
103
- return (0, import_path.normalizePath)(path.join((0, import_paths.getSocketDlxDir)(), packageName));
103
+ return (0, import_normalize.normalizePath)(path.join((0, import_socket.getSocketDlxDir)(), packageName));
104
104
  }
105
105
  function getDlxPackageJsonPath(packageName) {
106
106
  const path = /* @__PURE__ */ getPath();
107
- return (0, import_path.normalizePath)(
107
+ return (0, import_normalize.normalizePath)(
108
108
  path.join(getDlxInstalledPackageDir(packageName), "package.json")
109
109
  );
110
110
  }
111
111
  function getDlxPackageNodeModulesDir(packageName) {
112
112
  const path = /* @__PURE__ */ getPath();
113
- return (0, import_path.normalizePath)(path.join(getDlxPackageDir(packageName), "node_modules"));
113
+ return (0, import_normalize.normalizePath)(path.join(getDlxPackageDir(packageName), "node_modules"));
114
114
  }
115
115
  function isInSocketDlx(filePath) {
116
116
  if (!filePath) {
117
117
  return false;
118
118
  }
119
119
  const path = /* @__PURE__ */ getPath();
120
- const dlxDir = (0, import_paths.getSocketDlxDir)();
121
- const absolutePath = (0, import_path.normalizePath)(path.resolve(filePath));
120
+ const dlxDir = (0, import_socket.getSocketDlxDir)();
121
+ const absolutePath = (0, import_normalize.normalizePath)(path.resolve(filePath));
122
122
  return absolutePath.startsWith(`${dlxDir}/`);
123
123
  }
124
124
  function isDlxPackageInstalled(packageName) {
@@ -136,7 +136,7 @@ async function isDlxPackageInstalledAsync(packageName) {
136
136
  }
137
137
  function listDlxPackages() {
138
138
  try {
139
- return (0, import_fs.readDirNamesSync)((0, import_paths.getSocketDlxDir)(), { sort: true });
139
+ return (0, import_fs.readDirNamesSync)((0, import_socket.getSocketDlxDir)(), { sort: true });
140
140
  } catch {
141
141
  return [];
142
142
  }
@@ -144,7 +144,7 @@ function listDlxPackages() {
144
144
  async function listDlxPackagesAsync() {
145
145
  const fs = /* @__PURE__ */ getFs();
146
146
  try {
147
- const entries = await fs.promises.readdir((0, import_paths.getSocketDlxDir)(), {
147
+ const entries = await fs.promises.readdir((0, import_socket.getSocketDlxDir)(), {
148
148
  withFileTypes: true
149
149
  });
150
150
  return entries.filter((e) => e.isDirectory()).map((e) => e.name).sort();
@@ -30,7 +30,7 @@ __export(text_shimmer_exports, {
30
30
  module.exports = __toCommonJS(text_shimmer_exports);
31
31
  var import_ansi = require("../ansi");
32
32
  var import_arrays = require("../arrays");
33
- var import_ci = require("#env/ci");
33
+ var import_ci = require("../env/ci");
34
34
  var import_utils = require("../themes/utils");
35
35
  var import_themes = require("../themes/themes");
36
36
  function detectStyles(text) {
package/dist/env/ci.js CHANGED
@@ -22,8 +22,8 @@ __export(ci_exports, {
22
22
  getCI: () => getCI
23
23
  });
24
24
  module.exports = __toCommonJS(ci_exports);
25
- var import_helpers = require("#env/helpers");
26
- var import_rewire = require("#env/rewire");
25
+ var import_helpers = require("./helpers");
26
+ var import_rewire = require("./rewire");
27
27
  // @__NO_SIDE_EFFECTS__
28
28
  function getCI() {
29
29
  return (0, import_helpers.envAsBoolean)((0, import_rewire.getEnvValue)("CI"));
package/dist/env/debug.js CHANGED
@@ -22,7 +22,7 @@ __export(debug_exports, {
22
22
  getDebug: () => getDebug
23
23
  });
24
24
  module.exports = __toCommonJS(debug_exports);
25
- var import_rewire = require("#env/rewire");
25
+ var import_rewire = require("./rewire");
26
26
  // @__NO_SIDE_EFFECTS__
27
27
  function getDebug() {
28
28
  return (0, import_rewire.getEnvValue)("DEBUG");
@@ -29,7 +29,7 @@ __export(github_exports, {
29
29
  getGithubToken: () => getGithubToken
30
30
  });
31
31
  module.exports = __toCommonJS(github_exports);
32
- var import_rewire = require("#env/rewire");
32
+ var import_rewire = require("./rewire");
33
33
  // @__NO_SIDE_EFFECTS__
34
34
  function getGithubApiUrl() {
35
35
  return (0, import_rewire.getEnvValue)("GITHUB_API_URL");
package/dist/env/home.js CHANGED
@@ -22,7 +22,7 @@ __export(home_exports, {
22
22
  getHome: () => getHome
23
23
  });
24
24
  module.exports = __toCommonJS(home_exports);
25
- var import_rewire = require("#env/rewire");
25
+ var import_rewire = require("./rewire");
26
26
  // @__NO_SIDE_EFFECTS__
27
27
  function getHome() {
28
28
  return (0, import_rewire.getEnvValue)("HOME");
@@ -24,7 +24,7 @@ __export(locale_exports, {
24
24
  getLcMessages: () => getLcMessages
25
25
  });
26
26
  module.exports = __toCommonJS(locale_exports);
27
- var import_rewire = require("#env/rewire");
27
+ var import_rewire = require("./rewire");
28
28
  // @__NO_SIDE_EFFECTS__
29
29
  function getLang() {
30
30
  return (0, import_rewire.getEnvValue)("LANG");
@@ -22,7 +22,7 @@ __export(node_auth_token_exports, {
22
22
  getNodeAuthToken: () => getNodeAuthToken
23
23
  });
24
24
  module.exports = __toCommonJS(node_auth_token_exports);
25
- var import_rewire = require("#env/rewire");
25
+ var import_rewire = require("./rewire");
26
26
  // @__NO_SIDE_EFFECTS__
27
27
  function getNodeAuthToken() {
28
28
  return (0, import_rewire.getEnvValue)("NODE_AUTH_TOKEN");