@socketsecurity/lib 6.0.8 → 6.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/ai/route.d.mts +21 -8
  3. package/dist/ai/route.js +21 -6
  4. package/dist/ai/spawn.d.mts +32 -0
  5. package/dist/ai/spawn.js +91 -2
  6. package/dist/ai/types.d.mts +10 -0
  7. package/dist/bin/prim.cjs +18797 -13627
  8. package/dist/bin/resolve.js +1 -1
  9. package/dist/cache/ttl/store.js +1 -1
  10. package/dist/compression/brotli.js +1 -1
  11. package/dist/compression/gzip.js +1 -1
  12. package/dist/config/layers.d.ts +53 -0
  13. package/dist/config/layers.js +83 -0
  14. package/dist/constants/socket.js +1 -1
  15. package/dist/debug/caller-info.js +1 -1
  16. package/dist/dlx/binary-cache.js +1 -1
  17. package/dist/dlx/binary-resolution.js +1 -1
  18. package/dist/dlx/firewall.js +1 -1
  19. package/dist/dlx/lockfile.js +1 -1
  20. package/dist/eco/npm/npm/parse-lockfile.js +1 -1
  21. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +1 -1
  22. package/dist/env/rewire.d.ts +5 -3
  23. package/dist/env/rewire.js +6 -7
  24. package/dist/env/xdg.d.ts +17 -0
  25. package/dist/env/xdg.js +21 -1
  26. package/dist/errors/stack.js +1 -2
  27. package/dist/external/@npmcli/package-json.js +3455 -4881
  28. package/dist/external/@yarnpkg/extensions.js +1 -1
  29. package/dist/external/external-pack.js +1 -1
  30. package/dist/external/npm-pack.js +29164 -31799
  31. package/dist/external/tar-fs.js +63 -16
  32. package/dist/external-tools/jre/detect-platform-arch.js +1 -1
  33. package/dist/external-tools/manifest.js +1 -1
  34. package/dist/external-tools/python/asset-names.js +1 -1
  35. package/dist/external-tools/python/uv-install.d.ts +89 -0
  36. package/dist/external-tools/python/uv-install.js +165 -0
  37. package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
  38. package/dist/external-tools/skillspector/from-uv.js +56 -0
  39. package/dist/external-tools/skillspector/resolve.d.ts +18 -3
  40. package/dist/external-tools/skillspector/resolve.js +21 -8
  41. package/dist/external-tools/skillspector/types.d.ts +3 -1
  42. package/dist/external-tools/uv/asset-names.d.ts +36 -0
  43. package/dist/external-tools/uv/asset-names.js +73 -0
  44. package/dist/external-tools/uv/from-download.d.ts +17 -0
  45. package/dist/external-tools/uv/from-download.js +50 -0
  46. package/dist/external-tools/uv/from-path.d.ts +5 -0
  47. package/dist/external-tools/uv/from-path.js +22 -0
  48. package/dist/external-tools/uv/from-vfs.d.ts +7 -0
  49. package/dist/external-tools/uv/from-vfs.js +26 -0
  50. package/dist/external-tools/uv/resolve.d.ts +25 -0
  51. package/dist/external-tools/uv/resolve.js +61 -0
  52. package/dist/external-tools/uv/types.d.ts +24 -0
  53. package/dist/external-tools/uv/types.js +2 -0
  54. package/dist/fleet/repo-config.d.ts +53 -0
  55. package/dist/fleet/repo-config.js +79 -0
  56. package/dist/fs/allowed-dirs-cache.js +3 -5
  57. package/dist/fs/copy.d.ts +88 -0
  58. package/dist/fs/copy.js +89 -0
  59. package/dist/fs/safe.js +1 -1
  60. package/dist/git/_internal.js +2 -2
  61. package/dist/github/refs.js +10 -15
  62. package/dist/globs/_internal.js +1 -1
  63. package/dist/http-request/browser.js +1 -1
  64. package/dist/http-request/checksum-file.js +1 -1
  65. package/dist/http-request/headers.js +1 -1
  66. package/dist/integrity.d.ts +125 -78
  67. package/dist/integrity.js +168 -84
  68. package/dist/logger/colors.d.ts +1 -2
  69. package/dist/logger/colors.js +2 -2
  70. package/dist/logger/symbols-builder.js +7 -8
  71. package/dist/logger/symbols.js +8 -8
  72. package/dist/node/module.d.ts +73 -2
  73. package/dist/node/module.js +97 -12
  74. package/dist/objects/predicates.js +1 -1
  75. package/dist/packages/exports.js +2 -2
  76. package/dist/packages/isolation.js +1 -1
  77. package/dist/packages/manifest.d.ts +29 -0
  78. package/dist/packages/manifest.js +38 -2
  79. package/dist/packages/normalize.js +1 -1
  80. package/dist/packages/provenance.js +2 -2
  81. package/dist/packages/specs.js +1 -1
  82. package/dist/paths/_internal.d.ts +1 -7
  83. package/dist/paths/_internal.js +9 -15
  84. package/dist/paths/conversion.js +1 -1
  85. package/dist/paths/normalize.js +1 -1
  86. package/dist/paths/predicates.js +2 -1
  87. package/dist/paths/socket.d.ts +74 -23
  88. package/dist/paths/socket.js +97 -23
  89. package/dist/perf/metrics.js +1 -1
  90. package/dist/perf/report.js +1 -1
  91. package/dist/regexps/spec.js +1 -1
  92. package/dist/schema/validate.js +1 -1
  93. package/dist/secrets/broker.d.ts +35 -0
  94. package/dist/secrets/broker.js +72 -0
  95. package/dist/secrets/find.d.ts +6 -4
  96. package/dist/secrets/find.js +15 -1
  97. package/dist/secrets/rc.js +1 -1
  98. package/dist/smol/detect.js +1 -1
  99. package/dist/smol/http.js +1 -1
  100. package/dist/smol/https.js +1 -1
  101. package/dist/smol/manifest.js +1 -1
  102. package/dist/smol/path.js +1 -1
  103. package/dist/smol/primordial.js +1 -1
  104. package/dist/smol/purl.js +1 -1
  105. package/dist/smol/versions.js +1 -1
  106. package/dist/smol/vfs.js +1 -1
  107. package/dist/sorts/_internal.d.ts +1 -2
  108. package/dist/sorts/_internal.js +2 -6
  109. package/dist/sorts/semver.js +2 -2
  110. package/dist/spinner/create-spinner-class.js +1 -1
  111. package/dist/stdio/progress.js +1 -1
  112. package/dist/stdio/prompts.d.ts +0 -8
  113. package/dist/stdio/prompts.js +10 -23
  114. package/dist/strings/format.js +1 -1
  115. package/dist/strings/search.js +1 -1
  116. package/dist/themes/context.d.ts +5 -3
  117. package/dist/themes/context.js +5 -6
  118. package/llms.txt +750 -0
  119. package/package.json +79 -13
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_constants_platform = require('../constants/platform.js');
5
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_constants_platform = require('../constants/platform.js');
6
6
  const require_paths_normalize = require('../paths/normalize.js');
