binary-collections 2.0.11 → 2.0.12

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 (225) hide show
  1. package/.opencode/package.json +5 -0
  2. package/binaries/rmx +15 -1
  3. package/binaries/rmx.cmd +12 -0
  4. package/binaries/test-cjs +9 -1
  5. package/binaries/test-cjs.cmd +16 -1
  6. package/binaries/test-esm +16 -0
  7. package/binaries/test-esm.cjs +178 -0
  8. package/binaries/test-esm.cmd +23 -0
  9. package/binaries/yarn-clean +1 -1
  10. package/binaries/yarn-clean.cmd +1 -1
  11. package/binaries/yarn-clean.py +33 -15
  12. package/binaries/yc +110 -0
  13. package/binaries/yc.cjs +178 -0
  14. package/lib/binary-collections/config.cjs +126 -0
  15. package/lib/binary-collections/config.mjs +7 -0
  16. package/lib/binary-collections/executeScript.cjs +19 -0
  17. package/lib/binary-collections/executeScript.d.cts +12 -0
  18. package/lib/binary-collections/executeScript.mjs +6 -0
  19. package/lib/binary-collections/findScript.cjs +284 -0
  20. package/lib/binary-collections/findScript.d.cts +12 -0
  21. package/lib/binary-collections/findScript.mjs +7 -0
  22. package/lib/binary-collections/listScript.cjs +266 -0
  23. package/lib/binary-collections/listScript.d.cts +19 -0
  24. package/lib/binary-collections/listScript.mjs +7 -0
  25. package/lib/binary-collections.cjs +224 -137
  26. package/lib/binary-collections.mjs +22 -282
  27. package/lib/changelog.cjs +2 -2
  28. package/lib/changelog.mjs +1 -1
  29. package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
  30. package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
  31. package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
  32. package/lib/chunk-6PU7BAHB.mjs +61 -0
  33. package/lib/chunk-C6D2TTYU.mjs +32 -0
  34. package/lib/chunk-FB2WKVJD.mjs +158 -0
  35. package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
  36. package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
  37. package/lib/chunk-H44UWUFY.mjs +105 -0
  38. package/lib/chunk-NCZPTKDV.mjs +79 -0
  39. package/lib/chunk-NGFK3EYW.mjs +28 -0
  40. package/lib/chunk-NVEG3LEZ.mjs +143 -0
  41. package/lib/chunk-OGXVGBRI.mjs +29 -0
  42. package/lib/chunk-OXV52GD5.mjs +62 -0
  43. package/lib/chunk-PXBMHE7O.mjs +35 -0
  44. package/lib/chunk-R5FJOR63.mjs +47 -0
  45. package/lib/chunk-SPTECFE5.mjs +180 -0
  46. package/lib/chunk-UXCFNAR6.mjs +55 -0
  47. package/lib/chunk-V2IBPCEV.mjs +39 -0
  48. package/lib/chunk-XPJGCDOD.mjs +14 -0
  49. package/lib/chunk-ZOWVMII3.mjs +228 -0
  50. package/lib/clean-github-actions-caches-cli.cjs +465 -0
  51. package/lib/clean-github-actions-caches-cli.d.cts +1 -0
  52. package/lib/clean-github-actions-caches-cli.mjs +56 -0
  53. package/lib/clean-github-actions-caches.cjs +149 -205
  54. package/lib/clean-github-actions-caches.d.cts +15 -1
  55. package/lib/clean-github-actions-caches.mjs +4 -130
  56. package/lib/cross-env/command.cjs +63 -0
  57. package/lib/cross-env/command.d.ts +8 -0
  58. package/lib/cross-env/command.js +45 -0
  59. package/lib/cross-env/command.mjs +9 -0
  60. package/lib/cross-env/index.cjs +178 -0
  61. package/lib/cross-env/index.d.ts +8 -0
  62. package/lib/cross-env/index.js +102 -0
  63. package/lib/cross-env/index.mjs +101 -0
  64. package/lib/cross-env/variable.cjs +60 -0
  65. package/lib/cross-env/variable.d.ts +7 -0
  66. package/lib/cross-env/variable.js +59 -0
  67. package/lib/cross-env/variable.mjs +9 -0
  68. package/lib/del-gradle.cjs +2 -2
  69. package/lib/del-gradle.js +8 -8
  70. package/lib/del-gradle.mjs +1 -1
  71. package/lib/del-node-modules.js +24 -24
  72. package/lib/del-ps.cjs +2 -2
  73. package/lib/del-ps.js +8 -8
  74. package/lib/del-ps.mjs +1 -1
  75. package/lib/del-yarn-caches.cjs +2 -2
  76. package/lib/del-yarn-caches.js +2 -2
  77. package/lib/del-yarn-caches.mjs +1 -1
  78. package/lib/file/copy-cli.cjs +92 -0
  79. package/lib/file/copy-cli.d.mts +1 -0
  80. package/lib/file/copy-cli.mjs +55 -0
  81. package/lib/file/copy.cjs +56 -0
  82. package/lib/file/copy.d.mts +1 -0
  83. package/lib/file/copy.mjs +8 -0
  84. package/lib/file/move-cli.cjs +91 -0
  85. package/lib/file/move-cli.d.mts +1 -0
  86. package/lib/file/move-cli.mjs +55 -0
  87. package/lib/file/move.cjs +55 -0
  88. package/lib/file/move.d.mts +1 -0
  89. package/lib/file/move.mjs +8 -0
  90. package/lib/find-node-modules-cli.js +1 -1
  91. package/lib/free-chatgpt.cjs +21 -15
  92. package/lib/free-chatgpt.js +10 -10
  93. package/lib/free-chatgpt.mjs +2 -2
  94. package/lib/git/user-config.cjs +2 -2
  95. package/lib/git/user-config.mjs +2 -2
  96. package/lib/git-diff-cli.cjs +188 -42
  97. package/lib/git-diff-cli.mjs +5 -4
  98. package/lib/git-diff.cjs +188 -42
  99. package/lib/git-diff.d.ts +2 -1
  100. package/lib/git-diff.js +91 -34
  101. package/lib/git-diff.mjs +5 -4
  102. package/lib/git-fix.cjs +2 -2
  103. package/lib/git-fix.mjs +2 -2
  104. package/lib/git-purge.cjs +2 -2
  105. package/lib/git-purge.mjs +1 -1
  106. package/lib/index.d.ts +1 -1
  107. package/lib/kill-night-crows.cjs +7 -7
  108. package/lib/kill-night-crows.mjs +7 -7
  109. package/lib/node-cache-cleaner/npm.cjs +65 -0
  110. package/lib/node-cache-cleaner/npm.d.ts +2 -0
  111. package/lib/node-cache-cleaner/npm.js +41 -0
  112. package/lib/node-cache-cleaner/npm.mjs +10 -0
  113. package/lib/node-cache-cleaner/npx.cjs +89 -0
  114. package/lib/node-cache-cleaner/npx.d.ts +4 -0
  115. package/lib/node-cache-cleaner/npx.js +82 -0
  116. package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
  117. package/lib/node-cache-cleaner/yarn.cjs +73 -0
  118. package/lib/node-cache-cleaner/yarn.d.ts +2 -0
  119. package/lib/node-cache-cleaner/yarn.js +62 -0
  120. package/lib/node-cache-cleaner/yarn.mjs +10 -0
  121. package/lib/node-cache-cleaner-cli.cjs +182 -0
  122. package/lib/node-cache-cleaner-cli.d.ts +2 -0
  123. package/lib/node-cache-cleaner-cli.js +60 -0
  124. package/lib/node-cache-cleaner-cli.mjs +56 -0
  125. package/lib/node-executor.cjs +91 -0
  126. package/lib/node-executor.d.cts +2 -0
  127. package/lib/node-executor.mjs +103 -0
  128. package/lib/npm-run-series.cjs +21 -28
  129. package/lib/npm-run-series.mjs +20 -6
  130. package/lib/package-resolutions-updater-cli.cjs +213 -128
  131. package/lib/package-resolutions-updater-cli.mjs +17 -39
  132. package/lib/package-resolutions-updater.cjs +204 -98
  133. package/lib/package-resolutions-updater.d.mts +20 -1
  134. package/lib/package-resolutions-updater.mjs +7 -5
  135. package/lib/print-directory-tree.cjs +2 -2
  136. package/lib/print-directory-tree.mjs +1 -1
  137. package/lib/ps/connected-domain.js +10 -10
  138. package/lib/ps/index.cjs +1 -1
  139. package/lib/ps/index.mjs +177 -171
  140. package/lib/ps/isWin.js +1 -1
  141. package/lib/ps/table-parser.js +6 -6
  142. package/lib/remove-module.cjs +2 -2
  143. package/lib/remove-module.mjs +1 -1
  144. package/lib/rm-node-module-cli.cjs +222 -0
  145. package/lib/rm-node-module-cli.d.cts +1 -0
  146. package/lib/rm-node-module-cli.mjs +89 -0
  147. package/lib/rm-node-modules.cjs +127 -0
  148. package/lib/rm-node-modules.d.cts +35 -0
  149. package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
  150. package/lib/rmpath.cjs +2 -2
  151. package/lib/rmpath.mjs +1 -1
  152. package/lib/submodule-install.cjs +47 -34
  153. package/lib/submodule-install.mjs +46 -33
  154. package/lib/submodule-remove-cli.cjs +1 -2
  155. package/lib/submodule-remove-cli.js +3 -3
  156. package/lib/submodule-remove-cli.mjs +1 -2
  157. package/lib/utils/chatgpt.cjs +19 -13
  158. package/lib/utils/chatgpt.js +94 -94
  159. package/lib/utils/chatgpt.mjs +1 -1
  160. package/lib/utils/findEnvFiles.cjs +28 -46
  161. package/lib/utils/findEnvFiles.d.cts +19 -0
  162. package/lib/utils/findEnvFiles.mjs +3 -5
  163. package/lib/utils/findWorkspaceRoot.js +4 -4
  164. package/lib/utils/index.cjs +2 -2
  165. package/lib/utils/index.mjs +1 -1
  166. package/lib/utils/isGithubTokenValid.js +7 -7
  167. package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
  168. package/lib/utils/isWindows.d.ts +5 -0
  169. package/lib/utils/isWindows.js +10 -0
  170. package/lib/utils/isWindows.mjs +8 -0
  171. package/lib/utils/runBash.cjs +53 -0
  172. package/lib/utils/runBash.d.cts +12 -0
  173. package/lib/utils/runBash.mjs +66 -0
  174. package/lib/yarn-per-branch-lock-installer.cjs +97 -0
  175. package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
  176. package/lib/yarn-per-branch-lock-installer.mjs +109 -0
  177. package/lib/yarn-reinstall.cjs +2 -2
  178. package/lib/yarn-reinstall.mjs +1 -1
  179. package/package.json +61 -52
  180. package/readme.html +784 -0
  181. package/readme.md +106 -218
  182. package/releases/readme.md +1 -1
  183. package/test/README.md +2 -2
  184. package/test-project/package.json +8 -2
  185. package/test-project/workspaces/workspace-a/package.json +135 -0
  186. package/test-project/workspaces/workspace-a/readme.md +20 -0
  187. package/test-project/workspaces/workspace-a/release/readme.md +42 -0
  188. package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
  189. package/test-project/workspaces/workspace-a/test/readme.md +12 -0
  190. package/test-project/workspaces/workspace-b/package.json +139 -0
  191. package/test-project/workspaces/workspace-b/readme.md +94 -0
  192. package/test-project/workspaces/workspace-b/requirements.txt +1 -0
  193. package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
  194. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
  195. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
  196. package/tmp/rm-node-modules-test-project/package.json +17 -0
  197. package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
  198. package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
  199. package/tmp/test-repo/README.md +2 -35
  200. package/tmp/test-repo/package.json +13 -3
  201. package/docs-src/clean-github-actions-caches.md +0 -26
  202. package/docs-src/free-chatgpt.md +0 -26
  203. package/lib/binary-collections-config.cjs +0 -15
  204. package/lib/chunk-2CBJCW7E.mjs +0 -81
  205. package/lib/chunk-4UHL4WVN.mjs +0 -136
  206. package/lib/chunk-66PAU5PS.mjs +0 -31
  207. package/lib/chunk-6HHJRKFB.mjs +0 -59
  208. package/lib/chunk-7XTEJHOE.mjs +0 -193
  209. package/lib/chunk-FCDQGYBF.mjs +0 -136
  210. package/lib/chunk-GEYA2USY.mjs +0 -207
  211. package/lib/chunk-GJTGHXRA.mjs +0 -356
  212. package/lib/chunk-ID2WBTE2.mjs +0 -80
  213. package/lib/chunk-JXFOHKDM.mjs +0 -239
  214. package/lib/chunk-PDSXF5HY.mjs +0 -187
  215. package/lib/chunk-RWLXRTYP.mjs +0 -109
  216. package/lib/chunk-TOIVAQF7.mjs +0 -136
  217. package/lib/chunk-V5SKYJUB.mjs +0 -136
  218. package/lib/chunk-WSRETQCA.mjs +0 -59
  219. package/lib/chunk-YYLIQQKF.mjs +0 -31
  220. package/lib/ps/index.d.ts +0 -2
  221. package/lib/ps/index.js +0 -254
  222. package/lib/utils/findEnvFiles.d.ts +0 -8
  223. package/lib/utils/findEnvFiles.js +0 -121
  224. package/tmp/typedoc/readme.md +0 -320
  225. /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
