@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/spawn.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;
|
|
@@ -37,15 +38,37 @@ __export(spawn_exports, {
|
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(spawn_exports);
|
|
39
40
|
var import_node_process = __toESM(require("node:process"));
|
|
40
|
-
var import_process = require("./constants/process");
|
|
41
|
-
var import_errors = require("./errors");
|
|
42
41
|
var import_arrays = require("./arrays");
|
|
43
42
|
var import_bin = require("./bin");
|
|
44
|
-
var
|
|
43
|
+
var import_process = require("./constants/process");
|
|
44
|
+
var import_errors = require("./errors");
|
|
45
45
|
var import_objects = require("./objects");
|
|
46
|
+
var import_normalize = require("./paths/normalize");
|
|
46
47
|
var import_spinner = require("./spinner");
|
|
47
48
|
var import_strings = require("./strings");
|
|
49
|
+
const abortSignal = (0, import_process.getAbortSignal)();
|
|
50
|
+
const spinner = (0, import_spinner.getDefaultSpinner)();
|
|
51
|
+
const stackCache = /* @__PURE__ */ new WeakMap();
|
|
52
|
+
const spawnBinPathCache = /* @__PURE__ */ new Map();
|
|
53
|
+
const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
|
|
48
54
|
let _npmCliPromiseSpawn;
|
|
55
|
+
let _path;
|
|
56
|
+
let _fs;
|
|
57
|
+
let _child_process;
|
|
58
|
+
// @__NO_SIDE_EFFECTS__
|
|
59
|
+
function getChildProcess() {
|
|
60
|
+
if (_child_process === void 0) {
|
|
61
|
+
_child_process = require("node:child_process");
|
|
62
|
+
}
|
|
63
|
+
return _child_process;
|
|
64
|
+
}
|
|
65
|
+
// @__NO_SIDE_EFFECTS__
|
|
66
|
+
function getFs() {
|
|
67
|
+
if (_fs === void 0) {
|
|
68
|
+
_fs = require("node:fs");
|
|
69
|
+
}
|
|
70
|
+
return _fs;
|
|
71
|
+
}
|
|
49
72
|
// @__NO_SIDE_EFFECTS__
|
|
50
73
|
function getNpmCliPromiseSpawn() {
|
|
51
74
|
if (_npmCliPromiseSpawn === void 0) {
|
|
@@ -53,34 +76,24 @@ function getNpmCliPromiseSpawn() {
|
|
|
53
76
|
}
|
|
54
77
|
return _npmCliPromiseSpawn;
|
|
55
78
|
}
|
|
56
|
-
let _path;
|
|
57
79
|
// @__NO_SIDE_EFFECTS__
|
|
58
80
|
function getPath() {
|
|
59
81
|
if (_path === void 0) {
|
|
60
|
-
_path = require("path");
|
|
82
|
+
_path = require("node:path");
|
|
61
83
|
}
|
|
62
84
|
return _path;
|
|
63
85
|
}
|
|
64
|
-
let _fs;
|
|
65
86
|
// @__NO_SIDE_EFFECTS__
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
function stripAnsiFromSpawnResult(result) {
|
|
88
|
+
const res = result;
|
|
89
|
+
const { stderr, stdout } = res;
|
|
90
|
+
if (typeof stdout === "string") {
|
|
91
|
+
res.stdout = (0, import_strings.stripAnsi)(stdout);
|
|
69
92
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const abortSignal = (0, import_process.getAbortSignal)();
|
|
73
|
-
const spinner = (0, import_spinner.getDefaultSpinner)();
|
|
74
|
-
const stackCache = /* @__PURE__ */ new WeakMap();
|
|
75
|
-
const spawnBinPathCache = /* @__PURE__ */ new Map();
|
|
76
|
-
const windowsScriptExtRegExp = /\.(?:cmd|bat|ps1)$/i;
|
|
77
|
-
let _child_process;
|
|
78
|
-
// @__NO_SIDE_EFFECTS__
|
|
79
|
-
function getChildProcess() {
|
|
80
|
-
if (_child_process === void 0) {
|
|
81
|
-
_child_process = require("child_process");
|
|
93
|
+
if (typeof stderr === "string") {
|
|
94
|
+
res.stderr = (0, import_strings.stripAnsi)(stderr);
|
|
82
95
|
}
|
|
83
|
-
return
|
|
96
|
+
return res;
|
|
84
97
|
}
|
|
85
98
|
// @__NO_SIDE_EFFECTS__
|
|
86
99
|
function enhanceSpawnError(error) {
|
|
@@ -133,8 +146,8 @@ ${firstLine.slice(0, 197)}...`;
|
|
|
133
146
|
cause: err
|
|
134
147
|
});
|
|
135
148
|
const descriptors = Object.getOwnPropertyDescriptors(err);
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
Reflect.deleteProperty(descriptors, "message");
|
|
150
|
+
Reflect.deleteProperty(descriptors, "stack");
|
|
138
151
|
Object.defineProperties(enhancedError, descriptors);
|
|
139
152
|
Object.defineProperty(enhancedError, "stack", {
|
|
140
153
|
__proto__: null,
|
|
@@ -171,18 +184,6 @@ function isStdioType(stdio, type) {
|
|
|
171
184
|
}
|
|
172
185
|
return stdio === type || (stdio === null || stdio === void 0) && type === "pipe" || (0, import_arrays.isArray)(stdio) && stdio.length > 2 && stdio[0] === type && stdio[1] === type && stdio[2] === type;
|
|
173
186
|
}
|
|
174
|
-
// @__NO_SIDE_EFFECTS__
|
|
175
|
-
function stripAnsiFromSpawnResult(result) {
|
|
176
|
-
const res = result;
|
|
177
|
-
const { stderr, stdout } = res;
|
|
178
|
-
if (typeof stdout === "string") {
|
|
179
|
-
res.stdout = (0, import_strings.stripAnsi)(stdout);
|
|
180
|
-
}
|
|
181
|
-
if (typeof stderr === "string") {
|
|
182
|
-
res.stderr = (0, import_strings.stripAnsi)(stderr);
|
|
183
|
-
}
|
|
184
|
-
return res;
|
|
185
|
-
}
|
|
186
187
|
function spawn(cmd, args, options, extra) {
|
|
187
188
|
const {
|
|
188
189
|
spinner: optionsSpinner = spinner,
|
|
@@ -266,9 +267,9 @@ function spawn(cmd, args, options, extra) {
|
|
|
266
267
|
});
|
|
267
268
|
} else {
|
|
268
269
|
newSpawnPromise = spawnPromise.then((result) => {
|
|
269
|
-
if ("code" in result) {
|
|
270
|
+
if (result !== null && typeof result === "object" && "code" in result) {
|
|
270
271
|
const res = result;
|
|
271
|
-
res.exitCode =
|
|
272
|
+
res.exitCode = res.code;
|
|
272
273
|
return res;
|
|
273
274
|
}
|
|
274
275
|
return result;
|
package/dist/spinner.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CLI spinner utilities for long-running operations.
|
|
3
|
+
* Provides animated progress indicators with CI environment detection.
|
|
4
|
+
*/
|
|
5
|
+
import type { Writable } from 'node:stream';
|
|
2
6
|
import type { ColorInherit, ColorRgb, ColorValue } from './colors';
|
|
3
7
|
import type { ShimmerColorGradient, ShimmerConfig, ShimmerDirection, ShimmerState } from './effects/text-shimmer';
|
|
4
8
|
/**
|
|
@@ -208,8 +212,23 @@ export declare const ciSpinner: SpinnerStyle;
|
|
|
208
212
|
* const dotsStyle = getCliSpinners('dots')
|
|
209
213
|
* ```
|
|
210
214
|
*/
|
|
211
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
212
215
|
export declare function getCliSpinners(styleName?: string | undefined): SpinnerStyle | Record<string, SpinnerStyle> | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* Get the default spinner instance.
|
|
218
|
+
* Lazily creates the spinner to avoid circular dependencies during module initialization.
|
|
219
|
+
* Reuses the same instance across calls.
|
|
220
|
+
*
|
|
221
|
+
* @returns Shared default spinner instance
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* import { getDefaultSpinner } from '@socketsecurity/lib/spinner'
|
|
226
|
+
*
|
|
227
|
+
* const spinner = getDefaultSpinner()
|
|
228
|
+
* spinner.start('Loading…')
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare function getDefaultSpinner(): ReturnType<typeof Spinner>;
|
|
213
232
|
/**
|
|
214
233
|
* Create a spinner instance for displaying loading indicators.
|
|
215
234
|
* Provides an animated CLI spinner with status messages, progress tracking, and shimmer effects.
|
|
@@ -261,27 +280,7 @@ export declare function getCliSpinners(styleName?: string | undefined): SpinnerS
|
|
|
261
280
|
* spinner.progressStep() // Increment by 1
|
|
262
281
|
* ```
|
|
263
282
|
*/
|
|
264
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
265
283
|
export declare function Spinner(options?: SpinnerOptions | undefined): Spinner;
|
|
266
|
-
/**
|
|
267
|
-
* Get the default spinner instance.
|
|
268
|
-
* Lazily creates the spinner to avoid circular dependencies during module initialization.
|
|
269
|
-
* Reuses the same instance across calls.
|
|
270
|
-
*
|
|
271
|
-
* @returns Shared default spinner instance
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* ```ts
|
|
275
|
-
* import { getDefaultSpinner } from '@socketsecurity/lib/spinner'
|
|
276
|
-
*
|
|
277
|
-
* const spinner = getDefaultSpinner()
|
|
278
|
-
* spinner.start('Loading…')
|
|
279
|
-
* ```
|
|
280
|
-
*/
|
|
281
|
-
export declare function getDefaultSpinner(): ReturnType<typeof Spinner>;
|
|
282
|
-
// REMOVED: Deprecated `spinner` export
|
|
283
|
-
// Migration: Use getDefaultSpinner() instead
|
|
284
|
-
// See: getDefaultSpinner() function above
|
|
285
284
|
/**
|
|
286
285
|
* Configuration options for `withSpinner()` helper.
|
|
287
286
|
* @template T - Return type of the async operation
|
package/dist/spinner.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;
|
|
@@ -76,8 +77,11 @@ function normalizeText(value) {
|
|
|
76
77
|
return typeof value === "string" ? value.trimStart() : "";
|
|
77
78
|
}
|
|
78
79
|
function renderProgressBar(percentage, width = 20) {
|
|
79
|
-
const filled = Math.
|
|
80
|
-
|
|
80
|
+
const filled = Math.max(
|
|
81
|
+
0,
|
|
82
|
+
Math.min(width, Math.round(percentage / 100 * width))
|
|
83
|
+
);
|
|
84
|
+
const empty = Math.max(0, width - filled);
|
|
81
85
|
const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
82
86
|
return import_yoctocolors_cjs.default.cyan(bar);
|
|
83
87
|
}
|
|
@@ -101,6 +105,13 @@ function getCliSpinners(styleName) {
|
|
|
101
105
|
}
|
|
102
106
|
let _Spinner;
|
|
103
107
|
let _defaultSpinner;
|
|
108
|
+
let _spinner;
|
|
109
|
+
function getDefaultSpinner() {
|
|
110
|
+
if (_spinner === void 0) {
|
|
111
|
+
_spinner = /* @__PURE__ */ Spinner();
|
|
112
|
+
}
|
|
113
|
+
return _spinner;
|
|
114
|
+
}
|
|
104
115
|
// @__NO_SIDE_EFFECTS__
|
|
105
116
|
function Spinner(options) {
|
|
106
117
|
if (_Spinner === void 0) {
|
|
@@ -119,7 +130,7 @@ function Spinner(options) {
|
|
|
119
130
|
let theme = (0, import_context.getTheme)();
|
|
120
131
|
if (opts.theme) {
|
|
121
132
|
if (typeof opts.theme === "string") {
|
|
122
|
-
theme = import_themes.THEMES[opts.theme];
|
|
133
|
+
theme = import_themes.THEMES[opts.theme] ?? theme;
|
|
123
134
|
} else {
|
|
124
135
|
theme = opts.theme;
|
|
125
136
|
}
|
|
@@ -601,7 +612,7 @@ function Spinner(options) {
|
|
|
601
612
|
this.#apply("stop", []);
|
|
602
613
|
const normalized = normalizeText(text);
|
|
603
614
|
if (normalized) {
|
|
604
|
-
logger.error(`${import_logger.LOG_SYMBOLS
|
|
615
|
+
logger.error(`${import_logger.LOG_SYMBOLS["skip"]} ${normalized}`, ...extras);
|
|
605
616
|
}
|
|
606
617
|
return this;
|
|
607
618
|
}
|
|
@@ -848,13 +859,6 @@ function Spinner(options) {
|
|
|
848
859
|
...options
|
|
849
860
|
});
|
|
850
861
|
}
|
|
851
|
-
let _spinner;
|
|
852
|
-
function getDefaultSpinner() {
|
|
853
|
-
if (_spinner === void 0) {
|
|
854
|
-
_spinner = /* @__PURE__ */ Spinner();
|
|
855
|
-
}
|
|
856
|
-
return _spinner;
|
|
857
|
-
}
|
|
858
862
|
async function withSpinner(options) {
|
|
859
863
|
const { message, operation, spinner, withOptions } = {
|
|
860
864
|
__proto__: null,
|
package/dist/ssri.d.ts
CHANGED
|
@@ -2,24 +2,6 @@
|
|
|
2
2
|
* @fileoverview SSRI (Subresource Integrity) hash format utilities.
|
|
3
3
|
* Provides conversion and validation for SSRI and hex hash formats.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* Convert SSRI format hash to hex format.
|
|
7
|
-
*
|
|
8
|
-
* Takes a hash in SSRI format (e.g., "sha256-base64hash") and converts it to
|
|
9
|
-
* standard hex format (e.g., "hexstring").
|
|
10
|
-
*
|
|
11
|
-
* @param ssri - Hash in SSRI format (algorithm-base64)
|
|
12
|
-
* @returns Hex string representation of the hash
|
|
13
|
-
* @throws Error if SSRI format is invalid
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const hex = ssriToHex('sha256-dmgqn8O75il1F24lQfOagWiHfYKNXK2LVkYfw2rCuFY=')
|
|
18
|
-
* // Returns: '76682a9fc3bbe62975176e2541f39a8168877d828d5cad8b56461fc36ac2b856'
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
22
|
-
export declare function ssriToHex(ssri: string): string;
|
|
23
5
|
/**
|
|
24
6
|
* Convert hex format hash to SSRI format.
|
|
25
7
|
*
|
|
@@ -37,42 +19,39 @@ export declare function ssriToHex(ssri: string): string;
|
|
|
37
19
|
* // Returns: 'sha256-dmgqn8O75il1F24lQfOagWiHfYKNXK2LVkYfw2rCuFY='
|
|
38
20
|
* ```
|
|
39
21
|
*/
|
|
40
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
41
22
|
export declare function hexToSsri(hex: string, algorithm?: string): string;
|
|
42
23
|
/**
|
|
43
|
-
* Check if a string is valid
|
|
24
|
+
* Check if a string is valid hex format.
|
|
44
25
|
*
|
|
45
|
-
* Validates that a string
|
|
46
|
-
* Does not verify
|
|
26
|
+
* Validates that a string contains only hexadecimal characters (0-9, a-f).
|
|
27
|
+
* Does not verify hash length or algorithm.
|
|
47
28
|
*
|
|
48
29
|
* @param value - String to validate
|
|
49
|
-
* @returns True if string
|
|
30
|
+
* @returns True if string is valid hex format
|
|
50
31
|
*
|
|
51
32
|
* @example
|
|
52
33
|
* ```typescript
|
|
53
|
-
*
|
|
54
|
-
*
|
|
34
|
+
* isValidHex('76682a9fc3bbe62975176e2541f39a8168877d828d5cad8b56461fc36ac2b856') // true
|
|
35
|
+
* isValidHex('sha256-dmgqn8O75il1F24lQfOagWiHfYKNXK2LVkYfw2rCuFY=') // false
|
|
55
36
|
* ```
|
|
56
37
|
*/
|
|
57
|
-
|
|
58
|
-
export declare function isValidSsri(value: string): boolean;
|
|
38
|
+
export declare function isValidHex(value: string): boolean;
|
|
59
39
|
/**
|
|
60
|
-
* Check if a string is valid
|
|
40
|
+
* Check if a string is valid SSRI format.
|
|
61
41
|
*
|
|
62
|
-
* Validates that a string
|
|
63
|
-
* Does not verify
|
|
42
|
+
* Validates that a string matches the SSRI format pattern (algorithm-base64).
|
|
43
|
+
* Does not verify that the base64 encoding is valid.
|
|
64
44
|
*
|
|
65
45
|
* @param value - String to validate
|
|
66
|
-
* @returns True if string
|
|
46
|
+
* @returns True if string matches SSRI format
|
|
67
47
|
*
|
|
68
48
|
* @example
|
|
69
49
|
* ```typescript
|
|
70
|
-
*
|
|
71
|
-
*
|
|
50
|
+
* isValidSsri('sha256-dmgqn8O75il1F24lQfOagWiHfYKNXK2LVkYfw2rCuFY=') // true
|
|
51
|
+
* isValidSsri('76682a9f...') // false
|
|
72
52
|
* ```
|
|
73
53
|
*/
|
|
74
|
-
|
|
75
|
-
export declare function isValidHex(value: string): boolean;
|
|
54
|
+
export declare function isValidSsri(value: string): boolean;
|
|
76
55
|
/**
|
|
77
56
|
* Parse SSRI format into components.
|
|
78
57
|
*
|
|
@@ -88,8 +67,24 @@ export declare function isValidHex(value: string): boolean;
|
|
|
88
67
|
* // Returns: { algorithm: 'sha256', base64Hash: 'dmgqn8O75il1F24lQfOagWiHfYKNXK2LVkYfw2rCuFY=' }
|
|
89
68
|
* ```
|
|
90
69
|
*/
|
|
91
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
92
70
|
export declare function parseSsri(ssri: string): {
|
|
93
71
|
algorithm: string;
|
|
94
72
|
base64Hash: string;
|
|
95
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Convert SSRI format hash to hex format.
|
|
76
|
+
*
|
|
77
|
+
* Takes a hash in SSRI format (e.g., "sha256-base64hash") and converts it to
|
|
78
|
+
* standard hex format (e.g., "hexstring").
|
|
79
|
+
*
|
|
80
|
+
* @param ssri - Hash in SSRI format (algorithm-base64)
|
|
81
|
+
* @returns Hex string representation of the hash
|
|
82
|
+
* @throws Error if SSRI format is invalid
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const hex = ssriToHex('sha256-dmgqn8O75il1F24lQfOagWiHfYKNXK2LVkYfw2rCuFY=')
|
|
87
|
+
* // Returns: '76682a9fc3bbe62975176e2541f39a8168877d828d5cad8b56461fc36ac2b856'
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function ssriToHex(ssri: string): string;
|
package/dist/ssri.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -27,16 +28,6 @@ __export(ssri_exports, {
|
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(ssri_exports);
|
|
29
30
|
// @__NO_SIDE_EFFECTS__
|
|
30
|
-
function ssriToHex(ssri) {
|
|
31
|
-
const match = /^([a-z0-9]+)-([A-Za-z0-9+/]+=*)$/i.exec(ssri);
|
|
32
|
-
if (!match || !match[2] || match[2].length < 2) {
|
|
33
|
-
throw new Error(`Invalid SSRI format: ${ssri}`);
|
|
34
|
-
}
|
|
35
|
-
const base64Hash = match[2];
|
|
36
|
-
const buffer = Buffer.from(base64Hash, "base64");
|
|
37
|
-
return buffer.toString("hex");
|
|
38
|
-
}
|
|
39
|
-
// @__NO_SIDE_EFFECTS__
|
|
40
31
|
function hexToSsri(hex, algorithm = "sha256") {
|
|
41
32
|
if (!/^[a-f0-9]+$/i.test(hex)) {
|
|
42
33
|
throw new Error(`Invalid hex format: ${hex}`);
|
|
@@ -46,14 +37,14 @@ function hexToSsri(hex, algorithm = "sha256") {
|
|
|
46
37
|
return `${algorithm}-${base64Hash}`;
|
|
47
38
|
}
|
|
48
39
|
// @__NO_SIDE_EFFECTS__
|
|
49
|
-
function isValidSsri(value) {
|
|
50
|
-
return /^[a-z0-9]+-[A-Za-z0-9+/]{2,}=*$/i.test(value);
|
|
51
|
-
}
|
|
52
|
-
// @__NO_SIDE_EFFECTS__
|
|
53
40
|
function isValidHex(value) {
|
|
54
41
|
return /^[a-f0-9]+$/i.test(value);
|
|
55
42
|
}
|
|
56
43
|
// @__NO_SIDE_EFFECTS__
|
|
44
|
+
function isValidSsri(value) {
|
|
45
|
+
return /^[a-z0-9]+-[A-Za-z0-9+/]{2,}=*$/i.test(value);
|
|
46
|
+
}
|
|
47
|
+
// @__NO_SIDE_EFFECTS__
|
|
57
48
|
function parseSsri(ssri) {
|
|
58
49
|
const match = /^([a-z0-9]+)-([A-Za-z0-9+/]+=*)$/i.exec(ssri);
|
|
59
50
|
if (!match || !match[1] || !match[2] || match[2].length < 2) {
|
|
@@ -63,6 +54,16 @@ function parseSsri(ssri) {
|
|
|
63
54
|
const base64Hash = match[2];
|
|
64
55
|
return { algorithm, base64Hash };
|
|
65
56
|
}
|
|
57
|
+
// @__NO_SIDE_EFFECTS__
|
|
58
|
+
function ssriToHex(ssri) {
|
|
59
|
+
const match = /^([a-z0-9]+)-([A-Za-z0-9+/]+=*)$/i.exec(ssri);
|
|
60
|
+
if (!match || !match[2] || match[2].length < 2) {
|
|
61
|
+
throw new Error(`Invalid SSRI format: ${ssri}`);
|
|
62
|
+
}
|
|
63
|
+
const base64Hash = match[2];
|
|
64
|
+
const buffer = Buffer.from(base64Hash, "base64");
|
|
65
|
+
return buffer.toString("hex");
|
|
66
|
+
}
|
|
66
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
68
|
0 && (module.exports = {
|
|
68
69
|
hexToSsri,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared TTY primitives for stdio/stdout.ts + stdio/stderr.ts.
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Clear the current line on the given stream.
|
|
7
|
+
* Only works in TTY environments.
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export declare function clearLineOn(stream: NodeJS.WriteStream): void;
|
|
11
|
+
/**
|
|
12
|
+
* Move cursor to specific position on the given stream.
|
|
13
|
+
* Only works in TTY environments.
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export declare function cursorToOn(stream: NodeJS.WriteStream, x: number, y?: number | undefined): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get the number of columns on the given stream (or 80 fallback).
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export declare function getColumnsOf(stream: NodeJS.WriteStream): number;
|
|
22
|
+
/**
|
|
23
|
+
* Get the number of rows on the given stream (or 24 fallback).
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export declare function getRowsOf(stream: NodeJS.WriteStream): number;
|
|
27
|
+
/**
|
|
28
|
+
* Check if the given stream is connected to a TTY.
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
export declare function isTTYOf(stream: NodeJS.WriteStream): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var stream_exports = {};
|
|
22
|
+
__export(stream_exports, {
|
|
23
|
+
clearLineOn: () => clearLineOn,
|
|
24
|
+
cursorToOn: () => cursorToOn,
|
|
25
|
+
getColumnsOf: () => getColumnsOf,
|
|
26
|
+
getRowsOf: () => getRowsOf,
|
|
27
|
+
isTTYOf: () => isTTYOf
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(stream_exports);
|
|
30
|
+
function clearLineOn(stream) {
|
|
31
|
+
if (stream.isTTY) {
|
|
32
|
+
stream.cursorTo(0);
|
|
33
|
+
stream.clearLine(0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function cursorToOn(stream, x, y) {
|
|
37
|
+
if (stream.isTTY) {
|
|
38
|
+
stream.cursorTo(x, y);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function getColumnsOf(stream) {
|
|
42
|
+
return stream.columns || 80;
|
|
43
|
+
}
|
|
44
|
+
function getRowsOf(stream) {
|
|
45
|
+
return stream.rows || 24;
|
|
46
|
+
}
|
|
47
|
+
function isTTYOf(stream) {
|
|
48
|
+
return stream.isTTY || false;
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
clearLineOn,
|
|
53
|
+
cursorToOn,
|
|
54
|
+
getColumnsOf,
|
|
55
|
+
getRowsOf,
|
|
56
|
+
isTTYOf
|
|
57
|
+
});
|
package/dist/stdio/divider.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Console divider and separator utilities.
|
|
3
|
+
* Provides various line styles for visual separation in CLI output.
|
|
4
|
+
*/
|
|
1
5
|
export interface DividerOptions {
|
|
2
6
|
/**
|
|
3
7
|
* Width of the divider line in characters.
|
|
@@ -30,18 +34,6 @@ export interface DividerOptions {
|
|
|
30
34
|
* ```
|
|
31
35
|
*/
|
|
32
36
|
export declare function divider(options?: DividerOptions): string;
|
|
33
|
-
/**
|
|
34
|
-
* Print a divider line directly to console.
|
|
35
|
-
*
|
|
36
|
-
* @param options - Divider formatting options
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* printDivider() // Prints default divider
|
|
41
|
-
* printDivider({ char: '─', width: 60 })
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare function printDivider(options?: DividerOptions): void;
|
|
45
37
|
/**
|
|
46
38
|
* Common divider style presets.
|
|
47
39
|
* Provides quick access to popular divider styles.
|
|
@@ -75,6 +67,42 @@ export declare const dividers: {
|
|
|
75
67
|
/** Arrow divider using `→` */
|
|
76
68
|
readonly arrow: () => string;
|
|
77
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Print a divider line directly to console.
|
|
72
|
+
*
|
|
73
|
+
* @param options - Divider formatting options
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* printDivider() // Prints default divider
|
|
78
|
+
* printDivider({ char: '─', width: 60 })
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare function printDivider(options?: DividerOptions): void;
|
|
82
|
+
/**
|
|
83
|
+
* Print a dotted divider line.
|
|
84
|
+
* Convenience function using `·` character.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* printDottedDivider()
|
|
89
|
+
* // ·······················································
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function printDottedDivider(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Print a section break with spacing directly to console.
|
|
95
|
+
*
|
|
96
|
+
* @param options - Divider formatting options
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* console.log('Previous section')
|
|
101
|
+
* printSectionBreak()
|
|
102
|
+
* console.log('Next section')
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function printSectionBreak(options?: DividerOptions): void;
|
|
78
106
|
/**
|
|
79
107
|
* Print a thick divider line (default style).
|
|
80
108
|
* Convenience function using `═` character.
|
|
@@ -97,17 +125,6 @@ export declare function printThickDivider(): void;
|
|
|
97
125
|
* ```
|
|
98
126
|
*/
|
|
99
127
|
export declare function printThinDivider(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Print a dotted divider line.
|
|
102
|
-
* Convenience function using `·` character.
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```ts
|
|
106
|
-
* printDottedDivider()
|
|
107
|
-
* // ·······················································
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export declare function printDottedDivider(): void;
|
|
111
128
|
/**
|
|
112
129
|
* Create a section break with blank lines before and after the divider.
|
|
113
130
|
* Useful for creating visual separation between major sections.
|
|
@@ -129,16 +146,3 @@ export declare function printDottedDivider(): void;
|
|
|
129
146
|
* ```
|
|
130
147
|
*/
|
|
131
148
|
export declare function sectionBreak(options?: DividerOptions): string;
|
|
132
|
-
/**
|
|
133
|
-
* Print a section break with spacing directly to console.
|
|
134
|
-
*
|
|
135
|
-
* @param options - Divider formatting options
|
|
136
|
-
*
|
|
137
|
-
* @example
|
|
138
|
-
* ```ts
|
|
139
|
-
* console.log('Previous section')
|
|
140
|
-
* printSectionBreak()
|
|
141
|
-
* console.log('Next section')
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
export declare function printSectionBreak(options?: DividerOptions): void;
|
package/dist/stdio/divider.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -35,9 +36,6 @@ function divider(options) {
|
|
|
35
36
|
const { char = "\u2550", width = 55 } = opts;
|
|
36
37
|
return (0, import_strings.repeatString)(char, width);
|
|
37
38
|
}
|
|
38
|
-
function printDivider(options) {
|
|
39
|
-
console.log(divider(options));
|
|
40
|
-
}
|
|
41
39
|
const dividers = {
|
|
42
40
|
/** Thick double-line divider using `═` */
|
|
43
41
|
thick: () => divider({ char: "\u2550" }),
|
|
@@ -60,24 +58,27 @@ const dividers = {
|
|
|
60
58
|
/** Arrow divider using `→` */
|
|
61
59
|
arrow: () => divider({ char: "\u2192" })
|
|
62
60
|
};
|
|
61
|
+
function printDivider(options) {
|
|
62
|
+
console.log(divider(options));
|
|
63
|
+
}
|
|
64
|
+
function printDottedDivider() {
|
|
65
|
+
printDivider({ char: "\xB7" });
|
|
66
|
+
}
|
|
67
|
+
function printSectionBreak(options) {
|
|
68
|
+
console.log(sectionBreak(options));
|
|
69
|
+
}
|
|
63
70
|
function printThickDivider() {
|
|
64
71
|
printDivider({ char: "\u2550" });
|
|
65
72
|
}
|
|
66
73
|
function printThinDivider() {
|
|
67
74
|
printDivider({ char: "\u2500" });
|
|
68
75
|
}
|
|
69
|
-
function printDottedDivider() {
|
|
70
|
-
printDivider({ char: "\xB7" });
|
|
71
|
-
}
|
|
72
76
|
function sectionBreak(options) {
|
|
73
77
|
const div = divider(options);
|
|
74
78
|
return `
|
|
75
79
|
${div}
|
|
76
80
|
`;
|
|
77
81
|
}
|
|
78
|
-
function printSectionBreak(options) {
|
|
79
|
-
console.log(sectionBreak(options));
|
|
80
|
-
}
|
|
81
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
83
|
0 && (module.exports = {
|
|
83
84
|
divider,
|