binary-collections 2.0.10 → 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 (290) hide show
  1. package/.opencode/package.json +5 -0
  2. package/.puppeterrc.cjs +25 -0
  3. package/binaries/binary-executor.cjs +138 -3
  4. package/binaries/clean-nodemodule.cjs +138 -3
  5. package/binaries/clean-nodemodules.cjs +138 -3
  6. package/binaries/dev.cjs +138 -3
  7. package/binaries/empty.cjs +138 -3
  8. package/binaries/git-reduce-size.cjs +138 -3
  9. package/binaries/javakill.cjs +138 -3
  10. package/binaries/kill-night-crows.bat +7 -0
  11. package/binaries/kill-night-crows.ps1 +172 -0
  12. package/binaries/kill-process.cjs +138 -3
  13. package/binaries/nodekill.cjs +138 -3
  14. package/binaries/prod.cjs +138 -3
  15. package/binaries/py +111 -0
  16. package/binaries/py.cjs +178 -0
  17. package/binaries/py.cmd +49 -0
  18. package/binaries/rmfind.cjs +138 -3
  19. package/binaries/rmx +15 -1
  20. package/binaries/rmx.cjs +138 -3
  21. package/binaries/rmx.cmd +12 -0
  22. package/binaries/submodule-token.cjs +138 -3
  23. package/binaries/test-cjs +18 -0
  24. package/binaries/test-cjs.cjs +178 -0
  25. package/binaries/test-cjs.cmd +26 -0
  26. package/binaries/test-esm +16 -0
  27. package/binaries/test-esm.cjs +178 -0
  28. package/binaries/test-esm.cmd +23 -0
  29. package/binaries/yarn-clean +32 -0
  30. package/binaries/yarn-clean.cjs +178 -0
  31. package/binaries/yarn-clean.cmd +30 -0
  32. package/binaries/yarn-clean.py +166 -0
  33. package/binaries/yc +110 -0
  34. package/binaries/yc.cjs +178 -0
  35. package/lib/binary-collections/config.cjs +126 -0
  36. package/lib/binary-collections/config.mjs +7 -0
  37. package/lib/binary-collections/executeScript.cjs +19 -0
  38. package/lib/binary-collections/executeScript.d.cts +12 -0
  39. package/lib/binary-collections/executeScript.mjs +6 -0
  40. package/lib/binary-collections/findScript.cjs +284 -0
  41. package/lib/binary-collections/findScript.d.cts +12 -0
  42. package/lib/binary-collections/findScript.mjs +7 -0
  43. package/lib/binary-collections/listScript.cjs +266 -0
  44. package/lib/binary-collections/listScript.d.cts +19 -0
  45. package/lib/binary-collections/listScript.mjs +7 -0
  46. package/lib/binary-collections.cjs +342 -194
  47. package/lib/binary-collections.mjs +22 -268
  48. package/lib/changelog.cjs +61 -13
  49. package/lib/changelog.mjs +1 -1
  50. package/lib/{chunk-E6FDDAOO.mjs → chunk-2LSRSEXF.mjs} +2 -2
  51. package/lib/chunk-34IQDTLZ.mjs +27 -0
  52. package/lib/chunk-3HFFECCI.mjs +27 -0
  53. package/lib/{chunk-V3N3JEUF.mjs → chunk-5RTXZVCW.mjs} +60 -13
  54. package/lib/chunk-66KDU4TX.mjs +268 -0
  55. package/lib/chunk-6PU7BAHB.mjs +61 -0
  56. package/lib/{chunk-6HHJRKFB.mjs → chunk-BZWVHODJ.mjs} +4 -1
  57. package/lib/chunk-C6D2TTYU.mjs +32 -0
  58. package/lib/chunk-FB2WKVJD.mjs +158 -0
  59. package/lib/{chunk-66PAU5PS.mjs → chunk-G5UUEWUO.mjs} +9 -5
  60. package/lib/{chunk-HO6GHCOB.mjs → chunk-GAGABICI.mjs} +198 -63
  61. package/lib/chunk-H44UWUFY.mjs +105 -0
  62. package/lib/chunk-NCZPTKDV.mjs +79 -0
  63. package/lib/chunk-NGFK3EYW.mjs +28 -0
  64. package/lib/chunk-NVEG3LEZ.mjs +143 -0
  65. package/lib/chunk-OGXVGBRI.mjs +29 -0
  66. package/lib/chunk-OXV52GD5.mjs +62 -0
  67. package/lib/{chunk-PDSXF5HY.mjs → chunk-PDN26I7O.mjs} +1 -0
  68. package/lib/chunk-PXBMHE7O.mjs +35 -0
  69. package/lib/chunk-R5FJOR63.mjs +47 -0
  70. package/lib/chunk-SPTECFE5.mjs +180 -0
  71. package/lib/chunk-UXCFNAR6.mjs +55 -0
  72. package/lib/chunk-V2IBPCEV.mjs +39 -0
  73. package/lib/chunk-XPJGCDOD.mjs +14 -0
  74. package/lib/{chunk-AI4CVPJ7.mjs → chunk-ZDMWBSYF.mjs} +4 -4
  75. package/lib/chunk-ZOWVMII3.mjs +228 -0
  76. package/lib/clean-github-actions-caches-cli.cjs +465 -0
  77. package/lib/clean-github-actions-caches-cli.d.cts +1 -0
  78. package/lib/clean-github-actions-caches-cli.mjs +56 -0
  79. package/lib/clean-github-actions-caches.cjs +152 -160
  80. package/lib/clean-github-actions-caches.d.cts +15 -1
  81. package/lib/clean-github-actions-caches.mjs +4 -130
  82. package/lib/cross-env/command.cjs +63 -0
  83. package/lib/cross-env/command.d.ts +8 -0
  84. package/lib/cross-env/command.js +45 -0
  85. package/lib/cross-env/command.mjs +9 -0
  86. package/lib/cross-env/index.cjs +178 -0
  87. package/lib/cross-env/index.d.ts +8 -0
  88. package/lib/cross-env/index.js +102 -0
  89. package/lib/cross-env/index.mjs +101 -0
  90. package/lib/cross-env/variable.cjs +60 -0
  91. package/lib/cross-env/variable.d.ts +7 -0
  92. package/lib/cross-env/variable.js +59 -0
  93. package/lib/cross-env/variable.mjs +9 -0
  94. package/lib/del-gradle.cjs +61 -13
  95. package/lib/del-gradle.js +9 -8
  96. package/lib/del-gradle.mjs +1 -1
  97. package/lib/del-node-modules.cjs +143 -148
  98. package/lib/del-node-modules.js +210 -14
  99. package/lib/del-node-modules.mjs +148 -17
  100. package/lib/del-ps.cjs +61 -13
  101. package/lib/del-ps.js +9 -8
  102. package/lib/del-ps.mjs +1 -1
  103. package/lib/del-yarn-caches.cjs +61 -13
  104. package/lib/del-yarn-caches.js +2 -2
  105. package/lib/del-yarn-caches.mjs +1 -1
  106. package/lib/file/copy-cli.cjs +92 -0
  107. package/lib/file/copy-cli.d.mts +1 -0
  108. package/lib/file/copy-cli.mjs +55 -0
  109. package/lib/file/copy.cjs +56 -0
  110. package/lib/file/copy.d.mts +1 -0
  111. package/lib/file/copy.mjs +8 -0
  112. package/lib/file/move-cli.cjs +91 -0
  113. package/lib/file/move-cli.d.mts +1 -0
  114. package/lib/file/move-cli.mjs +55 -0
  115. package/lib/file/move.cjs +55 -0
  116. package/lib/file/move.d.mts +1 -0
  117. package/lib/file/move.mjs +8 -0
  118. package/lib/find-node-modules-cli.js +2 -1
  119. package/lib/free-chatgpt.cjs +259 -47
  120. package/lib/free-chatgpt.js +10 -10
  121. package/lib/free-chatgpt.mjs +2 -2
  122. package/lib/git/gitattributes.cjs +1 -0
  123. package/lib/git/gitattributes.d.cts +7 -2
  124. package/lib/git/gitattributes.mjs +1 -1
  125. package/lib/git/line-endings.cjs +2 -1
  126. package/lib/git/line-endings.mjs +2 -2
  127. package/lib/git/undo-commit-cli.cjs +110 -0
  128. package/lib/git/undo-commit-cli.d.ts +1 -0
  129. package/lib/git/undo-commit-cli.js +4 -0
  130. package/lib/git/undo-commit-cli.mjs +14 -0
  131. package/lib/git/undo-commit.cjs +81 -0
  132. package/lib/git/undo-commit.d.cts +1 -0
  133. package/lib/git/undo-commit.mjs +7 -0
  134. package/lib/git/undo-staged-cli.cjs +110 -0
  135. package/lib/git/undo-staged-cli.d.ts +1 -0
  136. package/lib/git/undo-staged-cli.js +4 -0
  137. package/lib/git/undo-staged-cli.mjs +14 -0
  138. package/lib/git/undo-staged.cjs +81 -0
  139. package/lib/git/undo-staged.d.cts +1 -0
  140. package/lib/git/undo-staged.mjs +7 -0
  141. package/lib/git/user-config.cjs +61 -14
  142. package/lib/git/user-config.mjs +2 -2
  143. package/lib/git-diff-cli.cjs +427 -75
  144. package/lib/git-diff-cli.d.ts +1 -0
  145. package/lib/git-diff-cli.js +1 -0
  146. package/lib/git-diff-cli.mjs +6 -4
  147. package/lib/git-diff.cjs +426 -75
  148. package/lib/git-diff.d.ts +2 -1
  149. package/lib/git-diff.js +91 -34
  150. package/lib/git-diff.mjs +5 -4
  151. package/lib/git-fix.cjs +64 -16
  152. package/lib/git-fix.mjs +10 -10
  153. package/lib/git-purge.cjs +61 -13
  154. package/lib/git-purge.mjs +1 -1
  155. package/lib/index.d.ts +1 -1
  156. package/lib/kill-night-crows.cjs +87 -0
  157. package/lib/kill-night-crows.d.mts +1 -0
  158. package/lib/kill-night-crows.mjs +65 -0
  159. package/lib/node-cache-cleaner/npm.cjs +65 -0
  160. package/lib/node-cache-cleaner/npm.d.ts +2 -0
  161. package/lib/node-cache-cleaner/npm.js +41 -0
  162. package/lib/node-cache-cleaner/npm.mjs +10 -0
  163. package/lib/node-cache-cleaner/npx.cjs +89 -0
  164. package/lib/node-cache-cleaner/npx.d.ts +4 -0
  165. package/lib/node-cache-cleaner/npx.js +82 -0
  166. package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
  167. package/lib/node-cache-cleaner/yarn.cjs +73 -0
  168. package/lib/node-cache-cleaner/yarn.d.ts +2 -0
  169. package/lib/node-cache-cleaner/yarn.js +62 -0
  170. package/lib/node-cache-cleaner/yarn.mjs +10 -0
  171. package/lib/node-cache-cleaner-cli.cjs +182 -0
  172. package/lib/node-cache-cleaner-cli.d.ts +2 -0
  173. package/lib/node-cache-cleaner-cli.js +60 -0
  174. package/lib/node-cache-cleaner-cli.mjs +56 -0
  175. package/lib/node-executor.cjs +91 -0
  176. package/lib/node-executor.d.cts +2 -0
  177. package/lib/node-executor.mjs +103 -0
  178. package/lib/npm-run-series.cjs +79 -39
  179. package/lib/npm-run-series.mjs +20 -6
  180. package/lib/package-resolutions-updater-cli.cjs +645 -0
  181. package/lib/package-resolutions-updater-cli.d.mts +1 -0
  182. package/lib/package-resolutions-updater-cli.mjs +102 -0
  183. package/lib/package-resolutions-updater.cjs +259 -133
  184. package/lib/package-resolutions-updater.d.mts +51 -1
  185. package/lib/package-resolutions-updater.mjs +18 -294
  186. package/lib/php-cs-fixer-staged.cjs +105 -0
  187. package/lib/php-cs-fixer-staged.d.cts +2 -0
  188. package/lib/php-cs-fixer-staged.mjs +117 -0
  189. package/lib/print-directory-tree.cjs +62 -14
  190. package/lib/print-directory-tree.mjs +2 -2
  191. package/lib/ps/connected-domain.d.ts +1 -1
  192. package/lib/ps/connected-domain.js +10 -10
  193. package/lib/ps/index.cjs +1 -1
  194. package/lib/ps/index.mjs +177 -171
  195. package/lib/ps/isWin.js +1 -1
  196. package/lib/ps/table-parser.js +6 -6
  197. package/lib/remove-module.cjs +61 -13
  198. package/lib/remove-module.mjs +1 -1
  199. package/lib/rm-node-module-cli.cjs +222 -0
  200. package/lib/rm-node-module-cli.d.cts +1 -0
  201. package/lib/rm-node-module-cli.mjs +89 -0
  202. package/lib/rm-node-modules.cjs +127 -0
  203. package/lib/rm-node-modules.d.cts +35 -0
  204. package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
  205. package/lib/rmpath.cjs +63 -15
  206. package/lib/rmpath.mjs +2 -2
  207. package/lib/submodule-install.cjs +107 -47
  208. package/lib/submodule-install.mjs +48 -35
  209. package/lib/submodule-remove-cli.cjs +6 -3
  210. package/lib/submodule-remove-cli.js +3 -3
  211. package/lib/submodule-remove-cli.mjs +2 -3
  212. package/lib/submodule-remove.cjs +4 -1
  213. package/lib/submodule-remove.mjs +1 -1
  214. package/lib/utils/chatgpt.cjs +198 -34
  215. package/lib/utils/chatgpt.js +260 -93
  216. package/lib/utils/chatgpt.mjs +1 -1
  217. package/lib/utils/findEnvFiles.cjs +89 -0
  218. package/lib/utils/findEnvFiles.d.cts +19 -0
  219. package/lib/utils/findEnvFiles.mjs +6 -0
  220. package/lib/utils/findWorkspaceRoot.cjs +70 -0
  221. package/lib/utils/findWorkspaceRoot.d.ts +9 -0
  222. package/lib/utils/findWorkspaceRoot.js +57 -0
  223. package/lib/utils/findWorkspaceRoot.mjs +40 -0
  224. package/lib/utils/index.cjs +60 -13
  225. package/lib/utils/index.mjs +1 -1
  226. package/lib/utils/isGithubTokenValid.cjs +64 -0
  227. package/lib/utils/isGithubTokenValid.d.ts +7 -0
  228. package/lib/utils/isGithubTokenValid.js +48 -0
  229. package/lib/utils/isGithubTokenValid.mjs +36 -0
  230. package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
  231. package/lib/utils/isWindows.d.ts +5 -0
  232. package/lib/utils/isWindows.js +10 -0
  233. package/lib/utils/isWindows.mjs +8 -0
  234. package/lib/utils/runBash.cjs +53 -0
  235. package/lib/utils/runBash.d.cts +12 -0
  236. package/lib/utils/runBash.mjs +66 -0
  237. package/lib/yarn-per-branch-lock-installer.cjs +97 -0
  238. package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
  239. package/lib/yarn-per-branch-lock-installer.mjs +109 -0
  240. package/lib/yarn-reinstall.cjs +61 -13
  241. package/lib/yarn-reinstall.mjs +1 -1
  242. package/package.json +133 -110
  243. package/readme.html +784 -0
  244. package/readme.md +116 -229
  245. package/releases/readme.md +1 -1
  246. package/requirements.txt +1 -0
  247. package/test/README.md +2 -2
  248. package/test-project/package.json +8 -2
  249. package/test-project/workspaces/workspace-a/package.json +135 -0
  250. package/test-project/workspaces/workspace-a/readme.md +20 -0
  251. package/test-project/workspaces/workspace-a/release/readme.md +42 -0
  252. package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
  253. package/test-project/workspaces/workspace-a/test/readme.md +12 -0
  254. package/test-project/workspaces/workspace-b/package.json +139 -0
  255. package/test-project/workspaces/workspace-b/readme.md +94 -0
  256. package/test-project/workspaces/workspace-b/requirements.txt +1 -0
  257. package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
  258. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
  259. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
  260. package/tmp/rm-node-modules-test-project/package.json +17 -0
  261. package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
  262. package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
  263. package/tmp/test-repo/README.md +2 -35
  264. package/tmp/test-repo/package.json +13 -3
  265. package/docs-src/clean-github-actions-caches.md +0 -26
  266. package/docs-src/free-chatgpt.md +0 -26
  267. package/lib/binary-collections-config.cjs +0 -15
  268. package/lib/chunk-4EWQC6GZ.mjs +0 -382
  269. package/lib/chunk-4ZI7BQKQ.mjs +0 -381
  270. package/lib/chunk-5J2BEPY5.mjs +0 -83
  271. package/lib/chunk-AGZYRDC2.mjs +0 -323
  272. package/lib/chunk-BDCHCWHD.mjs +0 -136
  273. package/lib/chunk-BEZKJ25G.mjs +0 -140
  274. package/lib/chunk-DI5MDPSN.mjs +0 -386
  275. package/lib/chunk-GJTGHXRA.mjs +0 -356
  276. package/lib/chunk-HMRMTYZM.mjs +0 -40
  277. package/lib/chunk-HN52G2YL.mjs +0 -305
  278. package/lib/chunk-LEM5OMRP.mjs +0 -384
  279. package/lib/chunk-O6SWBEOQ.mjs +0 -81
  280. package/lib/chunk-RCP7DHVY.mjs +0 -190
  281. package/lib/chunk-SBNDSKG5.mjs +0 -136
  282. package/lib/chunk-U6SO4QEV.mjs +0 -320
  283. package/lib/chunk-XD6BJK6Q.mjs +0 -351
  284. package/lib/chunk-YXSFGA2D.mjs +0 -383
  285. package/lib/git/gitattributes.d.ts +0 -33
  286. package/lib/git/gitattributes.js +0 -223
  287. package/lib/ps/index.d.ts +0 -2
  288. package/lib/ps/index.js +0 -253
  289. package/tmp/typedoc/readme.md +0 -320
  290. /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