7
7
  const require_node_fs = require('../node/fs.js');
8
8
  const require_node_path = require('../node/path.js');
@@ -2,9 +2,9 @@
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_string = require('../../primordials/string.js');
5
6
  const require_primordials_math = require('../../primordials/math.js');
6
7
  const require_primordials_map_set = require('../../primordials/map-set.js');
7
- const require_primordials_string = require('../../primordials/string.js');
8
8
  const require_primordials_regexp = require('../../primordials/regexp.js');
9
9
  const require_primordials_date = require('../../primordials/date.js');
10
10
  const require_primordials_json = require('../../primordials/json.js');
@@ -4,8 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_primordials_buffer = require('../primordials/buffer.js');
6
6
  const require_primordials_error = require('../primordials/error.js');
7
- const require_primordials_map_set = require('../primordials/map-set.js');
8
7
  const require_primordials_string = require('../primordials/string.js');
8
+ const require_primordials_map_set = require('../primordials/map-set.js');
9
9
  const require_fs_safe = require('../fs/safe.js');
10
10
  const require_compression__internal = require('./_internal.js');
11
11
  let node_fs = require("node:fs");
@@ -4,8 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_primordials_buffer = require('../primordials/buffer.js');
6
6
  const require_primordials_error = require('../primordials/error.js');
7
- const require_primordials_map_set = require('../primordials/map-set.js');
8
7
  const require_primordials_string = require('../primordials/string.js');
8
+ const require_primordials_map_set = require('../primordials/map-set.js');
9
9
  const require_fs_safe = require('../fs/safe.js');
10
10
  const require_compression__internal = require('./_internal.js');
