@socketsecurity/lib 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ 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.1.2](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.2) - 2025-12-28
9
+
10
+ ### Fixed
11
+
12
+ - **paths**: Fixed missing `getPathValue()` caching in `getSocketDlxDir()`
13
+ - Now uses `getPathValue()` for performance, consistent with `getSocketUserDir()` and `getSocketCacacheDir()`
14
+ - Adds test override support via `setPath('socket-dlx-dir', ...)`
15
+ - Test helper `mockHomeDir()` now properly invalidates path cache with `resetPaths()` calls
16
+ - Resolves cache persistence issues in test environments
17
+
8
18
  ## [5.1.1](https://github.com/SocketDev/socket-lib/releases/tag/v5.1.1) - 2025-12-28
9
19
 
10
20
  ### Added
@@ -42,13 +42,15 @@ export declare function getSocketAppDir(appName: string): string;
42
42
  export declare function getSocketCacacheDir(): string;
43
43
  /**
44
44
  * Get the Socket DLX directory (~/.socket/_dlx).
45
- * Can be overridden with environment variables.
45
+ * Can be overridden with SOCKET_DLX_DIR environment variable or via setPath() for testing.
46
+ * Result is cached via getPathValue for performance.
46
47
  *
47
48
  * Priority order:
48
- * 1. SOCKET_DLX_DIR - Full override of DLX cache directory
49
- * 2. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
50
- * 3. Default: $HOME/.socket/_dlx
51
- * 4. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%\.socket\_dlx (Windows)
49
+ * 1. Test override via setPath('socket-dlx-dir', ...)
50
+ * 2. SOCKET_DLX_DIR - Full override of DLX cache directory
51
+ * 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
52
+ * 4. Default: $HOME/.socket/_dlx
53
+ * 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%\.socket\_dlx (Windows)
52
54
  */
53
55
  export declare function getSocketDlxDir(): string;
54
56
  /**
@@ -88,12 +88,17 @@ function getSocketCacacheDir() {
88
88
  });
89
89
  }
90
90
  function getSocketDlxDir() {
91
- if ((0, import_socket2.getSocketDlxDirEnv)()) {
92
- return (0, import_normalize.normalizePath)((0, import_socket2.getSocketDlxDirEnv)());
93
- }
94
- return (0, import_normalize.normalizePath)(
95
- path.join(getSocketUserDir(), `${import_socket.SOCKET_APP_PREFIX}${import_socket.SOCKET_DLX_APP_NAME}`)
96
- );
91
+ return (0, import_rewire.getPathValue)("socket-dlx-dir", () => {
92
+ if ((0, import_socket2.getSocketDlxDirEnv)()) {
93
+ return (0, import_normalize.normalizePath)((0, import_socket2.getSocketDlxDirEnv)());
94
+ }
95
+ return (0, import_normalize.normalizePath)(
96
+ path.join(
97
+ getSocketUserDir(),
98
+ `${import_socket.SOCKET_APP_PREFIX}${import_socket.SOCKET_DLX_APP_NAME}`
99
+ )
100
+ );
101
+ });
97
102
  }
98
103
  function getSocketAppCacheDir(appName) {
99
104
  return (0, import_normalize.normalizePath)(path.join(getSocketAppDir(appName), import_dirnames.CACHE_DIR));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/lib",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "packageManager": "pnpm@10.26.2",
5
5
  "license": "MIT",
6
6
  "description": "Core utilities and infrastructure for Socket.dev security tools",
@@ -714,7 +714,7 @@
714
714
  "@socketregistry/is-unicode-supported": "1.0.5",
715
715
  "@socketregistry/packageurl-js": "1.3.5",
716
716
  "@socketregistry/yocto-spinner": "1.0.25",
717
- "@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.1.0",
717
+ "@socketsecurity/lib-stable": "npm:@socketsecurity/lib@5.1.1",
718
718
  "@types/node": "24.9.2",
719
719
  "@typescript/native-preview": "7.0.0-dev.20250920.1",
720
720
  "@vitest/coverage-v8": "4.0.3",