binary-collections 2.0.6 → 2.0.8

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 (183) hide show
  1. package/bin/dir-tree.cmd +7 -0
  2. package/bin/git-diff +4 -0
  3. package/bin/git-diff.cmd +7 -0
  4. package/bin/{git-fix-encoding → git-fix} +1 -4
  5. package/bin/git-fix.cmd +7 -0
  6. package/bin/nodekill +0 -0
  7. package/bin/nodekill.cmd +0 -0
  8. package/bin/{submodule-install → submodule-install.txt} +0 -0
  9. package/bin/{submodule → submodule.txt} +0 -0
  10. package/lib/binary-collections-config.cjs +14 -0
  11. package/lib/binary-collections-config.d.mts +18 -0
  12. package/lib/binary-collections-config.d.ts +16 -0
  13. package/lib/binary-collections-config.js +39 -0
  14. package/lib/binary-collections-config.mjs +6 -0
  15. package/lib/binary-collections.cjs +105 -0
  16. package/lib/binary-collections.d.cts +2 -0
  17. package/lib/binary-collections.d.mts +121 -0
  18. package/lib/binary-collections.d.ts +121 -0
  19. package/lib/binary-collections.mjs +108 -0
  20. package/lib/chunk-4BYBVEYC.mjs +30 -0
  21. package/lib/chunk-AASHBCRW.mjs +57 -0
  22. package/lib/chunk-APBWENF6.mjs +135 -0
  23. package/lib/{chunk-M4IBUK4H.mjs → chunk-DPKAJKFO.mjs} +2 -4
  24. package/lib/chunk-EGSSKVDH.mjs +66 -0
  25. package/lib/{chunk-GA4DDV65.mjs → chunk-G3THLIDT.mjs} +3 -5
  26. package/lib/chunk-JGR2NW6D.mjs +187 -0
  27. package/lib/chunk-ONIBBBQ3.mjs +108 -0
  28. package/lib/chunk-SH3L6HHV.mjs +27 -0
  29. package/lib/chunk-VVEZVNIV.mjs +81 -0
  30. package/lib/{chunk-E75HJFJO.mjs → chunk-W3ENOM53.mjs} +2 -4
  31. package/lib/chunk-YV7DO3YV.mjs +48 -0
  32. package/lib/chunk-YX5U7XDR.mjs +58 -0
  33. package/lib/chunk-ZYAQRPUL.mjs +28 -0
  34. package/lib/clean-github-actions-caches.cjs +162 -0
  35. package/lib/clean-github-actions-caches.d.cts +1 -0
  36. package/lib/clean-github-actions-caches.d.mts +169 -0
  37. package/lib/clean-github-actions-caches.d.ts +169 -0
  38. package/lib/clean-github-actions-caches.mjs +132 -0
  39. package/lib/del-gradle.cjs +99 -15
  40. package/lib/del-gradle.d.ts +1 -2
  41. package/lib/del-gradle.js +12 -69
  42. package/lib/del-gradle.mjs +4 -6
  43. package/lib/del-node-modules.cjs +98 -14
  44. package/lib/del-node-modules.d.ts +1 -2
  45. package/lib/del-node-modules.js +11 -68
  46. package/lib/del-node-modules.mjs +3 -5
  47. package/lib/del-ps.cjs +98 -627
  48. package/lib/del-ps.d.ts +1 -2
  49. package/lib/del-ps.js +27 -702
  50. package/lib/del-ps.mjs +7 -12
  51. package/lib/del-yarn-caches.cjs +98 -14
  52. package/lib/del-yarn-caches.d.ts +1 -2
  53. package/lib/del-yarn-caches.js +6 -63
  54. package/lib/del-yarn-caches.mjs +3 -5
  55. package/lib/find-node-modules-cli.cjs +67 -0
  56. package/lib/find-node-modules-cli.d.mts +1 -0
  57. package/lib/find-node-modules-cli.d.ts +2 -0
  58. package/lib/find-node-modules-cli.js +3 -0
  59. package/lib/find-node-modules-cli.mjs +13 -0
  60. package/lib/find-node-modules.cjs +39 -9
  61. package/lib/find-node-modules.d.mts +12 -1
  62. package/lib/find-node-modules.d.ts +12 -2
  63. package/lib/find-node-modules.js +53 -12
  64. package/lib/find-node-modules.mjs +4 -19
  65. package/lib/git/gitattributes.cjs +171 -0
  66. package/lib/git/gitattributes.d.mts +35 -0
  67. package/lib/git/gitattributes.d.ts +33 -0
  68. package/lib/git/gitattributes.js +223 -0
  69. package/lib/git/gitattributes.mjs +6 -0
  70. package/lib/git/line-endings.cjs +74 -0
  71. package/lib/git/line-endings.d.cts +7 -0
  72. package/lib/git/line-endings.d.mts +83 -0
  73. package/lib/git/line-endings.d.ts +83 -0
  74. package/lib/git/line-endings.mjs +8 -0
  75. package/lib/git/normalize.cjs +42 -0
  76. package/lib/git/normalize.d.cts +6 -0
  77. package/lib/git/normalize.d.mts +43 -0
  78. package/lib/git/normalize.d.ts +43 -0
  79. package/lib/git/normalize.mjs +6 -0
  80. package/lib/git/permissions.cjs +15 -0
  81. package/lib/git/permissions.d.cts +6 -0
  82. package/lib/git/permissions.d.mts +17 -0
  83. package/lib/git/permissions.d.ts +17 -0
  84. package/lib/git/permissions.mjs +7 -0
  85. package/lib/git/pull-strategy.cjs +13 -0
  86. package/lib/git/pull-strategy.d.cts +5 -0
  87. package/lib/git/pull-strategy.d.mts +15 -0
  88. package/lib/git/pull-strategy.d.ts +15 -0
  89. package/lib/git/pull-strategy.mjs +7 -0
  90. package/lib/git/user-config.cjs +100 -0
  91. package/lib/git/user-config.d.cts +10 -0
  92. package/lib/git/user-config.d.mts +105 -0
  93. package/lib/git/user-config.d.ts +105 -0
  94. package/lib/git/user-config.mjs +8 -0
  95. package/lib/git/utils.cjs +70 -0
  96. package/lib/git/utils.d.cts +20 -0
  97. package/lib/git/utils.d.mts +69 -0
  98. package/lib/git/utils.d.ts +69 -0
  99. package/lib/git/utils.mjs +6 -0
  100. package/lib/git-diff.cjs +73 -0
  101. package/lib/git-diff.d.cts +2 -0
  102. package/lib/git-diff.d.mts +84 -0
  103. package/lib/git-diff.d.ts +84 -0
  104. package/lib/git-diff.mjs +88 -0
  105. package/lib/git-fix.cjs +129 -0
  106. package/lib/git-fix.d.cts +2 -0
  107. package/lib/git-fix.d.mts +141 -0
  108. package/lib/git-fix.d.ts +141 -0
  109. package/lib/git-fix.mjs +151 -0
  110. package/lib/git-purge.cjs +92 -621
  111. package/lib/git-purge.d.ts +1 -2
  112. package/lib/git-purge.js +53 -698
  113. package/lib/git-purge.mjs +4 -9
  114. package/lib/index.cjs +99 -1
  115. package/lib/index.d.mts +1 -2
  116. package/lib/index.d.ts +2 -2
  117. package/lib/index.js +8 -2
  118. package/lib/index.mjs +10 -3
  119. package/lib/npm-run-series.cjs +140 -1
  120. package/lib/npm-run-series.d.ts +1 -0
  121. package/lib/npm-run-series.js +81 -56
  122. package/lib/npm-run-series.mjs +7 -5
  123. package/lib/package-resolutions-updater.cjs +274 -0
  124. package/lib/package-resolutions-updater.d.mts +1 -0
  125. package/lib/package-resolutions-updater.d.ts +326 -0
  126. package/lib/package-resolutions-updater.mjs +316 -0
  127. package/lib/print-directory-tree.cjs +241 -0
  128. package/lib/print-directory-tree.d.cts +1 -0
  129. package/lib/print-directory-tree.d.mts +234 -0
  130. package/lib/print-directory-tree.d.ts +234 -0
  131. package/lib/print-directory-tree.mjs +182 -0
  132. package/lib/ps/connected-domain.cjs +0 -0
  133. package/lib/ps/connected-domain.d.ts +1 -2
  134. package/lib/ps/connected-domain.js +196 -150
  135. package/lib/ps/connected-domain.mjs +2 -3
  136. package/lib/ps/index.cjs +3 -3
  137. package/lib/ps/index.d.mjs +1 -2
  138. package/lib/ps/index.d.ts +2 -26
  139. package/lib/ps/index.js +233 -535
  140. package/lib/ps/index.mjs +9 -11
  141. package/lib/ps/isWin.cjs +0 -0
  142. package/lib/ps/isWin.d.ts +1 -2
  143. package/lib/ps/isWin.js +1 -2
  144. package/lib/ps/isWin.mjs +2 -3
  145. package/lib/ps/table-parser.cjs +0 -0
  146. package/lib/ps/table-parser.d.ts +1 -3
  147. package/lib/ps/table-parser.js +254 -345
  148. package/lib/ps/table-parser.mjs +3 -4
  149. package/lib/submodule-install.cjs +100 -0
  150. package/lib/submodule-install.d.cts +2 -0
  151. package/lib/submodule-install.d.mts +121 -0
  152. package/lib/submodule-install.d.ts +121 -0
  153. package/lib/submodule-install.mjs +107 -0
  154. package/lib/utils.cjs +98 -14
  155. package/lib/utils.d.mts +29 -9
  156. package/lib/utils.d.ts +30 -14
  157. package/lib/utils.js +173 -27
  158. package/lib/utils.mjs +2 -3
  159. package/lib/yarn-reinstall.cjs +44 -0
  160. package/lib/yarn-reinstall.d.cts +1 -0
  161. package/lib/yarn-reinstall.d.mts +49 -0
  162. package/lib/yarn-reinstall.d.ts +49 -0
  163. package/lib/yarn-reinstall.mjs +54 -0
  164. package/package.json +126 -99
  165. package/readme.md +238 -50
  166. package/src/package-resolutions-updater.mjs +325 -0
  167. package/src/print-directory-tree.cjs +234 -0
  168. package/src/ps/index.js +4 -3
  169. package/src/yarn-reinstall.cjs +49 -0
  170. package/test-project/package.json +16 -0
  171. package/tmp/test-repo/package.json +7 -0
  172. package/bin/git-fix-encoding.cmd +0 -6
  173. package/eslint.config.cjs +0 -97
  174. package/lib/chunk-7MSZ52XC.mjs +0 -14
  175. package/lib/chunk-AVDT32AY.mjs +0 -20
  176. package/lib/chunk-LPLPQBYP.mjs +0 -53
  177. package/lib/chunk-S4SJ7SDW.mjs +0 -625
  178. package/lib/package-resolutions.cjs +0 -28
  179. package/lib/package-resolutions.d.mts +0 -25
  180. package/lib/package-resolutions.d.ts +0 -25
  181. package/lib/package-resolutions.js +0 -28
  182. package/lib/package-resolutions.mjs +0 -31
  183. package/lib/ps/index.d.js +0 -17
