@socketsecurity/lib 3.5.0 → 4.0.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 +7 -0
- package/README.md +8 -8
- package/dist/agent.js +11 -24
- package/dist/bin.d.ts +97 -40
- package/dist/bin.js +129 -134
- package/dist/cacache.d.ts +5 -2
- package/dist/cacache.js +29 -18
- package/dist/cache-with-ttl.js +1 -1
- package/dist/constants/agents.d.ts +0 -4
- package/dist/constants/agents.js +13 -4
- package/dist/constants/node.d.ts +1 -0
- package/dist/constants/node.js +2 -5
- package/dist/constants/packages.js +22 -10
- package/dist/dlx-binary.js +9 -17
- package/dist/dlx-manifest.js +2 -2
- package/dist/dlx-package.js +22 -62
- package/dist/dlx.js +14 -14
- package/dist/fs.js +19 -24
- package/dist/git.d.ts +6 -6
- package/dist/git.js +11 -14
- package/dist/globs.js +16 -29
- package/dist/ipc.d.ts +4 -4
- package/dist/ipc.js +3 -3
- package/dist/logger.d.ts +0 -25
- package/dist/logger.js +0 -26
- package/dist/package-default-node-range.js +13 -3
- package/dist/package-extensions.d.ts +2 -1
- package/dist/package-extensions.js +12 -2
- package/dist/packages/editable.d.ts +0 -3
- package/dist/packages/editable.js +34 -24
- package/dist/packages/isolation.js +32 -32
- package/dist/packages/licenses.js +18 -32
- package/dist/packages/manifest.js +18 -33
- package/dist/packages/normalize.js +19 -43
- package/dist/packages/operations.js +33 -80
- package/dist/packages/provenance.js +14 -4
- package/dist/packages/specs.js +13 -12
- package/dist/packages/validation.js +12 -10
- package/dist/packages.d.ts +1 -1
- package/dist/packages.js +3 -3
- package/dist/paths/dirnames.d.ts +13 -0
- package/dist/paths/dirnames.js +50 -0
- package/dist/paths/exts.d.ts +18 -0
- package/dist/paths/exts.js +68 -0
- package/dist/paths/filenames.d.ts +16 -0
- package/dist/paths/filenames.js +62 -0
- package/dist/paths/globs.d.ts +10 -0
- package/dist/{argv/quote.js → paths/globs.js} +21 -19
- package/dist/{path.d.ts → paths/normalize.d.ts} +41 -0
- package/dist/{path.js → paths/normalize.js} +17 -4
- package/dist/{packages/paths.js → paths/packages.js} +8 -8
- package/dist/{paths.js → paths/socket.js} +29 -65
- package/dist/sea.js +2 -2
- package/dist/shadow.js +3 -3
- package/dist/sorts.js +12 -2
- package/dist/spawn.d.ts +15 -12
- package/dist/spawn.js +42 -30
- package/dist/spinner.d.ts +2 -6
- package/dist/spinner.js +6 -39
- package/dist/stdio/prompts.d.ts +8 -10
- package/dist/stdio/prompts.js +14 -12
- package/dist/streams.d.ts +0 -4
- package/dist/streams.js +3 -12
- package/dist/temporary-executor.js +3 -3
- package/dist/versions.js +31 -28
- package/package.json +28 -20
- package/dist/argv/quote.d.ts +0 -49
- package/dist/constants/paths.d.ts +0 -51
- package/dist/constants/paths.js +0 -152
- /package/dist/{packages/paths.d.ts → paths/packages.d.ts} +0 -0
- /package/dist/{paths.d.ts → paths/socket.d.ts} +0 -0
|
@@ -17,26 +17,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
var globs_exports = {};
|
|
21
|
+
__export(globs_exports, {
|
|
22
|
+
LICENSE_GLOB: () => LICENSE_GLOB,
|
|
23
|
+
LICENSE_GLOB_RECURSIVE: () => LICENSE_GLOB_RECURSIVE,
|
|
24
|
+
LICENSE_ORIGINAL_GLOB: () => LICENSE_ORIGINAL_GLOB,
|
|
25
|
+
LICENSE_ORIGINAL_GLOB_RECURSIVE: () => LICENSE_ORIGINAL_GLOB_RECURSIVE,
|
|
26
|
+
README_GLOB: () => README_GLOB,
|
|
27
|
+
README_GLOB_RECURSIVE: () => README_GLOB_RECURSIVE
|
|
24
28
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
function win32Quote(arg) {
|
|
33
|
-
if (!/[\s&|<>^%()!"]/.test(arg)) {
|
|
34
|
-
return arg;
|
|
35
|
-
}
|
|
36
|
-
return `"${arg.replace(/"/g, '""')}"`;
|
|
37
|
-
}
|
|
29
|
+
module.exports = __toCommonJS(globs_exports);
|
|
30
|
+
const LICENSE_GLOB = "LICEN[CS]E{[.-]*,}";
|
|
31
|
+
const LICENSE_GLOB_RECURSIVE = "**/LICEN[CS]E{[.-]*,}";
|
|
32
|
+
const LICENSE_ORIGINAL_GLOB = "*.original{.*,}";
|
|
33
|
+
const LICENSE_ORIGINAL_GLOB_RECURSIVE = "**/*.original{.*,}";
|
|
34
|
+
const README_GLOB = "README{.*,}";
|
|
35
|
+
const README_GLOB_RECURSIVE = "**/README{.*,}";
|
|
38
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
37
|
0 && (module.exports = {
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
LICENSE_GLOB,
|
|
39
|
+
LICENSE_GLOB_RECURSIVE,
|
|
40
|
+
LICENSE_ORIGINAL_GLOB,
|
|
41
|
+
LICENSE_ORIGINAL_GLOB_RECURSIVE,
|
|
42
|
+
README_GLOB,
|
|
43
|
+
README_GLOB_RECURSIVE
|
|
42
44
|
});
|
|
@@ -347,3 +347,44 @@ export declare function trimLeadingDotSlash(pathLike: string | Buffer | URL): st
|
|
|
347
347
|
*/
|
|
348
348
|
/*@__NO_SIDE_EFFECTS__*/
|
|
349
349
|
export declare function relativeResolve(from: string, to: string): string;
|
|
350
|
+
/**
|
|
351
|
+
* Convert Windows paths to Unix-style POSIX paths for Git Bash tools.
|
|
352
|
+
*
|
|
353
|
+
* Git for Windows tools (like tar, git, etc.) expect POSIX-style paths with
|
|
354
|
+
* forward slashes and Unix drive letter notation (/c/ instead of C:\).
|
|
355
|
+
* This function handles the conversion for cross-platform compatibility.
|
|
356
|
+
*
|
|
357
|
+
* Conversion rules:
|
|
358
|
+
* - On Windows: Normalizes separators and converts drive letters
|
|
359
|
+
* - `C:\path\to\file` becomes `/c/path/to/file`
|
|
360
|
+
* - `D:/Users/name` becomes `/d/Users/name`
|
|
361
|
+
* - Drive letters are always lowercase in the output
|
|
362
|
+
* - On Unix: Returns the path unchanged (passes through normalization)
|
|
363
|
+
*
|
|
364
|
+
* This is particularly important for:
|
|
365
|
+
* - Git Bash tools that interpret `D:\` as a remote hostname
|
|
366
|
+
* - Cross-platform build scripts using tar, git archive, etc.
|
|
367
|
+
* - CI/CD environments where Git for Windows is used
|
|
368
|
+
*
|
|
369
|
+
* @param {string | Buffer | URL} pathLike - The path to convert
|
|
370
|
+
* @returns {string} Unix-style POSIX path (e.g., `/c/path/to/file`)
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* // Windows drive letter paths
|
|
375
|
+
* toUnixPath('C:\\path\\to\\file.txt') // '/c/path/to/file.txt'
|
|
376
|
+
* toUnixPath('D:/projects/foo/bar') // '/d/projects/foo/bar'
|
|
377
|
+
*
|
|
378
|
+
* // Already forward slashes (still converts drive letter)
|
|
379
|
+
* toUnixPath('C:/Windows/System32') // '/c/Windows/System32'
|
|
380
|
+
*
|
|
381
|
+
* // Unix paths (unchanged on Unix platforms)
|
|
382
|
+
* toUnixPath('/home/user/file') // '/home/user/file'
|
|
383
|
+
* toUnixPath('/var/log/app.log') // '/var/log/app.log'
|
|
384
|
+
*
|
|
385
|
+
* // UNC paths (Windows network shares)
|
|
386
|
+
* toUnixPath('\\\\server\\share\\file') // '//server/share/file'
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
390
|
+
export declare function toUnixPath(pathLike: string | Buffer | URL): string;
|
|
@@ -17,8 +17,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
20
|
+
var normalize_exports = {};
|
|
21
|
+
__export(normalize_exports, {
|
|
22
22
|
isAbsolute: () => isAbsolute,
|
|
23
23
|
isNodeModules: () => isNodeModules,
|
|
24
24
|
isPath: () => isPath,
|
|
@@ -27,11 +27,12 @@ __export(path_exports, {
|
|
|
27
27
|
pathLikeToString: () => pathLikeToString,
|
|
28
28
|
relativeResolve: () => relativeResolve,
|
|
29
29
|
splitPath: () => splitPath,
|
|
30
|
+
toUnixPath: () => toUnixPath,
|
|
30
31
|
trimLeadingDotSlash: () => trimLeadingDotSlash
|
|
31
32
|
});
|
|
32
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(normalize_exports);
|
|
33
34
|
var import_platform = require("#constants/platform");
|
|
34
|
-
var import_strings = require("
|
|
35
|
+
var import_strings = require("../strings");
|
|
35
36
|
const CHAR_BACKWARD_SLASH = 92;
|
|
36
37
|
const CHAR_COLON = 58;
|
|
37
38
|
const CHAR_FORWARD_SLASH = 47;
|
|
@@ -434,6 +435,17 @@ function relativeResolve(from, to) {
|
|
|
434
435
|
}
|
|
435
436
|
return /* @__PURE__ */ normalizePath(rel);
|
|
436
437
|
}
|
|
438
|
+
// @__NO_SIDE_EFFECTS__
|
|
439
|
+
function toUnixPath(pathLike) {
|
|
440
|
+
const normalized = /* @__PURE__ */ normalizePath(pathLike);
|
|
441
|
+
if (import_platform.WIN32) {
|
|
442
|
+
return normalized.replace(
|
|
443
|
+
/^([A-Z]):/i,
|
|
444
|
+
(_, letter) => `/${letter.toLowerCase()}`
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
return normalized;
|
|
448
|
+
}
|
|
437
449
|
// Annotate the CommonJS export names for ESM import in node:
|
|
438
450
|
0 && (module.exports = {
|
|
439
451
|
isAbsolute,
|
|
@@ -444,5 +456,6 @@ function relativeResolve(from, to) {
|
|
|
444
456
|
pathLikeToString,
|
|
445
457
|
relativeResolve,
|
|
446
458
|
splitPath,
|
|
459
|
+
toUnixPath,
|
|
447
460
|
trimLeadingDotSlash
|
|
448
461
|
});
|
|
@@ -17,13 +17,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
20
|
+
var packages_exports = {};
|
|
21
|
+
__export(packages_exports, {
|
|
22
22
|
resolvePackageJsonDirname: () => resolvePackageJsonDirname,
|
|
23
23
|
resolvePackageJsonPath: () => resolvePackageJsonPath
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
-
var
|
|
25
|
+
module.exports = __toCommonJS(packages_exports);
|
|
26
|
+
var import_normalize = require("./normalize");
|
|
27
27
|
let _path;
|
|
28
28
|
// @__NO_SIDE_EFFECTS__
|
|
29
29
|
function getPath() {
|
|
@@ -36,17 +36,17 @@ function getPath() {
|
|
|
36
36
|
function resolvePackageJsonDirname(filepath) {
|
|
37
37
|
if (filepath.endsWith("package.json")) {
|
|
38
38
|
const path = /* @__PURE__ */ getPath();
|
|
39
|
-
return (0,
|
|
39
|
+
return (0, import_normalize.normalizePath)(path.dirname(filepath));
|
|
40
40
|
}
|
|
41
|
-
return (0,
|
|
41
|
+
return (0, import_normalize.normalizePath)(filepath);
|
|
42
42
|
}
|
|
43
43
|
// @__NO_SIDE_EFFECTS__
|
|
44
44
|
function resolvePackageJsonPath(filepath) {
|
|
45
45
|
if (filepath.endsWith("package.json")) {
|
|
46
|
-
return (0,
|
|
46
|
+
return (0, import_normalize.normalizePath)(filepath);
|
|
47
47
|
}
|
|
48
48
|
const path = /* @__PURE__ */ getPath();
|
|
49
|
-
return (0,
|
|
49
|
+
return (0, import_normalize.normalizePath)(path.join(filepath, "package.json"));
|
|
50
50
|
}
|
|
51
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
52
|
0 && (module.exports = {
|
|
@@ -27,8 +27,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var
|
|
31
|
-
__export(
|
|
30
|
+
var socket_exports = {};
|
|
31
|
+
__export(socket_exports, {
|
|
32
32
|
getOsHomeDir: () => getOsHomeDir,
|
|
33
33
|
getOsTmpDir: () => getOsTmpDir,
|
|
34
34
|
getSocketAppCacheDir: () => getSocketAppCacheDir,
|
|
@@ -44,14 +44,17 @@ __export(paths_exports, {
|
|
|
44
44
|
getUserHomeDir: () => getUserHomeDir,
|
|
45
45
|
invalidateCache: () => invalidateCache
|
|
46
46
|
});
|
|
47
|
-
module.exports = __toCommonJS(
|
|
47
|
+
module.exports = __toCommonJS(socket_exports);
|
|
48
48
|
var os = __toESM(require("os"));
|
|
49
49
|
var path = __toESM(require("path"));
|
|
50
|
+
var import_github = require("#constants/github");
|
|
51
|
+
var import_socket = require("#constants/socket");
|
|
50
52
|
var import_home = require("#env/home");
|
|
51
|
-
var
|
|
53
|
+
var import_socket2 = require("#env/socket");
|
|
52
54
|
var import_windows = require("#env/windows");
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
+
var import_dirnames = require("./dirnames");
|
|
56
|
+
var import_normalize = require("./normalize");
|
|
57
|
+
var import_rewire = require("./rewire");
|
|
55
58
|
function getOsHomeDir() {
|
|
56
59
|
return (0, import_rewire.getPathValue)("homedir", () => os.homedir());
|
|
57
60
|
}
|
|
@@ -64,96 +67,57 @@ function getSocketHomePath() {
|
|
|
64
67
|
let _cachedSocketUserDir;
|
|
65
68
|
function getSocketUserDir() {
|
|
66
69
|
if (_cachedSocketUserDir === void 0) {
|
|
67
|
-
_cachedSocketUserDir = (0,
|
|
68
|
-
path.join(
|
|
69
|
-
getUserHomeDir(),
|
|
70
|
-
/*@__INLINE__*/
|
|
71
|
-
require("#constants/paths").DOT_SOCKET_DIR
|
|
72
|
-
)
|
|
70
|
+
_cachedSocketUserDir = (0, import_normalize.normalizePath)(
|
|
71
|
+
path.join(getUserHomeDir(), import_dirnames.DOT_SOCKET_DIR)
|
|
73
72
|
);
|
|
74
73
|
}
|
|
75
74
|
return _cachedSocketUserDir;
|
|
76
75
|
}
|
|
77
76
|
function getSocketAppDir(appName) {
|
|
78
|
-
return (0,
|
|
79
|
-
path.join(
|
|
80
|
-
getSocketUserDir(),
|
|
81
|
-
`${/*@__INLINE__*/
|
|
82
|
-
require("#constants/socket").SOCKET_APP_PREFIX}${appName}`
|
|
83
|
-
)
|
|
77
|
+
return (0, import_normalize.normalizePath)(
|
|
78
|
+
path.join(getSocketUserDir(), `${import_socket.SOCKET_APP_PREFIX}${appName}`)
|
|
84
79
|
);
|
|
85
80
|
}
|
|
86
81
|
let _cachedSocketCacacheDir;
|
|
87
82
|
function getSocketCacacheDir() {
|
|
88
83
|
if (_cachedSocketCacacheDir === void 0) {
|
|
89
|
-
if ((0,
|
|
90
|
-
_cachedSocketCacacheDir = (0,
|
|
91
|
-
(0,
|
|
84
|
+
if ((0, import_socket2.getSocketCacacheDir)()) {
|
|
85
|
+
_cachedSocketCacacheDir = (0, import_normalize.normalizePath)(
|
|
86
|
+
(0, import_socket2.getSocketCacacheDir)()
|
|
92
87
|
);
|
|
93
88
|
} else {
|
|
94
|
-
_cachedSocketCacacheDir = (0,
|
|
95
|
-
path.join(
|
|
96
|
-
getSocketUserDir(),
|
|
97
|
-
`${/*@__INLINE__*/
|
|
98
|
-
require("#constants/socket").SOCKET_APP_PREFIX}cacache`
|
|
99
|
-
)
|
|
89
|
+
_cachedSocketCacacheDir = (0, import_normalize.normalizePath)(
|
|
90
|
+
path.join(getSocketUserDir(), `${import_socket.SOCKET_APP_PREFIX}cacache`)
|
|
100
91
|
);
|
|
101
92
|
}
|
|
102
93
|
}
|
|
103
94
|
return _cachedSocketCacacheDir;
|
|
104
95
|
}
|
|
105
96
|
function getSocketDlxDir() {
|
|
106
|
-
if ((0,
|
|
107
|
-
return (0,
|
|
97
|
+
if ((0, import_socket2.getSocketDlxDirEnv)()) {
|
|
98
|
+
return (0, import_normalize.normalizePath)((0, import_socket2.getSocketDlxDirEnv)());
|
|
108
99
|
}
|
|
109
|
-
return (0,
|
|
110
|
-
path.join(
|
|
111
|
-
getSocketUserDir(),
|
|
112
|
-
`${/*@__INLINE__*/
|
|
113
|
-
require("#constants/socket").SOCKET_APP_PREFIX}${/*@__INLINE__*/
|
|
114
|
-
require("#constants/socket").SOCKET_DLX_APP_NAME}`
|
|
115
|
-
)
|
|
100
|
+
return (0, import_normalize.normalizePath)(
|
|
101
|
+
path.join(getSocketUserDir(), `${import_socket.SOCKET_APP_PREFIX}${import_socket.SOCKET_DLX_APP_NAME}`)
|
|
116
102
|
);
|
|
117
103
|
}
|
|
118
104
|
function getSocketAppCacheDir(appName) {
|
|
119
|
-
return (0,
|
|
120
|
-
path.join(
|
|
121
|
-
getSocketAppDir(appName),
|
|
122
|
-
/*@__INLINE__*/
|
|
123
|
-
require("#constants/paths").CACHE_DIR
|
|
124
|
-
)
|
|
125
|
-
);
|
|
105
|
+
return (0, import_normalize.normalizePath)(path.join(getSocketAppDir(appName), import_dirnames.CACHE_DIR));
|
|
126
106
|
}
|
|
127
107
|
function getSocketAppCacheTtlDir(appName) {
|
|
128
|
-
return (0,
|
|
129
|
-
path.join(
|
|
130
|
-
getSocketAppCacheDir(appName),
|
|
131
|
-
/*@__INLINE__*/
|
|
132
|
-
require("#constants/paths").CACHE_TTL_DIR
|
|
133
|
-
)
|
|
134
|
-
);
|
|
108
|
+
return (0, import_normalize.normalizePath)(path.join(getSocketAppCacheDir(appName), import_dirnames.CACHE_TTL_DIR));
|
|
135
109
|
}
|
|
136
110
|
function getSocketCliDir() {
|
|
137
|
-
return getSocketAppDir(
|
|
138
|
-
/*@__INLINE__*/
|
|
139
|
-
require("#constants/socket").SOCKET_CLI_APP_NAME
|
|
140
|
-
);
|
|
111
|
+
return getSocketAppDir(import_socket.SOCKET_CLI_APP_NAME);
|
|
141
112
|
}
|
|
142
113
|
function getSocketRegistryDir() {
|
|
143
|
-
return getSocketAppDir(
|
|
144
|
-
/*@__INLINE__*/
|
|
145
|
-
require("#constants/socket").SOCKET_REGISTRY_APP_NAME
|
|
146
|
-
);
|
|
114
|
+
return getSocketAppDir(import_socket.SOCKET_REGISTRY_APP_NAME);
|
|
147
115
|
}
|
|
148
116
|
function getSocketRegistryGithubCacheDir() {
|
|
149
|
-
return (0,
|
|
117
|
+
return (0, import_normalize.normalizePath)(
|
|
150
118
|
path.join(
|
|
151
|
-
getSocketAppCacheTtlDir(
|
|
152
|
-
|
|
153
|
-
require("#constants/socket").SOCKET_REGISTRY_APP_NAME
|
|
154
|
-
),
|
|
155
|
-
/*@__INLINE__*/
|
|
156
|
-
require("#constants/github").CACHE_GITHUB_DIR
|
|
119
|
+
getSocketAppCacheTtlDir(import_socket.SOCKET_REGISTRY_APP_NAME),
|
|
120
|
+
import_github.CACHE_GITHUB_DIR
|
|
157
121
|
)
|
|
158
122
|
);
|
|
159
123
|
}
|
package/dist/sea.js
CHANGED
|
@@ -23,10 +23,10 @@ __export(sea_exports, {
|
|
|
23
23
|
isSeaBinary: () => isSeaBinary
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(sea_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_normalize = require("./paths/normalize");
|
|
27
27
|
let _isSea;
|
|
28
28
|
function getSeaBinaryPath() {
|
|
29
|
-
return isSeaBinary() && process.argv[0] ? (0,
|
|
29
|
+
return isSeaBinary() && process.argv[0] ? (0, import_normalize.normalizePath)(process.argv[0]) : void 0;
|
|
30
30
|
}
|
|
31
31
|
function isSeaBinary() {
|
|
32
32
|
if (_isSea === void 0) {
|
package/dist/shadow.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(shadow_exports, {
|
|
|
22
22
|
shouldSkipShadow: () => shouldSkipShadow
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(shadow_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_normalize = require("./paths/normalize");
|
|
26
26
|
function shouldSkipShadow(binPath, options) {
|
|
27
27
|
const { cwd = process.cwd(), win32 = false } = {
|
|
28
28
|
__proto__: null,
|
|
@@ -35,9 +35,9 @@ function shouldSkipShadow(binPath, options) {
|
|
|
35
35
|
if (userAgent?.includes("exec") || userAgent?.includes("npx") || userAgent?.includes("dlx")) {
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
|
-
const normalizedCwd = (0,
|
|
38
|
+
const normalizedCwd = (0, import_normalize.normalizePath)(cwd);
|
|
39
39
|
const npmCache = process.env["npm_config_cache"];
|
|
40
|
-
if (npmCache && normalizedCwd.includes((0,
|
|
40
|
+
if (npmCache && normalizedCwd.includes((0, import_normalize.normalizePath)(npmCache))) {
|
|
41
41
|
return true;
|
|
42
42
|
}
|
|
43
43
|
const tempPatterns = [
|
package/dist/sorts.js
CHANGED
|
@@ -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 sorts_exports = {};
|
|
21
31
|
__export(sorts_exports, {
|
|
@@ -26,6 +36,8 @@ __export(sorts_exports, {
|
|
|
26
36
|
naturalSorter: () => naturalSorter
|
|
27
37
|
});
|
|
28
38
|
module.exports = __toCommonJS(sorts_exports);
|
|
39
|
+
var fastSort = __toESM(require("./external/fast-sort.js"));
|
|
40
|
+
var semver = __toESM(require("./external/semver.js"));
|
|
29
41
|
let _localeCompare;
|
|
30
42
|
// @__NO_SIDE_EFFECTS__
|
|
31
43
|
function localeCompare(x, y) {
|
|
@@ -59,7 +71,6 @@ let _naturalSorter;
|
|
|
59
71
|
// @__NO_SIDE_EFFECTS__
|
|
60
72
|
function naturalSorter(arrayToSort) {
|
|
61
73
|
if (_naturalSorter === void 0) {
|
|
62
|
-
const fastSort = require("./external/fast-sort.js");
|
|
63
74
|
_naturalSorter = fastSort.createNewSortInstance({
|
|
64
75
|
comparer: naturalCompare
|
|
65
76
|
});
|
|
@@ -72,7 +83,6 @@ function compareStr(a, b) {
|
|
|
72
83
|
}
|
|
73
84
|
// @__NO_SIDE_EFFECTS__
|
|
74
85
|
function compareSemver(a, b) {
|
|
75
|
-
const semver = require("./external/semver.js");
|
|
76
86
|
const validA = semver.valid(a);
|
|
77
87
|
const validB = semver.valid(b);
|
|
78
88
|
if (!validA && !validB) {
|
package/dist/spawn.d.ts
CHANGED
|
@@ -4,25 +4,27 @@ type BufferEncoding = globalThis.BufferEncoding;
|
|
|
4
4
|
* Options for spawning a child process with promise-based completion.
|
|
5
5
|
*
|
|
6
6
|
* @property {string | undefined} cwd - Current working directory for the process
|
|
7
|
-
* @property {boolean | undefined} stdioString - Convert stdio output to strings (default: `true`)
|
|
8
|
-
* @property {StdioType | undefined} stdio - Stdio configuration (`'pipe'`, `'ignore'`, `'inherit'`, or array)
|
|
9
7
|
* @property {NodeJS.ProcessEnv | undefined} env - Environment variables for the process
|
|
8
|
+
* @property {number | undefined} gid - Group identity of the process (POSIX only)
|
|
10
9
|
* @property {boolean | string | undefined} shell - Whether to run command in shell, or path to shell
|
|
11
10
|
* @property {AbortSignal | undefined} signal - Signal to abort the process
|
|
11
|
+
* @property {StdioType | undefined} stdio - Stdio configuration (`'pipe'`, `'ignore'`, `'inherit'`, or array)
|
|
12
|
+
* @property {boolean | undefined} stdioString - Convert stdio output to strings (default: `true`)
|
|
12
13
|
* @property {number | undefined} timeout - Maximum time in milliseconds before killing the process
|
|
13
14
|
* @property {number | undefined} uid - User identity of the process (POSIX only)
|
|
14
|
-
* @property {
|
|
15
|
+
* @property {boolean | undefined} windowsVerbatimArguments - Don't quote or escape arguments on Windows (requires shell: true). Use when you need exact argument control. Default: false
|
|
15
16
|
*/
|
|
16
17
|
export type PromiseSpawnOptions = {
|
|
17
18
|
cwd?: string | undefined;
|
|
18
|
-
stdioString?: boolean | undefined;
|
|
19
|
-
stdio?: StdioType | undefined;
|
|
20
19
|
env?: NodeJS.ProcessEnv | undefined;
|
|
20
|
+
gid?: number | undefined;
|
|
21
21
|
shell?: boolean | string | undefined;
|
|
22
22
|
signal?: AbortSignal | undefined;
|
|
23
|
+
stdio?: StdioType | undefined;
|
|
24
|
+
stdioString?: boolean | undefined;
|
|
23
25
|
timeout?: number | undefined;
|
|
24
26
|
uid?: number | undefined;
|
|
25
|
-
|
|
27
|
+
windowsVerbatimArguments?: boolean | undefined;
|
|
26
28
|
};
|
|
27
29
|
/**
|
|
28
30
|
* Result returned by {@link spawn} when the child process completes.
|
|
@@ -266,17 +268,18 @@ interface WritableStreamType {
|
|
|
266
268
|
* Options for spawning a child process with {@link spawn}.
|
|
267
269
|
* Extends Node.js spawn options with additional Socket-specific functionality.
|
|
268
270
|
*
|
|
269
|
-
* @property {import('./spinner').Spinner | undefined} spinner - Spinner instance to pause during execution
|
|
270
|
-
* @property {boolean | undefined} stdioString - Convert output to strings (default: `true`)
|
|
271
|
-
* @property {boolean | undefined} stripAnsi - Remove ANSI codes from output (default: `true`)
|
|
272
271
|
* @property {string | URL | undefined} cwd - Current working directory
|
|
273
272
|
* @property {NodeJS.ProcessEnv | undefined} env - Environment variables
|
|
274
|
-
* @property {
|
|
273
|
+
* @property {number | undefined} gid - Group identity (POSIX)
|
|
275
274
|
* @property {boolean | string | undefined} shell - Run command in shell
|
|
276
|
-
* @property {number | undefined} timeout - Timeout in milliseconds
|
|
277
275
|
* @property {AbortSignal | undefined} signal - Abort signal
|
|
276
|
+
* @property {import('./spinner').Spinner | undefined} spinner - Spinner instance to pause during execution
|
|
277
|
+
* @property {StdioType | undefined} stdio - Stdio configuration
|
|
278
|
+
* @property {boolean | undefined} stdioString - Convert output to strings (default: `true`)
|
|
279
|
+
* @property {boolean | undefined} stripAnsi - Remove ANSI codes from output (default: `true`)
|
|
280
|
+
* @property {number | undefined} timeout - Timeout in milliseconds
|
|
278
281
|
* @property {number | undefined} uid - User identity (POSIX)
|
|
279
|
-
* @property {
|
|
282
|
+
* @property {boolean | undefined} windowsVerbatimArguments - Don't quote or escape arguments on Windows (requires shell: true). Use when you need exact argument control. Default: false
|
|
280
283
|
*/
|
|
281
284
|
export type SpawnOptions = import('./objects').Remap<NodeSpawnOptions & {
|
|
282
285
|
spinner?: import('./spinner').Spinner | undefined;
|
package/dist/spawn.js
CHANGED
|
@@ -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 spawn_exports = {};
|
|
21
31
|
__export(spawn_exports, {
|
|
@@ -26,7 +36,11 @@ __export(spawn_exports, {
|
|
|
26
36
|
});
|
|
27
37
|
module.exports = __toCommonJS(spawn_exports);
|
|
28
38
|
var import_process = require("#constants/process");
|
|
39
|
+
var import_promise_spawn = __toESM(require("./external/@npmcli/promise-spawn"));
|
|
40
|
+
var import_node_path = __toESM(require("node:path"));
|
|
29
41
|
var import_arrays = require("./arrays");
|
|
42
|
+
var import_bin = require("./bin");
|
|
43
|
+
var import_normalize = require("./paths/normalize");
|
|
30
44
|
var import_objects = require("./objects");
|
|
31
45
|
var import_strings = require("./strings");
|
|
32
46
|
const abortSignal = (0, import_process.getAbortSignal)();
|
|
@@ -40,22 +54,6 @@ function getChildProcess() {
|
|
|
40
54
|
}
|
|
41
55
|
return _child_process;
|
|
42
56
|
}
|
|
43
|
-
let _npmCliPromiseSpawn;
|
|
44
|
-
// @__NO_SIDE_EFFECTS__
|
|
45
|
-
function getNpmcliPromiseSpawn() {
|
|
46
|
-
if (_npmCliPromiseSpawn === void 0) {
|
|
47
|
-
_npmCliPromiseSpawn = require("./external/@npmcli/promise-spawn.js");
|
|
48
|
-
}
|
|
49
|
-
return _npmCliPromiseSpawn;
|
|
50
|
-
}
|
|
51
|
-
let _path;
|
|
52
|
-
// @__NO_SIDE_EFFECTS__
|
|
53
|
-
function getPath() {
|
|
54
|
-
if (_path === void 0) {
|
|
55
|
-
_path = require("node:path");
|
|
56
|
-
}
|
|
57
|
-
return _path;
|
|
58
|
-
}
|
|
59
57
|
// @__NO_SIDE_EFFECTS__
|
|
60
58
|
function isSpawnError(value) {
|
|
61
59
|
if (value === null || typeof value !== "object") {
|
|
@@ -85,27 +83,32 @@ function stripAnsiFromSpawnResult(result) {
|
|
|
85
83
|
return res;
|
|
86
84
|
}
|
|
87
85
|
function spawn(cmd, args, options, extra) {
|
|
88
|
-
const shell = (0, import_objects.getOwn)(options, "shell");
|
|
89
|
-
const WIN32 = process.platform === "win32";
|
|
90
|
-
let actualCmd = cmd;
|
|
91
|
-
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
92
|
-
const path = /* @__PURE__ */ getPath();
|
|
93
|
-
actualCmd = path.basename(actualCmd, path.extname(actualCmd));
|
|
94
|
-
}
|
|
95
86
|
const {
|
|
96
87
|
spinner: optionsSpinner = spinner,
|
|
97
88
|
stripAnsi: shouldStripAnsi = true,
|
|
98
|
-
...
|
|
89
|
+
...rawSpawnOptions
|
|
99
90
|
} = { __proto__: null, ...options };
|
|
100
91
|
const spinnerInstance = optionsSpinner;
|
|
101
|
-
const {
|
|
92
|
+
const spawnOptions = { __proto__: null, ...rawSpawnOptions };
|
|
93
|
+
const { env, shell, stdio, stdioString = true } = spawnOptions;
|
|
94
|
+
const cwd = spawnOptions.cwd ? String(spawnOptions.cwd) : void 0;
|
|
95
|
+
let actualCmd = cmd;
|
|
96
|
+
if (!(0, import_normalize.isPath)(cmd)) {
|
|
97
|
+
const resolved = (0, import_bin.whichSync)(cmd, { cwd, nothrow: true });
|
|
98
|
+
if (resolved && typeof resolved === "string") {
|
|
99
|
+
actualCmd = resolved;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const WIN32 = process.platform === "win32";
|
|
103
|
+
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
104
|
+
actualCmd = import_node_path.default.basename(actualCmd, import_node_path.default.extname(actualCmd));
|
|
105
|
+
}
|
|
102
106
|
const wasSpinning = !!spinnerInstance?.isSpinning;
|
|
103
107
|
const shouldStopSpinner = wasSpinning && !/* @__PURE__ */ isStdioType(stdio, "ignore") && !/* @__PURE__ */ isStdioType(stdio, "pipe");
|
|
104
108
|
const shouldRestartSpinner = shouldStopSpinner;
|
|
105
109
|
if (shouldStopSpinner) {
|
|
106
110
|
spinnerInstance.stop();
|
|
107
111
|
}
|
|
108
|
-
const npmCliPromiseSpawn = /* @__PURE__ */ getNpmcliPromiseSpawn();
|
|
109
112
|
const envToUse = env ? {
|
|
110
113
|
__proto__: null,
|
|
111
114
|
...process.env,
|
|
@@ -119,11 +122,12 @@ function spawn(cmd, args, options, extra) {
|
|
|
119
122
|
stdio: spawnOptions.stdio,
|
|
120
123
|
stdioString,
|
|
121
124
|
shell: spawnOptions.shell,
|
|
125
|
+
windowsVerbatimArguments: spawnOptions.windowsVerbatimArguments,
|
|
122
126
|
timeout: spawnOptions.timeout,
|
|
123
127
|
uid: spawnOptions.uid,
|
|
124
128
|
gid: spawnOptions.gid
|
|
125
129
|
};
|
|
126
|
-
const spawnPromise =
|
|
130
|
+
const spawnPromise = (0, import_promise_spawn.default)(
|
|
127
131
|
actualCmd,
|
|
128
132
|
args ? [...args] : [],
|
|
129
133
|
promiseSpawnOpts,
|
|
@@ -163,12 +167,20 @@ function spawn(cmd, args, options, extra) {
|
|
|
163
167
|
return newSpawnPromise;
|
|
164
168
|
}
|
|
165
169
|
function spawnSync(cmd, args, options) {
|
|
170
|
+
let actualCmd = cmd;
|
|
171
|
+
if (!(0, import_normalize.isPath)(cmd)) {
|
|
172
|
+
const resolved = (0, import_bin.whichSync)(cmd, {
|
|
173
|
+
cwd: (0, import_objects.getOwn)(options, "cwd"),
|
|
174
|
+
nothrow: true
|
|
175
|
+
});
|
|
176
|
+
if (resolved && typeof resolved === "string") {
|
|
177
|
+
actualCmd = resolved;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
166
180
|
const shell = (0, import_objects.getOwn)(options, "shell");
|
|
167
181
|
const WIN32 = process.platform === "win32";
|
|
168
|
-
let actualCmd = cmd;
|
|
169
182
|
if (WIN32 && shell && windowsScriptExtRegExp.test(actualCmd)) {
|
|
170
|
-
|
|
171
|
-
actualCmd = path.basename(actualCmd, path.extname(actualCmd));
|
|
183
|
+
actualCmd = import_node_path.default.basename(actualCmd, import_node_path.default.extname(actualCmd));
|
|
172
184
|
}
|
|
173
185
|
const { stripAnsi: shouldStripAnsi = true, ...rawSpawnOptions } = {
|
|
174
186
|
__proto__: null,
|
package/dist/spinner.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import type { ColorInherit, ColorRgb, ColorValue } from './colors';
|
|
|
7
7
|
import type { ShimmerColorGradient, ShimmerConfig, ShimmerDirection, ShimmerState } from './effects/text-shimmer';
|
|
8
8
|
/**
|
|
9
9
|
* Symbol types for status messages.
|
|
10
|
-
* Maps to log symbols: fail (✗), info (ℹ),
|
|
10
|
+
* Maps to log symbols: fail (✗), info (ℹ), skip (↻), success (✓), warn (⚠).
|
|
11
11
|
*/
|
|
12
|
-
export type SymbolType = 'fail' | 'info' | '
|
|
12
|
+
export type SymbolType = 'fail' | 'info' | 'skip' | 'success' | 'warn';
|
|
13
13
|
/**
|
|
14
14
|
* Progress tracking information for display in spinner.
|
|
15
15
|
* Used by `progress()` and `progressStep()` methods to show animated progress bars.
|
|
@@ -101,10 +101,6 @@ export type Spinner = {
|
|
|
101
101
|
progress(current: number, total: number, unit?: string | undefined): Spinner;
|
|
102
102
|
/** Increment progress by specified amount (default: 1) */
|
|
103
103
|
progressStep(amount?: number): Spinner;
|
|
104
|
-
/** Show reasoning (∴) message without stopping the spinner */
|
|
105
|
-
reason(text?: string | undefined, ...extras: unknown[]): Spinner;
|
|
106
|
-
/** Show reasoning (∴) message and stop the spinner, auto-clearing the line */
|
|
107
|
-
reasonAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
|
|
108
104
|
/** Set complete shimmer configuration */
|
|
109
105
|
setShimmer(config: ShimmerConfig): Spinner;
|
|
110
106
|
/** Show skip (↻) message without stopping the spinner */
|