@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/stdio/footer.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Console footer/summary formatting utilities.
|
|
3
|
+
* Provides consistent footer and summary formatting for CLI applications.
|
|
4
|
+
*/
|
|
1
5
|
export interface FooterOptions {
|
|
2
6
|
/**
|
|
3
7
|
* Width of the footer border in characters.
|
|
@@ -90,3 +94,19 @@ export declare function createFooter(message?: string | undefined, options?: Foo
|
|
|
90
94
|
* ```
|
|
91
95
|
*/
|
|
92
96
|
export declare function createSummaryFooter(stats: SummaryStats, options?: FooterOptions): string;
|
|
97
|
+
/**
|
|
98
|
+
* Print a footer with optional success message.
|
|
99
|
+
* Uses `─` border character for a lighter appearance.
|
|
100
|
+
* Fixed width of 55 characters to match `printHeader()`.
|
|
101
|
+
*
|
|
102
|
+
* @param message - Optional message to display (shown in green)
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* printFooter('Analysis complete')
|
|
107
|
+
* // Output:
|
|
108
|
+
* // ───────────────────────────────────────────────────
|
|
109
|
+
* // Analysis complete (in green)
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function printFooter(message?: string | undefined): void;
|
package/dist/stdio/footer.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;
|
|
@@ -30,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
31
|
var footer_exports = {};
|
|
31
32
|
__export(footer_exports, {
|
|
32
33
|
createFooter: () => createFooter,
|
|
33
|
-
createSummaryFooter: () => createSummaryFooter
|
|
34
|
+
createSummaryFooter: () => createSummaryFooter,
|
|
35
|
+
printFooter: () => printFooter
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(footer_exports);
|
|
36
38
|
var import_yoctocolors_cjs = __toESM(require("../external/yoctocolors-cjs"));
|
|
@@ -89,8 +91,16 @@ function createSummaryFooter(stats, options) {
|
|
|
89
91
|
...stats.duration !== void 0 && { startTime: stats.duration }
|
|
90
92
|
});
|
|
91
93
|
}
|
|
94
|
+
function printFooter(message) {
|
|
95
|
+
const border = (0, import_strings.repeatString)("\u2500", 55);
|
|
96
|
+
console.log(border);
|
|
97
|
+
if (message) {
|
|
98
|
+
console.log(import_yoctocolors_cjs.default.green(message));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
92
101
|
// Annotate the CommonJS export names for ESM import in node:
|
|
93
102
|
0 && (module.exports = {
|
|
94
103
|
createFooter,
|
|
95
|
-
createSummaryFooter
|
|
104
|
+
createSummaryFooter,
|
|
105
|
+
printFooter
|
|
96
106
|
});
|
package/dist/stdio/header.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Console header/banner formatting utilities.
|
|
3
|
+
* Provides consistent header formatting for CLI applications.
|
|
4
|
+
*/
|
|
1
5
|
export interface HeaderOptions {
|
|
2
6
|
/**
|
|
3
7
|
* Width of the header in characters.
|
|
@@ -88,19 +92,3 @@ export declare function createSectionHeader(title: string, options?: HeaderOptio
|
|
|
88
92
|
* ```
|
|
89
93
|
*/
|
|
90
94
|
export declare function printHeader(title: string): void;
|
|
91
|
-
/**
|
|
92
|
-
* Print a footer with optional success message.
|
|
93
|
-
* Uses `─` border character for a lighter appearance.
|
|
94
|
-
* Fixed width of 55 characters to match `printHeader()`.
|
|
95
|
-
*
|
|
96
|
-
* @param message - Optional message to display (shown in green)
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts
|
|
100
|
-
* printFooter('Analysis complete')
|
|
101
|
-
* // Output:
|
|
102
|
-
* // ───────────────────────────────────────────────────
|
|
103
|
-
* // Analysis complete (in green)
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export declare function printFooter(message?: string | undefined): void;
|
package/dist/stdio/header.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;
|
|
@@ -31,7 +32,6 @@ var header_exports = {};
|
|
|
31
32
|
__export(header_exports, {
|
|
32
33
|
createHeader: () => createHeader,
|
|
33
34
|
createSectionHeader: () => createSectionHeader,
|
|
34
|
-
printFooter: () => printFooter,
|
|
35
35
|
printHeader: () => printHeader
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(header_exports);
|
|
@@ -86,17 +86,9 @@ function printHeader(title) {
|
|
|
86
86
|
console.log(` ${title}`);
|
|
87
87
|
console.log(border);
|
|
88
88
|
}
|
|
89
|
-
function printFooter(message) {
|
|
90
|
-
const border = (0, import_strings.repeatString)("\u2500", 55);
|
|
91
|
-
console.log(border);
|
|
92
|
-
if (message) {
|
|
93
|
-
console.log(import_yoctocolors_cjs.default.green(message));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
97
90
|
0 && (module.exports = {
|
|
98
91
|
createHeader,
|
|
99
92
|
createSectionHeader,
|
|
100
|
-
printFooter,
|
|
101
93
|
printHeader
|
|
102
94
|
});
|
package/dist/stdio/stderr.d.ts
CHANGED
|
@@ -2,21 +2,7 @@
|
|
|
2
2
|
* @fileoverview Standard error stream utilities.
|
|
3
3
|
* Provides utilities for writing to stderr with formatting and control.
|
|
4
4
|
*/
|
|
5
|
-
// Get the actual stderr stream
|
|
6
5
|
declare const stderr: NodeJS.WriteStream;
|
|
7
|
-
export declare function writeErrorLine(text?: string): void;
|
|
8
|
-
/**
|
|
9
|
-
* Write text to stderr without adding a newline.
|
|
10
|
-
*
|
|
11
|
-
* @param text - Text to write
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* writeError('Downloading...')
|
|
16
|
-
* // Later update progress
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function writeError(text: string): void;
|
|
20
6
|
/**
|
|
21
7
|
* Clear the current line on stderr.
|
|
22
8
|
* Only works in TTY environments.
|
|
@@ -43,21 +29,6 @@ export declare function clearLine(): void;
|
|
|
43
29
|
* ```
|
|
44
30
|
*/
|
|
45
31
|
export declare function cursorTo(x: number, y?: number | undefined): void;
|
|
46
|
-
/**
|
|
47
|
-
* Check if stderr is connected to a TTY (terminal).
|
|
48
|
-
*
|
|
49
|
-
* @returns `true` if stderr is a TTY, `false` if piped/redirected
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```ts
|
|
53
|
-
* if (isTTY()) {
|
|
54
|
-
* // Show colored error messages
|
|
55
|
-
* } else {
|
|
56
|
-
* // Use plain text
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare function isTTY(): boolean;
|
|
61
32
|
/**
|
|
62
33
|
* Get the number of columns (width) in the terminal.
|
|
63
34
|
*
|
|
@@ -85,22 +56,32 @@ export declare function getColumns(): number;
|
|
|
85
56
|
*/
|
|
86
57
|
export declare function getRows(): number;
|
|
87
58
|
/**
|
|
88
|
-
*
|
|
59
|
+
* Check if stderr is connected to a TTY (terminal).
|
|
89
60
|
*
|
|
90
|
-
* @
|
|
91
|
-
* @param prefix - Prefix label for the warning
|
|
92
|
-
* @default prefix 'Warning'
|
|
61
|
+
* @returns `true` if stderr is a TTY, `false` if piped/redirected
|
|
93
62
|
*
|
|
94
63
|
* @example
|
|
95
64
|
* ```ts
|
|
96
|
-
*
|
|
97
|
-
*
|
|
65
|
+
* if (isTTY()) {
|
|
66
|
+
* // Show colored error messages
|
|
67
|
+
* } else {
|
|
68
|
+
* // Use plain text
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function isTTY(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Write text to stderr without adding a newline.
|
|
98
75
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
76
|
+
* @param text - Text to write
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* writeError('Downloading...')
|
|
81
|
+
* // Later update progress
|
|
101
82
|
* ```
|
|
102
83
|
*/
|
|
103
|
-
export declare function
|
|
84
|
+
export declare function writeError(text: string): void;
|
|
104
85
|
/**
|
|
105
86
|
* Write a formatted error message to stderr.
|
|
106
87
|
*
|
|
@@ -118,6 +99,21 @@ export declare function writeWarning(message: string, prefix?: string): void;
|
|
|
118
99
|
* ```
|
|
119
100
|
*/
|
|
120
101
|
export declare function writeErrorFormatted(message: string, prefix?: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Write a line to stderr with trailing newline.
|
|
104
|
+
* Used for error messages, warnings, and diagnostic output.
|
|
105
|
+
* Passing no argument writes an empty line.
|
|
106
|
+
*
|
|
107
|
+
* @param text - Text to write (defaults to the empty string)
|
|
108
|
+
* @default text ''
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* writeErrorLine('Error: File not found')
|
|
113
|
+
* writeErrorLine() // Write empty line
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function writeErrorLine(text?: string): void;
|
|
121
117
|
/**
|
|
122
118
|
* Write an error's stack trace to stderr.
|
|
123
119
|
* Falls back to formatted error message if no stack is available.
|
|
@@ -134,5 +130,21 @@ export declare function writeErrorFormatted(message: string, prefix?: string): v
|
|
|
134
130
|
* ```
|
|
135
131
|
*/
|
|
136
132
|
export declare function writeStackTrace(error: Error): void;
|
|
137
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Write a formatted warning message to stderr.
|
|
135
|
+
*
|
|
136
|
+
* @param message - Warning message text
|
|
137
|
+
* @param prefix - Prefix label for the warning
|
|
138
|
+
* @default prefix 'Warning'
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* writeWarning('Deprecated API usage')
|
|
143
|
+
* // Output: 'Warning: Deprecated API usage'
|
|
144
|
+
*
|
|
145
|
+
* writeWarning('Invalid config', 'Config')
|
|
146
|
+
* // Output: 'Config: Invalid config'
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export declare function writeWarning(message: string, prefix?: string): void;
|
|
138
150
|
export { stderr };
|
package/dist/stdio/stderr.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;
|
|
@@ -43,42 +44,34 @@ __export(stderr_exports, {
|
|
|
43
44
|
});
|
|
44
45
|
module.exports = __toCommonJS(stderr_exports);
|
|
45
46
|
var import_node_process = __toESM(require("node:process"));
|
|
47
|
+
var import_stream = require("./_stream");
|
|
46
48
|
const stderr = import_node_process.default.stderr;
|
|
47
|
-
function writeErrorLine(text = "") {
|
|
48
|
-
stderr.write(`${text}
|
|
49
|
-
`);
|
|
50
|
-
}
|
|
51
|
-
function writeError(text) {
|
|
52
|
-
stderr.write(text);
|
|
53
|
-
}
|
|
54
49
|
function clearLine() {
|
|
55
|
-
|
|
56
|
-
stderr.cursorTo(0);
|
|
57
|
-
stderr.clearLine(0);
|
|
58
|
-
}
|
|
50
|
+
(0, import_stream.clearLineOn)(stderr);
|
|
59
51
|
}
|
|
60
52
|
function cursorTo(x, y) {
|
|
61
|
-
|
|
62
|
-
stderr.cursorTo(x, y);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function isTTY() {
|
|
66
|
-
return stderr.isTTY || false;
|
|
53
|
+
(0, import_stream.cursorToOn)(stderr, x, y);
|
|
67
54
|
}
|
|
68
55
|
function getColumns() {
|
|
69
|
-
return stderr
|
|
56
|
+
return (0, import_stream.getColumnsOf)(stderr);
|
|
70
57
|
}
|
|
71
58
|
function getRows() {
|
|
72
|
-
return stderr
|
|
59
|
+
return (0, import_stream.getRowsOf)(stderr);
|
|
73
60
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
function isTTY() {
|
|
62
|
+
return (0, import_stream.isTTYOf)(stderr);
|
|
63
|
+
}
|
|
64
|
+
function writeError(text) {
|
|
65
|
+
stderr.write(text);
|
|
77
66
|
}
|
|
78
67
|
function writeErrorFormatted(message, prefix = "Error") {
|
|
79
68
|
const formatted = `${prefix}: ${message}`;
|
|
80
69
|
writeErrorLine(formatted);
|
|
81
70
|
}
|
|
71
|
+
function writeErrorLine(text = "") {
|
|
72
|
+
stderr.write(`${text}
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
82
75
|
function writeStackTrace(error) {
|
|
83
76
|
if (error.stack) {
|
|
84
77
|
writeErrorLine(error.stack);
|
|
@@ -86,6 +79,10 @@ function writeStackTrace(error) {
|
|
|
86
79
|
writeErrorFormatted(error.message);
|
|
87
80
|
}
|
|
88
81
|
}
|
|
82
|
+
function writeWarning(message, prefix = "Warning") {
|
|
83
|
+
const formatted = `${prefix}: ${message}`;
|
|
84
|
+
writeErrorLine(formatted);
|
|
85
|
+
}
|
|
89
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
90
87
|
0 && (module.exports = {
|
|
91
88
|
clearLine,
|
package/dist/stdio/stdout.d.ts
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
1
|
-
// Get the actual stdout stream
|
|
2
|
-
declare const stdout: NodeJS.WriteStream;
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param text - Text to write
|
|
7
|
-
* @default text ''
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* writeLine('Hello, world!')
|
|
12
|
-
* writeLine() // Write empty line
|
|
13
|
-
* ```
|
|
2
|
+
* @fileoverview Standard output stream utilities.
|
|
3
|
+
* Provides utilities for writing to stdout with formatting and control.
|
|
14
4
|
*/
|
|
15
|
-
|
|
5
|
+
declare const stdout: NodeJS.WriteStream;
|
|
16
6
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param text - Text to write
|
|
7
|
+
* Clear the current line on stdout.
|
|
8
|
+
* Only works in TTY environments.
|
|
20
9
|
*
|
|
21
10
|
* @example
|
|
22
11
|
* ```ts
|
|
23
|
-
* write('
|
|
24
|
-
*
|
|
12
|
+
* write('Processing...')
|
|
13
|
+
* clearLine()
|
|
14
|
+
* write('Done!')
|
|
25
15
|
* ```
|
|
26
16
|
*/
|
|
27
|
-
export declare function
|
|
17
|
+
export declare function clearLine(): void;
|
|
28
18
|
/**
|
|
29
|
-
* Clear
|
|
19
|
+
* Clear screen from cursor position down to bottom.
|
|
30
20
|
* Only works in TTY environments.
|
|
31
21
|
*
|
|
32
22
|
* @example
|
|
33
23
|
* ```ts
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* write('Done!')
|
|
24
|
+
* cursorTo(0, 5)
|
|
25
|
+
* clearScreenDown() // Clear from row 5 to bottom
|
|
37
26
|
* ```
|
|
38
27
|
*/
|
|
39
|
-
export declare function
|
|
28
|
+
export declare function clearScreenDown(): void;
|
|
40
29
|
/**
|
|
41
30
|
* Move cursor to specific position on stdout.
|
|
42
31
|
* Only works in TTY environments.
|
|
@@ -52,31 +41,18 @@ export declare function clearLine(): void;
|
|
|
52
41
|
*/
|
|
53
42
|
export declare function cursorTo(x: number, y?: number | undefined): void;
|
|
54
43
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* cursorTo(0, 5)
|
|
61
|
-
* clearScreenDown() // Clear from row 5 to bottom
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare function clearScreenDown(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Check if stdout is connected to a TTY (terminal).
|
|
67
|
-
*
|
|
68
|
-
* @returns `true` if stdout is a TTY, `false` if piped/redirected
|
|
44
|
+
* Register handlers to ensure cursor is shown on process exit.
|
|
45
|
+
* Prevents hidden cursor after abnormal termination.
|
|
46
|
+
* Handles SIGINT (Ctrl+C) and SIGTERM signals.
|
|
69
47
|
*
|
|
70
48
|
* @example
|
|
71
49
|
* ```ts
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* // Use simple text output
|
|
76
|
-
* }
|
|
50
|
+
* ensureCursorOnExit()
|
|
51
|
+
* hideCursor()
|
|
52
|
+
* // Even if process crashes, cursor will be restored
|
|
77
53
|
* ```
|
|
78
54
|
*/
|
|
79
|
-
export declare function
|
|
55
|
+
export declare function ensureCursorOnExit(): void;
|
|
80
56
|
/**
|
|
81
57
|
* Get the number of columns (width) in the terminal.
|
|
82
58
|
*
|
|
@@ -115,6 +91,21 @@ export declare function getRows(): number;
|
|
|
115
91
|
* ```
|
|
116
92
|
*/
|
|
117
93
|
export declare function hideCursor(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Check if stdout is connected to a TTY (terminal).
|
|
96
|
+
*
|
|
97
|
+
* @returns `true` if stdout is a TTY, `false` if piped/redirected
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* if (isTTY()) {
|
|
102
|
+
* // Show interactive UI
|
|
103
|
+
* } else {
|
|
104
|
+
* // Use simple text output
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function isTTY(): boolean;
|
|
118
109
|
/**
|
|
119
110
|
* Show the cursor on stdout.
|
|
120
111
|
* Should be called after `hideCursor()`.
|
|
@@ -128,17 +119,28 @@ export declare function hideCursor(): void;
|
|
|
128
119
|
*/
|
|
129
120
|
export declare function showCursor(): void;
|
|
130
121
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
122
|
+
* Write text to stdout without adding a newline.
|
|
123
|
+
*
|
|
124
|
+
* @param text - Text to write
|
|
134
125
|
*
|
|
135
126
|
* @example
|
|
136
127
|
* ```ts
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* // Even if process crashes, cursor will be restored
|
|
128
|
+
* write('Loading...')
|
|
129
|
+
* // Later: clear and update
|
|
140
130
|
* ```
|
|
141
131
|
*/
|
|
142
|
-
export declare function
|
|
143
|
-
|
|
132
|
+
export declare function write(text: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Write a line to stdout with trailing newline.
|
|
135
|
+
*
|
|
136
|
+
* @param text - Text to write
|
|
137
|
+
* @default text ''
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* writeLine('Hello, world!')
|
|
142
|
+
* writeLine() // Write empty line
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export declare function writeLine(text?: string): void;
|
|
144
146
|
export { stdout };
|
package/dist/stdio/stdout.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;
|
|
@@ -44,60 +45,61 @@ __export(stdout_exports, {
|
|
|
44
45
|
});
|
|
45
46
|
module.exports = __toCommonJS(stdout_exports);
|
|
46
47
|
var import_node_process = __toESM(require("node:process"));
|
|
47
|
-
var
|
|
48
|
+
var import_node_tty = require("node:tty");
|
|
49
|
+
var import_stream = require("./_stream");
|
|
48
50
|
const stdout = import_node_process.default.stdout;
|
|
49
|
-
|
|
50
|
-
stdout.write(`${text}
|
|
51
|
-
`);
|
|
52
|
-
}
|
|
53
|
-
function write(text) {
|
|
54
|
-
stdout.write(text);
|
|
55
|
-
}
|
|
51
|
+
let _cursorExitRegistered = false;
|
|
56
52
|
function clearLine() {
|
|
57
|
-
|
|
58
|
-
stdout.cursorTo(0);
|
|
59
|
-
stdout.clearLine(0);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function cursorTo(x, y) {
|
|
63
|
-
if (stdout.isTTY) {
|
|
64
|
-
stdout.cursorTo(x, y);
|
|
65
|
-
}
|
|
53
|
+
(0, import_stream.clearLineOn)(stdout);
|
|
66
54
|
}
|
|
67
55
|
function clearScreenDown() {
|
|
68
56
|
if (stdout.isTTY) {
|
|
69
57
|
stdout.clearScreenDown();
|
|
70
58
|
}
|
|
71
59
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
60
|
+
function cursorTo(x, y) {
|
|
61
|
+
(0, import_stream.cursorToOn)(stdout, x, y);
|
|
62
|
+
}
|
|
63
|
+
function ensureCursorOnExit() {
|
|
64
|
+
if (_cursorExitRegistered) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
_cursorExitRegistered = true;
|
|
68
|
+
import_node_process.default.on("exit", showCursor);
|
|
69
|
+
import_node_process.default.on("SIGINT", () => {
|
|
70
|
+
showCursor();
|
|
71
|
+
import_node_process.default.exit(130);
|
|
72
|
+
});
|
|
73
|
+
import_node_process.default.on("SIGTERM", () => {
|
|
74
|
+
showCursor();
|
|
75
|
+
import_node_process.default.exit(143);
|
|
76
|
+
});
|
|
74
77
|
}
|
|
75
78
|
function getColumns() {
|
|
76
|
-
return stdout
|
|
79
|
+
return (0, import_stream.getColumnsOf)(stdout);
|
|
77
80
|
}
|
|
78
81
|
function getRows() {
|
|
79
|
-
return stdout
|
|
82
|
+
return (0, import_stream.getRowsOf)(stdout);
|
|
80
83
|
}
|
|
81
84
|
function hideCursor() {
|
|
82
|
-
if (stdout.isTTY && stdout instanceof
|
|
85
|
+
if (stdout.isTTY && stdout instanceof import_node_tty.WriteStream) {
|
|
83
86
|
stdout.write("\x1B[?25l");
|
|
84
87
|
}
|
|
85
88
|
}
|
|
89
|
+
function isTTY() {
|
|
90
|
+
return (0, import_stream.isTTYOf)(stdout);
|
|
91
|
+
}
|
|
86
92
|
function showCursor() {
|
|
87
|
-
if (stdout.isTTY && stdout instanceof
|
|
93
|
+
if (stdout.isTTY && stdout instanceof import_node_tty.WriteStream) {
|
|
88
94
|
stdout.write("\x1B[?25h");
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
import_node_process.default.on("SIGTERM", () => {
|
|
98
|
-
showCursor();
|
|
99
|
-
import_node_process.default.exit(143);
|
|
100
|
-
});
|
|
97
|
+
function write(text) {
|
|
98
|
+
stdout.write(text);
|
|
99
|
+
}
|
|
100
|
+
function writeLine(text = "") {
|
|
101
|
+
stdout.write(`${text}
|
|
102
|
+
`);
|
|
101
103
|
}
|
|
102
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
103
105
|
0 && (module.exports = {
|
package/dist/streams.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Stream processing utilities with streaming-iterables integration.
|
|
3
|
+
* Provides async stream handling and transformation functions.
|
|
4
|
+
*/
|
|
1
5
|
import type { IterationOptions } from './promises';
|
|
2
6
|
/**
|
|
3
7
|
* Execute a function for each item in an iterable in parallel.
|
|
@@ -10,7 +14,6 @@ import type { IterationOptions } from './promises';
|
|
|
10
14
|
* }, { concurrency: 4 })
|
|
11
15
|
* ```
|
|
12
16
|
*/
|
|
13
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
14
17
|
export declare function parallelEach<T>(iterable: Iterable<T> | AsyncIterable<T>, func: (item: T) => Promise<unknown>, options?: number | IterationOptions): Promise<void>;
|
|
15
18
|
/**
|
|
16
19
|
* Map over an iterable in parallel with concurrency control.
|
|
@@ -25,7 +28,6 @@ export declare function parallelEach<T>(iterable: Iterable<T> | AsyncIterable<T>
|
|
|
25
28
|
* }
|
|
26
29
|
* ```
|
|
27
30
|
*/
|
|
28
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
29
31
|
export declare function parallelMap<T, U>(iterable: Iterable<T> | AsyncIterable<T>, func: (item: T) => Promise<U>, options?: number | IterationOptions): AsyncIterable<U>;
|
|
30
32
|
/**
|
|
31
33
|
* Transform an iterable with a function.
|
|
@@ -40,5 +42,4 @@ export declare function parallelMap<T, U>(iterable: Iterable<T> | AsyncIterable<
|
|
|
40
42
|
* }
|
|
41
43
|
* ```
|
|
42
44
|
*/
|
|
43
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
44
45
|
export declare function transform<T, U>(iterable: Iterable<T> | AsyncIterable<T>, func: (item: T) => Promise<U>, options?: number | IterationOptions): AsyncIterable<U>;
|