@socketsecurity/lib 6.0.8 → 6.0.10
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 +28 -0
- package/README.md +8 -9
- package/dist/abort/signal.d.ts +1 -1
- package/dist/abort/signal.js +1 -1
- package/dist/ai/agent-context.d.mts +1 -1
- package/dist/ai/agent-context.js +3 -2
- package/dist/ai/backends.d.mts +3 -3
- package/dist/ai/backends.js +2 -2
- package/dist/ai/billing-context.d.mts +74 -0
- package/dist/ai/billing-context.js +129 -0
- package/dist/ai/credentials.d.mts +39 -5
- package/dist/ai/credentials.js +61 -6
- package/dist/ai/discover.d.mts +4 -0
- package/dist/ai/discover.js +4 -0
- package/dist/ai/exec.d.mts +1 -1
- package/dist/ai/exec.js +1 -1
- package/dist/ai/http.d.mts +8 -8
- package/dist/ai/http.js +6 -6
- package/dist/ai/profiles.d.mts +9 -10
- package/dist/ai/profiles.js +0 -5
- package/dist/ai/role.d.mts +58 -0
- package/dist/ai/role.js +96 -0
- package/dist/ai/route-heuristic.d.mts +177 -0
- package/dist/ai/route-heuristic.js +194 -0
- package/dist/ai/route.d.mts +31 -17
- package/dist/ai/route.js +35 -19
- package/dist/ai/spawn.d.mts +34 -1
- package/dist/ai/spawn.js +115 -3
- package/dist/ai/subagent-status.d.mts +2 -0
- package/dist/ai/subagent-status.js +2 -0
- package/dist/ai/tier.d.mts +1 -1
- package/dist/ai/types.d.mts +19 -2
- package/dist/ai/worktree.d.mts +1 -1
- package/dist/ai/worktree.js +3 -2
- package/dist/argv/parse.d.ts +2 -0
- package/dist/argv/parse.js +2 -0
- package/dist/bin/_internal.d.ts +1 -1
- package/dist/bin/_internal.js +1 -1
- package/dist/bin/prim.cjs +19253 -13937
- package/dist/bin/resolve.js +1 -1
- package/dist/bin/shadow.js +2 -1
- package/dist/bin/which.d.ts +28 -3
- package/dist/bin/which.js +45 -3
- package/dist/cacache/_internal.d.ts +10 -2
- package/dist/cacache/_internal.js +6 -10
- package/dist/cache/ttl/_internal.d.ts +33 -0
- package/dist/cache/ttl/_internal.js +68 -0
- package/dist/cache/ttl/browser.d.ts +56 -0
- package/dist/cache/ttl/browser.js +257 -0
- package/dist/cache/ttl/store.js +11 -34
- package/dist/cache/ttl/types.d.ts +46 -3
- package/dist/checks/primordials-defaults.d.ts +5 -5
- package/dist/checks/primordials-defaults.js +5 -5
- package/dist/checks/primordials.d.ts +1 -1
- package/dist/checks/primordials.js +25 -17
- package/dist/cli/check-primordials.d.ts +6 -1
- package/dist/cli/check-primordials.js +14 -5
- package/dist/cli/check.js +1 -1
- package/dist/cli/socket-lib.d.ts +1 -1
- package/dist/cli/socket-lib.js +3 -3
- package/dist/colors/socket-palette.d.ts +1 -1
- package/dist/compression/brotli.d.ts +6 -2
- package/dist/compression/brotli.js +5 -1
- package/dist/compression/gzip.d.ts +6 -2
- package/dist/compression/gzip.js +7 -2
- package/dist/config/layers.d.ts +53 -0
- package/dist/config/layers.js +83 -0
- package/dist/constants/agents.d.ts +3 -0
- package/dist/constants/agents.js +3 -0
- package/dist/constants/node.d.ts +14 -0
- package/dist/constants/node.js +14 -0
- package/dist/constants/package-default-node-range.js +1 -5
- package/dist/constants/packages.d.ts +5 -0
- package/dist/constants/packages.js +5 -0
- package/dist/constants/platform.d.ts +1 -1
- package/dist/constants/platform.js +1 -1
- package/dist/constants/socket.js +1 -1
- package/dist/constants/typescript.d.ts +5 -0
- package/dist/constants/typescript.js +5 -0
- package/dist/debug/_internal.d.ts +22 -7
- package/dist/debug/_internal.js +33 -15
- package/dist/debug/caller-info.js +1 -1
- package/dist/debug/namespace.js +11 -8
- package/dist/debug/output.d.ts +12 -1
- package/dist/debug/output.js +33 -16
- package/dist/dlx/binary-cache.js +1 -1
- package/dist/dlx/binary-resolution.js +8 -5
- package/dist/dlx/firewall.js +1 -1
- package/dist/dlx/lockfile.js +1 -1
- package/dist/eco/npm/npm/parse-lockfile.js +3 -2
- package/dist/eco/npm/vlt/exec.d.ts +1 -1
- package/dist/eco/npm/vlt/exec.js +1 -1
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +1 -1
- package/dist/env/agents.d.ts +6 -0
- package/dist/env/agents.js +29 -0
- package/dist/env/flags.d.ts +12 -0
- package/dist/env/flags.js +23 -0
- package/dist/env/github-status.js +2 -2
- package/dist/env/providers.d.ts +6 -0
- package/dist/env/providers.js +23 -0
- package/dist/env/proxy.js +1 -1
- package/dist/env/rewire.d.ts +37 -3
- package/dist/env/rewire.js +60 -29
- package/dist/env/runtimes.d.ts +9 -0
- package/dist/env/runtimes.js +53 -0
- package/dist/env/socket-cli.d.ts +5 -2
- package/dist/env/socket-cli.js +6 -3
- package/dist/env/xdg.d.ts +17 -0
- package/dist/env/xdg.js +21 -1
- package/dist/errors/predicates.d.ts +3 -2
- package/dist/errors/predicates.js +5 -3
- package/dist/events/exit/_internal.d.ts +1 -23
- package/dist/external/@npmcli/package-json.js +3570 -4905
- package/dist/external/@npmcli/promise-spawn.js +2 -2
- package/dist/external/@sinclair/typebox/value.js +5 -4
- package/dist/external/@socketregistry/yocto-spinner.js +3 -3
- package/dist/external/@yarnpkg/extensions.js +1 -1
- package/dist/external/adm-zip.d.ts +82 -0
- package/dist/external/adm-zip.js +2 -2
- package/dist/external/cacache.d.ts +87 -0
- package/dist/external/debug.d.ts +22 -0
- package/dist/external/debug.js +11 -4
- package/dist/external/del.d.ts +1 -0
- package/dist/external/external-pack.d.ts +12 -0
- package/dist/external/external-pack.js +42 -35
- package/dist/external/fast-glob.d.ts +8 -0
- package/dist/external/fast-sort.d.ts +1 -0
- package/dist/external/get-east-asian-width.d.ts +5 -0
- package/dist/external/get-east-asian-width.js +8 -1
- package/dist/external/has-flag.d.ts +1 -0
- package/dist/external/inquirer-pack.d.ts +18 -0
- package/dist/external/libnpmexec.d.ts +35 -0
- package/dist/external/libnpmpack.d.ts +1 -0
- package/dist/external/make-fetch-happen.d.ts +13 -0
- package/dist/external/normalize-package-data.d.ts +4 -0
- package/dist/external/npm-core.d.ts +14 -0
- package/dist/external/npm-pack.d.ts +24 -0
- package/dist/external/npm-pack.js +28934 -31885
- package/dist/external/npm-package-arg.d.ts +4 -0
- package/dist/external/p-map.js +8 -1
- package/dist/external/pacote.d.ts +15 -0
- package/dist/external/pico-pack.d.ts +16 -0
- package/dist/external/pico-pack.js +38 -23
- package/dist/external/picomatch.d.ts +96 -0
- package/dist/external/pony-cause.d.ts +14 -0
- package/dist/external/semver.d.ts +60 -0
- package/dist/external/semver.js +1459 -4
- package/dist/external/shell-quote.d.ts +51 -0
- package/dist/external/shell-quote.js +55 -15
- package/dist/external/signal-exit.d.ts +1 -0
- package/dist/external/spdx-correct.d.ts +4 -0
- package/dist/external/spdx-expression-parse.d.ts +4 -0
- package/dist/external/spdx-pack.d.ts +10 -0
- package/dist/external/std-env.d.ts +284 -0
- package/dist/external/std-env.js +323 -0
- package/dist/external/streaming-iterables.d.ts +11 -0
- package/dist/external/supports-color.d.ts +1 -0
- package/dist/external/tar-fs.d.ts +31 -0
- package/dist/external/tar-fs.js +63 -16
- package/dist/external/validate-npm-package-name.d.ts +4 -0
- package/dist/external/which.d.ts +25 -0
- package/dist/external/which.js +2 -2
- package/dist/external/yargs-parser.d.ts +2 -0
- package/dist/external/yargs-parser.js +11 -3
- package/dist/external/yoctocolors-cjs.d.ts +51 -0
- package/dist/external-tools/bazel/asset-names.d.ts +1 -1
- package/dist/external-tools/bazel/from-download.d.ts +1 -1
- package/dist/external-tools/bazel/resolve.d.ts +3 -0
- package/dist/external-tools/bazel/resolve.js +3 -0
- package/dist/external-tools/cdxgen/asset-names.d.ts +5 -5
- package/dist/external-tools/cdxgen/asset-names.js +3 -3
- package/dist/external-tools/cdxgen/from-download.d.ts +2 -2
- package/dist/external-tools/cdxgen/from-download.js +1 -1
- package/dist/external-tools/cdxgen/resolve.d.ts +4 -1
- package/dist/external-tools/cdxgen/resolve.js +4 -1
- package/dist/external-tools/cdxgen/types.d.ts +1 -1
- package/dist/external-tools/from-download.d.ts +2 -2
- package/dist/external-tools/from-download.js +1 -1
- package/dist/external-tools/janus/asset-names.d.ts +4 -1
- package/dist/external-tools/janus/asset-names.js +3 -0
- package/dist/external-tools/janus/from-download.d.ts +3 -3
- package/dist/external-tools/janus/from-download.js +2 -2
- package/dist/external-tools/janus/resolve.d.ts +3 -0
- package/dist/external-tools/janus/resolve.js +3 -0
- package/dist/external-tools/jre/asset-names.d.ts +3 -1
- package/dist/external-tools/jre/asset-names.js +2 -0
- 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/manifest.d.ts +5 -3
- package/dist/external-tools/manifest.js +5 -3
- package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
- package/dist/external-tools/opengrep/resolve.d.ts +3 -0
- package/dist/external-tools/opengrep/resolve.js +3 -0
- package/dist/external-tools/python/asset-names.d.ts +3 -1
- package/dist/external-tools/python/asset-names.js +8 -4
- package/dist/external-tools/python/pin.js +3 -1
- package/dist/external-tools/python/resolve.d.ts +3 -0
- package/dist/external-tools/python/resolve.js +3 -0
- 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/resolve.d.ts +3 -0
- package/dist/external-tools/sbt/resolve.js +3 -0
- 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 +18 -3
- package/dist/external-tools/skillspector/resolve.js +21 -8
- package/dist/external-tools/skillspector/types.d.ts +3 -1
- package/dist/external-tools/synp/resolve.d.ts +3 -0
- package/dist/external-tools/synp/resolve.js +3 -0
- package/dist/external-tools/trivy/asset-names.d.ts +1 -1
- package/dist/external-tools/trivy/resolve.d.ts +3 -0
- package/dist/external-tools/trivy/resolve.js +3 -0
- package/dist/external-tools/trufflehog/asset-names.d.ts +4 -1
- package/dist/external-tools/trufflehog/asset-names.js +3 -0
- package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
- package/dist/external-tools/trufflehog/resolve.d.ts +3 -0
- package/dist/external-tools/trufflehog/resolve.js +3 -0
- 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 +28 -0
- package/dist/external-tools/uv/resolve.js +64 -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 +55 -0
- package/dist/fleet/repo-config.js +81 -0
- package/dist/fs/_internal.d.ts +1 -1
- package/dist/fs/_internal.js +1 -1
- package/dist/fs/access.d.ts +2 -0
- package/dist/fs/access.js +2 -0
- package/dist/fs/copy.d.ts +88 -0
- package/dist/fs/copy.js +89 -0
- package/dist/fs/find.js +1 -2
- package/dist/fs/inspect.d.ts +2 -2
- package/dist/fs/read-file.js +3 -4
- package/dist/fs/safe.js +2 -2
- package/dist/git/_internal.js +7 -3
- package/dist/github/commit.d.ts +92 -0
- package/dist/github/commit.js +113 -0
- package/dist/github/ghsa.js +1 -1
- package/dist/github/refs-graphql.js +1 -1
- package/dist/github/refs.js +10 -15
- package/dist/github/request.js +1 -1
- package/dist/github/token.d.ts +5 -2
- package/dist/github/token.js +6 -4
- package/dist/github/workflow-runs.d.ts +107 -0
- package/dist/github/workflow-runs.js +98 -0
- package/dist/globs/_internal.js +1 -1
- package/dist/http-request/_internal.d.ts +1 -1
- package/dist/http-request/browser.d.ts +6 -0
- package/dist/http-request/browser.js +4 -3
- package/dist/http-request/checksum-file.js +1 -1
- package/dist/http-request/download.js +2 -0
- package/dist/http-request/headers.d.ts +1 -1
- package/dist/http-request/headers.js +2 -2
- package/dist/http-request/request-attempt.js +6 -3
- package/dist/http-request/request-types.d.ts +10 -1
- package/dist/http-request/request.js +2 -2
- package/dist/http-request/user-agent.d.ts +23 -2
- package/dist/http-request/user-agent.js +48 -6
- package/dist/integrity.d.ts +127 -78
- package/dist/integrity.js +170 -84
- package/dist/json/format.js +4 -1
- package/dist/logger/_internal.d.ts +13 -15
- package/dist/logger/_internal.js +21 -21
- package/dist/logger/colors.d.ts +10 -5
- package/dist/logger/colors.js +7 -14
- package/dist/logger/console-methods.js +2 -2
- package/dist/logger/console.d.ts +1 -0
- package/dist/logger/console.js +9 -9
- package/dist/logger/node.js +2 -1
- package/dist/logger/symbols-builder.js +7 -8
- package/dist/logger/symbols.js +8 -8
- package/dist/native-messaging/install.js +1 -1
- package/dist/native-messaging/rate-limit.d.ts +4 -1
- package/dist/native-messaging/rate-limit.js +4 -1
- package/dist/node/events.d.ts +3 -0
- package/dist/node/events.js +3 -0
- package/dist/node/fs.d.ts +1 -1
- package/dist/node/module.d.ts +73 -2
- package/dist/node/module.js +97 -12
- package/dist/node/timers-promises.d.ts +3 -0
- package/dist/node/timers-promises.js +3 -0
- package/dist/node/url.d.ts +3 -0
- package/dist/node/url.js +3 -0
- package/dist/npm/meta-cache.d.ts +183 -0
- package/dist/npm/meta-cache.js +318 -0
- package/dist/npm/meta-slice.d.ts +27 -0
- package/dist/npm/meta-slice.js +68 -0
- package/dist/npm/meta-types.d.ts +282 -0
- package/dist/npm/meta-types.js +2 -0
- package/dist/npm/meta.d.ts +125 -0
- package/dist/npm/meta.js +347 -0
- package/dist/npm/registry.d.ts +212 -0
- package/dist/npm/registry.js +284 -0
- package/dist/objects/getters.d.ts +1 -1
- package/dist/objects/getters.js +1 -1
- package/dist/objects/predicates.js +1 -1
- package/dist/packages/exports.js +2 -2
- package/dist/packages/isolation.js +1 -1
- package/dist/packages/manifest.d.ts +29 -0
- package/dist/packages/manifest.js +44 -9
- package/dist/packages/metadata-extensions.js +2 -4
- package/dist/packages/normalize.js +1 -1
- package/dist/packages/provenance.d.ts +8 -0
- package/dist/packages/provenance.js +10 -2
- package/dist/packages/specs.js +1 -1
- package/dist/packages/tarball.js +1 -2
- package/dist/packages/validation.d.ts +0 -10
- package/dist/packages/validation.js +0 -14
- 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/exts.d.ts +30 -0
- package/dist/paths/exts.js +30 -0
- package/dist/paths/filenames.d.ts +6 -0
- package/dist/paths/filenames.js +6 -0
- package/dist/paths/globs.d.ts +6 -0
- package/dist/paths/globs.js +6 -0
- package/dist/paths/normalize.js +1 -1
- package/dist/paths/predicates.js +2 -1
- package/dist/paths/resolve.js +19 -14
- package/dist/paths/socket.d.ts +81 -30
- package/dist/paths/socket.js +102 -28
- package/dist/perf/metrics.js +1 -1
- package/dist/perf/report.js +5 -3
- package/dist/pkg-ext/data.js +0 -2
- package/dist/primordials/globals.d.ts +1 -1
- package/dist/primordials/globals.js +1 -1
- package/dist/primordials/headers.d.ts +13 -1
- package/dist/primordials/headers.js +13 -1
- package/dist/primordials/process.d.ts +1 -1
- package/dist/primordials/process.js +1 -1
- package/dist/primordials/url.d.ts +18 -0
- package/dist/primordials/url.js +18 -0
- package/dist/process/spawn/child.js +3 -5
- package/dist/promises/_internal.d.ts +1 -1
- package/dist/promises/_internal.js +1 -2
- package/dist/promises/options.js +3 -3
- package/dist/regexps/spec.js +1 -1
- package/dist/releases/socket-btm-binary-naming.js +12 -1
- package/dist/schema/validate.js +1 -1
- package/dist/secrets/_internal.d.ts +1 -1
- package/dist/secrets/_internal.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 +17 -3
- package/dist/secrets/keychain.d.ts +10 -1
- package/dist/secrets/keychain.js +10 -1
- package/dist/secrets/rc.js +1 -1
- package/dist/secrets/socket-api-token.d.ts +1 -1
- package/dist/secrets/socket-api-token.js +1 -1
- package/dist/secrets/types.d.ts +1 -1
- package/dist/smol/detect.js +1 -1
- package/dist/smol/http.d.ts +2 -0
- package/dist/smol/http.js +3 -1
- package/dist/smol/https.d.ts +2 -0
- package/dist/smol/https.js +3 -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 +2 -4
- package/dist/sorts/_internal.js +1 -7
- package/dist/sorts/semver.js +2 -2
- package/dist/spinner/create-spinner-class.js +1 -1
- package/dist/spinner/format.js +2 -4
- package/dist/stdio/footer.js +8 -7
- package/dist/stdio/progress.js +1 -1
- package/dist/stdio/prompts.d.ts +8 -23
- package/dist/stdio/prompts.js +28 -52
- package/dist/strings/format.js +1 -1
- package/dist/strings/predicates.d.ts +2 -2
- package/dist/strings/search.js +2 -2
- package/dist/strings/types.d.ts +4 -0
- package/dist/strings/width.d.ts +1 -0
- package/dist/strings/width.js +17 -8
- package/dist/themes/context.d.ts +18 -3
- package/dist/themes/context.js +28 -14
- package/dist/versions/_internal.d.ts +43 -13
- package/dist/versions/_internal.js +27 -15
- package/dist/versions/compare.d.ts +16 -10
- package/dist/versions/compare.js +36 -16
- package/dist/versions/parse.js +1 -1
- package/dist/versions/range.js +3 -2
- package/dist/words/pluralize.js +4 -1
- package/llms.txt +63 -0
- package/package.json +271 -40
package/dist/debug/output.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
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_constants_runtime = require('../constants/runtime.js');
|
|
5
5
|
const require_primordials_array = require('../primordials/array.js');
|
|
6
6
|
const require_primordials_date = require('../primordials/date.js');
|
|
7
7
|
const require_primordials_reflect = require('../primordials/reflect.js');
|
|
8
8
|
const require_strings_format = require('../strings/format.js');
|
|
9
|
+
const require_logger_default = require('../logger/default.js');
|
|
9
10
|
const require_env_socket = require('../env/socket.js');
|
|
10
11
|
const require_node_util = require('../node/util.js');
|
|
11
12
|
const require_debug__internal = require('./_internal.js');
|
|
12
13
|
const require_debug_namespace = require('./namespace.js');
|
|
13
14
|
const require_spinner_default = require('../spinner/default.js');
|
|
14
15
|
const require_debug_caller_info = require('./caller-info.js');
|
|
15
|
-
let src_external_debug = require("../external/debug");
|
|
16
|
-
src_external_debug = require_runtime.__toESM(src_external_debug);
|
|
17
16
|
|
|
18
17
|
//#region src/debug/output.ts
|
|
19
18
|
/**
|
|
@@ -43,7 +42,8 @@ function debugCache(operation, key, meta) {
|
|
|
43
42
|
if (!require_env_socket.getSocketDebug()) return;
|
|
44
43
|
const prefix = `[CACHE] ${require_debug_caller_info.getCallerInfo(3) || "cache"} ${require_debug__internal.getPointingTriangle()} ${operation}: ${key}`;
|
|
45
44
|
const args = meta !== void 0 ? [prefix, meta] : [prefix];
|
|
46
|
-
|
|
45
|
+
const logger = require_logger_default.getDefaultLogger();
|
|
46
|
+
require_primordials_reflect.ReflectApply(logger.info, logger, args);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Debug output for cache operations with caller info. First argument is the
|
|
@@ -56,10 +56,11 @@ function debugCacheNs(namespacesOrOpts, operation, key, meta) {
|
|
|
56
56
|
if (!require_debug_namespace.isEnabled(namespaces)) return;
|
|
57
57
|
const prefix = `[CACHE] ${require_debug_caller_info.getCallerInfo(4) || "cache"} ${require_debug__internal.getPointingTriangle()} ${operation}: ${key}`;
|
|
58
58
|
const logArgs = meta !== void 0 ? [prefix, meta] : [prefix];
|
|
59
|
-
const spinnerInstance = options.spinner ||
|
|
59
|
+
const spinnerInstance = options.spinner || getSpinner();
|
|
60
60
|
const wasSpinning = spinnerInstance?.isSpinning;
|
|
61
61
|
spinnerInstance?.stop();
|
|
62
|
-
|
|
62
|
+
const logger = require_logger_default.getDefaultLogger();
|
|
63
|
+
require_primordials_reflect.ReflectApply(logger.info, logger, logArgs);
|
|
63
64
|
if (wasSpinning) spinnerInstance?.start();
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
@@ -81,9 +82,9 @@ function debugDirNs(namespacesOrOpts, obj, inspectOpts) {
|
|
|
81
82
|
/* c8 ignore stop */
|
|
82
83
|
const pointingTriangle = require_debug__internal.getPointingTriangle();
|
|
83
84
|
let opts = inspectOpts;
|
|
84
|
-
/* c8 ignore start */
|
|
85
|
+
/* c8 ignore start - inspectOpts fallback needs DEBUG_INSPECT_OPTIONS env */
|
|
85
86
|
if (opts === void 0) {
|
|
86
|
-
const debugOpts =
|
|
87
|
+
const debugOpts = require_debug__internal.getDebugJs().inspectOpts;
|
|
87
88
|
if (debugOpts) opts = {
|
|
88
89
|
...debugOpts,
|
|
89
90
|
showHidden: debugOpts.showHidden === null ? void 0 : debugOpts.showHidden,
|
|
@@ -91,11 +92,12 @@ function debugDirNs(namespacesOrOpts, obj, inspectOpts) {
|
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
/* c8 ignore stop */
|
|
94
|
-
const spinnerInstance = options.spinner ||
|
|
95
|
+
const spinnerInstance = options.spinner || getSpinner();
|
|
95
96
|
const wasSpinning = spinnerInstance?.isSpinning;
|
|
96
97
|
spinnerInstance?.stop();
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
const logger = require_logger_default.getDefaultLogger();
|
|
99
|
+
logger.info(`[DEBUG] ${callerName} ${pointingTriangle} object inspection:`);
|
|
100
|
+
logger.dir(obj, inspectOpts);
|
|
99
101
|
if (wasSpinning) spinnerInstance?.start();
|
|
100
102
|
}
|
|
101
103
|
/**
|
|
@@ -117,10 +119,11 @@ function debugLogNs(namespacesOrOpts, ...args) {
|
|
|
117
119
|
const pointingTriangle = require_debug__internal.getPointingTriangle();
|
|
118
120
|
const text = require_primordials_array.ArrayPrototypeAt(args, 0);
|
|
119
121
|
const logArgs = typeof text === "string" ? [require_strings_format.applyLinePrefix(`${callerName} ${pointingTriangle} ${text}`, { prefix: "[DEBUG] " }), ...require_primordials_array.ArrayPrototypeSlice(args, 1)] : [`[DEBUG] ${callerName} ${pointingTriangle}`, ...args];
|
|
120
|
-
const spinnerInstance = options.spinner ||
|
|
122
|
+
const spinnerInstance = options.spinner || getSpinner();
|
|
121
123
|
const wasSpinning = spinnerInstance?.isSpinning;
|
|
122
124
|
spinnerInstance?.stop();
|
|
123
|
-
|
|
125
|
+
const logger = require_logger_default.getDefaultLogger();
|
|
126
|
+
require_primordials_reflect.ReflectApply(logger.info, logger, logArgs);
|
|
124
127
|
if (wasSpinning) spinnerInstance?.start();
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
@@ -136,10 +139,11 @@ function debugNs(namespacesOrOpts, ...args) {
|
|
|
136
139
|
const pointingTriangle = require_debug__internal.getPointingTriangle();
|
|
137
140
|
const text = require_primordials_array.ArrayPrototypeAt(args, 0);
|
|
138
141
|
const logArgs = typeof text === "string" ? [require_strings_format.applyLinePrefix(`${name} ${pointingTriangle} ${text}`, { prefix: "[DEBUG] " }), ...require_primordials_array.ArrayPrototypeSlice(args, 1)] : args;
|
|
139
|
-
const spinnerInstance = options.spinner ||
|
|
142
|
+
const spinnerInstance = options.spinner || getSpinner();
|
|
140
143
|
const wasSpinning = spinnerInstance?.isSpinning;
|
|
141
144
|
spinnerInstance?.stop();
|
|
142
|
-
|
|
145
|
+
const logger = require_logger_default.getDefaultLogger();
|
|
146
|
+
require_primordials_reflect.ReflectApply(logger.info, logger, logArgs);
|
|
143
147
|
if (wasSpinning) spinnerInstance?.start();
|
|
144
148
|
}
|
|
145
149
|
/**
|
|
@@ -176,6 +180,18 @@ function debugtime(label) {
|
|
|
176
180
|
};
|
|
177
181
|
return impl;
|
|
178
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Resolve the default spinner on Node; off Node (browser bundles) there is no
|
|
185
|
+
* spinner — callers no-op through their optional chains. Construction is
|
|
186
|
+
* deferred to first debug write (every call site sits behind the `isEnabled`
|
|
187
|
+
* / `getSocketDebug` gates), so a browser bundle never constructs the
|
|
188
|
+
* node-bound spinner even when debug output is force-enabled.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
192
|
+
function getSpinner() {
|
|
193
|
+
return require_constants_runtime.IS_NODE ? require_spinner_default.getDefaultSpinner() : void 0;
|
|
194
|
+
}
|
|
179
195
|
|
|
180
196
|
//#endregion
|
|
181
197
|
exports.debug = debug;
|
|
@@ -187,4 +203,5 @@ exports.debugLog = debugLog;
|
|
|
187
203
|
exports.debugLogNs = debugLogNs;
|
|
188
204
|
exports.debugNs = debugNs;
|
|
189
205
|
exports.debuglog = debuglog;
|
|
190
|
-
exports.debugtime = debugtime;
|
|
206
|
+
exports.debugtime = debugtime;
|
|
207
|
+
exports.getSpinner = getSpinner;
|
package/dist/dlx/binary-cache.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_objects_predicates = require('../objects/predicates.js');
|
|
6
5
|
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
+
const require_objects_predicates = require('../objects/predicates.js');
|
|
7
7
|
const require_primordials_array = require('../primordials/array.js');
|
|
8
8
|
const require_node_fs = require('../node/fs.js');
|
|
9
9
|
const require_node_path = require('../node/path.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
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
|
-
const require_constants_platform = require('../constants/platform.js');
|
|
7
6
|
const require_primordials_object = require('../primordials/object.js');
|
|
7
|
+
const require_constants_platform = require('../constants/platform.js');
|
|
8
8
|
const require_paths_normalize = require('../paths/normalize.js');
|
|
9
9
|
const require_node_fs = require('../node/fs.js');
|
|
10
10
|
const require_node_path = require('../node/path.js');
|
|
@@ -70,10 +70,13 @@ function findBinaryPath(packageDir, packageName, binaryName) {
|
|
|
70
70
|
packageName.split("/").pop() ?? packageName,
|
|
71
71
|
packageName.replace(/^@[^/]+\//, "")
|
|
72
72
|
].filter(Boolean);
|
|
73
|
-
for (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
for (let i = 0, { length } = candidates; i < length; i += 1) {
|
|
74
|
+
const candidate = candidates[i];
|
|
75
|
+
if (candidate && binObj[candidate]) {
|
|
76
|
+
binName = candidate;
|
|
77
|
+
binPath = binObj[candidate];
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
77
80
|
}
|
|
78
81
|
if (!binPath && binKeys.length > 0) {
|
|
79
82
|
binName = binKeys[0];
|
package/dist/dlx/firewall.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_primordials_error = require('../primordials/error.js');
|
|
5
|
-
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
6
5
|
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
+
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
7
7
|
const require_primordials_promise = require('../primordials/promise.js');
|
|
8
8
|
const require_http_request_user_agent = require('../http-request/user-agent.js');
|
|
9
9
|
const require_http_request_node = require('../http-request/node.js');
|
package/dist/dlx/lockfile.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_integrity = require('../integrity.js');
|
|
6
5
|
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
+
const require_integrity = require('../integrity.js');
|
|
7
7
|
const require_node_fs = require('../node/fs.js');
|
|
8
8
|
const require_node_path = require('../node/path.js');
|
|
9
9
|
const require_primordials_date = require('../primordials/date.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_primordials_error = require('../../../primordials/error.js');
|
|
5
5
|
const require_primordials_object = require('../../../primordials/object.js');
|
|
6
|
-
const require_primordials_map_set = require('../../../primordials/map-set.js');
|
|
7
6
|
const require_primordials_string = require('../../../primordials/string.js');
|
|
7
|
+
const require_primordials_map_set = require('../../../primordials/map-set.js');
|
|
8
8
|
const require_primordials_array = require('../../../primordials/array.js');
|
|
9
9
|
const require_primordials_json = require('../../../primordials/json.js');
|
|
10
10
|
const require_errors_message = require('../../../errors/message.js');
|
|
@@ -134,7 +134,8 @@ function parseV1(data, rootDeps) {
|
|
|
134
134
|
const key = `${name}@${typeof pkg.version === "string" ? pkg.version : "0.0.0"}`;
|
|
135
135
|
if (visited.has(key)) continue;
|
|
136
136
|
if (packageIndex[name] === void 0) {
|
|
137
|
-
|
|
137
|
+
const ref = buildPackageRef(name, pkg);
|
|
138
|
+
require_primordials_array.ArrayPrototypePush(packages, ref);
|
|
138
139
|
packageIndex[name] = packages.length - 1;
|
|
139
140
|
}
|
|
140
141
|
if (pkg.dependencies && typeof pkg.dependencies === "object") {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* The dir exists so downstream code can import from a stable canonical path;
|
|
4
4
|
* populate when first concrete need arrives. vlt lockfile is `vlt-lock.json`.
|
|
5
5
|
* Reference: socket-sdxgen/src/parsers/vlt/. vlt does not support overrides,
|
|
6
|
-
* so
|
|
6
|
+
* so Socket code that needs override support should branch around it (see
|
|
7
7
|
* socket-cli/packages/cli/src/commands/optimize/ for the canonical pattern of
|
|
8
8
|
* agent-conditional logic).
|
|
9
9
|
*/
|
package/dist/eco/npm/vlt/exec.js
CHANGED
|
@@ -9,7 +9,7 @@ const require_primordials_error = require('../../../primordials/error.js');
|
|
|
9
9
|
* The dir exists so downstream code can import from a stable canonical path;
|
|
10
10
|
* populate when first concrete need arrives. vlt lockfile is `vlt-lock.json`.
|
|
11
11
|
* Reference: socket-sdxgen/src/parsers/vlt/. vlt does not support overrides,
|
|
12
|
-
* so
|
|
12
|
+
* so Socket code that needs override support should branch around it (see
|
|
13
13
|
* socket-cli/packages/cli/src/commands/optimize/ for the canonical pattern of
|
|
14
14
|
* agent-conditional logic).
|
|
15
15
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
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');
|
|
6
5
|
const require_primordials_string = require('../../../../primordials/string.js');
|
|
6
|
+
const require_primordials_math = require('../../../../primordials/math.js');
|
|
7
7
|
const require_primordials_array = require('../../../../primordials/array.js');
|
|
8
8
|
const require_smol_manifest = require('../../../../smol/manifest.js');
|
|
9
9
|
const require_eco_npm_yarnpkg_yarn_parse_yarn_descriptor = require('./parse-yarn-descriptor.js');
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file AI coding-agent detection, re-exported from std-env — not
|
|
3
|
+
* reimplemented. std-env is a devDependency, inlined by the bundler.
|
|
4
|
+
*/
|
|
5
|
+
export { agent, agentInfo, detectAgent, isAgent } from '../external/std-env';
|
|
6
|
+
export type { AgentInfo, AgentName } from '../external/std-env';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
let src_external_std_env = require("../external/std-env");
|
|
5
|
+
|
|
6
|
+
Object.defineProperty(exports, 'agent', {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return src_external_std_env.agent;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, 'agentInfo', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return src_external_std_env.agentInfo;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, 'detectAgent', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return src_external_std_env.detectAgent;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, 'isAgent', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return src_external_std_env.isAgent;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Environment flag booleans, re-exported from std-env — not
|
|
3
|
+
* reimplemented. std-env is a devDependency; the bundler inlines it, so dist
|
|
4
|
+
* carries the logic with no runtime std-env import.
|
|
5
|
+
* Only the flags socket-lib does NOT already own live here. CI, DEBUG,
|
|
6
|
+
* NODE_ENV, test, platform, and Node-version detection are handled by
|
|
7
|
+
* socket-lib's own rewire-aware getters and constants (`env/ci` `getCI`,
|
|
8
|
+
* `env/debug` `getDebug`, `env/node-env` `getNodeEnv`, `env/test` `isTest`,
|
|
9
|
+
* `constants/platform`, `constants/node`, `constants/runtime`), so std-env's
|
|
10
|
+
* overlapping flags are intentionally not re-exported.
|
|
11
|
+
*/
|
|
12
|
+
export { hasTTY, isColorSupported, isMinimal } from '../external/std-env';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
let src_external_std_env = require("../external/std-env");
|
|
5
|
+
|
|
6
|
+
Object.defineProperty(exports, 'hasTTY', {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return src_external_std_env.hasTTY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, 'isColorSupported', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return src_external_std_env.isColorSupported;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, 'isMinimal', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return src_external_std_env.isMinimal;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -13,12 +13,12 @@ const require_http_request_node = require('../http-request/node.js');
|
|
|
13
13
|
* most 8 seconds to startup (configurable timeout) and fails open on network
|
|
14
14
|
* error so a down status page never blocks a healthy workflow.
|
|
15
15
|
*/
|
|
16
|
-
const MONITORED_COMPONENT_IDS = new Map([
|
|
16
|
+
const MONITORED_COMPONENT_IDS = /* @__PURE__ */ new Map([
|
|
17
17
|
["br0l2tvcx85d", "Actions"],
|
|
18
18
|
["8l4ygp009s5s", "Git Operations"],
|
|
19
19
|
["brv1bkgrwx7q", "API Requests"]
|
|
20
20
|
]);
|
|
21
|
-
const SEVERITY = new Map([
|
|
21
|
+
const SEVERITY = /* @__PURE__ */ new Map([
|
|
22
22
|
["major_outage", 4],
|
|
23
23
|
["partial_outage", 3],
|
|
24
24
|
["degraded_performance", 2],
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file CI/host provider detection, re-exported from std-env — not
|
|
3
|
+
* reimplemented. std-env is a devDependency, inlined by the bundler.
|
|
4
|
+
*/
|
|
5
|
+
export { detectProvider, provider, providerInfo } from '../external/std-env';
|
|
6
|
+
export type { ProviderInfo, ProviderName } from '../external/std-env';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
let src_external_std_env = require("../external/std-env");
|
|
5
|
+
|
|
6
|
+
Object.defineProperty(exports, 'detectProvider', {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return src_external_std_env.detectProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, 'provider', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return src_external_std_env.provider;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, 'providerInfo', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return src_external_std_env.providerInfo;
|
|
22
|
+
}
|
|
23
|
+
});
|
package/dist/env/proxy.js
CHANGED
|
@@ -86,7 +86,7 @@ function createEnvProxy(base, overrides) {
|
|
|
86
86
|
return lookupEnvValue(prop);
|
|
87
87
|
},
|
|
88
88
|
ownKeys(_target) {
|
|
89
|
-
return [
|
|
89
|
+
return [.../* @__PURE__ */ new Set([...require_primordials_object.ObjectKeys(base), ...overrides ? require_primordials_object.ObjectKeys(overrides) : []])];
|
|
90
90
|
},
|
|
91
91
|
getOwnPropertyDescriptor(_target, prop) {
|
|
92
92
|
if (typeof prop !== "string") return;
|
package/dist/env/rewire.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* - Compatible with vi.stubEnv() - reads from process.env as final fallback
|
|
9
9
|
* - Thread-safe for concurrent test execution
|
|
10
10
|
*/
|
|
11
|
-
import type
|
|
11
|
+
import type { AsyncLocalStorage } from 'node:async_hooks';
|
|
12
|
+
import { getNodeAsyncHooks } from '../node/async-hooks';
|
|
12
13
|
export type EnvOverrides = Map<string, string | undefined>;
|
|
13
14
|
/**
|
|
14
15
|
* Clear a specific environment variable override.
|
|
@@ -25,11 +26,13 @@ export type EnvOverrides = Map<string, string | undefined>;
|
|
|
25
26
|
*/
|
|
26
27
|
export declare function clearEnv(key: string): void;
|
|
27
28
|
/**
|
|
28
|
-
* Lazily load the async_hooks module
|
|
29
|
+
* Lazily load the async_hooks module. Aliases the canonical `node/async-hooks`
|
|
30
|
+
* accessor (single owner of the bundler-safe require); kept as an export so
|
|
31
|
+
* this module's surface is unchanged.
|
|
29
32
|
*
|
|
30
33
|
* @private
|
|
31
34
|
*/
|
|
32
|
-
export declare
|
|
35
|
+
export declare const getAsyncHooks: typeof getNodeAsyncHooks;
|
|
33
36
|
/**
|
|
34
37
|
* Get an environment variable value, checking overrides first.
|
|
35
38
|
*
|
|
@@ -48,6 +51,27 @@ export declare function getAsyncHooks(): typeof asyncHooksModule;
|
|
|
48
51
|
* @internal Used by env getters to support test rewiring
|
|
49
52
|
*/
|
|
50
53
|
export declare function getEnvValue(key: string): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Get the current isolated-override map, or undefined when none is active.
|
|
56
|
+
* Off Node (browser bundles) there is no AsyncLocalStorage and no isolated
|
|
57
|
+
* context — env getters fall straight through to the other tiers.
|
|
58
|
+
*
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
export declare function getIsolatedOverrides(): EnvOverrides | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Get the process-scoped AsyncLocalStorage used for nested env overrides
|
|
64
|
+
* (withEnv/withEnvSync).
|
|
65
|
+
*
|
|
66
|
+
* Constructed LAZILY (memoized) rather than at module-eval: an
|
|
67
|
+
* AsyncLocalStorage holds a live native handle, and constructing it at import
|
|
68
|
+
* time pins that handle into every module transitively importing this leaf —
|
|
69
|
+
* aborting V8 --build-snapshot serialization. Deferring to first use keeps the
|
|
70
|
+
* single-store semantics while leaving module import snapshot-safe.
|
|
71
|
+
*
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
export declare function getIsolatedOverridesStorage(): AsyncLocalStorage<EnvOverrides>;
|
|
51
75
|
/**
|
|
52
76
|
* Check if an environment variable has been overridden.
|
|
53
77
|
*
|
|
@@ -98,6 +122,16 @@ export declare function isInEnv(key: string): boolean;
|
|
|
98
122
|
* ```
|
|
99
123
|
*/
|
|
100
124
|
export declare function resetEnv(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Read `process.env` without assuming a real Node `process`. Probes the
|
|
127
|
+
* GLOBAL `process` via `typeof` (no `node:process` import — webpack throws
|
|
128
|
+
* UnhandledSchemeError on `node:` specifiers before the `browser`-field stubs
|
|
129
|
+
* apply), so browser bundles load this leaf cleanly and env getters read as
|
|
130
|
+
* unset instead of throwing.
|
|
131
|
+
*
|
|
132
|
+
* @private
|
|
133
|
+
*/
|
|
134
|
+
export declare function safeProcessEnv(): Record<string, string | undefined> | undefined;
|
|
101
135
|
/**
|
|
102
136
|
* Set an environment variable override for testing. This does not modify
|
|
103
137
|
* process.env, only affects env getters.
|
package/dist/env/rewire.js
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
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_constants_runtime = require('../constants/runtime.js');
|
|
5
5
|
const require_primordials_object = require('../primordials/object.js');
|
|
6
6
|
const require_objects_predicates = require('../objects/predicates.js');
|
|
7
7
|
const require_env_boolean = require('./boolean.js');
|
|
8
|
+
const require_node_async_hooks = require('../node/async-hooks.js');
|
|
8
9
|
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
9
|
-
let node_process = require("node:process");
|
|
10
|
-
node_process = require_runtime.__toESM(node_process);
|
|
11
10
|
|
|
12
11
|
//#region src/env/rewire.ts
|
|
13
|
-
|
|
14
|
-
* @file Environment variable rewiring utilities for testing. Uses
|
|
15
|
-
* AsyncLocalStorage for context-isolated overrides that work with concurrent
|
|
16
|
-
* tests. Features:
|
|
17
|
-
*
|
|
18
|
-
* - Context-isolated overrides via withEnv() for advanced use cases
|
|
19
|
-
* - Test-friendly setEnv/clearEnv/resetEnv that work in beforeEach/afterEach
|
|
20
|
-
* - Compatible with vi.stubEnv() - reads from process.env as final fallback
|
|
21
|
-
* - Thread-safe for concurrent test execution
|
|
22
|
-
*/
|
|
23
|
-
let asyncHooks;
|
|
24
|
-
const { AsyncLocalStorage } = getAsyncHooks();
|
|
25
|
-
const isolatedOverridesStorage = new AsyncLocalStorage();
|
|
12
|
+
let isolatedOverridesStorage;
|
|
26
13
|
const sharedOverridesSymbol = Symbol.for("@socketsecurity/lib/env/rewire/test-overrides");
|
|
27
14
|
const globalThisRef = globalThis;
|
|
28
|
-
if (require_env_boolean.envAsBoolean(
|
|
15
|
+
if (require_env_boolean.envAsBoolean(safeProcessEnv()?.["VITEST"]) && !globalThisRef[sharedOverridesSymbol]) globalThisRef[sharedOverridesSymbol] = new require_primordials_map_set.MapCtor();
|
|
29
16
|
const sharedOverrides = globalThisRef[sharedOverridesSymbol];
|
|
30
17
|
/**
|
|
31
18
|
* Clear a specific environment variable override.
|
|
@@ -44,14 +31,13 @@ function clearEnv(key) {
|
|
|
44
31
|
sharedOverrides?.delete(key);
|
|
45
32
|
}
|
|
46
33
|
/**
|
|
47
|
-
* Lazily load the async_hooks module
|
|
34
|
+
* Lazily load the async_hooks module. Aliases the canonical `node/async-hooks`
|
|
35
|
+
* accessor (single owner of the bundler-safe require); kept as an export so
|
|
36
|
+
* this module's surface is unchanged.
|
|
48
37
|
*
|
|
49
38
|
* @private
|
|
50
39
|
*/
|
|
51
|
-
|
|
52
|
-
if (asyncHooks === void 0) asyncHooks = /*@__PURE__*/ require("node:async_hooks");
|
|
53
|
-
return asyncHooks;
|
|
54
|
-
}
|
|
40
|
+
const getAsyncHooks = require_node_async_hooks.getNodeAsyncHooks;
|
|
55
41
|
/**
|
|
56
42
|
* Get an environment variable value, checking overrides first.
|
|
57
43
|
*
|
|
@@ -70,10 +56,39 @@ function getAsyncHooks() {
|
|
|
70
56
|
* @internal Used by env getters to support test rewiring
|
|
71
57
|
*/
|
|
72
58
|
function getEnvValue(key) {
|
|
73
|
-
const isolatedOverrides =
|
|
59
|
+
const isolatedOverrides = getIsolatedOverrides();
|
|
74
60
|
if (isolatedOverrides?.has(key)) return isolatedOverrides.get(key);
|
|
75
61
|
if (sharedOverrides?.has(key)) return sharedOverrides.get(key);
|
|
76
|
-
return
|
|
62
|
+
return safeProcessEnv()?.[key];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the current isolated-override map, or undefined when none is active.
|
|
66
|
+
* Off Node (browser bundles) there is no AsyncLocalStorage and no isolated
|
|
67
|
+
* context — env getters fall straight through to the other tiers.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
function getIsolatedOverrides() {
|
|
72
|
+
return require_constants_runtime.IS_NODE ? getIsolatedOverridesStorage().getStore() : void 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the process-scoped AsyncLocalStorage used for nested env overrides
|
|
76
|
+
* (withEnv/withEnvSync).
|
|
77
|
+
*
|
|
78
|
+
* Constructed LAZILY (memoized) rather than at module-eval: an
|
|
79
|
+
* AsyncLocalStorage holds a live native handle, and constructing it at import
|
|
80
|
+
* time pins that handle into every module transitively importing this leaf —
|
|
81
|
+
* aborting V8 --build-snapshot serialization. Deferring to first use keeps the
|
|
82
|
+
* single-store semantics while leaving module import snapshot-safe.
|
|
83
|
+
*
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
function getIsolatedOverridesStorage() {
|
|
87
|
+
if (isolatedOverridesStorage === void 0) {
|
|
88
|
+
const { AsyncLocalStorage } = require_node_async_hooks.getNodeAsyncHooks();
|
|
89
|
+
isolatedOverridesStorage = new AsyncLocalStorage();
|
|
90
|
+
}
|
|
91
|
+
return isolatedOverridesStorage;
|
|
77
92
|
}
|
|
78
93
|
/**
|
|
79
94
|
* Check if an environment variable has been overridden.
|
|
@@ -92,7 +107,7 @@ function getEnvValue(key) {
|
|
|
92
107
|
* @returns `true` if the variable has been overridden, `false` otherwise
|
|
93
108
|
*/
|
|
94
109
|
function hasOverride(key) {
|
|
95
|
-
return !!(
|
|
110
|
+
return !!(getIsolatedOverrides()?.has(key) || sharedOverrides?.has(key));
|
|
96
111
|
}
|
|
97
112
|
/**
|
|
98
113
|
* Check if an environment variable exists (has a key), checking overrides
|
|
@@ -113,9 +128,10 @@ function hasOverride(key) {
|
|
|
113
128
|
* @internal Used by env getters to check for key presence (not value truthiness)
|
|
114
129
|
*/
|
|
115
130
|
function isInEnv(key) {
|
|
116
|
-
if (
|
|
131
|
+
if (getIsolatedOverrides()?.has(key)) return true;
|
|
117
132
|
if (sharedOverrides?.has(key)) return true;
|
|
118
|
-
|
|
133
|
+
const env = safeProcessEnv();
|
|
134
|
+
return env ? require_objects_predicates.hasOwn(env, key) : false;
|
|
119
135
|
}
|
|
120
136
|
/**
|
|
121
137
|
* Clear all environment variable overrides. Useful in afterEach hooks to ensure
|
|
@@ -134,6 +150,18 @@ function resetEnv() {
|
|
|
134
150
|
sharedOverrides?.clear();
|
|
135
151
|
}
|
|
136
152
|
/**
|
|
153
|
+
* Read `process.env` without assuming a real Node `process`. Probes the
|
|
154
|
+
* GLOBAL `process` via `typeof` (no `node:process` import — webpack throws
|
|
155
|
+
* UnhandledSchemeError on `node:` specifiers before the `browser`-field stubs
|
|
156
|
+
* apply), so browser bundles load this leaf cleanly and env getters read as
|
|
157
|
+
* unset instead of throwing.
|
|
158
|
+
*
|
|
159
|
+
* @private
|
|
160
|
+
*/
|
|
161
|
+
function safeProcessEnv() {
|
|
162
|
+
return typeof process !== "undefined" && process ? process.env : void 0;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
137
165
|
* Set an environment variable override for testing. This does not modify
|
|
138
166
|
* process.env, only affects env getters.
|
|
139
167
|
*
|
|
@@ -194,7 +222,7 @@ function setEnv(key, value) {
|
|
|
194
222
|
*/
|
|
195
223
|
async function withEnv(overrides, fn) {
|
|
196
224
|
const map = new require_primordials_map_set.MapCtor(require_primordials_object.ObjectEntries(overrides));
|
|
197
|
-
return await
|
|
225
|
+
return await getIsolatedOverridesStorage().run(map, fn);
|
|
198
226
|
}
|
|
199
227
|
/**
|
|
200
228
|
* Synchronous version of withEnv for non-async code.
|
|
@@ -212,16 +240,19 @@ async function withEnv(overrides, fn) {
|
|
|
212
240
|
*/
|
|
213
241
|
function withEnvSync(overrides, fn) {
|
|
214
242
|
const map = new require_primordials_map_set.MapCtor(require_primordials_object.ObjectEntries(overrides));
|
|
215
|
-
return
|
|
243
|
+
return getIsolatedOverridesStorage().run(map, fn);
|
|
216
244
|
}
|
|
217
245
|
|
|
218
246
|
//#endregion
|
|
219
247
|
exports.clearEnv = clearEnv;
|
|
220
248
|
exports.getAsyncHooks = getAsyncHooks;
|
|
221
249
|
exports.getEnvValue = getEnvValue;
|
|
250
|
+
exports.getIsolatedOverrides = getIsolatedOverrides;
|
|
251
|
+
exports.getIsolatedOverridesStorage = getIsolatedOverridesStorage;
|
|
222
252
|
exports.hasOverride = hasOverride;
|
|
223
253
|
exports.isInEnv = isInEnv;
|
|
224
254
|
exports.resetEnv = resetEnv;
|
|
255
|
+
exports.safeProcessEnv = safeProcessEnv;
|
|
225
256
|
exports.setEnv = setEnv;
|
|
226
257
|
exports.withEnv = withEnv;
|
|
227
258
|
exports.withEnvSync = withEnvSync;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file JS runtime detection, re-exported from std-env — not reimplemented.
|
|
3
|
+
* std-env is a devDependency, inlined by the bundler.
|
|
4
|
+
* `isNode` is omitted: socket-lib's `constants/runtime` `IS_NODE` (a
|
|
5
|
+
* typeof-safe global probe) already owns Node detection. The edge/alt-runtime
|
|
6
|
+
* flags below have no socket-lib equivalent.
|
|
7
|
+
*/
|
|
8
|
+
export { isBun, isDeno, isEdgeLight, isFastly, isNetlify, isWorkerd, runtime, runtimeInfo, } from '../external/std-env';
|
|
9
|
+
export type { RuntimeInfo, RuntimeName } from '../external/std-env';
|