binary-collections 2.0.5 → 2.0.6
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.
- package/bin/bash-dummy +7 -2
- package/bin/clean-nodemodule +7 -2
- package/bin/clean-nodemodules +7 -2
- package/bin/dev +7 -2
- package/bin/empty +7 -2
- package/bin/git-fix-encoding +7 -2
- package/bin/git-reduce-size +7 -2
- package/bin/kill-process +7 -2
- package/bin/nodekill +7 -2
- package/bin/prod +7 -2
- package/bin/rmfind +7 -2
- package/bin/rmpath +7 -2
- package/bin/rmx +9 -3
- package/bin/submodule +13 -2
- package/bin/submodule-install +7 -2
- package/bin/submodule-remove +7 -2
- package/eslint.config.cjs +97 -0
- package/lib/chunk-7MSZ52XC.mjs +14 -0
- package/lib/chunk-AVDT32AY.mjs +20 -0
- package/lib/chunk-E75HJFJO.mjs +20 -0
- package/lib/chunk-GA4DDV65.mjs +202 -0
- package/lib/chunk-LPLPQBYP.mjs +53 -0
- package/lib/chunk-M4IBUK4H.mjs +173 -0
- package/lib/chunk-S4SJ7SDW.mjs +625 -0
- package/lib/del-gradle.cjs +72 -0
- package/lib/del-gradle.d.mts +2 -0
- package/lib/del-gradle.d.ts +2 -0
- package/lib/del-gradle.js +72 -0
- package/lib/del-gradle.mjs +28 -0
- package/lib/del-node-modules.cjs +72 -0
- package/lib/del-node-modules.d.mts +2 -0
- package/lib/del-node-modules.d.ts +2 -0
- package/lib/del-node-modules.js +63 -10
- package/lib/del-node-modules.mjs +28 -0
- package/lib/del-ps.cjs +706 -0
- package/lib/del-ps.d.mts +2 -0
- package/lib/del-ps.d.ts +2 -0
- package/lib/del-ps.js +706 -0
- package/lib/del-ps.mjs +46 -0
- package/lib/del-yarn-caches.cjs +65 -0
- package/lib/del-yarn-caches.d.mts +2 -0
- package/lib/del-yarn-caches.d.ts +2 -0
- package/lib/del-yarn-caches.js +60 -6
- package/lib/del-yarn-caches.mjs +21 -0
- package/lib/find-node-modules.cjs +12 -0
- package/lib/find-node-modules.d.mts +2 -0
- package/lib/find-node-modules.d.ts +2 -0
- package/lib/find-node-modules.js +6 -7
- package/lib/find-node-modules.mjs +21 -0
- package/lib/git-purge.cjs +704 -0
- package/lib/git-purge.d.mts +2 -0
- package/lib/git-purge.d.ts +2 -0
- package/lib/git-purge.js +704 -0
- package/lib/git-purge.mjs +50 -0
- package/lib/index.cjs +2 -0
- package/lib/index.d.mts +2 -0
- package/lib/index.d.ts +2 -0
- package/{index.js → lib/index.js} +1 -0
- package/lib/index.mjs +9 -0
- package/lib/npm-run-series.cjs +61 -0
- package/lib/npm-run-series.d.mts +1 -0
- package/lib/npm-run-series.d.ts +1 -0
- package/lib/npm-run-series.js +37 -20
- package/lib/npm-run-series.mjs +47 -0
- package/lib/package-resolutions.cjs +28 -0
- package/lib/package-resolutions.d.mts +25 -0
- package/lib/package-resolutions.d.ts +25 -0
- package/lib/package-resolutions.js +28 -0
- package/lib/package-resolutions.mjs +31 -0
- package/lib/ps/connected-domain.cjs +156 -0
- package/lib/ps/connected-domain.d.mts +3 -0
- package/lib/ps/connected-domain.d.ts +3 -0
- package/lib/ps/connected-domain.js +156 -0
- package/lib/ps/connected-domain.mjs +7 -0
- package/lib/ps/index.cjs +555 -0
- package/lib/ps/index.d.cjs +17 -0
- package/lib/ps/index.d.d.mts +26 -0
- package/lib/ps/index.d.d.ts +26 -0
- package/lib/ps/index.d.js +17 -0
- package/lib/ps/index.d.mjs +8 -0
- package/lib/ps/index.d.mts +26 -0
- package/lib/ps/index.d.ts +26 -0
- package/lib/ps/index.js +555 -0
- package/lib/ps/index.mjs +203 -0
- package/lib/ps/isWin.cjs +3 -0
- package/lib/ps/isWin.d.mts +3 -0
- package/lib/ps/isWin.d.ts +3 -0
- package/lib/ps/isWin.js +3 -0
- package/lib/ps/isWin.mjs +7 -0
- package/lib/ps/table-parser.cjs +359 -0
- package/lib/ps/table-parser.d.mts +3 -0
- package/lib/ps/table-parser.d.ts +3 -0
- package/lib/ps/table-parser.js +359 -0
- package/lib/ps/table-parser.mjs +8 -0
- package/lib/utils.cjs +35 -0
- package/lib/utils.d.mts +20 -0
- package/lib/utils.d.ts +20 -0
- package/lib/utils.js +22 -23
- package/lib/utils.mjs +7 -0
- package/package.json +76 -32
- package/readme.md +23 -0
- package/src/ps/index.js +285 -0
- package/test/package.json +19 -0
- package/lib/package-resolutions.json +0 -22
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
5
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
6
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// node_modules/tsup/assets/cjs_shims.js
|
|
10
|
+
var init_cjs_shims = __esm({
|
|
11
|
+
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
12
|
+
}
|
|
13
|
+
});
|
|
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) {
|
|
144
|
+
init_cjs_shims();
|
|
145
|
+
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) {
|
|
184
|
+
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;
|
|
248
|
+
}
|
|
249
|
+
found.push(withExt);
|
|
250
|
+
}
|
|
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
|
+
});
|
|
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);
|
|
343
|
+
}
|
|
344
|
+
return resolved;
|
|
345
|
+
}
|
|
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");
|
|
371
|
+
}
|
|
372
|
+
return arg;
|
|
373
|
+
}
|
|
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;
|
|
531
|
+
}
|
|
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
|
+
});
|
|
543
|
+
}
|
|
544
|
+
if (child.stderr && "on" in child.stdout) {
|
|
545
|
+
child.stderr.setEncoding("utf8");
|
|
546
|
+
child.stderr.on("data", function(data) {
|
|
547
|
+
stderr += data;
|
|
548
|
+
});
|
|
549
|
+
}
|
|
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
|
+
}
|
|
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
|
+
}
|
|
637
|
+
function delStream(globStream) {
|
|
638
|
+
globStream.stream().on("data", (result) => {
|
|
639
|
+
const fullPath = path2.resolve(process.cwd(), result);
|
|
640
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
641
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
642
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
643
|
+
del(subdir[i]);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
del(fullPath);
|
|
647
|
+
});
|
|
648
|
+
}
|
|
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);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
var delay2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
665
|
+
module2.exports = { del, delStream, getArgs, delay: delay2 };
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
// src/git-purge.js
|
|
670
|
+
init_cjs_shims();
|
|
671
|
+
var { spawnAsync } = require_dist();
|
|
672
|
+
var glob = require("glob");
|
|
673
|
+
var path = require("path");
|
|
674
|
+
var { delay } = require_utils();
|
|
675
|
+
var dirs = [];
|
|
676
|
+
var fetchDirs = (pattern, callback) => {
|
|
677
|
+
const globStream = new glob.Glob(pattern, {
|
|
678
|
+
withFileTypes: false,
|
|
679
|
+
cwd: process.cwd(),
|
|
680
|
+
ignore: ["**/node_modules/**", "**/vendor/**"]
|
|
681
|
+
});
|
|
682
|
+
globStream.stream().on("data", (result) => {
|
|
683
|
+
const fullPath = path.resolve(process.cwd(), result);
|
|
684
|
+
if (typeof callback == "function") callback(fullPath);
|
|
685
|
+
const base = path.dirname(fullPath);
|
|
686
|
+
if (!dirs.includes(base)) dirs.push(base);
|
|
687
|
+
start();
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
var running = false;
|
|
691
|
+
async function start() {
|
|
692
|
+
if (running) return;
|
|
693
|
+
while (dirs.length > 0) {
|
|
694
|
+
running = true;
|
|
695
|
+
const cwd = dirs.shift();
|
|
696
|
+
console.log("pruning reflog", cwd);
|
|
697
|
+
await spawnAsync("git", ["reflog", "expire", "--expire=all", "--all"], { cwd, stdio: "pipe", shell: true }).catch(
|
|
698
|
+
(e) => console.log("failed prune reflog", e.message)
|
|
699
|
+
);
|
|
700
|
+
await delay(3);
|
|
701
|
+
running = false;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
fetchDirs("**/.git");
|