@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/dlx/package.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;
|
|
@@ -42,7 +43,6 @@ __export(package_exports, {
|
|
|
42
43
|
module.exports = __toCommonJS(package_exports);
|
|
43
44
|
var import_platform = require("../constants/platform");
|
|
44
45
|
var import_socket = require("../constants/socket");
|
|
45
|
-
var import_cache = require("./cache");
|
|
46
46
|
var import_arborist = __toESM(require("../external/@npmcli/arborist"));
|
|
47
47
|
var import_libnpmexec = __toESM(require("../external/libnpmexec"));
|
|
48
48
|
var import_npm_package_arg = __toESM(require("../external/npm-package-arg"));
|
|
@@ -52,23 +52,90 @@ var import_normalize = require("../paths/normalize");
|
|
|
52
52
|
var import_socket2 = require("../paths/socket");
|
|
53
53
|
var import_process_lock = require("../process-lock");
|
|
54
54
|
var import_spawn = require("../spawn");
|
|
55
|
+
var import_cache = require("./cache");
|
|
55
56
|
let _fs;
|
|
57
|
+
let _path;
|
|
58
|
+
const rangeOperatorsRegExp = /[~^><=xX* ]|\|\|/;
|
|
59
|
+
const FIREWALL_API_URL = "https://firewall-api.socket.dev/purl";
|
|
60
|
+
const FIREWALL_TIMEOUT = 1e4;
|
|
61
|
+
const FIREWALL_BLOCK_SEVERITIES = /* @__PURE__ */ new Set([
|
|
62
|
+
"critical",
|
|
63
|
+
"high"
|
|
64
|
+
]);
|
|
65
|
+
const binaryPathCache = /* @__PURE__ */ new Map();
|
|
66
|
+
async function checkFirewallPurls(arb, requestedPackage) {
|
|
67
|
+
const idealTree = arb.idealTree;
|
|
68
|
+
if (!idealTree) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const purls = [];
|
|
72
|
+
for (const node of idealTree.inventory.values()) {
|
|
73
|
+
if (node.isProjectRoot) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const { name, version } = node.package;
|
|
77
|
+
if (!name || !version) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
purls.push({ purl: npmPurl(name, version), name, version });
|
|
81
|
+
}
|
|
82
|
+
if (purls.length === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const blocked = [];
|
|
86
|
+
await Promise.allSettled(
|
|
87
|
+
purls.map(async ({ name, purl, version }) => {
|
|
88
|
+
try {
|
|
89
|
+
const data = await (0, import_http_request.httpJson)(
|
|
90
|
+
`${FIREWALL_API_URL}/${encodeURIComponent(purl)}`,
|
|
91
|
+
{
|
|
92
|
+
headers: { "User-Agent": import_socket.SOCKET_LIB_USER_AGENT },
|
|
93
|
+
timeout: FIREWALL_TIMEOUT,
|
|
94
|
+
retries: 1,
|
|
95
|
+
retryDelay: 500
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
const blocking = (data.alerts ?? []).filter(
|
|
99
|
+
(a) => a.severity && FIREWALL_BLOCK_SEVERITIES.has(a.severity)
|
|
100
|
+
);
|
|
101
|
+
if (blocking.length > 0) {
|
|
102
|
+
blocked.push({
|
|
103
|
+
name,
|
|
104
|
+
version,
|
|
105
|
+
alerts: blocking.map(
|
|
106
|
+
(a) => `${a.severity}: ${a.type ?? a.key ?? "unknown"}`
|
|
107
|
+
)
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
if (blocked.length > 0) {
|
|
115
|
+
const details = blocked.map((b) => ` ${b.name}@${b.version}: ${b.alerts.join(", ")}`).join("\n");
|
|
116
|
+
throw new Error(
|
|
117
|
+
`Socket Firewall blocked installation of "${requestedPackage}".
|
|
118
|
+
The following dependencies have security alerts:
|
|
119
|
+
${details}
|
|
120
|
+
|
|
121
|
+
Visit https://socket.dev for more information.`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
56
125
|
// @__NO_SIDE_EFFECTS__
|
|
57
126
|
function getFs() {
|
|
58
127
|
if (_fs === void 0) {
|
|
59
|
-
_fs = require("fs");
|
|
128
|
+
_fs = require("node:fs");
|
|
60
129
|
}
|
|
61
130
|
return _fs;
|
|
62
131
|
}
|
|
63
|
-
let _path;
|
|
64
132
|
// @__NO_SIDE_EFFECTS__
|
|
65
133
|
function getPath() {
|
|
66
134
|
if (_path === void 0) {
|
|
67
|
-
_path = require("path");
|
|
135
|
+
_path = require("node:path");
|
|
68
136
|
}
|
|
69
137
|
return _path;
|
|
70
138
|
}
|
|
71
|
-
const rangeOperatorsRegExp = /[~^><=xX* ]|\|\|/;
|
|
72
139
|
async function dlxPackage(args, options, spawnExtra) {
|
|
73
140
|
const downloadResult = await downloadPackage(options);
|
|
74
141
|
const spawnPromise = executePackage(
|
|
@@ -86,6 +153,8 @@ async function downloadPackage(options) {
|
|
|
86
153
|
const {
|
|
87
154
|
binaryName,
|
|
88
155
|
force: userForce,
|
|
156
|
+
hash,
|
|
157
|
+
lockfile,
|
|
89
158
|
package: packageSpec,
|
|
90
159
|
yes
|
|
91
160
|
} = {
|
|
@@ -99,7 +168,8 @@ async function downloadPackage(options) {
|
|
|
99
168
|
const { installed, packageDir } = await ensurePackageInstalled(
|
|
100
169
|
packageName,
|
|
101
170
|
fullPackageSpec,
|
|
102
|
-
force
|
|
171
|
+
force,
|
|
172
|
+
{ hash, lockfile }
|
|
103
173
|
);
|
|
104
174
|
const binaryPath = findBinaryPath(packageDir, packageName, binaryName);
|
|
105
175
|
makePackageBinsExecutable(packageDir, packageName);
|
|
@@ -109,7 +179,7 @@ async function downloadPackage(options) {
|
|
|
109
179
|
packageDir
|
|
110
180
|
};
|
|
111
181
|
}
|
|
112
|
-
async function ensurePackageInstalled(packageName, packageSpec, force) {
|
|
182
|
+
async function ensurePackageInstalled(packageName, packageSpec, force, install) {
|
|
113
183
|
const fs = /* @__PURE__ */ getFs();
|
|
114
184
|
const path = /* @__PURE__ */ getPath();
|
|
115
185
|
const cacheKey = (0, import_cache.generateCacheKey)(packageSpec);
|
|
@@ -149,6 +219,29 @@ Ensure the filesystem is writable or set SOCKET_DLX_DIR to a writable location.`
|
|
|
149
219
|
return { installed: false, packageDir };
|
|
150
220
|
}
|
|
151
221
|
}
|
|
222
|
+
if (install?.lockfile !== void 0) {
|
|
223
|
+
const spec = install.lockfile;
|
|
224
|
+
const lockDest = path.join(packageDir, "package-lock.json");
|
|
225
|
+
let isContent;
|
|
226
|
+
let value;
|
|
227
|
+
if (typeof spec === "string") {
|
|
228
|
+
isContent = spec.trimStart().startsWith("{");
|
|
229
|
+
value = spec;
|
|
230
|
+
} else {
|
|
231
|
+
isContent = spec.type === "content";
|
|
232
|
+
value = spec.value;
|
|
233
|
+
}
|
|
234
|
+
if (isContent) {
|
|
235
|
+
fs.writeFileSync(lockDest, value, "utf8");
|
|
236
|
+
} else {
|
|
237
|
+
fs.copyFileSync(value, lockDest);
|
|
238
|
+
}
|
|
239
|
+
fs.writeFileSync(
|
|
240
|
+
path.join(packageDir, ".npmrc"),
|
|
241
|
+
"ignore-scripts=true\naudit=false\nfund=false\nsave=false\n",
|
|
242
|
+
"utf8"
|
|
243
|
+
);
|
|
244
|
+
}
|
|
152
245
|
try {
|
|
153
246
|
const arb = new import_arborist.default({
|
|
154
247
|
path: packageDir,
|
|
@@ -174,7 +267,7 @@ Ensure the filesystem is writable or set SOCKET_DLX_DIR to a writable location.`
|
|
|
174
267
|
if (e instanceof Error && e.message.startsWith("Socket Firewall blocked")) {
|
|
175
268
|
throw e;
|
|
176
269
|
}
|
|
177
|
-
const code = e
|
|
270
|
+
const code = e?.code;
|
|
178
271
|
if (code === "E404" || code === "ETARGET") {
|
|
179
272
|
throw new Error(
|
|
180
273
|
`Package not found: ${packageSpec}
|
|
@@ -303,76 +396,11 @@ function makePackageBinsExecutable(packageDir, packageName) {
|
|
|
303
396
|
} catch {
|
|
304
397
|
}
|
|
305
398
|
}
|
|
306
|
-
const FIREWALL_API_URL = "https://firewall-api.socket.dev/purl";
|
|
307
|
-
const FIREWALL_TIMEOUT = 1e4;
|
|
308
|
-
const FIREWALL_BLOCK_SEVERITIES = /* @__PURE__ */ new Set([
|
|
309
|
-
"critical",
|
|
310
|
-
"high"
|
|
311
|
-
]);
|
|
312
399
|
function npmPurl(name, version) {
|
|
313
400
|
const encoded = name.startsWith("@") ? `%40${name.slice(1)}` : name;
|
|
314
401
|
const encodedVersion = version.replace(/\+/g, "%2B");
|
|
315
402
|
return `pkg:npm/${encoded}@${encodedVersion}`;
|
|
316
403
|
}
|
|
317
|
-
async function checkFirewallPurls(arb, requestedPackage) {
|
|
318
|
-
const idealTree = arb.idealTree;
|
|
319
|
-
if (!idealTree) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
const purls = [];
|
|
323
|
-
for (const node of idealTree.inventory.values()) {
|
|
324
|
-
if (node.isProjectRoot) {
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
const { name, version } = node.package;
|
|
328
|
-
if (!name || !version) {
|
|
329
|
-
continue;
|
|
330
|
-
}
|
|
331
|
-
purls.push({ purl: npmPurl(name, version), name, version });
|
|
332
|
-
}
|
|
333
|
-
if (purls.length === 0) {
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
const blocked = [];
|
|
337
|
-
await Promise.allSettled(
|
|
338
|
-
purls.map(async ({ name, purl, version }) => {
|
|
339
|
-
try {
|
|
340
|
-
const data = await (0, import_http_request.httpJson)(
|
|
341
|
-
`${FIREWALL_API_URL}/${encodeURIComponent(purl)}`,
|
|
342
|
-
{
|
|
343
|
-
headers: { "User-Agent": import_socket.SOCKET_LIB_USER_AGENT },
|
|
344
|
-
timeout: FIREWALL_TIMEOUT,
|
|
345
|
-
retries: 1,
|
|
346
|
-
retryDelay: 500
|
|
347
|
-
}
|
|
348
|
-
);
|
|
349
|
-
const blocking = (data.alerts ?? []).filter(
|
|
350
|
-
(a) => a.severity && FIREWALL_BLOCK_SEVERITIES.has(a.severity)
|
|
351
|
-
);
|
|
352
|
-
if (blocking.length > 0) {
|
|
353
|
-
blocked.push({
|
|
354
|
-
name,
|
|
355
|
-
version,
|
|
356
|
-
alerts: blocking.map(
|
|
357
|
-
(a) => `${a.severity}: ${a.type ?? a.key ?? "unknown"}`
|
|
358
|
-
)
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
} catch {
|
|
362
|
-
}
|
|
363
|
-
})
|
|
364
|
-
);
|
|
365
|
-
if (blocked.length > 0) {
|
|
366
|
-
const details = blocked.map((b) => ` ${b.name}@${b.version}: ${b.alerts.join(", ")}`).join("\n");
|
|
367
|
-
throw new Error(
|
|
368
|
-
`Socket Firewall blocked installation of "${requestedPackage}".
|
|
369
|
-
The following dependencies have security alerts:
|
|
370
|
-
${details}
|
|
371
|
-
|
|
372
|
-
Visit https://socket.dev for more information.`
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
404
|
function parsePackageSpec(spec) {
|
|
377
405
|
try {
|
|
378
406
|
const parsed = (0, import_npm_package_arg.default)(spec);
|
|
@@ -392,7 +420,6 @@ function parsePackageSpec(spec) {
|
|
|
392
420
|
};
|
|
393
421
|
}
|
|
394
422
|
}
|
|
395
|
-
const binaryPathCache = /* @__PURE__ */ new Map();
|
|
396
423
|
function resolveBinaryPath(basePath) {
|
|
397
424
|
if (!import_platform.WIN32) {
|
|
398
425
|
return basePath;
|
package/dist/dlx/packages.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @fileoverview Package management utilities for DLX installations. */
|
|
1
2
|
/**
|
|
2
3
|
* Check if a package is installed in DLX.
|
|
3
4
|
*
|
|
@@ -9,17 +10,6 @@
|
|
|
9
10
|
* ```
|
|
10
11
|
*/
|
|
11
12
|
export declare function isDlxPackageInstalled(packageName: string): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Check if a package is installed in DLX asynchronously.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* if (await isDlxPackageInstalledAsync('prettier')) {
|
|
18
|
-
* console.log('prettier is installed')
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function isDlxPackageInstalledAsync(packageName: string): Promise<boolean>;
|
|
23
13
|
/**
|
|
24
14
|
* List all packages installed in DLX.
|
|
25
15
|
*
|
package/dist/dlx/packages.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;
|
|
@@ -20,7 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
21
|
var packages_exports = {};
|
|
21
22
|
__export(packages_exports, {
|
|
22
23
|
isDlxPackageInstalled: () => isDlxPackageInstalled,
|
|
23
|
-
isDlxPackageInstalledAsync: () => isDlxPackageInstalledAsync,
|
|
24
24
|
listDlxPackages: () => listDlxPackages,
|
|
25
25
|
listDlxPackagesAsync: () => listDlxPackagesAsync,
|
|
26
26
|
removeDlxPackage: () => removeDlxPackage,
|
|
@@ -34,7 +34,7 @@ let _fs;
|
|
|
34
34
|
// @__NO_SIDE_EFFECTS__
|
|
35
35
|
function getFs() {
|
|
36
36
|
if (_fs === void 0) {
|
|
37
|
-
_fs = require("fs");
|
|
37
|
+
_fs = require("node:fs");
|
|
38
38
|
}
|
|
39
39
|
return _fs;
|
|
40
40
|
}
|
|
@@ -42,15 +42,6 @@ function isDlxPackageInstalled(packageName) {
|
|
|
42
42
|
const fs = /* @__PURE__ */ getFs();
|
|
43
43
|
return fs.existsSync((0, import_paths.getDlxInstalledPackageDir)(packageName));
|
|
44
44
|
}
|
|
45
|
-
async function isDlxPackageInstalledAsync(packageName) {
|
|
46
|
-
const fs = /* @__PURE__ */ getFs();
|
|
47
|
-
try {
|
|
48
|
-
await fs.promises.access((0, import_paths.getDlxInstalledPackageDir)(packageName));
|
|
49
|
-
return true;
|
|
50
|
-
} catch {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
45
|
function listDlxPackages() {
|
|
55
46
|
try {
|
|
56
47
|
return (0, import_fs.readDirNamesSync)((0, import_socket.getSocketDlxDir)(), { sort: true });
|
|
@@ -80,10 +71,9 @@ async function removeDlxPackage(packageName) {
|
|
|
80
71
|
}
|
|
81
72
|
}
|
|
82
73
|
function removeDlxPackageSync(packageName) {
|
|
83
|
-
const fs = /* @__PURE__ */ getFs();
|
|
84
74
|
const packageDir = (0, import_paths.getDlxPackageDir)(packageName);
|
|
85
75
|
try {
|
|
86
|
-
|
|
76
|
+
(0, import_fs.safeDeleteSync)(packageDir, { recursive: true, force: true });
|
|
87
77
|
} catch (e) {
|
|
88
78
|
const code = e.code;
|
|
89
79
|
if (code === "EACCES" || code === "EPERM") {
|
|
@@ -117,7 +107,6 @@ Check permissions and ensure no programs are using this directory.`,
|
|
|
117
107
|
// Annotate the CommonJS export names for ESM import in node:
|
|
118
108
|
0 && (module.exports = {
|
|
119
109
|
isDlxPackageInstalled,
|
|
120
|
-
isDlxPackageInstalledAsync,
|
|
121
110
|
listDlxPackages,
|
|
122
111
|
listDlxPackagesAsync,
|
|
123
112
|
removeDlxPackage,
|
package/dist/dlx/paths.d.ts
CHANGED
package/dist/dlx/paths.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;
|
|
@@ -32,7 +33,7 @@ let _path;
|
|
|
32
33
|
// @__NO_SIDE_EFFECTS__
|
|
33
34
|
function getPath() {
|
|
34
35
|
if (_path === void 0) {
|
|
35
|
-
_path = require("path");
|
|
36
|
+
_path = require("node:path");
|
|
36
37
|
}
|
|
37
38
|
return _path;
|
|
38
39
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Text shimmer animation utilities.
|
|
3
|
+
* Provides animated highlight effects for spinner text with configurable directions:
|
|
4
|
+
* - LTR (left-to-right): Shimmer wave moves from left to right
|
|
5
|
+
* - RTL (right-to-left): Shimmer wave moves from right to left
|
|
6
|
+
* - Bidirectional: Alternates between LTR and RTL each cycle
|
|
7
|
+
* - Random: Picks a random direction each cycle
|
|
8
|
+
* - None: No shimmer animation
|
|
9
|
+
*
|
|
10
|
+
* The shimmer effect creates a bright wave that travels across the text,
|
|
11
|
+
* with characters near the wave appearing nearly white and fading to the
|
|
12
|
+
* base color as they get further from the wave position.
|
|
13
|
+
*/
|
|
1
14
|
import type { ShimmerColorGradient, ShimmerColorRgb, ShimmerDirection, ShimmerState } from './types';
|
|
2
|
-
// Re-export types for backward compatibility.
|
|
3
15
|
export type { ShimmerColor, ShimmerColorGradient, ShimmerColorInherit, ShimmerColorRgb, ShimmerConfig, ShimmerDirection, ShimmerState, } from './types';
|
|
4
16
|
/**
|
|
5
17
|
* Detected text formatting styles from ANSI codes.
|
|
@@ -11,7 +23,6 @@ type TextStyles = {
|
|
|
11
23
|
strikethrough: boolean;
|
|
12
24
|
underline: boolean;
|
|
13
25
|
};
|
|
14
|
-
// Internal options for applyShimmer function.
|
|
15
26
|
type ShimmerOptions = {
|
|
16
27
|
readonly color?: ShimmerColorRgb | ShimmerColorGradient | undefined;
|
|
17
28
|
readonly direction?: ShimmerDirection | undefined;
|
|
@@ -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;
|
|
@@ -31,8 +32,20 @@ module.exports = __toCommonJS(text_shimmer_exports);
|
|
|
31
32
|
var import_ansi = require("../ansi");
|
|
32
33
|
var import_arrays = require("../arrays");
|
|
33
34
|
var import_ci = require("../env/ci");
|
|
34
|
-
var import_utils = require("../themes/utils");
|
|
35
35
|
var import_themes = require("../themes/themes");
|
|
36
|
+
var import_utils = require("../themes/utils");
|
|
37
|
+
const COLOR_INHERIT = "inherit";
|
|
38
|
+
const DIR_LTR = "ltr";
|
|
39
|
+
const DIR_NONE = "none";
|
|
40
|
+
const DIR_RANDOM = "random";
|
|
41
|
+
const DIR_RTL = "rtl";
|
|
42
|
+
const MODE_BI = "bi";
|
|
43
|
+
function blendColors(color1, color2, factor) {
|
|
44
|
+
const r = Math.round(color1[0] + (color2[0] - color1[0]) * factor);
|
|
45
|
+
const g = Math.round(color1[1] + (color2[1] - color1[1]) * factor);
|
|
46
|
+
const b = Math.round(color1[2] + (color2[2] - color1[2]) * factor);
|
|
47
|
+
return [r, g, b];
|
|
48
|
+
}
|
|
36
49
|
function detectStyles(text) {
|
|
37
50
|
return {
|
|
38
51
|
__proto__: null,
|
|
@@ -48,43 +61,21 @@ function detectStyles(text) {
|
|
|
48
61
|
underline: /\x1b\[4m/.test(text)
|
|
49
62
|
};
|
|
50
63
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
if (styles.dim) {
|
|
57
|
-
codes += "\x1B[2m";
|
|
58
|
-
}
|
|
59
|
-
if (styles.italic) {
|
|
60
|
-
codes += "\x1B[3m";
|
|
61
|
-
}
|
|
62
|
-
if (styles.underline) {
|
|
63
|
-
codes += "\x1B[4m";
|
|
64
|
-
}
|
|
65
|
-
if (styles.strikethrough) {
|
|
66
|
-
codes += "\x1B[9m";
|
|
64
|
+
function getShimmerPos(textLength, step, currentDir, shimmerWidth = 2.5) {
|
|
65
|
+
const totalSteps = textLength + shimmerWidth + 2;
|
|
66
|
+
if (currentDir === DIR_RTL) {
|
|
67
|
+
return textLength - step % totalSteps;
|
|
67
68
|
}
|
|
68
|
-
return
|
|
69
|
+
return step % totalSteps;
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const DIR_RANDOM = "random";
|
|
74
|
-
const DIR_RTL = "rtl";
|
|
75
|
-
const MODE_BI = "bi";
|
|
76
|
-
function shimmerIntensity(distance, shimmerWidth = 2.5) {
|
|
77
|
-
if (distance > shimmerWidth) {
|
|
78
|
-
return 0;
|
|
71
|
+
function pickDirection(direction) {
|
|
72
|
+
if (direction === DIR_RANDOM) {
|
|
73
|
+
return Math.random() < 0.5 ? DIR_LTR : DIR_RTL;
|
|
79
74
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const r = Math.round(color1[0] + (color2[0] - color1[0]) * factor);
|
|
85
|
-
const g = Math.round(color1[1] + (color2[1] - color1[1]) * factor);
|
|
86
|
-
const b = Math.round(color1[2] + (color2[2] - color1[2]) * factor);
|
|
87
|
-
return [r, g, b];
|
|
75
|
+
if (direction === DIR_RTL) {
|
|
76
|
+
return DIR_RTL;
|
|
77
|
+
}
|
|
78
|
+
return DIR_LTR;
|
|
88
79
|
}
|
|
89
80
|
function renderChar(char, index, shimmerPos, baseColor, styles) {
|
|
90
81
|
const distance = Math.abs(index - shimmerPos);
|
|
@@ -104,21 +95,31 @@ function renderChar(char, index, shimmerPos, baseColor, styles) {
|
|
|
104
95
|
const color = `\x1B[38;2;${blended[0]};${blended[1]};${blended[2]}m`;
|
|
105
96
|
return `${styleCode}${color}${char}${import_ansi.ANSI_RESET}`;
|
|
106
97
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return textLength - step % totalSteps;
|
|
98
|
+
function shimmerIntensity(distance, shimmerWidth = 2.5) {
|
|
99
|
+
if (distance > shimmerWidth) {
|
|
100
|
+
return 0;
|
|
111
101
|
}
|
|
112
|
-
|
|
102
|
+
const normalized = distance / shimmerWidth;
|
|
103
|
+
return (1 - normalized) ** 2.5;
|
|
113
104
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
function stylesToAnsi(styles) {
|
|
106
|
+
let codes = "";
|
|
107
|
+
if (styles.bold) {
|
|
108
|
+
codes += "\x1B[1m";
|
|
117
109
|
}
|
|
118
|
-
if (
|
|
119
|
-
|
|
110
|
+
if (styles.dim) {
|
|
111
|
+
codes += "\x1B[2m";
|
|
120
112
|
}
|
|
121
|
-
|
|
113
|
+
if (styles.italic) {
|
|
114
|
+
codes += "\x1B[3m";
|
|
115
|
+
}
|
|
116
|
+
if (styles.underline) {
|
|
117
|
+
codes += "\x1B[4m";
|
|
118
|
+
}
|
|
119
|
+
if (styles.strikethrough) {
|
|
120
|
+
codes += "\x1B[9m";
|
|
121
|
+
}
|
|
122
|
+
return codes;
|
|
122
123
|
}
|
|
123
124
|
function applyShimmer(text, state, options) {
|
|
124
125
|
const opts = { __proto__: null, ...options };
|
|
@@ -127,6 +128,9 @@ function applyShimmer(text, state, options) {
|
|
|
127
128
|
let color;
|
|
128
129
|
if (opts.theme) {
|
|
129
130
|
const theme = typeof opts.theme === "string" ? import_themes.THEMES[opts.theme] : opts.theme;
|
|
131
|
+
if (!theme) {
|
|
132
|
+
throw new Error(`Unknown theme: ${opts.theme}`);
|
|
133
|
+
}
|
|
130
134
|
const themeColor = (0, import_utils.resolveColor)(
|
|
131
135
|
theme.colors.primary,
|
|
132
136
|
theme.colors
|
package/dist/effects/types.js
CHANGED
package/dist/effects/ultra.js
CHANGED
package/dist/env/ci.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CI environment variable getter.
|
|
3
|
+
* Exports `getCI()`, which returns whether the `CI` environment variable is
|
|
4
|
+
* present (using the rewire helper so tests can override without touching
|
|
5
|
+
* `process.env`).
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Returns whether the CI environment variable is set.
|
|
3
9
|
*
|
|
@@ -12,5 +18,4 @@
|
|
|
12
18
|
* }
|
|
13
19
|
* ```
|
|
14
20
|
*/
|
|
15
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
16
21
|
export declare function getCI(): boolean;
|
package/dist/env/ci.js
CHANGED
package/dist/env/debug.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview DEBUG environment variable getter.
|
|
3
|
+
* Exports `getDebug()`, which returns the raw `DEBUG` filter string used by
|
|
4
|
+
* the `debug` package (or `undefined` when unset).
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* Returns the value of the DEBUG environment variable.
|
|
3
8
|
*
|
|
@@ -11,5 +16,4 @@
|
|
|
11
16
|
* // e.g. 'socket:*' or undefined
|
|
12
17
|
* ```
|
|
13
18
|
*/
|
|
14
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
15
19
|
export declare function getDebug(): string | undefined;
|
package/dist/env/debug.js
CHANGED
package/dist/env/github.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview GitHub Actions environment variable getters.
|
|
3
|
+
* Provides access to GitHub Actions CI/CD environment variables.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* GH_TOKEN environment variable.
|
|
7
|
+
* Alternative GitHub authentication token for API access (used by GitHub CLI).
|
|
8
|
+
*
|
|
9
|
+
* @returns The GH CLI token, or `undefined` if not set
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { getGhToken } from '@socketsecurity/lib/env/github'
|
|
14
|
+
*
|
|
15
|
+
* const token = getGhToken()
|
|
16
|
+
* // e.g. 'gho_abc123...' or undefined
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function getGhToken(): string | undefined;
|
|
1
20
|
/**
|
|
2
21
|
* GITHUB_API_URL environment variable.
|
|
3
22
|
* GitHub API URL (e.g., https://api.github.com).
|
|
@@ -12,7 +31,6 @@
|
|
|
12
31
|
* // e.g. 'https://api.github.com' or undefined
|
|
13
32
|
* ```
|
|
14
33
|
*/
|
|
15
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
16
34
|
export declare function getGithubApiUrl(): string | undefined;
|
|
17
35
|
/**
|
|
18
36
|
* GITHUB_BASE_REF environment variable.
|
|
@@ -28,7 +46,6 @@ export declare function getGithubApiUrl(): string | undefined;
|
|
|
28
46
|
* // e.g. 'main' or undefined
|
|
29
47
|
* ```
|
|
30
48
|
*/
|
|
31
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
32
49
|
export declare function getGithubBaseRef(): string | undefined;
|
|
33
50
|
/**
|
|
34
51
|
* GITHUB_REF_NAME environment variable.
|
|
@@ -44,7 +61,6 @@ export declare function getGithubBaseRef(): string | undefined;
|
|
|
44
61
|
* // e.g. 'feature/my-branch' or 'v1.0.0'
|
|
45
62
|
* ```
|
|
46
63
|
*/
|
|
47
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
48
64
|
export declare function getGithubRefName(): string | undefined;
|
|
49
65
|
/**
|
|
50
66
|
* GITHUB_REF_TYPE environment variable.
|
|
@@ -60,7 +76,6 @@ export declare function getGithubRefName(): string | undefined;
|
|
|
60
76
|
* // e.g. 'branch' or 'tag'
|
|
61
77
|
* ```
|
|
62
78
|
*/
|
|
63
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
64
79
|
export declare function getGithubRefType(): string | undefined;
|
|
65
80
|
/**
|
|
66
81
|
* GITHUB_REPOSITORY environment variable.
|
|
@@ -76,7 +91,6 @@ export declare function getGithubRefType(): string | undefined;
|
|
|
76
91
|
* // e.g. 'SocketDev/socket-cli' or undefined
|
|
77
92
|
* ```
|
|
78
93
|
*/
|
|
79
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
80
94
|
export declare function getGithubRepository(): string | undefined;
|
|
81
95
|
/**
|
|
82
96
|
* GITHUB_SERVER_URL environment variable.
|
|
@@ -92,7 +106,6 @@ export declare function getGithubRepository(): string | undefined;
|
|
|
92
106
|
* // e.g. 'https://github.com' or undefined
|
|
93
107
|
* ```
|
|
94
108
|
*/
|
|
95
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
96
109
|
export declare function getGithubServerUrl(): string | undefined;
|
|
97
110
|
/**
|
|
98
111
|
* GITHUB_TOKEN environment variable.
|
|
@@ -108,21 +121,4 @@ export declare function getGithubServerUrl(): string | undefined;
|
|
|
108
121
|
* // e.g. 'ghp_abc123...' or undefined
|
|
109
122
|
* ```
|
|
110
123
|
*/
|
|
111
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
112
124
|
export declare function getGithubToken(): string | undefined;
|
|
113
|
-
/**
|
|
114
|
-
* GH_TOKEN environment variable.
|
|
115
|
-
* Alternative GitHub authentication token for API access (used by GitHub CLI).
|
|
116
|
-
*
|
|
117
|
-
* @returns The GH CLI token, or `undefined` if not set
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* import { getGhToken } from '@socketsecurity/lib/env/github'
|
|
122
|
-
*
|
|
123
|
-
* const token = getGhToken()
|
|
124
|
-
* // e.g. 'gho_abc123...' or undefined
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
128
|
-
export declare function getGhToken(): string | undefined;
|