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
@@ -38,11 +38,11 @@ var init_cjs_shims = __esm({
38
38
  var require_utils = __commonJS({
39
39
  "src/utils/index.cjs"(exports2, module2) {
40
40
  init_cjs_shims();
41
- var fs4 = require("fs");
42
- var path4 = require("upath");
43
- var argv = require("minimist")(process.argv.slice(2));
41
+ var fs3 = require("fs");
42
+ var path3 = require("upath");
43
+ var minimistLib = require("minimist");
44
+ var argv = minimistLib(process.argv.slice(2));
44
45
  var { exec } = require("child_process");
45
- var { URL: URL2 } = require("url");
46
46
  var { promisify } = require("util");
47
47
  var execAsync = promisify(exec);
48
48
  async function parseGitRemotes() {
@@ -55,7 +55,7 @@ var require_utils = __commonJS({
55
55
  if (name && url) {
56
56
  const [repoUrl] = url.split(" ");
57
57
  try {
58
- const parsedUrl = new URL2(repoUrl);
58
+ const parsedUrl = new URL(repoUrl);
59
59
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
60
60
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
61
61
  let repoPath = pathParts.join("/");
@@ -76,25 +76,20 @@ var require_utils = __commonJS({
76
76
  }
77
77
  }
78
78
  module2.exports.parseGitRemotes = parseGitRemotes;
79
- function joinPathPreserveDriveLetter(...segments) {
80
- let fullPath = require("path").join(...segments);
81
- if (/^[a-z]:\\/.test(fullPath)) {
82
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
79
+ function getArgs2(opts) {
80
+ if (opts) {
81
+ return minimistLib(process.argv.slice(2), opts);
83
82
  }
84
- return fullPath;
85
- }
86
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
87
- function getArgs2() {
88
83
  return argv;
89
84
  }
90
85
  module2.exports.getArgs = getArgs2;
91
86
  function del(fullPath) {
92
87
  try {
93
- if (!fs4.existsSync(fullPath)) return;
94
- const stat = fs4.lstatSync(fullPath);
88
+ if (!fs3.existsSync(fullPath)) return;
89
+ const stat = fs3.lstatSync(fullPath);
95
90
  if (stat.isSymbolicLink()) {
96
91
  try {
97
- fs4.unlinkSync(fullPath);
92
+ fs3.unlinkSync(fullPath);
98
93
  console.log("deleted symlink", fullPath);
99
94
  } catch (e) {
100
95
  console.log("failed delete symlink", fullPath, e && e.message);
@@ -102,16 +97,16 @@ var require_utils = __commonJS({
102
97
  return;
103
98
  }
104
99
  if (stat.isDirectory()) {
105
- const subdir = fs4.readdirSync(fullPath).map((dirPath) => path4.resolve(fullPath, dirPath));
100
+ const subdir = fs3.readdirSync(fullPath).map((dirPath) => path3.resolve(fullPath, dirPath));
106
101
  for (let i = 0; i < subdir.length; i++) {
107
102
  del(subdir[i]);
108
103
  }
109
104
  try {
110
- fs4.rmdirSync(fullPath);
105
+ fs3.rmdirSync(fullPath);
111
106
  console.log("deleted", fullPath);
112
- } catch (e) {
107
+ } catch (_e) {
113
108
  try {
114
- fs4.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
109
+ fs3.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
115
110
  console.log("deleted", fullPath);
116
111
  } catch (ee) {
117
112
  console.log("failed delete", fullPath, ee && ee.message);
@@ -120,11 +115,11 @@ var require_utils = __commonJS({
120
115
  return;
121
116
  }
122
117
  try {
123
- fs4.unlinkSync(fullPath);
118
+ fs3.unlinkSync(fullPath);
124
119
  console.log("deleted", fullPath);
125
- } catch (e) {
120
+ } catch (_e) {
126
121
  try {
127
- fs4.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
122
+ fs3.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
128
123
  console.log("deleted", fullPath);
129
124
  } catch (ee) {
130
125
  console.log("failed delete", fullPath, ee && ee.message);
@@ -137,13 +132,13 @@ var require_utils = __commonJS({
137
132
  module2.exports.del = del;
138
133
  function delStream(globStream) {
139
134
  globStream.stream().on("data", (result) => {
140
- const fullPath = path4.resolve(process.cwd(), result);
135
+ const fullPath = path3.resolve(process.cwd(), result);
141
136
  try {
142
- if (fs4.existsSync(fullPath)) {
143
- const stat = fs4.lstatSync(fullPath);
137
+ if (fs3.existsSync(fullPath)) {
138
+ const stat = fs3.lstatSync(fullPath);
144
139
  if (stat.isSymbolicLink()) {
145
140
  try {
146
- fs4.unlinkSync(fullPath);
141
+ fs3.unlinkSync(fullPath);
147
142
  console.log("deleted symlink", fullPath);
148
143
  } catch (e) {
149
144
  console.log("failed delete symlink", fullPath, e && e.message);
@@ -151,7 +146,7 @@ var require_utils = __commonJS({
151
146
  return;
152
147
  }
153
148
  if (stat.isDirectory()) {
154
- const subdir = fs4.readdirSync(fullPath).map((dirPath) => path4.resolve(fullPath, dirPath));
149
+ const subdir = fs3.readdirSync(fullPath).map((dirPath) => path3.resolve(fullPath, dirPath));
155
150
  for (let i = 0; i < subdir.length; i++) {
156
151
  del(subdir[i]);
157
152
  }
@@ -206,100 +201,152 @@ var require_utils = __commonJS({
206
201
  }
207
202
  });
208
203
 
204
+ // src/utils/fetchResponse.cjs
205
+ var require_fetchResponse = __commonJS({
206
+ "src/utils/fetchResponse.cjs"(exports2, module2) {
207
+ init_cjs_shims();
208
+ var axios = require("axios");
209
+ async function fetchResponse2(url, options = {}) {
210
+ var _a, _b, _c;
211
+ const response = await axios.get(url, {
212
+ maxRedirects: 5,
213
+ responseType: "arraybuffer",
214
+ validateStatus: () => true,
215
+ ...options
216
+ });
217
+ 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;
218
+ return {
219
+ finalUrl,
220
+ status: response.status,
221
+ statusText: response.statusText,
222
+ contentType: response.headers["content-type"],
223
+ contentLength: response.headers["content-length"],
224
+ dataLength: Buffer.isBuffer(response.data) ? response.data.length : void 0,
225
+ data: response.data
226
+ };
227
+ }
228
+ module2.exports = fetchResponse2;
229
+ module2.exports.fetchResponse = fetchResponse2;
230
+ module2.exports.default = fetchResponse2;
231
+ }
232
+ });
233
+
234
+ // src/utils/findEnvFiles.cjs
235
+ var require_findEnvFiles = __commonJS({
236
+ "src/utils/findEnvFiles.cjs"(exports2, module2) {
237
+ init_cjs_shims();
238
+ var fs3 = require("fs");
239
+ var path3 = require("path");
240
+ var glob = require("glob");
241
+ var DEFAULT_IGNORES = [
242
+ "**/node_modules/**",
243
+ "**/.git/**",
244
+ "**/.yarn/**",
245
+ "**/.pnpm/**",
246
+ "**/dist/**",
247
+ "**/build/**",
248
+ "**/coverage/**",
249
+ "**/vendor/**",
250
+ "**/tmp/**",
251
+ "**/.cache/**",
252
+ "**/assets/**",
253
+ "**/logs/**",
254
+ "**/output/**",
255
+ "**/public/**",
256
+ "**/static/**",
257
+ "**/temp/**",
258
+ "**/backup/**",
259
+ "**/backups/**",
260
+ "**/examples/**",
261
+ "**/docs/**",
262
+ "**/tests/**",
263
+ "**/__tests__/**",
264
+ "**/spec/**",
265
+ "**/__specs__/**",
266
+ "**/scripts/**",
267
+ "**/bin/**",
268
+ "**/hooks/**",
269
+ "**/config/**",
270
+ "**/configs/**",
271
+ "**/settings/**",
272
+ "**/.vscode/**",
273
+ "**/.idea/**"
274
+ ];
275
+ function findEnvFiles2(startDir = process.cwd(), filter) {
276
+ const found = /* @__PURE__ */ new Set();
277
+ function addFile(file) {
278
+ const normalized = path3.normalize(file);
279
+ if (typeof filter === "function" && !filter(normalized)) {
280
+ return;
281
+ }
282
+ found.add(normalized);
283
+ }
284
+ let current = path3.resolve(startDir);
285
+ while (true) {
286
+ const envPath2 = path3.join(current, ".env");
287
+ if (fs3.existsSync(envPath2)) {
288
+ addFile(envPath2);
289
+ }
290
+ const parent = path3.dirname(current);
291
+ if (parent === current) {
292
+ break;
293
+ }
294
+ current = parent;
295
+ }
296
+ const files = glob.globSync("**/.env*", {
297
+ cwd: startDir,
298
+ absolute: true,
299
+ nodir: true,
300
+ ignore: DEFAULT_IGNORES
301
+ });
302
+ for (const file of files) {
303
+ addFile(file);
304
+ }
305
+ return [...found];
306
+ }
307
+ function findEnvWithToken(startDir = process.cwd(), tokenName = "GITHUB_TOKEN") {
308
+ const envFiles = findEnvFiles2(startDir);
309
+ return envFiles.find((file) => {
310
+ try {
311
+ const content = fs3.readFileSync(file, "utf-8");
312
+ const regex = new RegExp(`^\\s*${tokenName}\\s*=`, "m");
313
+ return regex.test(content);
314
+ } catch (err) {
315
+ console.warn(`Failed to read ${file}: ${err instanceof Error ? err.message : String(err)}`);
316
+ return false;
317
+ }
318
+ });
319
+ }
320
+ module2.exports = {
321
+ DEFAULT_IGNORES,
322
+ findEnvFiles: findEnvFiles2,
323
+ findEnvWithToken,
324
+ default: findEnvFiles2
325
+ };
326
+ }
327
+ });
328
+
209
329
  // src/package-resolutions-updater-cli.mjs
210
330
  init_cjs_shims();
211
331
  var import_ansi_colors = __toESM(require("ansi-colors"), 1);
212
332
  var import_fs2 = __toESM(require("fs"), 1);
213
- var import_path2 = __toESM(require("path"), 1);
333
+ var import_upath2 = __toESM(require("upath"), 1);
214
334
 
215
335
  // src/package-resolutions-updater.mjs
216
336
  init_cjs_shims();
217
337
  var dotenv = __toESM(require("dotenv"), 1);
218
338
  var import_fs = __toESM(require("fs"), 1);
219
- var import_https = __toESM(require("https"), 1);
220
339
  var import_os = __toESM(require("os"), 1);
221
- var import_path = __toESM(require("path"), 1);
340
+ var import_upath = __toESM(require("upath"), 1);
222
341
  var utils = __toESM(require_utils(), 1);
223
-
224
- // src/utils/findEnvFiles.js
225
- init_cjs_shims();
226
- var import_node_fs = __toESM(require("fs"), 1);
227
- var import_node_path = __toESM(require("path"), 1);
228
- var glob = __toESM(require("glob"), 1);
229
- var DEFAULT_IGNORES = [
230
- "**/node_modules/**",
231
- "**/.git/**",
232
- "**/.yarn/**",
233
- "**/.pnpm/**",
234
- "**/dist/**",
235
- "**/build/**",
236
- "**/coverage/**",
237
- "**/vendor/**",
238
- "**/tmp/**",
239
- "**/.cache/**",
240
- "**/assets/**",
241
- "**/logs/**",
242
- "**/output/**",
243
- "**/public/**",
244
- "**/static/**",
245
- "**/temp/**",
246
- "**/backup/**",
247
- "**/backups/**",
248
- "**/examples/**",
249
- "**/docs/**",
250
- "**/tests/**",
251
- "**/__tests__/**",
252
- "**/spec/**",
253
- "**/__specs__/**",
254
- "**/scripts/**",
255
- "**/bin/**",
256
- "**/hooks/**",
257
- "**/config/**",
258
- "**/configs/**",
259
- "**/settings/**",
260
- "**/.vscode/**",
261
- "**/.idea/**"
262
- ];
263
- function findEnvFiles(startDir = process.cwd(), filter) {
264
- const found = /* @__PURE__ */ new Set();
265
- function addFile(file) {
266
- const normalized = import_node_path.default.normalize(file);
267
- if (typeof filter === "function" && !filter(normalized)) {
268
- return;
269
- }
270
- found.add(normalized);
271
- }
272
- let current = import_node_path.default.resolve(startDir);
273
- while (true) {
274
- const envPath2 = import_node_path.default.join(current, ".env");
275
- if (import_node_fs.default.existsSync(envPath2)) {
276
- addFile(envPath2);
277
- }
278
- const parent = import_node_path.default.dirname(current);
279
- if (parent === current) {
280
- break;
281
- }
282
- current = parent;
283
- }
284
- const files = glob.globSync("**/.env*", {
285
- cwd: startDir,
286
- absolute: true,
287
- nodir: true,
288
- ignore: DEFAULT_IGNORES
289
- });
290
- for (const file of files) {
291
- addFile(file);
292
- }
293
- return [...found];
294
- }
295
-
296
- // src/package-resolutions-updater.mjs
342
+ var import_fetchResponse = __toESM(require_fetchResponse(), 1);
343
+ var import_findEnvFiles = __toESM(require_findEnvFiles(), 1);
297
344
  var import_git_command_helper = require("git-command-helper");
298
345
  var projectDir = process.cwd();
299
- var envPath = import_path.default.join(projectDir, ".env");
346
+ var envPath = import_upath.default.join(projectDir, ".env");
300
347
  var args = utils.getArgs();
301
348
  if (!import_fs.default.existsSync(envPath)) {
302
- const envFiles = findEnvFiles(projectDir, (file) => {
349
+ const envFiles = (0, import_findEnvFiles.findEnvFiles)(projectDir, (file) => {
303
350
  const content = import_fs.default.readFileSync(file, "utf-8");
304
351
  return /GITHUB_TOKEN|ACCESS_TOKEN/.test(content);
305
352
  });
@@ -310,7 +357,7 @@ if (!import_fs.default.existsSync(envPath)) {
310
357
  if (import_fs.default.existsSync(envPath)) {
311
358
  dotenv.config({ path: envPath, quiet: true, override: true });
312
359
  }
313
- var ACCESS_TOKEN = process.env.GITHUB_TOKEN || process.env.ACCESS_TOKEN;
360
+ var ACCESS_TOKEN = process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN;
314
361
  if (args.help || args.h) {
315
362
  showHelp();
316
363
  }
@@ -350,8 +397,8 @@ var GITHUB_USER_AGENTS = [
350
397
  "PostmanRuntime/7.32.3",
351
398
  "binary-collections-resolver/1.0 (+https://github.com/dimaslanjaka/bin)"
352
399
  ];
353
- var userAgentDir = import_path.default.join(import_os.default.tmpdir(), "nodejs");
354
- var userAgentFile = import_path.default.join(userAgentDir, "useragent.txt");
400
+ var userAgentDir = import_upath.default.join(import_os.default.tmpdir(), "nodejs");
401
+ var userAgentFile = import_upath.default.join(userAgentDir, "useragent.txt");
355
402
  var selectedUserAgent;
356
403
  try {
357
404
  if (!import_fs.default.existsSync(userAgentDir)) import_fs.default.mkdirSync(userAgentDir, { recursive: true });
@@ -368,33 +415,23 @@ try {
368
415
  } catch (_e) {
369
416
  selectedUserAgent = GITHUB_USER_AGENTS[Math.floor(Math.random() * GITHUB_USER_AGENTS.length)];
370
417
  }
371
- function fetchJson(url) {
372
- const headers = {
373
- "User-Agent": selectedUserAgent,
374
- Accept: "application/vnd.github.v3+json",
375
- "X-GitHub-Api-Version": "2022-11-28",
376
- ...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
377
- };
378
- return new Promise((resolve, reject) => {
379
- import_https.default.get(url, { headers }, (res) => {
380
- let data = "";
381
- res.on("data", (chunk) => data += chunk);
382
- res.on("end", () => {
383
- try {
384
- const json = JSON.parse(data);
385
- if (res.statusCode < 200 || res.statusCode >= 300) {
386
- return reject(
387
- new Error(`GitHub API Error ${res.statusCode}: ${json.message || "Unknown error"}
388
- URL: ${url}`)
389
- );
390
- }
391
- resolve(json);
392
- } catch {
393
- reject(new Error(`Invalid JSON from: ${url}`));
394
- }
395
- });
396
- }).on("error", reject);
418
+ async function fetchJson(url) {
419
+ var _a;
420
+ const response = await (0, import_fetchResponse.default)(url, {
421
+ headers: {
422
+ "User-Agent": selectedUserAgent,
423
+ Accept: "application/vnd.github.v3+json",
424
+ "X-GitHub-Api-Version": "2022-11-28",
425
+ ...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
426
+ },
427
+ responseType: "json"
397
428
  });
429
+ if (response.status < 200 || response.status >= 300) {
430
+ const message = ((_a = response.data) == null ? void 0 : _a.message) || "Unknown error";
431
+ throw new Error(`GitHub API Error ${response.status}: ${message}
432
+ URL: ${url}`);
433
+ }
434
+ return response.data;
398
435
  }
399
436
  async function getLatestCommit(owner, repo, branch = "main") {
400
437
  var _a, _b, _c, _d;
@@ -445,10 +482,74 @@ async function getLatestCommitAcrossBranches(owner, repo) {
445
482
  };
446
483
  }
447
484
  function replaceRawWithLatestHash(url, latestHash) {
448
- const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/raw\/([^/]+)\/(.+)$/);
449
- if (!match) throw new Error("Invalid GitHub raw URL");
450
- const [, owner, repo, _oldHash, path4] = match;
451
- return `https://github.com/${owner}/${repo}/raw/${latestHash}/${path4}`;
485
+ const parsed = (0, import_git_command_helper.parseGitHubUrl)(url);
486
+ if (!parsed || !parsed.owner || !parsed.repo || !parsed.branch) {
487
+ throw new Error("Invalid GitHub raw URL");
488
+ }
489
+ const branchPrefix = `${parsed.branch}/`;
490
+ const rawPrefix = parsed.host === "github.com" ? `raw/${branchPrefix}` : branchPrefix;
491
+ const refsPrefix = `refs/heads/${branchPrefix}`;
492
+ const path3 = 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;
493
+ if (parsed.host === "github.com") {
494
+ return `https://github.com/${parsed.owner}/${parsed.repo}/raw/${latestHash}/${path3}`;
495
+ }
496
+ if (parsed.host === "raw.githubusercontent.com") {
497
+ return `https://raw.githubusercontent.com/${parsed.owner}/${parsed.repo}/${latestHash}/${path3}`;
498
+ }
499
+ throw new Error("Invalid GitHub raw URL");
500
+ }
501
+ async function resolvePackageResolutionUpdates(resolutions, specialPackageOverrides = []) {
502
+ const updates = [];
503
+ for (const [currentPkgName, url] of Object.entries(resolutions || {})) {
504
+ let repo;
505
+ try {
506
+ repo = (0, import_git_command_helper.parseGitHubUrl)(url);
507
+ } catch (error) {
508
+ updates.push({
509
+ skipped: true,
510
+ currentPkgName,
511
+ url,
512
+ error
513
+ });
514
+ continue;
515
+ }
516
+ try {
517
+ const override = specialPackageOverrides.find((p) => p.pkg === currentPkgName);
518
+ const latest = override ? await getLatestCommit(override.owner, override.repo, override.branch) : await getLatestCommitAcrossBranches(repo.owner, repo.repo);
519
+ const new_url = replaceRawWithLatestHash(url, latest.sha);
520
+ const response = await (0, import_fetchResponse.default)(new_url);
521
+ if (response.status < 200 || response.status >= 300) {
522
+ updates.push({
523
+ failed: true,
524
+ currentPkgName,
525
+ url,
526
+ new_url,
527
+ repo,
528
+ latest,
529
+ error: new Error(`New URL not accessible (status ${response.status}).
530
+ original: ${url}
531
+ new: ${new_url}`)
532
+ });
533
+ continue;
534
+ }
535
+ updates.push({
536
+ currentPkgName,
537
+ url,
538
+ new_url,
539
+ repo,
540
+ latest
541
+ });
542
+ } catch (error) {
543
+ updates.push({
544
+ failed: true,
545
+ currentPkgName,
546
+ url,
547
+ repo,
548
+ error
549
+ });
550
+ }
551
+ }
552
+ return updates;
452
553
  }
453
554
 
454
555
  // src/package-resolutions-updater-cli.mjs
@@ -464,12 +565,6 @@ function replaceRawWithLatestHash(url, latestHash) {
464
565
  // Hexo family
465
566
  // { pkg: "hexo", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
466
567
  // { pkg: "hexo-util", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
467
- // { pkg: "warehouse", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
468
- // { pkg: "hexo-server", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
469
- // { pkg: "hexo-log", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
470
- // { pkg: "hexo-front-matter", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
471
- // { pkg: "hexo-cli", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
472
- // { pkg: "hexo-asset-link", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
473
568
  { pkg: "hexo-post-parser", branch: "pre-release", repo: "hexo-post-parser", owner: "dimaslanjaka" },
474
569
  { pkg: "hexo-seo", branch: "pre-release", repo: "hexo-seo", owner: "dimaslanjaka" },
475
570
  { pkg: "hexo-is", branch: "master", repo: "hexo-is", owner: "dimaslanjaka" },
@@ -490,7 +585,7 @@ function replaceRawWithLatestHash(url, latestHash) {
490
585
  // { pkg: "@types/hexo", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
491
586
  { pkg: "@types/git-command-helper", branch: "pre-release", repo: "git-command-helper", owner: "dimaslanjaka" }
492
587
  ];
493
- const pkgPath = import_path2.default.join(process.cwd(), "package.json");
588
+ const pkgPath = import_upath2.default.join(process.cwd(), "package.json");
494
589
  let pkg;
495
590
  try {
496
591
  pkg = JSON.parse(import_fs2.default.readFileSync(pkgPath, "utf-8"));
@@ -503,38 +598,25 @@ function replaceRawWithLatestHash(url, latestHash) {
503
598
  console.log(import_ansi_colors.default.yellow("No resolutions found in package.json"));
504
599
  return;
505
600
  }
506
- console.log(`Processing ${entries.length} resolution(s)...`);
507
- const updates = [];
508
- for (const [currentPkgName, url] of entries) {
509
- let repo;
510
- try {
511
- repo = (0, import_git_command_helper.parseGitHubUrl)(url);
512
- } catch (error) {
513
- console.log(`\u23ED\uFE0F Skipping ${import_ansi_colors.default.yellow(currentPkgName)}: ${error.message}`);
514
- continue;
601
+ console.log(`\u2699\uFE0F Processing ${entries.length} resolution(s)...`);
602
+ const updates = await resolvePackageResolutionUpdates(pkg.resolutions, specialPackageOverrides);
603
+ const validUpdates = updates.filter((u) => !u.skipped && !u.failed);
604
+ for (const update of updates) {
605
+ if (update.skipped) {
606
+ console.log(`\u23ED\uFE0F Skipping ${import_ansi_colors.default.yellow(update.currentPkgName)}: ${update.error.message}`);
515
607
  }
516
- try {
517
- const override = specialPackageOverrides.find((p) => p.pkg === currentPkgName);
518
- const latest = override ? await getLatestCommit(override.owner, override.repo, override.branch) : await getLatestCommitAcrossBranches(repo.owner, repo.repo);
519
- const new_url = replaceRawWithLatestHash(url, latest.sha);
520
- updates.push({
521
- currentPkgName,
522
- url,
523
- new_url,
524
- repo,
525
- latest
526
- });
527
- } catch (error) {
528
- console.log(`\u274C Failed to process ${import_ansi_colors.default.red(currentPkgName)}: ${error.message}`);
608
+ if (update.failed) {
609
+ console.log(`\u274C Failed to process ${import_ansi_colors.default.red(update.currentPkgName)}: ${update.error.message}`);
529
610
  }
530
611
  }
531
- if (updates.length === 0) {
612
+ console.log("");
613
+ if (validUpdates.length === 0) {
532
614
  console.log(import_ansi_colors.default.yellow("No GitHub URLs were processed"));
533
615
  return;
534
616
  }
535
- console.log(`\u{1F4DD} Applying updates to ${updates.length} GitHub URL(s)...`);
617
+ console.log(`\u{1F4DD} Applying updates to ${validUpdates.length} GitHub URL(s)...`);
536
618
  let changed = false;
537
- for (const { currentPkgName, url, new_url, repo, latest } of updates) {
619
+ for (const { currentPkgName, url, new_url, repo, latest } of validUpdates) {
538
620
  if (url !== new_url) {
539
621
  console.log(`${import_ansi_colors.default.cyan(currentPkgName)}:`);
540
622
  console.log(" from:", url.replace(repo.branch, import_ansi_colors.default.red(repo.branch)));
@@ -548,7 +630,7 @@ function replaceRawWithLatestHash(url, latestHash) {
548
630
  console.log("\n\u{1F4CC} Summary:");
549
631
  if (changed) {
550
632
  try {
551
- import_fs2.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "");
633
+ import_fs2.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
552
634
  console.log(`\u2705 package.json updated successfully`);
553
635
  } catch (e) {
554
636
  console.error(import_ansi_colors.default.red(`Failed to write package.json: ${e.message}`));
@@ -1,12 +1,10 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
- getLatestCommit,
4
- getLatestCommitAcrossBranches,
5
- parseGitHubUrl,
6
- replaceRawWithLatestHash
7
- } from "./chunk-XA3SNBPA.mjs";
8
- import "./chunk-ID2WBTE2.mjs";
9
- import "./chunk-Z6JLYU2J.mjs";
3
+ resolvePackageResolutionUpdates
4
+ } from "./chunk-TBWXE7ST.mjs";
5
+ import "./chunk-KLKAIFKI.mjs";
6
+ import "./chunk-H44UWUFY.mjs";
7
+ import "./chunk-6RK5UCTP.mjs";
10
8
  import {
11
9
  init_esm_shims
12
10
  } from "./chunk-QQ4A6DLD.mjs";
@@ -15,7 +13,7 @@ import {
15
13
  init_esm_shims();
16
14
  import ansiColors from "ansi-colors";
17
15
  import fs from "fs";
18
- import path from "path";
16
+ import path from "upath";
19
17
  (async () => {
20
18
  const specialPackageOverrides = [
21
19
  // SBG packages
@@ -28,12 +26,6 @@ import path from "path";
28
26
  // Hexo family
29
27
  // { pkg: "hexo", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
30
28
  // { pkg: "hexo-util", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
31
- // { pkg: "warehouse", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
32
- // { pkg: "hexo-server", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
33
- // { pkg: "hexo-log", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
34
- // { pkg: "hexo-front-matter", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
35
- // { pkg: "hexo-cli", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
36
- // { pkg: "hexo-asset-link", branch: "monorepo-v7", repo: "hexo", owner: "dimaslanjaka" },
37
29
  { pkg: "hexo-post-parser", branch: "pre-release", repo: "hexo-post-parser", owner: "dimaslanjaka" },
38
30
  { pkg: "hexo-seo", branch: "pre-release", repo: "hexo-seo", owner: "dimaslanjaka" },
39
31
  { pkg: "hexo-is", branch: "master", repo: "hexo-is", owner: "dimaslanjaka" },
@@ -67,38 +59,25 @@ import path from "path";
67
59
  console.log(ansiColors.yellow("No resolutions found in package.json"));
68
60
  return;
69
61
  }
70
- console.log(`Processing ${entries.length} resolution(s)...`);
71
- const updates = [];
72
- for (const [currentPkgName, url] of entries) {
73
- let repo;
74
- try {
75
- repo = parseGitHubUrl(url);
76
- } catch (error) {
77
- console.log(`\u23ED\uFE0F Skipping ${ansiColors.yellow(currentPkgName)}: ${error.message}`);
78
- continue;
62
+ console.log(`\u2699\uFE0F Processing ${entries.length} resolution(s)...`);
63
+ const updates = await resolvePackageResolutionUpdates(pkg.resolutions, specialPackageOverrides);
64
+ const validUpdates = updates.filter((u) => !u.skipped && !u.failed);
65
+ for (const update of updates) {
66
+ if (update.skipped) {
67
+ console.log(`\u23ED\uFE0F Skipping ${ansiColors.yellow(update.currentPkgName)}: ${update.error.message}`);
79
68
  }
80
- try {
81
- const override = specialPackageOverrides.find((p) => p.pkg === currentPkgName);
82
- const latest = override ? await getLatestCommit(override.owner, override.repo, override.branch) : await getLatestCommitAcrossBranches(repo.owner, repo.repo);
83
- const new_url = replaceRawWithLatestHash(url, latest.sha);
84
- updates.push({
85
- currentPkgName,
86
- url,
87
- new_url,
88
- repo,
89
- latest
90
- });
91
- } catch (error) {
92
- console.log(`\u274C Failed to process ${ansiColors.red(currentPkgName)}: ${error.message}`);
69
+ if (update.failed) {
70
+ console.log(`\u274C Failed to process ${ansiColors.red(update.currentPkgName)}: ${update.error.message}`);
93
71
  }
94
72
  }
95
- if (updates.length === 0) {
73
+ console.log("");
74
+ if (validUpdates.length === 0) {
96
75
  console.log(ansiColors.yellow("No GitHub URLs were processed"));
97
76
  return;
98
77
  }
99
- console.log(`\u{1F4DD} Applying updates to ${updates.length} GitHub URL(s)...`);
78
+ console.log(`\u{1F4DD} Applying updates to ${validUpdates.length} GitHub URL(s)...`);
100
79
  let changed = false;
101
- for (const { currentPkgName, url, new_url, repo, latest } of updates) {
80
+ for (const { currentPkgName, url, new_url, repo, latest } of validUpdates) {
102
81
  if (url !== new_url) {
103
82
  console.log(`${ansiColors.cyan(currentPkgName)}:`);
104
83
  console.log(" from:", url.replace(repo.branch, ansiColors.red(repo.branch)));
@@ -112,7 +91,7 @@ import path from "path";
112
91
  console.log("\n\u{1F4CC} Summary:");
113
92
  if (changed) {
114
93
  try {
115
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "");
94
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
116
95
  console.log(`\u2705 package.json updated successfully`);
117
96
  } catch (e) {
118
97
  console.error(ansiColors.red(`Failed to write package.json: ${e.message}`));