@yarn-tool/pkg-version-query 3.0.13 → 3.0.14

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
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.14](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/pkg-version-query@3.0.13...@yarn-tool/pkg-version-query@3.0.14) (2026-10-14)
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * **cache-path:** 新增 findEnvCachePath 環境變數快取來源並統一 finder 簽名
12
+
13
+
14
+
15
+ ### ✨ Features
16
+
17
+ * **cache-path:** 新增 findEnvCachePath 環境變數快取來源並統一 finder 簽名 ([582b67c](https://github.com/bluelovers/ws-yarn-workspaces/commit/582b67c0052a3d5909fada92c3be177633dccf8e))
18
+
19
+
20
+ ### 🛠 Build System
21
+
22
+ * update build ([d3b0f92](https://github.com/bluelovers/ws-yarn-workspaces/commit/d3b0f925ccaec35a2a4eb0929ddd145793a2f232))
23
+
24
+
25
+
6
26
  ## [3.0.13](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/pkg-version-query@3.0.12...@yarn-tool/pkg-version-query@3.0.13) (2026-10-14)
7
27
 
8
28
  **Note:** Version bump only for package @yarn-tool/pkg-version-query
package/lib/cacheAgent.js CHANGED
@@ -5,6 +5,7 @@ exports.getCache = getCache;
5
5
  const tslib_1 = require("tslib");
6
6
  const lru_cache_fs2_1 = tslib_1.__importDefault(require("lru-cache-fs2"));
7
7
  const cache_path_1 = require("cache-path");
8
+ const finder_1 = require("cache-path/lib/finder");
8
9
  /**
9
10
  * 模組層級的快取單例 (Module-level Cache Singleton);
10
11
  * 以 `??=` 延後初始化,確保只有第一次 getCache() 才會建立快取並產生磁碟 IO。
@@ -32,12 +33,7 @@ function initCache(options) {
32
33
  * avoids writing into a potentially read-only node_modules.
33
34
  */
34
35
  let cwd = (0, cache_path_1.getCachePath)(id, {
35
- fnOrder: [
36
- cache_path_1.findYarnCachePath,
37
- cache_path_1.findNpmCachePath,
38
- cache_path_1.findOSTempPath,
39
- cache_path_1.findPkgModulePath,
40
- ],
36
+ fnOrder: finder_1.defaultOrderGlobal,
41
37
  });
42
38
  let { cacheAgentOptions } = (options !== null && options !== void 0 ? options : (options = {}));
43
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"cacheAgent.js","sourceRoot":"","sources":["cacheAgent.ts"],"names":[],"mappings":";;AA6BA,8BAkEC;AAcD,4BAGC;;AAhHD,0EAA0D;AAC1D,2CAOoB;AAIpB;;;;;;GAMG;AACH,IAAI,KAA0C,CAAC;AAE/C;;;;;;;GAOG;AACH,SAAgB,SAAS,CAAC,OAAuC;IAEhE,IAAI,EAAE,GAAG,8BAA8B,CAAC;IAExC;;;;;;;OAOG;IACH,IAAI,GAAG,GAAG,IAAA,yBAAY,EAAC,EAAE,EAAE;QAC1B,OAAO,EAAE;YACR,8BAAiB;YACjB,6BAAgB;YAChB,2BAAc;YACd,8BAAiB;SACjB;KACD,CAAC,CAAC;IAEH,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC,CAAC;IAE7C;;;;;;OAMG;IACH,iBAAiB,GAAG;QACrB,cAAc;QACd,0BAA0B;QACxB,GAAG,iBAAiB;QACpB,SAAS,EAAE,IAAA,0BAAa,EAAC,EAAE,EAAE,IAAI,CAAC;QAClC,UAAU,EAAE,IAAI;QAChB,GAAG;KACH,CAAA;IAED;;;;;;OAMG;IACH,IAAI,CAAC,iBAAiB,CAAC,GAAG,IAAI,iBAAiB,CAAC,GAAG,IAAI,GAAG,EAC1D,CAAC;QACA,iBAAiB,CAAC,GAAG,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,iBAAiB,CAAC,MAAM,IAAI,iBAAiB,CAAC,MAAM,IAAI,EAAE,GAAG,IAAI,EACtE,CAAC;QACA,iBAAiB,CAAC,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,uBAAK,CAA+B,iBAAiB,CAAC,CAAC;IAEzE,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,QAAQ,CAAC,OAAuC;;IAE/D,OAAO,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,mCAAI,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,IAAL,KAAK,GAAK,SAAS,CAAC,OAAO,CAAC,EAAC,CAAC;AAC9D,CAAC","sourcesContent":["import Cache, { IOptionsLRUCacheFS } from 'lru-cache-fs2';\nimport {\n\tnormalizeName,\n\tgetCachePath,\n\tfindPkgModulePath,\n\tfindYarnCachePath,\n\tfindNpmCachePath,\n\tfindOSTempPath,\n} from 'cache-path';\nimport { ICachedVersionResult, IOptionsQueryVersion } from './types';\nimport { Options } from 'package-json';\n\n/**\n * 模組層級的快取單例 (Module-level Cache Singleton);\n * 以 `??=` 延後初始化,確保只有第一次 getCache() 才會建立快取並產生磁碟 IO。\n *\n * Module-level cache singleton, initialised lazily with `??=` so the cache\n * (and its disk IO) is only created on the first getCache() call.\n */\nlet cache: Cache<string, ICachedVersionResult>;\n\n/**\n * 建立檔案後盾的 LRU 快取 (File-backed LRU Cache) 實例。\n *\n * Creates the file-backed LRU cache instance.\n *\n * @param options 查詢選項,僅取用其中的 cacheAgentOptions / Query options; only cacheAgentOptions is used\n * @returns 新的快取實例 / A fresh cache instance\n */\nexport function initCache(options?: IOptionsQueryVersion<Options>)\n{\n\tlet id = '@yarn-tool/pkg-version-query';\n\n\t/**\n\t * 快取目錄依序偏好 yarn 快取、npm 快取、系統暫存目錄,最後才退回 node_modules;\n\t * 這樣可與套件管理器共用既有快取位置,也避免在唯讀的 node_modules 下寫檔。\n\t *\n\t * The cache dir prefers the yarn cache, then npm cache, then OS temp, and only\n\t * falls back to node_modules; this reuses package-manager cache locations and\n\t * avoids writing into a potentially read-only node_modules.\n\t */\n\tlet cwd = getCachePath(id, {\n\t\tfnOrder: [\n\t\t\tfindYarnCachePath,\n\t\t\tfindNpmCachePath,\n\t\t\tfindOSTempPath,\n\t\t\tfindPkgModulePath,\n\t\t],\n\t});\n\n\tlet { cacheAgentOptions } = (options ??= {});\n\n\t/**\n\t * 使用展開運算子合併:呼叫端的設定優先,但 cacheName / autoCreate / cwd\n\t * 由本函式決定,避免使用者誤覆寫成指向別的快取檔。\n\t *\n\t * Spread-merge keeps caller settings first while cacheName / autoCreate / cwd stay\n\t * under this function's control, so callers cannot accidentally point at another cache file.\n\t */\n\tcacheAgentOptions = {\n//\t\tmax: 1000,\n//\t\tmaxAge: 5 * 60 * 1000,\n\t\t...cacheAgentOptions,\n\t\tcacheName: normalizeName(id, true),\n\t\tautoCreate: true,\n\t\tcwd,\n\t}\n\n\t/**\n\t * 下限保護:max 太小(或未設定)會使快取幾乎無效、每次查詢都打 registry,\n\t * 因此強制提升到 1000。\n\t *\n\t * Floor guard: a tiny or unset max would make the cache useless and hammer the\n\t * registry on every query, so it is raised to 1000.\n\t */\n\tif (!cacheAgentOptions.max || cacheAgentOptions.max <= 100)\n\t{\n\t\tcacheAgentOptions.max = 1000;\n\t}\n\n\t/**\n\t * 下限保護:maxAge 太短(或未設定)會讓版本資料幾乎立刻過期,\n\t * 因此強制至少保留 10 分鐘。\n\t *\n\t * Floor guard: a too-short or unset maxAge would expire version data almost\n\t * immediately, so it is kept at 10 minutes at minimum.\n\t */\n\tif (!cacheAgentOptions.maxAge || cacheAgentOptions.maxAge <= 60 * 1000)\n\t{\n\t\tcacheAgentOptions.maxAge = 10 * 60 * 1000;\n\t}\n\n\tconst cache = new Cache<string, ICachedVersionResult>(cacheAgentOptions);\n\n\treturn cache;\n}\n\n/**\n * 取得快取實例:優先使用呼叫端自帶的 cacheAgent,\n * 否則以 `??=` 惰性建立並重複使用同一個單例,\n * 讓多處查詢共享同一份磁碟快取而不必各自初始化。\n *\n * Returns the cache instance: a caller-supplied cacheAgent wins, otherwise a\n * module-level singleton is created lazily via `??=` so scattered queries share\n * one disk-backed cache instead of each initialising their own.\n *\n * @param options 查詢選項,可攜帶 cacheAgent / Query options; may carry a custom cacheAgent\n * @returns 快取實例 / The cache instance\n */\nexport function getCache(options?: IOptionsQueryVersion<Options>)\n{\n\treturn options?.cacheAgent ?? (cache ??= initCache(options));\n}\n"]}
1
+ {"version":3,"file":"cacheAgent.js","sourceRoot":"","sources":["cacheAgent.ts"],"names":[],"mappings":";;AA8BA,8BA6DC;AAcD,4BAGC;;AA5GD,0EAA0D;AAC1D,2CAOoB;AAGpB,kDAA2D;AAE3D;;;;;;GAMG;AACH,IAAI,KAA0C,CAAC;AAE/C;;;;;;;GAOG;AACH,SAAgB,SAAS,CAAC,OAAuC;IAEhE,IAAI,EAAE,GAAG,8BAA8B,CAAC;IAExC;;;;;;;OAOG;IACH,IAAI,GAAG,GAAG,IAAA,yBAAY,EAAC,EAAE,EAAE;QAC1B,OAAO,EAAE,2BAAkB;KAC3B,CAAC,CAAC;IAEH,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC,CAAC;IAE7C;;;;;;OAMG;IACH,iBAAiB,GAAG;QACrB,cAAc;QACd,0BAA0B;QACxB,GAAG,iBAAiB;QACpB,SAAS,EAAE,IAAA,0BAAa,EAAC,EAAE,EAAE,IAAI,CAAC;QAClC,UAAU,EAAE,IAAI;QAChB,GAAG;KACH,CAAA;IAED;;;;;;OAMG;IACH,IAAI,CAAC,iBAAiB,CAAC,GAAG,IAAI,iBAAiB,CAAC,GAAG,IAAI,GAAG,EAC1D,CAAC;QACA,iBAAiB,CAAC,GAAG,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,iBAAiB,CAAC,MAAM,IAAI,iBAAiB,CAAC,MAAM,IAAI,EAAE,GAAG,IAAI,EACtE,CAAC;QACA,iBAAiB,CAAC,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,uBAAK,CAA+B,iBAAiB,CAAC,CAAC;IAEzE,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,QAAQ,CAAC,OAAuC;;IAE/D,OAAO,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,mCAAI,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,IAAL,KAAK,GAAK,SAAS,CAAC,OAAO,CAAC,EAAC,CAAC;AAC9D,CAAC","sourcesContent":["import Cache, { IOptionsLRUCacheFS } from 'lru-cache-fs2';\nimport {\n\tnormalizeName,\n\tgetCachePath,\n\tfindPkgModulePath,\n\tfindYarnCachePath,\n\tfindNpmCachePath,\n\tfindOSTempPath,\n} from 'cache-path';\nimport { ICachedVersionResult, IOptionsQueryVersion } from './types';\nimport { Options } from 'package-json';\nimport { defaultOrderGlobal } from 'cache-path/lib/finder';\n\n/**\n * 模組層級的快取單例 (Module-level Cache Singleton);\n * 以 `??=` 延後初始化,確保只有第一次 getCache() 才會建立快取並產生磁碟 IO。\n *\n * Module-level cache singleton, initialised lazily with `??=` so the cache\n * (and its disk IO) is only created on the first getCache() call.\n */\nlet cache: Cache<string, ICachedVersionResult>;\n\n/**\n * 建立檔案後盾的 LRU 快取 (File-backed LRU Cache) 實例。\n *\n * Creates the file-backed LRU cache instance.\n *\n * @param options 查詢選項,僅取用其中的 cacheAgentOptions / Query options; only cacheAgentOptions is used\n * @returns 新的快取實例 / A fresh cache instance\n */\nexport function initCache(options?: IOptionsQueryVersion<Options>)\n{\n\tlet id = '@yarn-tool/pkg-version-query';\n\n\t/**\n\t * 快取目錄依序偏好 yarn 快取、npm 快取、系統暫存目錄,最後才退回 node_modules;\n\t * 這樣可與套件管理器共用既有快取位置,也避免在唯讀的 node_modules 下寫檔。\n\t *\n\t * The cache dir prefers the yarn cache, then npm cache, then OS temp, and only\n\t * falls back to node_modules; this reuses package-manager cache locations and\n\t * avoids writing into a potentially read-only node_modules.\n\t */\n\tlet cwd = getCachePath(id, {\n\t\tfnOrder: defaultOrderGlobal,\n\t});\n\n\tlet { cacheAgentOptions } = (options ??= {});\n\n\t/**\n\t * 使用展開運算子合併:呼叫端的設定優先,但 cacheName / autoCreate / cwd\n\t * 由本函式決定,避免使用者誤覆寫成指向別的快取檔。\n\t *\n\t * Spread-merge keeps caller settings first while cacheName / autoCreate / cwd stay\n\t * under this function's control, so callers cannot accidentally point at another cache file.\n\t */\n\tcacheAgentOptions = {\n//\t\tmax: 1000,\n//\t\tmaxAge: 5 * 60 * 1000,\n\t\t...cacheAgentOptions,\n\t\tcacheName: normalizeName(id, true),\n\t\tautoCreate: true,\n\t\tcwd,\n\t}\n\n\t/**\n\t * 下限保護:max 太小(或未設定)會使快取幾乎無效、每次查詢都打 registry,\n\t * 因此強制提升到 1000。\n\t *\n\t * Floor guard: a tiny or unset max would make the cache useless and hammer the\n\t * registry on every query, so it is raised to 1000.\n\t */\n\tif (!cacheAgentOptions.max || cacheAgentOptions.max <= 100)\n\t{\n\t\tcacheAgentOptions.max = 1000;\n\t}\n\n\t/**\n\t * 下限保護:maxAge 太短(或未設定)會讓版本資料幾乎立刻過期,\n\t * 因此強制至少保留 10 分鐘。\n\t *\n\t * Floor guard: a too-short or unset maxAge would expire version data almost\n\t * immediately, so it is kept at 10 minutes at minimum.\n\t */\n\tif (!cacheAgentOptions.maxAge || cacheAgentOptions.maxAge <= 60 * 1000)\n\t{\n\t\tcacheAgentOptions.maxAge = 10 * 60 * 1000;\n\t}\n\n\tconst cache = new Cache<string, ICachedVersionResult>(cacheAgentOptions);\n\n\treturn cache;\n}\n\n/**\n * 取得快取實例:優先使用呼叫端自帶的 cacheAgent,\n * 否則以 `??=` 惰性建立並重複使用同一個單例,\n * 讓多處查詢共享同一份磁碟快取而不必各自初始化。\n *\n * Returns the cache instance: a caller-supplied cacheAgent wins, otherwise a\n * module-level singleton is created lazily via `??=` so scattered queries share\n * one disk-backed cache instead of each initialising their own.\n *\n * @param options 查詢選項,可攜帶 cacheAgent / Query options; may carry a custom cacheAgent\n * @returns 快取實例 / The cache instance\n */\nexport function getCache(options?: IOptionsQueryVersion<Options>)\n{\n\treturn options?.cacheAgent ?? (cache ??= initCache(options));\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarn-tool/pkg-version-query",
3
- "version": "3.0.13",
3
+ "version": "3.0.14",
4
4
  "description": "Query package versions from npm registry with LRU cache support. Supports version ranges, npm: protocol, and semver syntax handling. 從 npm registry 查詢套件版本,支援 LRU 快取、版本範圍語法與 npm: 協議處理。",
5
5
  "keywords": [
6
6
  "npm",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@lazy-node/semver-ampersand": "^3.0.13",
57
57
  "@yarn-tool/npm-package-arg-util": "^2.0.11",
58
- "cache-path": "^4.0.14",
58
+ "cache-path": "^4.0.15",
59
59
  "lru-cache-fs2": "^2.0.8",
60
60
  "package-json": "<7 >=6.5",
61
61
  "semver": "^7.8.5",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "298e125907abc4dc8c8187e82636ccd8e9c10aaa"
68
+ "gitHead": "08b3dd65494a279aacbd7d72d5c7415ce0e15da4"
69
69
  }