@socketsecurity/lib 5.18.1 → 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 +49 -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 -70
- 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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Testing framework
|
|
2
|
+
* @fileoverview Testing framework and CI-related string constants.
|
|
3
|
+
* Exports the canonical `TEST`, `VITEST`, `CI`, and `PRE_COMMIT` name
|
|
4
|
+
* strings referenced by env checks and configuration.
|
|
3
5
|
*/
|
|
4
|
-
// Testing frameworks.
|
|
5
6
|
export declare const TEST = "test";
|
|
6
7
|
export declare const VITEST = "VITEST";
|
|
7
|
-
// CI environment.
|
|
8
8
|
export declare const CI = "CI";
|
|
9
9
|
export declare const PRE_COMMIT = "PRE_COMMIT";
|
package/dist/constants/time.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Time-related constants
|
|
2
|
+
* @fileoverview Time-related numeric constants.
|
|
3
|
+
* Provides millisecond-per-unit multipliers (second/minute/hour/day) and
|
|
4
|
+
* derived cache TTLs such as the DLX binary cache expiration.
|
|
3
5
|
*/
|
|
4
|
-
// Time unit multipliers (milliseconds).
|
|
5
6
|
export declare const MILLISECONDS_PER_SECOND = 1000;
|
|
6
7
|
export declare const MILLISECONDS_PER_MINUTE: number;
|
|
7
8
|
export declare const MILLISECONDS_PER_HOUR: number;
|
|
8
9
|
export declare const MILLISECONDS_PER_DAY: number;
|
|
9
|
-
// Cache TTL values.
|
|
10
|
-
// DLX binary cache expires after 7 days.
|
|
11
10
|
export declare const DLX_BINARY_CACHE_TTL: number;
|
package/dist/constants/time.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TypeScript availability
|
|
2
|
+
* @fileoverview TypeScript availability detection.
|
|
3
|
+
* Exports small getters that probe whether the `typescript` package's type
|
|
4
|
+
* definitions and lib files are resolvable from the current project.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check whether TypeScript's `lib/` directory is resolvable from the current
|
|
8
|
+
* project by probing `typescript/lib`.
|
|
9
|
+
*
|
|
10
|
+
* @returns `true` when the `typescript` package's libs can be resolved.
|
|
3
11
|
*/
|
|
4
|
-
// TypeScript types/libs availability.
|
|
5
|
-
export declare function getTsTypesAvailable(): boolean;
|
|
6
12
|
export declare function getTsLibsAvailable(): boolean;
|
|
13
|
+
export declare function getTsTypesAvailable(): boolean;
|
|
@@ -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;
|
|
@@ -33,17 +34,17 @@ __export(typescript_exports, {
|
|
|
33
34
|
getTsTypesAvailable: () => getTsTypesAvailable
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(typescript_exports);
|
|
36
|
-
function
|
|
37
|
+
function getTsLibsAvailable() {
|
|
37
38
|
try {
|
|
38
|
-
require.resolve("typescript/lib
|
|
39
|
+
require.resolve("typescript/lib");
|
|
39
40
|
return true;
|
|
40
41
|
} catch {
|
|
41
42
|
return false;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function getTsTypesAvailable() {
|
|
45
46
|
try {
|
|
46
|
-
require.resolve("typescript/lib");
|
|
47
|
+
require.resolve("typescript/lib/lib.d.ts");
|
|
47
48
|
return true;
|
|
48
49
|
} catch {
|
|
49
50
|
return false;
|
package/dist/cover/code.d.ts
CHANGED
package/dist/cover/code.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,17 +39,25 @@ var import_objects = require("../objects");
|
|
|
38
39
|
var import_spawn = require("../spawn");
|
|
39
40
|
let _fs;
|
|
40
41
|
let _path;
|
|
42
|
+
function calculateMetric(data) {
|
|
43
|
+
const percent = data.total === 0 ? "0.00" : (data.covered / data.total * 100).toFixed(2);
|
|
44
|
+
return {
|
|
45
|
+
covered: data.covered,
|
|
46
|
+
percent,
|
|
47
|
+
total: data.total
|
|
48
|
+
};
|
|
49
|
+
}
|
|
41
50
|
// @__NO_SIDE_EFFECTS__
|
|
42
51
|
function getFs() {
|
|
43
52
|
if (_fs === void 0) {
|
|
44
|
-
_fs = require("fs");
|
|
53
|
+
_fs = require("node:fs");
|
|
45
54
|
}
|
|
46
55
|
return _fs;
|
|
47
56
|
}
|
|
48
57
|
// @__NO_SIDE_EFFECTS__
|
|
49
58
|
function getPath() {
|
|
50
59
|
if (_path === void 0) {
|
|
51
|
-
_path = require("path");
|
|
60
|
+
_path = require("node:path");
|
|
52
61
|
}
|
|
53
62
|
return _path;
|
|
54
63
|
}
|
|
@@ -65,8 +74,7 @@ async function getCodeCoverage(options) {
|
|
|
65
74
|
throw new Error("Coverage path is required");
|
|
66
75
|
}
|
|
67
76
|
const fs = /* @__PURE__ */ getFs();
|
|
68
|
-
|
|
69
|
-
if (!coverageExists) {
|
|
77
|
+
if (!fs.existsSync(coveragePath)) {
|
|
70
78
|
if (generateIfMissing) {
|
|
71
79
|
await (0, import_spawn.spawn)("vitest", ["run", "--coverage"], {
|
|
72
80
|
cwd: import_node_process.default.cwd(),
|
|
@@ -142,14 +150,6 @@ async function getCodeCoverage(options) {
|
|
|
142
150
|
statements: calculateMetric(totals.statements)
|
|
143
151
|
};
|
|
144
152
|
}
|
|
145
|
-
function calculateMetric(data) {
|
|
146
|
-
const percent = data.total === 0 ? "0.00" : (data.covered / data.total * 100).toFixed(2);
|
|
147
|
-
return {
|
|
148
|
-
covered: data.covered,
|
|
149
|
-
percent,
|
|
150
|
-
total: data.total
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
154
154
|
0 && (module.exports = {
|
|
155
155
|
getCodeCoverage
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type { FormatCoverageOptions } from './types';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* getCoverageEmoji(95) // ' \u{1F3AF}'
|
|
8
|
-
* getCoverageEmoji(50) // ' \u{1F528}'
|
|
9
|
-
* ```
|
|
2
|
+
* @fileoverview Coverage output formatters.
|
|
10
3
|
*/
|
|
11
|
-
|
|
4
|
+
import type { FormatCoverageOptions } from './types';
|
|
12
5
|
/**
|
|
13
6
|
* Format coverage data for console output.
|
|
14
7
|
*
|
|
@@ -25,3 +18,13 @@ export declare function getCoverageEmoji(percent: number): string;
|
|
|
25
18
|
* ```
|
|
26
19
|
*/
|
|
27
20
|
export declare function formatCoverage(options: FormatCoverageOptions): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get emoji for coverage percentage.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* getCoverageEmoji(95) // ' \u{1F3AF}'
|
|
27
|
+
* getCoverageEmoji(50) // ' \u{1F528}'
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCoverageEmoji(percent: number): string;
|
package/dist/cover/formatters.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,11 +36,19 @@ const COVERAGE_EMOJI_THRESHOLDS = [
|
|
|
35
36
|
{ emoji: " \u{1F528}", threshold: 50 },
|
|
36
37
|
{ emoji: " \u26A0\uFE0F", threshold: 0 }
|
|
37
38
|
];
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
function calculateOverall(code, type) {
|
|
40
|
+
const metrics = [
|
|
41
|
+
Number.parseFloat(code.statements.percent),
|
|
42
|
+
Number.parseFloat(code.branches.percent),
|
|
43
|
+
Number.parseFloat(code.functions.percent),
|
|
44
|
+
Number.parseFloat(code.lines.percent)
|
|
45
|
+
].map((val) => Number.isNaN(val) ? 0 : val);
|
|
46
|
+
if (type) {
|
|
47
|
+
const typePercent = Number.parseFloat(type.percent);
|
|
48
|
+
metrics.push(Number.isNaN(typePercent) ? 0 : typePercent);
|
|
49
|
+
}
|
|
50
|
+
const average = metrics.reduce((sum, val) => sum + val, 0) / metrics.length;
|
|
51
|
+
return average.toFixed(2);
|
|
43
52
|
}
|
|
44
53
|
function formatCoverage(options) {
|
|
45
54
|
const opts = {
|
|
@@ -84,19 +93,11 @@ Overall: ${overall}%${emoji}
|
|
|
84
93
|
`;
|
|
85
94
|
return output;
|
|
86
95
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Number.parseFloat(code.lines.percent)
|
|
93
|
-
].map((val) => Number.isNaN(val) ? 0 : val);
|
|
94
|
-
if (type) {
|
|
95
|
-
const typePercent = Number.parseFloat(type.percent);
|
|
96
|
-
metrics.push(Number.isNaN(typePercent) ? 0 : typePercent);
|
|
97
|
-
}
|
|
98
|
-
const average = metrics.reduce((sum, val) => sum + val, 0) / metrics.length;
|
|
99
|
-
return average.toFixed(2);
|
|
96
|
+
function getCoverageEmoji(percent) {
|
|
97
|
+
const entry = COVERAGE_EMOJI_THRESHOLDS.find(
|
|
98
|
+
({ threshold }) => percent >= threshold
|
|
99
|
+
);
|
|
100
|
+
return entry?.emoji || "";
|
|
100
101
|
}
|
|
101
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
102
103
|
0 && (module.exports = {
|
package/dist/cover/type.d.ts
CHANGED
package/dist/cover/type.js
CHANGED
package/dist/cover/types.js
CHANGED
package/dist/debug.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Debug logging utilities with lazy loading and environment-based control.
|
|
3
|
+
* Provides Socket CLI specific debug functionality and logging formatters.
|
|
4
|
+
*/
|
|
2
5
|
interface DebugOptions {
|
|
3
6
|
namespaces?: string;
|
|
4
7
|
spinner?: {
|
|
@@ -16,24 +19,9 @@ interface InspectOptions {
|
|
|
16
19
|
}
|
|
17
20
|
export type { DebugOptions, NamespacesOrOptions, InspectOptions };
|
|
18
21
|
/**
|
|
19
|
-
* Debug output for
|
|
20
|
-
*/
|
|
21
|
-
declare function debugDirNs(namespacesOrOpts: NamespacesOrOptions, obj: unknown, inspectOpts?: InspectOptions | undefined): void;
|
|
22
|
-
/**
|
|
23
|
-
* Debug output with caller info.
|
|
24
|
-
*/
|
|
25
|
-
declare function debugNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]): void;
|
|
26
|
-
/**
|
|
27
|
-
* Debug logging function with caller info.
|
|
28
|
-
*/
|
|
29
|
-
declare function debugLogNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]): void;
|
|
30
|
-
/**
|
|
31
|
-
* Debug output for cache operations with caller info.
|
|
32
|
-
* First argument is the operation type (hit/miss/set/clear).
|
|
33
|
-
* Second argument is the cache key or message.
|
|
34
|
-
* Optional third argument is metadata object.
|
|
22
|
+
* Debug output with caller info (wrapper for debugNs with default namespace).
|
|
35
23
|
*/
|
|
36
|
-
declare function
|
|
24
|
+
export declare function debug(...args: unknown[]): void;
|
|
37
25
|
/**
|
|
38
26
|
* Cache debug function with caller info.
|
|
39
27
|
*
|
|
@@ -43,56 +31,53 @@ declare function debugCacheNs(namespacesOrOpts: NamespacesOrOptions, operation:
|
|
|
43
31
|
* debugCache('miss', 'socket-sdk:scans:xyz', { ttl: 60000 })
|
|
44
32
|
* ```
|
|
45
33
|
*/
|
|
46
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
47
34
|
export declare function debugCache(operation: string, key: string, meta?: unknown | undefined): void;
|
|
48
35
|
/**
|
|
49
|
-
*
|
|
36
|
+
* Debug output for cache operations with caller info.
|
|
37
|
+
* First argument is the operation type (hit/miss/set/clear).
|
|
38
|
+
* Second argument is the cache key or message.
|
|
39
|
+
* Optional third argument is metadata object.
|
|
50
40
|
*/
|
|
51
|
-
|
|
52
|
-
declare function isDebugNs(namespaces: string | undefined): boolean;
|
|
41
|
+
export declare function debugCacheNs(namespacesOrOpts: NamespacesOrOptions, operation: string, key: string, meta?: unknown | undefined): void;
|
|
53
42
|
/**
|
|
54
|
-
* Debug output
|
|
43
|
+
* Debug output for object inspection (wrapper for debugDirNs with default namespace).
|
|
55
44
|
*/
|
|
56
|
-
declare function
|
|
45
|
+
export declare function debugDir(obj: unknown, inspectOpts?: InspectOptions | undefined): void;
|
|
57
46
|
/**
|
|
58
|
-
* Debug output for object inspection
|
|
47
|
+
* Debug output for object inspection with caller info.
|
|
59
48
|
*/
|
|
60
|
-
declare function
|
|
49
|
+
export declare function debugDirNs(namespacesOrOpts: NamespacesOrOptions, obj: unknown, inspectOpts?: InspectOptions | undefined): void;
|
|
61
50
|
/**
|
|
62
51
|
* Debug logging function (wrapper for debugLogNs with default namespace).
|
|
63
52
|
*/
|
|
64
|
-
declare function debugLog(...args: unknown[]): void;
|
|
53
|
+
export declare function debugLog(...args: unknown[]): void;
|
|
65
54
|
/**
|
|
66
|
-
*
|
|
55
|
+
* Debug logging function with caller info.
|
|
67
56
|
*/
|
|
68
|
-
|
|
69
|
-
declare function isDebug(): boolean;
|
|
57
|
+
export declare function debugLogNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]): void;
|
|
70
58
|
/**
|
|
71
59
|
* Create a Node.js util.debuglog compatible function.
|
|
72
60
|
* Returns a function that conditionally writes debug messages to stderr.
|
|
73
61
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
export declare function debuglog(section: string): import("util").DebugLogger;
|
|
63
|
+
/**
|
|
64
|
+
* Debug output with caller info.
|
|
65
|
+
*/
|
|
66
|
+
export declare function debugNs(namespacesOrOpts: NamespacesOrOptions, ...args: unknown[]): void;
|
|
76
67
|
/**
|
|
77
68
|
* Create timing functions for measuring code execution time.
|
|
78
69
|
* Returns an object with start() and end() methods, plus a callable function.
|
|
79
70
|
*/
|
|
80
|
-
|
|
81
|
-
declare function debugtime(label: string): {
|
|
71
|
+
export declare function debugtime(label: string): {
|
|
82
72
|
(): void;
|
|
83
73
|
start: () => void;
|
|
84
74
|
end: () => void;
|
|
85
75
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export
|
|
94
|
-
export { debugLogNs };
|
|
95
|
-
export { debugNs };
|
|
96
|
-
export { debugtime };
|
|
97
|
-
export { isDebug };
|
|
98
|
-
export { isDebugNs };
|
|
76
|
+
/**
|
|
77
|
+
* Check if debug mode is enabled.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isDebug(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Check if debug mode is enabled.
|
|
82
|
+
*/
|
|
83
|
+
export declare function isDebugNs(namespaces: string | undefined): boolean;
|
package/dist/debug.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;
|
|
@@ -54,27 +55,23 @@ var import_strings = require("./strings");
|
|
|
54
55
|
const ReflectApply = Reflect.apply;
|
|
55
56
|
const logger = (0, import_logger.getDefaultLogger)();
|
|
56
57
|
const debugByNamespace = /* @__PURE__ */ new Map();
|
|
58
|
+
let _util;
|
|
59
|
+
let pointingTriangle;
|
|
57
60
|
// @__NO_SIDE_EFFECTS__
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
debugByNamespace.set(namespace, inst);
|
|
69
|
-
return inst;
|
|
61
|
+
function customLog(...args) {
|
|
62
|
+
const util = /* @__PURE__ */ getUtil();
|
|
63
|
+
const inspectOpts = import_debug2.default.inspectOpts ? {
|
|
64
|
+
...import_debug2.default.inspectOpts,
|
|
65
|
+
showHidden: import_debug2.default.inspectOpts.showHidden === null ? void 0 : import_debug2.default.inspectOpts.showHidden,
|
|
66
|
+
depth: import_debug2.default.inspectOpts.depth === null || typeof import_debug2.default.inspectOpts.depth === "boolean" ? void 0 : import_debug2.default.inspectOpts.depth
|
|
67
|
+
} : {};
|
|
68
|
+
ReflectApply(logger.info, logger, [
|
|
69
|
+
util.formatWithOptions(inspectOpts, ...args)
|
|
70
|
+
]);
|
|
70
71
|
}
|
|
71
|
-
let _util;
|
|
72
72
|
// @__NO_SIDE_EFFECTS__
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
_util = require("util");
|
|
76
|
-
}
|
|
77
|
-
return _util;
|
|
73
|
+
function extractOptions(namespaces) {
|
|
74
|
+
return namespaces !== null && typeof namespaces === "object" ? { __proto__: null, ...namespaces } : { __proto__: null, namespaces };
|
|
78
75
|
}
|
|
79
76
|
// @__NO_SIDE_EFFECTS__
|
|
80
77
|
function getCallerInfo(stackOffset = 3) {
|
|
@@ -116,20 +113,25 @@ function getCallerInfo(stackOffset = 3) {
|
|
|
116
113
|
return name;
|
|
117
114
|
}
|
|
118
115
|
// @__NO_SIDE_EFFECTS__
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
function getDebugJsInstance(namespace) {
|
|
117
|
+
let inst = debugByNamespace.get(namespace);
|
|
118
|
+
if (inst) {
|
|
119
|
+
return inst;
|
|
120
|
+
}
|
|
121
|
+
if (!(0, import_debug.getDebug)() && (0, import_socket.getSocketDebug)() && (namespace === "error" || namespace === "notice")) {
|
|
122
|
+
import_debug2.default.enable(namespace);
|
|
123
|
+
}
|
|
124
|
+
inst = (0, import_debug2.default)(namespace);
|
|
125
|
+
inst.log = customLog;
|
|
126
|
+
debugByNamespace.set(namespace, inst);
|
|
127
|
+
return inst;
|
|
129
128
|
}
|
|
130
129
|
// @__NO_SIDE_EFFECTS__
|
|
131
|
-
function
|
|
132
|
-
|
|
130
|
+
function getUtil() {
|
|
131
|
+
if (_util === void 0) {
|
|
132
|
+
_util = require("node:util");
|
|
133
|
+
}
|
|
134
|
+
return _util;
|
|
133
135
|
}
|
|
134
136
|
// @__NO_SIDE_EFFECTS__
|
|
135
137
|
function isEnabled(namespaces) {
|
|
@@ -154,6 +156,47 @@ function isEnabled(namespaces) {
|
|
|
154
156
|
}
|
|
155
157
|
return skips.every((ns) => !(/* @__PURE__ */ getDebugJsInstance(ns)).enabled);
|
|
156
158
|
}
|
|
159
|
+
function debug(...args) {
|
|
160
|
+
debugNs("*", ...args);
|
|
161
|
+
}
|
|
162
|
+
// @__NO_SIDE_EFFECTS__
|
|
163
|
+
function debugCache(operation, key, meta) {
|
|
164
|
+
if (!(0, import_socket.getSocketDebug)()) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const callerName = /* @__PURE__ */ getCallerInfo(3) || "cache";
|
|
168
|
+
if (pointingTriangle === void 0) {
|
|
169
|
+
const supported = (0, import_is_unicode_supported.default)();
|
|
170
|
+
pointingTriangle = supported ? "\u25B8" : ">";
|
|
171
|
+
}
|
|
172
|
+
const prefix = `[CACHE] ${callerName} ${pointingTriangle} ${operation}: ${key}`;
|
|
173
|
+
const args = meta !== void 0 ? [prefix, meta] : [prefix];
|
|
174
|
+
console.log(...args);
|
|
175
|
+
}
|
|
176
|
+
function debugCacheNs(namespacesOrOpts, operation, key, meta) {
|
|
177
|
+
const options = /* @__PURE__ */ extractOptions(namespacesOrOpts);
|
|
178
|
+
const { namespaces } = options;
|
|
179
|
+
if (!/* @__PURE__ */ isEnabled(namespaces)) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const callerName = /* @__PURE__ */ getCallerInfo(4) || "cache";
|
|
183
|
+
if (pointingTriangle === void 0) {
|
|
184
|
+
const supported = (0, import_is_unicode_supported.default)();
|
|
185
|
+
pointingTriangle = supported ? "\u25B8" : ">";
|
|
186
|
+
}
|
|
187
|
+
const prefix = `[CACHE] ${callerName} ${pointingTriangle} ${operation}: ${key}`;
|
|
188
|
+
const logArgs = meta !== void 0 ? [prefix, meta] : [prefix];
|
|
189
|
+
const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
|
|
190
|
+
const wasSpinning = spinnerInstance?.isSpinning;
|
|
191
|
+
spinnerInstance?.stop();
|
|
192
|
+
ReflectApply(logger.info, logger, logArgs);
|
|
193
|
+
if (wasSpinning) {
|
|
194
|
+
spinnerInstance?.start();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function debugDir(obj, inspectOpts) {
|
|
198
|
+
debugDirNs("*", obj, inspectOpts);
|
|
199
|
+
}
|
|
157
200
|
function debugDirNs(namespacesOrOpts, obj, inspectOpts) {
|
|
158
201
|
const options = /* @__PURE__ */ extractOptions(namespacesOrOpts);
|
|
159
202
|
const { namespaces } = options;
|
|
@@ -185,14 +228,16 @@ function debugDirNs(namespacesOrOpts, obj, inspectOpts) {
|
|
|
185
228
|
spinnerInstance?.start();
|
|
186
229
|
}
|
|
187
230
|
}
|
|
188
|
-
|
|
189
|
-
|
|
231
|
+
function debugLog(...args) {
|
|
232
|
+
debugLogNs("*", ...args);
|
|
233
|
+
}
|
|
234
|
+
function debugLogNs(namespacesOrOpts, ...args) {
|
|
190
235
|
const options = /* @__PURE__ */ extractOptions(namespacesOrOpts);
|
|
191
236
|
const { namespaces } = options;
|
|
192
237
|
if (!/* @__PURE__ */ isEnabled(namespaces)) {
|
|
193
238
|
return;
|
|
194
239
|
}
|
|
195
|
-
const
|
|
240
|
+
const callerName = /* @__PURE__ */ getCallerInfo(4) || "anonymous";
|
|
196
241
|
if (pointingTriangle === void 0) {
|
|
197
242
|
const supported = (0, import_is_unicode_supported.default)();
|
|
198
243
|
pointingTriangle = supported ? "\u25B8" : ">";
|
|
@@ -200,11 +245,11 @@ function debugNs(namespacesOrOpts, ...args) {
|
|
|
200
245
|
const text = args.at(0);
|
|
201
246
|
const logArgs = typeof text === "string" ? [
|
|
202
247
|
(0, import_strings.applyLinePrefix)(
|
|
203
|
-
`${
|
|
248
|
+
`${callerName ? `${callerName} ${pointingTriangle} ` : ""}${text}`,
|
|
204
249
|
{ prefix: "[DEBUG] " }
|
|
205
250
|
),
|
|
206
251
|
...args.slice(1)
|
|
207
|
-
] : args;
|
|
252
|
+
] : [`[DEBUG] ${callerName} ${pointingTriangle}`, ...args];
|
|
208
253
|
const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
|
|
209
254
|
const wasSpinning = spinnerInstance?.isSpinning;
|
|
210
255
|
spinnerInstance?.stop();
|
|
@@ -213,13 +258,18 @@ function debugNs(namespacesOrOpts, ...args) {
|
|
|
213
258
|
spinnerInstance?.start();
|
|
214
259
|
}
|
|
215
260
|
}
|
|
216
|
-
|
|
261
|
+
// @__NO_SIDE_EFFECTS__
|
|
262
|
+
function debuglog(section) {
|
|
263
|
+
const util = /* @__PURE__ */ getUtil();
|
|
264
|
+
return util.debuglog(section);
|
|
265
|
+
}
|
|
266
|
+
function debugNs(namespacesOrOpts, ...args) {
|
|
217
267
|
const options = /* @__PURE__ */ extractOptions(namespacesOrOpts);
|
|
218
268
|
const { namespaces } = options;
|
|
219
269
|
if (!/* @__PURE__ */ isEnabled(namespaces)) {
|
|
220
270
|
return;
|
|
221
271
|
}
|
|
222
|
-
const
|
|
272
|
+
const name = /* @__PURE__ */ getCallerInfo(4) || "anonymous";
|
|
223
273
|
if (pointingTriangle === void 0) {
|
|
224
274
|
const supported = (0, import_is_unicode_supported.default)();
|
|
225
275
|
pointingTriangle = supported ? "\u25B8" : ">";
|
|
@@ -227,32 +277,11 @@ function debugLogNs(namespacesOrOpts, ...args) {
|
|
|
227
277
|
const text = args.at(0);
|
|
228
278
|
const logArgs = typeof text === "string" ? [
|
|
229
279
|
(0, import_strings.applyLinePrefix)(
|
|
230
|
-
`${
|
|
280
|
+
`${name ? `${name} ${pointingTriangle} ` : ""}${text}`,
|
|
231
281
|
{ prefix: "[DEBUG] " }
|
|
232
282
|
),
|
|
233
283
|
...args.slice(1)
|
|
234
|
-
] :
|
|
235
|
-
const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
|
|
236
|
-
const wasSpinning = spinnerInstance?.isSpinning;
|
|
237
|
-
spinnerInstance?.stop();
|
|
238
|
-
ReflectApply(logger.info, logger, logArgs);
|
|
239
|
-
if (wasSpinning) {
|
|
240
|
-
spinnerInstance?.start();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function debugCacheNs(namespacesOrOpts, operation, key, meta) {
|
|
244
|
-
const options = /* @__PURE__ */ extractOptions(namespacesOrOpts);
|
|
245
|
-
const { namespaces } = options;
|
|
246
|
-
if (!/* @__PURE__ */ isEnabled(namespaces)) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const callerName = /* @__PURE__ */ getCallerInfo(4) || "cache";
|
|
250
|
-
if (pointingTriangle === void 0) {
|
|
251
|
-
const supported = (0, import_is_unicode_supported.default)();
|
|
252
|
-
pointingTriangle = supported ? "\u25B8" : ">";
|
|
253
|
-
}
|
|
254
|
-
const prefix = `[CACHE] ${callerName} ${pointingTriangle} ${operation}: ${key}`;
|
|
255
|
-
const logArgs = meta !== void 0 ? [prefix, meta] : [prefix];
|
|
284
|
+
] : args;
|
|
256
285
|
const spinnerInstance = options.spinner || (0, import_spinner.getDefaultSpinner)();
|
|
257
286
|
const wasSpinning = spinnerInstance?.isSpinning;
|
|
258
287
|
spinnerInstance?.stop();
|
|
@@ -262,42 +291,6 @@ function debugCacheNs(namespacesOrOpts, operation, key, meta) {
|
|
|
262
291
|
}
|
|
263
292
|
}
|
|
264
293
|
// @__NO_SIDE_EFFECTS__
|
|
265
|
-
function debugCache(operation, key, meta) {
|
|
266
|
-
if (!(0, import_socket.getSocketDebug)()) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const callerName = /* @__PURE__ */ getCallerInfo(3) || "cache";
|
|
270
|
-
if (pointingTriangle === void 0) {
|
|
271
|
-
const supported = (0, import_is_unicode_supported.default)();
|
|
272
|
-
pointingTriangle = supported ? "\u25B8" : ">";
|
|
273
|
-
}
|
|
274
|
-
const prefix = `[CACHE] ${callerName} ${pointingTriangle} ${operation}: ${key}`;
|
|
275
|
-
const args = meta !== void 0 ? [prefix, meta] : [prefix];
|
|
276
|
-
console.log(...args);
|
|
277
|
-
}
|
|
278
|
-
// @__NO_SIDE_EFFECTS__
|
|
279
|
-
function isDebugNs(namespaces) {
|
|
280
|
-
return !!(0, import_socket.getSocketDebug)() && /* @__PURE__ */ isEnabled(namespaces);
|
|
281
|
-
}
|
|
282
|
-
function debug(...args) {
|
|
283
|
-
debugNs("*", ...args);
|
|
284
|
-
}
|
|
285
|
-
function debugDir(obj, inspectOpts) {
|
|
286
|
-
debugDirNs("*", obj, inspectOpts);
|
|
287
|
-
}
|
|
288
|
-
function debugLog(...args) {
|
|
289
|
-
debugLogNs("*", ...args);
|
|
290
|
-
}
|
|
291
|
-
// @__NO_SIDE_EFFECTS__
|
|
292
|
-
function isDebug() {
|
|
293
|
-
return !!(0, import_socket.getSocketDebug)();
|
|
294
|
-
}
|
|
295
|
-
// @__NO_SIDE_EFFECTS__
|
|
296
|
-
function debuglog(section) {
|
|
297
|
-
const util = /* @__PURE__ */ getUtil();
|
|
298
|
-
return util.debuglog(section);
|
|
299
|
-
}
|
|
300
|
-
// @__NO_SIDE_EFFECTS__
|
|
301
294
|
function debugtime(label) {
|
|
302
295
|
const util = /* @__PURE__ */ getUtil();
|
|
303
296
|
let startTime;
|
|
@@ -322,6 +315,14 @@ function debugtime(label) {
|
|
|
322
315
|
};
|
|
323
316
|
return impl;
|
|
324
317
|
}
|
|
318
|
+
// @__NO_SIDE_EFFECTS__
|
|
319
|
+
function isDebug() {
|
|
320
|
+
return !!(0, import_socket.getSocketDebug)();
|
|
321
|
+
}
|
|
322
|
+
// @__NO_SIDE_EFFECTS__
|
|
323
|
+
function isDebugNs(namespaces) {
|
|
324
|
+
return !!(0, import_socket.getSocketDebug)() && /* @__PURE__ */ isEnabled(namespaces);
|
|
325
|
+
}
|
|
325
326
|
// Annotate the CommonJS export names for ESM import in node:
|
|
326
327
|
0 && (module.exports = {
|
|
327
328
|
debug,
|