@@ -13,10 +13,10 @@ exports.default = default_1;
13
13
  function default_1(tdArray, indicator, hardlink) {
14
14
  hardlink = hardlink || false;
15
15
  if (!tdArray) {
16
- throw new Error("tdArray must be provided");
16
+ throw new Error('tdArray must be provided');
17
17
  }
18
18
  if (!indicator) {
19
- throw new Error("indicator must be provided");
19
+ throw new Error('indicator must be provided');
20
20
  }
21
21
  // clone 一份数据,因为需要对饮用进行修改,方便执行
22
22
  tdArray = JSON.parse(JSON.stringify(tdArray));
@@ -34,21 +34,21 @@ function default_1(tdArray, indicator, hardlink) {
34
34
  var neighbours = [];
35
35
  // top neighbour
36
36
  if (tdArray[y - 1] && tdArray[y - 1][x] !== undefined) {
37
- neighbours.push(pointsHash[x + "_" + (y - 1)]);
37
+ neighbours.push(pointsHash[x + '_' + (y - 1)]);
38
38
  }
39
39
  // left neighbour
40
40
  if (row[x - 1] !== undefined) {
41
- neighbours.push(pointsHash[x - 1 + "_" + y]);
41
+ neighbours.push(pointsHash[x - 1 + '_' + y]);
42
42
  }
43
43
  // soft link will treat corner link as domain link.
44
44
  if (!hardlink) {
45
45
  // top left neighbour
46
46
  if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== undefined) {
47
- neighbours.push(pointsHash[x - 1 + "_" + (y - 1)]);
47
+ neighbours.push(pointsHash[x - 1 + '_' + (y - 1)]);
48
48
  }
49
49
  // top right neighbour
50
50
  if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== undefined) {
51
- neighbours.push(pointsHash[x + 1 + "_" + (y - 1)]);
51
+ neighbours.push(pointsHash[x + 1 + '_' + (y - 1)]);
52
52
  }
53
53
  }
