@socketsecurity/lib 6.0.7 → 6.0.9
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 +42 -0
- package/README.md +1 -1
- package/dist/ai/agent-context.d.mts +103 -0
- package/dist/ai/agent-context.js +157 -0
- package/dist/ai/backends.d.mts +83 -0
- package/dist/ai/backends.js +173 -0
- package/dist/ai/credentials.d.mts +49 -0
- package/dist/ai/credentials.js +82 -0
- package/dist/ai/discover.d.mts +4 -0
- package/dist/ai/discover.js +1 -1
- package/dist/ai/exec.d.mts +52 -0
- package/dist/ai/exec.js +92 -0
- package/dist/ai/http.d.mts +132 -0
- package/dist/ai/http.js +130 -0
- package/dist/ai/profiles.d.mts +41 -6
- package/dist/ai/profiles.js +52 -10
- package/dist/ai/route.d.mts +82 -0
- package/dist/ai/route.js +171 -0
- package/dist/ai/spawn.d.mts +42 -2
- package/dist/ai/spawn.js +146 -33
- package/dist/ai/subagent-status.d.mts +48 -0
- package/dist/ai/subagent-status.js +57 -0
- package/dist/ai/tier.d.mts +60 -0
- package/dist/ai/tier.js +53 -0
- package/dist/ai/types.d.mts +25 -2
- package/dist/ai/worktree.js +4 -0
- package/dist/archives/tar.js +1 -1
- package/dist/archives/zip.js +2 -2
- package/dist/argv/parse.d.ts +19 -2
- package/dist/argv/parse.js +1 -1
- package/dist/arrays/join.js +4 -0
- package/dist/bin/find.js +4 -4
- package/dist/bin/prim.cjs +23322 -18018
- package/dist/bin/resolve.js +2 -2
- package/dist/cache/ttl/store.js +2 -2
- package/dist/cli/check-primordials.d.ts +8 -3
- package/dist/cli/check-primordials.js +4 -4
- package/dist/compression/_internal.js +1 -1
- package/dist/compression/brotli.d.ts +1 -2
- package/dist/compression/brotli.js +5 -1
- package/dist/compression/gzip.js +5 -1
- package/dist/config/layers.d.ts +53 -0
- package/dist/config/layers.js +83 -0
- package/dist/constants/packages.d.ts +3 -0
- package/dist/constants/packages.js +2 -1
- package/dist/constants/socket.d.ts +2 -6
- package/dist/constants/socket.js +12 -14
- package/dist/cover/code.js +2 -2
- package/dist/crypto/hash.d.ts +4 -1
- package/dist/crypto/hash.js +4 -1
- package/dist/dlx/arborist.js +13 -3
- package/dist/dlx/binary-cache.js +1 -1
- package/dist/dlx/binary-resolution.js +1 -1
- package/dist/dlx/detect.d.ts +8 -0
- package/dist/dlx/firewall.d.ts +8 -0
- package/dist/dlx/lockfile.js +5 -2
- package/dist/dlx/manifest.js +1 -1
- package/dist/dlx/package.js +4 -0
- package/dist/eco/cargo/parse-lockfile.d.ts +1 -2
- package/dist/eco/cargo/parse-lockfile.js +3 -3
- package/dist/eco/manifest/detect-format.js +1 -1
- package/dist/eco/npm/npm/parse-lockfile.d.ts +3 -4
- package/dist/eco/npm/npm/parse-lockfile.js +2 -2
- package/dist/eco/npm/parse-package-json.d.ts +11 -0
- package/dist/eco/npm/parse-package-json.js +1 -1
- package/dist/eco/npm/pnpm/parse-lockfile.d.ts +5 -3
- package/dist/eco/npm/pnpm/parse-lockfile.js +3 -3
- package/dist/eco/npm/yarnpkg/yarn/exec.js +1 -1
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +1 -2
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +2 -2
- package/dist/env/proxy.js +1 -1
- package/dist/env/rewire.d.ts +6 -3
- package/dist/env/rewire.js +7 -8
- package/dist/env/socket.d.ts +7 -0
- package/dist/env/socket.js +10 -0
- package/dist/env/xdg.d.ts +17 -0
- package/dist/env/xdg.js +21 -1
- package/dist/errors/predicates.js +1 -1
- package/dist/errors/stack.js +1 -2
- package/dist/external/@npmcli/package-json.js +3455 -4881
- package/dist/external/@npmcli/promise-spawn.js +3 -1
- package/dist/external/@yarnpkg/extensions.js +1 -1
- package/dist/external/external-pack.js +1 -1
- package/dist/external/npm-pack.js +29164 -31799
- package/dist/external/pico-pack.js +4 -2
- package/dist/external/tar-fs.js +63 -16
- package/dist/external/which.js +3 -1
- package/dist/external-tools/bazel/asset-names.d.ts +1 -1
- package/dist/external-tools/bazel/asset-names.js +5 -2
- package/dist/external-tools/bazel/from-download.d.ts +1 -1
- package/dist/external-tools/bazel/from-download.js +5 -2
- package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
- package/dist/external-tools/bazel/resolve.d.ts +3 -3
- package/dist/external-tools/bazel/resolve.js +16 -8
- package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.js +5 -2
- package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
- package/dist/external-tools/cdxgen/from-download.js +7 -4
- package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
- package/dist/external-tools/cdxgen/resolve.js +16 -8
- package/dist/external-tools/from-download.d.ts +2 -2
- package/dist/external-tools/from-download.js +11 -5
- package/dist/external-tools/from-pip-venv.d.ts +1 -1
- package/dist/external-tools/from-pip-venv.js +12 -5
- package/dist/external-tools/janus/asset-names.d.ts +1 -1
- package/dist/external-tools/janus/asset-names.js +5 -2
- package/dist/external-tools/janus/from-download.d.ts +1 -1
- package/dist/external-tools/janus/from-download.js +5 -2
- package/dist/external-tools/janus/resolve.d.ts +3 -3
- package/dist/external-tools/janus/resolve.js +16 -8
- package/dist/external-tools/jre/asset-names.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.js +5 -2
- package/dist/external-tools/jre/detect-platform-arch.js +1 -1
- package/dist/external-tools/jre/from-download.d.ts +1 -1
- package/dist/external-tools/jre/from-download.js +7 -4
- package/dist/external-tools/jre/from-java-home.js +2 -2
- package/dist/external-tools/jre/from-vfs.js +2 -2
- package/dist/external-tools/jre/resolve.d.ts +3 -3
- package/dist/external-tools/jre/resolve.js +16 -8
- package/dist/external-tools/manifest.d.ts +18 -0
- package/dist/external-tools/manifest.js +2 -2
- package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
- package/dist/external-tools/opengrep/asset-names.js +5 -2
- package/dist/external-tools/opengrep/from-download.d.ts +1 -1
- package/dist/external-tools/opengrep/from-download.js +5 -2
- package/dist/external-tools/opengrep/resolve.d.ts +3 -3
- package/dist/external-tools/opengrep/resolve.js +16 -8
- package/dist/external-tools/python/asset-names.d.ts +1 -1
- package/dist/external-tools/python/asset-names.js +11 -4
- package/dist/external-tools/python/dlx.d.ts +3 -3
- package/dist/external-tools/python/dlx.js +20 -9
- package/dist/external-tools/python/from-download.d.ts +1 -1
- package/dist/external-tools/python/from-download.js +12 -5
- package/dist/external-tools/python/pin.js +6 -3
- package/dist/external-tools/python/pip-install.js +6 -3
- package/dist/external-tools/python/resolve.d.ts +3 -3
- package/dist/external-tools/python/resolve.js +19 -11
- package/dist/external-tools/python/uv-install.d.ts +89 -0
- package/dist/external-tools/python/uv-install.js +165 -0
- package/dist/external-tools/sbt/asset-names.d.ts +1 -1
- package/dist/external-tools/sbt/asset-names.js +5 -2
- package/dist/external-tools/sbt/from-download.d.ts +1 -1
- package/dist/external-tools/sbt/from-download.js +5 -2
- package/dist/external-tools/sbt/resolve.d.ts +3 -3
- package/dist/external-tools/sbt/resolve.js +16 -8
- package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.js +10 -3
- package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
- package/dist/external-tools/skillspector/from-uv.js +56 -0
- package/dist/external-tools/skillspector/resolve.d.ts +20 -5
- package/dist/external-tools/skillspector/resolve.js +27 -6
- package/dist/external-tools/skillspector/types.d.ts +3 -1
- package/dist/external-tools/synp/asset-names.d.ts +1 -1
- package/dist/external-tools/synp/asset-names.js +6 -2
- package/dist/external-tools/synp/from-download.d.ts +1 -1
- package/dist/external-tools/synp/from-download.js +5 -2
- package/dist/external-tools/synp/resolve.d.ts +3 -3
- package/dist/external-tools/synp/resolve.js +16 -8
- package/dist/external-tools/trivy/asset-names.d.ts +1 -1
- package/dist/external-tools/trivy/asset-names.js +5 -2
- package/dist/external-tools/trivy/from-download.d.ts +1 -1
- package/dist/external-tools/trivy/from-download.js +7 -4
- package/dist/external-tools/trivy/resolve.d.ts +3 -3
- package/dist/external-tools/trivy/resolve.js +16 -8
- package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.js +5 -2
- package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
- package/dist/external-tools/trufflehog/from-download.js +7 -4
- package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
- package/dist/external-tools/trufflehog/resolve.js +16 -8
- package/dist/external-tools/uv/asset-names.d.ts +36 -0
- package/dist/external-tools/uv/asset-names.js +73 -0
- package/dist/external-tools/uv/from-download.d.ts +17 -0
- package/dist/external-tools/uv/from-download.js +50 -0
- package/dist/external-tools/uv/from-path.d.ts +5 -0
- package/dist/external-tools/uv/from-path.js +22 -0
- package/dist/external-tools/uv/from-vfs.d.ts +7 -0
- package/dist/external-tools/uv/from-vfs.js +26 -0
- package/dist/external-tools/uv/resolve.d.ts +25 -0
- package/dist/external-tools/uv/resolve.js +61 -0
- package/dist/external-tools/uv/types.d.ts +24 -0
- package/dist/external-tools/uv/types.js +2 -0
- package/dist/fleet/repo-config.d.ts +53 -0
- package/dist/fleet/repo-config.js +79 -0
- package/dist/fs/allowed-dirs-cache.d.ts +27 -1
- package/dist/fs/allowed-dirs-cache.js +39 -6
- package/dist/fs/copy.d.ts +88 -0
- package/dist/fs/copy.js +89 -0
- package/dist/fs/find.js +1 -1
- package/dist/fs/read-json-cache.d.ts +7 -0
- package/dist/fs/resolve-module.js +6 -2
- package/dist/fs/safe.js +1 -1
- package/dist/git/_internal.js +3 -3
- package/dist/git/repo.js +2 -4
- package/dist/git/staged.js +8 -0
- package/dist/git/tracked.d.ts +84 -0
- package/dist/git/tracked.js +163 -0
- package/dist/git/unstaged.js +8 -0
- package/dist/github/refs-graphql.js +4 -0
- package/dist/github/refs-rest.js +4 -0
- package/dist/globs/_internal.js +1 -1
- package/dist/globs/match.js +9 -1
- package/dist/globs/matcher.js +5 -1
- package/dist/http-request/browser.js +7 -3
- package/dist/http-request/checksum-file.js +1 -1
- package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
- package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
- package/dist/http-request/headers.js +1 -1
- package/dist/http-request/request-attempt.js +2 -2
- package/dist/http-request/user-agent.js +1 -1
- package/dist/integrity.d.ts +124 -71
- package/dist/integrity.js +168 -78
- package/dist/json/edit.js +38 -30
- package/dist/json/format.js +1 -1
- package/dist/logger/colors.d.ts +1 -2
- package/dist/logger/colors.js +2 -2
- package/dist/logger/symbols-builder.js +7 -8
- package/dist/logger/symbols.js +8 -8
- package/dist/native-messaging/install.d.ts +1 -1
- package/dist/native-messaging/install.js +7 -4
- package/dist/native-messaging/rate-limit.d.ts +7 -0
- package/dist/native-messaging/rate-limit.js +4 -0
- package/dist/node/async-hooks.js +1 -1
- package/dist/node/child-process.js +1 -1
- package/dist/node/crypto.js +1 -1
- package/dist/node/events.js +1 -1
- package/dist/node/fs-promises.js +1 -1
- package/dist/node/fs.d.ts +22 -6
- package/dist/node/fs.js +16 -3
- package/dist/node/http.js +1 -1
- package/dist/node/https.js +1 -1
- package/dist/node/module.d.ts +73 -2
- package/dist/node/module.js +97 -12
- package/dist/node/os.d.ts +10 -2
- package/dist/node/os.js +11 -4
- package/dist/node/path.d.ts +11 -2
- package/dist/node/path.js +17 -4
- package/dist/node/timers-promises.js +1 -1
- package/dist/node/url.js +1 -1
- package/dist/node/util.js +1 -1
- package/dist/objects/getters.js +1 -1
- package/dist/objects/mutate.js +2 -2
- package/dist/packages/edit-class.d.ts +2 -3
- package/dist/packages/edit-class.js +41 -35
- package/dist/packages/exports.js +4 -4
- package/dist/packages/fetch.js +1 -1
- package/dist/packages/isolation.js +2 -2
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.d.ts +29 -0
- package/dist/packages/manifest.js +40 -4
- package/dist/packages/normalize.js +2 -2
- package/dist/packages/provenance.js +3 -3
- package/dist/packages/specs.js +1 -1
- package/dist/packages/tarball.js +4 -2
- package/dist/packages/types.d.ts +1 -2
- package/dist/paths/_internal.d.ts +1 -7
- package/dist/paths/_internal.js +9 -15
- package/dist/paths/conversion.js +1 -1
- package/dist/paths/dirnames.d.ts +1 -0
- package/dist/paths/dirnames.js +2 -0
- package/dist/paths/normalize.js +1 -1
- package/dist/paths/predicates.js +2 -1
- package/dist/paths/resolve.js +14 -19
- package/dist/paths/rewire.d.ts +5 -0
- package/dist/paths/socket.d.ts +137 -123
- package/dist/paths/socket.js +172 -131
- package/dist/perf/metrics.js +1 -1
- package/dist/perf/report.js +1 -1
- package/dist/primordials/process.d.ts +88 -0
- package/dist/primordials/process.js +132 -0
- package/dist/primordials/uncurry.d.ts +1 -2
- package/dist/process/spawn/child.js +8 -2
- package/dist/process/spawn/errors.js +1 -1
- package/dist/releases/github-archives.js +1 -1
- package/dist/releases/github-listing.d.ts +1 -2
- package/dist/schema/types.d.ts +3 -4
- package/dist/schema/validate.js +1 -1
- package/dist/secrets/broker.d.ts +35 -0
- package/dist/secrets/broker.js +72 -0
- package/dist/secrets/find.d.ts +8 -6
- package/dist/secrets/find.js +25 -5
- package/dist/secrets/keychain.d.ts +1 -1
- package/dist/secrets/linux.js +32 -44
- package/dist/secrets/macos.d.ts +1 -2
- package/dist/secrets/macos.js +20 -29
- package/dist/secrets/rc.d.ts +2 -2
- package/dist/secrets/rc.js +21 -13
- package/dist/secrets/socket-api-token.js +8 -0
- package/dist/secrets/windows.js +27 -33
- package/dist/shell/parse.d.ts +32 -0
- package/dist/shell/parse.js +60 -0
- package/dist/smol/detect.js +1 -1
- package/dist/smol/http.js +1 -1
- package/dist/smol/https.js +1 -1
- package/dist/smol/manifest.js +1 -1
- package/dist/smol/path.js +1 -1
- package/dist/smol/primordial.js +1 -1
- package/dist/smol/purl.js +1 -1
- package/dist/smol/versions.js +1 -1
- package/dist/smol/vfs.js +1 -1
- package/dist/sorts/_internal.d.ts +1 -2
- package/dist/sorts/_internal.js +2 -6
- package/dist/sorts/semver.js +2 -2
- package/dist/spinner/create-spinner-class.js +2 -2
- package/dist/spinner/spinner-internals.d.ts +1 -1
- package/dist/spinner/spinner-internals.js +9 -5
- package/dist/spinner/spinner.d.ts +4 -0
- package/dist/spinner/spinner.js +1 -1
- package/dist/stdio/progress.js +6 -2
- package/dist/stdio/prompts.d.ts +2 -10
- package/dist/stdio/prompts.js +11 -24
- package/dist/strings/format.js +1 -1
- package/dist/strings/search.js +1 -1
- package/dist/temporal/instant.js +2 -2
- package/dist/themes/context.d.ts +5 -3
- package/dist/themes/context.js +5 -6
- package/dist/url/assert-safe.d.ts +29 -0
- package/dist/url/assert-safe.js +54 -0
- package/dist/url/predicates.d.ts +31 -1
- package/dist/url/predicates.js +42 -1
- package/dist/url/types.d.ts +4 -0
- package/llms.txt +750 -0
- package/package.json +253 -125
package/dist/secrets/rc.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
-
const require_primordials_regexp = require('../primordials/regexp.js');
|
|
7
5
|
const require_primordials_object = require('../primordials/object.js');
|
|
6
|
+
const require_primordials_string = require('../primordials/string.js');
|
|
8
7
|
const require_env_home = require('../env/home.js');
|
|
8
|
+
const require_primordials_regexp = require('../primordials/regexp.js');
|
|
9
9
|
let node_fs = require("node:fs");
|
|
10
|
+
let node_process = require("node:process");
|
|
11
|
+
node_process = require_runtime.__toESM(node_process);
|
|
10
12
|
let node_path = require("node:path");
|
|
11
13
|
node_path = require_runtime.__toESM(node_path);
|
|
12
14
|
let node_os = require("node:os");
|
|
13
15
|
node_os = require_runtime.__toESM(node_os);
|
|
14
|
-
let node_process = require("node:process");
|
|
15
|
-
node_process = require_runtime.__toESM(node_process);
|
|
16
16
|
|
|
17
17
|
//#region src/secrets/rc.ts
|
|
18
18
|
/**
|
|
@@ -54,11 +54,15 @@ node_process = require_runtime.__toESM(node_process);
|
|
|
54
54
|
* non-interactive shells (Claude Code, IDE plugins, CI runners) skip .zshrc
|
|
55
55
|
* and would miss the export.
|
|
56
56
|
*/
|
|
57
|
-
function buildBlock(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
function buildBlock(options) {
|
|
58
|
+
options = {
|
|
59
|
+
__proto__: null,
|
|
60
|
+
...options
|
|
61
|
+
};
|
|
62
|
+
const begin = `# BEGIN ${options.service} env (managed)`;
|
|
63
|
+
const end = `# END ${options.service} env (managed)`;
|
|
64
|
+
const noteLines = (options.notes ?? []).map((line) => `# ${line}`);
|
|
65
|
+
const exportLines = require_primordials_object.ObjectEntries(options.exports).map(([name, value]) => `export ${name}=${shellSingleQuote(value)}`);
|
|
62
66
|
const body = [...noteLines, ...exportLines].join("\n");
|
|
63
67
|
return {
|
|
64
68
|
begin,
|
|
@@ -134,23 +138,27 @@ function shellSingleQuote(value) {
|
|
|
134
138
|
* `shell` and `rcPath` override the auto-detected target — useful for chezmoi /
|
|
135
139
|
* dotfile-manager users or installers running under a non-default shell.
|
|
136
140
|
*/
|
|
137
|
-
function write(
|
|
141
|
+
function write(options) {
|
|
142
|
+
options = {
|
|
143
|
+
__proto__: null,
|
|
144
|
+
...options
|
|
145
|
+
};
|
|
138
146
|
if (node_os.default.platform() !== "darwin") return {
|
|
139
147
|
rcPath: void 0,
|
|
140
148
|
outcome: "skipped",
|
|
141
149
|
reason: "unsupported-platform"
|
|
142
150
|
};
|
|
143
|
-
const rcPath =
|
|
151
|
+
const rcPath = options.rcPath ?? pickRcFile(options.shell);
|
|
144
152
|
if (!rcPath) return {
|
|
145
153
|
rcPath: void 0,
|
|
146
154
|
outcome: "skipped",
|
|
147
155
|
reason: "unknown-shell"
|
|
148
156
|
};
|
|
149
|
-
const { begin, end, full: desiredBlock } = buildBlock(
|
|
157
|
+
const { begin, end, full: desiredBlock } = buildBlock(options);
|
|
150
158
|
let onDisk = "";
|
|
151
159
|
if ((0, node_fs.existsSync)(rcPath)) onDisk = (0, node_fs.readFileSync)(rcPath, "utf8");
|
|
152
160
|
let working = onDisk;
|
|
153
|
-
for (const legacyBegin of
|
|
161
|
+
for (const legacyBegin of options.legacySentinels ?? []) {
|
|
154
162
|
const legacyEnd = legacyBegin.replace(/\bBEGIN\b/, "END");
|
|
155
163
|
const legacyEndStripped = legacyEnd.replace(/\s*\(managed\)\s*$/, "");
|
|
156
164
|
const endAlt = legacyEnd === legacyEndStripped ? escapeRegExp(legacyEnd) : `(?:${escapeRegExp(legacyEnd)}|${escapeRegExp(legacyEndStripped)})`;
|
|
@@ -17,6 +17,10 @@ const SOCKET_SERVICE = "socketsecurity";
|
|
|
17
17
|
const SOCKET_SERVICE_LEGACY = "socket-cli";
|
|
18
18
|
const TOKEN_ACCOUNTS = ["SOCKET_API_TOKEN", "SOCKET_API_KEY"];
|
|
19
19
|
async function readSocketApiToken(options) {
|
|
20
|
+
options = {
|
|
21
|
+
__proto__: null,
|
|
22
|
+
...options
|
|
23
|
+
};
|
|
20
24
|
return (await require_secrets_find.resolve({
|
|
21
25
|
service: SOCKET_SERVICE,
|
|
22
26
|
accounts: TOKEN_ACCOUNTS,
|
|
@@ -28,6 +32,10 @@ async function readSocketApiToken(options) {
|
|
|
28
32
|
}))?.value;
|
|
29
33
|
}
|
|
30
34
|
function readSocketApiTokenSync(options) {
|
|
35
|
+
options = {
|
|
36
|
+
__proto__: null,
|
|
37
|
+
...options
|
|
38
|
+
};
|
|
31
39
|
return (require_secrets_find.resolveSync({
|
|
32
40
|
service: SOCKET_SERVICE,
|
|
33
41
|
accounts: TOKEN_ACCOUNTS,
|
package/dist/secrets/windows.js
CHANGED
|
@@ -4,14 +4,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_primordials_error = require('../primordials/error.js');
|
|
6
6
|
const require_primordials_json = require('../primordials/json.js');
|
|
7
|
-
const require_primordials_promise = require('../primordials/promise.js');
|
|
8
7
|
let node_fs = require("node:fs");
|
|
8
|
+
let node_process = require("node:process");
|
|
9
|
+
node_process = require_runtime.__toESM(node_process);
|
|
9
10
|
let node_path = require("node:path");
|
|
10
11
|
node_path = require_runtime.__toESM(node_path);
|
|
11
12
|
let node_os = require("node:os");
|
|
12
13
|
node_os = require_runtime.__toESM(node_os);
|
|
13
|
-
let node_process = require("node:process");
|
|
14
|
-
node_process = require_runtime.__toESM(node_process);
|
|
15
14
|
let _socketsecurity_lib_stable_process_spawn_child = require("@socketsecurity/lib-stable/process/spawn/child");
|
|
16
15
|
|
|
17
16
|
//#region src/secrets/windows.ts
|
|
@@ -128,40 +127,35 @@ function readWindowsSync(service, account) {
|
|
|
128
127
|
}
|
|
129
128
|
return readDpapiSync(getDpapiFilePath(service, account));
|
|
130
129
|
}
|
|
131
|
-
function runPsAsync(script, input) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
async function runPsAsync(script, input) {
|
|
131
|
+
const child = (0, _socketsecurity_lib_stable_process_spawn_child.spawn)(POWERSHELL_BIN, [
|
|
132
|
+
"-NoProfile",
|
|
133
|
+
"-Command",
|
|
134
|
+
script
|
|
135
|
+
], {
|
|
136
|
+
stdio: [
|
|
138
137
|
"pipe",
|
|
139
138
|
"pipe",
|
|
140
139
|
"pipe"
|
|
141
|
-
]
|
|
142
|
-
|
|
143
|
-
let stderr = "";
|
|
144
|
-
cp.stdout.setEncoding("utf8");
|
|
145
|
-
cp.stdout.on("data", (chunk) => {
|
|
146
|
-
stdout += chunk;
|
|
147
|
-
});
|
|
148
|
-
cp.stderr.setEncoding("utf8");
|
|
149
|
-
cp.stderr.on("data", (chunk) => {
|
|
150
|
-
stderr += chunk;
|
|
151
|
-
});
|
|
152
|
-
cp.on("error", () => resolve({
|
|
153
|
-
status: -1,
|
|
154
|
-
stdout,
|
|
155
|
-
stderr
|
|
156
|
-
}));
|
|
157
|
-
cp.on("close", (status) => resolve({
|
|
158
|
-
status,
|
|
159
|
-
stdout,
|
|
160
|
-
stderr
|
|
161
|
-
}));
|
|
162
|
-
if (input !== void 0) cp.stdin.end(input);
|
|
163
|
-
else cp.stdin.end();
|
|
140
|
+
],
|
|
141
|
+
stdioString: true
|
|
164
142
|
});
|
|
143
|
+
child.process.stdin.end(input ?? "");
|
|
144
|
+
try {
|
|
145
|
+
const r = await child;
|
|
146
|
+
return {
|
|
147
|
+
status: typeof r.code === "number" ? r.code : null,
|
|
148
|
+
stderr: String(r.stderr ?? ""),
|
|
149
|
+
stdout: String(r.stdout ?? "")
|
|
150
|
+
};
|
|
151
|
+
} catch (e) {
|
|
152
|
+
const err = e;
|
|
153
|
+
return {
|
|
154
|
+
status: typeof err?.code === "number" ? err.code : -1,
|
|
155
|
+
stderr: String(err?.stderr ?? ""),
|
|
156
|
+
stdout: String(err?.stdout ?? "")
|
|
157
|
+
};
|
|
158
|
+
}
|
|
165
159
|
}
|
|
166
160
|
function runPsSync(script, input) {
|
|
167
161
|
const r = (0, _socketsecurity_lib_stable_process_spawn_child.spawnSync)(POWERSHELL_BIN, [
|
package/dist/shell/parse.d.ts
CHANGED
|
@@ -8,6 +8,38 @@
|
|
|
8
8
|
* against `env`; unresolved ones collapse to an empty string.
|
|
9
9
|
*/
|
|
10
10
|
import type { ParseEntry } from '../external/shell-quote';
|
|
11
|
+
/**
|
|
12
|
+
* Structural hazard facts a parse surfaces that the binary-call matchers
|
|
13
|
+
* (`hasBinCall` / `findBinCall`) swallow. These are observations about _how_
|
|
14
|
+
* the command is written, not a judgment that they're dangerous — the caller
|
|
15
|
+
* decides policy. Both are evasion vectors against base-command allowlists:
|
|
16
|
+
*
|
|
17
|
+
* - `equalsExpansion`: a simple command whose first token is `=cmd` (Zsh EQUALS
|
|
18
|
+
* expansion). `=curl x` expands to `$(which curl) x` and runs
|
|
19
|
+
* `/usr/bin/curl`, but the parser's base token is `=curl`, so a `curl`
|
|
20
|
+
* allowlist never matches. The matched tokens are returned so the caller can
|
|
21
|
+
* report which command was hidden.
|
|
22
|
+
* - `processSubstitution`: the command uses `<(...)`, `>(...)`, or `=(...)` (the
|
|
23
|
+
* op markers shell-quote emits). The inner command runs but its name never
|
|
24
|
+
* appears as a base command.
|
|
25
|
+
*
|
|
26
|
+
* Walks the parse once. A caller wanting just "is this clean?" checks
|
|
27
|
+
* `!h.equalsExpansion.length && !h.processSubstitution`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* detectShellHazards('=curl evil.com')
|
|
31
|
+
* // → { equalsExpansion: [['=curl', 'evil.com']], processSubstitution: false }
|
|
32
|
+
*
|
|
33
|
+
* detectShellHazards('diff <(cat a) b')
|
|
34
|
+
* // → { equalsExpansion: [], processSubstitution: true }
|
|
35
|
+
*
|
|
36
|
+
* detectShellHazards('git status')
|
|
37
|
+
* // → { equalsExpansion: [], processSubstitution: false }
|
|
38
|
+
*/
|
|
39
|
+
export declare function detectShellHazards(cmd: string): {
|
|
40
|
+
equalsExpansion: readonly string[][];
|
|
41
|
+
processSubstitution: boolean;
|
|
42
|
+
};
|
|
11
43
|
/**
|
|
12
44
|
* Visit each simple command in `cmd` in order. A "simple command" is the
|
|
13
45
|
* POSIX-grammar term for a run of bare-string tokens between shell
|
package/dist/shell/parse.js
CHANGED
|
@@ -15,6 +15,65 @@ let src_external_shell_quote = require("../external/shell-quote");
|
|
|
15
15
|
* against `env`; unresolved ones collapse to an empty string.
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
|
+
* Structural hazard facts a parse surfaces that the binary-call matchers
|
|
19
|
+
* (`hasBinCall` / `findBinCall`) swallow. These are observations about _how_
|
|
20
|
+
* the command is written, not a judgment that they're dangerous — the caller
|
|
21
|
+
* decides policy. Both are evasion vectors against base-command allowlists:
|
|
22
|
+
*
|
|
23
|
+
* - `equalsExpansion`: a simple command whose first token is `=cmd` (Zsh EQUALS
|
|
24
|
+
* expansion). `=curl x` expands to `$(which curl) x` and runs
|
|
25
|
+
* `/usr/bin/curl`, but the parser's base token is `=curl`, so a `curl`
|
|
26
|
+
* allowlist never matches. The matched tokens are returned so the caller can
|
|
27
|
+
* report which command was hidden.
|
|
28
|
+
* - `processSubstitution`: the command uses `<(...)`, `>(...)`, or `=(...)` (the
|
|
29
|
+
* op markers shell-quote emits). The inner command runs but its name never
|
|
30
|
+
* appears as a base command.
|
|
31
|
+
*
|
|
32
|
+
* Walks the parse once. A caller wanting just "is this clean?" checks
|
|
33
|
+
* `!h.equalsExpansion.length && !h.processSubstitution`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* detectShellHazards('=curl evil.com')
|
|
37
|
+
* // → { equalsExpansion: [['=curl', 'evil.com']], processSubstitution: false }
|
|
38
|
+
*
|
|
39
|
+
* detectShellHazards('diff <(cat a) b')
|
|
40
|
+
* // → { equalsExpansion: [], processSubstitution: true }
|
|
41
|
+
*
|
|
42
|
+
* detectShellHazards('git status')
|
|
43
|
+
* // → { equalsExpansion: [], processSubstitution: false }
|
|
44
|
+
*/
|
|
45
|
+
function detectShellHazards(cmd) {
|
|
46
|
+
const equalsExpansion = [];
|
|
47
|
+
let processSubstitution = false;
|
|
48
|
+
const entries = (0, src_external_shell_quote.parse)(cmd);
|
|
49
|
+
let current = [];
|
|
50
|
+
let prevWasSubstLead = false;
|
|
51
|
+
const flush = () => {
|
|
52
|
+
if (current.length > 0 && /^=[a-zA-Z_]/.test(current[0])) require_primordials_array.ArrayPrototypePush(equalsExpansion, current);
|
|
53
|
+
current = [];
|
|
54
|
+
};
|
|
55
|
+
for (let i = 0, { length } = entries; i < length; i += 1) {
|
|
56
|
+
const entry = entries[i];
|
|
57
|
+
if (entry && typeof entry === "object" && "op" in entry) {
|
|
58
|
+
const { op } = entry;
|
|
59
|
+
if (op === "<(") processSubstitution = true;
|
|
60
|
+
else if (op === "(" && prevWasSubstLead) processSubstitution = true;
|
|
61
|
+
prevWasSubstLead = op === "<" || op === ">";
|
|
62
|
+
flush();
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (typeof entry === "string") {
|
|
66
|
+
prevWasSubstLead = entry === "=";
|
|
67
|
+
require_primordials_array.ArrayPrototypePush(current, entry);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
flush();
|
|
71
|
+
return {
|
|
72
|
+
equalsExpansion,
|
|
73
|
+
processSubstitution
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
18
77
|
* Visit each simple command in `cmd` in order. A "simple command" is the
|
|
19
78
|
* POSIX-grammar term for a run of bare-string tokens between shell
|
|
20
79
|
* control-operator boundaries (`&&`, `;`, `||`, `|`) — e.g. in `sudo apt && rm
|
|
@@ -193,6 +252,7 @@ function simpleCommandStartsWith(tokens, prefix) {
|
|
|
193
252
|
}
|
|
194
253
|
|
|
195
254
|
//#endregion
|
|
255
|
+
exports.detectShellHazards = detectShellHazards;
|
|
196
256
|
exports.eachSimpleCommand = eachSimpleCommand;
|
|
197
257
|
exports.findBinCall = findBinCall;
|
|
198
258
|
exports.findBinCalls = findBinCalls;
|
package/dist/smol/detect.js
CHANGED
|
@@ -43,7 +43,7 @@ function getSmolUtil() {
|
|
|
43
43
|
if (!smolUtilProbed) {
|
|
44
44
|
smolUtilProbed = true;
|
|
45
45
|
/* c8 ignore start - smol Node binary only. */
|
|
46
|
-
if (require_node_module.isNodeBuiltin("node:smol-util")) smolUtilCache =
|
|
46
|
+
if (require_node_module.isNodeBuiltin("node:smol-util")) smolUtilCache = require_node_module.requireBuiltin("node:smol-util");
|
|
47
47
|
}
|
|
48
48
|
return smolUtilCache;
|
|
49
49
|
}
|
package/dist/smol/http.js
CHANGED
|
@@ -28,7 +28,7 @@ function getSmolHttp() {
|
|
|
28
28
|
if (!smolHttpProbed) {
|
|
29
29
|
smolHttpProbed = true;
|
|
30
30
|
/* c8 ignore start - smol Node binary only. */
|
|
31
|
-
if (require_node_module.isNodeBuiltin("node:smol-http")) smolHttpBinding =
|
|
31
|
+
if (require_node_module.isNodeBuiltin("node:smol-http")) smolHttpBinding = require_node_module.requireBuiltin("node:smol-http");
|
|
32
32
|
}
|
|
33
33
|
return smolHttpBinding;
|
|
34
34
|
}
|
package/dist/smol/https.js
CHANGED
|
@@ -26,7 +26,7 @@ function getSmolHttps() {
|
|
|
26
26
|
if (!smolHttpsProbed) {
|
|
27
27
|
smolHttpsProbed = true;
|
|
28
28
|
/* c8 ignore start - smol Node binary only. */
|
|
29
|
-
if (require_node_module.isNodeBuiltin("node:smol-https")) smolHttps =
|
|
29
|
+
if (require_node_module.isNodeBuiltin("node:smol-https")) smolHttps = require_node_module.requireBuiltin("node:smol-https");
|
|
30
30
|
}
|
|
31
31
|
return smolHttps;
|
|
32
32
|
}
|
package/dist/smol/manifest.js
CHANGED
|
@@ -28,7 +28,7 @@ function getSmolManifest() {
|
|
|
28
28
|
if (!smolManifestProbed) {
|
|
29
29
|
smolManifestProbed = true;
|
|
30
30
|
/* c8 ignore start - smol Node binary only. */
|
|
31
|
-
if (require_node_module.isNodeBuiltin("node:smol-manifest")) cachedSmolManifest =
|
|
31
|
+
if (require_node_module.isNodeBuiltin("node:smol-manifest")) cachedSmolManifest = require_node_module.requireBuiltin("node:smol-manifest");
|
|
32
32
|
}
|
|
33
33
|
return cachedSmolManifest;
|
|
34
34
|
}
|
package/dist/smol/path.js
CHANGED
|
@@ -28,7 +28,7 @@ function getSmolPath() {
|
|
|
28
28
|
if (!smolPathProbed) {
|
|
29
29
|
smolPathProbed = true;
|
|
30
30
|
/* c8 ignore start - smol Node binary only. */
|
|
31
|
-
if (require_node_module.isNodeBuiltin("node:smol-path")) smolPathCache =
|
|
31
|
+
if (require_node_module.isNodeBuiltin("node:smol-path")) smolPathCache = require_node_module.requireBuiltin("node:smol-path");
|
|
32
32
|
}
|
|
33
33
|
return smolPathCache;
|
|
34
34
|
}
|
package/dist/smol/primordial.js
CHANGED
|
@@ -30,7 +30,7 @@ function getSmolPrimordial() {
|
|
|
30
30
|
if (!smolPrimordialProbed) {
|
|
31
31
|
smolPrimordialProbed = true;
|
|
32
32
|
/* c8 ignore start - smol Node binary only. */
|
|
33
|
-
if (require_node_module.isNodeBuiltin("node:smol-primordial")) smolPrimordial =
|
|
33
|
+
if (require_node_module.isNodeBuiltin("node:smol-primordial")) smolPrimordial = require_node_module.requireBuiltin("node:smol-primordial");
|
|
34
34
|
}
|
|
35
35
|
return smolPrimordial;
|
|
36
36
|
}
|
package/dist/smol/purl.js
CHANGED
|
@@ -29,7 +29,7 @@ function getSmolPurl() {
|
|
|
29
29
|
if (!smolPurlProbed) {
|
|
30
30
|
smolPurlProbed = true;
|
|
31
31
|
/* c8 ignore start - smol Node binary only. */
|
|
32
|
-
if (require_node_module.isNodeBuiltin("node:smol-purl")) smolPurl =
|
|
32
|
+
if (require_node_module.isNodeBuiltin("node:smol-purl")) smolPurl = require_node_module.requireBuiltin("node:smol-purl");
|
|
33
33
|
}
|
|
34
34
|
return smolPurl;
|
|
35
35
|
}
|
package/dist/smol/versions.js
CHANGED
|
@@ -26,7 +26,7 @@ function getSmolVersions() {
|
|
|
26
26
|
if (!smolVersionsProbed) {
|
|
27
27
|
smolVersionsProbed = true;
|
|
28
28
|
/* c8 ignore start - smol Node binary only. */
|
|
29
|
-
if (require_node_module.isNodeBuiltin("node:smol-versions")) smolVersions =
|
|
29
|
+
if (require_node_module.isNodeBuiltin("node:smol-versions")) smolVersions = require_node_module.requireBuiltin("node:smol-versions");
|
|
30
30
|
}
|
|
31
31
|
return smolVersions;
|
|
32
32
|
}
|
package/dist/smol/vfs.js
CHANGED
|
@@ -41,7 +41,7 @@ function getSmolVfs() {
|
|
|
41
41
|
if (!smolVfsProbed) {
|
|
42
42
|
smolVfsProbed = true;
|
|
43
43
|
/* c8 ignore start - smol Node binary only. */
|
|
44
|
-
if (require_node_module.isNodeBuiltin("node:smol-vfs")) cachedSmolVfs =
|
|
44
|
+
if (require_node_module.isNodeBuiltin("node:smol-vfs")) cachedSmolVfs = require_node_module.requireBuiltin("node:smol-vfs").getSmolVfs();
|
|
45
45
|
}
|
|
46
46
|
return cachedSmolVfs;
|
|
47
47
|
}
|
|
@@ -4,6 +4,5 @@
|
|
|
4
4
|
* locale / natural / semver comparison entrypoints.
|
|
5
5
|
*/
|
|
6
6
|
import type * as fastSortType from '../external/fast-sort';
|
|
7
|
-
|
|
7
|
+
export { getSemver } from '../versions/_internal';
|
|
8
8
|
export declare function getFastSort(): typeof fastSortType;
|
|
9
|
-
export declare function getSemver(): typeof semverType;
|
package/dist/sorts/_internal.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_versions__internal = require('../versions/_internal.js');
|
|
4
5
|
|
|
5
6
|
//#region src/sorts/_internal.ts
|
|
6
7
|
let fastSort;
|
|
7
|
-
let semver;
|
|
8
8
|
function getFastSort() {
|
|
9
9
|
if (fastSort === void 0) fastSort = /*@__PURE__*/ require("../external/fast-sort.js");
|
|
10
10
|
return fastSort;
|
|
11
11
|
}
|
|
12
|
-
function getSemver() {
|
|
13
|
-
if (semver === void 0) semver = /*@__PURE__*/ require("../external/semver.js");
|
|
14
|
-
return semver;
|
|
15
|
-
}
|
|
16
12
|
|
|
17
13
|
//#endregion
|
|
18
14
|
exports.getFastSort = getFastSort;
|
|
19
|
-
exports.getSemver = getSemver;
|
|
15
|
+
exports.getSemver = require_versions__internal.getSemver;
|
package/dist/sorts/semver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const
|
|
4
|
+
const require_versions__internal = require('../versions/_internal.js');
|
|
5
5
|
|
|
6
6
|
//#region src/sorts/semver.ts
|
|
7
7
|
/**
|
|
@@ -20,7 +20,7 @@ const require_sorts__internal = require('./_internal.js');
|
|
|
20
20
|
*/
|
|
21
21
|
function compareSemver(a, b) {
|
|
22
22
|
/* c8 ignore start */
|
|
23
|
-
const semver =
|
|
23
|
+
const semver = require_versions__internal.getSemver();
|
|
24
24
|
const validA = semver.valid(a);
|
|
25
25
|
/* c8 ignore stop */
|
|
26
26
|
const validB = semver.valid(b);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
4
5
|
const require_primordials_math = require('../primordials/math.js');
|
|
5
6
|
const require_primordials_array = require('../primordials/array.js');
|
|
6
|
-
const
|
|
7
|
+
const require_process_abort = require('../process/abort.js');
|
|
7
8
|
const require_logger_symbols = require('../logger/symbols.js');
|
|
8
9
|
const require_strings_predicates = require('../strings/predicates.js');
|
|
9
|
-
const require_process_abort = require('../process/abort.js');
|
|
10
10
|
const require_colors_convert = require('../colors/convert.js');
|
|
11
11
|
const require_strings_width = require('../strings/width.js');
|
|
12
12
|
const require_spinner_format = require('./format.js');
|
|
@@ -33,4 +33,4 @@ export declare function parseShimmerOption(shimmer: SpinnerOptions['shimmer']):
|
|
|
33
33
|
*
|
|
34
34
|
* @returns Resolved RGB color tuple.
|
|
35
35
|
*/
|
|
36
|
-
export declare function resolveSpinnerColorRgb(
|
|
36
|
+
export declare function resolveSpinnerColorRgb(options: SpinnerOptions): ColorRgb;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_primordials_error = require('../primordials/error.js');
|
|
5
5
|
const require_primordials_array = require('../primordials/array.js');
|
|
6
|
+
const require_env_ci = require('../env/ci.js');
|
|
6
7
|
const require_themes_themes = require('../themes/themes.js');
|
|
7
8
|
const require_themes_context = require('../themes/context.js');
|
|
8
|
-
const require_env_ci = require('../env/ci.js');
|
|
9
9
|
const require_colors_convert = require('../colors/convert.js');
|
|
10
10
|
const require_spinner_format = require('./format.js');
|
|
11
11
|
const require_effects_shimmer = require('../effects/shimmer.js');
|
|
@@ -80,17 +80,21 @@ function parseShimmerOption(shimmer) {
|
|
|
80
80
|
*
|
|
81
81
|
* @returns Resolved RGB color tuple.
|
|
82
82
|
*/
|
|
83
|
-
function resolveSpinnerColorRgb(
|
|
83
|
+
function resolveSpinnerColorRgb(options) {
|
|
84
|
+
options = {
|
|
85
|
+
__proto__: null,
|
|
86
|
+
...options
|
|
87
|
+
};
|
|
84
88
|
let theme = require_themes_context.getTheme();
|
|
85
|
-
if (
|
|
86
|
-
else theme =
|
|
89
|
+
if (options.theme) if (typeof options.theme === "string") theme = require_themes_themes.THEMES[options.theme] ?? theme;
|
|
90
|
+
else theme = options.theme;
|
|
87
91
|
let defaultColor = theme.colors.primary;
|
|
88
92
|
if (theme.effects?.spinner?.color) {
|
|
89
93
|
const resolved = require_themes_resolve.resolveColor(theme.effects.spinner.color, theme.colors);
|
|
90
94
|
if (resolved === "inherit" || require_primordials_array.ArrayIsArray(resolved[0])) defaultColor = theme.colors.primary;
|
|
91
95
|
else defaultColor = resolved;
|
|
92
96
|
}
|
|
93
|
-
const spinnerColor =
|
|
97
|
+
const spinnerColor = options.color ?? defaultColor;
|
|
94
98
|
if (require_colors_convert.isRgbTuple(spinnerColor) && (spinnerColor.length !== 3 || !spinnerColor.every((n) => typeof n === "number" && n >= 0 && n <= 255))) throw new require_primordials_error.TypeErrorCtor("RGB color must be an array of 3 numbers between 0 and 255");
|
|
95
99
|
return require_colors_convert.toRgb(spinnerColor);
|
|
96
100
|
}
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
* the live `YoctoSpinner` constructor resolved here; building it lazily keeps
|
|
8
8
|
* the module free of side effects at import time.
|
|
9
9
|
*/
|
|
10
|
+
import type { YoctoSpinnerConstructor } from './create-spinner-class';
|
|
10
11
|
import type { SpinnerInstance, SpinnerOptions } from './types';
|
|
12
|
+
export type YoctoSpinnerFactory = (options: Record<string, unknown>) => {
|
|
13
|
+
constructor: YoctoSpinnerConstructor;
|
|
14
|
+
};
|
|
11
15
|
/**
|
|
12
16
|
* Create a spinner instance for displaying loading indicators. Provides an
|
|
13
17
|
* animated CLI spinner with status messages, progress tracking, and shimmer
|
package/dist/spinner/spinner.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
-
const require_logger_default = require('../logger/default.js');
|
|
6
5
|
const require_env_ci = require('../env/ci.js');
|
|
6
|
+
const require_logger_default = require('../logger/default.js');
|
|
7
7
|
const require_spinner_format = require('./format.js');
|
|
8
8
|
const require_spinner_create_spinner_class = require('./create-spinner-class.js');
|
|
9
9
|
const require_spinner_default = require('./default.js');
|
package/dist/stdio/progress.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
-
const
|
|
5
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
6
6
|
const require_primordials_string = require('../primordials/string.js');
|
|
7
|
+
const require_primordials_math = require('../primordials/math.js');
|
|
7
8
|
const require_primordials_date = require('../primordials/date.js');
|
|
8
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
9
9
|
const require_ansi_strip = require('../ansi/strip.js');
|
|
10
10
|
const require_strings_format = require('../strings/format.js');
|
|
11
11
|
let node_process = require("node:process");
|
|
@@ -43,6 +43,10 @@ var ProgressBar = class {
|
|
|
43
43
|
* @param options - Configuration options for the progress bar.
|
|
44
44
|
*/
|
|
45
45
|
constructor(total, options) {
|
|
46
|
+
options = {
|
|
47
|
+
__proto__: null,
|
|
48
|
+
...options
|
|
49
|
+
};
|
|
46
50
|
this.total = total;
|
|
47
51
|
this.startTime = require_primordials_date.DateNow();
|
|
48
52
|
this.stream = options?.stream || node_process.default.stderr;
|
package/dist/stdio/prompts.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import checkboxRaw from '../external/@inquirer/checkbox';
|
|
|
6
6
|
import confirmRaw from '../external/@inquirer/confirm';
|
|
7
7
|
import inputRaw from '../external/@inquirer/input';
|
|
8
8
|
import passwordRaw from '../external/@inquirer/password';
|
|
9
|
-
import type { ColorValue } from '../colors/types';
|
|
10
9
|
import type { Remap } from '../objects/types';
|
|
11
10
|
import type { SpinnerInstance } from '../spinner/types';
|
|
12
11
|
import type { ThemeName } from '../themes/themes';
|
|
@@ -45,7 +44,7 @@ export interface Choice<Value = unknown> {
|
|
|
45
44
|
* Context for inquirer prompts. Minimal context interface used by Inquirer
|
|
46
45
|
* prompts. Duplicated from `@inquirer/type` - InquirerContext.
|
|
47
46
|
*/
|
|
48
|
-
interface InquirerContext {
|
|
47
|
+
export interface InquirerContext {
|
|
49
48
|
/**
|
|
50
49
|
* Abort signal for cancelling the prompt.
|
|
51
50
|
*/
|
|
@@ -88,19 +87,12 @@ export type Context = Remap<InquirerContext & {
|
|
|
88
87
|
* { name: 'Option 2', value: 2 },
|
|
89
88
|
* ]
|
|
90
89
|
*/
|
|
91
|
-
declare class SeparatorType {
|
|
90
|
+
export declare class SeparatorType {
|
|
92
91
|
readonly separator: string;
|
|
93
92
|
readonly type: 'separator';
|
|
94
93
|
constructor(separator?: string);
|
|
95
94
|
}
|
|
96
95
|
export type Separator = SeparatorType;
|
|
97
|
-
/**
|
|
98
|
-
* Apply a color to text using yoctocolors. Handles both named colors and RGB
|
|
99
|
-
* tuples.
|
|
100
|
-
*
|
|
101
|
-
* @private
|
|
102
|
-
*/
|
|
103
|
-
export declare function applyColor(text: string, color: ColorValue): string;
|
|
104
96
|
/**
|
|
105
97
|
* Convert Socket theme to @inquirer theme format. Maps our theme colors to
|
|
106
98
|
* inquirer's style functions. Handles theme names, Theme objects, and passes
|
package/dist/stdio/prompts.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_process_abort = require('../process/abort.js');
|
|
5
6
|
const require_themes_themes = require('../themes/themes.js');
|
|
6
7
|
const require_themes_context = require('../themes/context.js');
|
|
7
|
-
const
|
|
8
|
+
const require_logger_colors = require('../logger/colors.js');
|
|
8
9
|
const require_themes_resolve = require('../themes/resolve.js');
|
|
9
10
|
const require_spinner_default = require('../spinner/default.js');
|
|
10
|
-
let src_external_yoctocolors_cjs = require("../external/yoctocolors-cjs");
|
|
11
|
-
src_external_yoctocolors_cjs = require_runtime.__toESM(src_external_yoctocolors_cjs);
|
|
12
11
|
let src_external__inquirer_checkbox = require("../external/@inquirer/checkbox");
|
|
13
12
|
src_external__inquirer_checkbox = require_runtime.__toESM(src_external__inquirer_checkbox);
|
|
14
13
|
let src_external__inquirer_confirm = require("../external/@inquirer/confirm");
|
|
@@ -34,17 +33,6 @@ const selectModule = src_external__inquirer_select;
|
|
|
34
33
|
const selectRaw = selectModule.default;
|
|
35
34
|
const ActualSeparator = selectModule.Separator;
|
|
36
35
|
/**
|
|
37
|
-
* Apply a color to text using yoctocolors. Handles both named colors and RGB
|
|
38
|
-
* tuples.
|
|
39
|
-
*
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
function applyColor(text, color) {
|
|
43
|
-
if (typeof color === "string") return src_external_yoctocolors_cjs.default[color](text);
|
|
44
|
-
const { 0: r, 1: g, 2: b } = color;
|
|
45
|
-
return `\u001B[38;2;${r};${g};${b}m${text}\u001B[39m`;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
36
|
* Convert Socket theme to @inquirer theme format. Maps our theme colors to
|
|
49
37
|
* inquirer's style functions. Handles theme names, Theme objects, and passes
|
|
50
38
|
* through @inquirer themes.
|
|
@@ -75,18 +63,18 @@ function createInquirerTheme(theme) {
|
|
|
75
63
|
const primaryColor = socketTheme.colors.primary;
|
|
76
64
|
return {
|
|
77
65
|
style: {
|
|
78
|
-
message: (text) => applyColor(text, promptColor),
|
|
79
|
-
answer: (text) => applyColor(text, primaryColor),
|
|
80
|
-
help: (text) => applyColor(text, textDimColor),
|
|
81
|
-
description: (text) => applyColor(text, textDimColor),
|
|
82
|
-
disabled: (text) => applyColor(text, textDimColor),
|
|
83
|
-
error: (text) => applyColor(text, errorColor),
|
|
84
|
-
highlight: (text) => applyColor(text, primaryColor)
|
|
66
|
+
message: (text) => require_logger_colors.applyColor(text, promptColor),
|
|
67
|
+
answer: (text) => require_logger_colors.applyColor(text, primaryColor),
|
|
68
|
+
help: (text) => require_logger_colors.applyColor(text, textDimColor),
|
|
69
|
+
description: (text) => require_logger_colors.applyColor(text, textDimColor),
|
|
70
|
+
disabled: (text) => require_logger_colors.applyColor(text, textDimColor),
|
|
71
|
+
error: (text) => require_logger_colors.applyColor(text, errorColor),
|
|
72
|
+
highlight: (text) => require_logger_colors.applyColor(text, primaryColor)
|
|
85
73
|
},
|
|
86
74
|
icon: {
|
|
87
|
-
checked: applyColor("✓", successColor),
|
|
75
|
+
checked: require_logger_colors.applyColor("✓", successColor),
|
|
88
76
|
unchecked: " ",
|
|
89
|
-
cursor: applyColor("❯", primaryColor)
|
|
77
|
+
cursor: require_logger_colors.applyColor("❯", primaryColor)
|
|
90
78
|
}
|
|
91
79
|
};
|
|
92
80
|
}
|
|
@@ -246,7 +234,6 @@ const select = wrapPrompt(selectRaw);
|
|
|
246
234
|
|
|
247
235
|
//#endregion
|
|
248
236
|
exports.Separator = ActualSeparator;
|
|
249
|
-
exports.applyColor = applyColor;
|
|
250
237
|
exports.checkbox = checkbox;
|
|
251
238
|
exports.confirm = confirm;
|
|
252
239
|
exports.createInquirerTheme = createInquirerTheme;
|