@socketsecurity/lib 5.25.1 → 5.26.1

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 (147) hide show
  1. package/CHANGELOG.md +344 -1184
  2. package/README.md +1 -1
  3. package/dist/abort.js +7 -6
  4. package/dist/agent.js +16 -15
  5. package/dist/ansi.js +3 -2
  6. package/dist/archives.js +18 -17
  7. package/dist/argv/flags.js +29 -28
  8. package/dist/argv/parse.js +4 -3
  9. package/dist/arrays.js +3 -2
  10. package/dist/bin.js +12 -11
  11. package/dist/cacache.js +16 -11
  12. package/dist/cache-with-ttl.js +26 -21
  13. package/dist/colors.js +2 -1
  14. package/dist/constants/licenses.js +2 -1
  15. package/dist/constants/lifecycle-script-names.js +2 -1
  16. package/dist/constants/maintained-node-versions.js +2 -1
  17. package/dist/constants/node.js +4 -3
  18. package/dist/constants/package-default-socket-categories.js +2 -1
  19. package/dist/constants/packages.js +4 -3
  20. package/dist/constants/socket.js +1 -1
  21. package/dist/cover/code.js +9 -8
  22. package/dist/cover/formatters.js +12 -11
  23. package/dist/cover/type.js +5 -4
  24. package/dist/crypto.d.ts +36 -0
  25. package/dist/{effects/ultra.js → crypto.js} +33 -37
  26. package/dist/debug.js +12 -15
  27. package/dist/dlx/arborist.js +10 -9
  28. package/dist/dlx/binary.js +27 -24
  29. package/dist/dlx/cache.js +2 -10
  30. package/dist/dlx/detect.js +6 -5
  31. package/dist/dlx/integrity.js +13 -11
  32. package/dist/dlx/lockfile.js +7 -6
  33. package/dist/dlx/manifest.js +6 -5
  34. package/dist/dlx/package.js +17 -16
  35. package/dist/dlx/packages.js +6 -5
  36. package/dist/dlx/paths.d.ts +1 -1
  37. package/dist/dlx/paths.js +2 -1
  38. package/dist/effects/pulse-frames.js +4 -3
  39. package/dist/effects/shimmer-keyframes.d.ts +62 -0
  40. package/dist/effects/shimmer-keyframes.js +55 -0
  41. package/dist/effects/shimmer-terminal.d.ts +66 -0
  42. package/dist/effects/shimmer-terminal.js +57 -0
  43. package/dist/effects/shimmer.d.ts +293 -0
  44. package/dist/effects/shimmer.js +180 -0
  45. package/dist/env/rewire.js +4 -3
  46. package/dist/env.js +5 -4
  47. package/dist/errors.js +1 -1
  48. package/dist/external/@npmcli/package-json/lib/read-package.js +10 -10
  49. package/dist/external/@npmcli/package-json.js +372 -372
  50. package/dist/external/@npmcli/promise-spawn.js +24 -24
  51. package/dist/external/@socketregistry/packageurl-js.js +19 -18
  52. package/dist/external/@socketregistry/yocto-spinner.js +4 -3
  53. package/dist/external/@yarnpkg/extensions.js +2 -1
  54. package/dist/external/adm-zip.js +70 -70
  55. package/dist/external/debug.js +22 -22
  56. package/dist/external/external-pack.js +45 -45
  57. package/dist/external/fast-sort.js +5 -5
  58. package/dist/external/libnpmexec.js +4 -3
  59. package/dist/external/npm-pack.js +369 -369
  60. package/dist/external/p-map.js +9 -9
  61. package/dist/external/pico-pack.js +190 -190
  62. package/dist/external/pony-cause.js +2 -1
  63. package/dist/external/spdx-pack.js +11 -10
  64. package/dist/external/tar-fs.js +58 -58
  65. package/dist/external/which.js +13 -13
  66. package/dist/external/yargs-parser.js +71 -71
  67. package/dist/fs.js +19 -23
  68. package/dist/git.js +14 -13
  69. package/dist/github.d.ts +34 -0
  70. package/dist/github.js +248 -23
  71. package/dist/globs.d.ts +20 -0
  72. package/dist/globs.js +134 -25
  73. package/dist/http-request.d.ts +4 -3
  74. package/dist/http-request.js +39 -32
  75. package/dist/ipc-cli.js +2 -1
  76. package/dist/ipc.js +5 -4
  77. package/dist/json/edit.js +4 -3
  78. package/dist/json/format.js +3 -2
  79. package/dist/json/parse.js +7 -6
  80. package/dist/links.js +2 -1
  81. package/dist/logger.js +21 -14
  82. package/dist/memoization.js +16 -15
  83. package/dist/objects.js +2 -2
  84. package/dist/packages/edit.js +8 -7
  85. package/dist/packages/exports.js +17 -16
  86. package/dist/packages/isolation.js +20 -13
  87. package/dist/packages/licenses.js +6 -3
  88. package/dist/packages/manifest.js +2 -1
  89. package/dist/packages/normalize.js +8 -4
  90. package/dist/packages/operations.js +5 -4
  91. package/dist/packages/provenance.js +7 -6
  92. package/dist/packages/specs.js +2 -1
  93. package/dist/packages/validation.js +2 -1
  94. package/dist/paths/normalize.js +32 -40
  95. package/dist/paths/packages.js +2 -1
  96. package/dist/paths/rewire.js +3 -2
  97. package/dist/performance.js +19 -18
  98. package/dist/primordials.d.ts +9 -0
  99. package/dist/primordials.js +17 -0
  100. package/dist/process-lock.js +14 -13
  101. package/dist/promise-queue.js +17 -9
  102. package/dist/promises.d.ts +29 -6
  103. package/dist/promises.js +19 -15
  104. package/dist/regexps.js +9 -8
  105. package/dist/releases/github-api.d.ts +56 -0
  106. package/dist/releases/github-api.js +275 -0
  107. package/dist/releases/github-archives.d.ts +60 -0
  108. package/dist/releases/github-archives.js +136 -0
  109. package/dist/releases/github-assets.d.ts +21 -0
  110. package/dist/releases/github-assets.js +52 -0
  111. package/dist/releases/github-auth.d.ts +16 -0
  112. package/dist/releases/github-auth.js +51 -0
  113. package/dist/releases/github-downloads.d.ts +42 -0
  114. package/dist/releases/github-downloads.js +155 -0
  115. package/dist/releases/github-types.d.ts +66 -0
  116. package/dist/{effects/types.js → releases/github-types.js} +2 -2
  117. package/dist/releases/socket-btm.d.ts +1 -1
  118. package/dist/releases/socket-btm.js +17 -17
  119. package/dist/schema/parse.js +2 -1
  120. package/dist/schema/validate.js +6 -5
  121. package/dist/shadow.js +2 -1
  122. package/dist/signal-exit.js +2 -2
  123. package/dist/spawn.js +45 -35
  124. package/dist/spinner.d.ts +13 -6
  125. package/dist/spinner.js +75 -57
  126. package/dist/ssri.js +8 -7
  127. package/dist/stdio/footer.js +13 -12
  128. package/dist/stdio/header.js +5 -4
  129. package/dist/stdio/progress.js +13 -12
  130. package/dist/strings.js +19 -18
  131. package/dist/suppress-warnings.js +2 -2
  132. package/dist/tables.js +16 -13
  133. package/dist/temporary-executor.js +2 -1
  134. package/dist/themes/context.js +2 -1
  135. package/dist/themes/types.d.ts +1 -1
  136. package/dist/themes/utils.d.ts +8 -3
  137. package/dist/themes/utils.js +29 -5
  138. package/dist/url.js +4 -3
  139. package/package.json +44 -20
  140. package/dist/effects/text-shimmer.d.ts +0 -58
  141. package/dist/effects/text-shimmer.js +0 -192
  142. package/dist/effects/types.d.ts +0 -47
  143. package/dist/effects/ultra.d.ts +0 -22
  144. package/dist/releases/github.d.ts +0 -234
  145. package/dist/releases/github.js +0 -417
  146. package/dist/themes/index.d.ts +0 -49
  147. package/dist/themes/index.js +0 -60
