@socketsecurity/lib 6.0.2 → 6.0.3

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 CHANGED
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [6.0.3](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.3) - 2026-05-26
9
+
10
+ ### Added
11
+
12
+ - **`paths/walk` — `walkUp(from, { cwd, stopAt })`.** Lazy generator yielding a path then each ancestor up to (and including) the filesystem root or a `stopAt` boundary. `fs/find-up` now builds on it.
13
+ - **`fs/access` — `canAccess` / `canRead` / `canWrite` / `canExecute`.** Sync boolean permission checks over `fs.accessSync` (F_OK / R_OK / W_OK / X_OK). For "I'm about to write" prefer attempting the write over a pre-check (TOCTOU); use these when the answer drives a branch.
14
+ - **`fs/resolve-module` — `requireResolveFrom(fromDir, specifier)` / `requireResolveFromCwd(specifier)`.** `require.resolve` anchored at an arbitrary directory (e.g. "the `typescript` THIS project would load"). `nothrow: true` returns `undefined` instead of throwing.
15
+ - **`releases/github-retry-config` — `GITHUB_RETRY_CONFIG`, `resolveBaseDelayMs()`, `DEFAULT_BASE_DELAY_MS`.** Shared backoff config for the GitHub release helpers. The base retry delay is overridable via the `SOCKET_GITHUB_RETRY_BASE_DELAY_MS` env var (default 5000ms; set `0` for near-instant retries) — useful in CI / tests to skip the exponential-backoff wait.
16
+ - **`smol/path` — `getSmolPath()`.** Lazy accessor for socket-btm's `node:smol-path` native binding; `undefined` on stock Node. `walkUp`, `canAccess`, and `findUp` now prefer the native fast path (`dirname` / `access` / batched find-up) when running on a smol binary and fall back to the JS implementation otherwise — transparent to callers.
17
+
18
+ ### Changed (breaking)
19
+
20
+ - **`ai/profiles` exports a single `AI_PROFILE` capability ladder** instead of the four standalone `*_PROFILE` constants. The tiers are `AI_PROFILE.read` ⊂ `.edit` ⊂ `.create` ⊂ `.full`, ordered least-to-most capable. Migration: `READ_ONLY_PROFILE` → `AI_PROFILE.read`; `EDIT_ONLY_PROFILE` → `AI_PROFILE.create` (the old `EDIT_ONLY` allowed `Write`/`MultiEdit`); `FULL_FIX_PROFILE` → `AI_PROFILE.full`. New `AI_PROFILE.edit` is the narrowest fix tier — `Edit` on existing files only, no `Write`/`MultiEdit` — for lint autofix and in-place codemods.
21
+
22
+ ### Changed
23
+
24
+ - **Every `AI_PROFILE` tier now denies `Agent`.** Sub-agent spawning is blocked across all profiles, since a sub-agent can escape the parent's tool restrictions.
25
+
8
26
  ## [6.0.2](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.2) - 2026-05-26
9
27
 
10
28
  ### Added
@@ -2,38 +2,61 @@
2
2
  * @file Pre-built lockdown profiles for spawnAiAgent. Per CLAUDE.md
3
3
  * "Programmatic Claude calls" rule: every spawn must set tools / disallow /
4
4
  * permissionMode (and the helper always sets --no-session-persistence +
5
- * --add-dir cwd). These profiles are canonical safe defaults that callers
6
- * spread + override per call. Choose by capability:
5
+ * --add-dir cwd). `AI_PROFILE` is a capability ladder each tier permits
6
+ * everything the tier above it does, plus one more capability. Spread a tier
7
+ * and override per call (`tools`/`disallow` to tighten further, `model`,
8
+ * `addDirs`). Choose the LEAST-capable tier that gets the job done:
7
9
  *