package/lib/git-purge.cjs CHANGED
@@ -12,628 +12,76 @@ var init_cjs_shims = __esm({
12
12
  }
13
13
  });
14
14
 
15
- // node_modules/cross-spawn/dist/lib/enoent.js
16
- var require_enoent = __commonJS({
17
- "node_modules/cross-spawn/dist/lib/enoent.js"(exports2, module2) {
18
- "use strict";
19
- init_cjs_shims();
20
- var isWin = process.platform === "win32";
21
- function notFoundError(original, syscall) {
22
- return Object.assign(new Error("".concat(syscall, " ").concat(original.command, " ENOENT")), {
23
- code: "ENOENT",
24
- errno: "ENOENT",
25
- syscall: "".concat(syscall, " ").concat(original.command),
26
- path: original.command,
27
- spawnargs: original.args
28
- });
29
- }
30
- function hookChildProcess(cp, parsed) {
31
- if (!isWin) {
32
- return;
33
- }
34
- var originalEmit = cp.emit;
35
- cp.emit = function(name, arg1) {
36
- if (name === "exit") {
37
- var err = verifyENOENT(arg1, parsed, "spawn");
38
- if (err) {
39
- return originalEmit.call(cp, "error", err);
40
- }
41
- }
42
- return originalEmit.apply(cp, arguments);
43
- };
44
- }
45
- function verifyENOENT(status, parsed) {
46
- if (isWin && status === 1 && !parsed.file) {
47
- return notFoundError(parsed.original, "spawn");
48
- }
49
- return null;
50
- }
51
- function verifyENOENTSync(status, parsed) {
52
- if (isWin && status === 1 && !parsed.file) {
53
- return notFoundError(parsed.original, "spawnSync");
54
- }
55
- return null;
56
- }
57
- module2.exports = {
58
- hookChildProcess,
59
- verifyENOENT,
60
- verifyENOENTSync,
61
- notFoundError
62
- };
63
- }
64
- });
65
-
66
- // node_modules/isexe/windows.js
67
- var require_windows = __commonJS({
68
- "node_modules/isexe/windows.js"(exports2, module2) {
69
- init_cjs_shims();
70
- module2.exports = isexe;
71
- isexe.sync = sync;
72
- var fs = require("fs");
73
- function checkPathExt(path2, options) {
74
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
75
- if (!pathext) {
76
- return true;
77
- }
78
- pathext = pathext.split(";");
79
- if (pathext.indexOf("") !== -1) {
80
- return true;
81
- }
82
- for (var i = 0; i < pathext.length; i++) {
83
- var p = pathext[i].toLowerCase();
84
- if (p && path2.substr(-p.length).toLowerCase() === p) {
85
- return true;
86
- }
87
- }
88
- return false;
89
- }
90
- function checkStat(stat, path2, options) {
91
- if (!stat.isSymbolicLink() && !stat.isFile()) {
92
- return false;
93
- }
94
- return checkPathExt(path2, options);
95
- }
96
- function isexe(path2, options, cb) {
97
- fs.stat(path2, function(er, stat) {
98
- cb(er, er ? false : checkStat(stat, path2, options));
99
- });
100
- }
101
- function sync(path2, options) {
102
- return checkStat(fs.statSync(path2), path2, options);
103
- }
104
- }
105
- });
106
-
107
- // node_modules/isexe/mode.js
108
- var require_mode = __commonJS({
109
- "node_modules/isexe/mode.js"(exports2, module2) {
110
- init_cjs_shims();
111
- module2.exports = isexe;
112
- isexe.sync = sync;
113
- var fs = require("fs");
114
- function isexe(path2, options, cb) {
115
- fs.stat(path2, function(er, stat) {
116
- cb(er, er ? false : checkStat(stat, options));
117
- });
118
- }
119
- function sync(path2, options) {
120
- return checkStat(fs.statSync(path2), options);
121
- }
122
- function checkStat(stat, options) {
123
- return stat.isFile() && checkMode(stat, options);
124
- }
125
- function checkMode(stat, options) {
126
- var mod = stat.mode;
127
- var uid = stat.uid;
128
- var gid = stat.gid;
129
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
130
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
131
- var u = parseInt("100", 8);
132
- var g = parseInt("010", 8);
133
- var o = parseInt("001", 8);
134
- var ug = u | g;
135
- var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
136
- return ret;
137
- }
138
- }
139
- });
140
-
141
- // node_modules/isexe/index.js
142
- var require_isexe = __commonJS({
143
- "node_modules/isexe/index.js"(exports2, module2) {
15
+ // src/utils.js
16
+ var require_utils = __commonJS({
17
+ "src/utils.js"(exports2, module2) {
144
18
  init_cjs_shims();
145
19
  var fs = require("fs");
146
- var core;
147
- if (process.platform === "win32" || global.TESTING_WINDOWS) {
148
- core = require_windows();
149
- } else {
150
- core = require_mode();
151
- }
152
- module2.exports = isexe;
153
- isexe.sync = sync;
154
- function isexe(path2, options, cb) {
155
- if (typeof options === "function") {
156
- cb = options;
157
- options = {};
158
- }
159
- if (!cb) {
160
- if (typeof Promise !== "function") {
161
- throw new TypeError("callback not provided");
162
- }
163
- return new Promise(function(resolve, reject) {
164
- isexe(path2, options || {}, function(er, is) {
165
- if (er) {
166
- reject(er);
167
- } else {
168
- resolve(is);
169
- }
170
- });
171
- });
172
- }
173
- core(path2, options || {}, function(er, is) {
174
- if (er) {
175
- if (er.code === "EACCES" || options && options.ignoreErrors) {
176
- er = null;
177
- is = false;
178
- }
179
- }
180
- cb(er, is);
181
- });
182
- }
183
- function sync(path2, options) {
20
+ var path2 = require("upath");
21
+ var argv = require("minimist")(process.argv.slice(2));
22
+ var { exec } = require("child_process");
23
+ var { URL: URL2 } = require("url");
24
+ var { promisify } = require("util");
25
+ var execAsync = promisify(exec);
26
+ async function parseGitRemotes() {
184
27
  try {
185
- return core.sync(path2, options || {});
186
- } catch (er) {
187
- if (options && options.ignoreErrors || er.code === "EACCES") {
188
- return false;
189
- } else {
190
- throw er;
191
- }
192
- }
193
- }
194
- }
195
- });
196
-
197
- // node_modules/cross-spawn/node_modules/which/lib/index.js
198
- var require_lib = __commonJS({
199
- "node_modules/cross-spawn/node_modules/which/lib/index.js"(exports2, module2) {
200
- init_cjs_shims();
201
- var isexe = require_isexe();
202
- var { join, delimiter, sep, posix } = require("path");
203
- var isWindows = process.platform === "win32";
204
- var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
205
- var rRel = new RegExp(`^\\.${rSlash.source}`);
206
- var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
207
- var getPathInfo = (cmd, {
208
- path: optPath = process.env.PATH,
209
- pathExt: optPathExt = process.env.PATHEXT,
210
- delimiter: optDelimiter = delimiter
211
- }) => {
212
- const pathEnv = cmd.match(rSlash) ? [""] : [
213
- // windows always checks the cwd first
214
- ...isWindows ? [process.cwd()] : [],
215
- ...(optPath || /* istanbul ignore next: very unusual */
216
- "").split(optDelimiter)
217
- ];
218
- if (isWindows) {
219
- const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
220
- const pathExt = pathExtExe.split(optDelimiter).reduce((acc, item) => {
221
- acc.push(item);
222
- acc.push(item.toLowerCase());
223
- return acc;
224
- }, []);
225
- if (cmd.includes(".") && pathExt[0] !== "") {
226
- pathExt.unshift("");
227
- }
228
- return { pathEnv, pathExt, pathExtExe };
229
- }
230
- return { pathEnv, pathExt: [""] };
231
- };
232
- var getPathPart = (raw, cmd) => {
233
- const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
234
- const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
235
- return prefix + join(pathPart, cmd);
236
- };
237
- var which = async (cmd, opt = {}) => {
238
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
239
- const found = [];
240
- for (const envPart of pathEnv) {
241
- const p = getPathPart(envPart, cmd);
242
- for (const ext of pathExt) {
243
- const withExt = p + ext;
244
- const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
245
- if (is) {
246
- if (!opt.all) {
247
- return withExt;
28
+ const { stdout } = await execAsync("git remote -v");
29
+ const lines = stdout.split("\n");
30
+ const remotes = {};
31
+ lines.forEach((line) => {
32
+ const [name, url] = line.split(" ");
33
+ if (name && url) {
34
+ const [repoUrl] = url.split(" ");
35
+ try {
36
+ const parsedUrl = new URL2(repoUrl);
37
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
38
+ if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
39
+ let repoPath = pathParts.join("/");
40
+ if (repoPath.endsWith(".git")) {
41
+ repoPath = repoPath.slice(0, -4);
42
+ }
43
+ remotes[name] = repoPath;
44
+ }
45
+ } catch (e) {
46
+ console.error("URL Parsing Error:", e.message);
248
47
  }
249
- found.push(withExt);
250
48
  }
251
- }
252
- }
253
- if (opt.all && found.length) {
254
- return found;
255
- }
256
- if (opt.nothrow) {
257
- return null;
258
- }
259
- throw getNotFoundError(cmd);
260
- };
261
- var whichSync = (cmd, opt = {}) => {
262
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
263
- const found = [];
264
- for (const pathEnvPart of pathEnv) {
265
- const p = getPathPart(pathEnvPart, cmd);
266
- for (const ext of pathExt) {
267
- const withExt = p + ext;
268
- const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
269
- if (is) {
270
- if (!opt.all) {
271
- return withExt;
272
- }
273
- found.push(withExt);
274
- }
275
- }
276
- }
277
- if (opt.all && found.length) {
278
- return found;
279
- }
280
- if (opt.nothrow) {
281
- return null;
282
- }
283
- throw getNotFoundError(cmd);
284
- };
285
- module2.exports = which;
286
- which.sync = whichSync;
287
- }
288
- });
289
-
290
- // node_modules/cross-spawn/dist/lib/util/pathKey.js
291
- var require_pathKey = __commonJS({
292
- "node_modules/cross-spawn/dist/lib/util/pathKey.js"(exports2, module2) {
293
- init_cjs_shims();
294
- function pathKey(options) {
295
- if (options === void 0) {
296
- options = {};
297
- }
298
- var _a = options.env, env = _a === void 0 ? process.env : _a, _b = options.platform, platform = _b === void 0 ? process.platform : _b;
299
- if (platform !== "win32") {
300
- return "PATH";
301
- }
302
- return Object.keys(env).reverse().find(function(key) {
303
- return key.toUpperCase() === "PATH";
304
- }) || "Path";
305
- }
306
- module2.exports = pathKey;
307
- }
308
- });
309
-
310
- // node_modules/cross-spawn/dist/lib/util/resolveCommand.js
311
- var require_resolveCommand = __commonJS({
312
- "node_modules/cross-spawn/dist/lib/util/resolveCommand.js"(exports2, module2) {
313
- "use strict";
314
- init_cjs_shims();
315
- var path2 = require("path");
316
- var which = require_lib();
317
- var getPathKey = require_pathKey();
318
- function resolveCommandAttempt(parsed, withoutPathExt) {
319
- var env = parsed.options.env || process.env;
320
- var cwd = process.cwd();
321
- var hasCustomCwd = parsed.options.cwd != null;
322
- var shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
323
- if (shouldSwitchCwd) {
324
- try {
325
- process.chdir(parsed.options.cwd);
326
- } catch (err) {
327
- }
328
- }
329
- var resolved;
330
- try {
331
- resolved = which.sync(parsed.command, {
332
- path: env[getPathKey({ env })],
333
- pathExt: withoutPathExt ? path2.delimiter : void 0
334
49
  });
335
- } catch (e) {
336
- } finally {
337
- if (shouldSwitchCwd) {
338
- process.chdir(cwd);
339
- }
340
- }
341
- if (resolved) {
342
- resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
50
+ return remotes;
51
+ } catch (error) {
52
+ console.error("Error:", error.message);
53
+ return {};
343
54
  }
344
- return resolved;
345
55
  }
346
- function resolveCommand(parsed) {
347
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
348
- }
349
- module2.exports = resolveCommand;
350
- }
351
- });
352
-
353
- // node_modules/cross-spawn/dist/lib/util/escape.js
354
- var require_escape = __commonJS({
355
- "node_modules/cross-spawn/dist/lib/util/escape.js"(exports2, module2) {
356
- "use strict";
357
- init_cjs_shims();
358
- var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
359
- function escapeCommand(arg) {
360
- arg = arg.replace(metaCharsRegExp, "^$1");
361
- return arg;
362
- }
363
- function escapeArgument(arg, doubleEscapeMetaChars) {
364
- arg = "".concat(arg);
365
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
366
- arg = arg.replace(/(\\*)$/, "$1$1");
367
- arg = '"'.concat(arg, '"');
368
- arg = arg.replace(metaCharsRegExp, "^$1");
369
- if (doubleEscapeMetaChars) {
370
- arg = arg.replace(metaCharsRegExp, "^$1");
56
+ module2.exports.parseGitRemotes = parseGitRemotes;
57
+ function joinPathPreserveDriveLetter(...segments) {
58
+ let fullPath = require("path").join(...segments);
59
+ if (/^[a-z]:\\/.test(fullPath)) {
60
+ fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
371
61
  }
372
- return arg;
62
+ return fullPath;
373
63
  }
374
- module2.exports.command = escapeCommand;
375
- module2.exports.argument = escapeArgument;
376
- }
377
- });
378
-
379
- // node_modules/shebang-regex/index.js
380
- var require_shebang_regex = __commonJS({
381
- "node_modules/shebang-regex/index.js"(exports2, module2) {
382
- "use strict";
383
- init_cjs_shims();
384
- module2.exports = /^#!(.*)/;
385
- }
386
- });
387
-
388
- // node_modules/shebang-command/index.js
389
- var require_shebang_command = __commonJS({
390
- "node_modules/shebang-command/index.js"(exports2, module2) {
391
- "use strict";
392
- init_cjs_shims();
393
- var shebangRegex = require_shebang_regex();
394
- module2.exports = (string = "") => {
395
- const match = string.match(shebangRegex);
396
- if (!match) {
397
- return null;
398
- }
399
- const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
400
- const binary = path2.split("/").pop();
401
- if (binary === "env") {
402
- return argument;
403
- }
404
- return argument ? `${binary} ${argument}` : binary;
405
- };
406
- }
407
- });
408
-
409
- // node_modules/cross-spawn/dist/lib/util/readShebang.js
410
- var require_readShebang = __commonJS({
411
- "node_modules/cross-spawn/dist/lib/util/readShebang.js"(exports2, module2) {
412
- "use strict";
413
- init_cjs_shims();
414
- var fs = require("fs");
415
- var shebangCommand = require_shebang_command();
416
- function readShebang(command) {
417
- var size = 150;
418
- var buffer = Buffer.alloc(size);
419
- var fd;
420
- try {
421
- fd = fs.openSync(command, "r");
422
- fs.readSync(fd, buffer, 0, size, 0);
423
- fs.closeSync(fd);
424
- } catch (e) {
425
- }
426
- return shebangCommand(buffer.toString());
427
- }
428
- module2.exports = readShebang;
429
- }
430
- });
431
-
432
- // node_modules/cross-spawn/dist/lib/parse.js
433
- var require_parse = __commonJS({
434
- "node_modules/cross-spawn/dist/lib/parse.js"(exports2, module2) {
435
- "use strict";
436
- init_cjs_shims();
437
- var path2 = require("path");
438
- var resolveCommand = require_resolveCommand();
439
- var escape = require_escape();
440
- var readShebang = require_readShebang();
441
- var isWin = process.platform === "win32";
442
- var isExecutableRegExp = /\.(?:com|exe)$/i;
443
- var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
444
- function detectShebang(parsed) {
445
- parsed.file = resolveCommand(parsed);
446
- var shebang = parsed.file && readShebang(parsed.file);
447
- if (shebang) {
448
- parsed.args.unshift(parsed.file);
449
- parsed.command = shebang;
450
- return resolveCommand(parsed);
451
- }
452
- return parsed.file;
453
- }
454
- function parseNonShell(parsed) {
455
- if (!isWin) {
456
- return parsed;
457
- }
458
- var commandFile = detectShebang(parsed);
459
- var needsShell = !isExecutableRegExp.test(commandFile);
460
- if (parsed.options.forceShell || needsShell) {
461
- var needsDoubleEscapeMetaChars_1 = isCmdShimRegExp.test(commandFile);
462
- parsed.command = path2.normalize(parsed.command);
463
- parsed.command = escape.command(parsed.command);
464
- parsed.args = parsed.args.map(function(arg) {
465
- return escape.argument(arg, needsDoubleEscapeMetaChars_1);
466
- });
467
- var shellCommand = [parsed.command].concat(parsed.args).join(" ");
468
- parsed.args = ["/d", "/s", "/c", '"'.concat(shellCommand, '"')];
469
- parsed.command = process.env.comspec || "cmd.exe";
470
- parsed.options.windowsVerbatimArguments = true;
471
- }
472
- return parsed;
473
- }
474
- function parse(command, args, options) {
475
- if (args && !Array.isArray(args)) {
476
- options = args;
477
- args = null;
478
- }
479
- args = args ? args.slice(0) : [];
480
- options = Object.assign({}, options);
481
- var parsed = {
482
- command,
483
- args,
484
- options,
485
- file: void 0,
486
- original: {
487
- command,
488
- args
489
- }
490
- };
491
- return options.shell ? parsed : parseNonShell(parsed);
492
- }
493
- module2.exports = parse;
494
- }
495
- });
496
-
497
- // node_modules/cross-spawn/dist/spawn.js
498
- var require_spawn = __commonJS({
499
- "node_modules/cross-spawn/dist/spawn.js"(exports2) {
500
- "use strict";
501
- init_cjs_shims();
502
- var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) {
503
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
504
- if (ar || !(i in from)) {
505
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
506
- ar[i] = from[i];
507
- }
508
- }
509
- return to.concat(ar || Array.prototype.slice.call(from));
510
- };
511
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
512
- return mod && mod.__esModule ? mod : { "default": mod };
513
- };
514
- Object.defineProperty(exports2, "__esModule", { value: true });
515
- exports2.sync = exports2.async = exports2._parse = exports2._enoent = exports2.spawnAsync = exports2.spawnSync = exports2.spawn = void 0;
516
- var child_process_1 = __importDefault(require("child_process"));
517
- var enoent_1 = __importDefault(require_enoent());
518
- var parse_1 = __importDefault(require_parse());
519
- function spawn(command, args, options) {
520
- var parsed = (0, parse_1.default)(command, args, options);
521
- var spawned = child_process_1.default.spawn(parsed.command, parsed.args, parsed.options);
522
- enoent_1.default.hookChildProcess(spawned, parsed);
523
- return spawned;
524
- }
525
- exports2.spawn = spawn;
526
- function spawnSync(command, args, options) {
527
- var parsed = (0, parse_1.default)(command, args, options);
528
- var result = child_process_1.default.spawnSync(parsed.command, parsed.args, parsed.options);
529
- result.error = result.error || enoent_1.default.verifyENOENTSync(result.status, parsed);
530
- return result;
64
+ module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
65
+ function getArgs() {
66
+ return argv;
531
67
  }
532
- exports2.spawnSync = spawnSync;
533
- function spawnAsync2(command, args, options) {
534
- return new Promise(function(resolve) {
535
- var stdout = "";
536
- var stderr = "";
537
- var child = spawn(command, args, options);
538
- if (child.stdout && "on" in child.stdout) {
539
- child.stdout.setEncoding("utf8");
540
- child.stdout.on("data", function(data) {
541
- stdout += data;
542
- });
68
+ module2.exports.getArgs = getArgs;
69
+ function del(fullPath) {
70
+ if (fs.statSync(fullPath).isDirectory()) {
71
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
72
+ for (let i = 0; i < subdir.length; i++) {
73
+ del(subdir[i]);
543
74
  }
544
- if (child.stderr && "on" in child.stdout) {
545
- child.stderr.setEncoding("utf8");
546
- child.stderr.on("data", function(data) {
547
- stderr += data;
548
- });
75
+ } else {
76
+ try {
77
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
78
+ console.log("deleted", fullPath);
79
+ } catch (_) {
80
+ console.log("failed delete", fullPath);
549
81
  }
550
- child.on("close", function(code, signal) {
551
- resolve({
552
- stdout,
553
- stderr,
554
- error: code !== 0 ? __spreadArray(__spreadArray([command], args, true), ["dies with code", code, "signal", signal], false).join(" ") : null,
555
- output: "".concat(stdout, "\n\n").concat(stderr)
556
- });
557
- });
558
- });
559
- }
560
- exports2.spawnAsync = spawnAsync2;
561
- exports2._enoent = enoent_1.default;
562
- exports2._parse = parse_1.default;
563
- exports2.async = spawnAsync2;
564
- exports2.sync = spawnSync;
565
- }
566
- });
567
-
568
- // node_modules/cross-spawn/dist/index.js
569
- var require_dist = __commonJS({
570
- "node_modules/cross-spawn/dist/index.js"(exports2, module2) {
571
- "use strict";
572
- init_cjs_shims();
573
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
574
- if (k2 === void 0) k2 = k;
575
- var desc = Object.getOwnPropertyDescriptor(m, k);
576
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
577
- desc = { enumerable: true, get: function() {
578
- return m[k];
579
- } };
580
- }
581
- Object.defineProperty(o, k2, desc);
582
- } : function(o, m, k, k2) {
583
- if (k2 === void 0) k2 = k;
584
- o[k2] = m[k];
585
- });
586
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
587
- Object.defineProperty(o, "default", { enumerable: true, value: v });
588
- } : function(o, v) {
589
- o["default"] = v;
590
- });
591
- var __importStar = exports2 && exports2.__importStar || function(mod) {
592
- if (mod && mod.__esModule) return mod;
593
- var result = {};
594
- if (mod != null) {
595
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
596
82
  }
597
- __setModuleDefault(result, mod);
598
- return result;
599
- };
600
- var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
601
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
602
- };
603
- Object.defineProperty(exports2, "__esModule", { value: true });
604
- exports2._enoent = exports2._parse = exports2.spawnAsync = exports2.spawnSync = exports2.async = exports2.sync = exports2.spawn = void 0;
605
- var internalSpawn = __importStar(require_spawn());
606
- if (typeof module2 !== "undefined" && "exports" in module2) {
607
- module2.exports = internalSpawn.spawn;
608
- module2.exports.spawn = internalSpawn.spawn;
609
- module2.exports.sync = internalSpawn.spawnSync;
610
- module2.exports.async = internalSpawn.spawnAsync;
611
- module2.exports.spawnSync = internalSpawn.spawnSync;
612
- module2.exports.spawnAsync = internalSpawn.spawnAsync;
613
- module2.exports._parse = internalSpawn._parse;
614
- module2.exports._enoent = internalSpawn._enoent;
615
- }
616
- __exportStar(require_spawn(), exports2);
617
- exports2.spawn = internalSpawn.spawn;
618
- exports2.sync = internalSpawn.spawnSync;
619
- exports2.async = internalSpawn.spawnAsync;
620
- exports2.spawnSync = internalSpawn.spawnSync;
621
- exports2.spawnAsync = internalSpawn.spawnAsync;
622
- exports2._parse = internalSpawn._parse;
623
- exports2._enoent = internalSpawn._enoent;
624
- exports2.default = internalSpawn;
625
- }
626
- });
627
-
628
- // src/utils.js
629
- var require_utils = __commonJS({
630
- "src/utils.js"(exports2, module2) {
631
- init_cjs_shims();
632
- var { fs, path: path2 } = require("sbg-utility");
633
- var argv = require("minimist")(process.argv.slice(2));
634
- function getArgs() {
635
- return argv;
636
83
  }
84
+ module2.exports.del = del;
637
85
  function delStream(globStream) {
638
86
  globStream.stream().on("data", (result) => {
639
87
  const fullPath = path2.resolve(process.cwd(), result);
@@ -646,29 +94,52 @@ var require_utils = __commonJS({
646
94
  del(fullPath);
647
95
  });
648
96
  }
649
- function del(fullPath) {
650
- if (fs.statSync(fullPath).isDirectory()) {
651
- const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
652
- for (let i = 0; i < subdir.length; i++) {
653
- del(subdir[i]);
654
- }
655
- } else {
656
- try {
657
- fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
658
- console.log("deleted", fullPath);
659
- } catch (_) {
660
- console.log("failed delete", fullPath);
97
+ module2.exports.delStream = delStream;
98
+ function getFileTreeString(hashArray) {
99
+ const tree = {};
100
+ const hashMap = {};
101
+ for (const entry of hashArray) {
102
+ const [filePath, hash] = entry.split(" ");
103
+ hashMap[filePath] = hash;
104
+ const parts = filePath.split("/");
105
+ let current = tree;
106
+ for (let i = 0; i < parts.length; i++) {
107
+ const part = parts[i];
108
+ if (i === parts.length - 1) {
109
+ current[part] = null;
110
+ } else {
111
+ current[part] = current[part] || {};
112
+ current = current[part];
113
+ }
661
114
  }
662
115
  }
116
+ function printNode(node, prefix = "", parentPath = "") {
117
+ const keys = Object.keys(node).sort();
118
+ let lines = [];
119
+ keys.forEach((key, idx) => {
120
+ const isLast = idx === keys.length - 1;
121
+ const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
122
+ const currentPath = parentPath ? parentPath + "/" + key : key;
123
+ if (node[key] === null) {
124
+ lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
125
+ } else {
126
+ lines.push(prefix + branch + key + "/");
127
+ lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
128
+ }
129
+ });
130
+ return lines;
131
+ }
132
+ return printNode(tree, "", "").join("\n");
663
133
  }
134
+ module2.exports.getFileTreeString = getFileTreeString;
664
135
  var delay2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
665
- module2.exports = { del, delStream, getArgs, delay: delay2 };
136
+ module2.exports.delay = delay2;
666
137
  }
667
138
  });
668
139
 
669
140
  // src/git-purge.js
670
141
  init_cjs_shims();
671
- var { spawnAsync } = require_dist();
142
+ var { spawnAsync } = require("cross-spawn");
672
143
  var glob = require("glob");
673
144
  var path = require("path");
674
145
  var { delay } = require_utils();