11
11
  let node_fs = require("node:fs");
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @file Read a layered config — a base config that higher layers may override
3
+ * or extend. Generic over the layer directories, the base name, and the file
4
+ * extension: `readConfigLayers('vitest', { dirs: ['.config/base',
5
+ * '.config/local'] })` reads each `<dir>/vitest.json` in precedence order and
6
+ * returns the layers that exist. Callers apply their own merge, because merge
7
+ * policy varies (a denylist unions all layers; an allowlist takes the highest
8
+ * layer that declares one; an array key concatenates). `mergeConfigArray`
9
+ * covers the concat case across any number of layers. No fleet knowledge
10
+ * lives here — the fleet-convention `.config/fleet` + `.config/repo` wrapper
11
+ * is `fleet/repo-config`'s `resolveRepoConfig`, a thin layer over this
12
+ * reader.
13
+ */
14
+ export interface ReadConfigLayersOptions {
15
+ dirs: readonly string[];
16
+ rootDir?: string | undefined;
17
+ cwd?: string | undefined;
18
+ ext?: string | undefined;
19
+ }
20
+ /**
21
+ * Concatenate one array-valued key across all layers — the common merge for a
22
+ * list that higher layers EXTEND rather than replace (e.g. extra exclude
23
+ * globs). Layers contribute in precedence order; a non-array value for the key
24
+ * (or a missing key, or an `undefined` layer) contributes nothing.
25
+ *
26
+ * @param layers - The layers from `readConfigLayers` (or any object array).
27
+ * @param key - The array-valued property to concatenate.
28
+ *
29
+ * @returns Each layer's entries in order; `[]` when no layer has the array.
30
+ */
31
+ export declare function mergeConfigArray<T extends Record<string, unknown>, K extends keyof T>(layers: ReadonlyArray<T | undefined>, key: K): Array<T[K] extends Array<infer E> ? E : never>;
32
+ /**
33
+ * Read a named config from an ordered list of layer directories.
34
+ *
35
+ * For each dir in `dirs`, reads `<rootDir>/<dir>/<name><ext>`; layers that are
36
+ * absent or unparseable are skipped (never throws — config reads are
37
+ * best-effort). The returned array preserves `dirs` order (lowest precedence
38
+ * first), so the last element is the highest-precedence layer present.
39
+ *
40
+ * @example
41
+ * ;```typescript
42
+ * const layers = readConfigLayers<VitestConfig>('vitest', {
43
+ * dirs: ['.config/base', '.config/team', '.config/local'],
44
+ * })
45
+ * // layers === every one of those that existed, in that order
46
+ * ```
47
+ *
48
+ * @param name - Base name of the config file (no directory, no extension).
49
+ * @param options - Layer dirs + resolution options.
50
+ *
51
+ * @returns Parsed layers in precedence order; empty when none exist.
52
+ */
53
+ export declare function readConfigLayers<T = unknown>(name: string, options: ReadConfigLayersOptions): T[];
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_node_path = require('../node/path.js');
5
+ const require_fs_read_json = require('../fs/read-json.js');
6
+ const require_primordials_process = require('../primordials/process.js');
7
+ const require_git_repo = require('../git/repo.js');
8
+
9
+ //#region src/config/layers.ts
10
+ /**
11
+ * @file Read a layered config — a base config that higher layers may override
12
+ * or extend. Generic over the layer directories, the base name, and the file
13
+ * extension: `readConfigLayers('vitest', { dirs: ['.config/base',
14
+ * '.config/local'] })` reads each `<dir>/vitest.json` in precedence order and
15
+ * returns the layers that exist. Callers apply their own merge, because merge
16
+ * policy varies (a denylist unions all layers; an allowlist takes the highest
17
+ * layer that declares one; an array key concatenates). `mergeConfigArray`
18
+ * covers the concat case across any number of layers. No fleet knowledge
19
+ * lives here — the fleet-convention `.config/fleet` + `.config/repo` wrapper
20
+ * is `fleet/repo-config`'s `resolveRepoConfig`, a thin layer over this
21
+ * reader.
22
+ */
23
+ /**
24
+ * Concatenate one array-valued key across all layers — the common merge for a
25
+ * list that higher layers EXTEND rather than replace (e.g. extra exclude
26
+ * globs). Layers contribute in precedence order; a non-array value for the key
27
+ * (or a missing key, or an `undefined` layer) contributes nothing.
28
+ *
29
+ * @param layers - The layers from `readConfigLayers` (or any object array).
30
+ * @param key - The array-valued property to concatenate.
31
+ *
32
+ * @returns Each layer's entries in order; `[]` when no layer has the array.
33
+ */
34
+ function mergeConfigArray(layers, key) {
35
+ const out = [];
36
+ for (let i = 0, { length } = layers; i < length; i += 1) {
37
+ const value = layers[i]?.[key];
38
+ if (Array.isArray(value)) out.push(...value);
39
+ }
40
+ return out;
41
+ }
42
+ /**
43
+ * Read a named config from an ordered list of layer directories.
44
+ *
45
+ * For each dir in `dirs`, reads `<rootDir>/<dir>/<name><ext>`; layers that are
46
+ * absent or unparseable are skipped (never throws — config reads are
47
+ * best-effort). The returned array preserves `dirs` order (lowest precedence
48
+ * first), so the last element is the highest-precedence layer present.
49
+ *
50
+ * @example
51
+ * ;```typescript
52
+ * const layers = readConfigLayers<VitestConfig>('vitest', {
53
+ * dirs: ['.config/base', '.config/team', '.config/local'],
54
+ * })
55
+ * // layers === every one of those that existed, in that order
56
+ * ```
57
+ *
58
+ * @param name - Base name of the config file (no directory, no extension).
59
+ * @param options - Layer dirs + resolution options.
60
+ *
61
+ * @returns Parsed layers in precedence order; empty when none exist.
62
+ */
63
+ function readConfigLayers(name, options) {
64
+ const opts = {
65
+ __proto__: null,
66
+ ...options
67
+ };
68
+ const path = require_node_path.getNodePath();
69
+ const cwd = opts.cwd ?? require_primordials_process.processCwd();
70
+ const rootDir = opts.rootDir ?? require_git_repo.findGitRoot(cwd);
71
+ const file = `${name}${opts.ext ?? ".json"}`;
72
+ const layers = [];
73
+ const { dirs } = opts;
74
+ for (let i = 0, { length } = dirs; i < length; i += 1) {
75
+ const value = require_fs_read_json.readJsonSync(path.join(rootDir, dirs[i], file), { throws: false });
76
+ if (value !== void 0) layers.push(value);
77
+ }
78
+ return layers;
79
+ }
80
+
81
+ //#endregion
82
+ exports.mergeConfigArray = mergeConfigArray;
83
+ exports.readConfigLayers = readConfigLayers;
@@ -35,7 +35,7 @@ const SOCKET_DIR = {
35
35
  wheelhouse: `${"_"}wheelhouse`
36
36
  };