8
- * - `READ_ONLY_PROFILE` — research / scanning. Read + Grep + Glob
9
- * - WebFetch + WebSearch. No Edit, no Write, no Bash. Use for static analysis
10
- * skills (scanning-quality, scanning-security).
11
- * - `EDIT_ONLY_PROFILE` — fix-mode. Read + Edit + Grep + Glob. Bash explicitly
12
- * denied. Use for skills that mutate source files but don't run arbitrary
13
- * shell (ai-lint-fix, refactor passes).
14
- * - `FULL_FIX_PROFILE` — fix-mode WITH Bash. Read + Edit + Write + Grep + Glob
15
- * - Bash (allowlisted to git/pnpm/node by default). Use for skills that need to
16
- * commit, run tests, install deps. No `WIDE_OPEN_PROFILE` exists by design
17
- * letting an agent run arbitrary tools is the lockdown rule's exact
18
- * failure mode.
10
+ * - `AI_PROFILE.read` — research / scanning. Read + Grep + Glob + WebFetch +
11
+ * WebSearch. No Edit, no Write, no Bash. Static-analysis skills
12
+ * (scanning-quality, scanning-security).
13
+ * - `AI_PROFILE.edit` — in-place edits only. Read + Edit + Grep + Glob. NO
14
+ * Write (can't create files), NO MultiEdit, NO Bash. Lint autofix /
15
+ * codemods constrained to existing files.
16
+ * - `AI_PROFILE.create` — edit AND create files. Adds MultiEdit + Write on top
17
+ * of `.edit`. Still no Bash. Codegen, adding a test, refactors that split
18
+ * modules.
19
+ * - `AI_PROFILE.full` `.create` plus Bash, allowlisted to git / pnpm / node.
20
+ * Skills that commit, run tests, install deps. No "wide open" tier exists
21
+ * by design — letting an agent run arbitrary tools is the lockdown rule's
22
+ * exact failure mode. The ladder is read ⊂ edit ⊂ create ⊂ full: each
23
+ * tier's tool set is a superset of the one above.
19
24
  */
20
25
  import type { PermissionMode } from './types.mts';
21
- interface Profile {
26
+ export interface AiProfile {
22
27
  readonly allow: readonly string[];
23
28
  readonly disallow: readonly string[];
24
29
  readonly permissionMode: PermissionMode;
25
30
  readonly tools: readonly string[];
26
31
  }
27
32
  /**
28
- * Read-only research / scanning. No mutation.
33
+ * Capability ladder of lockdown profiles, ordered least → most capable. Key
34
+ * order documents the ladder; each tier is a strict superset of the previous
35
+ * tier's tool surface.
29
36
  */
30
- export declare const READ_ONLY_PROFILE: Profile;
31
- /**
32
- * Edit-mode without Bash. Mutates source but can't run shell.
33
- */
34
- export declare const EDIT_ONLY_PROFILE: Profile;
35
- /**
36
- * Fix-mode with Bash, allowlisted to git / pnpm / node.
37
- */
38
- export declare const FULL_FIX_PROFILE: Profile;
39
- export {};
37
+ export declare const AI_PROFILE: {
38
+ readonly read: {
39
+ readonly allow: readonly [];
40
+ readonly disallow: readonly ["Agent", "Bash", "Edit", "MultiEdit", "Write"];
41
+ readonly permissionMode: 'dontAsk';
42
+ readonly tools: readonly ["Glob", "Grep", "Read", "WebFetch", "WebSearch"];
43
+ };
44
+ readonly edit: {
45
+ readonly allow: readonly [];
46
+ readonly disallow: readonly ["Agent", "Bash", "MultiEdit", "WebFetch", "WebSearch", "Write"];
47
+ readonly permissionMode: 'acceptEdits';
48
+ readonly tools: readonly ["Edit", "Glob", "Grep", "Read"];
49
+ };
50
+ readonly create: {
51
+ readonly allow: readonly [];
52
+ readonly disallow: readonly ["Agent", "Bash", "WebFetch", "WebSearch"];
53
+ readonly permissionMode: 'acceptEdits';
54
+ readonly tools: readonly ["Edit", "Glob", "Grep", "MultiEdit", "Read", "Write"];
55
+ };
56
+ readonly full: {
57
+ readonly allow: readonly ["Bash(git status:*)", "Bash(git diff:*)", "Bash(git log:*)", "Bash(git add:*)", "Bash(git commit:*)", "Bash(node:*)", "Bash(pnpm exec:*)", "Bash(pnpm run:*)", "Bash(pnpm test:*)"];
58
+ readonly disallow: readonly ["Agent", "WebFetch", "WebSearch"];
59
+ readonly permissionMode: 'acceptEdits';
60
+ readonly tools: readonly ["Bash", "Edit", "Glob", "Grep", "MultiEdit", "Read", "Write"];
61
+ };
62
+ };
@@ -20,42 +20,49 @@ var __copyProps = (to, from, except, desc) => {
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var profiles_exports = {};
22
22
  __export(profiles_exports, {
23
- EDIT_ONLY_PROFILE: () => EDIT_ONLY_PROFILE,
24
- FULL_FIX_PROFILE: () => FULL_FIX_PROFILE,
25
- READ_ONLY_PROFILE: () => READ_ONLY_PROFILE
23
+ AI_PROFILE: () => AI_PROFILE
26
24
  });
27
25
  module.exports = __toCommonJS(profiles_exports);
28
- const READ_ONLY_PROFILE = {
29
- allow: [],
30
- disallow: ["Bash", "Edit", "MultiEdit", "Write"],
31
- permissionMode: "dontAsk",
32
- tools: ["Glob", "Grep", "Read", "WebFetch", "WebSearch"]
33
- };
34
- const EDIT_ONLY_PROFILE = {
35
- allow: [],
36
- disallow: ["Bash", "WebFetch", "WebSearch"],
37
- permissionMode: "acceptEdits",
38
- tools: ["Edit", "Glob", "Grep", "MultiEdit", "Read", "Write"]
39
- };
40
- const FULL_FIX_PROFILE = {
41
- allow: [
42
- "Bash(git status:*)",
43
- "Bash(git diff:*)",
44
- "Bash(git log:*)",
45
- "Bash(git add:*)",
46
- "Bash(git commit:*)",
47
- "Bash(node:*)",
48
- "Bash(pnpm exec:*)",
49
- "Bash(pnpm run:*)",
50
- "Bash(pnpm test:*)"
51
- ],
52
- disallow: ["WebFetch", "WebSearch"],
53
- permissionMode: "acceptEdits",
54
- tools: ["Bash", "Edit", "Glob", "Grep", "MultiEdit", "Read", "Write"]
26
+ const AI_PROFILE = {
27
+ read: {
28
+ allow: [],
29
+ disallow: ["Agent", "Bash", "Edit", "MultiEdit", "Write"],
30
+ permissionMode: "dontAsk",
31
+ tools: ["Glob", "Grep", "Read", "WebFetch", "WebSearch"]
32
+ },
33
+ // No Write / MultiEdit: edits land in existing files, never create new ones.
34
+ edit: {
35
+ allow: [],
36
+ disallow: ["Agent", "Bash", "MultiEdit", "WebFetch", "WebSearch", "Write"],
37
+ permissionMode: "acceptEdits",
38
+ tools: ["Edit", "Glob", "Grep", "Read"]
39
+ },
40
+ // MultiEdit + Write added: may create files. Bash still denied.
41
+ create: {
42
+ allow: [],
43
+ disallow: ["Agent", "Bash", "WebFetch", "WebSearch"],
44
+ permissionMode: "acceptEdits",
45
+ tools: ["Edit", "Glob", "Grep", "MultiEdit", "Read", "Write"]
46
+ },
47
+ // Bash allowlisted to git / pnpm / node only; anything else is denied.
48
+ full: {
49
+ allow: [
50
+ "Bash(git status:*)",
51
+ "Bash(git diff:*)",
52
+ "Bash(git log:*)",
53
+ "Bash(git add:*)",
54
+ "Bash(git commit:*)",
55
+ "Bash(node:*)",
56
+ "Bash(pnpm exec:*)",
57
+ "Bash(pnpm run:*)",
58
+ "Bash(pnpm test:*)"
59
+ ],
60
+ disallow: ["Agent", "WebFetch", "WebSearch"],
61
+ permissionMode: "acceptEdits",
62
+ tools: ["Bash", "Edit", "Glob", "Grep", "MultiEdit", "Read", "Write"]
63
+ }
55
64
  };
56
65
  // Annotate the CommonJS export names for ESM import in node:
57
66
  0 && (module.exports = {
58
- EDIT_ONLY_PROFILE,
59
- FULL_FIX_PROFILE,
60
- READ_ONLY_PROFILE
67
+ AI_PROFILE
61
68
  });
@@ -30,11 +30,11 @@ export declare function pickAgent(requested: AiAgentName | undefined, cwd: strin
30
30
  *
31
31
  * @example
32
32
  * ```ts
33
- * import { EDIT_ONLY_PROFILE } from '@socketsecurity/lib/ai/profiles'
33
+ * import { AI_PROFILE } from '@socketsecurity/lib/ai/profiles'
34
34
  * import { spawnAiAgent } from '@socketsecurity/lib/ai/spawn'
35
35
  *
36
36
  * const result = await spawnAiAgent({
37
- * ...EDIT_ONLY_PROFILE,
37
+ * ...AI_PROFILE.edit,
38
38
  * prompt: 'Fix the lint findings in src/foo.ts',
39
39
  * cwd: process.cwd(),
40
40
  * model: 'claude-sonnet-4-6',
@@ -42,9 +42,9 @@ export interface AgentSpawnResult {
42
42
  *
43
43
  * Required: `prompt`, `cwd`, `tools`, `disallow`, `permissionMode`.
44
44
  *
45
- * Pre-built profiles in `profiles.ts` cover the common shapes
46
- * (READ_ONLY_PROFILE, EDIT_ONLY_PROFILE) — callers spread the profile and
47
- * override per-call (model, timeout, addDirs).
45
+ * Pre-built profiles in `profiles.ts` cover the common shapes (the `AI_PROFILE`
46
+ * capability ladder) — callers spread a tier and override per-call (model,
47
+ * timeout, addDirs).
48
48
  *
49
49
  * Why the lockdown fields are required (not defaulted to a permissive shape):
50
50
  * the CLAUDE.md rule says "all four lockdown flags MUST be set on every spawn."
@@ -77,14 +77,14 @@ export declare function runOne<I, T>(item: I, index: number, worktreeBranch: str
77
77
  * ;```ts
78
78
  * import { spawnAiAgentsInWorktrees } from '@socketsecurity/lib/ai/worktree'
79
79
  * import { spawnAiAgent } from '@socketsecurity/lib/ai/spawn'
80
- * import { EDIT_ONLY_PROFILE } from '@socketsecurity/lib/ai/profiles'
80
+ * import { AI_PROFILE } from '@socketsecurity/lib/ai/profiles'
81
81
  *
82
82
  * const repos = ['socket-addon', 'socket-btm', 'socket-lib']
83
83
  * const settled = await spawnAiAgentsInWorktrees(
84
84
  * repos,
85
85
  * async ({ cwd }) => {
86
86
  * return await spawnAiAgent({
87
- * ...EDIT_ONLY_PROFILE,
87
+ * ...AI_PROFILE.create,
88
88
  * prompt: 'Run the cleanup task',
89
89
  * cwd,
90
90
  * })
@@ -77,7 +77,7 @@ const SOCKET_REGISTRY_APP_NAME = "registry";
77
77
  const SOCKET_WHEELHOUSE_APP_NAME = "wheelhouse";
78
78
  const SOCKET_APP_PREFIX = "_";
79
79
  const SOCKET_LIB_NAME = "@socketsecurity/lib";
80
- const SOCKET_LIB_VERSION = "6.0.2";
80
+ const SOCKET_LIB_VERSION = "6.0.3";
81
81
  const SOCKET_IPC_HANDSHAKE = "SOCKET_IPC_HANDSHAKE";
82
82
  const CACHE_SOCKET_API_DIR = "socket-api";
83
83
  const REGISTRY = "registry";
@@ -32,6 +32,7 @@ __export(detect_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(detect_exports);
34
34
  var import_paths = require("./paths");
35
+ var import_find_up = require("../fs/find-up");
35
36
  var import_socket = require("../paths/socket");
36
37
  var import_date = require("../primordials/date");
37
38
  var import_json = require("../primordials/json");
@@ -72,18 +73,9 @@ function findPackageJson(filePath) {
72
73
  packageJsonPathCache.delete(startDir);
73
74
  }
74
75
  }
75
- let currentDir = startDir;
76
- const root = path.parse(currentDir).root;
77
- while (currentDir !== root) {
78
- const packageJsonPath = path.join(currentDir, "package.json");
79
- if (fs.existsSync(packageJsonPath)) {
80
- packageJsonPathCacheSet(startDir, packageJsonPath);
81
- return packageJsonPath;
82
- }
83
- currentDir = path.dirname(currentDir);
84
- }
85
- packageJsonPathCacheSet(startDir, void 0);
86
- return void 0;
76
+ const packageJsonPath = (0, import_find_up.findUpSync)("package.json", { cwd: startDir });
77
+ packageJsonPathCacheSet(startDir, packageJsonPath);
78
+ return packageJsonPath;
87
79
  }
88
80
  function readPackageJson(packageJsonPath) {
89
81
  const fs = (0, import_fs.getNodeFs)();
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file Synchronous file-access predicates — boolean "can this process do X to
3
+ * this path?" checks over `fs.accessSync`. Prefer these only where the answer
4
+ * drives a user-facing decision (e.g. "is the cache dir writable, so I can
5
+ * pick a fallback?"). For "I'm about to write, can I?" do NOT pre-check —
6
+ * just attempt the write and handle the error; a check-then-act gap is a
7
+ * TOCTOU race. `canAccess` (F_OK) overlaps `existsSync`; use `existsSync` for
8
+ * plain existence, these for permission bits.
9
+ */
10
+ import type { PathLike } from 'node:fs';
11
+ /**
12
+ * Does the process have `mode` access to `path`? Wraps `fs.accessSync`,
13
+ * returning a boolean instead of throwing. Default mode is `F_OK` (existence).
14
+ *
15
+ * @param path - Path to check.
16
+ * @param mode - `fs.constants` bit (`F_OK` / `R_OK` / `W_OK` / `X_OK`).
17
+ *
18
+ * @returns True if the access check succeeds.
19
+ */
20
+ export declare function canAccess(path: PathLike, mode?: number | undefined): boolean;
21
+ /**
22
+ * Can the process execute `path`? (`X_OK`)
23
+ */
24
+ export declare function canExecute(path: PathLike): boolean;
25
+ /**
26
+ * Can the process read `path`? (`R_OK`)
27
+ */
28
+ export declare function canRead(path: PathLike): boolean;
29
+ /**
30
+ * Can the process write `path`? (`W_OK`)
31
+ */
32
+ export declare function canWrite(path: PathLike): boolean;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var access_exports = {};
22
+ __export(access_exports, {
23
+ canAccess: () => canAccess,
24
+ canExecute: () => canExecute,
25
+ canRead: () => canRead,
26
+ canWrite: () => canWrite
27
+ });
28
+ module.exports = __toCommonJS(access_exports);
29
+ var import_fs = require("../node/fs");
30
+ var import_path = require("../smol/path");
31
+ // @__NO_SIDE_EFFECTS__
32
+ function canAccess(path, mode) {
33
+ const smolAccess = (0, import_path.getSmolPath)()?.access;
34
+ if (smolAccess) {
35
+ return smolAccess(path, mode);
36
+ }
37
+ const fs = (0, import_fs.getNodeFs)();
38
+ try {
39
+ fs.accessSync(path, mode);
40
+ return true;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+ // @__NO_SIDE_EFFECTS__
46
+ function canExecute(path) {
47
+ return /* @__PURE__ */ canAccess(path, (0, import_fs.getNodeFs)().constants.X_OK);
48
+ }
49
+ // @__NO_SIDE_EFFECTS__
50
+ function canRead(path) {
51
+ return /* @__PURE__ */ canAccess(path, (0, import_fs.getNodeFs)().constants.R_OK);
52
+ }
53
+ // @__NO_SIDE_EFFECTS__
54
+ function canWrite(path) {
55
+ return /* @__PURE__ */ canAccess(path, (0, import_fs.getNodeFs)().constants.W_OK);
56
+ }
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ canAccess,
60
+ canExecute,
61
+ canRead,
62
+ canWrite
63
+ });
@@ -40,6 +40,8 @@ var import_abort = require("../process/abort");
40
40
  var import_fs = require("../node/fs");
41
41
  var import_path = require("../node/path");
42
42
  var import_normalize = require("../paths/normalize");
43
+ var import_walk = require("../paths/walk");
44
+ var import_path2 = require("../smol/path");
43
45
  const abortSignal = (0, import_abort.getAbortSignal)();
44
46
  // @__NO_SIDE_EFFECTS__
45
47
  async function findUp(name, options) {
@@ -59,10 +61,8 @@ async function findUp(name, options) {
59
61
  }
60
62
  const fs = (0, import_fs.getNodeFs)();
61
63
  const path = (0, import_path.getNodePath)();
62
- let dir = path.resolve(cwd);
63
- const { root } = path.parse(dir);
64
64
  const names = (0, import_predicates.isArray)(name) ? name : [name];
65
- while (dir) {
65
+ for (const dir of (0, import_walk.walkUp)(cwd)) {
66
66
  for (const n of names) {
67
67
  if (signal?.aborted) {
68
68
  return void 0;
@@ -79,10 +79,6 @@ async function findUp(name, options) {
79
79
  } catch {
80
80
  }
81
81
  }
82
- if (dir === root) {
83
- break;
84
- }
85
- dir = path.dirname(dir);
86
82
  }
87
83
  return void 0;
88
84
  }
@@ -104,27 +100,13 @@ function findUpSync(name, options) {
104
100
  }
105
101
  const fs = (0, import_fs.getNodeFs)();
106
102
  const path = (0, import_path.getNodePath)();
107
- let dir = path.resolve(cwd);
108
- const { root } = path.parse(dir);
109
- const stopDir = stopAt ? path.resolve(stopAt) : void 0;
110
103
  const names = (0, import_predicates.isArray)(name) ? name : [name];
111
- while (dir) {
112
- if (stopDir && dir === stopDir) {
113
- for (const n of names) {
114
- const thePath = path.join(dir, n);
115
- try {
116
- const stats = fs.statSync(thePath);
117
- if (!onlyDirectories && stats.isFile()) {
118
- return (0, import_normalize.normalizePath)(thePath);
119
- }
120
- if (!onlyFiles && stats.isDirectory()) {
121
- return (0, import_normalize.normalizePath)(thePath);
122
- }
123
- } catch {
124
- }
125
- }
126
- return void 0;
127
- }
104
+ const smolFindUp = (0, import_path2.getSmolPath)()?.findUp;
105
+ if (smolFindUp && stopAt === void 0) {
106
+ const found = smolFindUp(path.resolve(cwd), names, { onlyDirectories });
107
+ return found === void 0 ? void 0 : (0, import_normalize.normalizePath)(found);
108
+ }
109
+ for (const dir of (0, import_walk.walkUp)(cwd, { stopAt })) {
128
110
  for (const n of names) {
129
111
  const thePath = path.join(dir, n);
130
112
  try {
@@ -138,10 +120,6 @@ function findUpSync(name, options) {
138
120
  } catch {
139
121
  }
140
122
  }
141
- if (dir === root) {
142
- break;
143
- }
144
- dir = path.dirname(dir);
145
123
  }
146
124
  return void 0;
147
125
  }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @file `require.resolve`-from-an-arbitrary-base. Node's bare
3
+ * `require.resolve(spec)` resolves relative to the calling module; these
4
+ * helpers resolve a specifier as if required from a DIFFERENT directory —
5
+ * useful for "find the copy of `typescript` that THIS project would load,"
6
+ * not the copy socket-lib itself loads. Returns the resolved absolute file
7
+ * path, or (in `nothrow` form) `undefined` when the specifier can't be
8
+ * resolved.
9
+ */
10
+ /**
11
+ * Resolve a module specifier as if `require`'d from `fromDir`.
12
+ *
13
+ * Equivalent to running `require.resolve(specifier)` inside a module located at
14
+ * `fromDir`. Accepts package specifiers (`'typescript'`, `'pkg/sub/path'`) and
15
+ * relative paths (`'./foo'`).
16
+ *
17
+ * @example
18
+ * ;```ts
19
+ * // The `typescript` the project at /repo would load:
20
+ * requireResolveFrom('/repo', 'typescript')
21
+ * //=> '/repo/node_modules/typescript/lib/typescript.js'
22
+ *
23
+ * requireResolveFrom('/repo', './missing', { nothrow: true })
24
+ * //=> undefined
25
+ * ```
26
+ *
27
+ * @param fromDir - Directory to resolve as if the require originated there.
28
+ * @param specifier - Module specifier or relative path to resolve.
29
+ * @param options - `nothrow: true` returns `undefined` instead of throwing.
30
+ *
31
+ * @returns Absolute resolved path (or `undefined` when `nothrow` and
32
+ * unresolved).
33
+ *
34
+ * @throws When the specifier can't be resolved and `nothrow` is not set.
35
+ */
36
+ export declare function requireResolveFrom(fromDir: string, specifier: string, options: {
37
+ nothrow: true;
38
+ }): string | undefined;
39
+ export declare function requireResolveFrom(fromDir: string, specifier: string, options?: {
40
+ nothrow?: false | undefined;
41
+ } | undefined): string;
42
+ /**
43
+ * Resolve a module specifier as if `require`'d from `process.cwd()`. Alias for
44
+ * {@link requireResolveFrom} anchored at the current directory.
45
+ *
46
+ * @param specifier - Module specifier or relative path to resolve.
47
+ * @param options - `nothrow: true` returns `undefined` instead of throwing.
48
+ *
49
+ * @returns Absolute resolved path (or `undefined` when `nothrow` and
50
+ * unresolved).
51
+ */
52
+ export declare function requireResolveFromCwd(specifier: string, options: {
53
+ nothrow: true;
54
+ }): string | undefined;
55
+ export declare function requireResolveFromCwd(specifier: string, options?: {
56
+ nothrow?: false | undefined;
57
+ } | undefined): string;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var resolve_module_exports = {};
32
+ __export(resolve_module_exports, {
33
+ requireResolveFrom: () => requireResolveFrom,
34
+ requireResolveFromCwd: () => requireResolveFromCwd
35
+ });
36
+ module.exports = __toCommonJS(resolve_module_exports);
37
+ var import_node_module = require("node:module");
38
+ var import_node_process = __toESM(require("node:process"));
39
+ var import_path = require("../node/path");
40
+ function requireResolveFrom(fromDir, specifier, options) {
41
+ const { nothrow = false } = {
42
+ __proto__: null,
43
+ ...options
44
+ };
45
+ const path = (0, import_path.getNodePath)();
46
+ const anchor = path.join(path.resolve(fromDir), "noop.js");
47
+ try {
48
+ return (0, import_node_module.createRequire)(anchor).resolve(specifier);
49
+ } catch (e) {
50
+ if (nothrow) {
51
+ return void 0;
52
+ }
53
+ throw e;
54
+ }
55
+ }
56
+ function requireResolveFromCwd(specifier, options) {
57
+ return options && options.nothrow ? requireResolveFrom(import_node_process.default.cwd(), specifier, { nothrow: true }) : requireResolveFrom(import_node_process.default.cwd(), specifier);
58
+ }
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ requireResolveFrom,
62
+ requireResolveFromCwd
63
+ });
@@ -23,18 +23,15 @@ __export(validate_exports, {
23
23
  validateFiles: () => validateFiles
24
24
  });
25
25
  module.exports = __toCommonJS(validate_exports);
26
- var import_fs = require("../node/fs");
26
+ var import_access = require("./access");
27
27
  // @__NO_SIDE_EFFECTS__
28
28
  function validateFiles(filepaths) {
29
- const fs = (0, import_fs.getNodeFs)();
30
29
  const validPaths = [];
31
30
  const invalidPaths = [];
32
- const { R_OK } = fs.constants;
33
31
  for (const filepath of filepaths) {
34
- try {
35
- fs.accessSync(filepath, R_OK);
32
+ if ((0, import_access.canRead)(filepath)) {
36
33
  validPaths.push(filepath);
37
- } catch {
34
+ } else {
38
35
  invalidPaths.push(filepath);
39
36
  }
40
37
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @file Walk parent directories. `walkUp` is the lazy ancestor generator that
3
+ * `fs/find-up` and package-root lookups build on: given a starting path it
4
+ * yields that path, then each parent, up to and INCLUDING the filesystem root
5
+ * (or a caller-supplied `stopAt` boundary). Lazy so a caller can stop early
6
+ * without computing the whole chain.
7
+ */
8
+ export interface WalkUpOptions {
9
+ /**
10
+ * Starting directory. Relative `from` values are resolved against this.
11
+ * Defaults to `process.cwd()`.
12
+ */
13
+ cwd?: string | undefined;
14
+ /**
15
+ * Last directory to yield (INCLUSIVE). Traversal stops after this path is
16
+ * emitted. Defaults to the filesystem root.
17
+ */
18
+ stopAt?: string | undefined;
19
+ }
20
+ /**
21
+ * Lazily yield `from` and each of its ancestor directories, up to and including
22
+ * the filesystem root (or `stopAt`). Each yielded path is normalized to forward
23
+ * slashes.
24
+ *
25
+ * @example
26
+ * ;```ts
27
+ * for (const dir of walkUp('/a/b/c')) {
28
+ * // '/a/b/c', '/a/b', '/a', '/'
29
+ * }
30
+ *
31
+ * // Stop at a boundary (inclusive):
32
+ * [...walkUp('/a/b/c', { stopAt: '/a' })] // ['/a/b/c', '/a/b', '/a']
33
+ * ```
34
+ *
35
+ * @param from - Path to start from. Relative values resolve against `cwd`.
36
+ * @param options - `cwd` and `stopAt` boundary.
37
+ *
38
+ * @returns Generator of normalized absolute directory paths.
39
+ */
40
+ export declare function walkUp(from: string, options?: WalkUpOptions | undefined): Generator<string>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+ var walk_exports = {};
32
+ __export(walk_exports, {
33
+ walkUp: () => walkUp
34
+ });
35
+ module.exports = __toCommonJS(walk_exports);
36
+ var import_node_process = __toESM(require("node:process"));
37
+ var import_path = require("../node/path");
38
+ var import_path2 = require("../smol/path");
39
+ var import_normalize = require("./normalize");
40
+ function* walkUp(from, options) {
41
+ const { cwd = import_node_process.default.cwd(), stopAt } = {
42
+ __proto__: null,
43
+ ...options
44
+ };
45
+ const path = (0, import_path.getNodePath)();
46
+ const smol = (0, import_path2.getSmolPath)();
47
+ const dirname = smol?.dirname ?? path.dirname;
48
+ let dir = path.resolve(cwd, from);
49
+ const stopDir = stopAt ? path.resolve(cwd, stopAt) : void 0;
50
+ let prev;
51
+ while (dir !== prev) {
52
+ yield (0, import_normalize.normalizePath)(dir);
53
+ if (stopDir !== void 0 && dir === stopDir) {
54
+ return;
55
+ }
56
+ prev = dir;
57
+ dir = dirname(dir);
58
+ }
59
+ }
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ walkUp
63
+ });
@@ -5,8 +5,14 @@
5
5
  */
6
6
  export declare const abortSignal: AbortSignal;
7
7
  /**
8
- * Get the timers/promises module. Uses lazy loading to avoid Webpack bundling
9
- * issues.
8
+ * Get the timers/promises module. Lazy `require` (not a top-level import) to
9
+ * avoid Webpack bundling issues.
10
+ *
11
+ * Intentionally NOT memoized: Node's module cache already makes the repeat
12
+ * `require` effectively free, and caching the reference breaks fake timers
13
+ * (`vi.useFakeTimers()` swaps the clock after this module loads; a cached
14
+ * reference would hold the pre-fake real `setTimeout`, burning real wallclock
15
+ * on retry backoff and starving the test worker pool).
10
16
  *
11
17
  * @private
12
18
  *
@@ -26,13 +26,9 @@ __export(internal_exports, {
26
26
  module.exports = __toCommonJS(internal_exports);
27
27
  var import_abort = require("../process/abort");
28
28
  const abortSignal = (0, import_abort.getAbortSignal)();
29
- let _timers;
30
29
  // @__NO_SIDE_EFFECTS__
31
30
  function getTimers() {
32
- if (_timers === void 0) {
33
- _timers = require("node:timers/promises");
34
- }
35
- return _timers;
31
+ return require("node:timers/promises");
36
32
  }
37
33
  // Annotate the CommonJS export names for ESM import in node:
38
34
  0 && (module.exports = {
@@ -29,18 +29,9 @@ var import_retry = require("../promises/retry");
29
29
  var import_array = require("../primordials/array");
30
30
  var import_error = require("../primordials/error");
31
31
  var import_json = require("../primordials/json");
32
- var import_object = require("../primordials/object");
33
32
  var import_github_assets = require("./github-assets");
34
33
  var import_github_auth = require("./github-auth");
35
- const RETRY_CONFIG = (0, import_object.ObjectFreeze)({
36
- __proto__: null,
37
- // Exponential backoff: delay doubles with each retry (5s, 10s, 20s).
38
- backoffFactor: 2,
39
- // Initial delay before first retry.
40
- baseDelayMs: 5e3,
41
- // Maximum number of retry attempts (excluding initial request).
42
- retries: 2
43
- });
34
+ var import_github_retry_config = require("./github-retry-config");
44
35
  async function fetchReleaseAssetsViaGraphQL(owner, repo, tag) {
45
36
  const response = await (0, import_request.httpRequest)("https://api.github.com/graphql", {
46
37
  body: (0, import_json.JSONStringify)({
@@ -143,7 +134,7 @@ async function getReleaseAssetUrl(tag, assetPattern, repoConfig, options = {}) {
143
134
  assets2 = release.assets;
144
135
  }
145
136
  return assets2;
146
- }, RETRY_CONFIG);
137
+ }, import_github_retry_config.GITHUB_RETRY_CONFIG);
147
138
  if (!assets) {
148
139
  if (nothrow) {
149
140
  return void 0;
@@ -31,19 +31,10 @@ var import_array = require("../primordials/array");
31
31
  var import_date = require("../primordials/date");
32
32
  var import_error = require("../primordials/error");
33
33
  var import_json = require("../primordials/json");
34
- var import_object = require("../primordials/object");
35
34
  var import_string = require("../primordials/string");
36
35
  var import_github_assets = require("./github-assets");
37
36
  var import_github_auth = require("./github-auth");
38
- const RETRY_CONFIG = (0, import_object.ObjectFreeze)({
39
- __proto__: null,
40
- // Exponential backoff: delay doubles with each retry (5s, 10s, 20s).
41
- backoffFactor: 2,
42
- // Initial delay before first retry.
43
- baseDelayMs: 5e3,
44
- // Maximum number of retry attempts (excluding initial request).
45
- retries: 2
46
- });
37
+ var import_github_retry_config = require("./github-retry-config");
47
38
  async function fetchReleasesViaGraphQL(owner, repo) {
48
39
  const response = await (0, import_request.httpRequest)("https://api.github.com/graphql", {
49
40
  body: (0, import_json.JSONStringify)({
@@ -161,7 +152,7 @@ async function getLatestRelease(toolPrefix, repoConfig, options = {}) {
161
152
  );
162
153
  const latestRelease = matchingReleases[0];
163
154
  return latestRelease.tag_name;
164
- }, RETRY_CONFIG) ?? void 0;
155
+ }, import_github_retry_config.GITHUB_RETRY_CONFIG) ?? void 0;
165
156
  }
166
157
  // Annotate the CommonJS export names for ESM import in node:
167
158
  0 && (module.exports = {
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @file Shared retry configuration for the GitHub release helpers
3
+ * (`github-listing`, `github-asset-url`). Exponential backoff over the
4
+ * transient-failure / rate-limit surface. `baseDelayMs` is overridable via
5
+ * `SOCKET_GITHUB_RETRY_BASE_DELAY_MS` — set it to `0` for near-instant
6
+ * retries. Tests set it so the backoff sleep (5s + 10s of real wallclock)
7
+ * doesn't run: pRetry's delay goes through `node:timers/promises`, which
8
+ * `vi.useFakeTimers()` doesn't reliably intercept, so a zero base delay is
9
+ * the robust, fake-timer-independent way to keep these tests fast. CI can
10
+ * also dial it down. Default stays 5000ms for production resilience.
11
+ */
12
+ /**
13
+ * Default base delay (ms) before the first retry when the env override is unset
14
+ * or non-numeric.
15
+ */
16
+ export declare const DEFAULT_BASE_DELAY_MS = 5000;
17
+ /**
18
+ * Resolve the retry base delay from `SOCKET_GITHUB_RETRY_BASE_DELAY_MS`,
19
+ * falling back to {@link DEFAULT_BASE_DELAY_MS}. Read live (not memoized) so
20
+ * it's unit-testable by mutating the env — and so a long-lived process that has
21
+ * the env changed under it picks up the new value on next read.
22
+ *
23
+ * @returns The configured base delay in milliseconds.
24
+ */
25
+ export declare function resolveBaseDelayMs(): number;
26
+ export declare const GITHUB_RETRY_CONFIG: Readonly<{
27
+ __proto__: null;
28
+ backoffFactor: 2;
29
+ baseDelayMs: number;
30
+ retries: 2;
31
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var github_retry_config_exports = {};
22
+ __export(github_retry_config_exports, {
23
+ DEFAULT_BASE_DELAY_MS: () => DEFAULT_BASE_DELAY_MS,
24
+ GITHUB_RETRY_CONFIG: () => GITHUB_RETRY_CONFIG,
25
+ resolveBaseDelayMs: () => resolveBaseDelayMs
26
+ });
27
+ module.exports = __toCommonJS(github_retry_config_exports);
28
+ var import_number = require("../env/number");
29
+ var import_rewire = require("../env/rewire");
30
+ var import_object = require("../primordials/object");
31
+ const DEFAULT_BASE_DELAY_MS = 5e3;
32
+ function resolveBaseDelayMs() {
33
+ return (0, import_number.envAsNumber)(
34
+ (0, import_rewire.getEnvValue)("SOCKET_GITHUB_RETRY_BASE_DELAY_MS"),
35
+ DEFAULT_BASE_DELAY_MS
36
+ );
37
+ }
38
+ const GITHUB_RETRY_CONFIG = (0, import_object.ObjectFreeze)({
39
+ __proto__: null,
40
+ // Exponential backoff: delay doubles with each retry (5s, 10s, 20s).
41
+ backoffFactor: 2,
42
+ // Initial delay before first retry. Overridable for tests / CI.
43
+ baseDelayMs: resolveBaseDelayMs(),
44
+ // Maximum number of retry attempts (excluding initial request).
45
+ retries: 2
46
+ });
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ DEFAULT_BASE_DELAY_MS,
50
+ GITHUB_RETRY_CONFIG,
51
+ resolveBaseDelayMs
52
+ });
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @file Lazy-loader for socket-btm's `node:smol-path` — native fast paths for
3
+ * the hot path-string primitives (`dirname`, `normalize`, …) and, per the
4
+ * socket-btm `node-smol-path` Phase 4 plan, batched filesystem ops (`access`,
5
+ * an in-C++ `findUp`). Returns `undefined` on stock Node, non-Node runtimes,
6
+ * and on socket-btm binaries that haven't shipped the binding yet; callers
7
+ * fall back to the JS implementation. Result is cached. The binding does not
8
+ * exist yet (the plan is unbuilt) — this accessor is the seam so that when it
9
+ * lands, only this file changes and `paths/walk`, `fs/access`, `fs/find-up`
10
+ * light up natively. Today `getSmolPath()` is always `undefined` and the JS
11
+ * paths run.
12
+ */
13
+ import type { PathLike } from 'node:fs';
14
+ /**
15
+ * Native path / filesystem fast-path surface. Only the operations socket-lib's
16
+ * helpers shim are typed; the binding may expose more. Every method is optional
17
+ * so a partial rollout (e.g. `dirname` ships before `access`) still type-checks
18
+ * at the shim sites.
19
+ */
20
+ export interface SmolPathBinding {
21
+ /**
22
+ * `path.dirname` over the one-byte Fast API. ASCII fast path; two-byte inputs
23
+ * route to the equivalent of `path.dirname`.
24
+ */
25
+ dirname?: ((p: string) => string) | undefined;
26
+ /**
27
+ * `path.normalize` over the one-byte Fast API.
28
+ */
29
+ normalize?: ((p: string) => string) | undefined;
30
+ /**
31
+ * `fs.accessSync`-equivalent returning a boolean instead of throwing — skips
32
+ * the V8 error-object materialization the JS wrapper pays on every negative
33
+ * check. `mode` is an `fs.constants` bit.
34
+ */
35
+ access?: ((path: PathLike, mode?: number | undefined) => boolean) | undefined;
36
+ /**
37
+ * In-C++ find-up: walk `startDir`'s ancestors, return the first dir
38
+ * containing any of `names` (as a file unless `onlyDirectories`), or
39
+ * `undefined`. Collapses the N JS↔native crossings of the JS walk into one.
40
+ */
41
+ findUp?: ((startDir: string, names: readonly string[], options?: {
42
+ onlyDirectories?: boolean | undefined;
43
+ } | undefined) => string | undefined) | undefined;
44
+ }
45
+ /**
46
+ * Returns the `node:smol-path` binding when running on a smol Node binary that
47
+ * ships it; otherwise `undefined`. Cached across calls.
48
+ *
49
+ * @returns The native binding, or `undefined` to signal "use the JS fallback".
50
+ */
51
+ export declare function getSmolPath(): SmolPathBinding | undefined;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var path_exports = {};
22
+ __export(path_exports, {
23
+ getSmolPath: () => getSmolPath
24
+ });
25
+ module.exports = __toCommonJS(path_exports);
26
+ var import_module = require("../node/module");
27
+ let _smolPath;
28
+ let _smolPathProbed = false;
29
+ // @__NO_SIDE_EFFECTS__
30
+ function getSmolPath() {
31
+ if (!_smolPathProbed) {
32
+ _smolPathProbed = true;
33
+ if ((0, import_module.isNodeBuiltin)("node:smol-path")) {
34
+ _smolPath = require("node:smol-path");
35
+ }
36
+ }
37
+ return _smolPath;
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ getSmolPath
42
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/lib",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Core utilities and infrastructure for Socket.dev security tools",
5
5
  "keywords": [
6
6
  "Socket.dev",
@@ -1319,6 +1319,11 @@
1319
1319
  "types": "./dist/external-tools/uv/types.d.ts",
1320
1320
  "default": "./dist/external-tools/uv/types.js"
1321
1321
  },
1322
+ "./fs/access": {
1323
+ "source": "./src/fs/access.ts",
1324
+ "types": "./dist/fs/access.d.ts",
1325
+ "default": "./dist/fs/access.js"
1326
+ },
1322
1327
  "./fs/encoding": {
1323
1328
  "source": "./src/fs/encoding.ts",
1324
1329
  "types": "./dist/fs/encoding.d.ts",
@@ -1359,6 +1364,11 @@
1359
1364
  "types": "./dist/fs/read-json-cache.d.ts",
1360
1365
  "default": "./dist/fs/read-json-cache.js"
1361
1366
  },
1367
+ "./fs/resolve-module": {
1368
+ "source": "./src/fs/resolve-module.ts",
1369
+ "types": "./dist/fs/resolve-module.d.ts",
1370
+ "default": "./dist/fs/resolve-module.js"
1371
+ },
1362
1372
  "./fs/safe": {
1363
1373
  "source": "./src/fs/safe.ts",
1364
1374
  "types": "./dist/fs/safe.d.ts",
@@ -1990,6 +2000,11 @@
1990
2000
  "types": "./dist/paths/socket.d.ts",
1991
2001
  "default": "./dist/paths/socket.js"
1992
2002
  },
2003
+ "./paths/walk": {
2004
+ "source": "./src/paths/walk.ts",
2005
+ "types": "./dist/paths/walk.d.ts",
2006
+ "default": "./dist/paths/walk.js"
2007
+ },
1993
2008
  "./perf/enabled": {
1994
2009
  "source": "./src/perf/enabled.ts",
1995
2010
  "types": "./dist/perf/enabled.d.ts",
@@ -2250,6 +2265,11 @@
2250
2265
  "types": "./dist/releases/github-listing.d.ts",
2251
2266
  "default": "./dist/releases/github-listing.js"
2252
2267
  },
2268
+ "./releases/github-retry-config": {
2269
+ "source": "./src/releases/github-retry-config.ts",
2270
+ "types": "./dist/releases/github-retry-config.d.ts",
2271
+ "default": "./dist/releases/github-retry-config.js"
2272
+ },
2253
2273
  "./releases/github-types": {
2254
2274
  "source": "./src/releases/github-types.ts",
2255
2275
  "types": "./dist/releases/github-types.d.ts",
@@ -2350,6 +2370,11 @@
2350
2370
  "types": "./dist/smol/manifest.d.ts",
2351
2371
  "default": "./dist/smol/manifest.js"
2352
2372
  },
2373
+ "./smol/path": {
2374
+ "source": "./src/smol/path.ts",
2375
+ "types": "./dist/smol/path.d.ts",
2376
+ "default": "./dist/smol/path.js"
2377
+ },
2353
2378
  "./smol/primordial": {
2354
2379
  "source": "./src/smol/primordial.ts",
2355
2380
  "types": "./dist/smol/primordial.d.ts",