binary-collections 2.0.11 → 2.0.13

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 (330) hide show
  1. package/binaries/binary-executor.cjs +89 -13
  2. package/binaries/clean-nodemodule.cjs +89 -13
  3. package/binaries/clean-nodemodules.cjs +89 -13
  4. package/binaries/dev.cjs +89 -13
  5. package/binaries/empty.cjs +89 -13
  6. package/binaries/git-reduce-size.cjs +89 -13
  7. package/binaries/javakill.cjs +89 -13
  8. package/binaries/kill-process.cjs +89 -13
  9. package/binaries/nodekill.cjs +89 -13
  10. package/binaries/prod.cjs +89 -13
  11. package/binaries/py.cjs +89 -13
  12. package/binaries/rmfind.cjs +89 -13
  13. package/binaries/rmx +15 -1
  14. package/binaries/rmx.cjs +89 -13
  15. package/binaries/rmx.cmd +12 -0
  16. package/binaries/submodule-token.cjs +89 -13
  17. package/binaries/test-cjs +9 -1
  18. package/binaries/test-cjs.cjs +89 -13
  19. package/binaries/test-cjs.cmd +16 -1
  20. package/binaries/test-esm +16 -0
  21. package/binaries/test-esm.cjs +254 -0
  22. package/binaries/test-esm.cmd +23 -0
  23. package/binaries/yarn-clean +1 -1
  24. package/binaries/yarn-clean.cjs +89 -13
  25. package/binaries/yarn-clean.cmd +1 -1
  26. package/binaries/yarn-clean.py +33 -15
  27. package/binaries/yc +131 -0
  28. package/binaries/yc.cjs +254 -0
  29. package/binaries/ycw +256 -0
  30. package/binaries/ycw.cjs +254 -0
  31. package/docs-src/binary-collections.md +34 -0
  32. package/docs-src/changelog.md +26 -0
  33. package/docs-src/clean-github-actions-caches.md +91 -2
  34. package/docs-src/copy-move-file.md +59 -0
  35. package/docs-src/del-gradle.md +17 -0
  36. package/docs-src/del-ps.md +28 -0
  37. package/docs-src/downloader.md +62 -0
  38. package/docs-src/env-helpers.md +29 -0
  39. package/docs-src/find-node-modules.md +17 -0
  40. package/docs-src/git-diff.md +33 -0
  41. package/docs-src/git-fix.md +34 -0
  42. package/docs-src/git-purge.md +17 -0
  43. package/docs-src/git-reduce-size.md +17 -0
  44. package/docs-src/git-undo.md +21 -0
  45. package/docs-src/kill-night-crows.md +26 -0
  46. package/docs-src/node-cache-cleaner.md +182 -0
  47. package/docs-src/node-executor.md +50 -0
  48. package/docs-src/node-package-packer.md +48 -0
  49. package/docs-src/npm-run-series.md +43 -0
  50. package/docs-src/package-resolutions-updater.md +22 -0
  51. package/docs-src/php-cs-fixer-staged.md +19 -0
  52. package/docs-src/print-directory-tree.md +35 -0
  53. package/docs-src/print-tarball-tree.md +55 -0
  54. package/docs-src/py.md +19 -0
  55. package/docs-src/remove-module.md +32 -0
  56. package/docs-src/rmfind-rmx.md +21 -0
  57. package/docs-src/rmpath.md +38 -0
  58. package/docs-src/run-by-checksum.md +87 -0
  59. package/docs-src/submodule-install.md +31 -0
  60. package/docs-src/submodule-remove.md +22 -0
  61. package/docs-src/submodule-token.md +17 -0
  62. package/docs-src/test-runners.md +21 -0
  63. package/docs-src/yarn-install.md +31 -0
  64. package/docs-src/yarn-reinstall.md +27 -0
  65. package/lib/binary-collections/config.cjs +126 -0
  66. package/lib/binary-collections/config.mjs +7 -0
  67. package/lib/binary-collections/executeScript.cjs +19 -0
  68. package/lib/binary-collections/executeScript.d.cts +12 -0
  69. package/lib/binary-collections/executeScript.mjs +6 -0
  70. package/lib/binary-collections/findScript.cjs +309 -0
  71. package/lib/binary-collections/findScript.d.cts +12 -0
  72. package/lib/binary-collections/findScript.mjs +7 -0
  73. package/lib/binary-collections/listScript.cjs +291 -0
  74. package/lib/binary-collections/listScript.d.cts +19 -0
  75. package/lib/binary-collections/listScript.mjs +7 -0
  76. package/lib/binary-collections.cjs +264 -157
  77. package/lib/binary-collections.mjs +26 -286
  78. package/lib/changelog.cjs +9 -14
  79. package/lib/changelog.mjs +2 -2
  80. package/lib/chunk-2MN4VPV2.mjs +246 -0
  81. package/lib/chunk-6C7KTYGZ.mjs +41 -0
  82. package/lib/{chunk-Z6JLYU2J.mjs → chunk-6RK5UCTP.mjs} +7 -12
  83. package/lib/chunk-CD3HF3LK.mjs +190 -0
  84. package/lib/chunk-FLYSZFLW.mjs +61 -0
  85. package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
  86. package/lib/chunk-H44UWUFY.mjs +105 -0
  87. package/lib/chunk-KLKAIFKI.mjs +40 -0
  88. package/lib/chunk-LVSPEFU2.mjs +86 -0
  89. package/lib/{chunk-RWLXRTYP.mjs → chunk-MGPYPKIE.mjs} +2 -2
  90. package/lib/chunk-NGFK3EYW.mjs +28 -0
  91. package/lib/chunk-NQXUYO67.mjs +253 -0
  92. package/lib/chunk-NVEG3LEZ.mjs +143 -0
  93. package/lib/chunk-OBXLTXFJ.mjs +34 -0
  94. package/lib/chunk-OGXVGBRI.mjs +29 -0
  95. package/lib/chunk-OXV52GD5.mjs +62 -0
  96. package/lib/chunk-PXBMHE7O.mjs +35 -0
  97. package/lib/chunk-QD4T255Z.mjs +40 -0
  98. package/lib/chunk-QII2EKCS.mjs +26 -0
  99. package/lib/chunk-R5FJOR63.mjs +47 -0
  100. package/lib/chunk-RDGDLSPD.mjs +76 -0
  101. package/lib/chunk-RDN6HF5Z.mjs +79 -0
  102. package/lib/chunk-RJKTSUAX.mjs +123 -0
  103. package/lib/{chunk-XA3SNBPA.mjs → chunk-TBWXE7ST.mjs} +97 -38
  104. package/lib/chunk-UXCFNAR6.mjs +55 -0
  105. package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
  106. package/lib/chunk-WSHVPGNM.mjs +44 -0
  107. package/lib/{chunk-66PAU5PS.mjs → chunk-X2B3X7D4.mjs} +10 -6
  108. package/lib/clean-github-actions-caches-cli.cjs +507 -0
  109. package/lib/clean-github-actions-caches-cli.mjs +74 -0
  110. package/lib/clean-github-actions-caches.cjs +246 -106
  111. package/lib/clean-github-actions-caches.d.cts +53 -1
  112. package/lib/clean-github-actions-caches.mjs +5 -130
  113. package/lib/cross-env/command.cjs +63 -0
  114. package/lib/cross-env/command.d.ts +8 -0
  115. package/lib/cross-env/command.js +45 -0
  116. package/lib/{ps/isWin.mjs → cross-env/command.mjs} +4 -5
  117. package/lib/cross-env/index.cjs +178 -0
  118. package/lib/cross-env/index.d.ts +8 -0
  119. package/lib/cross-env/index.js +102 -0
  120. package/lib/cross-env/index.mjs +101 -0
  121. package/lib/cross-env/variable.cjs +60 -0
  122. package/lib/cross-env/variable.d.ts +7 -0
  123. package/lib/cross-env/variable.js +59 -0
  124. package/lib/cross-env/variable.mjs +9 -0
  125. package/lib/del-gradle.cjs +8 -13
  126. package/lib/del-gradle.js +8 -8
  127. package/lib/del-gradle.mjs +1 -1
  128. package/lib/del-node-modules.cjs +185 -3
  129. package/lib/del-node-modules.js +25 -25
  130. package/lib/del-node-modules.mjs +6 -3
  131. package/lib/{del-ps.cjs → del-ps-cli.cjs} +38 -43
  132. package/lib/del-ps-cli.d.mts +1 -0
  133. package/lib/del-ps-cli.mjs +44 -0
  134. package/lib/del-yarn-caches.cjs +8 -13
  135. package/lib/del-yarn-caches.js +2 -2
  136. package/lib/del-yarn-caches.mjs +1 -1
  137. package/lib/downloader-cli.cjs +256 -0
  138. package/lib/downloader-cli.d.cts +2 -0
  139. package/lib/downloader-cli.mjs +90 -0
  140. package/lib/file/copy-cli.cjs +273 -0
  141. package/lib/file/copy-cli.d.mts +1 -0
  142. package/lib/file/copy-cli.mjs +59 -0
  143. package/lib/file/copy.cjs +56 -0
  144. package/lib/file/copy.d.mts +1 -0
  145. package/lib/file/copy.mjs +8 -0
  146. package/lib/file/move-cli.cjs +272 -0
  147. package/lib/file/move-cli.d.mts +1 -0
  148. package/lib/file/move-cli.mjs +59 -0
  149. package/lib/file/move.cjs +55 -0
  150. package/lib/file/move.d.mts +1 -0
  151. package/lib/file/move.mjs +8 -0
  152. package/lib/find-node-modules-cli.cjs +1 -1
  153. package/lib/find-node-modules-cli.js +1 -1
  154. package/lib/find-node-modules-cli.mjs +1 -1
  155. package/lib/find-node-modules.cjs +1 -1
  156. package/lib/find-node-modules.mjs +1 -1
  157. package/lib/free-chatgpt.cjs +27 -26
  158. package/lib/free-chatgpt.js +10 -10
  159. package/lib/free-chatgpt.mjs +2 -2
  160. package/lib/git/user-config.cjs +9 -14
  161. package/lib/git/user-config.mjs +2 -2
  162. package/lib/git-diff-cli.cjs +273 -66
  163. package/lib/git-diff-cli.mjs +5 -4
  164. package/lib/git-diff.cjs +273 -66
  165. package/lib/git-diff.d.ts +2 -1
  166. package/lib/git-diff.js +153 -39
  167. package/lib/git-diff.mjs +5 -4
  168. package/lib/git-fix.cjs +9 -14
  169. package/lib/git-fix.mjs +2 -2
  170. package/lib/git-purge.cjs +9 -14
  171. package/lib/git-purge.mjs +2 -2
  172. package/lib/index.cjs +1 -1
  173. package/lib/index.d.ts +1 -1
  174. package/lib/index.mjs +1 -1
  175. package/lib/kill-night-crows.cjs +7 -7
  176. package/lib/kill-night-crows.mjs +7 -7
  177. package/lib/node-cache-cleaner/npm.cjs +65 -0
  178. package/lib/node-cache-cleaner/npm.d.ts +2 -0
  179. package/lib/node-cache-cleaner/npm.js +41 -0
  180. package/lib/node-cache-cleaner/npm.mjs +10 -0
  181. package/lib/node-cache-cleaner/npx.cjs +89 -0
  182. package/lib/node-cache-cleaner/npx.d.ts +4 -0
  183. package/lib/node-cache-cleaner/npx.js +82 -0
  184. package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
  185. package/lib/node-cache-cleaner/yarn.cjs +73 -0
  186. package/lib/node-cache-cleaner/yarn.d.ts +2 -0
  187. package/lib/node-cache-cleaner/yarn.js +62 -0
  188. package/lib/node-cache-cleaner/yarn.mjs +10 -0
  189. package/lib/node-cache-cleaner-cli.cjs +365 -0
  190. package/lib/node-cache-cleaner-cli.d.ts +2 -0
  191. package/lib/node-cache-cleaner-cli.js +57 -0
  192. package/lib/node-cache-cleaner-cli.mjs +60 -0
  193. package/lib/node-executor.cjs +272 -0
  194. package/lib/node-executor.d.cts +2 -0
  195. package/lib/node-executor.mjs +106 -0
  196. package/lib/node-package-packer/build-readme.cjs +150 -0
  197. package/lib/node-package-packer/build-readme.d.mts +10 -0
  198. package/lib/node-package-packer/build-readme.mjs +10 -0
  199. package/lib/node-package-packer/build-tarball.cjs +495 -0
  200. package/lib/node-package-packer/build-tarball.d.mts +33 -0
  201. package/lib/node-package-packer/build-tarball.mjs +175 -0
  202. package/lib/node-package-packer-cli.cjs +525 -0
  203. package/lib/node-package-packer-cli.d.mts +1 -0
  204. package/lib/node-package-packer-cli.mjs +34 -0
  205. package/lib/npm-run-series.cjs +28 -40
  206. package/lib/npm-run-series.mjs +21 -7
  207. package/lib/package-resolutions-updater-cli.cjs +255 -173
  208. package/lib/package-resolutions-updater-cli.mjs +19 -40
  209. package/lib/package-resolutions-updater.cjs +244 -141
  210. package/lib/package-resolutions-updater.d.mts +54 -1
  211. package/lib/package-resolutions-updater.mjs +8 -5
  212. package/lib/php-cs-fixer-staged.cjs +1 -1
  213. package/lib/php-cs-fixer-staged.mjs +1 -1
  214. package/lib/print-directory-tree.cjs +18 -20
  215. package/lib/print-directory-tree.mjs +11 -8
  216. package/lib/print-tarball-tree.cjs +262 -0
  217. package/lib/print-tarball-tree.d.mts +1 -0
  218. package/lib/print-tarball-tree.mjs +68 -0
  219. package/lib/ps/connected-domain.js +10 -10
  220. package/lib/ps/index.cjs +11 -11
  221. package/lib/ps/index.mjs +180 -174
  222. package/lib/ps/table-parser.d.ts +3 -4
  223. package/lib/ps/table-parser.js +15 -22
  224. package/lib/remove-module.cjs +19 -24
  225. package/lib/remove-module.mjs +2 -2
  226. package/lib/rm-node-module-cli.cjs +389 -0
  227. package/lib/rm-node-module-cli.d.cts +1 -0
  228. package/lib/rm-node-module-cli.mjs +92 -0
  229. package/lib/rm-node-modules.cjs +127 -0
  230. package/lib/rm-node-modules.d.cts +35 -0
  231. package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
  232. package/lib/rmpath-cli.cjs +285 -0
  233. package/lib/rmpath-cli.d.mts +1 -0
  234. package/lib/rmpath-cli.mjs +23 -0
  235. package/lib/rmpath.cjs +6 -217
  236. package/lib/rmpath.mjs +5 -101
  237. package/lib/run-by-checksum/cache.cjs +69 -0
  238. package/lib/run-by-checksum/cache.d.ts +19 -0
  239. package/lib/run-by-checksum/cache.js +50 -0
  240. package/lib/run-by-checksum/cache.mjs +12 -0
  241. package/lib/run-by-checksum/hash.cjs +72 -0
  242. package/lib/run-by-checksum/hash.d.ts +14 -0
  243. package/lib/run-by-checksum/hash.js +85 -0
  244. package/lib/run-by-checksum/hash.mjs +10 -0
  245. package/lib/run-by-checksum/run.cjs +169 -0
  246. package/lib/run-by-checksum/run.d.ts +22 -0
  247. package/lib/run-by-checksum/run.js +93 -0
  248. package/lib/run-by-checksum/run.mjs +10 -0
  249. package/lib/run-by-checksum-cli.cjs +382 -0
  250. package/lib/run-by-checksum-cli.d.ts +2 -0
  251. package/lib/run-by-checksum-cli.js +43 -0
  252. package/lib/run-by-checksum-cli.mjs +56 -0
  253. package/lib/submodule-install.cjs +55 -47
  254. package/lib/submodule-install.mjs +48 -35
  255. package/lib/submodule-remove-cli.cjs +170 -4
  256. package/lib/submodule-remove-cli.js +5 -5
  257. package/lib/submodule-remove-cli.mjs +6 -4
  258. package/lib/utils/chatgpt.cjs +19 -13
  259. package/lib/utils/chatgpt.js +94 -94
  260. package/lib/utils/chatgpt.mjs +1 -1
  261. package/lib/utils/fetchResponse.cjs +24 -0
  262. package/lib/utils/fetchResponse.d.cts +25 -0
  263. package/lib/utils/fetchResponse.mjs +6 -0
  264. package/lib/utils/findEnvFiles.cjs +28 -46
  265. package/lib/utils/findEnvFiles.d.cts +19 -0
  266. package/lib/utils/findEnvFiles.mjs +3 -5
  267. package/lib/utils/findWorkspaceRoot.js +4 -4
  268. package/lib/utils/index.cjs +7 -12
  269. package/lib/utils/index.d.cts +2 -9
  270. package/lib/utils/index.mjs +1 -1
  271. package/lib/utils/isGithubTokenValid.js +7 -7
  272. package/lib/{ps/isWin.cjs → utils/isWindows.cjs} +12 -7
  273. package/lib/utils/isWindows.d.ts +5 -0
  274. package/lib/utils/isWindows.js +10 -0
  275. package/lib/utils/isWindows.mjs +10 -0
  276. package/lib/utils/runBash.cjs +53 -0
  277. package/lib/utils/runBash.d.cts +12 -0
  278. package/lib/utils/runBash.mjs +66 -0
  279. package/lib/yarn-per-branch-lock-installer.cjs +288 -0
  280. package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
  281. package/lib/yarn-per-branch-lock-installer.mjs +122 -0
  282. package/lib/yarn-reinstall.cjs +8 -13
  283. package/lib/yarn-reinstall.mjs +1 -1
  284. package/package.json +91 -57
  285. package/readme.html +784 -0
  286. package/readme.md +107 -219
  287. package/releases/readme.md +6 -3
  288. package/test/README.md +2 -2
  289. package/test-project/workspaces/workspace-a/readme.md +20 -0
  290. package/test-project/workspaces/workspace-a/release/readme.md +42 -0
  291. package/test-project/workspaces/workspace-a/test/readme.md +12 -0
  292. package/test-project/workspaces/workspace-b/readme.md +94 -0
  293. package/test-project/workspaces/workspace-b/requirements.txt +1 -0
  294. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
  295. package/tmp/test-repo/README.md +2 -35
  296. package/tmp/test-repo-runChecksum/test-complex-glob/README.md +1 -0
  297. package/tmp/test-repo-runChecksum/test-mixed-args/README.md +1 -0
  298. package/lib/binary-collections-config.cjs +0 -15
  299. package/lib/chunk-2CBJCW7E.mjs +0 -81
  300. package/lib/chunk-4UHL4WVN.mjs +0 -136
  301. package/lib/chunk-6HHJRKFB.mjs +0 -59
  302. package/lib/chunk-6S4NXESK.mjs +0 -26
  303. package/lib/chunk-7XTEJHOE.mjs +0 -193
  304. package/lib/chunk-AJDD5DZM.mjs +0 -109
  305. package/lib/chunk-FCDQGYBF.mjs +0 -136
  306. package/lib/chunk-GEYA2USY.mjs +0 -207
  307. package/lib/chunk-GJTGHXRA.mjs +0 -356
  308. package/lib/chunk-ID2WBTE2.mjs +0 -80
  309. package/lib/chunk-JXFOHKDM.mjs +0 -239
  310. package/lib/chunk-NCXAP7AA.mjs +0 -31
  311. package/lib/chunk-PDSXF5HY.mjs +0 -187
  312. package/lib/chunk-TOIVAQF7.mjs +0 -136
  313. package/lib/chunk-V5SKYJUB.mjs +0 -136
  314. package/lib/chunk-WSRETQCA.mjs +0 -59
  315. package/lib/chunk-YYLIQQKF.mjs +0 -31
  316. package/lib/del-ps.js +0 -32
  317. package/lib/del-ps.mjs +0 -43
  318. package/lib/ps/index.d.cjs +0 -17
  319. package/lib/ps/index.d.ts +0 -2
  320. package/lib/ps/index.js +0 -254
  321. package/lib/ps/isWin.d.ts +0 -2
  322. package/lib/ps/isWin.js +0 -4
  323. package/lib/utils/findEnvFiles.d.ts +0 -8
  324. package/lib/utils/findEnvFiles.js +0 -121
  325. package/test/package.json +0 -20
  326. package/test-project/package.json +0 -16
  327. package/tmp/test-repo/package.json +0 -7
  328. package/tmp/typedoc/readme.md +0 -320
  329. /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
  330. /package/lib/{del-ps.d.ts → clean-github-actions-caches-cli.d.cts} +0 -0
