@socketsecurity/lib 5.18.2 → 5.19.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 +43 -0
- package/README.md +6 -5
- package/dist/abort.d.ts +3 -0
- package/dist/abort.js +1 -0
- package/dist/agent.d.ts +66 -49
- package/dist/agent.js +51 -50
- package/dist/ansi.d.ts +2 -5
- package/dist/ansi.js +3 -2
- package/dist/archives.d.ts +25 -21
- package/dist/archives.js +35 -34
- package/dist/argv/flags.d.ts +100 -91
- package/dist/argv/flags.js +88 -87
- package/dist/argv/parse.d.ts +30 -40
- package/dist/argv/parse.js +33 -32
- package/dist/arrays.d.ts +4 -8
- package/dist/arrays.js +1 -0
- package/dist/bin.d.ts +7 -5
- package/dist/bin.js +52 -29
- package/dist/cacache.d.ts +13 -12
- package/dist/cacache.js +9 -8
- package/dist/cache-with-ttl.d.ts +53 -35
- package/dist/cache-with-ttl.js +1 -0
- package/dist/colors.d.ts +5 -5
- package/dist/colors.js +1 -0
- package/dist/constants/agents.d.ts +5 -9
- package/dist/constants/agents.js +3 -2
- package/dist/constants/core.d.ts +5 -10
- package/dist/constants/core.js +2 -1
- package/dist/constants/encoding.d.ts +3 -3
- package/dist/constants/encoding.js +1 -0
- package/dist/constants/github.d.ts +3 -3
- package/dist/constants/github.js +1 -0
- package/dist/constants/licenses.d.ts +9 -2
- package/dist/constants/licenses.js +1 -0
- package/dist/constants/lifecycle-script-names.js +1 -0
- package/dist/constants/maintained-node-versions.d.ts +3 -0
- package/dist/constants/maintained-node-versions.js +1 -0
- package/dist/constants/node.d.ts +125 -16
- package/dist/constants/node.js +74 -73
- package/dist/constants/package-default-node-range.d.ts +3 -1
- package/dist/constants/package-default-node-range.js +2 -1
- package/dist/constants/package-default-socket-categories.d.ts +0 -1
- package/dist/constants/package-default-socket-categories.js +1 -0
- package/dist/constants/packages.d.ts +12 -17
- package/dist/constants/packages.js +31 -16
- package/dist/constants/platform.d.ts +1 -2
- package/dist/constants/platform.js +2 -1
- package/dist/constants/process.d.ts +18 -0
- package/dist/constants/process.js +1 -0
- package/dist/constants/socket.d.ts +4 -10
- package/dist/constants/socket.js +2 -1
- package/dist/constants/testing.d.ts +3 -3
- package/dist/constants/testing.js +1 -0
- package/dist/constants/time.d.ts +3 -4
- package/dist/constants/time.js +1 -0
- package/dist/constants/typescript.d.ts +10 -3
- package/dist/constants/typescript.js +5 -4
- package/dist/cover/code.d.ts +3 -0
- package/dist/cover/code.js +12 -12
- package/dist/cover/formatters.d.ts +12 -9
- package/dist/cover/formatters.js +19 -18
- package/dist/cover/type.d.ts +3 -0
- package/dist/cover/type.js +1 -0
- package/dist/cover/types.js +1 -0
- package/dist/debug.d.ts +32 -47
- package/dist/debug.js +97 -96
- package/dist/dlx/arborist.d.ts +134 -0
- package/dist/dlx/arborist.js +177 -0
- package/dist/dlx/binary.d.ts +25 -9
- package/dist/dlx/binary.js +34 -12
- package/dist/dlx/cache.d.ts +1 -0
- package/dist/dlx/cache.js +2 -1
- package/dist/dlx/detect.d.ts +15 -0
- package/dist/dlx/detect.js +28 -20
- package/dist/dlx/dir.d.ts +1 -11
- package/dist/dlx/dir.js +2 -12
- package/dist/dlx/integrity.d.ts +86 -0
- package/dist/dlx/integrity.js +112 -0
- package/dist/dlx/lockfile.d.ts +115 -0
- package/dist/dlx/lockfile.js +139 -0
- package/dist/dlx/manifest.d.ts +26 -1
- package/dist/dlx/manifest.js +9 -6
- package/dist/dlx/package.d.ts +58 -3
- package/dist/dlx/package.js +101 -74
- package/dist/dlx/packages.d.ts +1 -11
- package/dist/dlx/packages.js +3 -14
- package/dist/dlx/paths.d.ts +1 -0
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +1 -0
- package/dist/effects/text-shimmer.d.ts +13 -2
- package/dist/effects/text-shimmer.js +50 -46
- package/dist/effects/types.js +1 -0
- package/dist/effects/ultra.js +1 -0
- package/dist/env/ci.d.ts +6 -1
- package/dist/env/ci.js +1 -0
- package/dist/env/debug.d.ts +5 -1
- package/dist/env/debug.js +1 -0
- package/dist/env/github.d.ts +19 -23
- package/dist/env/github.js +5 -4
- package/dist/env/helpers.d.ts +21 -9
- package/dist/env/helpers.js +5 -11
- package/dist/env/home.d.ts +17 -4
- package/dist/env/home.js +2 -1
- package/dist/env/locale.d.ts +4 -3
- package/dist/env/locale.js +1 -0
- package/dist/env/node-auth-token.d.ts +5 -1
- package/dist/env/node-auth-token.js +1 -0
- package/dist/env/node-env.d.ts +5 -1
- package/dist/env/node-env.js +1 -0
- package/dist/env/npm.d.ts +4 -5
- package/dist/env/npm.js +1 -0
- package/dist/env/package-manager.d.ts +4 -3
- package/dist/env/package-manager.js +2 -1
- package/dist/env/path.d.ts +5 -1
- package/dist/env/path.js +1 -0
- package/dist/env/pre-commit.d.ts +5 -1
- package/dist/env/pre-commit.js +1 -0
- package/dist/env/rewire.d.ts +10 -0
- package/dist/env/rewire.js +7 -5
- package/dist/env/shell.d.ts +5 -1
- package/dist/env/shell.js +1 -0
- package/dist/env/socket-cli-shadow.d.ts +4 -5
- package/dist/env/socket-cli-shadow.js +1 -0
- package/dist/env/socket-cli.d.ts +4 -14
- package/dist/env/socket-cli.js +1 -0
- package/dist/env/socket.d.ts +6 -18
- package/dist/env/socket.js +4 -3
- package/dist/env/temp-dir.d.ts +4 -3
- package/dist/env/temp-dir.js +1 -0
- package/dist/env/term.d.ts +5 -1
- package/dist/env/term.js +1 -0
- package/dist/env/test.d.ts +4 -3
- package/dist/env/test.js +1 -0
- package/dist/env/windows.d.ts +4 -4
- package/dist/env/windows.js +1 -0
- package/dist/env/xdg.d.ts +4 -3
- package/dist/env/xdg.js +1 -0
- package/dist/env.d.ts +83 -23
- package/dist/env.js +112 -80
- package/dist/errors.js +1 -0
- package/dist/external/@npmcli/package-json.js +9 -3968
- package/dist/external/@socketregistry/packageurl-js.js +2 -2
- package/dist/external/debug.js +162 -328
- package/dist/external/external-pack.js +3 -2835
- package/dist/external/npm-pack.js +13939 -33342
- package/dist/external/zod.js +160 -7558
- package/dist/fs.d.ts +92 -113
- package/dist/fs.js +35 -35
- package/dist/git.d.ts +170 -164
- package/dist/git.js +113 -87
- package/dist/github.d.ts +249 -227
- package/dist/github.js +82 -81
- package/dist/globs.d.ts +31 -17
- package/dist/globs.js +51 -58
- package/dist/http-request.d.ts +99 -99
- package/dist/http-request.js +182 -156
- package/dist/ipc-cli.d.ts +28 -0
- package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
- package/dist/ipc.d.ts +9 -299
- package/dist/ipc.js +18 -204
- package/dist/json/edit.d.ts +3 -1
- package/dist/json/edit.js +30 -30
- package/dist/json/format.d.ts +36 -36
- package/dist/json/format.js +22 -21
- package/dist/json/parse.d.ts +4 -2
- package/dist/json/parse.js +1 -0
- package/dist/json/types.js +1 -0
- package/dist/{links/index.d.ts → links.d.ts} +6 -2
- package/dist/{links/index.js → links.js} +5 -4
- package/dist/logger.d.ts +4 -6
- package/dist/logger.js +61 -53
- package/dist/memoization.d.ts +52 -49
- package/dist/memoization.js +55 -33
- package/dist/objects.d.ts +25 -44
- package/dist/objects.js +2 -1
- package/dist/package-extensions.d.ts +6 -0
- package/dist/package-extensions.js +2 -1
- package/dist/packages/edit.d.ts +3 -5
- package/dist/packages/edit.js +4 -3
- package/dist/packages/exports.d.ts +11 -14
- package/dist/packages/exports.js +11 -10
- package/dist/packages/isolation.d.ts +4 -0
- package/dist/packages/isolation.js +20 -19
- package/dist/packages/licenses.d.ts +3 -10
- package/dist/packages/licenses.js +2 -1
- package/dist/packages/manifest.d.ts +3 -3
- package/dist/packages/manifest.js +1 -0
- package/dist/packages/normalize.d.ts +3 -4
- package/dist/packages/normalize.js +1 -0
- package/dist/packages/operations.d.ts +3 -10
- package/dist/packages/operations.js +1 -0
- package/dist/packages/provenance.d.ts +10 -8
- package/dist/packages/provenance.js +55 -54
- package/dist/packages/specs.d.ts +3 -5
- package/dist/packages/specs.js +1 -0
- package/dist/packages/validation.d.ts +3 -3
- package/dist/packages/validation.js +1 -0
- package/dist/packages.d.ts +2 -17
- package/dist/packages.js +2 -1
- package/dist/paths/dirnames.d.ts +0 -2
- package/dist/paths/dirnames.js +1 -0
- package/dist/paths/exts.d.ts +0 -1
- package/dist/paths/exts.js +1 -0
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +1 -0
- package/dist/paths/globs.d.ts +0 -1
- package/dist/paths/globs.js +1 -0
- package/dist/paths/normalize.d.ts +115 -123
- package/dist/paths/normalize.js +128 -127
- package/dist/paths/packages.d.ts +3 -2
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.d.ts +9 -0
- package/dist/paths/rewire.js +5 -3
- package/dist/paths/socket.d.ts +37 -23
- package/dist/paths/socket.js +26 -25
- package/dist/performance.d.ts +87 -84
- package/dist/performance.js +97 -96
- package/dist/process-lock.d.ts +41 -1
- package/dist/process-lock.js +24 -17
- package/dist/promise-queue.d.ts +6 -0
- package/dist/promise-queue.js +1 -0
- package/dist/promises.d.ts +40 -55
- package/dist/promises.js +12 -11
- package/dist/regexps.d.ts +0 -5
- package/dist/regexps.js +1 -0
- package/dist/releases/github.d.ts +59 -63
- package/dist/releases/github.js +95 -100
- package/dist/releases/socket-btm.d.ts +9 -2
- package/dist/releases/socket-btm.js +32 -25
- package/dist/sea.d.ts +5 -0
- package/dist/sea.js +1 -0
- package/dist/shadow.d.ts +4 -0
- package/dist/shadow.js +1 -0
- package/dist/signal-exit.d.ts +7 -7
- package/dist/signal-exit.js +46 -45
- package/dist/sorts.d.ts +5 -7
- package/dist/sorts.js +11 -10
- package/dist/spawn.d.ts +96 -77
- package/dist/spawn.js +39 -38
- package/dist/spinner.d.ts +21 -22
- package/dist/spinner.js +15 -11
- package/dist/ssri.d.ts +31 -36
- package/dist/ssri.js +15 -14
- package/dist/stdio/_stream.d.ts +31 -0
- package/dist/stdio/_stream.js +57 -0
- package/dist/stdio/divider.d.ts +40 -36
- package/dist/stdio/divider.js +10 -9
- package/dist/stdio/footer.d.ts +20 -0
- package/dist/stdio/footer.js +12 -2
- package/dist/stdio/header.d.ts +4 -16
- package/dist/stdio/header.js +1 -9
- package/dist/stdio/stderr.d.ts +51 -39
- package/dist/stdio/stderr.js +19 -22
- package/dist/stdio/stdout.d.ts +54 -52
- package/dist/stdio/stdout.js +35 -33
- package/dist/streams.d.ts +4 -3
- package/dist/streams.js +1 -0
- package/dist/strings.d.ts +31 -85
- package/dist/strings.js +5 -49
- package/dist/suppress-warnings.d.ts +32 -15
- package/dist/suppress-warnings.js +14 -13
- package/dist/tables.d.ts +30 -26
- package/dist/tables.js +24 -23
- package/dist/temporary-executor.d.ts +4 -0
- package/dist/temporary-executor.js +1 -0
- package/dist/themes/context.d.ts +30 -26
- package/dist/themes/context.js +19 -18
- package/dist/themes/index.d.ts +0 -4
- package/dist/themes/index.js +1 -0
- package/dist/themes/themes.d.ts +1 -1
- package/dist/themes/themes.js +1 -0
- package/dist/themes/types.js +1 -0
- package/dist/themes/utils.d.ts +46 -43
- package/dist/themes/utils.js +45 -44
- package/dist/types.d.ts +48 -52
- package/dist/types.js +35 -35
- package/dist/url.d.ts +48 -53
- package/dist/url.js +38 -37
- package/dist/validation/json-parser.d.ts +19 -190
- package/dist/validation/json-parser.js +5 -69
- package/dist/validation/types.d.ts +9 -33
- package/dist/validation/types.js +1 -0
- package/dist/versions.d.ts +1 -0
- package/dist/versions.js +2 -1
- package/dist/words.d.ts +3 -6
- package/dist/words.js +1 -0
- package/dist/zod.js +1 -0
- package/package.json +34 -66
- package/dist/external/@inquirer/checkbox.js +0 -5
- package/dist/external/@inquirer/confirm.js +0 -5
- package/dist/external/@inquirer/input.js +0 -5
- package/dist/external/@inquirer/password.js +0 -5
- package/dist/external/@inquirer/search.js +0 -5
- package/dist/external/@inquirer/select.js +0 -5
- package/dist/functions.d.ts +0 -57
- package/dist/functions.js +0 -70
- package/dist/stdio/clear.d.ts +0 -140
- package/dist/stdio/clear.js +0 -95
- package/dist/stdio/mask.d.ts +0 -151
- package/dist/stdio/mask.js +0 -224
- package/dist/stdio/progress.d.ts +0 -148
- package/dist/stdio/progress.js +0 -212
- package/dist/stdio/prompts.d.ts +0 -195
- package/dist/stdio/prompts.js +0 -176
- package/dist/utils/get-ipc.d.ts +0 -15
package/dist/argv/flags.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Common flag utilities for Socket CLI applications.
|
|
3
|
+
* Provides consistent flag checking (quiet, silent, verbose, debug, dry-run,
|
|
4
|
+
* etc.) across Socket projects, accepting either parsed flag objects or raw
|
|
5
|
+
* argv arrays.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Flag values object from parsed arguments.
|
|
9
|
+
*/
|
|
1
10
|
export interface FlagValues {
|
|
2
11
|
[key: string]: unknown;
|
|
3
12
|
quiet?: boolean;
|
|
@@ -22,6 +31,97 @@ export interface FlagValues {
|
|
|
22
31
|
* Can be parsed flag values, process.argv array, or undefined (uses process.argv).
|
|
23
32
|
*/
|
|
24
33
|
export type FlagInput = FlagValues | string[] | readonly string[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Common flag definitions for parseArgs configuration.
|
|
36
|
+
* Can be spread into parseArgs options for consistency.
|
|
37
|
+
*/
|
|
38
|
+
export declare const COMMON_FLAGS: {
|
|
39
|
+
all: {
|
|
40
|
+
type: 'boolean';
|
|
41
|
+
default: boolean;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
changed: {
|
|
45
|
+
type: 'boolean';
|
|
46
|
+
default: boolean;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
coverage: {
|
|
50
|
+
type: 'boolean';
|
|
51
|
+
default: boolean;
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
cover: {
|
|
55
|
+
type: 'boolean';
|
|
56
|
+
default: boolean;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
debug: {
|
|
60
|
+
type: 'boolean';
|
|
61
|
+
default: boolean;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
'dry-run': {
|
|
65
|
+
type: 'boolean';
|
|
66
|
+
default: boolean;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
fix: {
|
|
70
|
+
type: 'boolean';
|
|
71
|
+
default: boolean;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
force: {
|
|
75
|
+
type: 'boolean';
|
|
76
|
+
default: boolean;
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
help: {
|
|
80
|
+
type: 'boolean';
|
|
81
|
+
default: boolean;
|
|
82
|
+
short: string;
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
json: {
|
|
86
|
+
type: 'boolean';
|
|
87
|
+
default: boolean;
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
quiet: {
|
|
91
|
+
type: 'boolean';
|
|
92
|
+
default: boolean;
|
|
93
|
+
short: string;
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
silent: {
|
|
97
|
+
type: 'boolean';
|
|
98
|
+
default: boolean;
|
|
99
|
+
description: string;
|
|
100
|
+
};
|
|
101
|
+
staged: {
|
|
102
|
+
type: 'boolean';
|
|
103
|
+
default: boolean;
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
update: {
|
|
107
|
+
type: 'boolean';
|
|
108
|
+
default: boolean;
|
|
109
|
+
short: string;
|
|
110
|
+
description: string;
|
|
111
|
+
};
|
|
112
|
+
verbose: {
|
|
113
|
+
type: 'boolean';
|
|
114
|
+
default: boolean;
|
|
115
|
+
short: string;
|
|
116
|
+
description: string;
|
|
117
|
+
};
|
|
118
|
+
watch: {
|
|
119
|
+
type: 'boolean';
|
|
120
|
+
default: boolean;
|
|
121
|
+
short: string;
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
25
125
|
/**
|
|
26
126
|
* Get the appropriate log level based on flags.
|
|
27
127
|
* Returns 'silent', 'error', 'warn', 'info', 'verbose', or 'debug'.
|
|
@@ -190,94 +290,3 @@ export declare function isVerbose(input?: FlagInput): boolean;
|
|
|
190
290
|
* ```
|
|
191
291
|
*/
|
|
192
292
|
export declare function isWatch(input?: FlagInput): boolean;
|
|
193
|
-
/**
|
|
194
|
-
* Common flag definitions for parseArgs configuration.
|
|
195
|
-
* Can be spread into parseArgs options for consistency.
|
|
196
|
-
*/
|
|
197
|
-
export declare const COMMON_FLAGS: {
|
|
198
|
-
all: {
|
|
199
|
-
type: "boolean";
|
|
200
|
-
default: boolean;
|
|
201
|
-
description: string;
|
|
202
|
-
};
|
|
203
|
-
changed: {
|
|
204
|
-
type: "boolean";
|
|
205
|
-
default: boolean;
|
|
206
|
-
description: string;
|
|
207
|
-
};
|
|
208
|
-
coverage: {
|
|
209
|
-
type: "boolean";
|
|
210
|
-
default: boolean;
|
|
211
|
-
description: string;
|
|
212
|
-
};
|
|
213
|
-
cover: {
|
|
214
|
-
type: "boolean";
|
|
215
|
-
default: boolean;
|
|
216
|
-
description: string;
|
|
217
|
-
};
|
|
218
|
-
debug: {
|
|
219
|
-
type: "boolean";
|
|
220
|
-
default: boolean;
|
|
221
|
-
description: string;
|
|
222
|
-
};
|
|
223
|
-
"dry-run": {
|
|
224
|
-
type: "boolean";
|
|
225
|
-
default: boolean;
|
|
226
|
-
description: string;
|
|
227
|
-
};
|
|
228
|
-
fix: {
|
|
229
|
-
type: "boolean";
|
|
230
|
-
default: boolean;
|
|
231
|
-
description: string;
|
|
232
|
-
};
|
|
233
|
-
force: {
|
|
234
|
-
type: "boolean";
|
|
235
|
-
default: boolean;
|
|
236
|
-
description: string;
|
|
237
|
-
};
|
|
238
|
-
help: {
|
|
239
|
-
type: "boolean";
|
|
240
|
-
default: boolean;
|
|
241
|
-
short: string;
|
|
242
|
-
description: string;
|
|
243
|
-
};
|
|
244
|
-
json: {
|
|
245
|
-
type: "boolean";
|
|
246
|
-
default: boolean;
|
|
247
|
-
description: string;
|
|
248
|
-
};
|
|
249
|
-
quiet: {
|
|
250
|
-
type: "boolean";
|
|
251
|
-
default: boolean;
|
|
252
|
-
short: string;
|
|
253
|
-
description: string;
|
|
254
|
-
};
|
|
255
|
-
silent: {
|
|
256
|
-
type: "boolean";
|
|
257
|
-
default: boolean;
|
|
258
|
-
description: string;
|
|
259
|
-
};
|
|
260
|
-
staged: {
|
|
261
|
-
type: "boolean";
|
|
262
|
-
default: boolean;
|
|
263
|
-
description: string;
|
|
264
|
-
};
|
|
265
|
-
update: {
|
|
266
|
-
type: "boolean";
|
|
267
|
-
default: boolean;
|
|
268
|
-
short: string;
|
|
269
|
-
description: string;
|
|
270
|
-
};
|
|
271
|
-
verbose: {
|
|
272
|
-
type: "boolean";
|
|
273
|
-
default: boolean;
|
|
274
|
-
short: string;
|
|
275
|
-
description: string;
|
|
276
|
-
};
|
|
277
|
-
watch: {
|
|
278
|
-
type: "boolean";
|
|
279
|
-
default: boolean;
|
|
280
|
-
short: string;
|
|
281
|
-
description: string;
|
|
282
|
-
};
|
|
283
|
-
};
|
package/dist/argv/flags.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -49,6 +50,93 @@ __export(flags_exports, {
|
|
|
49
50
|
module.exports = __toCommonJS(flags_exports);
|
|
50
51
|
var import_node_process = __toESM(require("node:process"));
|
|
51
52
|
const processArg = [...import_node_process.default.argv];
|
|
53
|
+
const COMMON_FLAGS = {
|
|
54
|
+
all: {
|
|
55
|
+
type: "boolean",
|
|
56
|
+
default: false,
|
|
57
|
+
description: "Target all files"
|
|
58
|
+
},
|
|
59
|
+
changed: {
|
|
60
|
+
type: "boolean",
|
|
61
|
+
default: false,
|
|
62
|
+
description: "Target changed files"
|
|
63
|
+
},
|
|
64
|
+
coverage: {
|
|
65
|
+
type: "boolean",
|
|
66
|
+
default: false,
|
|
67
|
+
description: "Run with coverage"
|
|
68
|
+
},
|
|
69
|
+
cover: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
default: false,
|
|
72
|
+
description: "Run with coverage (alias)"
|
|
73
|
+
},
|
|
74
|
+
debug: {
|
|
75
|
+
type: "boolean",
|
|
76
|
+
default: false,
|
|
77
|
+
description: "Enable debug output"
|
|
78
|
+
},
|
|
79
|
+
"dry-run": {
|
|
80
|
+
type: "boolean",
|
|
81
|
+
default: false,
|
|
82
|
+
description: "Perform a dry run"
|
|
83
|
+
},
|
|
84
|
+
fix: {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
default: false,
|
|
87
|
+
description: "Automatically fix issues"
|
|
88
|
+
},
|
|
89
|
+
force: {
|
|
90
|
+
type: "boolean",
|
|
91
|
+
default: false,
|
|
92
|
+
description: "Force the operation"
|
|
93
|
+
},
|
|
94
|
+
help: {
|
|
95
|
+
type: "boolean",
|
|
96
|
+
default: false,
|
|
97
|
+
short: "h",
|
|
98
|
+
description: "Show help"
|
|
99
|
+
},
|
|
100
|
+
json: {
|
|
101
|
+
type: "boolean",
|
|
102
|
+
default: false,
|
|
103
|
+
description: "Output as JSON"
|
|
104
|
+
},
|
|
105
|
+
quiet: {
|
|
106
|
+
type: "boolean",
|
|
107
|
+
default: false,
|
|
108
|
+
short: "q",
|
|
109
|
+
description: "Suppress output"
|
|
110
|
+
},
|
|
111
|
+
silent: {
|
|
112
|
+
type: "boolean",
|
|
113
|
+
default: false,
|
|
114
|
+
description: "Suppress all output"
|
|
115
|
+
},
|
|
116
|
+
staged: {
|
|
117
|
+
type: "boolean",
|
|
118
|
+
default: false,
|
|
119
|
+
description: "Target staged files"
|
|
120
|
+
},
|
|
121
|
+
update: {
|
|
122
|
+
type: "boolean",
|
|
123
|
+
default: false,
|
|
124
|
+
short: "u",
|
|
125
|
+
description: "Update snapshots/deps"
|
|
126
|
+
},
|
|
127
|
+
verbose: {
|
|
128
|
+
type: "boolean",
|
|
129
|
+
default: false,
|
|
130
|
+
short: "v",
|
|
131
|
+
description: "Verbose output"
|
|
132
|
+
},
|
|
133
|
+
watch: {
|
|
134
|
+
type: "boolean",
|
|
135
|
+
default: false,
|
|
136
|
+
short: "w",
|
|
137
|
+
description: "Watch mode"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
52
140
|
function getLogLevel(input) {
|
|
53
141
|
if (isQuiet(input)) {
|
|
54
142
|
return "silent";
|
|
@@ -187,93 +275,6 @@ function isWatch(input) {
|
|
|
187
275
|
}
|
|
188
276
|
return !!input.watch;
|
|
189
277
|
}
|
|
190
|
-
const COMMON_FLAGS = {
|
|
191
|
-
all: {
|
|
192
|
-
type: "boolean",
|
|
193
|
-
default: false,
|
|
194
|
-
description: "Target all files"
|
|
195
|
-
},
|
|
196
|
-
changed: {
|
|
197
|
-
type: "boolean",
|
|
198
|
-
default: false,
|
|
199
|
-
description: "Target changed files"
|
|
200
|
-
},
|
|
201
|
-
coverage: {
|
|
202
|
-
type: "boolean",
|
|
203
|
-
default: false,
|
|
204
|
-
description: "Run with coverage"
|
|
205
|
-
},
|
|
206
|
-
cover: {
|
|
207
|
-
type: "boolean",
|
|
208
|
-
default: false,
|
|
209
|
-
description: "Run with coverage (alias)"
|
|
210
|
-
},
|
|
211
|
-
debug: {
|
|
212
|
-
type: "boolean",
|
|
213
|
-
default: false,
|
|
214
|
-
description: "Enable debug output"
|
|
215
|
-
},
|
|
216
|
-
"dry-run": {
|
|
217
|
-
type: "boolean",
|
|
218
|
-
default: false,
|
|
219
|
-
description: "Perform a dry run"
|
|
220
|
-
},
|
|
221
|
-
fix: {
|
|
222
|
-
type: "boolean",
|
|
223
|
-
default: false,
|
|
224
|
-
description: "Automatically fix issues"
|
|
225
|
-
},
|
|
226
|
-
force: {
|
|
227
|
-
type: "boolean",
|
|
228
|
-
default: false,
|
|
229
|
-
description: "Force the operation"
|
|
230
|
-
},
|
|
231
|
-
help: {
|
|
232
|
-
type: "boolean",
|
|
233
|
-
default: false,
|
|
234
|
-
short: "h",
|
|
235
|
-
description: "Show help"
|
|
236
|
-
},
|
|
237
|
-
json: {
|
|
238
|
-
type: "boolean",
|
|
239
|
-
default: false,
|
|
240
|
-
description: "Output as JSON"
|
|
241
|
-
},
|
|
242
|
-
quiet: {
|
|
243
|
-
type: "boolean",
|
|
244
|
-
default: false,
|
|
245
|
-
short: "q",
|
|
246
|
-
description: "Suppress output"
|
|
247
|
-
},
|
|
248
|
-
silent: {
|
|
249
|
-
type: "boolean",
|
|
250
|
-
default: false,
|
|
251
|
-
description: "Suppress all output"
|
|
252
|
-
},
|
|
253
|
-
staged: {
|
|
254
|
-
type: "boolean",
|
|
255
|
-
default: false,
|
|
256
|
-
description: "Target staged files"
|
|
257
|
-
},
|
|
258
|
-
update: {
|
|
259
|
-
type: "boolean",
|
|
260
|
-
default: false,
|
|
261
|
-
short: "u",
|
|
262
|
-
description: "Update snapshots/deps"
|
|
263
|
-
},
|
|
264
|
-
verbose: {
|
|
265
|
-
type: "boolean",
|
|
266
|
-
default: false,
|
|
267
|
-
short: "v",
|
|
268
|
-
description: "Verbose output"
|
|
269
|
-
},
|
|
270
|
-
watch: {
|
|
271
|
-
type: "boolean",
|
|
272
|
-
default: false,
|
|
273
|
-
short: "w",
|
|
274
|
-
description: "Watch mode"
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
278
|
// Annotate the CommonJS export names for ESM import in node:
|
|
278
279
|
0 && (module.exports = {
|
|
279
280
|
COMMON_FLAGS,
|
package/dist/argv/parse.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Argument parsing utilities for CLI applications.
|
|
3
|
+
* Wraps the vendored yargs-parser with a Node.js parseArgs-compatible surface
|
|
4
|
+
* for booleans, strings, arrays, aliases, defaults, and coercion.
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* Yargs parser result interface.
|
|
3
8
|
*/
|
|
@@ -9,47 +14,57 @@ interface YargsArguments extends Record<string, unknown> {
|
|
|
9
14
|
* Options for configuring argument parsing, similar to Node.js util.parseArgs.
|
|
10
15
|
*/
|
|
11
16
|
export interface ParseArgsOptionsConfig {
|
|
12
|
-
// Whether the option accepts multiple values (array).
|
|
13
17
|
multiple?: boolean | undefined;
|
|
14
|
-
// Short alias for the option (single character).
|
|
15
18
|
short?: string | undefined;
|
|
16
|
-
// Type of the option value.
|
|
17
19
|
type?: 'boolean' | 'string' | undefined;
|
|
18
|
-
// Default value for the option.
|
|
19
20
|
default?: unknown | undefined;
|
|
20
|
-
// Transform function to coerce parsed values.
|
|
21
21
|
coerce?: (value: unknown) => unknown | undefined;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Configuration object for parseArgs function, similar to Node.js util.parseArgs.
|
|
25
25
|
*/
|
|
26
26
|
export interface ParseArgsConfig {
|
|
27
|
-
// Command-line arguments to parse (defaults to process.argv.slice(2)).
|
|
28
27
|
args?: readonly string[] | undefined;
|
|
29
|
-
// Options configuration object.
|
|
30
28
|
options?: Record<string, ParseArgsOptionsConfig> | undefined;
|
|
31
|
-
// Whether to throw on unknown options (default: true).
|
|
32
29
|
strict?: boolean | undefined;
|
|
33
|
-
// Whether to populate tokens array (not implemented, for API compatibility).
|
|
34
30
|
tokens?: boolean | undefined;
|
|
35
|
-
// Whether to allow positional arguments after options.
|
|
36
31
|
allowPositionals?: boolean | undefined;
|
|
37
|
-
// Whether to allow negative numbers as option values.
|
|
38
32
|
allowNegative?: boolean | undefined;
|
|
39
|
-
// Advanced yargs-parser configuration passthrough.
|
|
40
33
|
configuration?: Record<string, boolean | string> | undefined;
|
|
41
34
|
}
|
|
42
35
|
/**
|
|
43
36
|
* Result of parsing command-line arguments.
|
|
44
37
|
*/
|
|
45
38
|
export interface ParsedArgs<T = Record<string, unknown>> {
|
|
46
|
-
// Parsed option values.
|
|
47
39
|
values: T;
|
|
48
|
-
// Positional arguments (non-option arguments).
|
|
49
40
|
positionals: string[];
|
|
50
|
-
// Raw parsed arguments object from yargs-parser.
|
|
51
41
|
raw: YargsArguments;
|
|
52
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Common parseArgs configuration for Socket registry scripts.
|
|
45
|
+
*/
|
|
46
|
+
export declare const commonParseArgsConfig: ParseArgsConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Extract positional arguments from process.argv.
|
|
49
|
+
* Useful for commands that accept file paths or other positional parameters.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* // process.argv = ["node", "script.js", "src", "lib", "--verbose"]
|
|
54
|
+
* getPositionalArgs() // ["src", "lib"]
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function getPositionalArgs(startIndex?: number): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Check if a specific flag is present in argv.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* hasFlag('verbose') // true if --verbose is in process.argv
|
|
64
|
+
* hasFlag('force', ['--force', '--quiet']) // true
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function hasFlag(flag: string, argv?: string[]): boolean;
|
|
53
68
|
/**
|
|
54
69
|
* Parse command-line arguments with a Node.js parseArgs-compatible API.
|
|
55
70
|
* Uses yargs-parser internally for robust argument parsing.
|
|
@@ -79,29 +94,4 @@ export declare function parseArgs<T = Record<string, unknown>>(config?: ParseArg
|
|
|
79
94
|
* ```
|
|
80
95
|
*/
|
|
81
96
|
export declare function parseArgsWithDefaults<T = Record<string, unknown>>(config?: ParseArgsConfig): ParsedArgs<T>;
|
|
82
|
-
/**
|
|
83
|
-
* Common parseArgs configuration for Socket registry scripts.
|
|
84
|
-
*/
|
|
85
|
-
export declare const commonParseArgsConfig: ParseArgsConfig;
|
|
86
|
-
/**
|
|
87
|
-
* Extract positional arguments from process.argv.
|
|
88
|
-
* Useful for commands that accept file paths or other positional parameters.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```typescript
|
|
92
|
-
* // process.argv = ["node", "script.js", "src", "lib", "--verbose"]
|
|
93
|
-
* getPositionalArgs() // ["src", "lib"]
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export declare function getPositionalArgs(startIndex?: number): string[];
|
|
97
|
-
/**
|
|
98
|
-
* Check if a specific flag is present in argv.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```typescript
|
|
102
|
-
* hasFlag('verbose') // true if --verbose is in process.argv
|
|
103
|
-
* hasFlag('force', ['--force', '--quiet']) // true
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export declare function hasFlag(flag: string, argv?: string[]): boolean;
|
|
107
97
|
export {};
|
package/dist/argv/parse.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -38,6 +39,38 @@ __export(parse_exports, {
|
|
|
38
39
|
module.exports = __toCommonJS(parse_exports);
|
|
39
40
|
var import_node_process = __toESM(require("node:process"));
|
|
40
41
|
var import_yargs_parser = __toESM(require("../external/yargs-parser"));
|
|
42
|
+
const commonParseArgsConfig = {
|
|
43
|
+
options: {
|
|
44
|
+
force: {
|
|
45
|
+
type: "boolean",
|
|
46
|
+
short: "f",
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
quiet: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
short: "q",
|
|
52
|
+
default: false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
strict: false
|
|
56
|
+
};
|
|
57
|
+
function getPositionalArgs(startIndex = 2) {
|
|
58
|
+
const args = import_node_process.default.argv.slice(startIndex);
|
|
59
|
+
const positionals = [];
|
|
60
|
+
let i = 0;
|
|
61
|
+
while (i < args.length) {
|
|
62
|
+
const arg = args[i];
|
|
63
|
+
if (arg.startsWith("-")) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
positionals.push(arg);
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
return positionals;
|
|
70
|
+
}
|
|
71
|
+
function hasFlag(flag, argv = import_node_process.default.argv) {
|
|
72
|
+
return argv.includes(`--${flag}`);
|
|
73
|
+
}
|
|
41
74
|
function parseArgs(config = {}) {
|
|
42
75
|
const {
|
|
43
76
|
allowNegative = false,
|
|
@@ -127,38 +160,6 @@ function parseArgsWithDefaults(config = {}) {
|
|
|
127
160
|
...config
|
|
128
161
|
});
|
|
129
162
|
}
|
|
130
|
-
const commonParseArgsConfig = {
|
|
131
|
-
options: {
|
|
132
|
-
force: {
|
|
133
|
-
type: "boolean",
|
|
134
|
-
short: "f",
|
|
135
|
-
default: false
|
|
136
|
-
},
|
|
137
|
-
quiet: {
|
|
138
|
-
type: "boolean",
|
|
139
|
-
short: "q",
|
|
140
|
-
default: false
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
strict: false
|
|
144
|
-
};
|
|
145
|
-
function getPositionalArgs(startIndex = 2) {
|
|
146
|
-
const args = import_node_process.default.argv.slice(startIndex);
|
|
147
|
-
const positionals = [];
|
|
148
|
-
let i = 0;
|
|
149
|
-
while (i < args.length) {
|
|
150
|
-
const arg = args[i];
|
|
151
|
-
if (arg.startsWith("-")) {
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
positionals.push(arg);
|
|
155
|
-
i++;
|
|
156
|
-
}
|
|
157
|
-
return positionals;
|
|
158
|
-
}
|
|
159
|
-
function hasFlag(flag, argv = import_node_process.default.argv) {
|
|
160
|
-
return argv.includes(`--${flag}`);
|
|
161
|
-
}
|
|
162
163
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
164
|
0 && (module.exports = {
|
|
164
165
|
commonParseArgsConfig,
|
package/dist/arrays.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Array utility functions for formatting lists and collections.
|
|
3
|
+
* Provides conjunction and disjunction formatters using Intl.ListFormat.
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* Split an array into chunks of a specified size.
|
|
3
7
|
*
|
|
@@ -27,7 +31,6 @@
|
|
|
27
31
|
* // Returns: [[1, 2], [3]]
|
|
28
32
|
* ```
|
|
29
33
|
*/
|
|
30
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
31
34
|
export declare function arrayChunk<T>(arr: T[] | readonly T[], size?: number | undefined): T[][];
|
|
32
35
|
/**
|
|
33
36
|
* Get unique values from an array.
|
|
@@ -59,12 +62,7 @@ export declare function arrayChunk<T>(arr: T[] | readonly T[], size?: number | u
|
|
|
59
62
|
* // Returns: []
|
|
60
63
|
* ```
|
|
61
64
|
*/
|
|
62
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
63
65
|
export declare function arrayUnique<T>(arr: T[] | readonly T[]): T[];
|
|
64
|
-
// IMPORTANT: Do not use destructuring here - use direct assignment instead.
|
|
65
|
-
// tsgo has a bug that incorrectly transpiles destructured exports, resulting in
|
|
66
|
-
// `exports.SomeName = void 0;` which causes runtime errors.
|
|
67
|
-
// See: https://github.com/SocketDev/socket-packageurl-js/issues/3
|
|
68
66
|
/**
|
|
69
67
|
* Alias for native Array.isArray.
|
|
70
68
|
* Determines whether the passed value is an array.
|
|
@@ -132,7 +130,6 @@ export declare const isArray: (arg: any) => arg is any[];
|
|
|
132
130
|
* // Outputs: "You can choose React, Vue, and Angular"
|
|
133
131
|
* ```
|
|
134
132
|
*/
|
|
135
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
136
133
|
export declare function joinAnd(arr: string[] | readonly string[]): string;
|
|
137
134
|
/**
|
|
138
135
|
* Join array elements with proper "or" disjunction formatting.
|
|
@@ -168,5 +165,4 @@ export declare function joinAnd(arr: string[] | readonly string[]): string;
|
|
|
168
165
|
* // Outputs: "Choose a package manager: npm, yarn, or pnpm"
|
|
169
166
|
* ```
|
|
170
167
|
*/
|
|
171
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
172
168
|
export declare function joinOr(arr: string[] | readonly string[]): string;
|
package/dist/arrays.js
CHANGED
package/dist/bin.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Binary path resolution and execution utilities for package managers.
|
|
3
|
+
* Provides cross-platform bin path lookup, command execution, and path normalization.
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* Options for the which function.
|
|
3
7
|
*/
|
|
@@ -24,14 +28,13 @@ export interface WhichOptions {
|
|
|
24
28
|
* await execBin('/usr/local/bin/node', ['script.js'], { cwd: '/tmp' })
|
|
25
29
|
* ```
|
|
26
30
|
*/
|
|
27
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
28
31
|
export declare function execBin(binPath: string, args?: string[], options?: import('./spawn').SpawnOptions): Promise<{
|
|
29
32
|
cmd: string;
|
|
30
33
|
args: string[] | readonly string[];
|
|
31
34
|
code: number;
|
|
32
|
-
signal: NodeJS.Signals;
|
|
33
|
-
stdout: string | Buffer
|
|
34
|
-
stderr: string | Buffer
|
|
35
|
+
signal: NodeJS.Signals | null;
|
|
36
|
+
stdout: string | Buffer;
|
|
37
|
+
stderr: string | Buffer;
|
|
35
38
|
}>;
|
|
36
39
|
/**
|
|
37
40
|
* Find the real executable for a binary, bypassing shadow bins.
|
|
@@ -83,7 +86,6 @@ export declare function findRealYarn(): string;
|
|
|
83
86
|
* ```
|
|
84
87
|
*/
|
|
85
88
|
export declare function isShadowBinPath(dirPath: string | undefined): boolean;
|
|
86
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
87
89
|
/**
|
|
88
90
|
* Resolve a binary path to the real underlying script file.
|
|
89
91
|
* Handles Windows .cmd wrappers and Unix shell scripts, resolving them to the actual .js files they execute.
|