@@ -65,19 +65,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
65
65
  process.exit(0);
66
66
  }
67
67
  if (!scriptPath) {
68
- console.error(`PowerShell script not found in any of these paths:
69
- ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`);
68
+ console.error(
69
+ `PowerShell script not found in any of these paths:
70
+ ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
71
+ );
70
72
  process.exit(1);
71
73
  }
72
74
  if (process.platform !== "win32") {
73
75
  console.error("kill-night-crows is supported only on Windows.");
74
76
  process.exit(1);
75
77
  }
76
- var result = (0, import_node_child_process.spawnSync)(
77
- "powershell.exe",
78
- ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args],
79
- { stdio: "inherit" }
80
- );
78
+ var result = (0, import_node_child_process.spawnSync)("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
79
+ stdio: "inherit"
80
+ });
81
81
  if (typeof result.status === "number") {
82
82
  process.exit(result.status);
83
83
  }
@@ -43,19 +43,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
43
43
  process.exit(0);
44
44
  }
45
45
  if (!scriptPath) {
46
- console.error(`PowerShell script not found in any of these paths:
47
- ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`);
46
+ console.error(
47
+ `PowerShell script not found in any of these paths:
48
+ ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
49
+ );
48
50
  process.exit(1);
49
51
  }
50
52
  if (process.platform !== "win32") {
51
53
  console.error("kill-night-crows is supported only on Windows.");
52
54
  process.exit(1);
53
55
  }
