@socketsecurity/lib 6.0.5 → 6.0.6
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 +18 -0
- package/dist/ai/discover.js +3 -2
- package/dist/ai/spawn.js +8 -5
- package/dist/ai/worktree.js +11 -6
- package/dist/ansi/strip.js +2 -2
- package/dist/archives/_internal.js +4 -4
- package/dist/archives/zip.js +1 -1
- package/dist/arrays/_internal.js +2 -2
- package/dist/arrays/chunk.js +1 -1
- package/dist/arrays/join.js +2 -2
- package/dist/arrays/unique.js +1 -1
- package/dist/bin/acorn-bindgen.cjs +769 -0
- package/dist/bin/acorn.wasm +0 -0
- package/dist/bin/check-primordials.js +3 -2
- package/dist/bin/check.js +3 -2
- package/dist/bin/exec.js +1 -1
- package/dist/bin/prim.cjs +39064 -0
- package/dist/bin/resolve.js +1 -1
- package/dist/colors/socket-palette.js +2 -2
- package/dist/compression/_internal.js +3 -2
- package/dist/compression/brotli.js +5 -12
- package/dist/compression/gzip.js +5 -13
- package/dist/constants/agents.js +4 -4
- package/dist/constants/packages.js +6 -6
- package/dist/constants/socket.js +1 -1
- package/dist/crypto/hash.js +2 -2
- package/dist/debug/_internal.js +2 -2
- package/dist/debug/caller-info.js +1 -1
- package/dist/debug/namespace.js +5 -5
- package/dist/debug/output.js +3 -3
- package/dist/dlx/binary-download.js +3 -2
- package/dist/eco/npm/npm/flags.js +5 -5
- package/dist/eco/npm/pnpm/flags.js +3 -3
- package/dist/env/boolean.js +1 -1
- package/dist/env/ci.js +1 -1
- package/dist/env/debug.js +1 -1
- package/dist/env/github.js +8 -8
- package/dist/env/home.js +1 -1
- package/dist/env/locale.js +3 -3
- package/dist/env/node-auth-token.js +1 -1
- package/dist/env/node-env.js +1 -1
- package/dist/env/npm.js +5 -5
- package/dist/env/number.js +1 -1
- package/dist/env/package-manager.js +3 -3
- package/dist/env/path.js +1 -1
- package/dist/env/pre-commit.js +1 -1
- package/dist/env/rewire.js +2 -2
- package/dist/env/shell.js +1 -1
- package/dist/env/socket-cli.js +13 -13
- package/dist/env/socket.js +33 -32
- package/dist/env/string.js +1 -1
- package/dist/env/temp-dir.js +3 -3
- package/dist/env/term.js +1 -1
- package/dist/env/test.js +3 -3
- package/dist/env/windows.js +4 -4
- package/dist/env/xdg.js +3 -3
- package/dist/events/exit/_internal.js +5 -5
- package/dist/events/exit/handler.js +1 -1
- package/dist/events/exit/intercept.js +2 -2
- package/dist/events/exit/lifecycle.js +3 -3
- package/dist/events/exit/signals.js +1 -1
- package/dist/external/@sinclair/typebox/value.js +5 -1
- package/dist/external/@sinclair/typebox.js +5 -1
- package/dist/external/@socketregistry/packageurl-js.js +27 -0
- package/dist/external-tools/bazel/resolve.js +2 -1
- package/dist/external-tools/cdxgen/resolve.js +2 -1
- package/dist/external-tools/from-pip-venv.d.ts +73 -0
- package/dist/external-tools/from-pip-venv.js +98 -0
- package/dist/external-tools/janus/asset-names.js +1 -1
- package/dist/external-tools/janus/from-download.js +3 -5
- package/dist/external-tools/janus/resolve.js +2 -1
- package/dist/external-tools/jre/from-download.js +2 -1
- package/dist/external-tools/jre/resolve.js +2 -1
- package/dist/external-tools/manifest.js +7 -5
- package/dist/external-tools/opengrep/resolve.js +2 -1
- package/dist/external-tools/sbt/resolve.js +2 -1
- package/dist/external-tools/skillspector/from-dlx.d.ts +24 -0
- package/dist/external-tools/skillspector/from-dlx.js +41 -0
- package/dist/external-tools/skillspector/from-path.d.ts +8 -0
- package/dist/external-tools/skillspector/from-path.js +32 -0
- package/dist/external-tools/skillspector/from-vfs.d.ts +8 -0
- package/dist/external-tools/skillspector/from-vfs.js +27 -0
- package/dist/external-tools/skillspector/resolve.d.ts +34 -0
- package/dist/external-tools/skillspector/resolve.js +53 -0
- package/dist/external-tools/skillspector/types.d.ts +24 -0
- package/dist/external-tools/skillspector/types.js +2 -0
- package/dist/external-tools/synp/resolve.js +2 -1
- package/dist/external-tools/trivy/resolve.js +2 -1
- package/dist/external-tools/trufflehog/resolve.js +2 -1
- package/dist/external-tools/uv/resolve.js +2 -1
- package/dist/fs/access.js +4 -4
- package/dist/fs/encoding.js +2 -2
- package/dist/fs/find-up.js +2 -2
- package/dist/fs/inspect.js +6 -6
- package/dist/fs/read-dir.js +3 -3
- package/dist/fs/read-file.js +6 -6
- package/dist/fs/read-json.js +2 -2
- package/dist/fs/safe.js +2 -2
- package/dist/fs/unique.js +1 -1
- package/dist/fs/validate.js +1 -1
- package/dist/fs/write-json.js +1 -1
- package/dist/git/_internal.js +2 -1
- package/dist/globs/_internal.js +4 -4
- package/dist/globs/match.js +4 -3
- package/dist/globs/matcher.js +2 -2
- package/dist/globs/stream.js +1 -1
- package/dist/http-request/browser.js +17 -11
- package/dist/http-request/download.js +1 -1
- package/dist/http-request/headers.d.ts +32 -3
- package/dist/http-request/headers.js +42 -13
- package/dist/http-request/request-attempt.js +1 -0
- package/dist/http-request/request-types.d.ts +5 -0
- package/dist/http-request/request.js +32 -15
- package/dist/http-request/response-reader.d.ts +12 -1
- package/dist/http-request/response-reader.js +22 -2
- package/dist/http-request/user-agent.js +1 -1
- package/dist/json/edit.js +1 -1
- package/dist/json/parse.js +4 -4
- package/dist/logger/colors.js +2 -2
- package/dist/logger/console.js +1 -1
- package/dist/logger/symbols.js +1 -1
- package/dist/node/async-hooks.js +2 -2
- package/dist/node/child-process.js +2 -2
- package/dist/node/crypto.js +2 -2
- package/dist/node/events.js +2 -2
- package/dist/node/fs-promises.js +2 -2
- package/dist/node/fs.js +2 -2
- package/dist/node/http.js +2 -2
- package/dist/node/https.js +2 -2
- package/dist/node/module.js +3 -3
- package/dist/node/os.js +2 -2
- package/dist/node/path.js +2 -2
- package/dist/node/timers-promises.js +2 -2
- package/dist/node/url.js +2 -2
- package/dist/node/util.js +2 -2
- package/dist/objects/getters.js +2 -2
- package/dist/objects/inspect.js +3 -3
- package/dist/objects/mutate.js +1 -1
- package/dist/objects/predicates.js +4 -4
- package/dist/objects/sort.js +4 -4
- package/dist/packages/edit-class.js +1 -1
- package/dist/packages/edit.js +2 -2
- package/dist/packages/exports.js +6 -6
- package/dist/packages/licenses.js +8 -8
- package/dist/packages/manifest.js +3 -3
- package/dist/packages/normalize.js +4 -4
- package/dist/packages/operations.js +11 -11
- package/dist/packages/provenance.d.ts +6 -0
- package/dist/packages/provenance.js +12 -3
- package/dist/packages/specs.js +5 -5
- package/dist/packages/validation.js +3 -3
- package/dist/paths/_internal.js +3 -3
- package/dist/paths/conversion.js +4 -4
- package/dist/paths/normalize.js +3 -1
- package/dist/paths/packages.js +3 -3
- package/dist/paths/predicates.js +7 -7
- package/dist/paths/resolve.js +3 -3
- package/dist/process/spawn/_internal.js +3 -3
- package/dist/process/spawn/errors.js +2 -2
- package/dist/process/spawn/stdio.js +1 -1
- package/dist/promises/_internal.js +1 -1
- package/dist/promises/iterate.js +5 -5
- package/dist/promises/options.js +3 -3
- package/dist/promises/retry.js +1 -1
- package/dist/secrets/_internal.js +3 -2
- package/dist/secrets/keychain.js +5 -4
- package/dist/secrets/linux.js +6 -4
- package/dist/secrets/macos.js +5 -3
- package/dist/secrets/rc.js +9 -6
- package/dist/secrets/windows.js +7 -4
- package/dist/shell/parse.d.ts +108 -1
- package/dist/shell/parse.js +168 -2
- 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.js +4 -4
- package/dist/sorts/natural.js +3 -3
- package/dist/sorts/semver.js +1 -1
- package/dist/sorts/strings.js +1 -1
- package/dist/spinner/default.js +1 -1
- package/dist/spinner/spinner.js +1 -1
- package/dist/ssri/convert.js +2 -2
- package/dist/ssri/parse.js +1 -1
- package/dist/ssri/validate.js +2 -2
- package/dist/stdio/prompts.js +1 -1
- package/dist/streams/parallel.js +2 -2
- package/dist/streams/transform.js +1 -1
- package/dist/strings/format.js +4 -4
- package/dist/strings/predicates.js +2 -2
- package/dist/strings/search.js +1 -1
- package/dist/strings/transform.js +3 -3
- package/dist/strings/width.js +2 -2
- package/dist/temporal/instant.js +4 -2
- package/dist/temporal/slots.js +3 -2
- package/dist/themes/context.js +2 -2
- package/dist/url/parse.js +2 -2
- package/dist/url/predicates.js +1 -1
- package/dist/url/search-params.js +6 -6
- package/dist/words/article.js +1 -1
- package/dist/words/capitalize.js +1 -1
- package/dist/words/pluralize.d.ts +24 -2
- package/dist/words/pluralize.js +37 -2
- package/dist/words/types.d.ts +25 -2
- package/package.json +44 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_smol_vfs = require('../../smol/vfs.js');
|
|
5
|
+
|
|
6
|
+
//#region src/external-tools/skillspector/from-vfs.ts
|
|
7
|
+
/**
|
|
8
|
+
* @file `skillspectorFromVfs()` — extracts SkillSpector from the smol Node VFS
|
|
9
|
+
* if it's bundled. Returns `undefined` when the binary doesn't carry
|
|
10
|
+
* skillspector.
|
|
11
|
+
*/
|
|
12
|
+
const SKILLSPECTOR_VFS_KEY = "skillspector";
|
|
13
|
+
async function skillspectorFromVfs() {
|
|
14
|
+
const vfs = /* @__PURE__ */ require_smol_vfs.getSmolVfs();
|
|
15
|
+
if (!vfs) return;
|
|
16
|
+
/* c8 ignore start - smol Node binary only. */
|
|
17
|
+
if (!vfs.has("skillspector")) return;
|
|
18
|
+
return {
|
|
19
|
+
path: await vfs.extract(SKILLSPECTOR_VFS_KEY),
|
|
20
|
+
source: "vfs"
|
|
21
|
+
};
|
|
22
|
+
/* c8 ignore stop */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.SKILLSPECTOR_VFS_KEY = SKILLSPECTOR_VFS_KEY;
|
|
27
|
+
exports.skillspectorFromVfs = skillspectorFromVfs;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `resolveSkillSpector()` — SkillSpector resolution entry point. Tries
|
|
3
|
+
* each source in order:
|
|
4
|
+
*
|
|
5
|
+
* 1. VFS — smol binary's embedded skillspector (if packed)
|
|
6
|
+
* 2. PATH — `which skillspector` (pipx-installed binaries land here too; the
|
|
7
|
+
* source field distinguishes `'pipx'` vs `'path'`)
|
|
8
|
+
* 3. DLX-venv — `~/.socket/_dlx/skillspector/<sha>/` with the pinned SHA Returns
|
|
9
|
+
* `undefined` when all enabled sources miss. Memoized per
|
|
10
|
+
* sha+cacheDir+localOnly tuple.
|
|
11
|
+
*/
|
|
12
|
+
import type { ResolvedSkillSpector } from './types';
|
|
13
|
+
export interface ResolveSkillSpectorOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Tier-3 install spec — the pinned upstream SHA. Required when `localOnly` is
|
|
16
|
+
* unset (without a SHA, the DLX tier can't run).
|
|
17
|
+
*/
|
|
18
|
+
readonly sha?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Tier-3 cache override. Defaults to `~/.socket/_dlx/skillspector/<sha>`.
|
|
21
|
+
*/
|
|
22
|
+
readonly cacheDir?: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* When true, only the VFS + PATH tiers run. Use for check-mode invocations
|
|
25
|
+
* that want to fail-fast if the tool isn't already installed.
|
|
26
|
+
*/
|
|
27
|
+
readonly localOnly?: boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
export declare function cacheKey(opts: ResolveSkillSpectorOptions): string;
|
|
30
|
+
export declare function doResolveSkillSpector(opts: ResolveSkillSpectorOptions): Promise<ResolvedSkillSpector | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Memoizing wrapper around {@link doResolveSkillSpector}.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveSkillSpector(opts?: ResolveSkillSpectorOptions): Promise<ResolvedSkillSpector | undefined>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_map_set = require('../../primordials/map-set.js');
|
|
5
|
+
const require_external_tools_skillspector_from_dlx = require('./from-dlx.js');
|
|
6
|
+
const require_external_tools_skillspector_from_path = require('./from-path.js');
|
|
7
|
+
const require_external_tools_skillspector_from_vfs = require('./from-vfs.js');
|
|
8
|
+
|
|
9
|
+
//#region src/external-tools/skillspector/resolve.ts
|
|
10
|
+
/**
|
|
11
|
+
* @file `resolveSkillSpector()` — SkillSpector resolution entry point. Tries
|
|
12
|
+
* each source in order:
|
|
13
|
+
*
|
|
14
|
+
* 1. VFS — smol binary's embedded skillspector (if packed)
|
|
15
|
+
* 2. PATH — `which skillspector` (pipx-installed binaries land here too; the
|
|
16
|
+
* source field distinguishes `'pipx'` vs `'path'`)
|
|
17
|
+
* 3. DLX-venv — `~/.socket/_dlx/skillspector/<sha>/` with the pinned SHA Returns
|
|
18
|
+
* `undefined` when all enabled sources miss. Memoized per
|
|
19
|
+
* sha+cacheDir+localOnly tuple.
|
|
20
|
+
*/
|
|
21
|
+
const resolutionCache = new require_primordials_map_set.MapCtor();
|
|
22
|
+
function cacheKey(opts) {
|
|
23
|
+
return `${opts.sha ?? ""}|${opts.cacheDir ?? ""}|${opts.localOnly ? "local" : "full"}`;
|
|
24
|
+
}
|
|
25
|
+
async function doResolveSkillSpector(opts) {
|
|
26
|
+
const fromVfs = await require_external_tools_skillspector_from_vfs.skillspectorFromVfs();
|
|
27
|
+
/* c8 ignore start - smol Node binary only. */
|
|
28
|
+
if (fromVfs) return fromVfs;
|
|
29
|
+
/* c8 ignore stop */
|
|
30
|
+
const fromPath = await require_external_tools_skillspector_from_path.skillspectorFromPath();
|
|
31
|
+
if (fromPath) return fromPath;
|
|
32
|
+
if (opts.localOnly || !opts.sha) return;
|
|
33
|
+
return require_external_tools_skillspector_from_dlx.skillspectorFromDlx({
|
|
34
|
+
sha: opts.sha,
|
|
35
|
+
cacheDir: opts.cacheDir
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Memoizing wrapper around {@link doResolveSkillSpector}.
|
|
40
|
+
*/
|
|
41
|
+
async function resolveSkillSpector(opts = {}) {
|
|
42
|
+
const key = cacheKey(opts);
|
|
43
|
+
const existing = resolutionCache.get(key);
|
|
44
|
+
if (existing) return existing;
|
|
45
|
+
const promise = doResolveSkillSpector(opts);
|
|
46
|
+
resolutionCache.set(key, promise);
|
|
47
|
+
return promise;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.cacheKey = cacheKey;
|
|
52
|
+
exports.doResolveSkillSpector = doResolveSkillSpector;
|
|
53
|
+
exports.resolveSkillSpector = resolveSkillSpector;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Shared types for SkillSpector resolution. SkillSpector is NVIDIA's
|
|
3
|
+
* third-party-skill scanner (sibling to AgentShield); pinned to a git SHA
|
|
4
|
+
* because upstream has no PyPI release or GH tags as of 2026-06-01.
|
|
5
|
+
*/
|
|
6
|
+
export type SkillSpectorSource = 'vfs' | 'pipx' | 'path' | 'dlx';
|
|
7
|
+
/**
|
|
8
|
+
* A resolved SkillSpector installation.
|
|
9
|
+
*/
|
|
10
|
+
export interface ResolvedSkillSpector {
|
|
11
|
+
/**
|
|
12
|
+
* Absolute path to the `skillspector` entry-point executable.
|
|
13
|
+
*/
|
|
14
|
+
readonly path: string;
|
|
15
|
+
/**
|
|
16
|
+
* Which resolver tier found this.
|
|
17
|
+
*
|
|
18
|
+
* - 'vfs' — extracted from the SEA binary's VFS
|
|
19
|
+
* - 'pipx' — `which skillspector` returned a pipx-installed venv binary
|
|
20
|
+
* - 'path' — `which skillspector` returned a non-pipx binary on PATH
|
|
21
|
+
* - 'dlx' — created a venv under ~/.socket/_dlx/skillspector/<sha>/
|
|
22
|
+
*/
|
|
23
|
+
readonly source: SkillSpectorSource;
|
|
24
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_map_set = require('../../primordials/map-set.js');
|
|
4
5
|
const require_external_tools_synp_from_download = require('./from-download.js');
|
|
5
6
|
const require_external_tools_synp_from_path = require('./from-path.js');
|
|
6
7
|
const require_external_tools_synp_from_vfs = require('./from-vfs.js');
|
|
@@ -16,7 +17,7 @@ const require_external_tools_synp_from_vfs = require('./from-vfs.js');
|
|
|
16
17
|
* passed) Returns `undefined` if all of the enabled sources miss. Memoized
|
|
17
18
|
* per option-shape.
|
|
18
19
|
*/
|
|
19
|
-
const resolutionCache =
|
|
20
|
+
const resolutionCache = new require_primordials_map_set.MapCtor();
|
|
20
21
|
function cacheKey(opts) {
|
|
21
22
|
if (!opts?.downloadIfMissing) return "local-only";
|
|
22
23
|
const { integrity, version } = opts.downloadIfMissing;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_map_set = require('../../primordials/map-set.js');
|
|
4
5
|
const require_external_tools_trivy_from_download = require('./from-download.js');
|
|
5
6
|
const require_external_tools_trivy_from_path = require('./from-path.js');
|
|
6
7
|
const require_external_tools_trivy_from_vfs = require('./from-vfs.js');
|
|
@@ -16,7 +17,7 @@ const require_external_tools_trivy_from_vfs = require('./from-vfs.js');
|
|
|
16
17
|
* is passed) Returns `undefined` if all of the enabled sources miss.
|
|
17
18
|
* Memoized per option-shape.
|
|
18
19
|
*/
|
|
19
|
-
const resolutionCache =
|
|
20
|
+
const resolutionCache = new require_primordials_map_set.MapCtor();
|
|
20
21
|
function cacheKey(opts) {
|
|
21
22
|
if (!opts?.downloadIfMissing) return "local-only";
|
|
22
23
|
const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_map_set = require('../../primordials/map-set.js');
|
|
4
5
|
const require_external_tools_trufflehog_from_download = require('./from-download.js');
|
|
5
6
|
const require_external_tools_trufflehog_from_path = require('./from-path.js');
|
|
6
7
|
const require_external_tools_trufflehog_from_vfs = require('./from-vfs.js');
|
|
@@ -16,7 +17,7 @@ const require_external_tools_trufflehog_from_vfs = require('./from-vfs.js');
|
|
|
16
17
|
* passed) Returns `undefined` if all of the enabled sources miss. Memoized
|
|
17
18
|
* per option-shape; same caching semantics as `resolveJre()`.
|
|
18
19
|
*/
|
|
19
|
-
const resolutionCache =
|
|
20
|
+
const resolutionCache = new require_primordials_map_set.MapCtor();
|
|
20
21
|
function cacheKey(opts) {
|
|
21
22
|
if (!opts?.downloadIfMissing) return "local-only";
|
|
22
23
|
const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_map_set = require('../../primordials/map-set.js');
|
|
4
5
|
const require_external_tools_uv_from_download = require('./from-download.js');
|
|
5
6
|
const require_external_tools_uv_from_path = require('./from-path.js');
|
|
6
7
|
const require_external_tools_uv_from_vfs = require('./from-vfs.js');
|
|
@@ -15,7 +16,7 @@ const require_external_tools_uv_from_vfs = require('./from-vfs.js');
|
|
|
15
16
|
* is passed) Returns `undefined` if all of the enabled sources miss.
|
|
16
17
|
* Memoized per option-shape.
|
|
17
18
|
*/
|
|
18
|
-
const resolutionCache =
|
|
19
|
+
const resolutionCache = new require_primordials_map_set.MapCtor();
|
|
19
20
|
function cacheKey(opts) {
|
|
20
21
|
if (!opts?.downloadIfMissing) return "local-only";
|
|
21
22
|
const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
|
package/dist/fs/access.js
CHANGED
|
@@ -23,7 +23,7 @@ const require_smol_path = require('../smol/path.js');
|
|
|
23
23
|
*
|
|
24
24
|
* @returns True if the access check succeeds.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
27
27
|
function canAccess(path, mode) {
|
|
28
28
|
/* c8 ignore start - native access arm only on socket-btm smol binaries; getSmolPath() is undefined on stock Node. */
|
|
29
29
|
const smolAccess = (/* @__PURE__ */ require_smol_path.getSmolPath())?.access;
|
|
@@ -40,21 +40,21 @@ function canAccess(path, mode) {
|
|
|
40
40
|
/**
|
|
41
41
|
* Can the process execute `path`? (`X_OK`)
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
44
44
|
function canExecute(path) {
|
|
45
45
|
return /* @__PURE__ */ canAccess(path, (/* @__PURE__ */ require_node_fs.getNodeFs()).constants.X_OK);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Can the process read `path`? (`R_OK`)
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
51
51
|
function canRead(path) {
|
|
52
52
|
return /* @__PURE__ */ canAccess(path, (/* @__PURE__ */ require_node_fs.getNodeFs()).constants.R_OK);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Can the process write `path`? (`W_OK`)
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
58
58
|
function canWrite(path) {
|
|
59
59
|
return /* @__PURE__ */ canAccess(path, (/* @__PURE__ */ require_node_fs.getNodeFs()).constants.W_OK);
|
|
60
60
|
}
|
package/dist/fs/encoding.js
CHANGED
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://github.com/nodejs/node/blob/ae62b36d442b7bf987e85ae6e0df0f02cc1bb17f/lib/internal/util.js#L247-L310
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
27
27
|
function normalizeEncoding(enc) {
|
|
28
28
|
return enc == null || enc === "utf8" || enc === "utf-8" ? "utf8" : /* @__PURE__ */ normalizeEncodingSlow(enc);
|
|
29
29
|
}
|
|
@@ -46,7 +46,7 @@ function normalizeEncoding(enc) {
|
|
|
46
46
|
*
|
|
47
47
|
* @see https://github.com/nodejs/node/blob/ae62b36d442b7bf987e85ae6e0df0f02cc1bb17f/lib/internal/util.js#L247-L310
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
50
50
|
function normalizeEncodingSlow(enc) {
|
|
51
51
|
const { length } = enc;
|
|
52
52
|
if (length === 4) {
|
package/dist/fs/find-up.js
CHANGED
|
@@ -43,7 +43,7 @@ const abortSignal = require_process_abort.getAbortSignal();
|
|
|
43
43
|
*
|
|
44
44
|
* @returns Normalized absolute path if found, undefined otherwise
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
47
47
|
async function findUp(name, options) {
|
|
48
48
|
const { cwd = node_process.default.cwd(), signal = abortSignal } = {
|
|
49
49
|
__proto__: null,
|
|
@@ -94,7 +94,7 @@ async function findUp(name, options) {
|
|
|
94
94
|
*
|
|
95
95
|
* @returns Normalized absolute path if found, undefined otherwise
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
98
98
|
function findUpSync(name, options) {
|
|
99
99
|
const { cwd = node_process.default.cwd(), stopAt } = {
|
|
100
100
|
__proto__: null,
|
package/dist/fs/inspect.js
CHANGED
|
@@ -29,7 +29,7 @@ const require_globs_matcher = require('../globs/matcher.js');
|
|
|
29
29
|
*
|
|
30
30
|
* @returns `true` if path is a directory, `false` otherwise
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
33
33
|
async function isDir(filepath) {
|
|
34
34
|
return !!(await /* @__PURE__ */ safeStat(filepath))?.isDirectory();
|
|
35
35
|
}
|
|
@@ -52,7 +52,7 @@ async function isDir(filepath) {
|
|
|
52
52
|
*
|
|
53
53
|
* @returns `true` if directory is empty (or doesn't exist), `false` otherwise
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
56
56
|
function isDirEmptySync(dirname, options) {
|
|
57
57
|
const { ignore = require_globs_defaults.defaultIgnore } = {
|
|
58
58
|
__proto__: null,
|
|
@@ -89,7 +89,7 @@ function isDirEmptySync(dirname, options) {
|
|
|
89
89
|
*
|
|
90
90
|
* @returns `true` if path is a directory, `false` otherwise
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
93
93
|
function isDirSync(filepath) {
|
|
94
94
|
return !!(/* @__PURE__ */ safeStatSync(filepath))?.isDirectory();
|
|
95
95
|
}
|
|
@@ -108,7 +108,7 @@ function isDirSync(filepath) {
|
|
|
108
108
|
*
|
|
109
109
|
* @returns `true` if path is a symbolic link, `false` otherwise
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
112
112
|
function isSymlinkSync(filepath) {
|
|
113
113
|
const fs = /* @__PURE__ */ require_node_fs.getNodeFs();
|
|
114
114
|
try {
|
|
@@ -135,7 +135,7 @@ function isSymlinkSync(filepath) {
|
|
|
135
135
|
*
|
|
136
136
|
* @returns Promise resolving to Stats object, or undefined on error
|
|
137
137
|
*/
|
|
138
|
-
|
|
138
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
139
139
|
async function safeStat(filepath) {
|
|
140
140
|
const fs = /* @__PURE__ */ require_node_fs.getNodeFs();
|
|
141
141
|
try {
|
|
@@ -161,7 +161,7 @@ async function safeStat(filepath) {
|
|
|
161
161
|
*
|
|
162
162
|
* @returns Stats object, or undefined on error
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
165
165
|
function safeStatSync(filepath) {
|
|
166
166
|
const fs = /* @__PURE__ */ require_node_fs.getNodeFs();
|
|
167
167
|
try {
|
package/dist/fs/read-dir.js
CHANGED
|
@@ -24,7 +24,7 @@ const require_fs_inspect = require('./inspect.js');
|
|
|
24
24
|
*
|
|
25
25
|
* @returns Array of directory names, optionally sorted
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
28
28
|
function innerReadDirNames(dirents, dirname, options) {
|
|
29
29
|
const { ignore, includeEmpty = true, sort = true } = {
|
|
30
30
|
__proto__: null,
|
|
@@ -56,7 +56,7 @@ function innerReadDirNames(dirents, dirname, options) {
|
|
|
56
56
|
*
|
|
57
57
|
* @returns Array of directory names, empty array on error
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
60
60
|
async function readDirNames(dirname, options) {
|
|
61
61
|
const fs = /* @__PURE__ */ require_node_fs.getNodeFs();
|
|
62
62
|
try {
|
|
@@ -90,7 +90,7 @@ async function readDirNames(dirname, options) {
|
|
|
90
90
|
*
|
|
91
91
|
* @returns Array of directory names, empty array on error
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
94
94
|
function readDirNamesSync(dirname, options) {
|
|
95
95
|
const fs = /* @__PURE__ */ require_node_fs.getNodeFs();
|
|
96
96
|
try {
|
package/dist/fs/read-file.js
CHANGED
|
@@ -34,7 +34,7 @@ const abortSignal = require_process_abort.getAbortSignal();
|
|
|
34
34
|
*
|
|
35
35
|
* @returns Promise resolving to Buffer containing file contents
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
38
38
|
async function readFileBinary(filepath, options) {
|
|
39
39
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
40
40
|
return await (/* @__PURE__ */ require_node_fs.getNodeFs()).promises.readFile(filepath, {
|
|
@@ -61,7 +61,7 @@ async function readFileBinary(filepath, options) {
|
|
|
61
61
|
*
|
|
62
62
|
* @returns Buffer containing file contents
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
65
65
|
function readFileBinarySync(filepath, options) {
|
|
66
66
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
67
67
|
return (/* @__PURE__ */ require_node_fs.getNodeFs()).readFileSync(filepath, {
|
|
@@ -87,7 +87,7 @@ function readFileBinarySync(filepath, options) {
|
|
|
87
87
|
*
|
|
88
88
|
* @returns Promise resolving to string containing file contents
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
91
91
|
async function readFileUtf8(filepath, options) {
|
|
92
92
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
93
93
|
return await (/* @__PURE__ */ require_node_fs.getNodeFs()).promises.readFile(filepath, {
|
|
@@ -115,7 +115,7 @@ async function readFileUtf8(filepath, options) {
|
|
|
115
115
|
*
|
|
116
116
|
* @returns String containing file contents
|
|
117
117
|
*/
|
|
118
|
-
|
|
118
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
119
119
|
function readFileUtf8Sync(filepath, options) {
|
|
120
120
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
121
121
|
return (/* @__PURE__ */ require_node_fs.getNodeFs()).readFileSync(filepath, {
|
|
@@ -123,7 +123,7 @@ function readFileUtf8Sync(filepath, options) {
|
|
|
123
123
|
encoding: "utf8"
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
127
127
|
async function safeReadFile(filepath, options) {
|
|
128
128
|
const { defaultValue, ...rawReadOpts } = typeof options === "string" ? {
|
|
129
129
|
__proto__: null,
|
|
@@ -152,7 +152,7 @@ async function safeReadFile(filepath, options) {
|
|
|
152
152
|
if (shouldReturnBuffer) return require_primordials_buffer.BufferIsBuffer(defaultValue) ? defaultValue : void 0;
|
|
153
153
|
return typeof defaultValue === "string" ? defaultValue : String(defaultValue);
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
156
156
|
function safeReadFileSync(filepath, options) {
|
|
157
157
|
const { defaultValue, ...rawReadOpts } = typeof options === "string" ? {
|
|
158
158
|
__proto__: null,
|
package/dist/fs/read-json.js
CHANGED
|
@@ -49,7 +49,7 @@ const require_json_parse = require('../json/parse.js');
|
|
|
49
49
|
* @returns Promise resolving to parsed JSON value, or undefined if throws is
|
|
50
50
|
* false and an error occurs.
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
53
53
|
async function readJson(filepath, options) {
|
|
54
54
|
const { cache, reviver, throws, ...fsOptions } = {
|
|
55
55
|
__proto__: null,
|
|
@@ -123,7 +123,7 @@ async function readJson(filepath, options) {
|
|
|
123
123
|
* @returns Parsed JSON value, or undefined if throws is false and an error
|
|
124
124
|
* occurs.
|
|
125
125
|
*/
|
|
126
|
-
|
|
126
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
127
127
|
function readJsonSync(filepath, options) {
|
|
128
128
|
const { cache, reviver, throws, ...fsOptions } = {
|
|
129
129
|
__proto__: null,
|
package/dist/fs/safe.js
CHANGED
|
@@ -29,9 +29,9 @@ const defaultRemoveOptions = require_objects_mutate.objectFreeze({
|
|
|
29
29
|
retryDelay: 200
|
|
30
30
|
});
|
|
31
31
|
let _del;
|
|
32
|
-
|
|
32
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
33
33
|
function getDel() {
|
|
34
|
-
if (_del === void 0) _del =
|
|
34
|
+
if (_del === void 0) _del = /*@__PURE__*/ require("../external/del");
|
|
35
35
|
return _del;
|
|
36
36
|
}
|
|
37
37
|
/**
|
package/dist/fs/unique.js
CHANGED
|
@@ -33,7 +33,7 @@ const require_node_path = require('../node/path.js');
|
|
|
33
33
|
* @returns Normalized unique filepath (original if it doesn't exist, or with
|
|
34
34
|
* number suffix)
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
37
37
|
function uniqueSync(filepath) {
|
|
38
38
|
const fs = /* @__PURE__ */ require_node_fs.getNodeFs();
|
|
39
39
|
const path = /* @__PURE__ */ require_node_path.getNodePath();
|
package/dist/fs/validate.js
CHANGED
|
@@ -42,7 +42,7 @@ const require_fs_access = require('./access.js');
|
|
|
42
42
|
*
|
|
43
43
|
* @returns Object with `validPaths` (readable) and `invalidPaths` (unreadable)
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
46
46
|
function validateFiles(filepaths) {
|
|
47
47
|
const validPaths = [];
|
|
48
48
|
const invalidPaths = [];
|
package/dist/fs/write-json.js
CHANGED
|
@@ -26,7 +26,7 @@ const NEWLINE_REGEX = /\n/g;
|
|
|
26
26
|
*
|
|
27
27
|
* @returns Formatted JSON string
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
30
30
|
function stringify(json, EOL, finalEOL, replacer, spaces = 2) {
|
|
31
31
|
const EOF = finalEOL ? EOL : "";
|
|
32
32
|
return `${require_primordials_string.StringPrototypeReplace(require_primordials_json.JSONStringify(json, replacer, spaces), NEWLINE_REGEX, EOL)}${EOF}`;
|
package/dist/git/_internal.js
CHANGED
|
@@ -7,6 +7,7 @@ const require_paths_normalize = require('../paths/normalize.js');
|
|
|
7
7
|
const require_primordials_array = require('../primordials/array.js');
|
|
8
8
|
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
9
9
|
const require_node_path = require('../node/path.js');
|
|
10
|
+
const require_primordials_date = require('../primordials/date.js');
|
|
10
11
|
const require_primordials_object = require('../primordials/object.js');
|
|
11
12
|
const require_primordials_json = require('../primordials/json.js');
|
|
12
13
|
const require_bin_which = require('../bin/which.js');
|
|
@@ -30,7 +31,7 @@ let _gitPath;
|
|
|
30
31
|
function getCachedGitDiff(key) {
|
|
31
32
|
const entry = gitDiffCache.get(key);
|
|
32
33
|
if (!entry) return;
|
|
33
|
-
if (
|
|
34
|
+
if (require_primordials_date.DateNow() >= entry.expiresAt) {
|
|
34
35
|
gitDiffCache.delete(key);
|
|
35
36
|
return;
|
|
36
37
|
}
|
package/dist/globs/_internal.js
CHANGED
|
@@ -20,14 +20,14 @@ const MATCHER_CACHE_MAX_SIZE = 100;
|
|
|
20
20
|
const matcherCache = new require_primordials_map_set.MapCtor();
|
|
21
21
|
let _fastGlob;
|
|
22
22
|
let _picomatch;
|
|
23
|
-
|
|
23
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
24
24
|
function getFastGlob() {
|
|
25
|
-
if (_fastGlob === void 0) _fastGlob =
|
|
25
|
+
if (_fastGlob === void 0) _fastGlob = /*@__PURE__*/ require("../external/fast-glob.js");
|
|
26
26
|
return _fastGlob;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
29
29
|
function getPicomatch() {
|
|
30
|
-
if (_picomatch === void 0) _picomatch =
|
|
30
|
+
if (_picomatch === void 0) _picomatch = /*@__PURE__*/ require("../external/picomatch.js");
|
|
31
31
|
return _picomatch;
|
|
32
32
|
}
|
|
33
33
|
/**
|
package/dist/globs/match.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_node_fs = require('../node/fs.js');
|
|
5
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
5
6
|
const require_node_fs_promises = require('../node/fs-promises.js');
|
|
6
7
|
const require_globs__internal = require('./_internal.js');
|
|
7
8
|
const require_promises_resolvers = require('../promises/resolvers.js');
|
|
@@ -45,7 +46,7 @@ const require_promises_resolvers = require('../promises/resolvers.js');
|
|
|
45
46
|
*/
|
|
46
47
|
function canUseNodeFsGlob(options) {
|
|
47
48
|
if (!options) return true;
|
|
48
|
-
for (const key of
|
|
49
|
+
for (const key of require_primordials_object.ObjectKeys(options)) if (key !== "cwd" && key !== "ignore") return false;
|
|
49
50
|
return true;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
@@ -57,7 +58,7 @@ function canUseNodeFsGlob(options) {
|
|
|
57
58
|
* console.log(files) // ['src/index.ts', 'src/utils.ts']
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
|
-
|
|
61
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
61
62
|
async function glob(patterns, options) {
|
|
62
63
|
const normalizedIgnore = require_globs__internal.normalizeIgnorePatterns(options?.ignore);
|
|
63
64
|
/* c8 ignore start */
|
|
@@ -80,7 +81,7 @@ async function glob(patterns, options) {
|
|
|
80
81
|
* console.log(files) // ['package.json', 'tsconfig.json']
|
|
81
82
|
* ```
|
|
82
83
|
*/
|
|
83
|
-
|
|
84
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
84
85
|
function globSync(patterns, options) {
|
|
85
86
|
const normalizedIgnore = require_globs__internal.normalizeIgnorePatterns(options?.ignore);
|
|
86
87
|
/* c8 ignore start */
|
package/dist/globs/matcher.js
CHANGED
|
@@ -40,7 +40,7 @@ let _matchesGlobProbed = false;
|
|
|
40
40
|
* const isSource = getGlobMatcher(['src/**', '!**\/*.test.ts'])
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
44
44
|
function getGlobMatcher(glob, options) {
|
|
45
45
|
const patterns = require_primordials_array.ArrayIsArray(glob) ? glob : [glob];
|
|
46
46
|
const sortedPatterns = [...patterns].sort();
|
|
@@ -94,7 +94,7 @@ function getGlobMatcher(glob, options) {
|
|
|
94
94
|
*
|
|
95
95
|
* @internal
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
98
98
|
function getMatchesGlob() {
|
|
99
99
|
if (!_matchesGlobProbed) {
|
|
100
100
|
const fn = (/* @__PURE__ */ require("node:path")).matchesGlob;
|
package/dist/globs/stream.js
CHANGED
|
@@ -23,7 +23,7 @@ const require_paths_globs = require('../paths/globs.js');
|
|
|
23
23
|
* }
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
27
27
|
function globStreamLicenses(dirname, options) {
|
|
28
28
|
const { ignore: ignoreOpt, ignoreOriginals, recursive, ...globOptions } = {
|
|
29
29
|
__proto__: null,
|