54
54
  if (neighbours.length) {
@@ -63,7 +63,7 @@ function default_1(tdArray, indicator, hardlink) {
63
63
  // If more than one neighbour matched, check if these neighbours belong to the same domain
64
64
  // If not, merge these domains since they connects to each other.
65
65
  else {
66
- var colItemPoint = pointsHash[x + "_" + y];
66
+ var colItemPoint = pointsHash[x + '_' + y];
67
67
  if (neighbour.domainId != colItemPoint.domainId) {
68
68
  mergeDomains(neighbour.domainId, colItemPoint.domainId);
69
69
  }
@@ -150,7 +150,7 @@ function default_1(tdArray, indicator, hardlink) {
150
150
  identifier: identifier,
151
151
  domainId: newDomain.domainId
152
152
  };
153
- pointsHash[x + "_" + y] = {
153
+ pointsHash[x + '_' + y] = {
154
154
  value: point,
155
155
  identifier: identifier,
156
156
  domainId: newDomain.domainId
@@ -174,7 +174,7 @@ function default_1(tdArray, indicator, hardlink) {
174
174
  identifier: domain.identifier,
175
175
  domainId: domainId
176
176
  };
177
- pointsHash[x + "_" + y] = {
177
+ pointsHash[x + '_' + y] = {
178
178
  value: point,
179
179
  identifier: domain.identifier,
180
180
  domainId: domainId
@@ -194,7 +194,7 @@ function default_1(tdArray, indicator, hardlink) {
194
194
  domainB.domainId = domainA.domainId;
195
195
  domainB.points.forEach(function (point) {
196
196
  point.domainId = domainA.domainId;
197
- pointsHash[point.x + "_" + point.y].domainId = domainA.domainId;
197
+ pointsHash[point.x + '_' + point.y].domainId = domainA.domainId;
198
198
  });
199
199
  domainA.points = domainA.points.concat(domainB.points);
200
200
  // 删除domainB
package/lib/ps/index.cjs CHANGED
@@ -394,7 +394,7 @@ var init_table_parser = __esm({
394
394
  }
395
395
  });
396
396
 
397
- // src/ps/index.js
397
+ // src/ps/index.cjs
398
398
  init_cjs_shims();
399
399
  var ChildProcess = require("child_process");
400
400
  var IS_WIN = (init_isWin(), __toCommonJS(isWin_exports)).default;
package/lib/ps/index.mjs CHANGED
@@ -9,190 +9,196 @@ import {
9
9
  isWin_exports
10
10
  } from "../chunk-6S4NXESK.mjs";
11
11
  import {
12
+ __commonJS,
12
13
  __require,
13
14
  __toCommonJS,
14
15
  init_esm_shims
15
16
  } from "../chunk-QQ4A6DLD.mjs";
16
17
 
17
- // src/ps/index.js
18
- init_esm_shims();
19
- var ChildProcess = __require("child_process");
20
- var IS_WIN = (init_isWin(), __toCommonJS(isWin_exports)).default;
21
- var TableParser = (init_table_parser(), __toCommonJS(table_parser_exports));
22
- var EOL = /(\r\n)|(\n\r)|\n|\r/;
23
- var SystemEOL = __require("os").EOL;
24
- var Exec = module.exports = exports = function(args, callback) {
25
- var spawn = ChildProcess.spawn;
26
- if (IS_WIN) {
27
- var CMD = spawn("cmd");
28
- var stdout = "";
29
- var stderr = null;
30
- CMD.stdout.on("data", function(data) {
31
- stdout += data.toString();
32
- });
33
- CMD.stderr.on("data", function(data) {
34
- if (stderr === null) {
35
- stderr = data.toString();
18
+ // src/ps/index.cjs
19
+ var require_ps = __commonJS({
20
+ "src/ps/index.cjs"(exports, module) {
21
+ init_esm_shims();
22
+ var ChildProcess = __require("child_process");
23
+ var IS_WIN = (init_isWin(), __toCommonJS(isWin_exports)).default;
24
+ var TableParser = (init_table_parser(), __toCommonJS(table_parser_exports));
25
+ var EOL = /(\r\n)|(\n\r)|\n|\r/;
26
+ var SystemEOL = __require("os").EOL;
27
+ var Exec = module.exports = exports = function(args, callback) {
28
+ var spawn = ChildProcess.spawn;
29
+ if (IS_WIN) {
30
+ var CMD = spawn("cmd");
31
+ var stdout = "";
32
+ var stderr = null;
33
+ CMD.stdout.on("data", function(data) {
34
+ stdout += data.toString();
35
+ });
36
+ CMD.stderr.on("data", function(data) {
37
+ if (stderr === null) {
38
+ stderr = data.toString();
39
+ } else {
40
+ stderr += data.toString();
41
+ }
42
+ });
43
+ CMD.on("exit", function() {
44
+ var beginRow;
45
+ stdout = stdout.split(EOL);
46
+ stdout.forEach(function(out, index) {
47
+ if (out && typeof beginRow == "undefined" && out.indexOf("CommandLine") === 0) {
48
+ beginRow = index;
49
+ }
50
+ });
51
+ stdout.splice(stdout.length - 1, 1);
52
+ stdout.splice(0, beginRow);
53
+ callback(stderr, stdout.join(SystemEOL) || false);
54
+ });
55
+ CMD.stdin.write("wmic process get ProcessId,ParentProcessId,CommandLine \n");
56
+ CMD.stdin.end();
36
57
  } else {
37
- stderr += data.toString();
58
+ if (typeof args === "string") {
59
+ args = args.split(/\s+/);
60
+ }
61
+ const child = spawn("ps", args);
62
+ stdout = "";
63
+ stderr = null;
64
+ child.stdout.on("data", function(data) {
65
+ stdout += data.toString();
66
+ });
67
+ child.stderr.on("data", function(data) {
68
+ if (stderr === null) {
69
+ stderr = data.toString();
70
+ } else {
71
+ stderr += data.toString();
72
+ }
73
+ });
74
+ child.on("exit", function() {
75
+ if (stderr) {
76
+ return callback(stderr.toString());
77
+ } else {
78
+ callback(null, stdout || false);
79
+ }
80
+ });
38
81
  }
39
- });
40
- CMD.on("exit", function() {
41
- var beginRow;
42
- stdout = stdout.split(EOL);
43
- stdout.forEach(function(out, index) {
44
- if (out && typeof beginRow == "undefined" && out.indexOf("CommandLine") === 0) {
45
- beginRow = index;
82
+ };
83
+ exports.lookup = function(query, callback) {
84
+ var exeArgs = query.psargs || ["lx"];
85
+ var filter = {};
86
+ var idList;
87
+ if (query.pid) {
88
+ if (Array.isArray(query.pid)) {
89
+ idList = query.pid;
90
+ } else {
91
+ idList = [query.pid];
46
92
  }
47
- });
48
- stdout.splice(stdout.length - 1, 1);
49
- stdout.splice(0, beginRow);
50
- callback(stderr, stdout.join(SystemEOL) || false);
51
- });
52
- CMD.stdin.write("wmic process get ProcessId,ParentProcessId,CommandLine \n");
53
- CMD.stdin.end();
54
- } else {
55
- if (typeof args === "string") {
56
- args = args.split(/\s+/);
57
- }
58
- const child = spawn("ps", args);
59
- stdout = "";
60
- stderr = null;
61
- child.stdout.on("data", function(data) {
62
- stdout += data.toString();
63
- });
64
- child.stderr.on("data", function(data) {
65
- if (stderr === null) {
66
- stderr = data.toString();
67
- } else {
68
- stderr += data.toString();
93
+ idList = idList.map(function(v) {
94
+ return String(v);
95
+ });
69
96
  }
70
- });
71
- child.on("exit", function() {
72
- if (stderr) {
73
- return callback(stderr.toString());
74
- } else {
75
- callback(null, stdout || false);
97
+ if (query.command) {
98
+ filter["command"] = new RegExp(query.command, "i");
76
99
  }
77
- });
78
- }
79
- };
80
- exports.lookup = function(query, callback) {
81
- var exeArgs = query.psargs || ["lx"];
82
- var filter = {};
83
- var idList;
84
- if (query.pid) {
85
- if (Array.isArray(query.pid)) {
86
- idList = query.pid;
87
- } else {
88
- idList = [query.pid];
89
- }
90
- idList = idList.map(function(v) {
91
- return String(v);
92
- });
93
- }
94
- if (query.command) {
95
- filter["command"] = new RegExp(query.command, "i");
96
- }
97
- if (query.arguments) {
98
- filter["arguments"] = new RegExp(query.arguments, "i");
99
- }
100
- if (query.ppid) {
101
- filter["ppid"] = new RegExp(query.ppid);
102
- }
103
- return Exec(exeArgs, function(err, output) {
104
- if (err) {
105
- return callback(err);
106
- } else {
107
- var processList = parseGrid(output);
108
- var resultList = [];
109
- processList.forEach(function(p) {
110
- var flt;
111
- var type;
112
- var result = true;
113
- if (idList && idList.indexOf(String(p.pid)) < 0) {
114
- return;
115
- }
116
- for (type in filter) {
117
- flt = filter[type];
118
- result = flt.test(p[type]) ? result : false;
119
- }
120
- if (result) {
121
- resultList.push(p);
122
- }
123
- });
124
- callback(null, resultList);
125
- }
126
- });
127
- };
128
- exports.kill = function(pid, signal, next) {
129
- if (arguments.length == 2 && typeof signal == "function") {
130
- next = signal;
131
- signal = void 0;
132
- }
133
- var checkTimeoutSeconds = signal && signal.timeout || 30;
134
- if (typeof signal === "object") {
135
- signal = signal.signal;
136
- }
137
- try {
138
- process.kill(pid, signal);
139
- } catch (e) {
140
- return next && next(e);
141
- }
142
- var checkConfident = 0;
143
- var checkTimeoutTimer = null;
144
- var checkIsTimeout = false;
145
- function checkKilled(finishCallback) {
146
- exports.lookup({ pid }, function(err, list) {
147
- if (checkIsTimeout) return;
148
- if (err) {
149
- clearTimeout(checkTimeoutTimer);
150
- if (finishCallback) finishCallback(err);
151
- } else if (list.length > 0) {
152
- checkConfident = checkConfident - 1 || 0;
153
- checkKilled(finishCallback);
154
- } else {
155
- checkConfident++;
156
- if (checkConfident === 5) {
157
- clearTimeout(checkTimeoutTimer);
158
- if (finishCallback) finishCallback();
100
+ if (query.arguments) {
101
+ filter["arguments"] = new RegExp(query.arguments, "i");
102
+ }
103
+ if (query.ppid) {
104
+ filter["ppid"] = new RegExp(query.ppid);
105
+ }
106
+ return Exec(exeArgs, function(err, output) {
107
+ if (err) {
108
+ return callback(err);
159
109
  } else {
160
- checkKilled(finishCallback);
110
+ var processList = parseGrid(output);
111
+ var resultList = [];
112
+ processList.forEach(function(p) {
113
+ var flt;
114
+ var type;
115
+ var result = true;
116
+ if (idList && idList.indexOf(String(p.pid)) < 0) {
117
+ return;
118
+ }
119
+ for (type in filter) {
120
+ flt = filter[type];
121
+ result = flt.test(p[type]) ? result : false;
122
+ }
123
+ if (result) {
124
+ resultList.push(p);
125
+ }
126
+ });
127
+ callback(null, resultList);
161
128
  }
129
+ });
130
+ };
131
+ exports.kill = function(pid, signal, next) {
132
+ if (arguments.length == 2 && typeof signal == "function") {
133
+ next = signal;
134
+ signal = void 0;
162
135
  }
163
- });
164
- }
165
- if (next) checkKilled(next);
166
- checkTimeoutTimer = next && setTimeout(function() {
167
- checkIsTimeout = true;
168
- next(new Error("Kill process timeout"));
169
- }, checkTimeoutSeconds * 1e3);
170
- };
171
- function parseGrid(output) {
172
- if (!output) {
173
- return [];
174
- }
175
- return formatOutput(TableParser.parse(output));
176
- }
177
- function formatOutput(data) {
178
- var formatedData = [];
179
- data.forEach(function(d) {
180
- var pid = d.PID && d.PID[0] || d.ProcessId && d.ProcessId[0] || void 0;
181
- var cmd = d.CMD || d.CommandLine || d.COMMAND || void 0;
182
- var ppid = d.PPID && d.PPID[0] || d.ParentProcessId && d.ParentProcessId[0] || void 0;
183
- if (pid && cmd) {
184
- var command = cmd[0];
185
- var args = "";
186
- if (cmd.length > 1) {
187
- args = cmd.slice(1);
136
+ var checkTimeoutSeconds = signal && signal.timeout || 30;
137
+ if (typeof signal === "object") {
138
+ signal = signal.signal;
139
+ }
140
+ try {
141
+ process.kill(pid, signal);
142
+ } catch (e) {
143
+ return next && next(e);
144
+ }
145
+ var checkConfident = 0;
146
+ var checkTimeoutTimer = null;
147
+ var checkIsTimeout = false;
148
+ function checkKilled(finishCallback) {
149
+ exports.lookup({ pid }, function(err, list) {
150
+ if (checkIsTimeout) return;
151
+ if (err) {
152
+ clearTimeout(checkTimeoutTimer);
153
+ if (finishCallback) finishCallback(err);
154
+ } else if (list.length > 0) {
155
+ checkConfident = checkConfident - 1 || 0;
156
+ checkKilled(finishCallback);
157
+ } else {
158
+ checkConfident++;
159
+ if (checkConfident === 5) {
160
+ clearTimeout(checkTimeoutTimer);
161
+ if (finishCallback) finishCallback();
162
+ } else {
163
+ checkKilled(finishCallback);
164
+ }
165
+ }
166
+ });
188
167
  }
189
- formatedData.push({
190
- pid,
191
- command,
192
- arguments: args,
193
- ppid
168
+ if (next) checkKilled(next);
169
+ checkTimeoutTimer = next && setTimeout(function() {
170
+ checkIsTimeout = true;
171
+ next(new Error("Kill process timeout"));
172
+ }, checkTimeoutSeconds * 1e3);
173
+ };
174
+ function parseGrid(output) {
175
+ if (!output) {
176
+ return [];
177
+ }
178
+ return formatOutput(TableParser.parse(output));
179
+ }
180
+ function formatOutput(data) {
181
+ var formatedData = [];
182
+ data.forEach(function(d) {
183
+ var pid = d.PID && d.PID[0] || d.ProcessId && d.ProcessId[0] || void 0;
184
+ var cmd = d.CMD || d.CommandLine || d.COMMAND || void 0;
185
+ var ppid = d.PPID && d.PPID[0] || d.ParentProcessId && d.ParentProcessId[0] || void 0;
186
+ if (pid && cmd) {
187
+ var command = cmd[0];
188
+ var args = "";
189
+ if (cmd.length > 1) {
190
+ args = cmd.slice(1);
191
+ }
192
+ formatedData.push({
193
+ pid,
194
+ command,
195
+ arguments: args,
196
+ ppid
197
+ });
198
+ }
194
199
  });
200
+ return formatedData;
195
201
  }
196
- });
197
- return formatedData;
198
- }
202
+ }
203
+ });
204
+ export default require_ps();
package/lib/ps/isWin.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const isWin = process.platform === "win32";
3
+ const isWin = process.platform === 'win32';
4
4
  exports.default = isWin;
@@ -67,7 +67,7 @@ function parse(output) {
67
67
  });
68
68
  }
69
69
  else {
70
- twoDimArray[index - 1] = line.split("");
70
+ twoDimArray[index - 1] = line.split('');
71
71
  }
72
72
  });
73
73
  // In the connected-domain aspect of view, all the blanks are connected, and all the non-blanks are connected.
@@ -210,18 +210,18 @@ function splitValue(value) {
210
210
  // If the match length is a even, than nothing special, if a odd, ignore the last one.
211
211
  var maxQuotaCount = match.length % 2 == 0 ? match.length : match.length - 1;
212
212
  var previousItem = null;
213
- var values = value.split("");
213
+ var values = value.split('');
214
214
  values.forEach(function (item, index) {
215
- if (item !== " ") {
215
+ if (item !== ' ') {
216
216
  if (item === '"') {
217
217
  // quota chunk begin
218
218
  if (ifInWrappedChunk === false && quotaCount <= maxQuotaCount) {
219
219
  ifInWrappedChunk = true;
220
220
  quotaCount++;
221
221
  // pure quota chunk begin
222
- if (previousItem === " " || previousItem === null) {
222
+ if (previousItem === ' ' || previousItem === null) {
223
223
  ifInPureWrappedChunk = true;
224
- chunk = "";
224
+ chunk = '';
225
225
  }
226
226
  // normal continue
227
227
  else {
@@ -245,7 +245,7 @@ function splitValue(value) {
245
245
  }
246
246
  }
247
247
  // normal begin
248
- else if (ifInWrappedChunk === false && (previousItem === " " || previousItem === null)) {
248
+ else if (ifInWrappedChunk === false && (previousItem === ' ' || previousItem === null)) {
249
249
  chunk = item;
250
250
  }
251
251
  // normal or quota chunk continue.
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -88,31 +89,78 @@ var require_utils = __commonJS({
88
89
  }
89
90
  module2.exports.getArgs = getArgs2;
90
91
  function del(fullPath) {
91
- if (fs2.statSync(fullPath).isDirectory()) {
92
- const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
93
- for (let i = 0; i < subdir.length; i++) {
94
- del(subdir[i]);
92
+ try {
93
+ if (!fs2.existsSync(fullPath)) return;
94
+ const stat = fs2.lstatSync(fullPath);
95
+ if (stat.isSymbolicLink()) {
96
+ try {
97
+ fs2.unlinkSync(fullPath);
98
+ console.log("deleted symlink", fullPath);
99
+ } catch (e) {
100
+ console.log("failed delete symlink", fullPath, e && e.message);
101
+ }
102
+ return;
103
+ }
104
+ if (stat.isDirectory()) {
105
+ const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
106
+ for (let i = 0; i < subdir.length; i++) {
107
+ del(subdir[i]);
108
+ }
109
+ try {
110
+ fs2.rmdirSync(fullPath);
111
+ console.log("deleted", fullPath);
112
+ } catch (_e) {
113
+ try {
114
+ fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
115
+ console.log("deleted", fullPath);
116
+ } catch (ee) {
117
+ console.log("failed delete", fullPath, ee && ee.message);
118
+ }
119
+ }
120
+ return;
95
121
  }
96
- } else {
97
122
  try {
98
- fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
123
+ fs2.unlinkSync(fullPath);
99
124
  console.log("deleted", fullPath);
100
- } catch (_) {
101
- console.log("failed delete", fullPath);
125
+ } catch (_e) {
126
+ try {
127
+ fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
128
+ console.log("deleted", fullPath);
129
+ } catch (ee) {
130
+ console.log("failed delete", fullPath, ee && ee.message);
131
+ }
102
132
  }
133
+ } catch (err) {
134
+ console.log("failed delete", fullPath, err && err.message);
103
135
  }
104
136
  }
105
137
  module2.exports.del = del;
106
138
  function delStream(globStream) {
107
139
  globStream.stream().on("data", (result) => {
108
140
  const fullPath = path2.resolve(process.cwd(), result);
109
- if (fs2.statSync(fullPath).isDirectory()) {
110
- const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
111
- for (let i = 0; i < subdir.length; i++) {
112
- del(subdir[i]);
141
+ try {
142
+ if (fs2.existsSync(fullPath)) {
143
+ const stat = fs2.lstatSync(fullPath);
144
+ if (stat.isSymbolicLink()) {
145
+ try {
146
+ fs2.unlinkSync(fullPath);
147
+ console.log("deleted symlink", fullPath);
148
+ } catch (e) {
149
+ console.log("failed delete symlink", fullPath, e && e.message);
150
+ }
151
+ return;
152
+ }
153
+ if (stat.isDirectory()) {
154
+ const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
155
+ for (let i = 0; i < subdir.length; i++) {
156
+ del(subdir[i]);
157
+ }
158
+ }
113
159
  }
160
+ del(fullPath);
161
+ } catch (err) {
162
+ console.log("failed processing", fullPath, err && err.message);
114
163
  }
115
- del(fullPath);
116
164
  });
117
165
  }
118
166
  module2.exports.delStream = delStream;
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "./chunk-V3N3JEUF.mjs";
4
+ } from "./chunk-5RTXZVCW.mjs";
5
5
  import {
6
6
  __toESM,
7
7
  init_esm_shims