@@ -42,11 +42,11 @@ var init_cjs_shims = __esm({
42
42
  var require_utils = __commonJS({
43
43
  "src/utils/index.cjs"(exports2, module2) {
44
44
  init_cjs_shims();
45
- var fs3 = require("fs");
46
- var path3 = require("upath");
47
- var argv = require("minimist")(process.argv.slice(2));
45
+ var fs2 = require("fs");
46
+ var path2 = require("upath");
47
+ var minimistLib = require("minimist");
48
+ var argv = minimistLib(process.argv.slice(2));
48
49
  var { exec } = require("child_process");
49
- var { URL: URL2 } = require("url");
50
50
  var { promisify } = require("util");
51
51
  var execAsync = promisify(exec);
52
52
  async function parseGitRemotes() {
@@ -59,7 +59,7 @@ var require_utils = __commonJS({
59
59
  if (name && url) {
60
60
  const [repoUrl] = url.split(" ");
61
61
  try {
62
- const parsedUrl = new URL2(repoUrl);
62
+ const parsedUrl = new URL(repoUrl);
63
63
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
64
64
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
65
65
  let repoPath = pathParts.join("/");
@@ -80,25 +80,20 @@ var require_utils = __commonJS({
80
80
  }
81
81
  }
82
82
  module2.exports.parseGitRemotes = parseGitRemotes;
83
- function joinPathPreserveDriveLetter(...segments) {
84
- let fullPath = require("path").join(...segments);
85
- if (/^[a-z]:\\/.test(fullPath)) {
86
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
83
+ function getArgs2(opts) {
84
+ if (opts) {
85
+ return minimistLib(process.argv.slice(2), opts);
87
86
  }
88
- return fullPath;
89
- }
90
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
91
- function getArgs2() {
92
87
  return argv;
93
88
  }
94
89
  module2.exports.getArgs = getArgs2;
95
90
  function del(fullPath) {
96
91
  try {
97
- if (!fs3.existsSync(fullPath)) return;
98
- const stat = fs3.lstatSync(fullPath);
92
+ if (!fs2.existsSync(fullPath)) return;
93
+ const stat = fs2.lstatSync(fullPath);
99
94
  if (stat.isSymbolicLink()) {
100
95
  try {
101
- fs3.unlinkSync(fullPath);
96
+ fs2.unlinkSync(fullPath);
102
97
  console.log("deleted symlink", fullPath);
103
98
  } catch (e) {
104
99
  console.log("failed delete symlink", fullPath, e && e.message);
@@ -106,16 +101,16 @@ var require_utils = __commonJS({
106
101
  return;
107
102
  }
108
103
  if (stat.isDirectory()) {
109
- const subdir = fs3.readdirSync(fullPath).map((dirPath) => path3.resolve(fullPath, dirPath));
104
+ const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
110
105
  for (let i = 0; i < subdir.length; i++) {
111
106
  del(subdir[i]);
112
107
  }
113
108
  try {
114
- fs3.rmdirSync(fullPath);
109
+ fs2.rmdirSync(fullPath);
115
110
  console.log("deleted", fullPath);
116
- } catch (e) {
111
+ } catch (_e) {
117
112
  try {
118
- fs3.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
113
+ fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
119
114
  console.log("deleted", fullPath);
120
115
  } catch (ee) {
121
116
  console.log("failed delete", fullPath, ee && ee.message);
@@ -124,11 +119,11 @@ var require_utils = __commonJS({
124
119
  return;
125
120
  }
126
121
  try {
127
- fs3.unlinkSync(fullPath);
122
+ fs2.unlinkSync(fullPath);
128
123
  console.log("deleted", fullPath);
129
- } catch (e) {
124
+ } catch (_e) {
130
125
  try {
131
- fs3.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
126
+ fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
132
127
  console.log("deleted", fullPath);
133
128
  } catch (ee) {
134
129
  console.log("failed delete", fullPath, ee && ee.message);
@@ -141,13 +136,13 @@ var require_utils = __commonJS({
141
136
  module2.exports.del = del;
142
137
  function delStream(globStream) {
143
138
  globStream.stream().on("data", (result) => {
144
- const fullPath = path3.resolve(process.cwd(), result);
139
+ const fullPath = path2.resolve(process.cwd(), result);
145
140
  try {
146
- if (fs3.existsSync(fullPath)) {
147
- const stat = fs3.lstatSync(fullPath);
141
+ if (fs2.existsSync(fullPath)) {
142
+ const stat = fs2.lstatSync(fullPath);
148
143
  if (stat.isSymbolicLink()) {
149
144
  try {
150
- fs3.unlinkSync(fullPath);
145
+ fs2.unlinkSync(fullPath);
151
146
  console.log("deleted symlink", fullPath);
152
147
  } catch (e) {
153
148
  console.log("failed delete symlink", fullPath, e && e.message);
@@ -155,7 +150,7 @@ var require_utils = __commonJS({
155
150
  return;
156
151
  }
157
152
  if (stat.isDirectory()) {
158
- const subdir = fs3.readdirSync(fullPath).map((dirPath) => path3.resolve(fullPath, dirPath));
153
+ const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
159
154
  for (let i = 0; i < subdir.length; i++) {
160
155
  del(subdir[i]);
161
156
  }
@@ -210,6 +205,131 @@ var require_utils = __commonJS({
210
205
  }
211
206
  });
212
207
 
208
+ // src/utils/fetchResponse.cjs
209
+ var require_fetchResponse = __commonJS({
210
+ "src/utils/fetchResponse.cjs"(exports2, module2) {
211
+ init_cjs_shims();
212
+ var axios = require("axios");
213
+ async function fetchResponse2(url, options = {}) {
214
+ var _a, _b, _c;
215
+ const response = await axios.get(url, {
216
+ maxRedirects: 5,
217
+ responseType: "arraybuffer",
218
+ validateStatus: () => true,
219
+ ...options
220
+ });
221
+ const finalUrl = ((_b = (_a = response.request) == null ? void 0 : _a.res) == null ? void 0 : _b.responseUrl) ?? ((_c = response.request) == null ? void 0 : _c.responseURL) ?? url;
222
+ return {
223
+ finalUrl,
224
+ status: response.status,
225
+ statusText: response.statusText,
226
+ contentType: response.headers["content-type"],
227
+ contentLength: response.headers["content-length"],
228
+ dataLength: Buffer.isBuffer(response.data) ? response.data.length : void 0,
229
+ data: response.data
230
+ };
231
+ }
232
+ module2.exports = fetchResponse2;
233
+ module2.exports.fetchResponse = fetchResponse2;
234
+ module2.exports.default = fetchResponse2;
235
+ }
236
+ });
237
+
238
+ // src/utils/findEnvFiles.cjs
239
+ var require_findEnvFiles = __commonJS({
240
+ "src/utils/findEnvFiles.cjs"(exports2, module2) {
241
+ init_cjs_shims();
242
+ var fs2 = require("fs");
243
+ var path2 = require("path");
244
+ var glob = require("glob");
245
+ var DEFAULT_IGNORES = [
246
+ "**/node_modules/**",
247
+ "**/.git/**",
248
+ "**/.yarn/**",
249
+ "**/.pnpm/**",
250
+ "**/dist/**",
251
+ "**/build/**",
252
+ "**/coverage/**",
253
+ "**/vendor/**",
254
+ "**/tmp/**",
255
+ "**/.cache/**",
256
+ "**/assets/**",
257
+ "**/logs/**",
258
+ "**/output/**",
259
+ "**/public/**",
260
+ "**/static/**",
261
+ "**/temp/**",
262
+ "**/backup/**",
263
+ "**/backups/**",
264
+ "**/examples/**",
265
+ "**/docs/**",
266
+ "**/tests/**",
267
+ "**/__tests__/**",
268
+ "**/spec/**",
269
+ "**/__specs__/**",
270
+ "**/scripts/**",
271
+ "**/bin/**",
272
+ "**/hooks/**",
273
+ "**/config/**",
274
+ "**/configs/**",
275
+ "**/settings/**",
276
+ "**/.vscode/**",
277
+ "**/.idea/**"
278
+ ];
279
+ function findEnvFiles2(startDir = process.cwd(), filter) {
280
+ const found = /* @__PURE__ */ new Set();
281
+ function addFile(file) {
282
+ const normalized = path2.normalize(file);
283
+ if (typeof filter === "function" && !filter(normalized)) {
284
+ return;
285
+ }
286
+ found.add(normalized);
287
+ }
288
+ let current = path2.resolve(startDir);
289
+ while (true) {
290
+ const envPath2 = path2.join(current, ".env");
291
+ if (fs2.existsSync(envPath2)) {
292
+ addFile(envPath2);
293
+ }
294
+ const parent = path2.dirname(current);
295
+ if (parent === current) {
296
+ break;
297
+ }
298
+ current = parent;
299
+ }
300
+ const files = glob.globSync("**/.env*", {
301
+ cwd: startDir,
302
+ absolute: true,
303
+ nodir: true,
304
+ ignore: DEFAULT_IGNORES
305
+ });
306
+ for (const file of files) {
307
+ addFile(file);
308
+ }
309
+ return [...found];
310
+ }
311
+ function findEnvWithToken(startDir = process.cwd(), tokenName = "GITHUB_TOKEN") {
312
+ const envFiles = findEnvFiles2(startDir);
313
+ return envFiles.find((file) => {
314
+ try {
315
+ const content = fs2.readFileSync(file, "utf-8");
316
+ const regex = new RegExp(`^\\s*${tokenName}\\s*=`, "m");
317
+ return regex.test(content);
318
+ } catch (err) {
319
+ console.warn(`Failed to read ${file}: ${err instanceof Error ? err.message : String(err)}`);
320
+ return false;
321
+ }
322
+ });
323
+ }
324
+ module2.exports = {
325
+ DEFAULT_IGNORES,
326
+ findEnvFiles: findEnvFiles2,
327
+ findEnvWithToken,
328
+ default: findEnvFiles2
329
+ };
330
+ }
331
+ });
332
+
213
333
  // src/package-resolutions-updater.mjs
214
334
  var package_resolutions_updater_exports = {};
215
335
  __export(package_resolutions_updater_exports, {
@@ -217,96 +337,24 @@ __export(package_resolutions_updater_exports, {
217
337
  getLatestCommit: () => getLatestCommit,
218
338
  getLatestCommitAcrossBranches: () => getLatestCommitAcrossBranches,
219
339
  parseGitHubUrl: () => import_git_command_helper.parseGitHubUrl,
220
- replaceRawWithLatestHash: () => replaceRawWithLatestHash
340
+ replaceRawWithLatestHash: () => replaceRawWithLatestHash,
341
+ resolvePackageResolutionUpdates: () => resolvePackageResolutionUpdates
221
342
  });
222
343
  module.exports = __toCommonJS(package_resolutions_updater_exports);
223
344
  init_cjs_shims();
224
345
  var dotenv = __toESM(require("dotenv"), 1);
225
346
  var import_fs = __toESM(require("fs"), 1);
226
- var import_https = __toESM(require("https"), 1);
227
347
  var import_os = __toESM(require("os"), 1);
228
- var import_path = __toESM(require("path"), 1);
348
+ var import_upath = __toESM(require("upath"), 1);
229
349
  var utils = __toESM(require_utils(), 1);
230
-
231
- // src/utils/findEnvFiles.js
232
- init_cjs_shims();
233
- var import_node_fs = __toESM(require("fs"), 1);
234
- var import_node_path = __toESM(require("path"), 1);
235
- var glob = __toESM(require("glob"), 1);
236
- var DEFAULT_IGNORES = [
237
- "**/node_modules/**",
238
- "**/.git/**",
239
- "**/.yarn/**",
240
- "**/.pnpm/**",
241
- "**/dist/**",
242
- "**/build/**",
243
- "**/coverage/**",
244
- "**/vendor/**",
245
- "**/tmp/**",
246
- "**/.cache/**",
247
- "**/assets/**",
248
- "**/logs/**",
249
- "**/output/**",
250
- "**/public/**",
251
- "**/static/**",
252
- "**/temp/**",
253
- "**/backup/**",
254
- "**/backups/**",
255
- "**/examples/**",
256
- "**/docs/**",
257
- "**/tests/**",
258
- "**/__tests__/**",
259
- "**/spec/**",
260
- "**/__specs__/**",
261
- "**/scripts/**",
262
- "**/bin/**",
263
- "**/hooks/**",
264
- "**/config/**",
265
- "**/configs/**",
266
- "**/settings/**",
267
- "**/.vscode/**",
268
- "**/.idea/**"
269
- ];
270
- function findEnvFiles(startDir = process.cwd(), filter) {
271
- const found = /* @__PURE__ */ new Set();
272
- function addFile(file) {
273
- const normalized = import_node_path.default.normalize(file);
274
- if (typeof filter === "function" && !filter(normalized)) {
275
- return;
276
- }
277
- found.add(normalized);
278
- }
279
- let current = import_node_path.default.resolve(startDir);
280
- while (true) {
281
- const envPath2 = import_node_path.default.join(current, ".env");
282
- if (import_node_fs.default.existsSync(envPath2)) {
283
- addFile(envPath2);
284
- }
285
- const parent = import_node_path.default.dirname(current);
286
- if (parent === current) {
287
- break;
288
- }
289
- current = parent;
290
- }
291
- const files = glob.globSync("**/.env*", {
292
- cwd: startDir,
293
- absolute: true,
294
- nodir: true,
295
- ignore: DEFAULT_IGNORES
296
- });
297
- for (const file of files) {
298
- addFile(file);
299
- }
300
- return [...found];
301
- }
302
-
303
- // src/package-resolutions-updater.mjs
350
+ var import_fetchResponse = __toESM(require_fetchResponse(), 1);
351
+ var import_findEnvFiles = __toESM(require_findEnvFiles(), 1);
304
352
  var import_git_command_helper = require("git-command-helper");
305
353
  var projectDir = process.cwd();
306
- var envPath = import_path.default.join(projectDir, ".env");
354
+ var envPath = import_upath.default.join(projectDir, ".env");
307
355
  var args = utils.getArgs();
308
356
  if (!import_fs.default.existsSync(envPath)) {
309
- const envFiles = findEnvFiles(projectDir, (file) => {
357
+ const envFiles = (0, import_findEnvFiles.findEnvFiles)(projectDir, (file) => {
310
358
  const content = import_fs.default.readFileSync(file, "utf-8");
311
359
  return /GITHUB_TOKEN|ACCESS_TOKEN/.test(content);
312
360
  });
@@ -317,7 +365,7 @@ if (!import_fs.default.existsSync(envPath)) {
317
365
  if (import_fs.default.existsSync(envPath)) {
318
366
  dotenv.config({ path: envPath, quiet: true, override: true });
319
367
  }
320
- var ACCESS_TOKEN = process.env.GITHUB_TOKEN || process.env.ACCESS_TOKEN;
368
+ var ACCESS_TOKEN = process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN;
321
369
  if (args.help || args.h) {
322
370
  showHelp();
323
371
  }
@@ -357,8 +405,8 @@ var GITHUB_USER_AGENTS = [
357
405
  "PostmanRuntime/7.32.3",
358
406
  "binary-collections-resolver/1.0 (+https://github.com/dimaslanjaka/bin)"
359
407
  ];
360
- var userAgentDir = import_path.default.join(import_os.default.tmpdir(), "nodejs");
361
- var userAgentFile = import_path.default.join(userAgentDir, "useragent.txt");
408
+ var userAgentDir = import_upath.default.join(import_os.default.tmpdir(), "nodejs");
409
+ var userAgentFile = import_upath.default.join(userAgentDir, "useragent.txt");
362
410
  var selectedUserAgent;
363
411
  try {
364
412
  if (!import_fs.default.existsSync(userAgentDir)) import_fs.default.mkdirSync(userAgentDir, { recursive: true });
@@ -375,33 +423,23 @@ try {
375
423
  } catch (_e) {
376
424
  selectedUserAgent = GITHUB_USER_AGENTS[Math.floor(Math.random() * GITHUB_USER_AGENTS.length)];
377
425
  }
378
- function fetchJson(url) {
379
- const headers = {
380
- "User-Agent": selectedUserAgent,
381
- Accept: "application/vnd.github.v3+json",
382
- "X-GitHub-Api-Version": "2022-11-28",
383
- ...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
384
- };
385
- return new Promise((resolve, reject) => {
386
- import_https.default.get(url, { headers }, (res) => {
387
- let data = "";
388
- res.on("data", (chunk) => data += chunk);
389
- res.on("end", () => {
390
- try {
391
- const json = JSON.parse(data);
392
- if (res.statusCode < 200 || res.statusCode >= 300) {
393
- return reject(
394
- new Error(`GitHub API Error ${res.statusCode}: ${json.message || "Unknown error"}
395
- URL: ${url}`)
396
- );
397
- }
398
- resolve(json);
399
- } catch {
400
- reject(new Error(`Invalid JSON from: ${url}`));
401
- }
402
- });
403
- }).on("error", reject);
426
+ async function fetchJson(url) {
427
+ var _a;
428
+ const response = await (0, import_fetchResponse.default)(url, {
429
+ headers: {
430
+ "User-Agent": selectedUserAgent,
431
+ Accept: "application/vnd.github.v3+json",
432
+ "X-GitHub-Api-Version": "2022-11-28",
433
+ ...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
434
+ },
435
+ responseType: "json"
404
436
  });
437
+ if (response.status < 200 || response.status >= 300) {
438
+ const message = ((_a = response.data) == null ? void 0 : _a.message) || "Unknown error";
439
+ throw new Error(`GitHub API Error ${response.status}: ${message}
440
+ URL: ${url}`);
441
+ }
442
+ return response.data;
405
443
  }
406
444
  async function getLatestCommit(owner, repo, branch = "main") {
407
445
  var _a, _b, _c, _d;
@@ -452,10 +490,74 @@ async function getLatestCommitAcrossBranches(owner, repo) {
452
490
  };
453
491
  }
454
492
  function replaceRawWithLatestHash(url, latestHash) {
455
- const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/raw\/([^/]+)\/(.+)$/);
456
- if (!match) throw new Error("Invalid GitHub raw URL");
457
- const [, owner, repo, _oldHash, path3] = match;
458
- return `https://github.com/${owner}/${repo}/raw/${latestHash}/${path3}`;
493
+ const parsed = (0, import_git_command_helper.parseGitHubUrl)(url);
494
+ if (!parsed || !parsed.owner || !parsed.repo || !parsed.branch) {
495
+ throw new Error("Invalid GitHub raw URL");
496
+ }
497
+ const branchPrefix = `${parsed.branch}/`;
498
+ const rawPrefix = parsed.host === "github.com" ? `raw/${branchPrefix}` : branchPrefix;
499
+ const refsPrefix = `refs/heads/${branchPrefix}`;
500
+ const path2 = parsed.path.startsWith(rawPrefix) ? parsed.path.slice(rawPrefix.length) : parsed.path.startsWith(refsPrefix) ? parsed.path.slice(refsPrefix.length) : parsed.path.startsWith(branchPrefix) ? parsed.path.slice(branchPrefix.length) : parsed.path;
501
+ if (parsed.host === "github.com") {
502
+ return `https://github.com/${parsed.owner}/${parsed.repo}/raw/${latestHash}/${path2}`;
503
+ }
504
+ if (parsed.host === "raw.githubusercontent.com") {
505
+ return `https://raw.githubusercontent.com/${parsed.owner}/${parsed.repo}/${latestHash}/${path2}`;
506
+ }
507
+ throw new Error("Invalid GitHub raw URL");
508
+ }
509
+ async function resolvePackageResolutionUpdates(resolutions, specialPackageOverrides = []) {
510
+ const updates = [];
511
+ for (const [currentPkgName, url] of Object.entries(resolutions || {})) {
512
+ let repo;
513
+ try {
514
+ repo = (0, import_git_command_helper.parseGitHubUrl)(url);
515
+ } catch (error) {
516
+ updates.push({
517
+ skipped: true,
518
+ currentPkgName,
519
+ url,
520
+ error
521
+ });
522
+ continue;
523
+ }
524
+ try {
525
+ const override = specialPackageOverrides.find((p) => p.pkg === currentPkgName);
526
+ const latest = override ? await getLatestCommit(override.owner, override.repo, override.branch) : await getLatestCommitAcrossBranches(repo.owner, repo.repo);
527
+ const new_url = replaceRawWithLatestHash(url, latest.sha);
528
+ const response = await (0, import_fetchResponse.default)(new_url);
529
+ if (response.status < 200 || response.status >= 300) {
530
+ updates.push({
531
+ failed: true,
532
+ currentPkgName,
533
+ url,
534
+ new_url,
535
+ repo,
536
+ latest,
537
+ error: new Error(`New URL not accessible (status ${response.status}).
538
+ original: ${url}
539
+ new: ${new_url}`)
540
+ });
541
+ continue;
542
+ }
543
+ updates.push({
544
+ currentPkgName,
545
+ url,
546
+ new_url,
547
+ repo,
548
+ latest
549
+ });
550
+ } catch (error) {
551
+ updates.push({
552
+ failed: true,
553
+ currentPkgName,
554
+ url,
555
+ repo,
556
+ error
557
+ });
558
+ }
559
+ }
560
+ return updates;
459
561
  }
460
562
  // Annotate the CommonJS export names for ESM import in node:
461
563
  0 && (module.exports = {
@@ -463,5 +565,6 @@ function replaceRawWithLatestHash(url, latestHash) {
463
565
  getLatestCommit,
464
566
  getLatestCommitAcrossBranches,
465
567
  parseGitHubUrl,
466
- replaceRawWithLatestHash
568
+ replaceRawWithLatestHash,
569
+ resolvePackageResolutionUpdates
467
570
  });
@@ -28,5 +28,58 @@ export function getLatestCommitAcrossBranches(owner: any, repo: any): Promise<{
28
28
  * Replace the branch or commit in a GitHub raw URL with the latest hash.
29
29
  */
30
30
  export function replaceRawWithLatestHash(url: any, latestHash: any): string;
31
+ /**
32
+ * Resolve all package resolution updates.
33
+ * Pure logic function for Jest testing.
34
+ */
35
+ export function resolvePackageResolutionUpdates(resolutions: any, specialPackageOverrides?: any[]): Promise<({
36
+ skipped: boolean;
37
+ currentPkgName: string;
38
+ url: any;
39
+ error: unknown;
40
+ failed?: undefined;
41
+ new_url?: undefined;
42
+ repo?: undefined;
43
+ latest?: undefined;
44
+ } | {
45
+ failed: boolean;
46
+ currentPkgName: string;
47
+ url: any;
48
+ new_url: string;
49
+ repo: import("git-command-helper").ParsedGitHubUrl;
50
+ latest: {
51
+ owner: any;
52
+ repo: any;
53
+ branch: any;
54
+ sha: any;
55
+ date: any;
56
+ };
57
+ error: Error;
58
+ skipped?: undefined;
59
+ } | {
60
+ currentPkgName: string;
61
+ url: any;
62
+ new_url: string;
63
+ repo: import("git-command-helper").ParsedGitHubUrl;
64
+ latest: {
65
+ owner: any;
66
+ repo: any;
67
+ branch: any;
68
+ sha: any;
69
+ date: any;
70
+ };
71
+ skipped?: undefined;
72
+ error?: undefined;
73
+ failed?: undefined;
74
+ } | {
75
+ failed: boolean;
76
+ currentPkgName: string;
77
+ url: any;
78
+ repo: import("git-command-helper").ParsedGitHubUrl;
79
+ error: unknown;
80
+ skipped?: undefined;
81
+ new_url?: undefined;
82
+ latest?: undefined;
83
+ })[]>;
31
84
  export { parseGitHubUrl };
32
- import { parseGitHubUrl } from "git-command-helper";
85
+ import { parseGitHubUrl } from 'git-command-helper';
@@ -4,15 +4,18 @@ import {
4
4
  getLatestCommit,
5
5
  getLatestCommitAcrossBranches,
6
6
  parseGitHubUrl,
7
- replaceRawWithLatestHash
8
- } from "./chunk-XA3SNBPA.mjs";
9
- import "./chunk-ID2WBTE2.mjs";
10
- import "./chunk-Z6JLYU2J.mjs";
7
+ replaceRawWithLatestHash,
8
+ resolvePackageResolutionUpdates
9
+ } from "./chunk-TBWXE7ST.mjs";
10
+ import "./chunk-KLKAIFKI.mjs";
11
+ import "./chunk-H44UWUFY.mjs";
12
+ import "./chunk-6RK5UCTP.mjs";
11
13
  import "./chunk-QQ4A6DLD.mjs";
12
14
  export {
13
15
  fetchJson,
14
16
  getLatestCommit,
15
17
  getLatestCommitAcrossBranches,
16
18
  parseGitHubUrl,
17
- replaceRawWithLatestHash
19
+ replaceRawWithLatestHash,
20
+ resolvePackageResolutionUpdates
18
21
  };
@@ -4,7 +4,7 @@ var { exec } = require("child_process");
4
4
  var { spawn, spawnSync } = require("child_process");
5
5
  var util = require("util");
6
6
  var fs = require("fs");
7
- var path = require("path");
7
+ var path = require("upath");
8
8
  var execP = util.promisify(exec);
9
9
  function log(...args) {
10
10
  console.log("[php-cs-fixer-staged]", ...args);
@@ -13,7 +13,7 @@ var require_php_cs_fixer_staged = __commonJS({
13
13
  var { spawn, spawnSync } = __require("child_process");
14
14
  var util = __require("util");
15
15
  var fs = __require("fs");
16
- var path = __require("path");
16
+ var path = __require("upath");
17
17
  var execP = util.promisify(exec);
18
18
  function log(...args) {
19
19
  console.log("[php-cs-fixer-staged]", ...args);