37
37
  const SOCKET_LIB_NAME = "@socketsecurity/lib";
38
- const SOCKET_LIB_VERSION = "6.0.8";
38
+ const SOCKET_LIB_VERSION = "6.0.9";
39
39
  const SOCKET_IPC_HANDSHAKE = "SOCKET_IPC_HANDSHAKE";
40
40
  const CACHE_SOCKET_API_DIR = "socket-api";
41
41
  const REGISTRY = "registry";
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_objects_predicates = require('../objects/predicates.js');
5
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_objects_predicates = require('../objects/predicates.js');
6
6
 
7
7
  //#region src/debug/caller-info.ts
8
8
  /**
@@ -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');
@@ -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');
@@ -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');
@@ -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');
@@ -8,7 +8,7 @@
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 * as asyncHooksModule from 'node:async_hooks';
11
+ import { getNodeAsyncHooks } from '../node/async-hooks';
12
12
  export type EnvOverrides = Map<string, string | undefined>;
13
13
  /**
14
14
  * Clear a specific environment variable override.
@@ -25,11 +25,13 @@ export type EnvOverrides = Map<string, string | undefined>;
25
25
  */
26
26
  export declare function clearEnv(key: string): void;
27
27
  /**
28
- * Lazily load the async_hooks module to avoid Webpack errors.
28
+ * Lazily load the async_hooks module. Aliases the canonical `node/async-hooks`
29
+ * accessor (single owner of the bundler-safe require); kept as an export so
30
+ * this module's surface is unchanged.
29
31
  *
30
32
  * @private
31
33
  */
32
- export declare function getAsyncHooks(): typeof asyncHooksModule;
34
+ export declare const getAsyncHooks: typeof getNodeAsyncHooks;
33
35
  /**
34
36
  * Get an environment variable value, checking overrides first.
35
37
  *
@@ -5,6 +5,7 @@ const require_runtime = require('../_virtual/_rolldown/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
10
  let node_process = require("node:process");
10
11
  node_process = require_runtime.__toESM(node_process);
@@ -20,8 +21,7 @@ node_process = require_runtime.__toESM(node_process);
20
21
  * - Compatible with vi.stubEnv() - reads from process.env as final fallback
21
22
  * - Thread-safe for concurrent test execution
22
23
  */
23
- let asyncHooks;
24
- const { AsyncLocalStorage } = getAsyncHooks();
24
+ const { AsyncLocalStorage } = require_node_async_hooks.getNodeAsyncHooks();
25
25
  const isolatedOverridesStorage = new AsyncLocalStorage();
