@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/paths/socket.js
CHANGED
|
@@ -2,33 +2,36 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_node_os = require('../node/os.js');
|
|
5
|
+
const require_constants_platform = require('../constants/platform.js');
|
|
6
|
+
const require_env_home = require('../env/home.js');
|
|
7
|
+
const require_env_xdg = require('../env/xdg.js');
|
|
5
8
|
const require_paths_normalize = require('./normalize.js');
|
|
6
9
|
const require_node_path = require('../node/path.js');
|
|
7
10
|
const require_env_socket = require('../env/socket.js');
|
|
8
|
-
const require_constants_github = require('../constants/github.js');
|
|
9
11
|
const require_constants_socket = require('../constants/socket.js');
|
|
10
|
-
const require_env_home = require('../env/home.js');
|
|
11
12
|
const require_env_windows = require('../env/windows.js');
|
|
12
13
|
const require_paths_dirnames = require('./dirnames.js');
|
|
13
14
|
const require_paths_rewire = require('./rewire.js');
|
|
14
15
|
|
|
15
16
|
//#region src/paths/socket.ts
|
|
16
17
|
/**
|
|
17
|
-
* @file Path utilities for Socket ecosystem directories.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
18
|
+
* @file Path utilities for Socket ecosystem directories. Platform-aware
|
|
19
|
+
* resolution for the shared ~/.socket/ layout. The `_`-prefixed entries are
|
|
20
|
+
* Socket-managed DIRS (not apps): `_cacache` content-addressable cache;
|
|
21
|
+
* `_dlx/<hash>/` name+version binary store (node, jre, python, sfw, …);
|
|
22
|
+
* `_state/<app>/` version-LESS persistent app state (daemon socket + lock +
|
|
23
|
+
* OAuth refresh; mirrors pnpm `state-dir` / XDG_STATE_HOME), with
|
|
24
|
+
* `_state/<app>/run/` for a daemon's socket/lock/pid; `_wheelhouse`
|
|
25
|
+
* cross-fleet shared bin. Generic per-app dirs (`getSocketAppDir('<name>')`)
|
|
26
|
+
* nest under the same `_`-prefix.
|
|
25
27
|
*/
|
|
26
28
|
/**
|
|
27
29
|
* Get the OS home directory. Can be overridden in tests using
|
|
28
30
|
* setPath('homedir', ...) from paths/rewire.
|
|
29
31
|
*/
|
|
30
32
|
function getOsHomeDir() {
|
|
31
|
-
|
|
33
|
+
const os = require_node_os.getNodeOs();
|
|
34
|
+
return require_paths_rewire.getPathValue("homedir", () => os.homedir());
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Get the OS temporary directory. Can be overridden in tests using
|
|
@@ -39,7 +42,35 @@ function getOsHomeDir() {
|
|
|
39
42
|
* setPath('tmpdir', ...) from paths/rewire.
|
|
40
43
|
*/
|
|
41
44
|
function getOsTmpDir() {
|
|
42
|
-
|
|
45
|
+
const os = require_node_os.getNodeOs();
|
|
46
|
+
return require_paths_rewire.getPathValue("tmpdir", () => os.tmpdir());
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the runtime socket path for a local daemon named `name`. Distinct
|
|
50
|
+
* from getSocketAppRuntimeDir (the persistent ~/.socket/_state/<app>/run/
|
|
51
|
+
* home): the SOCKET endpoint itself belongs in the ephemeral, owner-only XDG
|
|
52
|
+
* runtime dir — correctly permissioned and auto-cleaned on logout — while the
|
|
53
|
+
* downloaded daemon binary + durable token cache live under ~/.socket. The
|
|
54
|
+
* daemon and every client MUST compute the identical path (1 path, 1
|
|
55
|
+
* reference), so this is the single resolver both sides call.
|
|
56
|
+
*
|
|
57
|
+
* Resolution:
|
|
58
|
+
*
|
|
59
|
+
* - Windows: `\\.\pipe\<name>-sock` (named pipe; Unix sockets are unavailable
|
|
60
|
+
* pre-Win10 1803, same framing/semantics). Returned raw — a pipe path is not
|
|
61
|
+
* a filesystem path and must not be slash-normalized.
|
|
62
|
+
* - `$XDG_RUNTIME_DIR/<name>.sock` when XDG_RUNTIME_DIR is set (systemd
|
|
63
|
+
* `/run/user/<uid>/`).
|
|
64
|
+
* - Else `$TMPDIR/<name>-<uid>.sock` (the `<uid>` suffix avoids collisions when
|
|
65
|
+
* TMPDIR is shared across users on a multi-tenant box).
|
|
66
|
+
*/
|
|
67
|
+
function getRuntimeSocketPath(name) {
|
|
68
|
+
if (require_constants_platform.WIN32) return `\\\\.\\pipe\\${name}-sock`;
|
|
69
|
+
const path = require_node_path.getNodePath();
|
|
70
|
+
const xdgRuntimeDir = require_env_xdg.getXdgRuntimeDir();
|
|
71
|
+
if (xdgRuntimeDir) return require_paths_normalize.normalizePath(path.join(xdgRuntimeDir, `${name}.sock`));
|
|
72
|
+
const { uid } = require_node_os.getNodeOs().userInfo();
|
|
73
|
+
return require_paths_normalize.normalizePath(path.join(getOsTmpDir(), `${name}-${uid}.sock`));
|
|
43
74
|
}
|
|
44
75
|
/**
|
|
45
76
|
* Get a Socket app cache directory (~/.socket/_<appName>/cache).
|
|
@@ -60,81 +91,72 @@ function getSocketAppCacheTtlDir(appName) {
|
|
|
60
91
|
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketAppCacheDir(appName), "ttl"));
|
|
61
92
|
}
|
|
62
93
|
/**
|
|
63
|
-
* Get a Socket app directory (~/.socket/_<appName>).
|
|
94
|
+
* Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
|
|
95
|
+
* here; pass the bare app name (e.g. 'socket', 'registry').
|
|
64
96
|
*/
|
|
65
97
|
/**
|
|
66
|
-
* Get a Socket app directory (~/.socket/_<appName>).
|
|
98
|
+
* Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
|
|
99
|
+
* here; pass the bare app name (e.g. 'socket', 'registry').
|
|
67
100
|
*/
|
|
68
101
|
function getSocketAppDir(appName) {
|
|
69
102
|
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), `${"_"}${appName}`));
|
|
70
103
|
}
|
|
71
104
|
/**
|
|
72
|
-
* Get the Socket cacache directory (~/.socket/_cacache).
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* Priority order:
|
|
77
|
-
*
|
|
78
|
-
* 1. Test override via setPath('socket-cacache-dir', ...)
|
|
79
|
-
* 2. SOCKET_CACACHE_DIR - Full override of cacache directory
|
|
80
|
-
* 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
|
|
105
|
+
* Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
|
|
106
|
+
* setPath('socket-cacache-dir', …) → SOCKET_CACACHE_DIR env →
|
|
107
|
+
* $SOCKET_HOME/_cacache → $HOME/.socket/_cacache.
|
|
81
108
|
*/
|
|
82
109
|
/**
|
|
83
|
-
* Get
|
|
84
|
-
*
|
|
85
|
-
* is
|
|
86
|
-
*
|
|
87
|
-
* Priority order:
|
|
88
|
-
*
|
|
89
|
-
* 1. Test override via setPath('socket-cacache-dir', ...)
|
|
90
|
-
* 2. SOCKET_CACACHE_DIR - Full override of cacache directory
|
|
91
|
-
* 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
|
|
110
|
+
* Get an app's runtime directory (~/.socket/_state/<app>/run/) — the home for a
|
|
111
|
+
* daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
|
|
112
|
+
* the socket path is stable across binary upgrades.
|
|
92
113
|
*/
|
|
93
|
-
function
|
|
94
|
-
return
|
|
95
|
-
if (require_env_socket.getSocketCacacheDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketCacacheDirEnv());
|
|
96
|
-
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), `${"_"}cacache`));
|
|
97
|
-
});
|
|
114
|
+
function getSocketAppRuntimeDir(appName) {
|
|
115
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketAppStateDir(appName), "run"));
|
|
98
116
|
}
|
|
99
117
|
/**
|
|
100
|
-
* Get the Socket
|
|
118
|
+
* Get the Socket user directory (~/.socket). Override precedence:
|
|
119
|
+
* setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
|
|
120
|
+
* /tmp/.socket (Unix) or %TEMP%.socket (Windows).
|
|
101
121
|
*/
|
|
102
122
|
/**
|
|
103
|
-
* Get
|
|
123
|
+
* Get an app's persistent state directory (~/.socket/_state/<app>/). The
|
|
124
|
+
* `<app>` is a real app (proteus, acorn) nesting its version-less state inside
|
|
125
|
+
* the `_state` infra dir.
|
|
104
126
|
*/
|
|
105
|
-
function
|
|
106
|
-
return
|
|
127
|
+
function getSocketAppStateDir(appName) {
|
|
128
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketStateDir(), appName));
|
|
107
129
|
}
|
|
108
130
|
/**
|
|
109
|
-
* Get
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* Priority order:
|
|
114
|
-
*
|
|
115
|
-
* 1. Test override via setPath('socket-dlx-dir', ...)
|
|
116
|
-
* 2. SOCKET_DLX_DIR - Full override of DLX cache directory
|
|
117
|
-
* 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
|
|
118
|
-
* 4. Default: $HOME/.socket/_dlx
|
|
119
|
-
* 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%.socket_dlx (Windows)
|
|
131
|
+
* Get an app's runtime directory (~/.socket/_state/<app>/run/) — the home for a
|
|
132
|
+
* daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
|
|
133
|
+
* the socket path is stable across binary upgrades.
|
|
120
134
|
*/
|
|
121
135
|
/**
|
|
122
|
-
* Get the Socket
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
* Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
|
|
137
|
+
* setPath('socket-cacache-dir', …) → SOCKET_CACACHE_DIR env →
|
|
138
|
+
* $SOCKET_HOME/_cacache → $HOME/.socket/_cacache.
|
|
139
|
+
*/
|
|
140
|
+
function getSocketCacacheDir() {
|
|
141
|
+
return require_paths_rewire.getPathValue("socket-cacache-dir", () => {
|
|
142
|
+
if (require_env_socket.getSocketCacacheDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketCacacheDirEnv());
|
|
143
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.cacache));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
|
|
148
|
+
* (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
|
|
149
|
+
* …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
|
|
153
|
+
* (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
|
|
154
|
+
* …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
|
|
133
155
|
*/
|
|
134
156
|
function getSocketDlxDir() {
|
|
135
157
|
return require_paths_rewire.getPathValue("socket-dlx-dir", () => {
|
|
136
158
|
if (require_env_socket.getSocketDlxDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketDlxDirEnv());
|
|
137
|
-
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(),
|
|
159
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.dlx));
|
|
138
160
|
});
|
|
139
161
|
}
|
|
140
162
|
/**
|
|
@@ -149,51 +171,71 @@ function getSocketHomePath() {
|
|
|
149
171
|
return getSocketUserDir();
|
|
150
172
|
}
|
|
151
173
|
/**
|
|
152
|
-
* Get the
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
174
|
+
* Get the Wheelhouse rack directory (~/.socket/_wheelhouse/rack) — the tool
|
|
175
|
+
* STORE. Every `_wheelhouse`-managed CLI tool keeps its real binaries here,
|
|
176
|
+
* racked by name + version as `<rack>/<tool>/<version>/…` (the wheelhouse
|
|
177
|
+
* analog of Homebrew's `Cellar/`). The handles on PATH live in
|
|
178
|
+
* `<wheelhouse>/bin` (getSocketWheelhouseBinDir) and point into the rack.
|
|
179
|
+
* Inherits the `_wheelhouse` override chain (SOCKET_HOME /
|
|
180
|
+
* setPath('socket-wheelhouse-dir')).
|
|
156
181
|
*/
|
|
157
|
-
function
|
|
158
|
-
return
|
|
182
|
+
function getSocketRackDir() {
|
|
183
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketWheelhouseDir(), "rack"));
|
|
159
184
|
}
|
|
160
185
|
/**
|
|
161
|
-
* Get
|
|
162
|
-
*
|
|
186
|
+
* Get a racked tool's version directory (~/.socket/_wheelhouse/rack/<tool>/
|
|
187
|
+
* <version>) — the per-tool, per-version home under the rack. The
|
|
188
|
+
* 1-path-1-reference owner of a tool install destination: installers resolve
|
|
189
|
+
* their extract/copy target through this, and the `<wheelhouse>/bin/<tool>`
|
|
190
|
+
* shim points at a binary inside it.
|
|
163
191
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(
|
|
192
|
+
function getSocketRackToolDir(options) {
|
|
193
|
+
const opts = {
|
|
194
|
+
__proto__: null,
|
|
195
|
+
...options
|
|
196
|
+
};
|
|
197
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketRackDir(), opts.tool, opts.version));
|
|
170
198
|
}
|
|
171
199
|
/**
|
|
172
|
-
* Get the
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
|
|
177
|
-
* appropriate `bin/` to PATH or invoke the binary by absolute path.
|
|
200
|
+
* Get the Wheelhouse repo-clones directory (~/.socket/_wheelhouse/repo-clones).
|
|
201
|
+
* Sits beside the per-tool dirs (sfw, codedb, janus, bin) under `_wheelhouse`.
|
|
202
|
+
* The home for reference clones of EXTERNAL repos an agent reviews, each as
|
|
203
|
+
* `<org>-<repo>` lowercased + dash-cased (e.g. `justrach-codedb`).
|
|
178
204
|
*
|
|
179
|
-
*
|
|
205
|
+
* Smallest-practical clone form (smallest disk + fastest initial fetch without
|
|
206
|
+
* the treeless tax): git clone --depth=1 --single-branch --filter=blob:none
|
|
207
|
+
* <url> <dest> `--depth=1` truncates history, `--single-branch` skips other
|
|
208
|
+
* refs, and `--filter=blob:none` (a BLOBLESS partial clone) fetches file blobs
|
|
209
|
+
* lazily on first access — so the initial download is tree-metadata only.
|
|
210
|
+
* (Treeless `--filter=tree:0` is smaller still but refetches trees on every
|
|
211
|
+
* walk, which is slow + breaks offline, so it is NOT the default.)
|
|
180
212
|
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
213
|
+
* Deliberately OUTSIDE `~/projects/` so the fleet's sibling-walk tooling (e.g.
|
|
214
|
+
* cascade `--all`) never mistakes a reference clone for a fleet member
|
|
215
|
+
* checkout. Disposable: a reference cache, not a working tree. Inherits the
|
|
216
|
+
* `_wheelhouse` override chain (SOCKET_HOME /
|
|
217
|
+
* setPath('socket-wheelhouse-dir')).
|
|
185
218
|
*/
|
|
219
|
+
function getSocketRepoClonesDir() {
|
|
220
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketWheelhouseDir(), "repo-clones"));
|
|
221
|
+
}
|
|
186
222
|
/**
|
|
187
|
-
* Get the Socket
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
223
|
+
* Get the Socket state directory (~/.socket/_state) — version-LESS persistent
|
|
224
|
+
* app state (the home for daemon sockets, locks, OAuth refresh, durable caches
|
|
225
|
+
* that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
|
|
226
|
+
* Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
|
|
227
|
+
* $SOCKET_HOME/_state → $HOME/.socket/_state.
|
|
228
|
+
*/
|
|
229
|
+
function getSocketStateDir() {
|
|
230
|
+
return require_paths_rewire.getPathValue("socket-state-dir", () => {
|
|
231
|
+
if (require_env_socket.getSocketStateDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketStateDirEnv());
|
|
232
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.state));
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Get the Socket user directory (~/.socket). Override precedence:
|
|
237
|
+
* setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
|
|
238
|
+
* /tmp/.socket (Unix) or %TEMP%.socket (Windows).
|
|
197
239
|
*/
|
|
198
240
|
function getSocketUserDir() {
|
|
199
241
|
return require_paths_rewire.getPathValue("socket-user-dir", () => {
|
|
@@ -203,52 +245,46 @@ function getSocketUserDir() {
|
|
|
203
245
|
});
|
|
204
246
|
}
|
|
205
247
|
/**
|
|
206
|
-
* Get the
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
248
|
+
* Get the Wheelhouse bin directory (~/.socket/_wheelhouse/bin) — the single
|
|
249
|
+
* directory placed on PATH. Holds only flat handles (thin exec shims or
|
|
250
|
+
* symlinks), one per tool, each pointing at a real binary racked under
|
|
251
|
+
* `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir). The shim IS
|
|
252
|
+
* the bin, the npm `prefix/bin` / Homebrew `bin/` model: PATH lookup does not
|
|
253
|
+
* recurse, so this dir stays flat (never a `bin/<tool>/` subdir). Inherits the
|
|
254
|
+
* `_wheelhouse` override chain (SOCKET_HOME /
|
|
255
|
+
* setPath('socket-wheelhouse-dir')).
|
|
212
256
|
*/
|
|
257
|
+
function getSocketWheelhouseBinDir() {
|
|
258
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketWheelhouseDir(), "bin"));
|
|
259
|
+
}
|
|
213
260
|
/**
|
|
214
261
|
* Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
|
|
215
262
|
* cross-fleet location for binaries that every fleet member can reach without
|
|
216
263
|
* each one re-downloading and re-extracting per-repo. Tool installers (janus,
|
|
217
|
-
* sfw, etc.)
|
|
218
|
-
* `<wheelhouse
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* 1. Test override via setPath('socket-wheelhouse-dir', ...)
|
|
224
|
-
* 2. SOCKET_HOME/_wheelhouse - Base directory override (inherits from
|
|
225
|
-
* getSocketUserDir)
|
|
226
|
-
* 3. Default: $HOME/.socket/_wheelhouse
|
|
264
|
+
* sfw, etc.) rack their resolved executables under
|
|
265
|
+
* `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir) and expose a
|
|
266
|
+
* handle in `<wheelhouse>/bin` (getSocketWheelhouseBinDir); consumers add that
|
|
267
|
+
* one `bin/` to PATH. Override precedence: setPath('socket-wheelhouse-dir', …)
|
|
268
|
+
* → $SOCKET_HOME/_wheelhouse → $HOME/.socket/_wheelhouse.
|
|
227
269
|
*/
|
|
228
270
|
function getSocketWheelhouseDir() {
|
|
229
271
|
return require_paths_rewire.getPathValue("socket-wheelhouse-dir", () => {
|
|
230
|
-
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(),
|
|
272
|
+
return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.wheelhouse));
|
|
231
273
|
});
|
|
232
274
|
}
|
|
233
275
|
/**
|
|
234
|
-
* Get the
|
|
235
|
-
*
|
|
236
|
-
* getPathValue for performance.
|
|
237
|
-
*
|
|
238
|
-
* Priority order:
|
|
276
|
+
* Get the user's home directory. Uses environment variables directly to support
|
|
277
|
+
* test mocking. Falls back to temporary directory if home is not available.
|
|
239
278
|
*
|
|
240
|
-
* 1.
|
|
241
|
-
*
|
|
242
|
-
* 3. Default: $HOME/.socket
|
|
243
|
-
* 4. Fallback: /tmp/.socket (Unix) or %TEMP%.socket (Windows)
|
|
279
|
+
* Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
|
|
280
|
+
* getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
|
|
244
281
|
*/
|
|
245
282
|
/**
|
|
246
283
|
* Get the user's home directory. Uses environment variables directly to support
|
|
247
284
|
* test mocking. Falls back to temporary directory if home is not available.
|
|
248
285
|
*
|
|
249
|
-
* Priority order: 1. HOME
|
|
250
|
-
*
|
|
251
|
-
* getNodeOs().tmpdir() (rarely used, for restricted environments)
|
|
286
|
+
* Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
|
|
287
|
+
* getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
|
|
252
288
|
*/
|
|
253
289
|
function getUserHomeDir() {
|
|
254
290
|
const home = require_env_home.getHome();
|
|
@@ -267,15 +303,20 @@ function getUserHomeDir() {
|
|
|
267
303
|
//#endregion
|
|
268
304
|
exports.getOsHomeDir = getOsHomeDir;
|
|
269
305
|
exports.getOsTmpDir = getOsTmpDir;
|
|
306
|
+
exports.getRuntimeSocketPath = getRuntimeSocketPath;
|
|
270
307
|
exports.getSocketAppCacheDir = getSocketAppCacheDir;
|
|
271
308
|
exports.getSocketAppCacheTtlDir = getSocketAppCacheTtlDir;
|
|
272
309
|
exports.getSocketAppDir = getSocketAppDir;
|
|
310
|
+
exports.getSocketAppRuntimeDir = getSocketAppRuntimeDir;
|
|
311
|
+
exports.getSocketAppStateDir = getSocketAppStateDir;
|
|
273
312
|
exports.getSocketCacacheDir = getSocketCacacheDir;
|
|
274
|
-
exports.getSocketCliDir = getSocketCliDir;
|
|
275
313
|
exports.getSocketDlxDir = getSocketDlxDir;
|
|
276
314
|
exports.getSocketHomePath = getSocketHomePath;
|
|
277
|
-
exports.
|
|
278
|
-
exports.
|
|
315
|
+
exports.getSocketRackDir = getSocketRackDir;
|
|
316
|
+
exports.getSocketRackToolDir = getSocketRackToolDir;
|
|
317
|
+
exports.getSocketRepoClonesDir = getSocketRepoClonesDir;
|
|
318
|
+
exports.getSocketStateDir = getSocketStateDir;
|
|
279
319
|
exports.getSocketUserDir = getSocketUserDir;
|
|
320
|
+
exports.getSocketWheelhouseBinDir = getSocketWheelhouseBinDir;
|
|
280
321
|
exports.getSocketWheelhouseDir = getSocketWheelhouseDir;
|
|
281
322
|
exports.getUserHomeDir = getUserHomeDir;
|
package/dist/perf/metrics.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_primordials_math = require('../primordials/math.js');
|
|
5
4
|
const require_primordials_object = require('../primordials/object.js');
|
|
5
|
+
const require_primordials_math = require('../primordials/math.js');
|
|
6
6
|
const require_debug_output = require('../debug/output.js');
|
|
7
7
|
const require_perf__internal = require('./_internal.js');
|
|
8
8
|
|
package/dist/perf/report.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_primordials_math = require('../primordials/math.js');
|
|
5
4
|
const require_primordials_object = require('../primordials/object.js');
|
|
5
|
+
const require_primordials_math = require('../primordials/math.js');
|
|
6
6
|
const require_debug_output = require('../debug/output.js');
|
|
7
7
|
const require_perf__internal = require('./_internal.js');
|
|
8
8
|
const require_perf_enabled = require('./enabled.js');
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Safe call-through accessors for the `process` global's methods and
|
|
3
|
+
* value reads. The `process` object reference is captured once at module load
|
|
4
|
+
* (immune to a later `globalThis.process = …` reassignment), but each method
|
|
5
|
+
* is CALLED at access time off that captured object — so `vi.spyOn(process,
|
|
6
|
+
* 'cwd')`, which mutates the same captured object, still intercepts. Binding
|
|
7
|
+
* the method reference instead (`process.cwd.bind(process)`) would freeze it
|
|
8
|
+
* and break that test seam, so we deliberately keep the late call. Consumers
|
|
9
|
+
* read cwd / platform / env / argv through these instead of touching
|
|
10
|
+
* `process` directly; enforced fleet-wide by
|
|
11
|
+
* `socket/prefer-process-primordial`. This is the `process` leaf of the
|
|
12
|
+
* node-module primordials: where `node/fs` / `node/path` lazy-load a `node:`
|
|
13
|
+
* module behind a function, this captures the always-present `process` global
|
|
14
|
+
* and routes its hot reads through one tamper-resistant surface.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The CPU architecture token (`'x64'` / `'arm64'` / …).
|
|
18
|
+
*/
|
|
19
|
+
export declare function processArch(): string;
|
|
20
|
+
/**
|
|
21
|
+
* The argv array (`[execPath, scriptPath, ...args]`).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ;```typescript
|
|
25
|
+
* const entry = processArgv()[1]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function processArgv(): string[];
|
|
29
|
+
/**
|
|
30
|
+
* The current working directory. Call-through to the captured process's `cwd` —
|
|
31
|
+
* late-bound so test spies still intercept.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ;```typescript
|
|
35
|
+
* const dir = processCwd()
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function processCwd(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Emit a process warning. Call-through so a test spy on `process.emitWarning`
|
|
41
|
+
* still intercepts.
|
|
42
|
+
*/
|
|
43
|
+
export declare function processEmitWarning(...args: Parameters<NodeJS.Process['emitWarning']>): void;
|
|
44
|
+
/**
|
|
45
|
+
* The process environment object. Returns the live `process.env` off the
|
|
46
|
+
* captured process (call-through, so a test that swaps `process.env` is seen).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ;```typescript
|
|
50
|
+
* const token = processEnv()['SOCKET_API_TOKEN']
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function processEnv(): NodeJS.ProcessEnv;
|
|
54
|
+
/**
|
|
55
|
+
* The absolute path to the Node executable (`process.execPath`).
|
|
56
|
+
*/
|
|
57
|
+
export declare function processExecPath(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Schedule a callback on the next tick. Call-through (late-bound).
|
|
60
|
+
*/
|
|
61
|
+
export declare function processNextTick(...args: Parameters<NodeJS.Process['nextTick']>): void;
|
|
62
|
+
/**
|
|
63
|
+
* The process id.
|
|
64
|
+
*/
|
|
65
|
+
export declare function processPid(): number;
|
|
66
|
+
/**
|
|
67
|
+
* The OS platform token (`'darwin'` / `'linux'` / `'win32'` / …).
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ;```typescript
|
|
71
|
+
* if (processPlatform() === 'win32') { … }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function processPlatform(): NodeJS.Platform;
|
|
75
|
+
/**
|
|
76
|
+
* The standard error stream. Returned off the captured process so a test that
|
|
77
|
+
* spies on `process.stderr.write` still intercepts.
|
|
78
|
+
*/
|
|
79
|
+
export declare function processStderr(): NodeJS.WriteStream;
|
|
80
|
+
/**
|
|
81
|
+
* The standard output stream. Returned off the captured process so a test that
|
|
82
|
+
* spies on `process.stdout.write` still intercepts.
|
|
83
|
+
*/
|
|
84
|
+
export declare function processStdout(): NodeJS.WriteStream;
|
|
85
|
+
/**
|
|
86
|
+
* The Node version string (`process.version`, e.g. `'v26.2.0'`).
|
|
87
|
+
*/
|
|
88
|
+
export declare function processVersion(): string;
|