binary-collections 2.0.3 → 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 +72 -0
- 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 +65 -0
- 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 +35 -0
- package/lib/utils.mjs +7 -0
- package/package.json +89 -32
- package/readme.md +41 -0
- package/src/ps/index.js +285 -0
- package/test/package.json +19 -0
- package/lib/del-nodemodules.js +0 -52
- package/lib/package-resolutions.json +0 -22
|
@@ -0,0 +1,359 @@
|
|
|
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
|
+
// src/ps/connected-domain.js
|
|
16
|
+
var require_connected_domain = __commonJS({
|
|
17
|
+
"src/ps/connected-domain.js"(exports2, module2) {
|
|
18
|
+
init_cjs_shims();
|
|
19
|
+
module2.exports = function(tdArray, indicator, hardlink) {
|
|
20
|
+
hardlink = hardlink || false;
|
|
21
|
+
if (!tdArray) {
|
|
22
|
+
throw new Error("tdArray must be provided");
|
|
23
|
+
}
|
|
24
|
+
if (!indicator) {
|
|
25
|
+
throw new Error("indicator must be provided");
|
|
26
|
+
}
|
|
27
|
+
tdArray = JSON.parse(JSON.stringify(tdArray));
|
|
28
|
+
var domains = {};
|
|
29
|
+
var domainUUID = 0;
|
|
30
|
+
var pointsHash = {};
|
|
31
|
+
tdArray.forEach(function(row, y) {
|
|
32
|
+
row.forEach(function(colItem, x) {
|
|
33
|
+
var identifier2 = indicator(colItem, x, y);
|
|
34
|
+
var neighbours = [];
|
|
35
|
+
if (tdArray[y - 1] && tdArray[y - 1][x] !== void 0) {
|
|
36
|
+
neighbours.push(pointsHash[x + "_" + (y - 1)]);
|
|
37
|
+
}
|
|
38
|
+
if (row[x - 1] !== void 0) {
|
|
39
|
+
neighbours.push(pointsHash[x - 1 + "_" + y]);
|
|
40
|
+
}
|
|
41
|
+
if (!hardlink) {
|
|
42
|
+
if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== void 0) {
|
|
43
|
+
neighbours.push(pointsHash[x - 1 + "_" + (y - 1)]);
|
|
44
|
+
}
|
|
45
|
+
if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== void 0) {
|
|
46
|
+
neighbours.push(pointsHash[x + 1 + "_" + (y - 1)]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (neighbours.length) {
|
|
50
|
+
var matched = false;
|
|
51
|
+
neighbours.forEach(function(neighbour) {
|
|
52
|
+
if (neighbour.identifier == identifier2) {
|
|
53
|
+
if (!matched) {
|
|
54
|
+
addPointToDomain(colItem, x, y, neighbour.domainId);
|
|
55
|
+
matched = true;
|
|
56
|
+
} else {
|
|
57
|
+
var colItemPoint = pointsHash[x + "_" + y];
|
|
58
|
+
if (neighbour.domainId != colItemPoint.domainId) {
|
|
59
|
+
mergeDomains(neighbour.domainId, colItemPoint.domainId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if (!matched) {
|
|
65
|
+
addNewDomain(colItem, x, y, identifier2);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
addNewDomain(colItem, x, y, identifier2);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var result = {
|
|
73
|
+
domains: [],
|
|
74
|
+
totalDomains: 0,
|
|
75
|
+
groupByIdentifier: {},
|
|
76
|
+
totalIdentifiers: 0
|
|
77
|
+
};
|
|
78
|
+
var domainId = null;
|
|
79
|
+
var identifier = null;
|
|
80
|
+
var domain = null;
|
|
81
|
+
for (domainId in domains) {
|
|
82
|
+
domain = domains[domainId];
|
|
83
|
+
domain.bounding = calculateBounding(domain.points);
|
|
84
|
+
identifier = domain.identifier;
|
|
85
|
+
result.domains.push(domain);
|
|
86
|
+
result.totalDomains++;
|
|
87
|
+
if (!(identifier in result.groupByIdentifier)) {
|
|
88
|
+
result.groupByIdentifier[identifier] = [];
|
|
89
|
+
result.totalIdentifiers++;
|
|
90
|
+
}
|
|
91
|
+
result.groupByIdentifier[identifier].push(domain);
|
|
92
|
+
}
|
|
93
|
+
function calculateBounding(points) {
|
|
94
|
+
var minX = null;
|
|
95
|
+
var minY = null;
|
|
96
|
+
var maxX = null;
|
|
97
|
+
var maxY = null;
|
|
98
|
+
points.forEach(function(point) {
|
|
99
|
+
if (minX === null || point.x < minX) {
|
|
100
|
+
minX = point.x;
|
|
101
|
+
}
|
|
102
|
+
if (minY === null || point.y < minY) {
|
|
103
|
+
minY = point.y;
|
|
104
|
+
}
|
|
105
|
+
if (maxX === null || point.x > maxX) {
|
|
106
|
+
maxX = point.x;
|
|
107
|
+
}
|
|
108
|
+
if (maxY === null || point.y > maxY) {
|
|
109
|
+
maxY = point.y;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var w = maxX - minX;
|
|
113
|
+
var h = maxY - minY;
|
|
114
|
+
return {
|
|
115
|
+
x: minX,
|
|
116
|
+
y: minY,
|
|
117
|
+
w,
|
|
118
|
+
h
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function addNewDomain(point, x, y, identifier2) {
|
|
122
|
+
var newDomain = {
|
|
123
|
+
identifier: identifier2,
|
|
124
|
+
domainId: ++domainUUID,
|
|
125
|
+
bounding: {},
|
|
126
|
+
points: []
|
|
127
|
+
};
|
|
128
|
+
var newPoint = {
|
|
129
|
+
value: point,
|
|
130
|
+
x,
|
|
131
|
+
y,
|
|
132
|
+
identifier: identifier2,
|
|
133
|
+
domainId: newDomain.domainId
|
|
134
|
+
};
|
|
135
|
+
pointsHash[x + "_" + y] = {
|
|
136
|
+
value: point,
|
|
137
|
+
identifier: identifier2,
|
|
138
|
+
domainId: newDomain.domainId
|
|
139
|
+
};
|
|
140
|
+
newDomain.points.push(newPoint);
|
|
141
|
+
domains[newDomain.domainId] = newDomain;
|
|
142
|
+
}
|
|
143
|
+
function addPointToDomain(point, x, y, domainId2) {
|
|
144
|
+
var domain2 = domains[domainId2];
|
|
145
|
+
var newPoint = {
|
|
146
|
+
value: point,
|
|
147
|
+
x,
|
|
148
|
+
y,
|
|
149
|
+
identifier: domain2.identifier,
|
|
150
|
+
domainId: domainId2
|
|
151
|
+
};
|
|
152
|
+
pointsHash[x + "_" + y] = {
|
|
153
|
+
value: point,
|
|
154
|
+
identifier: domain2.identifier,
|
|
155
|
+
domainId: domainId2
|
|
156
|
+
};
|
|
157
|
+
domain2.points.push(newPoint);
|
|
158
|
+
}
|
|
159
|
+
function mergeDomains(domainAId, domainBId) {
|
|
160
|
+
var domainA = domains[domainAId];
|
|
161
|
+
var domainB = domains[domainBId];
|
|
162
|
+
if (domainA.identifier == domainB.identifier) {
|
|
163
|
+
domainB.domainId = domainA.domainId;
|
|
164
|
+
domainB.points.forEach(function(point) {
|
|
165
|
+
point.domainId = domainA.domainId;
|
|
166
|
+
pointsHash[point.x + "_" + point.y].domainId = domainA.domainId;
|
|
167
|
+
});
|
|
168
|
+
domainA.points = domainA.points.concat(domainB.points);
|
|
169
|
+
delete domains[domainBId];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return result;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// src/ps/table-parser.js
|
|
178
|
+
init_cjs_shims();
|
|
179
|
+
var ConnectedDomain = require_connected_domain();
|
|
180
|
+
var EMPTY_EX = /\s/;
|
|
181
|
+
module.exports.parse = function(output) {
|
|
182
|
+
var linesTmp = output.split(/(\r\n)|(\n\r)|\n|\r/);
|
|
183
|
+
var lines = [];
|
|
184
|
+
var titleInfo = {};
|
|
185
|
+
var twoDimArray = [];
|
|
186
|
+
linesTmp.forEach(function(line) {
|
|
187
|
+
if (line && line.trim()) {
|
|
188
|
+
lines.push(line);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
lines.forEach(function(line, index) {
|
|
192
|
+
if (index == 0) {
|
|
193
|
+
var fields = line.split(/\s+/);
|
|
194
|
+
var currentIndex = 0;
|
|
195
|
+
fields.forEach(function(field, idx) {
|
|
196
|
+
if (field) {
|
|
197
|
+
var info = titleInfo[field] = {};
|
|
198
|
+
var indexBegin = line.indexOf(field, currentIndex);
|
|
199
|
+
var indexEnd = currentIndex = indexBegin + field.length;
|
|
200
|
+
if (idx == 0) {
|
|
201
|
+
info.titleBegin = 0;
|
|
202
|
+
} else {
|
|
203
|
+
info.titleBegin = indexBegin;
|
|
204
|
+
}
|
|
205
|
+
if (idx == fields.length - 1) {
|
|
206
|
+
info.titleEnd = line.length - 1;
|
|
207
|
+
} else {
|
|
208
|
+
info.titleEnd = indexEnd;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
twoDimArray[index - 1] = line.split("");
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
var connectedDomains = ConnectedDomain(
|
|
217
|
+
twoDimArray,
|
|
218
|
+
function(value) {
|
|
219
|
+
if (EMPTY_EX.test(value)) {
|
|
220
|
+
return -1;
|
|
221
|
+
} else {
|
|
222
|
+
return 1;
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
true
|
|
226
|
+
);
|
|
227
|
+
var valuesDomainsVerticalGroups = [];
|
|
228
|
+
connectedDomains.domains.sort(function(a, b) {
|
|
229
|
+
return a.bounding.x - b.bounding.x;
|
|
230
|
+
});
|
|
231
|
+
connectedDomains.domains.forEach(function(domain) {
|
|
232
|
+
if (domain.identifier === 1) {
|
|
233
|
+
var overlapped = false;
|
|
234
|
+
valuesDomainsVerticalGroups.forEach(function(group) {
|
|
235
|
+
var bounding = domain.bounding;
|
|
236
|
+
var left = bounding.x;
|
|
237
|
+
var right = bounding.x + bounding.w;
|
|
238
|
+
if (overlap(left, right, group.begin, group.end)) {
|
|
239
|
+
overlapped = true;
|
|
240
|
+
group.domains.push(domain);
|
|
241
|
+
group.begin = group.begin > left ? left : group.begin;
|
|
242
|
+
group.end = group.end < right ? right : group.end;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
if (!overlapped) {
|
|
246
|
+
valuesDomainsVerticalGroups.push({
|
|
247
|
+
begin: domain.bounding.x,
|
|
248
|
+
end: domain.bounding.x + domain.bounding.w,
|
|
249
|
+
domains: [domain]
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
valuesDomainsVerticalGroups.forEach(function(group) {
|
|
255
|
+
var title = null;
|
|
256
|
+
var info = null;
|
|
257
|
+
var overlapped = false;
|
|
258
|
+
var minimunLeftDistance = null;
|
|
259
|
+
var nearestLeftTitle = null;
|
|
260
|
+
var distance = null;
|
|
261
|
+
for (title in titleInfo) {
|
|
262
|
+
info = titleInfo[title];
|
|
263
|
+
if (group.begin > info.titleBegin) {
|
|
264
|
+
distance = group.begin - info.titleBegin;
|
|
265
|
+
if (!nearestLeftTitle || distance < minimunLeftDistance) {
|
|
266
|
+
nearestLeftTitle = title;
|
|
267
|
+
minimunLeftDistance = distance;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (overlap(group.begin, group.end, info.titleBegin, info.titleEnd)) {
|
|
271
|
+
overlapped = true;
|
|
272
|
+
info.titleBegin = info.titleBegin > group.begin ? group.begin : info.titleBegin;
|
|
273
|
+
info.titleEnd = info.titleEnd < group.end ? group.end : info.titleEnd;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (!overlapped && nearestLeftTitle) {
|
|
277
|
+
var nearestTitleField = titleInfo[nearestLeftTitle];
|
|
278
|
+
nearestTitleField.titleBegin = nearestTitleField.titleBegin > group.begin ? group.begin : nearestTitleField.titleBegin;
|
|
279
|
+
nearestTitleField.titleEnd = nearestTitleField.titleEnd < group.end ? group.end : nearestTitleField.titleEnd;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
var result = [];
|
|
283
|
+
lines.forEach(function(line, index) {
|
|
284
|
+
if (index > 0) {
|
|
285
|
+
var lineItem = {};
|
|
286
|
+
var title = null;
|
|
287
|
+
var info = null;
|
|
288
|
+
var value = null;
|
|
289
|
+
for (title in titleInfo) {
|
|
290
|
+
info = titleInfo[title];
|
|
291
|
+
value = line.substring(info.titleBegin, info.titleEnd + 1);
|
|
292
|
+
lineItem[title] = splitValue(value.trim());
|
|
293
|
+
}
|
|
294
|
+
result.push(lineItem);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
return result;
|
|
298
|
+
};
|
|
299
|
+
function overlap(begin1, end1, begin2, end2) {
|
|
300
|
+
return begin1 > begin2 && begin1 < end2 || // 2--1--2--1 or 2--1--1--2
|
|
301
|
+
end1 > begin2 && end1 < end2 || // 1--2--1--2 or 2--1--1--2
|
|
302
|
+
begin1 <= begin2 && end1 >= end2;
|
|
303
|
+
}
|
|
304
|
+
function splitValue(value) {
|
|
305
|
+
var match = value.match(/"/g);
|
|
306
|
+
if (!match || match.length == 1) {
|
|
307
|
+
return value.split(/\s+/);
|
|
308
|
+
} else {
|
|
309
|
+
var result = [];
|
|
310
|
+
var chunk = null;
|
|
311
|
+
var ifInWrappedChunk = false;
|
|
312
|
+
var ifInPureWrappedChunk = false;
|
|
313
|
+
var quotaCount = 0;
|
|
314
|
+
var maxQuotaCount = match.length % 2 == 0 ? match.length : match.length - 1;
|
|
315
|
+
var previousItem = null;
|
|
316
|
+
var values = value.split("");
|
|
317
|
+
values.forEach(function(item, index) {
|
|
318
|
+
if (item !== " ") {
|
|
319
|
+
if (item === '"') {
|
|
320
|
+
if (ifInWrappedChunk === false && quotaCount <= maxQuotaCount) {
|
|
321
|
+
ifInWrappedChunk = true;
|
|
322
|
+
quotaCount++;
|
|
323
|
+
if (previousItem === " " || previousItem === null) {
|
|
324
|
+
ifInPureWrappedChunk = true;
|
|
325
|
+
chunk = "";
|
|
326
|
+
} else {
|
|
327
|
+
chunk += item;
|
|
328
|
+
}
|
|
329
|
+
} else if (ifInWrappedChunk === true) {
|
|
330
|
+
ifInWrappedChunk = false;
|
|
331
|
+
quotaCount++;
|
|
332
|
+
if (ifInPureWrappedChunk === true) {
|
|
333
|
+
ifInPureWrappedChunk = false;
|
|
334
|
+
result.push(chunk);
|
|
335
|
+
chunk = null;
|
|
336
|
+
} else {
|
|
337
|
+
chunk += item;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} else if (ifInWrappedChunk === false && (previousItem === " " || previousItem === null)) {
|
|
341
|
+
chunk = item;
|
|
342
|
+
} else {
|
|
343
|
+
chunk += item;
|
|
344
|
+
}
|
|
345
|
+
} else if (ifInWrappedChunk) {
|
|
346
|
+
chunk += item;
|
|
347
|
+
} else if (chunk !== null) {
|
|
348
|
+
result.push(chunk);
|
|
349
|
+
chunk = null;
|
|
350
|
+
}
|
|
351
|
+
previousItem = item;
|
|
352
|
+
if (index == values.length - 1 && chunk !== null) {
|
|
353
|
+
result.push(chunk);
|
|
354
|
+
chunk = null;
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
return result;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_table_parser
|
|
4
|
+
} from "../chunk-GA4DDV65.mjs";
|
|
5
|
+
import "../chunk-M4IBUK4H.mjs";
|
|
6
|
+
import "../chunk-7MSZ52XC.mjs";
|
|
7
|
+
import "../chunk-AVDT32AY.mjs";
|
|
8
|
+
export default require_table_parser();
|
package/lib/utils.cjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/utils.js
|
|
2
|
+
var { fs, path } = require("sbg-utility");
|
|
3
|
+
var argv = require("minimist")(process.argv.slice(2));
|
|
4
|
+
function getArgs() {
|
|
5
|
+
return argv;
|
|
6
|
+
}
|
|
7
|
+
function delStream(globStream) {
|
|
8
|
+
globStream.stream().on("data", (result) => {
|
|
9
|
+
const fullPath = path.resolve(process.cwd(), result);
|
|
10
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
11
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
12
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
13
|
+
del(subdir[i]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
del(fullPath);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function del(fullPath) {
|
|
20
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
21
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
22
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
23
|
+
del(subdir[i]);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
try {
|
|
27
|
+
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
28
|
+
console.log("deleted", fullPath);
|
|
29
|
+
} catch (_) {
|
|
30
|
+
console.log("failed delete", fullPath);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
35
|
+
module.exports = { del, delStream, getArgs, delay };
|
package/lib/utils.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as minimist from 'minimist';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* delete file recursive
|
|
5
|
+
* @param {string} fullPath
|
|
6
|
+
*/
|
|
7
|
+
declare function del(fullPath: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* glob stream handler
|
|
10
|
+
* @param {glob.Glob} globStream
|
|
11
|
+
*/
|
|
12
|
+
declare function delStream(globStream: glob.Glob): void;
|
|
13
|
+
declare function getArgs(): minimist.ParsedArgs;
|
|
14
|
+
/**
|
|
15
|
+
* async delayed
|
|
16
|
+
* @param {number} ms
|
|
17
|
+
*/
|
|
18
|
+
declare function delay(ms: number): Promise<any>;
|
|
19
|
+
|
|
20
|
+
export { del, delStream, delay, getArgs };
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as minimist from 'minimist';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* delete file recursive
|
|
5
|
+
* @param {string} fullPath
|
|
6
|
+
*/
|
|
7
|
+
declare function del(fullPath: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* glob stream handler
|
|
10
|
+
* @param {glob.Glob} globStream
|
|
11
|
+
*/
|
|
12
|
+
declare function delStream(globStream: glob.Glob): void;
|
|
13
|
+
declare function getArgs(): minimist.ParsedArgs;
|
|
14
|
+
/**
|
|
15
|
+
* async delayed
|
|
16
|
+
* @param {number} ms
|
|
17
|
+
*/
|
|
18
|
+
declare function delay(ms: number): Promise<any>;
|
|
19
|
+
|
|
20
|
+
export { del, delStream, delay, getArgs };
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/utils.js
|
|
2
|
+
var { fs, path } = require("sbg-utility");
|
|
3
|
+
var argv = require("minimist")(process.argv.slice(2));
|
|
4
|
+
function getArgs() {
|
|
5
|
+
return argv;
|
|
6
|
+
}
|
|
7
|
+
function delStream(globStream) {
|
|
8
|
+
globStream.stream().on("data", (result) => {
|
|
9
|
+
const fullPath = path.resolve(process.cwd(), result);
|
|
10
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
11
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
12
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
13
|
+
del(subdir[i]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
del(fullPath);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function del(fullPath) {
|
|
20
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
21
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
22
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
23
|
+
del(subdir[i]);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
try {
|
|
27
|
+
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
28
|
+
console.log("deleted", fullPath);
|
|
29
|
+
} catch (_) {
|
|
30
|
+
console.log("failed delete", fullPath);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
35
|
+
module.exports = { del, delStream, getArgs, delay };
|
package/lib/utils.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,57 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "binary-collections",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.6",
|
|
4
|
+
"description": "Utility to clean any programming caches and more",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"bin",
|
|
8
8
|
"lib",
|
|
9
9
|
"index.js",
|
|
10
|
-
"!
|
|
10
|
+
"!test",
|
|
11
|
+
"package.json"
|
|
11
12
|
],
|
|
12
13
|
"directories": {
|
|
13
|
-
"lib": "lib"
|
|
14
|
-
"test": "test"
|
|
14
|
+
"lib": "lib"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"update:packer": "curl -L https://github.com/dimaslanjaka/nodejs-package-types/raw/main/packer.js > packer.js",
|
|
18
|
-
"build": "node
|
|
18
|
+
"build": "node build.tsup.js && npm run postbuild",
|
|
19
|
+
"postbuild": "node -r ts-node/register -r dotenv/config build.js && yarn run pack",
|
|
19
20
|
"test": "cd test && npm install -D file:../ &&",
|
|
20
21
|
"test:nrs": "npm test -- nrs build:**",
|
|
21
22
|
"pack": "node packer.js --yarn --filename=bin",
|
|
22
|
-
"update:ncu": "npx npm-check-updates -u -x jsdom,chalk,hexo,deepmerge-ts --enginesNode --root"
|
|
23
|
+
"update:ncu": "npx npm-check-updates -u -x jsdom,chalk,hexo,deepmerge-ts --enginesNode --root",
|
|
24
|
+
"clean": "rimraf lib"
|
|
23
25
|
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
|
|
26
|
+
"keywords": [
|
|
27
|
+
"cache",
|
|
28
|
+
"cleaner",
|
|
29
|
+
"utility"
|
|
30
|
+
],
|
|
31
|
+
"author": {
|
|
32
|
+
"email": "dimaslanjaka@gmail.com",
|
|
33
|
+
"name": "dimaslanjaka",
|
|
34
|
+
"url": "https://webmanajemen.com"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/dimaslanjaka/bin"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/dimaslanjaka/bin/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://www.webmanajemen.com/",
|
|
26
44
|
"license": "MIT",
|
|
27
45
|
"dependencies": {
|
|
28
|
-
"
|
|
46
|
+
"dotenv": "^16.4.5",
|
|
47
|
+
"execa": "^9.4.0",
|
|
29
48
|
"fs-extra": "^11.2.0",
|
|
30
|
-
"glob": "^
|
|
31
|
-
"minimatch": "^
|
|
49
|
+
"glob": "^11.0.0",
|
|
50
|
+
"minimatch": "^10.0.1",
|
|
32
51
|
"minimist": "^1.2.8",
|
|
33
|
-
"
|
|
52
|
+
"ps-node": "^0.1.6",
|
|
53
|
+
"remove": "^0.1.5",
|
|
54
|
+
"sbg-utility": "^1.1.8",
|
|
34
55
|
"upath": "^2.0.1",
|
|
35
|
-
"yaml": "^2.
|
|
56
|
+
"yaml": "^2.5.1",
|
|
57
|
+
"yarn": "^1.22.22"
|
|
36
58
|
},
|
|
37
|
-
"packageManager": "yarn@
|
|
59
|
+
"packageManager": "yarn@4.5.0",
|
|
38
60
|
"devDependencies": {
|
|
39
|
-
"@types/eslint": "^
|
|
61
|
+
"@types/eslint": "^9",
|
|
62
|
+
"@types/fs-extra": "^11.0.4",
|
|
40
63
|
"@types/minimist": "^1",
|
|
41
|
-
"@types/node": "^
|
|
64
|
+
"@types/node": "^22.7.4",
|
|
42
65
|
"@types/prettier": "^3",
|
|
66
|
+
"@types/ps-node": "^0",
|
|
43
67
|
"@types/yargs": "^17",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
45
|
-
"@typescript-eslint/parser": "^
|
|
46
|
-
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/
|
|
47
|
-
"
|
|
48
|
-
"eslint": "^8.56.0",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.8.0",
|
|
70
|
+
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
|
|
71
|
+
"eslint": "^9.11.1",
|
|
49
72
|
"eslint-config-prettier": "^9.1.0",
|
|
50
|
-
"eslint-plugin-prettier": "^5.1
|
|
73
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
51
74
|
"git-command-helper": "^2.0.2",
|
|
52
|
-
"
|
|
75
|
+
"globals": "^15.10.0",
|
|
76
|
+
"prettier": "^3.3.3",
|
|
77
|
+
"rimraf": "^6.0.1",
|
|
53
78
|
"ts-node": "^10.9.2",
|
|
54
|
-
"
|
|
79
|
+
"tsup": "^8.3.0",
|
|
80
|
+
"typescript": "^5.6.2"
|
|
55
81
|
},
|
|
56
82
|
"optionalDependencies": {
|
|
57
83
|
"ansi-colors": "^4.1.3"
|
|
@@ -59,29 +85,60 @@
|
|
|
59
85
|
"bin": {
|
|
60
86
|
"clean-nodemodule": "bin/clean-nodemodule",
|
|
61
87
|
"clean-nodemodules": "bin/clean-nodemodules",
|
|
62
|
-
"
|
|
88
|
+
"connected-domain-cjs": "lib/ps/connected-domain.cjs",
|
|
89
|
+
"connected-domain-mjs": "lib/ps/connected-domain.mjs",
|
|
90
|
+
"del-gradle": "lib/del-gradle.cjs",
|
|
91
|
+
"del-gradle-cjs": "lib/del-gradle.cjs",
|
|
92
|
+
"del-gradle-mjs": "lib/del-gradle.mjs",
|
|
93
|
+
"del-node-modules-cjs": "lib/del-node-modules.cjs",
|
|
94
|
+
"del-node-modules-mjs": "lib/del-node-modules.mjs",
|
|
95
|
+
"del-nodemodules": "lib/del-node-modules.cjs",
|
|
96
|
+
"del-ps": "lib/del-ps.cjs",
|
|
97
|
+
"del-ps-cjs": "lib/del-ps.cjs",
|
|
98
|
+
"del-ps-mjs": "lib/del-ps.mjs",
|
|
99
|
+
"del-yarn-caches-cjs": "lib/del-yarn-caches.cjs",
|
|
100
|
+
"del-yarn-caches-mjs": "lib/del-yarn-caches.mjs",
|
|
101
|
+
"del-yarncaches": "lib/del-yarn-caches.cjs",
|
|
63
102
|
"dev": "bin/dev",
|
|
64
103
|
"empty": "bin/empty",
|
|
65
|
-
"
|
|
104
|
+
"eslint-config-cjs": "eslint.config.cjs",
|
|
105
|
+
"find-node-modules-cjs": "lib/find-node-modules.cjs",
|
|
106
|
+
"find-node-modules-mjs": "lib/find-node-modules.mjs",
|
|
107
|
+
"find-nodemodules": "lib/find-node-modules.cjs",
|
|
66
108
|
"git-fix-encoding": "bin/git-fix-encoding",
|
|
67
109
|
"git-fix-encoding-cmd": "bin/git-fix-encoding.cmd",
|
|
110
|
+
"git-purge": "lib/git-purge.cjs",
|
|
111
|
+
"git-purge-cjs": "lib/git-purge.cjs",
|
|
112
|
+
"git-purge-mjs": "lib/git-purge.mjs",
|
|
68
113
|
"git-reduce-size": "bin/git-reduce-size",
|
|
114
|
+
"index-cjs": "lib/ps/index.cjs",
|
|
115
|
+
"index-mjs": "lib/ps/index.mjs",
|
|
116
|
+
"isWin-cjs": "lib/ps/isWin.cjs",
|
|
117
|
+
"isWin-mjs": "lib/ps/isWin.mjs",
|
|
69
118
|
"javakill-cmd": "bin/javakill.cmd",
|
|
70
119
|
"kill-process": "bin/kill-process",
|
|
71
120
|
"nodekill": "bin/nodekill",
|
|
72
121
|
"nodekill-cmd": "bin/nodekill.cmd",
|
|
73
122
|
"nodekill-ps1": "bin/nodekill.ps1",
|
|
74
|
-
"npm-run-series": "lib/npm-run-series.
|
|
75
|
-
"
|
|
123
|
+
"npm-run-series": "lib/npm-run-series.cjs",
|
|
124
|
+
"npm-run-series-cjs": "lib/npm-run-series.cjs",
|
|
125
|
+
"npm-run-series-mjs": "lib/npm-run-series.mjs",
|
|
126
|
+
"nrs": "lib/npm-run-series.cjs",
|
|
127
|
+
"package-resolutions-cjs": "lib/package-resolutions.cjs",
|
|
128
|
+
"package-resolutions-mjs": "lib/package-resolutions.mjs",
|
|
76
129
|
"prod": "bin/prod",
|
|
77
130
|
"rmfind": "bin/rmfind",
|
|
78
131
|
"rmpath": "bin/rmpath",
|
|
79
132
|
"rmx": "bin/rmx",
|
|
80
|
-
"run-s": "lib/npm-run-series.
|
|
81
|
-
"run-series": "lib/npm-run-series.
|
|
133
|
+
"run-s": "lib/npm-run-series.cjs",
|
|
134
|
+
"run-series": "lib/npm-run-series.cjs",
|
|
82
135
|
"submodule": "bin/submodule",
|
|
83
136
|
"submodule-install": "bin/submodule-install",
|
|
84
137
|
"submodule-remove": "bin/submodule-remove",
|
|
85
|
-
"submodule-token": "bin/submodule-token"
|
|
138
|
+
"submodule-token": "bin/submodule-token",
|
|
139
|
+
"table-parser-cjs": "lib/ps/table-parser.cjs",
|
|
140
|
+
"table-parser-mjs": "lib/ps/table-parser.mjs",
|
|
141
|
+
"utils-cjs": "lib/utils.cjs",
|
|
142
|
+
"utils-mjs": "lib/utils.mjs"
|
|
86
143
|
}
|
|
87
144
|
}
|