26
26
  const sharedOverridesSymbol = Symbol.for("@socketsecurity/lib/env/rewire/test-overrides");
27
27
  const globalThisRef = globalThis;
@@ -44,14 +44,13 @@ function clearEnv(key) {
44
44
  sharedOverrides?.delete(key);
45
45
  }
46
46
  /**
47
- * Lazily load the async_hooks module to avoid Webpack errors.
47
+ * Lazily load the async_hooks module. Aliases the canonical `node/async-hooks`
48
+ * accessor (single owner of the bundler-safe require); kept as an export so
49
+ * this module's surface is unchanged.
48
50
  *
49
51
  * @private
50
52
  */
51
- function getAsyncHooks() {
52
- if (asyncHooks === void 0) asyncHooks = /*@__PURE__*/ require("node:async_hooks");
53
- return asyncHooks;
54
- }
53
+ const getAsyncHooks = require_node_async_hooks.getNodeAsyncHooks;
55
54
  /**
56
55
  * Get an environment variable value, checking overrides first.
57
56
  *
package/dist/env/xdg.d.ts CHANGED
@@ -47,3 +47,20 @@ export declare function getXdgConfigHome(): string | undefined;
47
47
  * @returns The XDG data directory path, or `undefined` if not set
48
48
  */
49
49
  export declare function getXdgDataHome(): string | undefined;
50
+ /**
51
+ * XDG_RUNTIME_DIR environment variable. XDG Base Directory specification
52
+ * runtime directory — the home for ephemeral, owner-only runtime objects
53
+ * (daemon sockets, locks). Set by systemd to `/run/user/<uid>`; absent on
54
+ * macOS and many non-systemd setups, so callers must provide a fallback.
55
+ *
56
+ * @example
57
+ * ;```typescript
58
+ * import { getXdgRuntimeDir } from '@socketsecurity/lib/env/xdg'
59
+ *
60
+ * const runtimeDir = getXdgRuntimeDir()
61
+ * // e.g. '/run/user/1000' or undefined
62
+ * ```
63
+ *
64
+ * @returns The XDG runtime directory path, or `undefined` if not set
65
+ */
66
+ export declare function getXdgRuntimeDir(): string | undefined;
package/dist/env/xdg.js CHANGED
@@ -59,8 +59,28 @@ function getXdgConfigHome() {
59
59
  function getXdgDataHome() {
60
60
  return require_env_rewire.getEnvValue("XDG_DATA_HOME");
61
61
  }
62
+ /**
63
+ * XDG_RUNTIME_DIR environment variable. XDG Base Directory specification
64
+ * runtime directory — the home for ephemeral, owner-only runtime objects
65
+ * (daemon sockets, locks). Set by systemd to `/run/user/<uid>`; absent on
66
+ * macOS and many non-systemd setups, so callers must provide a fallback.
67
+ *
68
+ * @example
69
+ * ;```typescript
70
+ * import { getXdgRuntimeDir } from '@socketsecurity/lib/env/xdg'
71
+ *
72
+ * const runtimeDir = getXdgRuntimeDir()
73
+ * // e.g. '/run/user/1000' or undefined
74
+ * ```
75
+ *
76
+ * @returns The XDG runtime directory path, or `undefined` if not set
77
+ */
78
+ function getXdgRuntimeDir() {
79
+ return require_env_rewire.getEnvValue("XDG_RUNTIME_DIR");
80
+ }
62
81
 
63
82
  //#endregion
64
83
  exports.getXdgCacheHome = getXdgCacheHome;
65
84
  exports.getXdgConfigHome = getXdgConfigHome;
66
- exports.getXdgDataHome = getXdgDataHome;
85
+ exports.getXdgDataHome = getXdgDataHome;
86
+ exports.getXdgRuntimeDir = getXdgRuntimeDir;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_errors_predicates = require('./predicates.js');
5
4
  let src_external_pony_cause = require("../external/pony-cause");
6
5
 
7
6
  //#region src/errors/stack.ts
@@ -19,7 +18,7 @@ let src_external_pony_cause = require("../external/pony-cause");
19
18
  * errorStack(e) })` safely.
20
19
  */
21
20
  function errorStack(value) {
22
- if (require_errors_predicates.isError(value)) return (0, src_external_pony_cause.stackWithCauses)(value);
21
+ if (isError(value)) return (0, src_external_pony_cause.stackWithCauses)(value);
23
22
  }
24
23
 
25
24
  //#endregion