54
- var result = spawnSync(
55
- "powershell.exe",
56
- ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args],
57
- { stdio: "inherit" }
58
- );
56
+ var result = spawnSync("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
57
+ stdio: "inherit"
58
+ });
59
59
  if (typeof result.status === "number") {
60
60
  process.exit(result.status);
61
61
  }
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/node-cache-cleaner/npm.ts
20
+ var npm_exports = {};
21
+ __export(npm_exports, {
22
+ cleanNpmCache: () => cleanNpmCache,
23
+ npmVersion: () => npmVersion
24
+ });
25
+ module.exports = __toCommonJS(npm_exports);
26
+ var import_cross_spawn = require("cross-spawn");
27
+ function npmVersion() {
28
+ return new Promise((resolve, reject) => {
29
+ const process = (0, import_cross_spawn.spawn)("npm", ["--version"], {
30
+ stdio: "pipe",
31
+ shell: true
32
+ });
33
+ let version = "";
34
+ process.stdout.on("data", (data) => {
35
+ version += data.toString();
36
+ });
37
+ process.on("close", (code) => {
38
+ if (code === 0) {
39
+ resolve(version.trim());
40
+ } else {
41
+ reject(new Error(`NPM version check failed with exit code ${code}`));
42
+ }
43
+ });
44
+ });
45
+ }
46
+ function cleanNpmCache() {
47
+ return new Promise((resolve, reject) => {
48
+ const process = (0, import_cross_spawn.spawn)("npm", ["cache", "clean", "--force"], {
49
+ stdio: "inherit",
50
+ shell: true
51
+ });
52
+ process.on("close", (code) => {
53
+ if (code === 0) {
54
+ resolve(true);
55
+ } else {
56
+ reject(new Error(`NPM cache clean failed with exit code ${code}`));
57
+ }
58
+ });
59
+ });
60
+ }
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ cleanNpmCache,
64
+ npmVersion
65
+ });
@@ -0,0 +1,2 @@
1
+ export declare function npmVersion(): Promise<string>;
2
+ export declare function cleanNpmCache(): Promise<unknown>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.npmVersion = npmVersion;
4
+ exports.cleanNpmCache = cleanNpmCache;
5
+ const cross_spawn_1 = require("cross-spawn");
6
+ function npmVersion() {
7
+ return new Promise((resolve, reject) => {
8
+ const process = (0, cross_spawn_1.spawn)('npm', ['--version'], {
9
+ stdio: 'pipe',
10
+ shell: true
11
+ });
12
+ let version = '';
13
+ process.stdout.on('data', (data) => {
14
+ version += data.toString();
15
+ });
16
+ process.on('close', (code) => {
17
+ if (code === 0) {
18
+ resolve(version.trim());
19
+ }
20
+ else {
21
+ reject(new Error(`NPM version check failed with exit code ${code}`));
22
+ }
23
+ });
24
+ });
25
+ }
26
+ function cleanNpmCache() {
27
+ return new Promise((resolve, reject) => {
28
+ const process = (0, cross_spawn_1.spawn)('npm', ['cache', 'clean', '--force'], {
29
+ stdio: 'inherit',
30
+ shell: true
31
+ });
32
+ process.on('close', (code) => {
33
+ if (code === 0) {
34
+ resolve(true);
35
+ }
36
+ else {
37
+ reject(new Error(`NPM cache clean failed with exit code ${code}`));
38
+ }
39
+ });
40
+ });
41
+ }
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ cleanNpmCache,
4
+ npmVersion
5
+ } from "../chunk-R5FJOR63.mjs";
6
+ import "../chunk-QQ4A6DLD.mjs";
7
+ export {
8
+ cleanNpmCache,
9
+ npmVersion
10
+ };
@@ -0,0 +1,89 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/node-cache-cleaner/npx.ts
30
+ var npx_exports = {};
31
+ __export(npx_exports, {
32
+ cleanNpxCache: () => cleanNpxCache
33
+ });
34
+ module.exports = __toCommonJS(npx_exports);
35
+ var import_fs_extra = __toESM(require("fs-extra"), 1);
36
+ var import_upath = __toESM(require("upath"), 1);
37
+ var import_os = __toESM(require("os"), 1);
38
+ var import_cross_spawn = require("cross-spawn");
39
+ function getNpmCacheDir() {
40
+ return new Promise((resolve, reject) => {
41
+ var _a, _b;
42
+ const child = (0, import_cross_spawn.spawn)("npm", ["config", "get", "cache"], {
43
+ stdio: ["ignore", "pipe", "pipe"],
44
+ shell: true
45
+ });
46
+ let output = "";
47
+ let error = "";
48
+ (_a = child.stdout) == null ? void 0 : _a.on("data", (data) => {
49
+ output += data.toString();
50
+ });
51
+ (_b = child.stderr) == null ? void 0 : _b.on("data", (data) => {
52
+ error += data.toString();
53
+ });
54
+ child.on("close", (code) => {
55
+ if (code === 0) {
56
+ resolve(output.trim());
57
+ } else {
58
+ reject(new Error(`Failed to get npm cache directory (code ${code}): ${error}`));
59
+ }
60
+ });
61
+ });
62
+ }
63
+ async function removeDir(target) {
64
+ try {
65
+ const exists = await import_fs_extra.default.pathExists(target);
66
+ if (exists) {
67
+ console.log(`Removing: ${target}`);
68
+ await import_fs_extra.default.remove(target);
69
+ } else {
70
+ console.log(`Not found: ${target}`);
71
+ }
72
+ } catch (err) {
73
+ console.error(`Failed to remove ${target}:`, err);
74
+ }
75
+ }
76
+ async function cleanNpxCache() {
77
+ const cacheDir = await getNpmCacheDir();
78
+ console.log("Detected npm cache:", cacheDir);
79
+ console.log("\nCleaning npm/npx cache...\n");
80
+ const npxCache = import_upath.default.join(cacheDir, "_npx");
81
+ const npmCache = import_upath.default.join(cacheDir, "_cacache");
82
+ const altNpxLinux = import_upath.default.join(import_os.default.homedir(), ".cache", "npx");
83
+ await Promise.all([removeDir(npxCache), removeDir(npmCache), removeDir(altNpxLinux)]);
84
+ console.log("\nDone \u2714\uFE0F");
85
+ }
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ cleanNpxCache
89
+ });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Main cleaner
3
+ */
4
+ export declare function cleanNpxCache(): Promise<void>;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.cleanNpxCache = cleanNpxCache;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const upath_1 = __importDefault(require("upath"));
18
+ const os_1 = __importDefault(require("os"));
19
+ const cross_spawn_1 = require("cross-spawn");
20
+ /**
21
+ * Get npm cache directory using `npm config get cache`
22
+ */
23
+ function getNpmCacheDir() {
24
+ return new Promise((resolve, reject) => {
25
+ var _a, _b;
26
+ const child = (0, cross_spawn_1.spawn)('npm', ['config', 'get', 'cache'], {
27
+ stdio: ['ignore', 'pipe', 'pipe'],
28
+ shell: true
29
+ });
30
+ let output = '';
31
+ let error = '';
32
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
33
+ output += data.toString();
34
+ });
35
+ (_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
36
+ error += data.toString();
37
+ });
38
+ child.on('close', (code) => {
39
+ if (code === 0) {
40
+ resolve(output.trim());
41
+ }
42
+ else {
43
+ reject(new Error(`Failed to get npm cache directory (code ${code}): ${error}`));
44
+ }
45
+ });
46
+ });
47
+ }
48
+ /**
49
+ * Remove directory safely
50
+ */
51
+ function removeDir(target) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ try {
54
+ const exists = yield fs_extra_1.default.pathExists(target);
55
+ if (exists) {
56
+ console.log(`Removing: ${target}`);
57
+ yield fs_extra_1.default.remove(target);
58
+ }
59
+ else {
60
+ console.log(`Not found: ${target}`);
61
+ }
62
+ }
63
+ catch (err) {
64
+ console.error(`Failed to remove ${target}:`, err);
65
+ }
66
+ });
67
+ }
68
+ /**
69
+ * Main cleaner
70
+ */
71
+ function cleanNpxCache() {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const cacheDir = yield getNpmCacheDir();
74
+ console.log('Detected npm cache:', cacheDir);
75
+ console.log('\nCleaning npm/npx cache...\n');
76
+ const npxCache = upath_1.default.join(cacheDir, '_npx');
77
+ const npmCache = upath_1.default.join(cacheDir, '_cacache');
78
+ const altNpxLinux = upath_1.default.join(os_1.default.homedir(), '.cache', 'npx');
79
+ yield Promise.all([removeDir(npxCache), removeDir(npmCache), removeDir(altNpxLinux)]);
80
+ console.log('\nDone ✔️');
81
+ });
82
+ }
@@ -1,7 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
- init_esm_shims
4
- } from "../chunk-QQ4A6DLD.mjs";
5
-
6
- // src/ps/index.d.ts
7
- init_esm_shims();
3
+ cleanNpxCache
4
+ } from "../chunk-OXV52GD5.mjs";
5
+ import "../chunk-QQ4A6DLD.mjs";
6
+ export {
7
+ cleanNpxCache
8
+ };
@@ -0,0 +1,73 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/node-cache-cleaner/yarn.ts
20
+ var yarn_exports = {};
21
+ __export(yarn_exports, {
22
+ cleanYarnCache: () => cleanYarnCache,
23
+ yarnVersion: () => yarnVersion
24
+ });
25
+ module.exports = __toCommonJS(yarn_exports);
26
+ var import_cross_spawn = require("cross-spawn");
27
+ function yarnVersion() {
28
+ return new Promise((resolve, reject) => {
29
+ const process = (0, import_cross_spawn.spawn)("yarn", ["--version"], {
30
+ stdio: "pipe",
31
+ shell: true
32
+ });
33
+ let version = "";
34
+ process.stdout.on("data", (data) => {
35
+ version += data.toString();
36
+ });
37
+ process.on("close", (code) => {
38
+ if (code === 0) {
39
+ resolve(version.trim());
40
+ } else {
41
+ reject(new Error(`Yarn version check failed with exit code ${code}`));
42
+ }
43
+ });
44
+ });
45
+ }
46
+ async function cleanYarnCache() {
47
+ let version = "";
48
+ try {
49
+ version = await yarnVersion();
50
+ } catch {
51
+ }
52
+ const major = parseInt(version.split(".")[0], 10);
53
+ const isClassic = major === 1 || version === "";
54
+ const args = isClassic ? ["cache", "clean"] : ["cache", "clean", "--all"];
55
+ return new Promise((resolve, reject) => {
56
+ const process = (0, import_cross_spawn.spawn)("yarn", args, {
57
+ stdio: "inherit",
58
+ shell: true
59
+ });
60
+ process.on("close", (code) => {
61
+ if (code === 0) {
62
+ resolve(true);
63
+ } else {
64
+ reject(new Error(`Yarn cache clean failed with exit code ${code}`));
65
+ }
66
+ });
67
+ });
68
+ }
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ cleanYarnCache,
72
+ yarnVersion
73
+ });
@@ -0,0 +1,2 @@
1
+ export declare function yarnVersion(): Promise<string>;
2
+ export declare function cleanYarnCache(): Promise<unknown>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.yarnVersion = yarnVersion;
13
+ exports.cleanYarnCache = cleanYarnCache;
14
+ const cross_spawn_1 = require("cross-spawn");
15
+ function yarnVersion() {
16
+ return new Promise((resolve, reject) => {
17
+ const process = (0, cross_spawn_1.spawn)('yarn', ['--version'], {
18
+ stdio: 'pipe',
19
+ shell: true
20
+ });
21
+ let version = '';
22
+ process.stdout.on('data', (data) => {
23
+ version += data.toString();
24
+ });
25
+ process.on('close', (code) => {
26
+ if (code === 0) {
27
+ resolve(version.trim());
28
+ }
29
+ else {
30
+ reject(new Error(`Yarn version check failed with exit code ${code}`));
31
+ }
32
+ });
33
+ });
34
+ }
35
+ function cleanYarnCache() {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ let version = '';
38
+ try {
39
+ version = yield yarnVersion();
40
+ }
41
+ catch (_a) {
42
+ // if version check fails, just try the generic command
43
+ }
44
+ const major = parseInt(version.split('.')[0], 10);
45
+ const isClassic = major === 1 || version === '';
46
+ const args = isClassic ? ['cache', 'clean'] : ['cache', 'clean', '--all'];
47
+ return new Promise((resolve, reject) => {
48
+ const process = (0, cross_spawn_1.spawn)('yarn', args, {
49
+ stdio: 'inherit',
50
+ shell: true
51
+ });
52
+ process.on('close', (code) => {
53
+ if (code === 0) {
54
+ resolve(true);
55
+ }
56
+ else {
57
+ reject(new Error(`Yarn cache clean failed with exit code ${code}`));
58
+ }
59
+ });
60
+ });
61
+ });
62
+ }
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ cleanYarnCache,
4
+ yarnVersion
5
+ } from "../chunk-UXCFNAR6.mjs";
6
+ import "../chunk-QQ4A6DLD.mjs";
7
+ export {
8
+ cleanYarnCache,
9
+ yarnVersion
10
+ };