package/CHANGELOG.md CHANGED
@@ -5,1573 +5,1002 @@ 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
+ ## [5.26.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.26.1) - 2026-05-01
9
+
10
+ ### Added
11
+
12
+ - `crypto` (new export) — `hash(algorithm, data, encoding)` one-shot helper that prefers Node's native `crypto.hash` (added v21.7.0 / v20.12.0; ~30% faster than `createHash().update().digest()` on small inputs) with a streaming fallback. `getNativeHash` exposed as `@internal` for tests
13
+ - `promises` `fromAsync<T>(source)` — drains an async iterable into an array, per [TC39 Array.fromAsync](https://tc39.es/proposal-array-from-async/). Backed by the new `ArrayFromAsync` primordial (Node 22+) with a `for await` + push fallback
14
+ - `primordials` `ArrayFromAsync` — ES2024 primordial. Unbound, matching `ArrayFrom`
15
+ - `globs` `glob` / `globSync` route through `node:fs.glob` / `node:fs.globSync` (Node 22+) when caller options reduce to `cwd` + `ignore` (mapped to `exclude`); fall back to fast-glob for the wider option surface. Output paths are normalized to forward slashes on Windows to match fast-glob's contract
16
+ - `effects/shimmer` — pure-functional shimmer engine
17
+ - `effects/shimmer-terminal` — terminal (ANSI) renderer for the engine
18
+ - `effects/shimmer-keyframes` — SVG keyframe batcher for the engine
19
+ - `releases/github-types`, `github-assets`, `github-auth`, `github-api`, `github-downloads`, `github-archives` — six focused submodules replacing the single `releases/github` export
20
+
21
+ ### Changed
22
+
23
+ - `http-request` retry/backoff sites use `setTimeout` from `node:timers/promises` instead of hand-rolled `new Promise(r => setTimeout(r, ms))`
24
+ - `dlx/cache`, `dlx/integrity`, `dlx/binary` — 4 one-shot hash sites switched to the new `crypto.hash()` helper
25
+ - `package.json` — pin `publishConfig: {access: "public", provenance: true}` so attestation is a property of the package, not a property of the workflow's `--provenance` CLI flag. Survives any direct-publish path that bypasses `provenance.yml`. `access: "public"` also load-bears for first-publish of `@scoped` packages on a fresh npm registry session.
26
+ - `promise-queue.runNext` — replace the `PromiseResolve().then().catch().finally()` chain with an async IIFE + try/catch/finally. Same semantics (defers `task.fn()` by one microtask so synchronous throws become rejections), more explicit about the success/error/cleanup flow.
27
+ - `packages/isolation.resolveRealPath` — replace `realpath().catch(fallback)` with try/await/catch. Same fall-back-on-ENOENT behavior, clearer that the catch is intentional.
28
+ - **BREAKING**: `spinner` `ShimmerInfo` shape — `{ direction, speed, frame }` (was: `currentDir`, `mode`, `speed`, `step`). User-facing `ShimmerConfig` is unchanged
29
+ - `getLatestRelease` / `getReleaseAssetUrl` return `undefined` (was: `null`) when no result is found, and no longer log on success/retry — errors throw, success returns
30
+
31
+ ### Removed
32
+
33
+ - **BREAKING**: `effects/text-shimmer`, `effects/ultra`, `effects/types` subpath exports. Migrate to `effects/shimmer` (+ `effects/shimmer-terminal`); `RAINBOW_GRADIENT` now lives in `themes/utils`
34
+ - **BREAKING**: `themes` barrel export. Import from `themes/themes`, `themes/context`, `themes/utils`, or `themes/types`
35
+ - **BREAKING**: `releases/github` subpath export. Migrate to the focused submodules (see Added)
36
+ - `getLatestRelease({ quiet })` / `getReleaseAssetUrl({ quiet })` — the helpers no longer log
37
+
38
+ ### Fixed
39
+
40
+ - `globs` `getGlobMatcher` — narrow the `path.matchesGlob` fast-path that an earlier draft introduced. `path.matchesGlob` doesn't honor the picomatch defaults (`dot: true`, `nocase: true`) that callers expect, so taking the fast-path under those defaults silently changed observable behavior — including breaking the case-insensitive default everywhere a single-pattern matcher was used. The fast-path now activates only when the caller has explicitly opted out of both defaults (`nocase: false` AND `dot: false`), signaling "I want strict, case-sensitive, no-dotfile-match" — exactly what `path.matchesGlob` provides
41
+ - `globs` `glob` / `globSync` — normalize results to forward slashes via `paths/normalize.normalizePath` regardless of which backend (`node:fs.glob` or `fast-glob`) was used. Restores fast-glob's forward-slash contract on Windows, where `node:fs.glob` returns native-OS separators
42
+ - `globs` `glob` / `globSync` / `globStreamLicenses` — strip a trailing `/` from `ignore` patterns before passing them to fast-glob. The gitignore convention of writing directory entries as `dist/` was silently dropped at the deep-filter level (fast-glob walked the entire subtree before discarding results), which on a large `dist/` could push memory past the limit. fast-glob v3.3.3 and the unreleased v4 both have the bug; tracked at [mrmlnc/fast-glob#437](https://github.com/mrmlnc/fast-glob/issues/437). Same workaround as [SocketDev/socket-cli#1288](https://github.com/SocketDev/socket-cli/pull/1288).
43
+ - `releases/github-api` `getLatestRelease` and `getReleaseAssetUrl` transparently fall back to GraphQL when GitHub REST returns 200 + empty body (search-degraded incident shape)
44
+ - `github` `resolveRefToSha` and `fetchGhsaDetails` get the same GraphQL fallback for the same incident shape
45
+ - All fallbacks only fire on the empty-body signature; real 404s, rate-limits, and 5xx still propagate
46
+
47
+ ## [5.26.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.26.0) - 2026-04-27
48
+
49
+ ### Added
50
+
51
+ - `github` `GitHubEmptyBodyError` — exported error class for GitHub's "search degraded" 200 OK + empty body incident shape
52
+ - `nothrow` option on `getLatestRelease` and `getReleaseAssetUrl` — return `undefined` instead of throwing when both REST and GraphQL backends are degraded
53
+
54
+ ### Changed
55
+
56
+ - `getLatestRelease` / `getReleaseAssetUrl` return `undefined` (was: `null`) when no result is found, and no longer log on success/retry — errors throw, success returns
57
+ - `fetchGhsaDetails` GraphQL fallback normalizes severity to lowercase to match REST shape
58
+
59
+ ### Removed
60
+
61
+ - `getLatestRelease({ quiet })` / `getReleaseAssetUrl({ quiet })` — no longer accepted (the helpers don't log anymore)
62
+
63
+ ### Fixed
64
+
65
+ - `releases/github` `getLatestRelease` and `getReleaseAssetUrl` fall back to GraphQL on the empty-body incident shape
66
+ - `github` `resolveRefToSha` and `fetchGhsaDetails` get the same GraphQL fallback
67
+ - All fallbacks fire only on `GitHubEmptyBodyError`; real 404s / rate-limits / 5xx still propagate
68
+
8
69
  ## [5.25.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.25.1) - 2026-04-27
9
70
 
10
71
  ### Fixed
11
72
 
12
- - `@socketsecurity/lib/primordials` `StringPrototypeReplace` / `StringPrototypeReplaceAll` — `replaceValue` parameter now accepts the callback form (`(substring, ...args) => string`) in addition to a literal string, matching `String.prototype.replace`'s actual signature
73
+ - `primordials` `StringPrototypeReplace` / `StringPrototypeReplaceAll` — `replaceValue` accepts the callback form, matching `String.prototype.replace`
13
74
 
14
75
  ## [5.25.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.25.0) - 2026-04-26
15
76
 
16
77
  ### Added
17
78
 
18
- - `@socketsecurity/lib/primordials` — new public module exposing safe references to ~100 built-in constructors, static methods, and prototype methods captured at module-load time. Mirrors the Node.js-internal primordials convention: static methods retain their name (`ObjectKeys`, `ArrayIsArray`, `JSONParse`, `ReflectApply`); prototype methods are uncurried via `uncurryThis` (`StringPrototypeSlice(str, 0, 3)` instead of `str.slice(0, 3)`); constructors get a `Ctor` suffix (`MapCtor`, `SetCtor`, `ErrorCtor`, …) to avoid shadowing the capital-case global. Library internals migrated to use these helpers so prototype-pollution attacks on the caller realm can't redirect them. Surface includes `Function`, `Math`, and the full Error subclass set (`TypeErrorCtor`, `RangeErrorCtor`, `SyntaxErrorCtor`, `ReferenceErrorCtor`, `URIErrorCtor`, `EvalErrorCtor`, `AggregateErrorCtor`) after audit-driven coverage passes
79
+ - `primordials` — public module exposing ~100 safe references to built-in constructors, static methods, and prototype methods captured at load time. Static methods keep their name (`ObjectKeys`, `JSONParse`); prototype methods are uncurried (`StringPrototypeSlice(str, 0, 3)`); constructors use a `Ctor` suffix (`MapCtor`, `ErrorCtor`)
19
80
 
20
81
  ## [5.24.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.24.0) - 2026-04-22
21
82
 
22
83
  ### Removed
23
84
 
24
- - `@socketsecurity/lib/env/socket-cli-shadow` — deleted. Unused after Socket CLI's shadow infrastructure was removed
85
+ - `env/socket-cli-shadow` — deleted (unused)
25
86
 
26
87
  ### Fixed
27
88
 
28
- - `packPackage()` / `extractPackage()` now work for non-registry specs (local dir/tarball, remote tarball URL, git). The bundled pacote fetchers (`dir.js`, `file.js`, `remote.js`, `git.js`) were over-stubbed and broke every non-registry path
29
- - `EditablePackageJson.prepare()` no longer throws `git.find is not a function`. `@npmcli/git` is reached from `normalize.gitHead`, not just `arb.audit()`, so it can't be stubbed
30
- - `packPackage(<dir>)` now runs `prepack` / `postpack` scripts instead of throwing `runScript is not a function`. `@npmcli/run-script` is reachable whenever `ignoreScripts` isn't set
89
+ - `packPackage()` / `extractPackage()` work for non-registry specs (local dir/tarball, remote tarball, git)
90
+ - `EditablePackageJson.prepare()` no longer throws `git.find is not a function`
91
+ - `packPackage(<dir>)` runs `prepack` / `postpack` scripts instead of throwing
31
92
 
32
93
  ## [5.23.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.23.0) - 2026-04-22
33
94
 
34
95
  ### Added
35
96
 
36
- - `@socketsecurity/lib/errors` `isError(value)` — spec-compliant ES2025 [`Error.isError`](https://tc39.es/ecma262/#sec-error.iserror) with an `@@toStringTag`-based shim for older engines. Recognizes cross-realm Errors (worker threads, vm contexts, iframes) that same-realm `instanceof Error` misses
37
- - `@socketsecurity/lib/errors` `errorMessage(value)` — extracts a readable message from any caught value (Error with cause chain via `messageWithCauses`, primitive, plain object, or nullish) with the shared `UNKNOWN_ERROR` (`'Unknown error'`) fallback. Replaces the `e instanceof Error ? e.message : String(e)` pattern
38
- - `@socketsecurity/lib/errors` `errorStack(value)` — companion helper returning the cause-aware stack for Error instances (via `stackWithCauses`) and `undefined` otherwise
39
- - `@socketsecurity/lib/errors` `isErrnoException(value)` — narrows to `NodeJS.ErrnoException` (an Error with a non-empty uppercase-prefixed `.code`, matching the libuv `UV_E*` / Node `ERR_*` conventions), cross-realm safe
40
- - `@socketsecurity/lib/errors` re-exports `UNKNOWN_ERROR` from `constants/core` so callers don't need a separate import
97
+ - `errors` `isError(value)` — spec-compliant ES2025 [`Error.isError`](https://tc39.es/ecma262/#sec-error.iserror), cross-realm safe
98
+ - `errors` `errorMessage(value)` — readable message from any caught value (Error, primitive, object, nullish) with cause-chain support
99
+ - `errors` `errorStack(value)` — cause-aware stack or `undefined`
100
+ - `errors` `isErrnoException(value)` — narrows to `NodeJS.ErrnoException`, cross-realm safe
101
+ - `errors` re-exports `UNKNOWN_ERROR`
41
102
 
42
103
  ### Changed
43
104
 
44
- - `@socketsecurity/lib/errors` pony-cause `messageWithCauses` / `stackWithCauses` / `findCauseByReference` / `getErrorCause` — patched to use `isError` internally so cross-realm Errors are recognized (previously returned `''` for any Error thrown in a different realm)
105
+ - pony-cause `messageWithCauses` / `stackWithCauses` / `findCauseByReference` / `getErrorCause` use `isError` internally cross-realm Errors are recognized (previously returned `''`)
45
106
 
46
107
  ## [5.22.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.22.0) - 2026-04-21
47
108
 
48
109
  ### Changed
49
110
 
50
- - `@socketsecurity/lib/releases/socket-btm` `getPlatformArch()` / `getBinaryAssetName()` — aligned with pnpm pack-app's `<os>-<arch>[-<libc>]` target format. The Windows OS segment is now `win32` (was `win`); `getPlatformArch('win32', 'x64')` returns `'win32-x64'` and `getBinaryAssetName('node', 'win32', 'x64')` returns `'node-win32-x64.exe'`. Callers that string-match on the output need updates
111
+ - `releases/socket-btm` `getPlatformArch()` / `getBinaryAssetName()` — aligned with pnpm pack-app's `<os>-<arch>[-<libc>]` format. Windows OS segment is now `win32` (was `win`)
51
112
 
52
113
  ## [5.21.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.21.0) - 2026-04-20
53
114
 
54
115
  ### Added
55
116
 
56
- - `@socketsecurity/lib/schema/validate` — non-throwing Zod/TypeBox validator returning `{ ok, value } | { ok, errors }` with normalized paths
57
- - `@socketsecurity/lib/schema/parse` — throwing variant for fail-fast trust boundaries
58
- - `@socketsecurity/lib/schema/types` — `Schema<T>`, `ValidateResult<T>`, `ValidationIssue`, `AnySchema`, `Infer<S>`
59
- - `@socketsecurity/lib/promises` `withResolvers()` — spec-compliant [`Promise.withResolvers`](https://tc39.es/ecma262/#sec-promise.withResolvers) helper with `PromiseWithResolvers<T>` type. Uses the native implementation when available
117
+ - `schema/validate` — non-throwing Zod/TypeBox validator returning `{ ok, value } | { ok, errors }`
118
+ - `schema/parse` — throwing variant for fail-fast trust boundaries
119
+ - `schema/types` — `Schema<T>`, `ValidateResult<T>`, `ValidationIssue`, `AnySchema`, `Infer<S>`
120
+ - `promises` `withResolvers()` — spec-compliant [`Promise.withResolvers`](https://tc39.es/ecma262/#sec-promise.withResolvers); uses native when available
60
121
 
61
122
  ### Changed
62
123
 
63
- - `@socketsecurity/lib/regexps` `escapeRegExp()` — now spec-compliant with TC39 [`RegExp.escape`](https://tc39.es/ecma262/#sec-regexp.escape); uses the native implementation when available. **Caller-visible shape change**: escaped output now uses `\xHH` for many characters that previously passed through literally (e.g. `escapeRegExp('a')` is now `'\x61'`). Functional equivalence (the compiled regex matches the original input) is preserved; only callers that string-match on escape output need updates
64
- - `@socketsecurity/lib/memoization` `MemoizeOptions<Args>` — dropped the unused second type parameter. Consumers who wrote `MemoizeOptions<Args, Result>` must drop the second argument
65
- - `@socketsecurity/lib/packages/specs` `getRepoUrlDetails()` — now accepts `git+https://` / `git+ssh://` GitHub URLs and rejects lookalike hosts (`githubXcom`, `fake-github.com.attacker.tld`). scp-style `git@github.com:…` URLs (no `://`) now return `{ user: '', project: '' }` — callers must normalize to https/ssh upstream
66
- - `@socketsecurity/lib/url` `urlSearchParamAsBoolean()` — accepts the same truthy vocabulary as `envAsBoolean` (`1` / `true` / `yes` / `on`, case-insensitive). Empty-string input now falls through to `defaultValue` instead of returning `false`
124
+ - `regexps` `escapeRegExp()` — now spec-compliant with TC39 [`RegExp.escape`](https://tc39.es/ecma262/#sec-regexp.escape). **Output shape changed**: many characters now escape to `\xHH` (e.g. `'a'` `'\x61'`); compiled regex behavior is preserved
125
+ - `memoization` `MemoizeOptions<Args>` — dropped unused second type parameter
126
+ - `packages/specs` `getRepoUrlDetails()` — accepts `git+https://` / `git+ssh://` GitHub URLs; rejects lookalike hosts. scp-style `git@github.com:…` returns `{ user: '', project: '' }`
127
+ - `url` `urlSearchParamAsBoolean()` — accepts the same truthy vocabulary as `envAsBoolean` (`1` / `true` / `yes` / `on`); empty string falls through to `defaultValue`
67
128
 
68
129
  ### Removed
69
130
 
70
- - `@socketsecurity/lib/validation/*` subpath retired — exports re-homed:
71
- - `validateSchema` / `parseSchema` `@socketsecurity/lib/schema/validate` / `@socketsecurity/lib/schema/parse`
72
- - `safeJsonParse` → `@socketsecurity/lib/json/parse`
73
- - Types → `@socketsecurity/lib/schema/types` and `@socketsecurity/lib/json/types`
74
- - `memoizeDebounced` from `@socketsecurity/lib/memoization` — was misnamed and had no consumers. Use `memoize` / `memoizeAsync` with a `ttl` instead
131
+ - `validation/*` subpath retired — exports re-homed: `validateSchema` / `parseSchema` → `schema/validate` / `schema/parse`; `safeJsonParse` → `json/parse`; types → `schema/types` and `json/types`
132
+ - `memoization` `memoizeDebounced` use `memoize` / `memoizeAsync` with a `ttl` instead
75
133
 
76
134
  ### Fixed
77
135
 
78
- - `@socketsecurity/lib/versions` `maxVersion()` / `minVersion()` — return the latest/earliest prerelease for all-prerelease inputs (previously returned `undefined`)
79
- - `@socketsecurity/lib/fs` `findUp()` / `findUpSync()` — traverse up to and **including** the filesystem root (previously missed matches at `/.foo`)
80
- - `@socketsecurity/lib/words` `capitalize()` — safe for non-BMP characters (emoji, astral-plane scripts); previously produced broken surrogate pairs
81
- - `@socketsecurity/lib/words` `determineArticle()` — case-insensitive vowel match (`Apple` → `an Apple`)
82
- - `@socketsecurity/lib/archives` `extractZip()` / `extractTar()` / `extractTarGz()` — missing-archive errors now uniformly surface as `ENOENT` with `code` / `path` / message (previously `extractZip` surfaced adm-zip's generic `"Invalid filename"`)
83
- - `@socketsecurity/lib/promise-queue` — bounded queue now rejects the newest submission when full, preserving in-flight work
84
- - `@socketsecurity/lib/cacache` / `@socketsecurity/lib/cache-with-ttl` — wildcard key deletion anchors both ends of the pattern (`deleteAll('foo*bar')` no longer sweeps `foo123bar-extra`)
85
- - `@socketsecurity/lib/process-lock` — sub-second `staleMs` values now honored at full precision; TOCTOU window on lock acquisition closed
86
- - `@socketsecurity/lib/suppress-warnings` `withSuppressedWarnings()` — no longer wipes concurrent suppressions on exit
87
- - Unbounded LRU caches in `@socketsecurity/lib/dlx` capped (binary path, package.json path); negative package.json lookups now expire after 10s
88
- - Glob cache keys for array-valued options (e.g. `ignore`) are order-insensitive
136
+ - `versions` `maxVersion()` / `minVersion()` — return latest/earliest prerelease for all-prerelease inputs
137
+ - `fs` `findUp()` / `findUpSync()` — traverse up to and including the filesystem root
138
+ - `words` `capitalize()` — safe for non-BMP characters (emoji, astral-plane scripts)
139
+ - `words` `determineArticle()` — case-insensitive vowel match
140
+ - `archives` `extractZip` / `extractTar` / `extractTarGz` — missing-archive errors uniformly surface as `ENOENT`
141
+ - `promise-queue` — bounded queue rejects newest submission when full, preserving in-flight work
142
+ - `cacache` / `cache-with-ttl` — wildcard key deletion anchors both ends of the pattern
143
+ - `process-lock` — sub-second `staleMs` values honored at full precision; TOCTOU window on acquisition closed
144
+ - `suppress-warnings` `withSuppressedWarnings()` — no longer wipes concurrent suppressions on exit
145
+ - `dlx` LRU caches capped (binary path, package.json path); negative package.json lookups expire after 10s
146
+ - Glob cache keys for array-valued options are order-insensitive
89
147
 
90
148
  ### Performance
91
149
 
92
- - `@socketsecurity/lib/memoization` — `memoize()` / `memoizeAsync()` cache-hit bookkeeping dropped from O(n) to O(1). Noticeable on caches with many entries
93
- - `@socketsecurity/lib/cacache` wildcard `clear()` no longer recompiles the match regex per streamed entry
150
+ - `memoization` cache-hit bookkeeping is now O(1) (was O(n))
151
+ - `cacache` wildcard `clear()` no longer recompiles the match regex per entry
94
152
 
95
153
  ## [5.20.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.20.1) - 2026-04-19
96
154
 
97
155
  ### Fixed
98
156
 
99
- - `@socketsecurity/lib/ipc` — harden stub-file writes against symlink/TOCTOU attacks on shared-tmp filesystems (POSIX ownership + mode validation, `O_EXCL | O_NOFOLLOW` open)
100
- - `@socketsecurity/lib/cache-with-ttl` `getOrFetch()` — close concurrent-caller race that let two cold-cache awaits both skip the inflight-dedupe check and fire the fetcher twice
101
- - `@socketsecurity/lib/cache-with-ttl` — cap the in-memory memo layer with LRU eviction (`memoMaxSize`, default 1000); long-running processes no longer grow unbounded
102
- - `@socketsecurity/lib/memoization` `memoizeAsync()` — refresh cache entry timestamp on resolve so slow fetches (longer than `ttl`) aren't classified as expired the moment they land
103
- - `@socketsecurity/lib/tables` — `displayWidth` now measures rendered terminal cells (via `stringWidth`) instead of UTF-16 code units; CJK / emoji / combining marks align correctly
104
- - `@socketsecurity/lib/paths/packages` — `resolvePackageJsonDirname` / `resolvePackageJsonPath` no longer mis-identify files like `/foo/my-package.json` as package manifests
105
- - `@socketsecurity/lib/json/edit` — `@example` import path corrected
157
+ - `ipc` — stub-file writes hardened against symlink/TOCTOU attacks (`O_EXCL | O_NOFOLLOW`, ownership + mode validation)
158
+ - `cache-with-ttl` `getOrFetch()` — closes concurrent-caller race that fired the fetcher twice
159
+ - `cache-with-ttl` — in-memory memo layer capped via LRU (`memoMaxSize`, default 1000)
160
+ - `memoization` `memoizeAsync()` — refreshes entry timestamp on resolve so slow fetches aren't immediately classified as expired
161
+ - `tables` — `displayWidth` measures rendered terminal cells via `stringWidth` (CJK / emoji / combining marks align correctly)
162
+ - `paths/packages` — `resolvePackageJsonDirname` / `resolvePackageJsonPath` no longer mis-identify files like `/foo/my-package.json`
106
163
 
107
164
  ## [5.20.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.20.0) - 2026-04-19
108
165
 
109
166
  ### Added
110
167
 
111
- - `@socketsecurity/lib/validation/validate-schema` — universal Zod-style schema validator with `validateSchema` (tagged result) and `parseSchema` (throwing); `Infer<S>`, `ValidateResult<T>`, `ValidationIssue`, `AnySchema` types. No runtime `zod` dependency
168
+ - `validation/validate-schema` — universal Zod-style schema validator with `validateSchema` (tagged result) and `parseSchema` (throwing). No runtime `zod` dep
112
169
 
113
- > **Deprecated in 5.21.0**: moved to `@socketsecurity/lib/schema/*`.
170
+ > **Deprecated in 5.21.0**: moved to `schema/*`.
114
171
 
115
172
  ### Fixed
116
173
 
117
- - `@socketsecurity/lib/promise-queue` — synchronous throws inside a queued task now convert to proper rejections instead of escaping as uncaught exceptions
118
- - `@socketsecurity/lib/stdio/progress` `formatTime()` — clamp negative milliseconds so over-ticking / clock-skewed bars don't render negative ETAs
119
- - `@socketsecurity/lib/dlx/lockfile` — scratch-directory cleanup can no longer clobber the real exception from the main block
120
- - `@socketsecurity/lib/dlx/package` `parsePackageSpec` — normalize a bare trailing `@` (e.g. `"pkg@"`) to `version: undefined`
121
- - `@socketsecurity/lib/stdio/prompts` — tighten an internal destructure type away from `as any`
122
- - `@socketsecurity/lib/http-request` — hoist checksum regex literals out of a per-line loop
174
+ - `promise-queue` — sync throws inside a queued task convert to proper rejections (no longer escape as uncaught)
175
+ - `stdio/progress` `formatTime()` — clamps negative milliseconds (no negative ETAs)
176
+ - `dlx/lockfile` — scratch-directory cleanup no longer clobbers the real exception
177
+ - `dlx/package` `parsePackageSpec` — bare trailing `@` (e.g. `"pkg@"`) normalizes to `version: undefined`
123
178
 
124
179
  ## [5.19.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.19.1) - 2026-04-19
125
180
 
126
181
  ### Fixed
127
182
 
128
- Restore `@socketsecurity/lib/stdio/prompts`, `@socketsecurity/lib/stdio/progress`, and `@socketsecurity/lib/stdio/clear` — accidentally removed in 5.19.0 without a major-bump callout. Downstream consumers that import `stdio/prompts` directly are unbroken.
183
+ - Restored `stdio/prompts`, `stdio/progress`, and `stdio/clear` — accidentally removed in 5.19.0
129
184
 
130
185
  ## [5.19.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.19.0) - 2026-04-19
131
186
 
132
187
  ### Added
133
188
 
134
- - `@socketsecurity/lib/dlx/integrity` — hash verification utilities: `HashSpec`, `NormalizedHash`, `ComputedHashes`, `normalizeHash()`, `computeHashes()`, `verifyHash()` (constant-time via `crypto.timingSafeEqual`), `DlxHashMismatchError`
135
- - `@socketsecurity/lib/dlx/arborist` — hardened `@npmcli/arborist` wrappers: `safeIdealTree()`, `safeReify()`, `writeSafeNpmrc()`. Locks down `audit`, `fund`, `ignoreScripts`, `saveBundle`, etc. Supports `before?: Date` for release-age enforcement
136
- - `@socketsecurity/lib/dlx/lockfile` `generatePackagePin()` returns `{ name, version, hash, packageJson, lockfile }` for a resolved package. Default `minReleaseDays: 7` refuses versions published in the last week (`0` to disable); `minReleaseMins` accepted as pnpm-style alias
137
- - `DlxPackageOptions.hash`, `DlxPackageOptions.lockfile`, `DlxBinaryOptions.hash` — first-class integrity + lockfile options on the dlx entry points
189
+ - `dlx/integrity` — hash verification utilities (`normalizeHash`, `computeHashes`, `verifyHash` with constant-time compare, `DlxHashMismatchError`)
190
+ - `dlx/arborist` — hardened `@npmcli/arborist` wrappers (`safeIdealTree`, `safeReify`, `writeSafeNpmrc`). Locks down audit/fund/scripts/etc. Supports `before?: Date` for release-age enforcement
191
+ - `dlx/lockfile` `generatePackagePin()` returns `{ name, version, hash, packageJson, lockfile }`. Default `minReleaseDays: 7` refuses versions published in the last week
192
+ - `DlxPackageOptions.hash`, `.lockfile`, `DlxBinaryOptions.hash` — integrity + lockfile options on dlx entry points
138
193
 
139
194
  ### Fixed
140
195
 
141
- - `pacote` shim exposes `tarball`, `manifest`, `packument` alongside `extract`. Fixes a latent runtime crash in `fetchPackageManifest` / `fetchPackagePackument` callers
196
+ - `pacote` shim exposes `tarball`, `manifest`, `packument` alongside `extract`
142
197
 
143
198
  ### Changed
144
199
 
145
- Reduced bundle size of `dist/external/npm-pack.js` (−771 KB, −30.5%) and `dist/external/zod.js` (−306 KB, −51.2%) by stubbing code paths our callers never reach (Sigstore attestation, arborist audit/query, zod locale translations, etc.)
200
+ - `dist/external/npm-pack.js` 30% smaller; `dist/external/zod.js` 51% smaller (unused code paths stubbed)
146
201
 
147
202
  ## [5.18.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.18.2) - 2026-04-14
148
203
 
149
204
  ### Removed
150
205
 
151
- - Remove unused `plugins/` directory and `./plugins/babel-plugin-inline-require-calls` export no downstream consumers; socket-cli maintains its own local copies
206
+ - `plugins/` directory + `./plugins/babel-plugin-inline-require-calls` — unused
152
207
 
153
208
  ## [5.18.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.18.1) - 2026-04-14
154
209
 
155
210
  ### Changed
156
211
 
157
- - Deduplicated the `dist/external/npm-pack` bundle via `pnpm overrides` (pacote 21.5.0, make-fetch-happen 15.0.5, and 7 transitive `@npmcli/*` packages) — 22 duplicate packages removed, ~130 KB smaller
212
+ - `dist/external/npm-pack` deduplicated via `pnpm overrides` — 22 duplicate packages removed, ~130 KB smaller
158
213
 
159
214
  ## [5.18.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.18.0) - 2026-04-14
160
215
 
161
216
  ### Added
162
217
 
163
- - `@socketsecurity/lib/dlx` — Socket Firewall API check before package downloads. Resolves the dependency tree and blocks on critical/high severity alerts
218
+ - `dlx` — Socket Firewall API check before package downloads. Resolves the dependency tree and blocks on critical/high alerts
164
219
 
165
220
  ### Changed
166
221
 
167
- - `@socketsecurity/lib/http-request` default `User-Agent` updated from `socket-registry/1.0` to `socketsecurity-lib/{version}`
222
+ - `http-request` default `User-Agent` is now `socketsecurity-lib/{version}` (was `socket-registry/1.0`)
168
223
 
169
224
  ## [5.17.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.17.0) - 2026-04-14
170
225
 
171
226
  ### Added
172
227
 
173
- - `@socketsecurity/lib/paths` `isUnixPath()` — detect MSYS/Git Bash drive-letter notation (`/c/...`)
228
+ - `paths` `isUnixPath()` — detects MSYS/Git Bash drive-letter notation (`/c/...`)
174
229
 
175
230
  ### Changed
176
231
 
177
- - `@socketsecurity/lib/paths` `normalizePath()` converts MSYS drive letters on Windows (`/c/path` → `C:/path`)
178
- - `@socketsecurity/lib/paths` `fromUnixPath()` produces native Windows paths with backslashes (`/c/path` → `C:\path`), making it the true inverse of `toUnixPath()`
232
+ - `paths` `normalizePath()` converts MSYS drive letters on Windows (`/c/path` → `C:/path`)
233
+ - `paths` `fromUnixPath()` produces native Windows paths with backslashes (`/c/path` → `C:\path`)
179
234
 
180
235
  ## [5.16.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.16.0) - 2026-04-14
181
236
 
182
237
  ### Added
183
238
 
184
- - `@socketsecurity/lib/paths` `fromUnixPath()` — convert MSYS/Git Bash Unix-style paths (`/c/path`) back to native Windows format (`C:/path`), inverse of `toUnixPath` (#168)
239
+ - `paths` `fromUnixPath()` — convert MSYS/Git Bash paths back to native Windows format (#168)
185
240
 
186
241
  ### Fixed
187
242
 
188
- - `@socketsecurity/lib/dlx` `isInSocketDlx` normalize the dlx directory path for Windows compatibility
243
+ - `dlx` `isInSocketDlx` normalizes the dlx directory path on Windows
189
244
 
190
245
  ## [5.15.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.15.0) - 2026-04-06
191
246
 
192
247
  ### Added
193
248
 
194
- - `@socketsecurity/lib/http-request` `stream` option on `HttpRequestOptions` resolves with `HttpResponse` immediately after headers arrive, leaving `rawResponse` unconsumed for piping to files
195
- - `@socketsecurity/lib/http-request` — `headers`, `ok`, `status`, `statusText` fields on `HttpDownloadResult`
249
+ - `http-request` `stream` option resolves immediately after headers arrive, leaving the body unconsumed for piping
250
+ - `http-request` — `headers`, `ok`, `status`, `statusText` fields on `HttpDownloadResult`
196
251
 
197
252
  ## [5.14.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.14.0) - 2026-04-06
198
253
 
199
254
  ### Added
200
255
 
201
- - `@socketsecurity/lib/http-request`:
202
- - `HttpResponseError` class — thrown on non-2xx when `throwOnError` is enabled; carries the full `HttpResponse`
256
+ - `http-request`:
257
+ - `HttpResponseError` — thrown on non-2xx when `throwOnError` is set
203
258
  - `throwOnError` option — non-2xx responses throw instead of resolving with `ok: false`
204
- - `onRetry` callback — customize retry behavior per-attempt (`false` to stop, a `number` to override delay, `undefined` for default backoff)
205
- - Streaming body support — `body` accepts `Readable` streams (incl. `form-data`), auto-merges `getHeaders()` when present
206
- - `parseRetryAfterHeader()` — standalone RFC 7231 §7.1.3 parser
207
- - `sanitizeHeaders()` — redact sensitive headers for safe logging
259
+ - `onRetry` callback — customize retry per attempt
260
+ - Streaming body support — `body` accepts `Readable` streams (incl. `form-data`)
261
+ - `parseRetryAfterHeader()` — RFC 7231 §7.1.3 parser
262
+ - `sanitizeHeaders()` — redact sensitive headers for logging
208
263
 
209
264
  ### Changed
210
265
 
211
- - `@socketsecurity/lib/http-request` `HttpRequestOptions.body` widened to `Buffer | Readable | string`; `onResponse` hook errors no longer leave promises pending
266
+ - `http-request` `HttpRequestOptions.body` widened to `Buffer | Readable | string`; `onResponse` errors no longer leave promises pending
212
267
 
213
268
  ## [5.13.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.13.0) - 2026-04-05
214
269
 
215
- ### Added — http-request
270
+ ### Added
216
271
 
217
- - `readIncomingResponse()` — reads and buffers a Node.js `IncomingResponse` into an `HttpResponse` (#143)
218
- - Useful for converting raw responses from code that bypasses `httpRequest()` (e.g. multipart form-data uploads) into the standard `HttpResponse` interface
219
- - `IncomingResponse` type alias — disambiguates `IncomingMessage` as a client-side response
220
- - `IncomingRequest` type alias — disambiguates `IncomingMessage` as a server-side request
272
+ - `http-request` `readIncomingResponse()` — reads and buffers a Node.js response into an `HttpResponse` (#143)
273
+ - `http-request` `IncomingResponse` / `IncomingRequest` type aliases disambiguate `IncomingMessage` direction
221
274
 
222
- ### Changed — http-request
275
+ ### Changed
223
276
 
224
- - Internal `httpRequestAttempt` callbacks now use `IncomingResponse` type
225
277
  - `HttpResponse.rawResponse` type narrowed from `IncomingMessage` to `IncomingResponse`
226
278
 
227
279
  ## [5.12.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.12.0) - 2026-04-04
228
280
 
229
- ### Added — http-request
281
+ ### Added
230
282
 
231
- - Lifecycle hooks (`onRequest`/`onResponse`) on `HttpRequestOptions` (#133)
232
- - Fire per-attemptretries and redirects each trigger separate hook calls
233
- - `HttpHooks`, `HttpHookRequestInfo`, `HttpHookResponseInfo` types exported
234
- - `maxResponseSize` option to reject responses exceeding a byte limit
235
- - Works through redirects, `httpJson`, and `httpText`
236
- - `rawResponse` property on `HttpResponse` exposing the underlying `IncomingMessage`
237
- - `enrichErrorMessage()` exported for reusable error enrichment
283
+ - `http-request` lifecycle hooks (`onRequest` / `onResponse`) on `HttpRequestOptions` — fire per-attempt; retries and redirects each trigger separate calls (#133)
284
+ - `http-request` `maxResponseSize` option reject responses exceeding a byte limit (works through redirects, `httpJson`, `httpText`)
285
+ - `http-request` `HttpResponse.rawResponse` underlying `IncomingMessage`
286
+ - `http-request` `enrichErrorMessage()` exported
238
287
 
239
- ### Changed — http-request
288
+ ### Changed
240
289
 
241
- - Error messages now include HTTP method and URL for easier debugging
242
- - `HttpResponse.headers` type changed from `Record<string, string | string[] | undefined>` to `IncomingHttpHeaders`
290
+ - Error messages now include HTTP method and URL
291
+ - `HttpResponse.headers` type changed to `IncomingHttpHeaders`
243
292
 
244
293
  ## [5.11.4](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.4) - 2026-03-28
245
294
 
246
- ### Changed
295
+ ### Performance
247
296
 
248
- - **perf**: Lazy-load heavy external sub-bundles across 7 modules (#119)
249
- - `sorts.ts`: Defer semver (2.5 MB via npm-pack) and fastSort until first use
250
- - `versions.ts`: Defer semver until first use
251
- - `archives.ts`: Defer adm-zip (102 KB) and tar-fs (105 KB) until extraction
252
- - `globs.ts`: Defer fast-glob and picomatch (260 KB via pico-pack) until glob execution
253
- - `fs.ts`: Defer del (260 KB via pico-pack) until safeDelete call
254
- - `spawn.ts`: Defer @npmcli/promise-spawn (17 KB) until async spawn
255
- - `strings.ts`: Defer get-east-asian-width (10 KB) until stringWidth call
256
- - Importing lightweight exports (isObject, httpJson, localeCompare, readJsonSync, stripAnsi) no longer loads heavy externals at module init time
297
+ - Lazy-load heavy external sub-bundles across 7 modules (#119) — `sorts`, `versions`, `archives`, `globs`, `fs`, `spawn`, `strings`. Lightweight imports no longer load heavy externals at init
257
298
 
258
299
  ## [5.11.3](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.3) - 2026-03-26
259
300
 
260
301
  ### Fixed
261
302
 
262
- - **build**: Deduplicate shared deps across external bundles (#110)
263
- - **quality**: Comprehensive quality scan fixes across codebase (#111)
264
- - **releases**: Add in-memory TTL cache for GitHub API responses
265
- - **releases**: Guard against missing assets in GitHub release response (#112)
266
- - **process-lock**: Fix Windows path separator handling for lock directory creation (#112)
303
+ - `releases` in-memory TTL cache for GitHub API responses; guard against missing assets in release response (#112)
304
+ - `process-lock` Windows path separator handling for lock directory creation (#112)
267
305
 
268
306
  ## [5.11.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.2) - 2026-03-24
269
307
 
270
308
  ### Added
271
309
 
272
- - **http-request**: Custom CA certificate support for TLS connections
273
- - `httpRequest`, `httpJson`, `httpText` accept `ca` option for custom certificate authorities
274
- - `httpDownload` accepts `ca` option, threaded through redirects and retries
275
- - `fetchChecksums` accepts `ca` option, passed through to underlying request
276
- - Enables SSL_CERT_FILE support when NODE_EXTRA_CA_CERTS is unavailable at process startup
310
+ - `http-request` custom CA certificate support (`ca` option on `httpRequest`, `httpJson`, `httpText`, `httpDownload`, `fetchChecksums`). Enables `SSL_CERT_FILE` support when `NODE_EXTRA_CA_CERTS` is unavailable at process startup
277
311
 
278
312
  ## [5.11.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.1) - 2026-03-24
279
313
 
280
314
  ### Added
281
315
 
282
- - **dlx/binary**: Added `sha256` option to `dlxBinary()`, `downloadBinary()`, and `downloadBinaryFile()`
283
- - Enables SHA-256 checksum verification for binary downloads via httpDownload
284
- - Verification happens during download (fails early if checksum mismatches)
285
- - Complements existing `integrity` option (SRI sha512 format, verified post-download)
316
+ - `dlx/binary` `sha256` option on `dlxBinary()`, `downloadBinary()`, `downloadBinaryFile()`. Verification happens during download (fails early on mismatch). Complements the existing `integrity` (SRI sha512) option
286
317
 
287
318
  ## [5.11.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.11.0) - 2026-03-23
288
319
 
289
320
  ### Added
290
321
 
291
- - **http-request**: Checksum verification for secure downloads
292
- - `parseChecksums(text)`: Parse checksums file text into filename→hash map
293
- - Supports GNU style (`hash filename`), BSD style (`SHA256 (file) = hash`), and single-space format
294
- - Handles Windows CRLF and Unix LF line endings
295
- - Returns null-prototype object to prevent prototype pollution
296
- - `fetchChecksums(url, options?)`: Fetch and parse checksums from URL
297
- - Supports `headers` and `timeout` options
298
- - `httpDownload` now accepts `sha256` option to verify downloaded files
299
- - Verification happens before atomic rename (file not saved if hash mismatches)
300
- - Accepts uppercase hashes (normalized to lowercase internally)
322
+ - `http-request` `parseChecksums(text)` parse GNU / BSD / single-space checksum file formats; CRLF and LF line endings; null-prototype map
323
+ - `http-request` `fetchChecksums(url, options?)` fetch and parse checksums from URL; supports `headers` and `timeout`
324
+ - `http-request` `httpDownload` `sha256` option verifies before atomic rename (file not saved on mismatch); accepts uppercase hashes
301
325
 
302
326
  ## [5.10.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.10.0) - 2026-03-14
303
327
 
304
328
  ### Changed
305
329
 
306
- - **releases/socket-btm**: Refactored `downloadSocketBtmRelease()` API for caller-controlled download paths
307
- - Tool name moved from config object to required first parameter
308
- - Config object is now optional second parameter (was required)
309
- - Removed automatic `/${toolName}/${platformArch}` directory nesting - callers now have full control over download directory structure
310
- - All optional parameters in config types now explicitly typed as `| undefined`
311
- - Migration example:
312
- - Before: `downloadSocketBtmRelease({ tool: 'lief', downloadDir: 'build' })`
313
- - After: `downloadSocketBtmRelease('lief', { downloadDir: 'build' })`
314
- - Rationale: Previous automatic path nesting created unexpected directory structures (e.g., `build/downloaded/lief/darwin-arm64/lief/assets/`) making it impossible for callers to predict exact file locations
330
+ - **BREAKING**: `releases/socket-btm` `downloadSocketBtmRelease()` tool name moved to required first parameter; config object now optional second parameter. Automatic `/${toolName}/${platformArch}` directory nesting removed (callers now control the full path).
331
+ - Before: `downloadSocketBtmRelease({ tool: 'lief', downloadDir: 'build' })`
332
+ - After: `downloadSocketBtmRelease('lief', { downloadDir: 'build' })`
315
333
 
316
334
  ## [5.9.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.9.1) - 2026-03-14
317
335
 
318
336
  ### Fixed
319
337
 
320
- - **fs**: `safeDelete()` and `safeDeleteSync()` now properly implement retry logic
321
- - Previously `maxRetries` was incorrectly passed as `concurrency` to del (parallelism, not retries)
322
- - `safeDelete()` now wraps `deleteAsync()` with `pRetry()` for exponential backoff
323
- - `safeDeleteSync()` implements sync retry loop with `Atomics.wait()` for non-blocking sleep
324
- - Both use `backoffFactor: 2` (delay doubles each retry: 200ms → 400ms → 800ms by default)
325
- - `maxRetries` and `retryDelay` options in `RemoveOptions` now work as documented
338
+ - `fs` `safeDelete()` and `safeDeleteSync()` now properly implement retry logic. Previously `maxRetries` was incorrectly passed as `concurrency` to `del`. Both now use exponential backoff (`backoffFactor: 2`); `maxRetries` and `retryDelay` in `RemoveOptions` work as documented
326
339
 
327
340
  ## [5.9.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.9.0) - 2026-03-14
328
341
 
329
342
  ### Changed
330
343
 
331
- - **releases/socket-btm**: `getPlatformArch()` now normalizes Windows platform to `win` instead of `win32`
332
- - Returns `win-x64`, `win-arm64` instead of `win32-x64`, `win32-arm64`
333
- - Consistent with `getBinaryAssetName()` which already uses `win` for Windows assets
334
- - Aligns with socket-btm and Node.js convention: use `win` for file/folder names, `win32` for platform checks (`process.platform`)
335
- - Added `PLATFORM_MAP` for explicit platform name mapping (darwin, linux, win32 → win)
336
- - Now throws `Error: Unsupported platform` for unknown platform values
344
+ - **BREAKING**: `releases/socket-btm` `getPlatformArch()` normalizes Windows to `win` (was `win32`) — returns `win-x64`, `win-arm64`. Throws on unknown platforms. (Reverted in 5.22.0 back to `win32`)
337
345
 
338
346
  ## [5.8.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.8.2) - 2026-03-13
339
347
 
340
348
  ### Fixed
341
349
 
342
- - **http-request**: Download to temp file then atomically rename to prevent corruption
343
- - Downloads now write to `{destPath}.download` temp file first
344
- - On success, atomically renames to the destination path
345
- - On failure, cleans up temp file and preserves any existing file at destination
346
- - Prevents partial/corrupted files from CI caching causing extraction failures
350
+ - `http-request` downloads write to `{destPath}.download` temp file then atomically rename. Prevents partial/corrupted files from CI caching causing extraction failures
347
351
 
348
352
  ## [5.8.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.8.1) - 2026-03-11
349
353
 
350
354
  ### Performance
351
355
 
352
- - **windows**: Add comprehensive caching for expensive PATH resolution operations
353
- - `getBinPath()`, `getBinPathSync()`: Cache binary path lookups
354
- - `findRealBin()`: Cache `all:true` lookups and use single `whichSync({ all: true })` call
355
- - `getVoltaBinPath()`: Cache Volta binary resolution
356
- - `spawn()`: Cache binary path resolution before spawning
357
- - `getGitPath()`: Cache git binary path
358
- - `getCachedRealpath()`: New helper caching `realpathSync()` calls for git operations
359
- - `findGitRoot()`: Cache git root directory lookups
360
- - `findPackageJson()`: Cache package.json path lookups
361
- - `readPackageJson()`: Cache parsed package.json content
362
- - `resolveBinaryPath()`: Cache binary path resolution with Windows extension handling
363
- - `NPM_BIN_PATH`, `NPM_REAL_EXEC_PATH`: Share npm path resolution to avoid duplicate `which.sync()` calls
364
- - `ProcessLockManager.isStale()`: Use single `statSync({ throwIfNoEntry: false })` instead of `existsSync()` + `statSync()`
365
- - All caches validate entries with `existsSync()` and remove stale entries automatically
356
+ - Comprehensive caching for expensive PATH/realpath/git/package.json lookups across `bin`, `spawn`, `git`, `paths`, and `process-lock`. All caches validate entries via `existsSync()` and evict stale ones
366
357
 
367
358
  ## [5.8.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.8.0) - 2026-03-10
368
359
 
369
360
  ### Added
370
361
 
371
- - **archives**: Added secure archive extraction utilities with support for ZIP, TAR, TAR.GZ, and TGZ formats
372
- - Configurable limits: `maxFileSize` (default 100MB), `maxTotalSize` (default 1GB)
373
- - Cross-platform path normalization
374
- - External dependencies: adm-zip@0.5.16, tar-fs@3.1.2 (bundled, +212KB)
375
- - Security features: path traversal protection, file size limits, total size limits, symlink blocking
376
- - Strip option to remove leading path components (like tar `--strip-components`)
377
- - `detectArchiveFormat()` - Detect archive type from file extension
378
- - `extractArchive()` - Generic extraction with auto-format detection
379
- - `extractTar()`, `extractTarGz()`, `extractZip()` - Format-specific extractors
380
-
381
- - **releases/github**: Added archive extraction support for GitHub releases
382
- - Auto-detects format from asset filename
383
- - Enhanced `downloadAndExtractZip()` to use generic archive helpers
384
- - Supports ZIP, TAR, TAR.GZ, and TGZ assets
385
- - `downloadAndExtractArchive()` - Generic archive download and extraction
362
+ - `archives` secure archive extraction for ZIP / TAR / TAR.GZ / TGZ. Configurable `maxFileSize` (100MB) and `maxTotalSize` (1GB). Path-traversal protection, symlink blocking, strip option. Exports: `detectArchiveFormat`, `extractArchive`, `extractTar`, `extractTarGz`, `extractZip`
363
+ - `releases/github` `downloadAndExtractArchive()` generic archive download and extract; auto-detects format
386
364
 
387
365
  ### Changed
388
366
 
389
- - **dependencies**: Deduplicated 14 external bundle packages to single versions using pnpm overrides and patches
367
+ - 14 external bundle packages deduplicated via pnpm overrides + patches
390
368
 
391
369
  ## [5.7.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.7.0) - 2026-02-12
392
370
 
393
371
  ### Added
394
372
 
395
- - **env**: Added `isInEnv()` helper function to check if an environment variable key exists, regardless of its value
396
- - Returns `true` even for empty strings, `"false"`, `"0"`, etc.
397
- - Follows same override resolution order as `getEnvValue()` (isolated overrides shared overrides → process.env)
398
- - Useful for detecting presence of environment variables independent of their value
399
-
400
- - **dlx**: Added new exported helper functions
401
- - `downloadBinaryFile()` - Downloads a binary file from a URL to the dlx cache directory
402
- - `ensurePackageInstalled()` - Ensures an npm package is installed and cached via Arborist
403
- - `getBinaryCacheMetadataPath()` - Gets the file path to dlx binary cache metadata (`.dlx-metadata.json`)
404
- - `isBinaryCacheValid()` - Checks if a cached dlx binary is still valid based on TTL and timestamp
405
- - `makePackageBinsExecutable()` - Makes npm package binaries executable on Unix systems
406
- - `parsePackageSpec()` - Parses npm package spec strings (e.g., `pkg@1.0.0`) into name and version
407
- - `resolveBinaryPath()` - Resolves the absolute path to a binary within an installed package
408
- - `writeBinaryCacheMetadata()` - Writes dlx binary cache metadata with integrity, size, and source info
409
-
410
- - **releases**: Added `createAssetMatcher()` utility function for GitHub release asset pattern matching
411
- - Creates matcher functions that test strings against glob patterns, prefix/suffix, or RegExp
412
- - Used for dynamic asset discovery in GitHub releases (e.g., matching platform-specific binaries)
373
+ - `env` `isInEnv(key)` `true` whenever the key exists, regardless of value (empty string, `"false"`, `"0"` all count)
374
+ - `dlx` helpers exposed: `downloadBinaryFile`, `ensurePackageInstalled`, `getBinaryCacheMetadataPath`, `isBinaryCacheValid`, `makePackageBinsExecutable`, `parsePackageSpec`, `resolveBinaryPath`, `writeBinaryCacheMetadata`
375
+ - `releases` `createAssetMatcher()` matcher fn for glob / prefix-suffix / RegExp asset patterns
413
376
 
414
377
  ### Changed
415
378
 
416
- - **env**: Updated `getCI()` to use `isInEnv()` for more accurate CI detection
417
- - Now returns `true` whenever the `CI` key exists in the environment, not just when truthy
418
- - Matches standard CI detection behavior where the presence of the key (not its value) indicates a CI environment
379
+ - `env` `getCI()` now uses `isInEnv('CI')` `true` whenever the key exists, matching standard CI-detection convention
419
380
 
420
381
  ### Fixed
421
382
 
422
- - **github**: Fixed JSON parsing crash vulnerability by adding try-catch around `JSON.parse()` in GitHub API responses
423
- - Prevents crashes on malformed, incomplete, or binary responses
424
- - Error messages now include the response URL for better debugging
425
-
426
- - **dlx/binary**: Fixed clock skew vulnerabilities in cache validation
427
- - Cache entries with future timestamps (clock skew) are now treated as expired
428
- - Metadata writes now use atomic write-then-rename pattern to prevent corruption
429
- - Added TOCTOU race protection by re-checking binary existence after metadata read
430
-
431
- - **dlx/cache cleanup**: Fixed handling of future timestamps during cache cleanup
432
- - Entries with future timestamps (due to clock skew) are now properly treated as expired
433
-
434
- - **dlx/package**: Fixed scoped package parsing bug where `@scope/package` was incorrectly parsed
435
- - Changed condition from `startsWith('@')` to `atIndex === 0` for more precise detection
436
- - Fixes installation failures for scoped packages like `@socketregistry/lib`
437
-
438
- - **cache-with-ttl**: Added clock skew detection to TTL cache
439
- - Far-future `expiresAt` values (>2x TTL) are now treated as expired
440
- - Protects against cache poisoning from clock skew
441
-
442
- - **packages/specs**: Fixed unconditional `.git` truncation in Git URL parsing
443
- - Now only removes `.git` suffix when URL actually ends with `.git`
444
- - Prevents incorrect truncation of URLs containing `.git` in the middle
445
-
446
- - **releases/github**: Fixed TOCTOU race condition in binary download verification
447
- - Re-checks binary existence after reading version file
448
- - Ensures binary is re-downloaded if missing despite version file presence
449
-
450
- - **provenance**: Fixed incorrect package name in provenance workflow
451
- - Changed from `@socketregistry/lib` to `@socketsecurity/lib`
383
+ - `github` try/catch around `JSON.parse()` in API responses; error messages include the response URL
384
+ - `dlx/binary` clock-skew protection (future timestamps treated as expired); atomic metadata write-then-rename; TOCTOU re-check of binary existence after metadata read
385
+ - `dlx/cache` future-timestamped entries treated as expired during cleanup
386
+ - `dlx/package` — scoped-package parsing uses `atIndex === 0` (was `startsWith('@')`); fixes `@scope/pkg` installation failures
387
+ - `cache-with-ttl` clock-skew detection (far-future `expiresAt` > 2x TTL treated as expired)
388
+ - `packages/specs` only strips `.git` when URL actually ends with it (no more mid-URL truncation)
389
+ - `releases/github` TOCTOU on binary download verification (re-checks after reading version file)
390
+ - `provenance` workflow corrected package name `@socketregistry/lib` `@socketsecurity/lib`
452
391
 
453
392
  ## [5.6.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.6.0) - 2026-02-08
454
393
 
455
394
  ### Added
456
395
 
457
- - **http-request**: Added automatic default headers for JSON and text requests
458
- - `httpJson()` now automatically sets `Accept: application/json` header
459
- - `httpJson()` automatically sets `Content-Type: application/json` when body is present
460
- - `httpText()` now automatically sets `Accept: text/plain` header
461
- - `httpText()` automatically sets `Content-Type: text/plain` when body is present
462
- - User-provided headers always override defaults
463
- - Simplifies API usage - no need to manually set common headers
396
+ - `http-request` `httpJson()` / `httpText()` automatically set `Accept` and `Content-Type` headers (when body present); user headers override
464
397
 
465
398
  ### Changed
466
399
 
467
- - **http-request**: Renamed HTTP helper functions to support all HTTP methods (BREAKING CHANGE)
468
- - `httpGetJson()` → `httpJson()` - Now supports GET, POST, PUT, DELETE, PATCH, etc.
469
- - `httpGetText()` → `httpText()` - Now supports all HTTP methods via `method` option
470
- - Functions now accept `method` parameter in options (defaults to 'GET')
471
- - More flexible API that matches modern fetch-style conventions
472
- - **Migration**: Replace `httpGetJson()` calls with `httpJson()` and `httpGetText()` with `httpText()`
400
+ - **BREAKING**: `http-request` `httpGetJson()` `httpJson()` and `httpGetText()` `httpText()`. Functions now accept `method` (defaults to `'GET'`), supporting all HTTP verbs
473
401
 
474
402
  ### Fixed
475
403
 
476
- - **http-request**: Fixed Content-Type header incorrectly sent with empty string body
477
- - Empty string body (`""`) no longer triggers Content-Type header
478
- - Changed condition from `if (body !== undefined)` to `if (body)` for semantic correctness
479
- - Empty string represents "no content" and should not declare a Content-Type
480
- - Affects `httpJson()` and `httpText()` functions
481
- - Fixes potential API compatibility issues with servers expecting no Content-Type for empty bodies
482
- - Added comprehensive test coverage for empty string edge case
404
+ - `http-request` empty-string body no longer triggers `Content-Type`
483
405
 
484
406
  ## [5.5.3](https://github.com/SocketDev/socket-lib/releases/tag/v5.5.3) - 2026-01-20
485
407
 
486
408
  ### Fixed
487
409
 
488
- - **deps**: Added patch for execa@2.1.0 to fix signal-exit v4 compatibility. The package was using default import syntax with signal-exit v4, which now exports onExit as a named export.
410
+ - Patched `execa@2.1.0` for `signal-exit` v4 compatibility (named export)
489
411
 
490
412
  ## [5.5.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.5.2) - 2026-01-20
491
413
 
492
414
  ### Changed
493
415
 
494
- - **dlx/package**: Use `getSocketCacacheDir()` instead of `getPacoteCachePath()` for Arborist cache configuration
495
- - Ensures consistent use of Socket's shared cacache directory (`~/.socket/_cacache`)
496
- - Removes dependency on pacote cache path extraction which could fail
497
- - Simplifies cache configuration by using reliable Socket path utility
416
+ - `dlx/package` uses `getSocketCacacheDir()` (was `getPacoteCachePath()`) for Arborist cache config — removes dependency on pacote cache-path extraction
498
417
 
499
418
  ## [5.5.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.5.1) - 2026-01-12
500
419
 
501
420
  ### Fixed
502
421
 
503
- - Fixed dotenvx compatibility with pre-commit hooks
504
- - Fixed empty releases being returned when finding latest release
422
+ - dotenvx compatibility with pre-commit hooks
423
+ - Empty releases being returned by latest-release lookup
505
424
 
506
425
  ## [5.5.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.5.0) - 2026-01-12
507
426
 
508
427
  ### Added
509
428
 
510
- - **dlx/detect**: Executable type detection utilities for DLX cache and local file paths
511
- - `detectDlxExecutableType()`: Detects Node.js packages vs native binaries in DLX cache by checking for node_modules/ directory
512
- - `detectExecutableType()`: Generic entry point that routes to appropriate detection strategy
513
- - `detectLocalExecutableType()`: Detects executables on local filesystem by checking package.json bin field or file extension
514
- - `isJsFilePath()`: Validates if a file path has .js, .mjs, or .cjs extension
515
- - `isNativeBinary()`: Simplified helper that returns true for native binary executables
516
- - `isNodePackage()`: Simplified helper that returns true for Node.js packages
429
+ - `dlx/detect` `detectDlxExecutableType`, `detectExecutableType`, `detectLocalExecutableType`, `isJsFilePath`, `isNativeBinary`, `isNodePackage`. Distinguishes Node packages from native binaries in DLX cache and on local filesystem
517
430
 
518
431
  ### Fixed
519
432
 
520
- - **releases/github**: Sort releases by published_at to reliably find latest release instead of relying on creation order
433
+ - `releases/github` sort releases by `published_at` to reliably find latest (was relying on creation order)
521
434
 
522
435
  ## [5.4.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.4.1) - 2026-01-10
523
436
 
524
437
  ### Fixed
525
438
 
526
- - **build**: Removed debug module stub to bundle real debug package. The stub was missing `enable()` and `disable()` methods, causing errors when downstream projects re-bundled the lib.
439
+ - Removed `debug` module stub to bundle the real package stub was missing `enable()` / `disable()`
527
440
 
528
441
  ## [5.4.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.4.0) - 2026-01-07
529
442
 
530
443
  ### Added
531
444
 
532
- - **releases/github**: Extended release functions to accept glob patterns for asset discovery
533
- - `getReleaseAssetUrl()` now accepts glob patterns: `'yoga-sync-*.mjs'`, `'models-*.tar.gz'`
534
- - `downloadReleaseAsset()` now accepts glob patterns for automatic asset discovery
535
- - `getLatestRelease()` now accepts asset patterns to find releases with matching assets
536
- - Supports wildcards, brace expansion, RegExp patterns, and prefix/suffix objects
537
- - Uses picomatch for robust glob pattern matching
538
-
539
- - **releases/socket-btm**: Extended `downloadSocketBtmRelease()` to accept glob patterns
540
- - `asset` parameter now accepts wildcards: `'yoga-sync-*.mjs'`, `'models-*.tar.gz'`
541
- - Automatically discovers and downloads latest matching asset
542
- - Eliminates need for hardcoded asset names in build scripts
445
+ - `releases/github` `getReleaseAssetUrl()`, `downloadReleaseAsset()`, `getLatestRelease()` accept glob patterns (wildcards, brace expansion, RegExp) via picomatch
446
+ - `releases/socket-btm` `downloadSocketBtmRelease()` `asset` parameter accepts glob patterns
543
447
 
544
448
  ## [5.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.3.0) - 2026-01-07
545
449
 
546
450
  ### Added
547
451
 
548
- - **releases/socket-btm**: Exported helper functions for external use
549
- - `detectLibc()`: Detect musl vs glibc on Linux systems
550
- - `getBinaryAssetName()`: Get GitHub asset name for platform/arch
551
- - `getBinaryName()`: Get binary filename with platform-appropriate extension
552
- - `getPlatformArch()`: Get platform-arch identifier for directory structure
553
-
554
- - **releases/github**: Exported `getAuthHeaders()` for GitHub API authentication
555
- - Returns headers with `Accept`, `X-GitHub-Api-Version`, and optional `Authorization`
556
- - Checks `GH_TOKEN` and `GITHUB_TOKEN` environment variables
452
+ - `releases/socket-btm` exports: `detectLibc`, `getBinaryAssetName`, `getBinaryName`, `getPlatformArch`
453
+ - `releases/github` exports `getAuthHeaders()` checks `GH_TOKEN` / `GITHUB_TOKEN`
557
454
 
558
455
  ## [5.2.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.2.1) - 2026-01-06
559
456
 
560
457
  ### Fixed
561
458
 
562
- - **releases**: Fixed "Text file busy" errors when executing downloaded binaries
563
- - Changed `downloadGitHubRelease()` to use synchronous `chmodSync()` instead of async `chmod()`
564
- - Ensures file system operations complete before binary execution
565
- - Prevents race conditions in CI/CD environments where async operations may not fully flush to disk
459
+ - `releases` `downloadGitHubRelease()` uses sync `chmodSync()` to prevent "Text file busy" race in CI
566
460
 
567
461
  ## [5.2.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.2.0) - 2026-01-06
568
462
 
569
463
  ### Added
570
464
 
571
- - **releases**: Added GitHub release download utilities for cross-project use
572
- - Added `downloadGitHubRelease()` for downloading releases from any GitHub repository
573
- - Added `downloadSocketBtmRelease()` specialized wrapper for socket-btm releases
574
- - Features version caching with `.version` files to avoid redundant downloads
575
- - Supports cross-platform binary downloads (darwin, linux, win32) with automatic platform/arch detection
576
- - Includes Linux musl/glibc support with musl as default for broader compatibility
577
- - Automatically removes macOS quarantine attributes from downloaded binaries
578
- - Supports generic asset downloads (WASM files, models, etc.)
579
- - API inspired by industry tools: `brew`, `cargo`, `gh` for intuitive usage
580
- - Package exports: `@socketsecurity/lib/releases/github` and `@socketsecurity/lib/releases/socket-btm`
465
+ - `releases/github` `downloadGitHubRelease()` for any GitHub repo
466
+ - `releases/socket-btm` `downloadSocketBtmRelease()` wrapper. Version caching via `.version` files; cross-platform with auto platform/arch detection; Linux musl/glibc support; macOS quarantine attribute auto-removal; generic asset downloads (WASM, models)
581
467
 
582
468
  ## [5.1.4](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.4) - 2025-12-30
583
469
 
584
470
  ### Fixed
585
471
 
586
- - **dependencies**: Removed unnecessary `http2` module dependency from `@sigstore/sign@4.1.0`
587
- - Added pnpm override to force `@sigstore/sign@4.1.0` across all dependencies
588
- - Created patch to inline HTTP header and status constants instead of importing `http2` module
589
- - Eliminates loading of Node.js `http2` module for HTTP/1.1-only operations
472
+ - Removed unnecessary `http2` module dependency from `@sigstore/sign@4.1.0` via pnpm override + patch — eliminates loading `node:http2` for HTTP/1.1-only operations
590
473
 
591
474
  ## [5.1.3](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.3) - 2025-12-29
592
475
 
593
476
  ### Fixed
594
477
 
595
- - **http-request**: Fixed `httpDownload()` to properly handle HTTP redirects (3xx status codes)
596
- - Added `followRedirects` option (default: `true`) to enable automatic redirect following
597
- - Added `maxRedirects` option (default: `5`) to limit redirect chain length
598
- - Now supports downloading from services that use CDN redirects, such as GitHub release assets
599
- - Prevents GitHub API quota exhaustion by following `browser_download_url` redirects instead of using API endpoints
600
- - Resolves "Request quota exhausted" errors when downloading GitHub release assets
478
+ - `http-request` `httpDownload()` follows 3xx redirects. New `followRedirects` (default `true`) and `maxRedirects` (default `5`) options. Resolves "Request quota exhausted" when downloading GitHub release assets
601
479
 
602
480
  ## [5.1.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.2) - 2025-12-28
603
481
 
604
482
  ### Fixed
605
483
 
606
- - **paths**: Fixed missing `getPathValue()` caching in `getSocketDlxDir()`
607
- - Now uses `getPathValue()` for performance, consistent with `getSocketUserDir()` and `getSocketCacacheDir()`
608
- - Adds test override support via `setPath('socket-dlx-dir', ...)`
609
- - Test helper `mockHomeDir()` now properly invalidates path cache with `resetPaths()` calls
610
- - Resolves cache persistence issues in test environments
484
+ - `paths` `getSocketDlxDir()` now uses `getPathValue()` caching consistent with the other Socket-dir helpers. Adds test override via `setPath('socket-dlx-dir', ...)`
611
485
 
612
486
  ## [5.1.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.1) - 2025-12-28
613
487
 
614
488
  ### Added
615
489
 
616
- - **paths**: Added `SOCKET_HOME` environment variable support to customize Socket base directory
617
- - `getSocketUserDir()` now checks `SOCKET_HOME` before defaulting to `~/.socket`
618
- - `getSocketDlxDir()` inherits `SOCKET_HOME` support (priority: `SOCKET_DLX_DIR` > `SOCKET_HOME/_dlx` > `~/.socket/_dlx`)
619
- - Enables flexible directory configuration for restricted or custom environments
490
+ - `paths` `SOCKET_HOME` env var support customize Socket base directory. Priority: `SOCKET_DLX_DIR` > `SOCKET_HOME/_dlx` > `~/.socket/_dlx`
620
491
 
621
492
  ### Changed
622
493
 
623
- - **paths**: Enhanced directory resolution with temporary directory fallback
624
- - `getUserHomeDir()` now falls back to `os.tmpdir()` when home directory is unavailable
625
- - Improves resilience in containerized and restricted environments
626
- - Priority order: `HOME` > `USERPROFILE` > `os.homedir()` > `os.tmpdir()`
494
+ - `paths` `getUserHomeDir()` falls back to `os.tmpdir()` when home dir is unavailable. Priority: `HOME` > `USERPROFILE` > `os.homedir()` > `os.tmpdir()`
627
495
 
628
496
  ## [5.1.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.0) - 2025-12-17
629
497
 
630
498
  ### Added
631
499
 
632
- - **types**: Added `ALPM` and `VSCODE` to `PURL_Type` enum
633
- - `ALPM`: Arch Linux Package Manager ecosystem
634
- - `VSCODE`: Visual Studio Code extensions ecosystem
500
+ - `types` `PURL_Type` — added `ALPM` (Arch Linux) and `VSCODE` (VS Code extensions)
635
501
 
636
502
  ## [5.0.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.0.2) - 2025-12-15
637
503
 
638
504
  ### Changed
639
505
 
640
- - **signal-exit**: `signals()` now auto-initializes its internal state
641
- - Commit: [`8cb0576`](https://github.com/SocketDev/socket-lib/commit/8cb0576)
506
+ - `signal-exit` `signals()` auto-initializes its internal state
642
507
 
643
508
  ## [5.0.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.0.1) - 2025-12-11
644
509
 
645
510
  ### Added
646
511
 
647
- - **http-request**: Enhanced `httpDownload()` with automatic progress logging via Logger integration
648
- - New `logger` option: Pass a Logger instance for automatic progress tracking
649
- - New `progressInterval` option: Configure progress reporting frequency (default: 10%)
650
- - Progress format: `Progress: XX% (Y.Y MB / Z.Z MB)`
651
- - `onProgress` callback takes precedence over `logger` when both are provided
652
- - Commit: [`91e5db5`](https://github.com/SocketDev/socket-lib/commit/91e5db5)
512
+ - `http-request` `httpDownload()` automatic progress logging `logger` option for a Logger instance, `progressInterval` option (default `10%`). `onProgress` callback takes precedence over `logger`
653
513
 
654
514
  ## [5.0.0](https://github.com/SocketDev/socket-lib/releases/tag/v5.0.0) - 2025-12-04
655
515
 
656
516
  ### Added
657
517
 
658
- - **json/edit**: New `EditableJson` base class for generic JSON file manipulation with formatting preservation
659
- - Extracted from `EditablePackageJson` to enable code reuse via composition pattern
660
- - Supports reading, modifying, and writing JSON files while preserving formatting
661
- - Export: `@socketsecurity/lib/json/edit`
662
-
663
- - **json/format**: New JSON formatting utilities for consistent JSON manipulation
664
- - Functions for analyzing and preserving JSON formatting patterns
665
- - Export: `@socketsecurity/lib/json/format`
666
-
667
- - **json/parse**: New JSON parsing utilities
668
- - `isJsonPrimitive()`: Check if value is a JSON primitive type
669
- - `jsonParse()`: Parse JSON with error handling
670
- - Export: `@socketsecurity/lib/json/parse`
671
-
672
- - **json/types**: New JSON type definitions and interfaces
673
- - Export: `@socketsecurity/lib/json/types`
674
-
675
- - **dlx/cache**: New DLX cache utilities
676
- - `generateCacheKey()`: Generate cache keys for DLX packages
677
- - Export: `@socketsecurity/lib/dlx/cache`
678
-
679
- - **dlx/dir**: New DLX directory management utilities
680
- - `clearDlx()`, `clearDlxSync()`: Clear DLX directory
681
- - `dlxDirExists()`, `dlxDirExistsAsync()`: Check if DLX directory exists
682
- - `ensureDlxDir()`, `ensureDlxDirSync()`: Ensure DLX directory exists
683
- - Export: `@socketsecurity/lib/dlx/dir`
684
-
685
- - **dlx/packages**: New DLX package management utilities
686
- - `isDlxPackageInstalled()`, `isDlxPackageInstalledAsync()`: Check if package is installed
687
- - `listDlxPackages()`, `listDlxPackagesAsync()`: List installed packages
688
- - `removeDlxPackage()`, `removeDlxPackageSync()`: Remove installed packages
689
- - Export: `@socketsecurity/lib/dlx/packages`
690
-
691
- - **dlx/paths**: New DLX path utilities
692
- - `getDlxPackageDir()`: Get package directory path
693
- - `getDlxInstalledPackageDir()`: Get installed package directory path
694
- - `getDlxPackageJsonPath()`: Get package.json path
695
- - `getDlxPackageNodeModulesDir()`: Get node_modules directory path
696
- - `isInSocketDlx()`: Check if path is in DLX directory
697
- - Export: `@socketsecurity/lib/dlx/paths`
518
+ - `json/edit` `EditableJson` base class for generic JSON file manipulation with formatting preservation
519
+ - `json/format` JSON formatting utilities
520
+ - `json/parse` `isJsonPrimitive`, `jsonParse` (with error handling)
521
+ - `json/types` — JSON type definitions
522
+ - `dlx/cache` `generateCacheKey()` — DLX package cache keys
523
+ - `dlx/dir` `clearDlx`, `clearDlxSync`, `dlxDirExists`, `dlxDirExistsAsync`, `ensureDlxDir`, `ensureDlxDirSync`
524
+ - `dlx/packages` `isDlxPackageInstalled`, `listDlxPackages`, `removeDlxPackage` (+ async/sync variants)
525
+ - `dlx/paths` — `getDlxPackageDir`, `getDlxInstalledPackageDir`, `getDlxPackageJsonPath`, `getDlxPackageNodeModulesDir`, `isInSocketDlx`
698
526
 
699
527
  ### Changed
700
528
 
701
- - **BREAKING**: Reorganized module paths for better structure and discoverability
702
- - `@socketsecurity/lib/json/editable` → `@socketsecurity/lib/json/edit`
703
- - `@socketsecurity/lib/packages/editable` → `@socketsecurity/lib/packages/edit`
704
- - `@socketsecurity/lib/maintained-node-versions` `@socketsecurity/lib/constants/maintained-node-versions`
705
- - `@socketsecurity/lib/package-default-node-range` → `@socketsecurity/lib/constants/package-default-node-range`
706
- - `@socketsecurity/lib/package-default-socket-categories` → `@socketsecurity/lib/constants/package-default-socket-categories`
707
- - `@socketsecurity/lib/lifecycle-script-names` → `@socketsecurity/lib/constants/lifecycle-script-names`
708
- - `@socketsecurity/lib/dlx` → Split into `@socketsecurity/lib/dlx/cache`, `@socketsecurity/lib/dlx/dir`, `@socketsecurity/lib/dlx/packages`, `@socketsecurity/lib/dlx/paths`
709
- - `@socketsecurity/lib/dlx-binary` → `@socketsecurity/lib/dlx/binary`
710
- - `@socketsecurity/lib/dlx-manifest` → `@socketsecurity/lib/dlx/manifest`
711
- - `@socketsecurity/lib/dlx-package` → `@socketsecurity/lib/dlx/package`
712
-
713
- - **json**: Reorganized JSON utilities into modular submodules (json/edit, json/format, json/parse, json/types)
714
- - Removed barrel index file in favor of direct submodule imports
715
- - Better separation of concerns and tree-shaking
716
-
717
- - **dlx**: Split monolithic DLX module into focused submodules (cache, dir, packages, paths)
718
- - Improved modularity and maintainability
719
- - Better code organization and discoverability
529
+ - **BREAKING**: Module path reorganization:
530
+ - `json/editable` → `json/edit`
531
+ - `packages/editable` → `packages/edit`
532
+ - `maintained-node-versions`, `package-default-node-range`, `package-default-socket-categories`, `lifecycle-script-names` → moved under `constants/`
533
+ - `dlx`split into `dlx/cache`, `dlx/dir`, `dlx/packages`, `dlx/paths`
534
+ - `dlx-binary` → `dlx/binary`; `dlx-manifest` → `dlx/manifest`; `dlx-package` → `dlx/package`
720
535
 
721
536
  ## [4.4.0](https://github.com/SocketDev/socket-lib/releases/tag/v4.4.0) - 2025-11-25
722
537
 
723
538
  ### Added
724
539
 
725
- - **fs**: Exported `normalizeEncoding()` function for robust encoding string normalization
726
- - Handles case-insensitive encoding names (e.g., 'UTF-8', 'utf8', 'UTF8')
727
- - Supports encoding aliases (e.g., 'binary' → 'latin1', 'ucs-2' → 'utf16le')
728
- - Fast-path optimization for common encodings
729
- - Defaults to 'utf8' for invalid or null encodings
730
- - Export: `@socketsecurity/lib/fs`
540
+ - `fs` `normalizeEncoding()` case-insensitive encoding normalization with aliases (`binary` → `latin1`, `ucs-2` → `utf16le`); defaults to `utf8`
731
541
 
732
542
  ### Fixed
733
543
 
734
- - **fs**: `safeReadFile()` and `safeReadFileSync()` type signatures and encoding handling
735
- - Corrected type overloads: `encoding: null` `Buffer | undefined`, no encoding `string | undefined` (UTF-8 default)
736
- - Fixed implementation to properly handle `encoding: null` for Buffer returns
737
-
738
- - **suppress-warnings**: `withSuppressedWarnings()` now properly restores warning state
739
- - Fixed state restoration to only remove warning types that were added by the function
740
- - Prevents accidental removal of warnings that were already suppressed
741
- - Ensures correct cleanup behavior when warning types are nested or reused
544
+ - `fs` `safeReadFile` / `safeReadFileSync` — corrected type overloads (`encoding: null` → `Buffer`; no encoding → `string`)
545
+ - `suppress-warnings` `withSuppressedWarnings()` properly restores state, only removing warnings the function added
742
546
 
743
547
  ## [4.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v4.3.0) - 2025-11-20
744
548
 
745
549
  ### Added
746
550
 
747
- - **globs**: New `glob()` and `globSync()` wrapper functions for fast-glob
748
- - Provides convenient wrappers around fast-glob with normalized options
749
- - Maintains consistent API with existing glob functionality
750
- - Export: `@socketsecurity/lib/globs`
551
+ - `globs` `glob()` / `globSync()` wrapper functions for fast-glob with normalized options
751
552
 
752
553
  ## [4.1.0](https://github.com/SocketDev/socket-lib/releases/tag/v4.1.0) - 2025-11-17
753
554
 
754
555
  ### Added
755
556
 
756
- - **constants/node**: New version helper functions for cleaner version detection
757
- - `getNodeMinorVersion()`: Extract minor version number
758
- - `getNodePatchVersion()`: Extract patch version number
557
+ - `constants/node` `getNodeMinorVersion()`, `getNodePatchVersion()`
759
558
 
760
559
  ### Fixed
761
560
 
762
- - **constants/node**: Improve Node.js flag management in `getNodeHardenFlags()`
763
- - Properly guard `--experimental-permission` for Node 20-23 only
764
- - Properly guard `--permission` for Node 24+ only
765
- - Properly guard `--force-node-api-uncaught-exceptions-policy` for Node 22+ (was incorrectly applied to all versions)
766
- - Automatically include permission grants from `getNodePermissionFlags()` for Node 24+
767
- - Remove `--experimental-policy` flag (no policy file provided)
561
+ - `constants/node` `getNodeHardenFlags()` — `--experimental-permission` guarded for Node 20-23; `--permission` for Node 24+; `--force-node-api-uncaught-exceptions-policy` for Node 22+. Removed `--experimental-policy`
768
562
 
769
563
  ## [4.0.1](https://github.com/SocketDev/socket-lib/releases/tag/v4.0.1) - 2025-11-17
770
564
 
771
565
  ### Changed
772
566
 
773
- - Removed # path imports and replaced with relative paths
567
+ - Replaced `#`-path imports with relative paths
774
568
 
775
569
  ## [4.0.0](https://github.com/SocketDev/socket-lib/releases/tag/v4.0.0) - 2025-11-15
776
570
 
777
571
  ### Changed
778
572
 
779
- - **paths**: Reorganized path utilities into dedicated `paths/*` submodules for improved modularity
780
- - **imports**: Converted lazy require() calls to ES6 static imports for better tree-shaking and bundler compatibility
573
+ - **BREAKING**: `paths` reorganized into dedicated `paths/*` submodules
574
+ - Lazy `require()` calls converted to ES6 static imports for better tree-shaking
781
575
 
782
576
  ## [3.5.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.5.0) - 2025-11-14
783
577
 
784
578
  ### Added
785
579
 
786
- - **argv/quote**: New utilities for quoting command-line arguments when using `spawn()` with `shell: true`
787
- - `posixQuote(arg)`: Quote arguments for POSIX shells (bash, sh, zsh) using single quotes
788
- - `win32Quote(arg)`: Quote arguments for Windows cmd.exe using double quotes
580
+ - `argv/quote` `posixQuote(arg)` (single-quote for bash/sh/zsh) and `win32Quote(arg)` (double-quote for cmd.exe). Use when invoking `spawn()` with `shell: true`
789
581
 
790
582
  ## [3.4.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.4.0) - 2025-11-14
791
583
 
792
584
  ### Added
793
585
 
794
- - **Spinner**: New `skip()` and `skipAndStop()` methods for displaying skipped operations
795
- - `skip(text)`: Display skip message alongside spinner (e.g., "Skipping optional step...")
796
- - `skipAndStop(text)`: Display skip message and stop spinner in one call
797
- - Uses cyan ↻ (refresh/reload) symbol with @ ASCII fallback
798
- - Normalizes text formatting consistently with other spinner methods
799
- - Useful for communicating skipped steps during long-running operations
800
-
801
- - **Logger**: New `skip()` method and symbol for skipped operations
802
- - `LOG_SYMBOLS.skip`: New cyan ↻ symbol for skip output (@ ASCII fallback)
803
- - `skip(message)`: Display skip messages with dedicated symbol
804
- - Complements existing info/step/success/error/warning/reason methods
586
+ - `Spinner` `skip(text)` / `skipAndStop(text)` display skip messages with cyan ↻ symbol
587
+ - `Logger` `skip(message)` and `LOG_SYMBOLS.skip`
805
588
 
806
589
  ## [3.3.11](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.11) - 2025-11-14
807
590
 
808
591
  ### Fixed
809
592
 
810
- - **prompts**: Fix "inquirerPrompt is not a function" error in interactive prompts
811
- - Properly handle inquirer modules with multiple exports (select, search)
593
+ - `prompts` "inquirerPrompt is not a function" when inquirer modules expose multiple exports (select, search)
812
594
 
813
595
  ## [3.3.10](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.10) - 2025-11-14
814
596
 
815
597
  ### Fixed
816
598
 
817
- - **deps**: Add string-width and wrap-ansi overrides for bundling compatibility
818
- - Forces string-width@8.1.0 and wrap-ansi@9.0.2 for compatibility with strip-ansi@7.1.2
599
+ - `string-width@8.1.0` and `wrap-ansi@9.0.2` overrides for `strip-ansi@7.1.2` compatibility
819
600
 
820
601
  ## [3.3.9](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.9) - 2025-11-14
821
602
 
822
603
  ### Fixed
823
604
 
824
- - **deps**: Add strip-ansi override to fix bundling compatibility
825
- - Forces strip-ansi@7.1.2 for compatibility with ansi-regex@6.2.2
605
+ - `strip-ansi@7.1.2` override for `ansi-regex@6.2.2` compatibility
826
606
 
827
607
  ## [3.3.8](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.8) - 2025-11-14
828
608
 
829
609
  ### Fixed
830
610
 
831
- - **spinner**: Clear remaining artifacts after withSpinner stops
832
- - Fixed rogue spinner characters persisting after spinner completes
611
+ - `spinner` clear remaining artifacts after `withSpinner` stops (rogue spinner characters)
833
612
 
834
613
  ## [3.3.7](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.7) - 2025-11-13
835
614
 
836
615
  ### Changed
837
616
 
838
- - **refactor**: Add explicit `.js` extensions to external require calls
839
- - Improves module resolution clarity and compatibility with modern bundlers
840
- - Updated 18 require calls across 10 source files
617
+ - Explicit `.js` extensions on external `require()` calls for modern bundler compat
841
618
 
842
619
  ## [3.3.6](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.6) - 2025-11-13
843
620
 
844
621
  ### Changed
845
622
 
846
- - **deps**: Add pnpm overrides to consolidate package versions
847
- - Force single versions: `@npmcli/arborist@9.1.6`, `@npmcli/run-script@10.0.0`, `semver@7.7.2`, `ansi-regex@6.2.2`, `lru-cache@11.2.2`
848
- - Update patch from `@npmcli/run-script@9.1.0` to `@npmcli/run-script@10.0.0`
849
- - Reduces duplicate dependencies and potential version conflicts
623
+ - pnpm overrides consolidate `@npmcli/arborist@9.1.6`, `@npmcli/run-script@10.0.0`, `semver@7.7.2`, `ansi-regex@6.2.2`, `lru-cache@11.2.2` to single versions
850
624
 
851
625
  ## [3.3.5](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.5) - 2025-11-13
852
626
 
853
627
  ### Fixed
854
628
 
855
- - **build**: Add patches to prevent node-gyp bundling issues
629
+ - Patches to prevent `node-gyp` bundling issues
856
630
 
857
631
  ## [3.3.4](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.4) - 2025-11-13
858
632
 
859
633
  ### Fixed
860
634
 
861
- - **build**: Mark node-gyp as external in npm-pack bundle
635
+ - `node-gyp` marked external in `npm-pack` bundle
862
636
 
863
637
  ## [3.3.3](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.3) - 2025-11-13
864
638
 
865
639
  ### Fixed
866
640
 
867
- - **build**: Break node-gyp string to prevent bundler issues with ESM/CJS interop
641
+ - `node-gyp` string broken to prevent bundler ESM/CJS interop issues
868
642
 
869
643
  ## [3.3.2](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.2) - 2025-11-13
870
644
 
871
645
  ### Changed
872
646
 
873
- - **dlx**: Install package dependencies after download
874
- - **external**: Optimize npm package bundle sizes (~3MB reduction)
647
+ - `dlx` installs package dependencies after download
648
+ - npm package bundle sizes reduced ~3 MB
875
649
 
876
650
  ## [3.3.1](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.1) - 2025-11-11
877
651
 
878
652
  ### Added
879
653
 
880
- - Added `SOCKET_DOCS_CONTACT_URL` constant for documentation contact support page
881
- - Added `checkbox` prompt support
654
+ - `SOCKET_DOCS_CONTACT_URL` constant
655
+ - `checkbox` prompt support
882
656
 
883
657
  ## [3.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.3.0) - 2025-11-07
884
658
 
885
659
  ### Added
886
660
 
887
- - **Spinner**: New `reason()` and `reasonAndStop()` methods for displaying working/thinking output
888
- - `reason(text)`: Display reason text alongside spinner (e.g., "Analyzing dependencies...")
889
- - `reasonAndStop(text)`: Display reason text and stop spinner in one call
890
- - Normalizes text formatting consistently with other spinner methods
891
- - Useful for communicating progress steps during long-running operations
892
-
893
- - **Logger**: New `reason()` method and symbol for working/thinking output
894
- - `LOG_SYMBOLS.reason`: New symbol for reason output (distinct from info/step symbols)
895
- - `reason(message)`: Display reason messages with dedicated symbol
896
- - Complements existing info/step/success/error/warning methods
661
+ - `Spinner` `reason(text)` / `reasonAndStop(text)` display working/thinking output
662
+ - `Logger` `reason(message)` and `LOG_SYMBOLS.reason`
897
663
 
898
664
  ## [3.2.8](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.8) - 2025-11-05
899
665
 
900
666
  ### Fixed
901
667
 
902
- - **build**: Fix CommonJS export script edge cases
903
- - Fixed stray semicolons after comment placeholders in transformed modules
904
- - Fixed incorrect transformation of `module.exports.default` to `module.module.exports`
905
- - Ensures external dependencies and default exports work correctly
668
+ - CommonJS export script edge cases (stray semicolons after comment placeholders; incorrect `module.exports.default` → `module.module.exports`)
906
669
 
907
670
  ## [3.2.7](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.7) - 2025-11-05
908
671
 
909
672
  ### Fixed
910
673
 
911
- - **build-externals**: Disable minification to preserve exports
912
- - External dependencies are no longer minified during bundling
913
- - Prevents export name mangling that breaks CommonJS interop
914
- - Fixes `semver.parse()` and `semver.major()` being undefined
915
-
916
- - **build**: Fix CommonJS export interop for TypeScript default exports
917
- - Modules with `export default` now work without requiring `.default` accessor
918
-
919
- ### Changed
920
-
921
- - **docs**: Moved packages README to correct location (`src/packages/README.md`)
674
+ - External dependency minification disabled to preserve exports (was breaking `semver.parse()`, `semver.major()`)
675
+ - CommonJS export interop for TypeScript `export default` no longer needs `.default` accessor
922
676
 
923
677
  ## [3.2.6](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.6) - 2025-11-05
924
678
 
925
679
  ### Fixed
926
680
 
927
- - **logger**: Replace yoctocolors-cjs rgb() with manual ANSI codes
928
- - The yoctocolors-cjs package doesn't have an rgb() method
929
- - Manually construct ANSI escape sequences for RGB colors (ESC[38;2;r;g;bm...ESC[39m)
930
- - Affects `src/logger.ts` and `src/stdio/prompts.ts` applyColor() functions
681
+ - `logger` and `stdio/prompts` — manual ANSI escape sequences for RGB colors (yoctocolors-cjs has no `rgb()` method)
931
682
 
932
683
  ## [3.2.5](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.5) - 2025-11-05
933
684
 
934
685
  ### Added
935
686
 
936
- - **scripts**: Add path alias resolution script (`fix-path-aliases.mjs`)
937
- - Resolves internal path aliases (`#lib/*`, `#constants/*`, etc.) to relative paths in built CommonJS files
938
-
939
- - **build**: Integrate path alias resolution into build pipeline
940
- - Add path alias plugin to esbuild config
941
- - Integrate `fix-path-aliases.mjs` into build process
942
- - Ensures path aliases work correctly in compiled CommonJS output
687
+ - Path alias resolution in build pipeline — `#lib/*` / `#constants/*` aliases resolve to relative paths in compiled CommonJS
943
688
 
944
689
  ## [3.2.4](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.4) - 2025-11-04
945
690
 
946
691
  ### Added
947
692
 
948
- - **Logger**: New `time()` method for timing operations with automatic duration reporting
949
- - Starts a named timer and returns a `stop()` function
950
- - Automatically logs completion with formatted duration (e.g., "Operation completed in 1.23s")
951
- - Useful for performance monitoring and debugging
693
+ - `Logger` `time()` start a named timer; returns `stop()` that logs completion with formatted duration
952
694
 
953
695
  ### Fixed
954
696
 
955
- - **Spinner effects**: Fixed star spinner frames by adding trailing space for consistent spacing
956
- - **Build system**: Fixed external dependency bundling issues
957
- - Bundle `@npmcli/package-json` with subpath exports support
958
- - Use `src/external` files as bundle entry points for proper module resolution
959
- - Bundle libnpmexec from npm instead of using vendored version
960
- - Prevent circular dependencies with `createForceNodeModulesPlugin()` to force resolution from node_modules
961
-
962
- ## [3.2.3](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.3) - 2025-11-03
963
-
964
- ### Internal
965
-
966
- - **Build system**: Added stub infrastructure for external dependency bundling
967
- - Created organized `scripts/build-externals/stubs/` directory with utility and active stubs
968
- - Added conservative stubs for unused dependencies: `encoding`/`iconv-lite` and `debug`
969
- - Reduces external bundle size by ~18KB (9KB from encoding stubs, 9KB from debug stubs)
697
+ - Star spinner frames added trailing space for consistent spacing
970
698
 
971
699
  ## [3.2.2](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.2) - 2025-11-03
972
700
 
973
701
  ### Added
974
702
 
975
- - **DLX**: Binary permission management with chmod 0o755 for all package binaries
976
- - New `makePackageBinsExecutable()` function ensures all binaries in installed packages are executable
977
- - Aligns with npm's cmd-shim approach for binary permissions
978
- - Handles both single and multiple binary packages
979
- - No-op on Windows (permissions not needed)
980
-
981
- - **DLX**: npm-compatible bin resolution via vendored `getBinFromManifest`
982
- - Cherry-picked `getBinFromManifest` from libnpmexec@10.1.8 (~1.5 KB)
983
- - Avoids 1.1 MB bundle by vendoring single function instead of full package
984
- - Provides battle-tested npm bin resolution strategy
985
- - Maintains user-friendly fallbacks for edge cases
986
-
987
- ### Changed
988
-
989
- - **DLX**: Enhanced `findBinaryPath()` with npm's resolution strategy
990
- - Primary: npm's `getBinFromManifest` (handles standard cases and aliases)
991
- - Fallback: user-provided `binaryName` parameter
992
- - Fallback: last segment of package name
993
- - Last resort: first binary in list
703
+ - `dlx` `makePackageBinsExecutable()` chmod 0o755 on all package binaries (no-op on Windows)
704
+ - `dlx` `findBinaryPath()` adopts npm's resolution strategy (vendored `getBinFromManifest` from libnpmexec)
994
705
 
995
706
  ### Performance
996
707
 
997
- - **Optimized package size**: Reduced bundle size through strategic export minimization and vendoring
998
- - Vendored `getBinFromManifest` function instead of bundling full libnpmexec (~1.1 MB savings)
999
- - Minimized external module exports for better tree-shaking:
1000
- - `fast-sort`: Now exports only `{ createNewSortInstance }` (2.1 KB, 96% reduction from ~56 KB)
1001
- - `fast-glob`: Now exports only `{ globStream }` (82 KB bundle)
1002
- - `del`: Now exports only `{ deleteAsync, deleteSync }` (100 KB bundle)
1003
- - `streaming-iterables`: Now exports only `{ parallelMap, transform }` (11 KB, 93% reduction from ~168 KB)
1004
- - Total savings: ~1.3 MB (1.1 MB from vendoring + 211 KB from minimized exports)
1005
- - Establishes pattern for future external module additions
708
+ - Bundle size reduced ~1.3 MB total vendored `getBinFromManifest` (1.1 MB savings) + minimized exports for `fast-sort`, `fast-glob`, `del`, `streaming-iterables`
1006
709
 
1007
710
  ## [3.2.1](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.1) - 2025-11-02
1008
711
 
1009
712
  ### Changed
1010
713
 
1011
- - **Logger/Spinner**: Use module-level constants to prevent duplicate and rogue spinner indicators
1012
- - Call `getDefaultLogger()` and `getDefaultSpinner()` once at module scope instead of repeated calls
1013
- - Prevents multiple spinner instances that can cause duplicate or lingering indicators in terminal output
1014
- - Applied in `src/dlx-manifest.ts`, `src/stdio/mask.ts`, and `src/spinner.ts`
1015
- - Follows DRY principle and aligns with socket-registry/socket-sdk-js patterns
1016
-
1017
- ### Fixed
1018
-
1019
- - **Scripts**: Fixed undefined logger variable in update script
1020
- - Replaced undefined `log` references with `_logger` throughout `scripts/update.mjs`
1021
- - Resolves ESLint errors that blocked test execution
1022
- - **Tests**: Improved stdout test stability by checking call delta instead of absolute counts
1023
- - Fixed flaky CI failures where spy call count was 101 instead of expected 100
1024
- - More robust approach handles potential state leakage between tests
1025
- - **Tests**: Removed unnecessary 10ms delay in cache-with-ttl test
1026
- - Cache with memoization enabled updates in-memory storage synchronously
1027
- - Delay was insufficient in CI and unnecessary given synchronous behavior
1028
- - Resolves flaky CI failures where cached values returned undefined
714
+ - `Logger` / `Spinner` call `getDefaultLogger()` / `getDefaultSpinner()` once at module scope to prevent duplicate spinner indicators
1029
715
 
1030
716
  ## [3.2.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.2.0) - 2025-11-02
1031
717
 
1032
718
  ### Added
1033
719
 
1034
- - **DLX**: Unified manifest for packages and binaries
1035
- - Centralized manifest system for tracking DLX-compatible packages
1036
- - Simplifies package and binary lookups for dependency-free execution
720
+ - `dlx` unified manifest for packages and binaries
1037
721
 
1038
722
  ## [3.1.3](https://github.com/SocketDev/socket-lib/releases/tag/v3.1.3) - 2025-11-02
1039
723
 
1040
724
  ### Changed
1041
725
 
1042
- - **Dependencies**: Updated `@socketregistry/packageurl-js` to 1.3.5
726
+ - `@socketregistry/packageurl-js` updated to 1.3.5
1043
727
 
1044
728
  ## [3.1.2](https://github.com/SocketDev/socket-lib/releases/tag/v3.1.2) - 2025-11-02
1045
729
 
1046
730
  ### Fixed
1047
731
 
1048
- - **External dependencies**: Fixed incorrectly marked external dependencies to use wrapper pattern
1049
- - Updated `src/constants/agents.ts` to use `require('../external/which')` instead of direct imports
1050
- - Updated `src/zod.ts` to export from `./external/zod'` instead of direct imports
1051
- - Maintains zero dependencies policy by ensuring all runtime dependencies go through the external wrapper pattern
1052
- - **Spinner**: Fixed undefined properties in setShimmer by handling defaults correctly
732
+ - `Spinner` `setShimmer` handle undefined properties via defaults
733
+ - External deps now go through the wrapper pattern (`require('../external/which')`, etc.) maintains zero-deps policy
1053
734
 
1054
735
  ## [3.1.1](https://github.com/SocketDev/socket-lib/releases/tag/v3.1.1) - 2025-11-02
1055
736
 
1056
737
  ### Fixed
1057
738
 
1058
- - **Cache TTL**: Fixed flaky test by handling persistent cache write failures gracefully
1059
- - Wrapped `cacache.put` in try/catch to prevent failures when persistent cache writes fail or are slow
1060
- - In-memory cache is updated synchronously before the persistent write, so immediate reads succeed regardless of persistent cache state
1061
- - Improves reliability in test environments and when cache directory has issues
739
+ - `cache-with-ttl` `cacache.put` wrapped in try/catch so persistent-cache write failures don't break in-memory reads
1062
740
 
1063
741
  ## [3.1.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.1.0) - 2025-11-01
1064
742
 
1065
743
  ### Changed
1066
744
 
1067
- - **File system utilities**: `safeMkdir` and `safeMkdirSync` now default to `recursive: true`
1068
- - Nested directories are created by default, simplifying common usage patterns
745
+ - `fs` `safeMkdir` / `safeMkdirSync` default to `recursive: true`
1069
746
 
1070
747
  ## [3.0.6](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.6) - 2025-11-01
1071
748
 
1072
749
  ### Added
1073
750
 
1074
- - **Build validation**: Added guard against `link:` protocol dependencies in package.json
1075
- - New `validate-no-link-deps.mjs` script automatically runs during `pnpm run check`
1076
- - Prevents accidental publication with `link:` dependencies which can cause issues
1077
- - Recommends using `workspace:` for monorepos or `catalog:` for centralized version management
1078
- - Validates all dependency fields: dependencies, devDependencies, peerDependencies, optionalDependencies
751
+ - Build validation guard against `link:` protocol dependencies in `package.json` (`validate-no-link-deps.mjs` runs during `pnpm run check`)
1079
752
 
1080
753
  ### Changed
1081
754
 
1082
- - **Dependencies**: Updated `@socketregistry/packageurl-js` to 1.3.3
1083
- - **Git hooks**: Committed pre-commit and pre-push hook configurations for version control
1084
- - **Scripts**: Removed shebang from `validate-no-link-deps` script (Node.js script, not shell)
755
+ - `@socketregistry/packageurl-js` updated to 1.3.3
1085
756
 
1086
757
  ## [3.0.5](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.5) - 2025-11-01
1087
758
 
1088
759
  ### Fixed
1089
760
 
1090
- - **Critical: Prompts API breaking changes**: Restored working prompts implementation that was accidentally replaced with non-functional stub in v3.0.0
1091
- - Consolidated all prompts functionality into `src/stdio/prompts.ts`
1092
- - Removed unimplemented stub from `src/prompts/` that was throwing "not yet implemented" errors
1093
- - Removed `./prompts` package export (use `@socketsecurity/lib/stdio/prompts` instead)
1094
- - Restored missing exports: `password`, `search`, `Separator`, and added `createSeparator()` helper
1095
- - Fixed `Choice` type to use correct `name` property (matching `@inquirer` API, not erroneous `label`)
761
+ - **Critical**: prompts API restored non-functional stub from v3.0.0 replaced with working implementation. `@socketsecurity/lib/stdio/prompts` exports `password`, `search`, `Separator`, `createSeparator()`. `Choice.name` (was erroneously `label`)
1096
762
 
1097
763
  ### Added
1098
764
 
1099
- - **Theme integration for prompts**: Prompts now automatically use the active theme colors
1100
- - Prompt messages styled with `colors.prompt`
1101
- - Descriptions and disabled items styled with `colors.textDim`
1102
- - Answers and highlights styled with `colors.primary`
1103
- - Error messages styled with `colors.error`
1104
- - Success indicators styled with `colors.success`
1105
- - Exported `createInquirerTheme()` function for converting Socket themes to @inquirer format
1106
- - Consistent visual experience with Logger and Spinner theme integration
1107
-
1108
- - **Theme parameter support**: Logger, Prompts, and text effects now accept optional `theme` parameter
1109
- - Pass theme names (`'socket'`, `'sunset'`, `'terracotta'`, `'lush'`, `'ultra'`) or Theme objects
1110
- - **Logger**: `new Logger({ theme: 'sunset' })` - uses theme-specific symbol colors
1111
- - **Prompts**: `await input({ message: 'Name:', theme: 'ultra' })` - uses theme for prompt styling
1112
- - **Text effects**: `applyShimmer(text, state, { theme: 'terracotta' })` - uses theme for shimmer colors
1113
- - Instance-specific themes override global theme context when provided
1114
- - Falls back to global theme context when no instance theme specified
1115
- - **Note**: Spinner already had theme parameter support in v3.0.0
765
+ - Prompts adopt the active theme (`colors.prompt`, `textDim`, `primary`, `error`, `success`); `createInquirerTheme()` exported
766
+ - Theme parameter support `Logger`, prompts, and text effects accept `theme: 'socket' | 'sunset' | 'terracotta' | 'lush' | 'ultra'` (or a Theme object)
1116
767
 
1117
768
  ### Removed
1118
769
 
1119
- - **Unused index entrypoint**: Removed `src/index.ts` and package exports for `"."` and `"./index"`
1120
- - This was a leftover from socket-registry and not needed for this library
1121
- - Users should import specific modules directly (e.g., `@socketsecurity/lib/logger`)
1122
- - Breaking: `import { getDefaultLogger } from '@socketsecurity/lib'` no longer works
1123
- - Use: `import { getDefaultLogger } from '@socketsecurity/lib/logger'` instead
770
+ - **BREAKING**: `src/index.ts` deleted; main index `"."` / `"./index"` exports gone. Import specific modules: `@socketsecurity/lib/logger` instead of `@socketsecurity/lib`
1124
771
 
1125
772
  ## [3.0.4](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.4) - 2025-11-01
1126
773
 
1127
774
  ### Changed
1128
775
 
1129
- - **Sunset theme**: Updated colors from azure blue to warm orange/purple gradient matching Coana branding
1130
- - **Terracotta theme**: Renamed from `brick` to `terracotta` for better clarity
776
+ - Sunset theme azure blue warm orange/purple gradient (Coana branding)
777
+ - `brick` theme renamed to `terracotta`
1131
778
 
1132
779
  ## [3.0.3](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.3) - 2025-11-01
1133
780
 
1134
781
  ### Fixed
1135
782
 
1136
- - **Critical: Node.js ESM/CJS interop completely fixed**: Disabled minification to ensure proper ESM named import detection
1137
- - Root cause: esbuild minification was breaking Node.js ESM's CJS named export detection
1138
- - Solution: Disabled minification entirely (`minify: false` in esbuild config)
1139
- - Libraries should not be minified - consumers minify during their own build process
1140
- - Unminified esbuild output uses clear `__export` patterns that Node.js ESM natively understands
1141
- - Removed `fix-commonjs-exports.mjs` build script - no longer needed with unminified code
1142
- - ESM imports now work reliably: `import { getDefaultLogger } from '@socketsecurity/lib/logger'`
1143
- - Verified with real-world ESM module testing (`.mjs` files importing from CJS `.js` dist)
783
+ - **Critical**: Node.js ESM/CJS interop disabled esbuild minification (was breaking ESM named-import detection from CJS dist). ESM imports now work reliably
1144
784
 
1145
785
  ## [3.0.2](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.2) - 2025-11-01
1146
786
 
1147
787
  ### Fixed
1148
788
 
1149
- - **Critical: Node.js ESM named imports from CommonJS**: Fixed build output to ensure Node.js ESM can properly detect named exports from CommonJS modules
1150
- - Previously, esbuild's minified export pattern placed `module.exports` before variable definitions, causing "Cannot access before initialization" errors
1151
- - Build script now uses `@babel/parser` + `magic-string` for safe AST parsing and transformation
1152
- - Exports are now correctly placed at end of files after all variable definitions
1153
- - Enables proper ESM named imports: `import { getDefaultLogger, Logger } from '@socketsecurity/lib/logger'`
1154
- - Fixes socket-cli issue where named imports were failing with obscure initialization errors
789
+ - **Critical**: Node.js ESM named imports from CommonJS `module.exports` placed before variable defs caused "Cannot access before initialization". Build now uses `@babel/parser` + `magic-string` to position exports at end of file
1155
790
 
1156
791
  ## [3.0.1](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.1) - 2025-11-01
1157
792
 
1158
793
  ### Added
1159
794
 
1160
- - **Convenience exports from main index**: Added logger and spinner exports to ease v2→v3 migration
1161
- - Logger: `getDefaultLogger()`, `Logger`, `LOG_SYMBOLS` now available from `@socketsecurity/lib`
1162
- - Spinner: `getDefaultSpinner()`, `Spinner` now available from `@socketsecurity/lib`
1163
- - Both main index (`@socketsecurity/lib`) and subpath (`@socketsecurity/lib/logger`, `@socketsecurity/lib/spinner`) imports now work
1164
- - Both import paths return the same singleton instances
795
+ - Convenience re-exports of `getDefaultLogger`, `Logger`, `LOG_SYMBOLS`, `getDefaultSpinner`, `Spinner` from main index for v2→v3 migration
1165
796
 
1166
797
  ### Fixed
1167
798
 
1168
- - **Critical: Spinner crashes when calling logger**: Fixed spinner internal calls to use `getDefaultLogger()` instead of removed `logger` export
1169
- - Spinner methods (`start()`, `stop()`, `success()`, `fail()`, etc.) no longer crash with "logger is not defined" errors
1170
- - All 5 internal logger access points updated to use the correct v3 API
1171
- - Resolves runtime errors when using spinners with hoisted variables
1172
-
1173
- ### Changed
1174
-
1175
- - **Migration path improvement**: Users can now import logger/spinner from either main index or subpaths, reducing breaking change impact from v3.0.0
799
+ - **Critical**: Spinner internal calls to removed `logger` export use `getDefaultLogger()` (5 call sites)
1176
800
 
1177
801
  ## [3.0.0](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.0) - 2025-11-01
1178
802
 
1179
803
  ### Added
1180
804
 
1181
- - Theme system with 5 built-in themes: `socket`, `sunset`, `terracotta`, `lush`, `ultra`
1182
- - `setTheme()`, `getTheme()`, `withTheme()`, `withThemeSync()` for theme management
1183
- - `createTheme()`, `extendTheme()`, `resolveColor()` helper functions
1184
- - `onThemeChange()` event listener for theme reactivity
1185
- - `link()` function for themed terminal hyperlinks in `@socketsecurity/lib/links`
1186
- - Logger and spinner now inherit theme colors automatically
1187
- - Spinner methods: `enableShimmer()`, `disableShimmer()`, `setShimmer()`, `updateShimmer()`
1188
- - DLX cross-platform binary resolution (`.cmd`, `.bat`, `.ps1` on Windows)
1189
- - DLX programmatic options aligned with CLI conventions (`force`, `quiet`, `package`)
805
+ - Theme system 5 built-in themes (`socket`, `sunset`, `terracotta`, `lush`, `ultra`); `setTheme`, `getTheme`, `withTheme`, `withThemeSync`, `createTheme`, `extendTheme`, `resolveColor`, `onThemeChange`
806
+ - `links` `link()` themed terminal hyperlinks
807
+ - Logger and spinner inherit theme colors
808
+ - Spinner methods: `enableShimmer`, `disableShimmer`, `setShimmer`, `updateShimmer`
809
+ - `dlx` cross-platform binary resolution (`.cmd`, `.bat`, `.ps1` on Windows)
1190
810
 
1191
811
  ### Changed
1192
812
 
1193
- - Theme context uses AsyncLocalStorage instead of manual stack management
1194
- - Promise retry options renamed: `factor` → `backoffFactor`, `minTimeout` → `baseDelayMs`, `maxTimeout` → `maxDelayMs`
813
+ - Theme context uses `AsyncLocalStorage` instead of manual stack
814
+ - **BREAKING**: Promise retry options renamed `factor` → `backoffFactor`, `minTimeout` → `baseDelayMs`, `maxTimeout` → `maxDelayMs`
1195
815
 
1196
816
  ### Removed
1197
817
 
1198
- **BREAKING CHANGES:**
1199
-
1200
- - `pushTheme()` and `popTheme()` - use `withTheme()` or `withThemeSync()` instead
1201
- - `logger` export - use `getDefaultLogger()` instead
1202
- - `spinner` export - use `getDefaultSpinner()` instead
1203
- - `download-lock.ts` - use `process-lock.ts` instead
818
+ - **BREAKING**: `pushTheme()` / `popTheme()` — use `withTheme()` / `withThemeSync()`
819
+ - **BREAKING**: `logger` / `spinner` exports — use `getDefaultLogger()` / `getDefaultSpinner()`
820
+ - **BREAKING**: `download-lock.ts` use `process-lock.ts`
1204
821
  - Promise option aliases: `factor`, `minTimeout`, `maxTimeout`
1205
822
 
1206
- ---
1207
-
1208
- # Changelog
1209
-
1210
- All notable changes to this project will be documented in this file.
1211
-
1212
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
1213
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1214
-
1215
823
  ## [2.10.3](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.3) - 2025-10-31
1216
824
 
1217
825
  ### Fixed
1218
826
 
1219
- - Updated `@socketregistry/packageurl-js` to 1.3.1 to resolve an unintended external dependency
1220
- - **Documentation**: Corrected JSDoc `@example` import paths from `@socketsecurity/registry` to `@socketsecurity/lib` across utility modules
1221
- - Updated examples in `memoization.ts`, `performance.ts`, `spinner.ts`, `suppress-warnings.ts`, and `tables.ts`
1222
- - Ensures documentation reflects correct package name after v1.0.0 rename
827
+ - `@socketregistry/packageurl-js` updated to 1.3.1 (resolves unintended external dep)
828
+ - JSDoc `@example` import paths corrected after v1.0.0 rename (`@socketsecurity/registry` `@socketsecurity/lib`)
1223
829
 
1224
830
  ## [2.10.2](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.2) - 2025-10-31
1225
831
 
1226
832
  ### Changed
1227
833
 
1228
- - **Package spec parsing**: Refactored to use official `npm-package-arg` library for robust handling of all npm package specification formats (versions, ranges, tags, git URLs)
1229
- - Improves reliability when parsing complex package specs
1230
- - Better handles edge cases in version ranges and scoped packages
1231
- - Falls back to simple parsing if npm-package-arg fails
834
+ - Package spec parsing uses official `npm-package-arg` library for full npm spec support (versions, ranges, tags, git URLs); falls back to simple parsing if it fails
1232
835
 
1233
836
  ### Fixed
1234
837
 
1235
- - **Scoped package version parsing**: Fixed critical bug where parsePackageSpec was stripping the `@` prefix from scoped packages with versions
1236
- - Example: `@coana-tech/cli@~14.12.51` was incorrectly parsed as `coana-tech/cli@~14.12.51`
1237
- - Caused package installation failures for scoped packages in DLX system
838
+ - **Critical**: `parsePackageSpec` no longer strips the `@` prefix from scoped+versioned specs (e.g., `@coana-tech/cli@~14.12.51`)
1238
839
 
1239
840
  ## [2.10.1](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.1) - 2025-10-31
1240
841
 
1241
842
  ### Fixed
1242
843
 
1243
- - **Process lock directory creation**: Use recursive mkdir to ensure parent directories exist when creating lock directory
1244
- - **Node.js debug flags**: Remove buggy `getNodeDebugFlags()` function that returned debug flags without required argument values
844
+ - Process lock recursive mkdir for parent dirs
845
+ - Removed buggy `getNodeDebugFlags()` (returned flags without required argument values)
1245
846
 
1246
847
  ## [2.10.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.10.0) - 2025-10-30
1247
848
 
1248
849
  ### Added
1249
850
 
1250
- - **Unified DLX metadata schema**: Standardized `.dlx-metadata.json` format across TypeScript and C++ implementations
1251
- - Exported `DlxMetadata` interface as canonical schema reference
1252
- - Core fields: `version`, `cache_key`, `timestamp`, `checksum`, `checksum_algorithm`, `platform`, `arch`, `size`, `source`
1253
- - Support for `source` tracking (download vs decompression origin)
1254
- - Reserved `extra` field for implementation-specific data
1255
- - Comprehensive documentation with examples for both download and decompression use cases
851
+ - Unified `.dlx-metadata.json` schema `DlxMetadata` interface exported. Fields: `version`, `cache_key`, `timestamp`, `checksum`, `checksum_algorithm`, `platform`, `arch`, `size`, `source` (`{ type, url }`); reserved `extra` for impl-specific data
1256
852
 
1257
853
  ### Changed
1258
854
 
1259
- - **DLX binary metadata structure**: Updated `writeBinaryCacheMetadata()` to use unified schema with additional fields
1260
- - Now includes `cache_key` (first 16 chars of SHA-512 hash)
1261
- - Added `size` field for cached binary size
1262
- - Added `checksum_algorithm` field (currently "sha256")
1263
- - Restructured to use `source.type` and `source.url` for origin tracking
1264
- - Maintains backward compatibility in `listDlxCache()` reader
855
+ - `dlx` `writeBinaryCacheMetadata()` adopts the unified schema (`cache_key` = SHA-512 prefix, `size`, `checksum_algorithm`, `source.type`/`source.url`)
1265
856
 
1266
857
  ## [2.9.1](https://github.com/SocketDev/socket-lib/releases/tag/v2.9.1) - 2025-10-30
1267
858
 
1268
859
  ### Added
1269
860
 
1270
- - **Smart binary detection in dlxPackage**: Automatically finds the correct binary even when package name doesn't match binary name
1271
- - If package has single binary, uses it automatically regardless of name
1272
- - Resolves packages like `@socketsecurity/cli` (binary: `socket`) without manual configuration
1273
- - Falls back to intelligent name matching for multi-binary packages
1274
- - **Optional binaryName parameter**: Added `binaryName` option to `DlxPackageOptions` for explicit binary selection when auto-detection isn't sufficient
861
+ - `dlxPackage` smart binary detection uses single-binary packages directly regardless of name. Optional `binaryName` for explicit selection on multi-binary packages
1275
862
 
1276
863
  ### Fixed
1277
864
 
1278
- - **Binary resolution for scoped packages**: Fixed issue where `dlxPackage` couldn't find binaries when package name didn't match binary name (e.g., `@socketsecurity/cli` with `bin: { socket: '...' }`)
865
+ - Binary resolution for scoped packages where package name binary name (e.g., `@socketsecurity/cli` exposes `bin: { socket: '...' }`)
1279
866
 
1280
867
  ## [2.9.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.9.0) - 2025-10-30
1281
868
 
1282
869
  ### Added
1283
870
 
1284
- - **Socket.dev URL constants**: Added centralized URL constants for Socket.dev services
1285
- - `SOCKET_WEBSITE_URL`: Main Socket.dev website
1286
- - `SOCKET_CONTACT_URL`: Contact page
1287
- - `SOCKET_DASHBOARD_URL`: Dashboard homepage
1288
- - `SOCKET_API_TOKENS_URL`: API tokens settings page
1289
- - `SOCKET_PRICING_URL`: Pricing information
1290
- - `SOCKET_STATUS_URL`: Service status page
1291
- - `SOCKET_DOCS_URL`: Documentation site
1292
- - Available via `@socketsecurity/lib/constants/socket`
871
+ - `constants/socket` URL constants `SOCKET_WEBSITE_URL`, `SOCKET_CONTACT_URL`, `SOCKET_DASHBOARD_URL`, `SOCKET_API_TOKENS_URL`, `SOCKET_PRICING_URL`, `SOCKET_STATUS_URL`, `SOCKET_DOCS_URL`
1293
872
 
1294
873
  ### Changed
1295
874
 
1296
- - **Enhanced error messages across library**: Comprehensive audit and improvement of error handling
1297
- - Added actionable error messages with resolution steps throughout modules
1298
- - Improved file system operation errors (permissions, read-only filesystems, path issues)
1299
- - Enhanced DLX error messages with clear troubleshooting guidance
1300
- - Better error context in process locking, binary downloads, and package operations
1301
- - Consistent error formatting with helpful user guidance
1302
- - **Consolidated process locking**: Standardized on directory-based lock format across all modules
1303
- - All locking operations now use `process-lock` module exclusively
1304
- - Lock directories provide atomic guarantees across all filesystems including NFS
1305
- - Consistent mtime-based stale detection with 5-second timeout (aligned with npm npx)
1306
- - Automatic cleanup on process exit with proper signal handling
875
+ - Error messages across the library actionable resolution steps for fs, dlx, process-lock, downloads
876
+ - All locking consolidated on `process-lock` (atomic mkdir-based; 5s stale timeout aligned with npm npx)
1307
877
 
1308
878
  ## [2.8.4](https://github.com/SocketDev/socket-lib/releases/tag/v2.8.4) - 2025-10-30
1309
879
 
1310
880
  ### Added
1311
881
 
1312
- - **DLX binary helper functions mirror dlx-package pattern**
1313
- - `downloadBinary`: Download binary with caching (without execution)
1314
- - `executeBinary`: Execute cached binary without re-downloading
1315
- - Renamed internal `downloadBinary` to `downloadBinaryFile` to avoid naming conflicts
1316
- - Maintains feature parity with `downloadPackage`/`executePackage` from dlx-package
882
+ - `dlx` `downloadBinary` (cache without execution) and `executeBinary` (run cached binary). Internal `downloadBinary` renamed to `downloadBinaryFile` to avoid the naming conflict
1317
883
 
1318
884
  ## [2.8.3](https://github.com/SocketDev/socket-lib/releases/tag/v2.8.3) - 2025-10-30
1319
885
 
1320
886
  ### Fixed
1321
887
 
1322
- - **Logger now fully defers all console access for Node.js internal bootstrap compatibility**: Completed lazy initialization to prevent ERR_CONSOLE_WRITABLE_STREAM errors
1323
- - Deferred `Object.getOwnPropertySymbols(console)` call until first logger use
1324
- - Deferred `kGroupIndentationWidth` symbol lookup
1325
- - Deferred `Object.entries(console)` and prototype method initialization
1326
- - Ensures logger can be safely imported in Node.js internal bootstrap contexts (e.g., `lib/internal/bootstrap/*.js`) before stdout is initialized
1327
- - Builds on v2.8.2 console deferring to complete early bootstrap compatibility
888
+ - `Logger` defers `Object.getOwnPropertySymbols(console)`, `kGroupIndentationWidth`, and `Object.entries(console)` until first use safe to import in Node.js internal bootstrap contexts
1328
889
 
1329
890
  ## [2.8.2](https://github.com/SocketDev/socket-lib/releases/tag/v2.8.2) - 2025-10-29
1330
891
 
1331
892
  ### Changed
1332
893
 
1333
- - Enhanced Logger class to defer Console creation until first use
1334
- - Eliminates early bootstrap errors when importing logger before stdout is ready
1335
- - Enables safe logger imports during Node.js early initialization phase
1336
- - Simplified internal storage with WeakMap-only pattern for constructor args
894
+ - `Logger` defers `Console` creation until first use — eliminates early-bootstrap errors when imported before stdout is ready
1337
895
 
1338
896
  ## [2.8.1](https://github.com/SocketDev/socket-lib/releases/tag/v2.8.1) - 2025-10-29
1339
897
 
1340
898
  ### Changed
1341
899
 
1342
- - **Consolidated DLX cache key generation**: Extracted `generateCacheKey` function to shared `dlx.ts` module
1343
- - Eliminates code duplication between `dlx-binary.ts` and `dlx-package.ts`
1344
- - Enables consistent cache key generation across the Socket ecosystem
1345
- - Exports function for use in dependent packages (e.g., socket-cli)
1346
- - Maintains SHA-512 truncated to 16 chars strategy from v2.8.0
900
+ - `dlx` `generateCacheKey` extracted to shared module. Exported for downstream consumers (e.g. socket-cli)
1347
901
 
1348
902
  ## [2.8.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.8.0) - 2025-10-29
1349
903
 
1350
904
  ### Changed
1351
905
 
1352
- - **Enhanced DLX cache key generation with npm/npx compatibility**: Updated cache key strategy to align with npm/npx ecosystem patterns
1353
- - Changed from SHA-256 (64 chars) to SHA-512 truncated to 16 chars (matching npm/npx)
1354
- - Optimized for Windows MAX_PATH compatibility (260 character limit)
1355
- - Accepts collision risk for shorter paths (~1 in 18 quintillion with 1000 entries)
1356
- - Added support for PURL-style package specifications (e.g., `npm:prettier@3.0.0`, `pypi:requests@2.31.0`)
1357
- - Documented Socket's shorthand format (without `pkg:` prefix) handled by `@socketregistry/packageurl-js`
1358
- - References npm/cli v11.6.2 implementation for consistency
906
+ - `dlx` cache keys SHA-512 truncated to 16 chars (was SHA-256 / 64 chars), matching npm/npx. Better Windows `MAX_PATH` compatibility. Supports PURL specs (`npm:prettier@3.0.0`, `pypi:requests@2.31.0`)
1359
907
 
1360
908
  ## [2.7.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.7.0) - 2025-10-28
1361
909
 
1362
910
  ### Added
1363
911
 
1364
- - **DLX cache locking for concurrent installation protection**: Added process-lock protection to dlx-package installation operations
1365
- - Lock file created at `~/.socket/_dlx/<hash>/.lock` (similar to npm npx's `concurrency.lock`)
1366
- - Prevents concurrent installations from corrupting the same package cache
1367
- - Uses 5-second stale timeout and 2-second periodic touching (aligned with npm npx)
1368
- - Double-check pattern verifies installation after acquiring lock to avoid redundant work
1369
- - Completes 100% alignment with npm's npx locking strategy
912
+ - `dlx` cache locking `~/.socket/_dlx/<hash>/.lock` (npm-npx-style `concurrency.lock`). Prevents concurrent installations from corrupting the same package cache. 5s stale timeout, 2s periodic touch
1370
913
 
1371
914
  ## [2.6.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.6.0) - 2025-10-28
1372
915
 
1373
916
  ### Changed
1374
917
 
1375
- - **Process locking aligned with npm npx**: Enhanced process-lock module to match npm's npx locking strategy
1376
- - Reduced stale timeout from 10 seconds to 5 seconds (matches npm npx)
1377
- - Added periodic lock touching (2-second interval) to prevent false stale detection during long operations
1378
- - Implemented second-level granularity for mtime comparison to avoid APFS floating-point precision issues
1379
- - Added automatic touch timer cleanup on process exit
1380
- - Timers use `unref()` to prevent keeping process alive
1381
- - Aligns with npm's npx implementation per https://github.com/npm/cli/pull/8512
918
+ - `process-lock` aligned with npm npx 5s stale timeout (was 10s), 2s periodic touch, second-level mtime comparison (avoids APFS float precision), `unref()` timers, automatic cleanup on exit
1382
919
 
1383
920
  ## [2.5.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.5.0) - 2025-10-28
1384
921
 
1385
922
  ### Added
1386
923
 
1387
- - **Process locking utilities**: Added `ProcessLockManager` class providing cross-platform inter-process synchronization using file-system based locks
1388
- - Atomic lock acquisition via `mkdir()` for thread-safe operations
1389
- - Stale lock detection with automatic cleanup (default 10 seconds, aligned with npm's npx strategy)
1390
- - Exponential backoff with jitter for retry attempts
1391
- - Process exit handlers for guaranteed cleanup even on abnormal termination
1392
- - Three main APIs: `acquire()`, `release()`, and `withLock()` (recommended)
1393
- - Comprehensive test suite with `describe.sequential` for proper isolation
1394
- - Export: `@socketsecurity/lib/process-lock`
924
+ - `process-lock` `ProcessLockManager` cross-platform inter-process sync via filesystem locks. Atomic `mkdir()` acquisition; stale-lock detection (10s default); exponential backoff with jitter; exit-handler cleanup. APIs: `acquire`, `release`, `withLock` (recommended)
1395
925
 
1396
926
  ### Changed
1397
927
 
1398
- - **Script refactoring**: Renamed `spinner.succeed()` to `spinner.success()` for consistency
1399
- - **Script cleanup**: Removed redundant spinner cleanup in interactive-runner
928
+ - `spinner.succeed()` renamed to `spinner.success()`
1400
929
 
1401
930
  ## [2.4.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.4.0) - 2025-10-28
1402
931
 
1403
932
  ### Changed
1404
933
 
1405
- - **Download locking aligned with npm**: Reduced default `staleTimeout` in `downloadWithLock()` from 300 seconds to 10 seconds to align with npm's npx locking strategy
1406
- - Prevents stale locks from blocking downloads for extended periods
1407
- - Matches npm's battle-tested timeout range (5-10 seconds)
1408
- - Binary downloads now protected against concurrent corruption
1409
- - **Binary download protection**: `dlxBinary.downloadBinary()` now uses `downloadWithLock()` to prevent corruption when multiple processes download the same binary concurrently
1410
- - Eliminates race conditions during parallel binary downloads
1411
- - Maintains checksum verification and executable permissions
934
+ - `downloadWithLock()` default `staleTimeout` 300s 10s (aligns with npm npx)
935
+ - `dlxBinary.downloadBinary()` uses `downloadWithLock()` to prevent corruption from concurrent binary downloads
1412
936
 
1413
937
  ## [2.3.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.3.0) - 2025-10-28
1414
938
 
1415
939
  ### Added
1416
940
 
1417
- - **Binary utility wrapper functions**: Added `which()` and `whichSync()` wrapper functions to `bin` module
1418
- - Cross-platform binary lookup that respects PATH environment variable
1419
- - Synchronous and asynchronous variants for different use cases
1420
- - Integrates with existing binary resolution utilities
941
+ - `bin` `which()` / `whichSync()` cross-platform binary lookup respecting `PATH`
1421
942
 
1422
943
  ## [2.2.1](https://github.com/SocketDev/socket-lib/releases/tag/v2.2.1) - 2025-10-28
1423
944
 
1424
945
  ### Fixed
1425
946
 
1426
- - **Logger write() method**: Fixed `write()` to bypass Console formatting when outputting raw text
1427
- - Previously, `write()` used Console's internal `_stdout` stream which applied unintended formatting like group indentation
1428
- - Now stores a reference to the original stdout stream in a dedicated private field (`#originalStdout`) during construction
1429
- - The `write()` method uses this stored reference to write directly to the raw stream, bypassing all Console formatting layers
1430
- - Ensures raw text output without any formatting applied, fixing test failures in CI environments where writes after `indent()` were unexpectedly formatted
947
+ - `Logger` `write()` bypasses Console formatting (group indentation, etc.) now writes directly to the raw stdout reference captured at construction
1431
948
 
1432
949
  ## [2.2.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.2.0) - 2025-10-28
1433
950
 
1434
951
  ### Added
1435
952
 
1436
- - **Logger step symbol**: `logger.step()` now displays a cyan arrow symbol (or > in ASCII) before step messages for improved visual separation
1437
- - New `LOG_SYMBOLS.step` symbol added to the symbol palette
1438
- - Automatic stripping of existing symbols from step messages
1439
- - Maintains existing blank line behavior for clear step separation
953
+ - `Logger` `step()` cyan arrow `→` prefix (or `>` in ASCII fallback). New `LOG_SYMBOLS.step`
1440
954
 
1441
955
  ## [2.1.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.1.0) - 2025-10-28
1442
956
 
1443
957
  ### Added
1444
958
 
1445
- - Package manager detection utilities (`detectPackageManager()`, `getPackageManagerInfo()`, `getPackageManagerUserAgent()`)
1446
- - `isInSocketDlx()` utility to check if file path is within `~/.socket/_dlx/`
1447
- - `downloadPackage()` and `executePackage()` functions for separate download and execution of packages
959
+ - Package manager detection `detectPackageManager()`, `getPackageManagerInfo()`, `getPackageManagerUserAgent()`
960
+ - `isInSocketDlx()` check if a path is under `~/.socket/_dlx/`
961
+ - `downloadPackage()` / `executePackage()` separate download and execution
1448
962
 
1449
963
  ## [2.0.0](https://github.com/SocketDev/socket-lib/releases/tag/v2.0.0) - 2025-10-27
1450
964
 
1451
- ### Breaking Changes
1452
-
1453
- **Environment Variable System Refactor**
1454
-
1455
- This release completely refactors the environment variable system, consolidating 60+ individual env constant files into grouped getter modules with AsyncLocalStorage-based test rewiring.
1456
-
1457
- **Consolidated env files** - Individual files replaced with grouped modules:
1458
-
1459
- - `env/github.ts` - All GitHub-related env vars (GITHUB_TOKEN, GH_TOKEN, GITHUB_API_URL, etc.)
1460
- - `env/socket.ts` - Socket-specific env vars (SOCKET_API_TOKEN, SOCKET_CACACHE_DIR, etc.)
1461
- - `env/socket-cli.ts` - Socket CLI env vars (SOCKET_CLI_API_TOKEN, SOCKET_CLI_CONFIG, etc.)
1462
- - `env/npm.ts` - NPM-related env vars
1463
- - `env/locale.ts` - Locale env vars (LANG, LC_ALL, LC_MESSAGES)
1464
- - `env/windows.ts` - Windows-specific env vars (USERPROFILE, LOCALAPPDATA, APPDATA, COMSPEC)
1465
- - `env/xdg.ts` - XDG base directory env vars
1466
- - `env/temp-dir.ts` - Temp directory env vars (TEMP, TMP, TMPDIR)
1467
- - `env/test.ts` - Test framework env vars (VITEST, JEST_WORKER_ID)
1468
-
1469
- **Constants → Getter functions** - All env constants converted to functions:
1470
-
1471
- ```typescript
1472
- // Before (v1.x):
1473
- import { GITHUB_TOKEN } from '#env/github-token'
1474
-
1475
- // After (v2.x):
1476
- import { getGithubToken } from '#env/github'
1477
- ```
1478
-
1479
- **Deleted files** - Removed 60+ individual env constant files:
965
+ ### Changed
1480
966
 
1481
- - `env/github-token.ts`, `env/socket-api-token.ts`, etc. Consolidated into grouped files
1482
- - `env/getters.ts` Functions moved to their respective grouped files
967
+ - **BREAKING**: Environment variable system refactor — 60+ individual `env/<NAME>.ts` files consolidated into grouped getter modules:
968
+ - `env/github`, `env/socket`, `env/socket-cli`, `env/npm`, `env/locale`, `env/windows`, `env/xdg`, `env/temp-dir`, `env/test`
969
+ - All env constants converted to functions: `import { GITHUB_TOKEN } from '#env/github-token'` → `import { getGithubToken } from '#env/github'`
1483
970
 
1484
971
  ### Added
1485
972
 
1486
- **AsyncLocalStorage-Based Test Rewiring**
1487
-
1488
- New `env/rewire.ts` and `path/rewire.ts` modules provides context-isolated environment variable overrides for testing:
1489
-
1490
- ```typescript
1491
- import { withEnv, setEnv, resetEnv, getEnvValue } from '#env/rewire'
1492
-
1493
- // Option 1: Isolated context with AsyncLocalStorage
1494
- await withEnv({ CI: '1', NODE_ENV: 'test' }, async () => {
1495
- // CI env var is '1' only within this block
1496
- // Concurrent tests don't interfere
1497
- })
1498
-
1499
- // Option 2: Traditional beforeEach/afterEach pattern
1500
- beforeEach(() => {
1501
- setEnv('CI', '1')
1502
- })
1503
-
1504
- afterEach(() => {
1505
- resetEnv()
1506
- })
1507
- ```
1508
-
1509
- **Features:**
1510
-
1511
- - Allows toggling between snapshot and live behavior
1512
- - Compatible with `vi.stubEnv()` as fallback
1513
-
1514
- ### Changed
1515
-
1516
- - Updated all dynamic `require()` statements to use path aliases (`#constants/*`, `#packages/*`)
1517
- - Improved logger blank line tracking per stream (separate stderr/stdout tracking)
1518
- - Exported `getCacache()` function for external use
973
+ - `env/rewire` and `paths/rewire` — AsyncLocalStorage-based env/path overrides for testing. `withEnv({...}, async () => {})` for isolated context, or `setEnv` / `resetEnv` for `beforeEach`/`afterEach`
974
+ - `getCacache()` exported
1519
975
 
1520
976
  ## [1.3.6](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.6) - 2025-10-26
1521
977
 
1522
978
  ### Fixed
1523
979
 
1524
- - Fixed `debug` module functions being incorrectly tree-shaken as no-ops in bundled output
1525
- - Removed incorrect `/*@__NO_SIDE_EFFECTS__*/` annotations from `debug()`, `debugDir()`, `debugLog()`, and their `*Ns` variants
1526
- - These functions have side effects (logging output, spinner manipulation) and should not be removed by bundlers
1527
- - Fixes issue where `debugLog()` and `debugDir()` were compiled to empty no-op functions
980
+ - `debug` functions no longer tree-shaken as no-ops removed incorrect `/*@__NO_SIDE_EFFECTS__*/` annotations on `debug`, `debugDir`, `debugLog` (+ `*Ns` variants)
1528
981
 
1529
982
  ## [1.3.5](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.5) - 2025-10-26
1530
983
 
1531
984
  ### Added
1532
985
 
1533
- - Added `createEnvProxy()` utility function to `env` module for Windows-compatible environment variable access
1534
- - Provides case-insensitive environment variable access (e.g., PATH, Path, path all work)
1535
- - Smart priority system: overrides > exact match > case-insensitive fallback
1536
- - Full Proxy implementation with proper handlers for get, set, has, ownKeys, getOwnPropertyDescriptor
1537
- - Opt-in helper for users who need Windows env var compatibility
1538
- - Well-documented with usage examples and performance notes
1539
- - Added `findCaseInsensitiveEnvKey()` utility function to `env` module
1540
- - Searches for environment variable keys using case-insensitive matching
1541
- - Optimized with length fast path to minimize expensive `toUpperCase()` calls
1542
- - Useful for cross-platform env var access where case may vary (e.g., PATH vs Path vs path)
1543
- - Added comprehensive test suite for `env` module with 71 tests
1544
- - Covers `envAsBoolean()`, `envAsNumber()`, `envAsString()` conversion utilities
1545
- - Tests `createEnvProxy()` with Windows environment variables and edge cases
1546
- - Validates `findCaseInsensitiveEnvKey()` optimization and behavior
986
+ - `env` `createEnvProxy()` Windows-compatible case-insensitive env var access (`PATH`, `Path`, `path` all work). Priority: overrides > exact match > case-insensitive fallback
987
+ - `env` `findCaseInsensitiveEnvKey()` — case-insensitive key search with length fast-path
1547
988
 
1548
989
  ### Fixed
1549
990
 
1550
- - Fixed `spawn` module to preserve Windows `process.env` Proxy behavior
1551
- - When no custom environment variables are provided, use `process.env` directly instead of spreading it
1552
- - Preserves Windows case-insensitive environment variable access (PATH vs Path)
1553
- - Fixes empty CLI output issue on Windows CI runners
1554
- - Only spreads `process.env` when merging custom environment variables
991
+ - `spawn` preserves Windows `process.env` Proxy behavior (uses `process.env` directly when no custom env merges, keeping Windows case-insensitive access)
1555
992
 
1556
993
  ## [1.3.4](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.4) - 2025-10-26
1557
994
 
1558
995
  ### Added
1559
996
 
1560
- - Added Node.js SIGUSR1 signal handler prevention utilities in `constants/node` module
1561
- - `supportsNodeDisableSigusr1Flag()`: Detects if Node supports `--disable-sigusr1` flag (v22.14+, v23.7+, v24.8+)
1562
- - `getNodeDisableSigusr1Flags()`: Returns appropriate flags to prevent debugger attachment
1563
- - Returns `['--disable-sigusr1']` on supported versions (prevents Signal I/O Thread creation)
1564
- - Falls back to `['--no-inspect']` on Node 18+ (blocks debugger but still creates thread)
1565
- - Enables production CLI environments to prevent SIGUSR1 debugger signal handling for security
997
+ - `constants/node` `supportsNodeDisableSigusr1Flag()`, `getNodeDisableSigusr1Flags()`. Returns `['--disable-sigusr1']` on Node 22.14+/23.7+/24.8+, falls back to `['--no-inspect']` on Node 18+
1566
998
 
1567
999
  ## [1.3.3](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.3) - 2025-10-24
1568
1000
 
1569
1001
  ### Fixed
1570
1002
 
1571
- - Fixed lazy getter bug in `objects` module where `defineGetter`, `defineLazyGetter`, and `defineLazyGetters` had incorrect `/*@__NO_SIDE_EFFECTS__*/` annotations
1572
- - These functions mutate objects by defining properties, so marking them as side-effect-free caused esbuild to incorrectly tree-shake the calls during bundling
1573
- - Lazy getters were returning `undefined` instead of their computed values
1574
- - Removed double wrapping in `defineLazyGetters` where `createLazyGetter` was being called unnecessarily
1003
+ - `objects` `defineGetter`, `defineLazyGetter`, `defineLazyGetters` removed incorrect `/*@__NO_SIDE_EFFECTS__*/` annotations (these mutate objects). Lazy getters were returning `undefined` after esbuild tree-shaking
1575
1004
 
1576
1005
  ## [1.3.2](https://github.com/SocketDev/socket-lib/releases/tag/v1.3.2) - 2025-10-24
1577
1006
 
@@ -1583,10 +1012,7 @@ afterEach(() => {
1583
1012
 
1584
1013
  ### Fixed
1585
1014
 
1586
- - Fixed @inquirer modules (`input`, `password`, `search`) not being properly bundled into `dist/external/`
1587
- - Resolves build failures in downstream packages (socket-cli) that depend on socket-lib
1588
- - Added missing packages to bundling configuration in `scripts/build-externals.mjs`
1589
- - All @inquirer packages now ship as zero-dependency bundles
1015
+ - `@inquirer` modules (`input`, `password`, `search`) properly bundled into `dist/external/` — fixes build failures in downstream socket-cli
1590
1016
 
1591
1017
  ### Added
1592
1018
 
@@ -1599,96 +1025,72 @@ afterEach(() => {
1599
1025
 
1600
1026
  ### Added
1601
1027
 
1602
- - Added `validateFiles()` utility function to `fs` module for defensive file access validation
1603
- - Returns `ValidateFilesResult` with `validPaths` and `invalidPaths` arrays
1604
- - Filters out unreadable files before processing (common with Yarn Berry PnP virtual filesystem, pnpm symlinks)
1605
- - Prevents ENOENT errors when files exist in glob results but are not accessible
1606
- - Comprehensive test coverage for all validation scenarios
1028
+ - `fs` `validateFiles()` returns `{ validPaths, invalidPaths }`. Filters unreadable files before processing (Yarn Berry PnP, pnpm symlinks)
1607
1029
 
1608
1030
  ## [1.2.0](https://github.com/SocketDev/socket-lib/releases/tag/v1.2.0) - 2025-10-23
1609
1031
 
1610
1032
  ### Added
1611
1033
 
1612
- - Added `dlx-package` module for installing and executing npm packages directly
1613
- - Content-addressed caching using SHA256 hash (like npm's \_npx)
1614
- - Auto-force for version ranges (^, ~, >, <) to get latest within range
1615
- - Cross-platform support with comprehensive tests (30 tests)
1616
- - Parses scoped and unscoped package specs correctly
1617
- - Resolves binaries from package.json bin field
1034
+ - `dlx-package` install and execute npm packages directly. Content-addressed cache (SHA256). Auto-force for version ranges (`^`, `~`, `>`, `<`). Resolves binaries from `package.json` `bin`
1618
1035
 
1619
1036
  ### Changed
1620
1037
 
1621
- - Unified DLX storage under `~/.socket/_dlx/` directory
1622
- - Binary downloads now use `~/.socket/_dlx/` instead of non-existent cache path
1623
- - Both npm packages and binaries share parent directory with content-addressed hashing
1624
- - Updated paths.ts documentation to clarify unified directory structure
1038
+ - Unified DLX storage under `~/.socket/_dlx/` (binary downloads + npm packages share content-addressed parent)
1625
1039
 
1626
1040
  ## [1.1.2] - 2025-10-23
1627
1041
 
1628
1042
  ### Fixed
1629
1043
 
1630
- - Fixed broken relative import paths in `packages/isolation.ts` and `packages/provenance.ts` that prevented bundling by external tools
1044
+ - Broken relative import paths in `packages/isolation.ts` / `packages/provenance.ts`
1631
1045
 
1632
1046
  ## [1.1.1] - 2025-10-23
1633
1047
 
1634
1048
  ### Fixed
1635
1049
 
1636
- - Fixed shimmer text effects not respecting CI environment detection (now disabled in CI to prevent ANSI escape codes in logs)
1050
+ - Shimmer text effects respect CI detection (disabled in CI to avoid ANSI escapes in logs)
1637
1051
 
1638
1052
  ## [1.1.0] - 2025-10-23
1639
1053
 
1640
1054
  ### Added
1641
1055
 
1642
- - Added `filterOutput` option to `stdio/mask` for filtering output chunks before display/buffering
1643
- - Added `overrideExitCode` option to `stdio/mask` for customizing exit codes based on captured output
1644
- - Added comprehensive JSDoc documentation across entire library for enhanced VSCode IntelliSense
1645
- - Detailed @param, @returns, @template, @throws tags
1646
- - Practical @example blocks with real-world usage patterns
1647
- - @default tags showing default values
1648
- - Enhanced interface property documentation
1649
-
1650
- ### Changed
1651
-
1652
- - Improved TypeScript type hints and tooltips throughout library
1653
- - Enhanced documentation for all core utilities (arrays, fs, git, github, http-request, json, logger, objects, path, promises, spawn, spinner, strings)
1654
- - Enhanced documentation for stdio utilities (clear, divider, footer, header, mask, progress, prompts, stderr, stdout)
1655
- - Enhanced documentation for validation utilities (json-parser, types)
1056
+ - `stdio/mask` `filterOutput` (filter output chunks before display) and `overrideExitCode` (customize exit codes from captured output)
1057
+ - Comprehensive JSDoc across the library for IntelliSense (`@param`, `@returns`, `@example`, `@default`)
1656
1058
 
1657
1059
  ## [1.0.5] - 2025-10-22
1658
1060
 
1659
1061
  ### Added
1660
1062
 
1661
- - Added support for custom retry delays from onRetry callback
1063
+ - Custom retry delays from `onRetry` callback
1662
1064
 
1663
1065
  ## [1.0.4] - 2025-10-21
1664
1066
 
1665
1067
  ### Fixed
1666
1068
 
1667
- - Fixed external dependency paths in root-level source files (corrected require paths from `../external/` to `./external/` in bin, cacache, fs, globs, spawn, spinner, and streams modules)
1069
+ - External dep paths in root-level dist files (`../external/` `./external/`)
1668
1070
 
1669
1071
  ## [1.0.3] - 2025-10-21
1670
1072
 
1671
1073
  ### Fixed
1672
1074
 
1673
- - Fixed external dependency import paths in packages and stdio modules (corrected require paths from `../../external/` to `../external/`)
1075
+ - External dep import paths in `packages/` and `stdio/` modules (`../../external/` `../external/`)
1674
1076
 
1675
1077
  ## [1.0.2] - 2025-10-21
1676
1078
 
1677
1079
  ### Fixed
1678
1080
 
1679
- - Fixed module resolution error in packages/normalize module (corrected require path from `../../constants/socket` to `../constants/socket`)
1081
+ - `packages/normalize` module resolution (`../../constants/socket` `../constants/socket`)
1680
1082
 
1681
1083
  ## [1.0.1] - 2025-10-21
1682
1084
 
1683
1085
  ### Fixed
1684
1086
 
1685
- - Fixed relative import paths in compiled CommonJS output (changed `require("../external/...")` to `require("./external/...")` for root-level dist files)
1087
+ - Relative imports in compiled CommonJS root-level dist files use `./external/...`
1686
1088
 
1687
1089
  ## [1.0.0] - 2025-10-20
1688
1090
 
1689
1091
  ### Changed
1690
1092
 
1691
- - Consolidated parseArgs into argv/parse module
1093
+ - `parseArgs` consolidated into `argv/parse`
1692
1094
 
1693
1095
  ---
1694
1096
 
@@ -1696,254 +1098,12 @@ afterEach(() => {
1696
1098
 
1697
1099
  ---
1698
1100
 
1699
- ## [1.5.3] - 2025-10-07
1700
-
1701
- ### Added
1702
-
1703
- - Fix bad build and add validation to prevent in future
1704
-
1705
- ## [1.5.2] - 2025-10-07
1706
-
1707
- ### Added
1708
-
1709
- - Added coverage utilities to parse v8 and type coverage reports
1710
-
1711
- ### Fixed
1712
-
1713
- - Fixed `isPath` function to exclude URLs with protocols
1714
- - Fixed `isolatePackage` to handle file: URLs and npm-package-arg paths correctly
1715
-
1716
- ## [1.5.1] - 2025-10-05
1717
-
1718
- ### Added
1719
-
1720
- - Added `isolatePackage` to `lib/packages/isolation` for creating isolated package test environments
1721
-
1722
- ### Changed
1723
-
1724
- - Removed `dependencies/index` barrel file to prevent eager loading of all dependency modules
1101
+ These entries cover versions 1.0.0 → 1.5.3 of the previous package name (`@socketsecurity/registry`, Sep 2025 – Oct 2025). The version-number line restarted at 1.0.0 when the package was renamed to `@socketsecurity/lib`, so the current 1.x and 5.x lines do **not** continue from these old versions. Listed here for archival reference only.
1725
1102
 
1726
- ## [1.5.0] - 2025-10-05
1103
+ ### Highlights
1727
1104
 
1728
- ### Added
1729
-
1730
- - Added support for testing local development packages in addition to socket-registry packages
1731
- - Exposed isolation module as part of public API via `lib/packages`
1732
-
1733
- ### Changed
1734
-
1735
- - Renamed `setupPackageTest` to `isolatePackage` for clearer intent
1736
- - Refactored `installPackageForTesting` to accept explicit `sourcePath` and `packageName` parameters
1737
- - Simplified package installation logic by removing path detection from low-level function
1738
- - Consolidated `setupPackageTest` and `setupMultiEntryTest` into single `isolatePackage` function with options
1739
-
1740
- ## [1.4.6] - 2025-10-05
1741
-
1742
- ### Added
1743
-
1744
- - Added comprehensive package.json exports validation tests
1745
-
1746
- ## [1.4.5] - 2025-10-05
1747
-
1748
- ### Added
1749
-
1750
- - Added performance monitoring utilities with timer, measurement, and reporting functions
1751
- - Added memoization utilities with LRU, TTL, weak references, and promise deduplication support
1752
- - Added table formatting utilities (`formatTable`, `formatSimpleTable`) for CLI output
1753
- - Added progress tracking to spinner with `updateProgress()` and `incrementProgress()` methods
1754
- - Added `isDir` and `safeStats` async helpers to fs module
1755
-
1756
- ### Changed
1757
-
1758
- - Removed `platform` and `arch` options from `dlxBinary` function as cross-platform binary execution is not supported
1759
-
1760
- ### Fixed
1761
-
1762
- - Fixed Windows shell execution in `dlxBinary` by adding cache directory to PATH
1763
-
1764
- ## [1.4.4] - 2025-10-05
1765
-
1766
- ### Fixed
1767
-
1768
- - Fixed subpath exports
1769
-
1770
- ## [1.4.3] - 2025-10-04
1771
-
1772
- ### Added
1773
-
1774
- - Spinner lifecycle utilities (`withSpinner`, `withSpinnerRestore`, `withSpinnerSync`) for automatic spinner cleanup with try/finally blocks
1775
-
1776
- ## [1.4.2] - 2025-10-04
1777
-
1778
- ### Added
1779
-
1780
- - Added `GITHUB_API_BASE_URL` constant for GitHub API endpoint configuration
1781
- - Added `SOCKET_API_BASE_URL` constant for Socket API endpoint configuration
1782
- - Added generic TTL cache utility (`createTtlCache`) with in-memory memoization and persistent storage support
1783
-
1784
- ### Changed
1785
-
1786
- - Refactored GitHub caching to use the new `cache-with-ttl` utility for better performance and consistency
1787
-
1788
- ## [1.4.1] - 2025-10-04
1789
-
1790
- ### Changed
1791
-
1792
- - Update maintained Node.js versions of `constants.maintainedNodeVersions`
1793
-
1794
- ## [1.4.0] - 2025-10-04
1795
-
1796
- ### Added
1797
-
1798
- - Added `PromiseQueue` utility for controlled concurrency operations
1799
- - Added lazy dependency loaders and test utilities
1800
- - Added HTTP utilities with retry logic and download locking
1801
- - Added `.claude` directory for scratch documents
1802
- - Added `noUnusedLocals` and `noUnusedParameters` to TypeScript config
1803
-
1804
- ### Changed
1805
-
1806
- - Refactored all library functions to use options objects for better API consistency
1807
- - `lib/strings.ts` - String manipulation functions
1808
- - `lib/url.ts` - URL handling functions
1809
- - `lib/words.ts` - Word manipulation functions
1810
- - Refactored `lib/packages` module into specialized submodules for improved code organization
1811
- - `lib/packages/editable.ts` - Package editing functionality
1812
- - `lib/packages/exports.ts` - Export resolution utilities
1813
- - `lib/packages/licenses.ts` - License handling and validation
1814
- - `lib/packages/manifest.ts` - Manifest data operations
1815
- - `lib/packages/normalize.ts` - Path normalization utilities
1816
- - `lib/packages/operations.ts` - Package installation and modification operations
1817
- - `lib/packages/paths.ts` - Package path utilities
1818
- - `lib/packages/provenance.ts` - Package provenance verification
1819
- - `lib/packages/specs.ts` - Package spec parsing
1820
- - `lib/packages/validation.ts` - Package validation utilities
1821
- - Moved configuration files (vitest, eslint, knip, oxlint, taze) to `.config` directory
1822
- - Replaced `fetch()` with Node.js native `http`/`https` modules for better reliability
1823
- - Replaced `any` types with meaningful types across library utilities
1824
- - Improved pnpm security with build script allowlist
1825
- - Updated vitest coverage thresholds to 80%
1826
- - Consolidated test files to reduce duplication
1827
- - Note: Public API remains unchanged; these are internal organizational improvements
1828
-
1829
- ### Fixed
1830
-
1831
- - Fixed resource leaks and race conditions in socket-registry
1832
- - Fixed `yarn-cache-path` constant to return string type consistently
1833
- - Fixed Yarn Windows temp path detection in `shouldSkipShadow`
1834
- - Fixed path normalization for Windows compatibility across all path utilities
1835
- - Fixed cache path tests for Windows case sensitivity
1836
- - Fixed type errors in promises, parse-args, logger, and specs tests
1837
- - Fixed GitHub tests to mock `httpRequest` correctly
1838
- - Fixed SEA build tests to mock `httpRequest`
1839
- - Decoded URL percent-encoding in `pathLikeToString` fallback
1840
-
1841
- ## [1.3.10] - 2025-10-03
1842
-
1843
- ### Added
1844
-
1845
- - New utility modules for DLX, shadow, SEA, cacache, and versions functionality
1846
- - getSocketHomePath alias to paths module
1847
- - del dependency and external wrapper for safer file deletion
1848
- - @fileoverview tags to lib modules
1849
- - camelCase expansion for kebab-case arguments in parseArgs
1850
- - Coerce and configuration options to parseArgs
1851
-
1852
- ### Changed
1853
-
1854
- - Updated file removal to use del package for safer deletion
1855
- - Normalized path returns in fs and Socket directory utilities
1856
- - Removed default exports from git and parse-args modules
1857
- - Enhanced test coverage across multiple modules (parse-args, prompts, strings, env, spawn, json)
1858
-
1859
- ## [1.3.9] - 2025-10-03
1860
-
1861
- ### Changed
1862
-
1863
- - Internal build and distribution updates
1864
-
1865
- ## [1.3.8] - 2025-10-03
1866
-
1867
- ### Added
1868
-
1869
- - Added unified directory structure for Socket ecosystem tools
1870
- - New path utilities module for cross-platform directory resolution
1871
- - Directory structure constants for Socket CLI, Registry, Firewall, and DLX
1872
-
1873
- ## [1.3.7] - 2025-10-02
1874
-
1875
- ### Changed
1876
-
1877
- - Updated manifest.json entries
1878
-
1879
- ## [1.3.6] - 2025-10-01
1880
-
1881
- ### Fixed
1882
-
1883
- - Fixed indent-string interoperability with older v1 and v2 versions
1884
-
1885
- ## [1.3.5] - 2025-10-01
1886
-
1887
- ### Added
1888
-
1889
- - Added lib/git utilities module
1890
-
1891
- ### Fixed
1892
-
1893
- - Fixed invalid manifest entries
1894
- - Fixed parseArgs strip-aliased bug
1895
-
1896
- ## [1.3.4] - 2025-10-01
1897
-
1898
- ### Changed
1899
-
1900
- - Updated various package override versions
1901
-
1902
- ## [1.3.3] - 2025-10-01
1903
-
1904
- ### Fixed
1905
-
1906
- - Fixed normalizePath collapsing multiple leading `..` segments incorrectly
1907
-
1908
- ## [1.3.2] - 2025-10-01
1909
-
1910
- ### Added
1911
-
1912
- - Added 'sfw' to isBlessedPackageName method check
1913
- - Added ENV.DEBUG normalization for debug package compatibility
1914
- - `DEBUG='1'` or `DEBUG='true'` automatically expands to `DEBUG='*'` (enables all namespaces)
1915
- - `DEBUG='0'` or `DEBUG='false'` automatically converts to empty string (disables all output)
1916
- - Namespace patterns like `DEBUG='app:*'` are preserved unchanged
1917
-
1918
- ## [1.3.1] - 2025-09-30
1919
-
1920
- ### Changed
1921
-
1922
- - Renamed debug functions from *Complex to *Ns
1923
-
1924
- ### Fixed
1925
-
1926
- - Fixed regression with lib/prompts module imports
1927
-
1928
- ## [1.3.0] - 2025-09-29
1929
-
1930
- ### Changed
1931
-
1932
- - Updated registry subpath exports
1933
-
1934
- ### Fixed
1935
-
1936
- - Fixed Node.js built-in module imports in CommonJS output
1937
-
1938
- ## [1.2.2] - 2025-09-29
1939
-
1940
- ### Changed
1941
-
1942
- - Internal improvements to module structure
1943
-
1944
- ## [1.2.1] - 2025-09-29
1945
-
1946
- ### Changed
1105
+ - **1.5.x** (Oct 2025) — `isolatePackage` for isolated package test environments; v8 coverage utilities; `dependencies/index` barrel removed
1106
+ - **1.4.x** (Oct 2025) — Performance monitoring + memoization utilities; table formatting (`formatTable`, `formatSimpleTable`); spinner progress; `isDir`, `safeStats` async fs helpers
1107
+ - **1.3.x** (Sep–Oct 2025) Initial constants restructure, build configuration, package exports
1947
1108
 
1948
- - Restructured constants module with new architecture
1949
- - Updated build configuration and package exports
1109
+ For full details, see git history under the `@socketsecurity/registry` package name.