@andersbakken/fisk 4.0.28 → 4.0.30
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/builder/VM_runtime.js +254 -238
- package/builder/fisk-builder.js +6991 -6803
- package/daemon/fisk-daemon.js +363 -349
- package/monitor/fisk-monitor.js +369 -352
- package/package.json +9 -8
- package/scheduler/fisk-scheduler.js +1071 -783
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var fs$
|
|
4
|
+
var fs$o = require('fs');
|
|
5
5
|
var assert$1 = require('assert');
|
|
6
6
|
var require$$0$3 = require('constants');
|
|
7
7
|
var require$$0$4 = require('stream');
|
|
8
8
|
var require$$4$1 = require('util');
|
|
9
|
-
var path$
|
|
9
|
+
var path$k = require('path');
|
|
10
10
|
var require$$1$1 = require('os');
|
|
11
11
|
var child_process = require('child_process');
|
|
12
12
|
var require$$0$5 = require('events');
|
|
@@ -26,12 +26,12 @@ var posix = require('posix');
|
|
|
26
26
|
|
|
27
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
28
|
|
|
29
|
-
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$
|
|
29
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$o);
|
|
30
30
|
var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert$1);
|
|
31
31
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
|
|
32
32
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
|
|
33
33
|
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4$1);
|
|
34
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$
|
|
34
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$k);
|
|
35
35
|
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
36
36
|
var child_process__default = /*#__PURE__*/_interopDefaultLegacy(child_process);
|
|
37
37
|
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
|
|
@@ -88,20 +88,10 @@ class Database {
|
|
|
88
88
|
records = {};
|
|
89
89
|
}
|
|
90
90
|
records[key] = value;
|
|
91
|
-
fs__default["default"].writeFile(this.path + ".tmp", JSON.stringify(records) + "\n", (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
fs__default["default"].rename(this.path + ".tmp", this.path, (err) => {
|
|
97
|
-
if (err) {
|
|
98
|
-
reject(new Error(`Failed to rename ${this.path}.tmp to ${this.path} ${err}`));
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
resolve();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
91
|
+
fs__default["default"].writeFile(this.path + ".tmp", JSON.stringify(records) + "\n", () => {
|
|
92
|
+
fs__default["default"].rename(this.path + ".tmp", this.path, () => {
|
|
93
|
+
resolve();
|
|
94
|
+
});
|
|
105
95
|
this.finishedOperation();
|
|
106
96
|
});
|
|
107
97
|
})
|
|
@@ -139,9 +129,9 @@ class Database {
|
|
|
139
129
|
try {
|
|
140
130
|
resolve(JSON.parse(data));
|
|
141
131
|
}
|
|
142
|
-
catch (
|
|
132
|
+
catch (error) {
|
|
143
133
|
fs__default["default"].renameSync(this.path, this.path + ".error");
|
|
144
|
-
reject(new Error(`Failed to parse JSON from file: ${this.path} ${
|
|
134
|
+
reject(new Error(`Failed to parse JSON from file: ${this.path} ${error.message}`));
|
|
145
135
|
}
|
|
146
136
|
}
|
|
147
137
|
}
|
|
@@ -205,12 +195,12 @@ class Environment {
|
|
|
205
195
|
}
|
|
206
196
|
console.log("Created environment", JSON.stringify(this), originalPath);
|
|
207
197
|
}
|
|
208
|
-
toString() {
|
|
209
|
-
return JSON.stringify(this, null, 4);
|
|
210
|
-
}
|
|
211
198
|
get file() {
|
|
212
199
|
return `${this.hash}_${this.system}.tar.gz`;
|
|
213
200
|
}
|
|
201
|
+
toString() {
|
|
202
|
+
return JSON.stringify(this, null, 4);
|
|
203
|
+
}
|
|
214
204
|
canRun(system) {
|
|
215
205
|
switch (system) {
|
|
216
206
|
case "Linux i686":
|
|
@@ -241,7 +231,7 @@ var lib$3 = {
|
|
|
241
231
|
set exports(v){ libExports$1 = v; },
|
|
242
232
|
};
|
|
243
233
|
|
|
244
|
-
var fs$
|
|
234
|
+
var fs$n = {};
|
|
245
235
|
|
|
246
236
|
var universalify = {};
|
|
247
237
|
|
|
@@ -766,7 +756,7 @@ function clone$1 (obj) {
|
|
|
766
756
|
return copy
|
|
767
757
|
}
|
|
768
758
|
|
|
769
|
-
var fs$
|
|
759
|
+
var fs$m = fs__default["default"];
|
|
770
760
|
var polyfills = polyfills$1;
|
|
771
761
|
var legacy = legacyStreams;
|
|
772
762
|
var clone = clone_1;
|
|
@@ -808,18 +798,18 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
|
808
798
|
};
|
|
809
799
|
|
|
810
800
|
// Once time initialization
|
|
811
|
-
if (!fs$
|
|
801
|
+
if (!fs$m[gracefulQueue]) {
|
|
812
802
|
// This queue can be shared by multiple loaded instances
|
|
813
803
|
var queue = commonjsGlobal[gracefulQueue] || [];
|
|
814
|
-
publishQueue(fs$
|
|
804
|
+
publishQueue(fs$m, queue);
|
|
815
805
|
|
|
816
806
|
// Patch fs.close/closeSync to shared queue version, because we need
|
|
817
807
|
// to retry() whenever a close happens *anywhere* in the program.
|
|
818
808
|
// This is essential when multiple graceful-fs instances are
|
|
819
809
|
// in play at the same time.
|
|
820
|
-
fs$
|
|
810
|
+
fs$m.close = (function (fs$close) {
|
|
821
811
|
function close (fd, cb) {
|
|
822
|
-
return fs$close.call(fs$
|
|
812
|
+
return fs$close.call(fs$m, fd, function (err) {
|
|
823
813
|
// This function uses the graceful-fs shared queue
|
|
824
814
|
if (!err) {
|
|
825
815
|
resetQueue();
|
|
@@ -834,12 +824,12 @@ if (!fs$n[gracefulQueue]) {
|
|
|
834
824
|
value: fs$close
|
|
835
825
|
});
|
|
836
826
|
return close
|
|
837
|
-
})(fs$
|
|
827
|
+
})(fs$m.close);
|
|
838
828
|
|
|
839
|
-
fs$
|
|
829
|
+
fs$m.closeSync = (function (fs$closeSync) {
|
|
840
830
|
function closeSync (fd) {
|
|
841
831
|
// This function uses the graceful-fs shared queue
|
|
842
|
-
fs$closeSync.apply(fs$
|
|
832
|
+
fs$closeSync.apply(fs$m, arguments);
|
|
843
833
|
resetQueue();
|
|
844
834
|
}
|
|
845
835
|
|
|
@@ -847,24 +837,24 @@ if (!fs$n[gracefulQueue]) {
|
|
|
847
837
|
value: fs$closeSync
|
|
848
838
|
});
|
|
849
839
|
return closeSync
|
|
850
|
-
})(fs$
|
|
840
|
+
})(fs$m.closeSync);
|
|
851
841
|
|
|
852
842
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
853
843
|
process.on('exit', function() {
|
|
854
|
-
debug$7(fs$
|
|
855
|
-
assert__default["default"].equal(fs$
|
|
844
|
+
debug$7(fs$m[gracefulQueue]);
|
|
845
|
+
assert__default["default"].equal(fs$m[gracefulQueue].length, 0);
|
|
856
846
|
});
|
|
857
847
|
}
|
|
858
848
|
}
|
|
859
849
|
|
|
860
850
|
if (!commonjsGlobal[gracefulQueue]) {
|
|
861
|
-
publishQueue(commonjsGlobal, fs$
|
|
851
|
+
publishQueue(commonjsGlobal, fs$m[gracefulQueue]);
|
|
862
852
|
}
|
|
863
853
|
|
|
864
|
-
var gracefulFs = patch(clone(fs$
|
|
865
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
866
|
-
gracefulFs = patch(fs$
|
|
867
|
-
fs$
|
|
854
|
+
var gracefulFs = patch(clone(fs$m));
|
|
855
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$m.__patched) {
|
|
856
|
+
gracefulFs = patch(fs$m);
|
|
857
|
+
fs$m.__patched = true;
|
|
868
858
|
}
|
|
869
859
|
|
|
870
860
|
function patch (fs) {
|
|
@@ -1138,7 +1128,7 @@ function patch (fs) {
|
|
|
1138
1128
|
|
|
1139
1129
|
function enqueue (elem) {
|
|
1140
1130
|
debug$7('ENQUEUE', elem[0].name, elem[1]);
|
|
1141
|
-
fs$
|
|
1131
|
+
fs$m[gracefulQueue].push(elem);
|
|
1142
1132
|
retry();
|
|
1143
1133
|
}
|
|
1144
1134
|
|
|
@@ -1150,12 +1140,12 @@ var retryTimer;
|
|
|
1150
1140
|
// delay between attempts so that we'll retry these jobs sooner
|
|
1151
1141
|
function resetQueue () {
|
|
1152
1142
|
var now = Date.now();
|
|
1153
|
-
for (var i = 0; i < fs$
|
|
1143
|
+
for (var i = 0; i < fs$m[gracefulQueue].length; ++i) {
|
|
1154
1144
|
// entries that are only a length of 2 are from an older version, don't
|
|
1155
1145
|
// bother modifying those since they'll be retried anyway.
|
|
1156
|
-
if (fs$
|
|
1157
|
-
fs$
|
|
1158
|
-
fs$
|
|
1146
|
+
if (fs$m[gracefulQueue][i].length > 2) {
|
|
1147
|
+
fs$m[gracefulQueue][i][3] = now; // startTime
|
|
1148
|
+
fs$m[gracefulQueue][i][4] = now; // lastTime
|
|
1159
1149
|
}
|
|
1160
1150
|
}
|
|
1161
1151
|
// call retry to make sure we're actively processing the queue
|
|
@@ -1167,10 +1157,10 @@ function retry () {
|
|
|
1167
1157
|
clearTimeout(retryTimer);
|
|
1168
1158
|
retryTimer = undefined;
|
|
1169
1159
|
|
|
1170
|
-
if (fs$
|
|
1160
|
+
if (fs$m[gracefulQueue].length === 0)
|
|
1171
1161
|
return
|
|
1172
1162
|
|
|
1173
|
-
var elem = fs$
|
|
1163
|
+
var elem = fs$m[gracefulQueue].shift();
|
|
1174
1164
|
var fn = elem[0];
|
|
1175
1165
|
var args = elem[1];
|
|
1176
1166
|
// these items may be unset if they were added by an older graceful-fs
|
|
@@ -1205,7 +1195,7 @@ function retry () {
|
|
|
1205
1195
|
} else {
|
|
1206
1196
|
// if we can't do this job yet, push it to the end of the queue
|
|
1207
1197
|
// and let the next iteration check again
|
|
1208
|
-
fs$
|
|
1198
|
+
fs$m[gracefulQueue].push(elem);
|
|
1209
1199
|
}
|
|
1210
1200
|
}
|
|
1211
1201
|
|
|
@@ -1318,13 +1308,13 @@ function retry () {
|
|
|
1318
1308
|
});
|
|
1319
1309
|
})
|
|
1320
1310
|
};
|
|
1321
|
-
} (fs$
|
|
1311
|
+
} (fs$n));
|
|
1322
1312
|
|
|
1323
|
-
const path$
|
|
1313
|
+
const path$j = path__default["default"];
|
|
1324
1314
|
|
|
1325
1315
|
// get drive on windows
|
|
1326
1316
|
function getRootPath (p) {
|
|
1327
|
-
p = path$
|
|
1317
|
+
p = path$j.normalize(path$j.resolve(p)).split(path$j.sep);
|
|
1328
1318
|
if (p.length > 0) return p[0]
|
|
1329
1319
|
return null
|
|
1330
1320
|
}
|
|
@@ -1344,8 +1334,8 @@ var win32 = {
|
|
|
1344
1334
|
invalidWin32Path: invalidWin32Path$2
|
|
1345
1335
|
};
|
|
1346
1336
|
|
|
1347
|
-
const fs$
|
|
1348
|
-
const path$
|
|
1337
|
+
const fs$l = gracefulFs;
|
|
1338
|
+
const path$i = path__default["default"];
|
|
1349
1339
|
const invalidWin32Path$1 = win32.invalidWin32Path;
|
|
1350
1340
|
|
|
1351
1341
|
const o777$1 = parseInt('0777', 8);
|
|
@@ -1365,7 +1355,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
1365
1355
|
}
|
|
1366
1356
|
|
|
1367
1357
|
let mode = opts.mode;
|
|
1368
|
-
const xfs = opts.fs || fs$
|
|
1358
|
+
const xfs = opts.fs || fs$l;
|
|
1369
1359
|
|
|
1370
1360
|
if (mode === undefined) {
|
|
1371
1361
|
mode = o777$1 & (~process.umask());
|
|
@@ -1373,7 +1363,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
1373
1363
|
if (!made) made = null;
|
|
1374
1364
|
|
|
1375
1365
|
callback = callback || function () {};
|
|
1376
|
-
p = path$
|
|
1366
|
+
p = path$i.resolve(p);
|
|
1377
1367
|
|
|
1378
1368
|
xfs.mkdir(p, mode, er => {
|
|
1379
1369
|
if (!er) {
|
|
@@ -1382,8 +1372,8 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
1382
1372
|
}
|
|
1383
1373
|
switch (er.code) {
|
|
1384
1374
|
case 'ENOENT':
|
|
1385
|
-
if (path$
|
|
1386
|
-
mkdirs$2(path$
|
|
1375
|
+
if (path$i.dirname(p) === p) return callback(er)
|
|
1376
|
+
mkdirs$2(path$i.dirname(p), opts, (er, made) => {
|
|
1387
1377
|
if (er) callback(er, made);
|
|
1388
1378
|
else mkdirs$2(p, opts, callback, made);
|
|
1389
1379
|
});
|
|
@@ -1406,8 +1396,8 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
1406
1396
|
|
|
1407
1397
|
var mkdirs_1$1 = mkdirs$2;
|
|
1408
1398
|
|
|
1409
|
-
const fs$
|
|
1410
|
-
const path$
|
|
1399
|
+
const fs$k = gracefulFs;
|
|
1400
|
+
const path$h = path__default["default"];
|
|
1411
1401
|
const invalidWin32Path = win32.invalidWin32Path;
|
|
1412
1402
|
|
|
1413
1403
|
const o777 = parseInt('0777', 8);
|
|
@@ -1418,7 +1408,7 @@ function mkdirsSync$2 (p, opts, made) {
|
|
|
1418
1408
|
}
|
|
1419
1409
|
|
|
1420
1410
|
let mode = opts.mode;
|
|
1421
|
-
const xfs = opts.fs || fs$
|
|
1411
|
+
const xfs = opts.fs || fs$k;
|
|
1422
1412
|
|
|
1423
1413
|
if (process.platform === 'win32' && invalidWin32Path(p)) {
|
|
1424
1414
|
const errInval = new Error(p + ' contains invalid WIN32 path characters.');
|
|
@@ -1431,15 +1421,15 @@ function mkdirsSync$2 (p, opts, made) {
|
|
|
1431
1421
|
}
|
|
1432
1422
|
if (!made) made = null;
|
|
1433
1423
|
|
|
1434
|
-
p = path$
|
|
1424
|
+
p = path$h.resolve(p);
|
|
1435
1425
|
|
|
1436
1426
|
try {
|
|
1437
1427
|
xfs.mkdirSync(p, mode);
|
|
1438
1428
|
made = made || p;
|
|
1439
1429
|
} catch (err0) {
|
|
1440
1430
|
if (err0.code === 'ENOENT') {
|
|
1441
|
-
if (path$
|
|
1442
|
-
made = mkdirsSync$2(path$
|
|
1431
|
+
if (path$h.dirname(p) === p) throw err0
|
|
1432
|
+
made = mkdirsSync$2(path$h.dirname(p), opts, made);
|
|
1443
1433
|
mkdirsSync$2(p, opts, made);
|
|
1444
1434
|
} else {
|
|
1445
1435
|
// In the case of any other error, just see if there's a dir there
|
|
@@ -1473,39 +1463,39 @@ var mkdirs_1 = {
|
|
|
1473
1463
|
ensureDirSync: mkdirsSync$1
|
|
1474
1464
|
};
|
|
1475
1465
|
|
|
1476
|
-
const fs$
|
|
1466
|
+
const fs$j = gracefulFs;
|
|
1477
1467
|
const os = require$$1__default["default"];
|
|
1478
|
-
const path$
|
|
1468
|
+
const path$g = path__default["default"];
|
|
1479
1469
|
|
|
1480
1470
|
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
|
1481
1471
|
function hasMillisResSync () {
|
|
1482
|
-
let tmpfile = path$
|
|
1483
|
-
tmpfile = path$
|
|
1472
|
+
let tmpfile = path$g.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2));
|
|
1473
|
+
tmpfile = path$g.join(os.tmpdir(), tmpfile);
|
|
1484
1474
|
|
|
1485
1475
|
// 550 millis past UNIX epoch
|
|
1486
1476
|
const d = new Date(1435410243862);
|
|
1487
|
-
fs$
|
|
1488
|
-
const fd = fs$
|
|
1489
|
-
fs$
|
|
1490
|
-
fs$
|
|
1491
|
-
return fs$
|
|
1477
|
+
fs$j.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141');
|
|
1478
|
+
const fd = fs$j.openSync(tmpfile, 'r+');
|
|
1479
|
+
fs$j.futimesSync(fd, d, d);
|
|
1480
|
+
fs$j.closeSync(fd);
|
|
1481
|
+
return fs$j.statSync(tmpfile).mtime > 1435410243000
|
|
1492
1482
|
}
|
|
1493
1483
|
|
|
1494
1484
|
function hasMillisRes (callback) {
|
|
1495
|
-
let tmpfile = path$
|
|
1496
|
-
tmpfile = path$
|
|
1485
|
+
let tmpfile = path$g.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2));
|
|
1486
|
+
tmpfile = path$g.join(os.tmpdir(), tmpfile);
|
|
1497
1487
|
|
|
1498
1488
|
// 550 millis past UNIX epoch
|
|
1499
1489
|
const d = new Date(1435410243862);
|
|
1500
|
-
fs$
|
|
1490
|
+
fs$j.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => {
|
|
1501
1491
|
if (err) return callback(err)
|
|
1502
|
-
fs$
|
|
1492
|
+
fs$j.open(tmpfile, 'r+', (err, fd) => {
|
|
1503
1493
|
if (err) return callback(err)
|
|
1504
|
-
fs$
|
|
1494
|
+
fs$j.futimes(fd, d, d, err => {
|
|
1505
1495
|
if (err) return callback(err)
|
|
1506
|
-
fs$
|
|
1496
|
+
fs$j.close(fd, err => {
|
|
1507
1497
|
if (err) return callback(err)
|
|
1508
|
-
fs$
|
|
1498
|
+
fs$j.stat(tmpfile, (err, stats) => {
|
|
1509
1499
|
if (err) return callback(err)
|
|
1510
1500
|
callback(null, stats.mtime > 1435410243000);
|
|
1511
1501
|
});
|
|
@@ -1527,10 +1517,10 @@ function timeRemoveMillis (timestamp) {
|
|
|
1527
1517
|
|
|
1528
1518
|
function utimesMillis (path, atime, mtime, callback) {
|
|
1529
1519
|
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
1530
|
-
fs$
|
|
1520
|
+
fs$j.open(path, 'r+', (err, fd) => {
|
|
1531
1521
|
if (err) return callback(err)
|
|
1532
|
-
fs$
|
|
1533
|
-
fs$
|
|
1522
|
+
fs$j.futimes(fd, atime, mtime, futimesErr => {
|
|
1523
|
+
fs$j.close(fd, closeErr => {
|
|
1534
1524
|
if (callback) callback(futimesErr || closeErr);
|
|
1535
1525
|
});
|
|
1536
1526
|
});
|
|
@@ -1538,9 +1528,9 @@ function utimesMillis (path, atime, mtime, callback) {
|
|
|
1538
1528
|
}
|
|
1539
1529
|
|
|
1540
1530
|
function utimesMillisSync (path, atime, mtime) {
|
|
1541
|
-
const fd = fs$
|
|
1542
|
-
fs$
|
|
1543
|
-
return fs$
|
|
1531
|
+
const fd = fs$j.openSync(path, 'r+');
|
|
1532
|
+
fs$j.futimesSync(fd, atime, mtime);
|
|
1533
|
+
return fs$j.closeSync(fd)
|
|
1544
1534
|
}
|
|
1545
1535
|
|
|
1546
1536
|
var utimes$1 = {
|
|
@@ -1563,8 +1553,8 @@ var buffer$1 = function (size) {
|
|
|
1563
1553
|
return new Buffer(size)
|
|
1564
1554
|
};
|
|
1565
1555
|
|
|
1566
|
-
const fs$
|
|
1567
|
-
const path$
|
|
1556
|
+
const fs$i = gracefulFs;
|
|
1557
|
+
const path$f = path__default["default"];
|
|
1568
1558
|
const mkdirpSync$1 = mkdirs_1.mkdirsSync;
|
|
1569
1559
|
const utimesSync = utimes$1.utimesMillisSync;
|
|
1570
1560
|
|
|
@@ -1590,8 +1580,8 @@ function copySync$2 (src, dest, opts) {
|
|
|
1590
1580
|
|
|
1591
1581
|
if (opts.filter && !opts.filter(src, dest)) return
|
|
1592
1582
|
|
|
1593
|
-
const destParent = path$
|
|
1594
|
-
if (!fs$
|
|
1583
|
+
const destParent = path$f.dirname(dest);
|
|
1584
|
+
if (!fs$i.existsSync(destParent)) mkdirpSync$1(destParent);
|
|
1595
1585
|
return startCopy$1(resolvedDest, src, dest, opts)
|
|
1596
1586
|
}
|
|
1597
1587
|
|
|
@@ -1601,7 +1591,7 @@ function startCopy$1 (resolvedDest, src, dest, opts) {
|
|
|
1601
1591
|
}
|
|
1602
1592
|
|
|
1603
1593
|
function getStats$1 (resolvedDest, src, dest, opts) {
|
|
1604
|
-
const statSync = opts.dereference ? fs$
|
|
1594
|
+
const statSync = opts.dereference ? fs$i.statSync : fs$i.lstatSync;
|
|
1605
1595
|
const st = statSync(src);
|
|
1606
1596
|
|
|
1607
1597
|
if (st.isDirectory()) return onDir$1(st, resolvedDest, src, dest, opts)
|
|
@@ -1619,7 +1609,7 @@ function onFile$1 (srcStat, resolvedDest, src, dest, opts) {
|
|
|
1619
1609
|
|
|
1620
1610
|
function mayCopyFile$1 (srcStat, src, dest, opts) {
|
|
1621
1611
|
if (opts.overwrite) {
|
|
1622
|
-
fs$
|
|
1612
|
+
fs$i.unlinkSync(dest);
|
|
1623
1613
|
return copyFile$1(srcStat, src, dest, opts)
|
|
1624
1614
|
} else if (opts.errorOnExist) {
|
|
1625
1615
|
throw new Error(`'${dest}' already exists`)
|
|
@@ -1627,9 +1617,9 @@ function mayCopyFile$1 (srcStat, src, dest, opts) {
|
|
|
1627
1617
|
}
|
|
1628
1618
|
|
|
1629
1619
|
function copyFile$1 (srcStat, src, dest, opts) {
|
|
1630
|
-
if (typeof fs$
|
|
1631
|
-
fs$
|
|
1632
|
-
fs$
|
|
1620
|
+
if (typeof fs$i.copyFileSync === 'function') {
|
|
1621
|
+
fs$i.copyFileSync(src, dest);
|
|
1622
|
+
fs$i.chmodSync(dest, srcStat.mode);
|
|
1633
1623
|
if (opts.preserveTimestamps) {
|
|
1634
1624
|
return utimesSync(dest, srcStat.atime, srcStat.mtime)
|
|
1635
1625
|
}
|
|
@@ -1642,20 +1632,20 @@ function copyFileFallback$1 (srcStat, src, dest, opts) {
|
|
|
1642
1632
|
const BUF_LENGTH = 64 * 1024;
|
|
1643
1633
|
const _buff = buffer$1(BUF_LENGTH);
|
|
1644
1634
|
|
|
1645
|
-
const fdr = fs$
|
|
1646
|
-
const fdw = fs$
|
|
1635
|
+
const fdr = fs$i.openSync(src, 'r');
|
|
1636
|
+
const fdw = fs$i.openSync(dest, 'w', srcStat.mode);
|
|
1647
1637
|
let pos = 0;
|
|
1648
1638
|
|
|
1649
1639
|
while (pos < srcStat.size) {
|
|
1650
|
-
const bytesRead = fs$
|
|
1651
|
-
fs$
|
|
1640
|
+
const bytesRead = fs$i.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
|
|
1641
|
+
fs$i.writeSync(fdw, _buff, 0, bytesRead);
|
|
1652
1642
|
pos += bytesRead;
|
|
1653
1643
|
}
|
|
1654
1644
|
|
|
1655
|
-
if (opts.preserveTimestamps) fs$
|
|
1645
|
+
if (opts.preserveTimestamps) fs$i.futimesSync(fdw, srcStat.atime, srcStat.mtime);
|
|
1656
1646
|
|
|
1657
|
-
fs$
|
|
1658
|
-
fs$
|
|
1647
|
+
fs$i.closeSync(fdr);
|
|
1648
|
+
fs$i.closeSync(fdw);
|
|
1659
1649
|
}
|
|
1660
1650
|
|
|
1661
1651
|
function onDir$1 (srcStat, resolvedDest, src, dest, opts) {
|
|
@@ -1674,50 +1664,50 @@ function onDir$1 (srcStat, resolvedDest, src, dest, opts) {
|
|
|
1674
1664
|
}
|
|
1675
1665
|
|
|
1676
1666
|
function mayCopyDir$1 (src, dest, opts) {
|
|
1677
|
-
if (!fs$
|
|
1667
|
+
if (!fs$i.statSync(dest).isDirectory()) {
|
|
1678
1668
|
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
1679
1669
|
}
|
|
1680
1670
|
return copyDir$1(src, dest, opts)
|
|
1681
1671
|
}
|
|
1682
1672
|
|
|
1683
1673
|
function mkDirAndCopy$1 (srcStat, src, dest, opts) {
|
|
1684
|
-
fs$
|
|
1685
|
-
fs$
|
|
1674
|
+
fs$i.mkdirSync(dest, srcStat.mode);
|
|
1675
|
+
fs$i.chmodSync(dest, srcStat.mode);
|
|
1686
1676
|
return copyDir$1(src, dest, opts)
|
|
1687
1677
|
}
|
|
1688
1678
|
|
|
1689
1679
|
function copyDir$1 (src, dest, opts) {
|
|
1690
|
-
fs$
|
|
1680
|
+
fs$i.readdirSync(src).forEach(item => copyDirItem$1(item, src, dest, opts));
|
|
1691
1681
|
}
|
|
1692
1682
|
|
|
1693
1683
|
function copyDirItem$1 (item, src, dest, opts) {
|
|
1694
|
-
const srcItem = path$
|
|
1695
|
-
const destItem = path$
|
|
1684
|
+
const srcItem = path$f.join(src, item);
|
|
1685
|
+
const destItem = path$f.join(dest, item);
|
|
1696
1686
|
const resolvedDest = checkPaths$1(srcItem, destItem);
|
|
1697
1687
|
return startCopy$1(resolvedDest, srcItem, destItem, opts)
|
|
1698
1688
|
}
|
|
1699
1689
|
|
|
1700
1690
|
function onLink$1 (resolvedDest, src, dest, opts) {
|
|
1701
|
-
let resolvedSrc = fs$
|
|
1691
|
+
let resolvedSrc = fs$i.readlinkSync(src);
|
|
1702
1692
|
|
|
1703
1693
|
if (opts.dereference) {
|
|
1704
|
-
resolvedSrc = path$
|
|
1694
|
+
resolvedSrc = path$f.resolve(process.cwd(), resolvedSrc);
|
|
1705
1695
|
}
|
|
1706
1696
|
|
|
1707
1697
|
if (resolvedDest === notExist$1 || resolvedDest === existsReg$1) {
|
|
1708
1698
|
// if dest already exists, fs throws error anyway,
|
|
1709
1699
|
// so no need to guard against it here.
|
|
1710
|
-
return fs$
|
|
1700
|
+
return fs$i.symlinkSync(resolvedSrc, dest)
|
|
1711
1701
|
} else {
|
|
1712
1702
|
if (opts.dereference) {
|
|
1713
|
-
resolvedDest = path$
|
|
1703
|
+
resolvedDest = path$f.resolve(process.cwd(), resolvedDest);
|
|
1714
1704
|
}
|
|
1715
1705
|
if (pathsAreIdentical$1(resolvedSrc, resolvedDest)) return
|
|
1716
1706
|
|
|
1717
1707
|
// prevent copy if src is a subdir of dest since unlinking
|
|
1718
1708
|
// dest in this case would result in removing src contents
|
|
1719
1709
|
// and therefore a broken symlink would be created.
|
|
1720
|
-
if (fs$
|
|
1710
|
+
if (fs$i.statSync(dest).isDirectory() && isSrcSubdir$3(resolvedDest, resolvedSrc)) {
|
|
1721
1711
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
|
|
1722
1712
|
}
|
|
1723
1713
|
return copyLink$1(resolvedSrc, dest)
|
|
@@ -1725,15 +1715,15 @@ function onLink$1 (resolvedDest, src, dest, opts) {
|
|
|
1725
1715
|
}
|
|
1726
1716
|
|
|
1727
1717
|
function copyLink$1 (resolvedSrc, dest) {
|
|
1728
|
-
fs$
|
|
1729
|
-
return fs$
|
|
1718
|
+
fs$i.unlinkSync(dest);
|
|
1719
|
+
return fs$i.symlinkSync(resolvedSrc, dest)
|
|
1730
1720
|
}
|
|
1731
1721
|
|
|
1732
1722
|
// return true if dest is a subdir of src, otherwise false.
|
|
1733
1723
|
// extract dest base dir and check if that is the same as src basename.
|
|
1734
1724
|
function isSrcSubdir$3 (src, dest) {
|
|
1735
|
-
const srcArray = path$
|
|
1736
|
-
const destArray = path$
|
|
1725
|
+
const srcArray = path$f.resolve(src).split(path$f.sep);
|
|
1726
|
+
const destArray = path$f.resolve(dest).split(path$f.sep);
|
|
1737
1727
|
|
|
1738
1728
|
return srcArray.reduce((acc, current, i) => {
|
|
1739
1729
|
return acc && destArray[i] === current
|
|
@@ -1744,7 +1734,7 @@ function isSrcSubdir$3 (src, dest) {
|
|
|
1744
1734
|
function checkDest$1 (dest) {
|
|
1745
1735
|
let resolvedPath;
|
|
1746
1736
|
try {
|
|
1747
|
-
resolvedPath = fs$
|
|
1737
|
+
resolvedPath = fs$i.readlinkSync(dest);
|
|
1748
1738
|
} catch (err) {
|
|
1749
1739
|
if (err.code === 'ENOENT') return notExist$1
|
|
1750
1740
|
|
|
@@ -1758,8 +1748,8 @@ function checkDest$1 (dest) {
|
|
|
1758
1748
|
|
|
1759
1749
|
function pathsAreIdentical$1 (src, dest) {
|
|
1760
1750
|
const os = process.platform;
|
|
1761
|
-
const resolvedSrc = path$
|
|
1762
|
-
const resolvedDest = path$
|
|
1751
|
+
const resolvedSrc = path$f.resolve(src);
|
|
1752
|
+
const resolvedDest = path$f.resolve(dest);
|
|
1763
1753
|
// case-insensitive paths
|
|
1764
1754
|
if (os === 'darwin' || os === 'win32') {
|
|
1765
1755
|
return resolvedSrc.toLowerCase() === resolvedDest.toLowerCase()
|
|
@@ -1786,19 +1776,19 @@ var copySync$1 = {
|
|
|
1786
1776
|
};
|
|
1787
1777
|
|
|
1788
1778
|
const u$a = universalify.fromPromise;
|
|
1789
|
-
const fs$
|
|
1779
|
+
const fs$h = fs$n;
|
|
1790
1780
|
|
|
1791
1781
|
function pathExists$8 (path) {
|
|
1792
|
-
return fs$
|
|
1782
|
+
return fs$h.access(path).then(() => true).catch(() => false)
|
|
1793
1783
|
}
|
|
1794
1784
|
|
|
1795
1785
|
var pathExists_1 = {
|
|
1796
1786
|
pathExists: u$a(pathExists$8),
|
|
1797
|
-
pathExistsSync: fs$
|
|
1787
|
+
pathExistsSync: fs$h.existsSync
|
|
1798
1788
|
};
|
|
1799
1789
|
|
|
1800
|
-
const fs$
|
|
1801
|
-
const path$
|
|
1790
|
+
const fs$g = gracefulFs;
|
|
1791
|
+
const path$e = path__default["default"];
|
|
1802
1792
|
const mkdirp$1 = mkdirs_1.mkdirs;
|
|
1803
1793
|
const pathExists$7 = pathExists_1.pathExists;
|
|
1804
1794
|
const utimes = utimes$1.utimesMillis;
|
|
@@ -1834,7 +1824,7 @@ function copy$2 (src, dest, opts, cb) {
|
|
|
1834
1824
|
}
|
|
1835
1825
|
|
|
1836
1826
|
function checkParentDir (resolvedDest, src, dest, opts, cb) {
|
|
1837
|
-
const destParent = path$
|
|
1827
|
+
const destParent = path$e.dirname(dest);
|
|
1838
1828
|
pathExists$7(destParent, (err, dirExists) => {
|
|
1839
1829
|
if (err) return cb(err)
|
|
1840
1830
|
if (dirExists) return startCopy(resolvedDest, src, dest, opts, cb)
|
|
@@ -1861,7 +1851,7 @@ function handleFilter (onInclude, resolvedDest, src, dest, opts, cb) {
|
|
|
1861
1851
|
}
|
|
1862
1852
|
|
|
1863
1853
|
function getStats (resolvedDest, src, dest, opts, cb) {
|
|
1864
|
-
const stat = opts.dereference ? fs$
|
|
1854
|
+
const stat = opts.dereference ? fs$g.stat : fs$g.lstat;
|
|
1865
1855
|
stat(src, (err, st) => {
|
|
1866
1856
|
if (err) return cb(err)
|
|
1867
1857
|
|
|
@@ -1881,7 +1871,7 @@ function onFile (srcStat, resolvedDest, src, dest, opts, cb) {
|
|
|
1881
1871
|
|
|
1882
1872
|
function mayCopyFile (srcStat, src, dest, opts, cb) {
|
|
1883
1873
|
if (opts.overwrite) {
|
|
1884
|
-
fs$
|
|
1874
|
+
fs$g.unlink(dest, err => {
|
|
1885
1875
|
if (err) return cb(err)
|
|
1886
1876
|
return copyFile(srcStat, src, dest, opts, cb)
|
|
1887
1877
|
});
|
|
@@ -1891,8 +1881,8 @@ function mayCopyFile (srcStat, src, dest, opts, cb) {
|
|
|
1891
1881
|
}
|
|
1892
1882
|
|
|
1893
1883
|
function copyFile (srcStat, src, dest, opts, cb) {
|
|
1894
|
-
if (typeof fs$
|
|
1895
|
-
return fs$
|
|
1884
|
+
if (typeof fs$g.copyFile === 'function') {
|
|
1885
|
+
return fs$g.copyFile(src, dest, err => {
|
|
1896
1886
|
if (err) return cb(err)
|
|
1897
1887
|
return setDestModeAndTimestamps(srcStat, dest, opts, cb)
|
|
1898
1888
|
})
|
|
@@ -1901,9 +1891,9 @@ function copyFile (srcStat, src, dest, opts, cb) {
|
|
|
1901
1891
|
}
|
|
1902
1892
|
|
|
1903
1893
|
function copyFileFallback (srcStat, src, dest, opts, cb) {
|
|
1904
|
-
const rs = fs$
|
|
1894
|
+
const rs = fs$g.createReadStream(src);
|
|
1905
1895
|
rs.on('error', err => cb(err)).once('open', () => {
|
|
1906
|
-
const ws = fs$
|
|
1896
|
+
const ws = fs$g.createWriteStream(dest, { mode: srcStat.mode });
|
|
1907
1897
|
ws.on('error', err => cb(err))
|
|
1908
1898
|
.on('open', () => rs.pipe(ws))
|
|
1909
1899
|
.once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb));
|
|
@@ -1911,7 +1901,7 @@ function copyFileFallback (srcStat, src, dest, opts, cb) {
|
|
|
1911
1901
|
}
|
|
1912
1902
|
|
|
1913
1903
|
function setDestModeAndTimestamps (srcStat, dest, opts, cb) {
|
|
1914
|
-
fs$
|
|
1904
|
+
fs$g.chmod(dest, srcStat.mode, err => {
|
|
1915
1905
|
if (err) return cb(err)
|
|
1916
1906
|
if (opts.preserveTimestamps) {
|
|
1917
1907
|
return utimes(dest, srcStat.atime, srcStat.mtime, cb)
|
|
@@ -1936,7 +1926,7 @@ function onDir (srcStat, resolvedDest, src, dest, opts, cb) {
|
|
|
1936
1926
|
}
|
|
1937
1927
|
|
|
1938
1928
|
function mayCopyDir (src, dest, opts, cb) {
|
|
1939
|
-
fs$
|
|
1929
|
+
fs$g.stat(dest, (err, st) => {
|
|
1940
1930
|
if (err) return cb(err)
|
|
1941
1931
|
if (!st.isDirectory()) {
|
|
1942
1932
|
return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`))
|
|
@@ -1946,9 +1936,9 @@ function mayCopyDir (src, dest, opts, cb) {
|
|
|
1946
1936
|
}
|
|
1947
1937
|
|
|
1948
1938
|
function mkDirAndCopy (srcStat, src, dest, opts, cb) {
|
|
1949
|
-
fs$
|
|
1939
|
+
fs$g.mkdir(dest, srcStat.mode, err => {
|
|
1950
1940
|
if (err) return cb(err)
|
|
1951
|
-
fs$
|
|
1941
|
+
fs$g.chmod(dest, srcStat.mode, err => {
|
|
1952
1942
|
if (err) return cb(err)
|
|
1953
1943
|
return copyDir(src, dest, opts, cb)
|
|
1954
1944
|
});
|
|
@@ -1956,7 +1946,7 @@ function mkDirAndCopy (srcStat, src, dest, opts, cb) {
|
|
|
1956
1946
|
}
|
|
1957
1947
|
|
|
1958
1948
|
function copyDir (src, dest, opts, cb) {
|
|
1959
|
-
fs$
|
|
1949
|
+
fs$g.readdir(src, (err, items) => {
|
|
1960
1950
|
if (err) return cb(err)
|
|
1961
1951
|
return copyDirItems(items, src, dest, opts, cb)
|
|
1962
1952
|
});
|
|
@@ -1969,8 +1959,8 @@ function copyDirItems (items, src, dest, opts, cb) {
|
|
|
1969
1959
|
}
|
|
1970
1960
|
|
|
1971
1961
|
function copyDirItem (items, item, src, dest, opts, cb) {
|
|
1972
|
-
const srcItem = path$
|
|
1973
|
-
const destItem = path$
|
|
1962
|
+
const srcItem = path$e.join(src, item);
|
|
1963
|
+
const destItem = path$e.join(dest, item);
|
|
1974
1964
|
checkPaths(srcItem, destItem, (err, resolvedDest) => {
|
|
1975
1965
|
if (err) return cb(err)
|
|
1976
1966
|
startCopy(resolvedDest, srcItem, destItem, opts, err => {
|
|
@@ -1981,27 +1971,27 @@ function copyDirItem (items, item, src, dest, opts, cb) {
|
|
|
1981
1971
|
}
|
|
1982
1972
|
|
|
1983
1973
|
function onLink (resolvedDest, src, dest, opts, cb) {
|
|
1984
|
-
fs$
|
|
1974
|
+
fs$g.readlink(src, (err, resolvedSrc) => {
|
|
1985
1975
|
if (err) return cb(err)
|
|
1986
1976
|
|
|
1987
1977
|
if (opts.dereference) {
|
|
1988
|
-
resolvedSrc = path$
|
|
1978
|
+
resolvedSrc = path$e.resolve(process.cwd(), resolvedSrc);
|
|
1989
1979
|
}
|
|
1990
1980
|
|
|
1991
1981
|
if (resolvedDest === notExist || resolvedDest === existsReg) {
|
|
1992
1982
|
// if dest already exists, fs throws error anyway,
|
|
1993
1983
|
// so no need to guard against it here.
|
|
1994
|
-
return fs$
|
|
1984
|
+
return fs$g.symlink(resolvedSrc, dest, cb)
|
|
1995
1985
|
} else {
|
|
1996
1986
|
if (opts.dereference) {
|
|
1997
|
-
resolvedDest = path$
|
|
1987
|
+
resolvedDest = path$e.resolve(process.cwd(), resolvedDest);
|
|
1998
1988
|
}
|
|
1999
1989
|
if (pathsAreIdentical(resolvedSrc, resolvedDest)) return cb()
|
|
2000
1990
|
|
|
2001
1991
|
// prevent copy if src is a subdir of dest since unlinking
|
|
2002
1992
|
// dest in this case would result in removing src contents
|
|
2003
1993
|
// and therefore a broken symlink would be created.
|
|
2004
|
-
fs$
|
|
1994
|
+
fs$g.stat(dest, (err, st) => {
|
|
2005
1995
|
if (err) return cb(err)
|
|
2006
1996
|
if (st.isDirectory() && isSrcSubdir$2(resolvedDest, resolvedSrc)) {
|
|
2007
1997
|
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
|
|
@@ -2013,17 +2003,17 @@ function onLink (resolvedDest, src, dest, opts, cb) {
|
|
|
2013
2003
|
}
|
|
2014
2004
|
|
|
2015
2005
|
function copyLink (resolvedSrc, dest, cb) {
|
|
2016
|
-
fs$
|
|
2006
|
+
fs$g.unlink(dest, err => {
|
|
2017
2007
|
if (err) return cb(err)
|
|
2018
|
-
return fs$
|
|
2008
|
+
return fs$g.symlink(resolvedSrc, dest, cb)
|
|
2019
2009
|
});
|
|
2020
2010
|
}
|
|
2021
2011
|
|
|
2022
2012
|
// return true if dest is a subdir of src, otherwise false.
|
|
2023
2013
|
// extract dest base dir and check if that is the same as src basename.
|
|
2024
2014
|
function isSrcSubdir$2 (src, dest) {
|
|
2025
|
-
const srcArray = path$
|
|
2026
|
-
const destArray = path$
|
|
2015
|
+
const srcArray = path$e.resolve(src).split(path$e.sep);
|
|
2016
|
+
const destArray = path$e.resolve(dest).split(path$e.sep);
|
|
2027
2017
|
|
|
2028
2018
|
return srcArray.reduce((acc, current, i) => {
|
|
2029
2019
|
return acc && destArray[i] === current
|
|
@@ -2032,7 +2022,7 @@ function isSrcSubdir$2 (src, dest) {
|
|
|
2032
2022
|
|
|
2033
2023
|
// check if dest exists and is a symlink.
|
|
2034
2024
|
function checkDest (dest, cb) {
|
|
2035
|
-
fs$
|
|
2025
|
+
fs$g.readlink(dest, (err, resolvedPath) => {
|
|
2036
2026
|
if (err) {
|
|
2037
2027
|
if (err.code === 'ENOENT') return cb(null, notExist)
|
|
2038
2028
|
|
|
@@ -2047,8 +2037,8 @@ function checkDest (dest, cb) {
|
|
|
2047
2037
|
|
|
2048
2038
|
function pathsAreIdentical (src, dest) {
|
|
2049
2039
|
const os = process.platform;
|
|
2050
|
-
const resolvedSrc = path$
|
|
2051
|
-
const resolvedDest = path$
|
|
2040
|
+
const resolvedSrc = path$e.resolve(src);
|
|
2041
|
+
const resolvedDest = path$e.resolve(dest);
|
|
2052
2042
|
// case-insensitive paths
|
|
2053
2043
|
if (os === 'darwin' || os === 'win32') {
|
|
2054
2044
|
return resolvedSrc.toLowerCase() === resolvedDest.toLowerCase()
|
|
@@ -2077,8 +2067,8 @@ var copy$1 = {
|
|
|
2077
2067
|
copy: u$9(copy_1)
|
|
2078
2068
|
};
|
|
2079
2069
|
|
|
2080
|
-
const fs$
|
|
2081
|
-
const path$
|
|
2070
|
+
const fs$f = gracefulFs;
|
|
2071
|
+
const path$d = path__default["default"];
|
|
2082
2072
|
const assert = assert__default["default"];
|
|
2083
2073
|
|
|
2084
2074
|
const isWindows = (process.platform === 'win32');
|
|
@@ -2093,9 +2083,9 @@ function defaults (options) {
|
|
|
2093
2083
|
'readdir'
|
|
2094
2084
|
];
|
|
2095
2085
|
methods.forEach(m => {
|
|
2096
|
-
options[m] = options[m] || fs$
|
|
2086
|
+
options[m] = options[m] || fs$f[m];
|
|
2097
2087
|
m = m + 'Sync';
|
|
2098
|
-
options[m] = options[m] || fs$
|
|
2088
|
+
options[m] = options[m] || fs$f[m];
|
|
2099
2089
|
});
|
|
2100
2090
|
|
|
2101
2091
|
options.maxBusyTries = options.maxBusyTries || 3;
|
|
@@ -2283,7 +2273,7 @@ function rmkids (p, options, cb) {
|
|
|
2283
2273
|
if (n === 0) return options.rmdir(p, cb)
|
|
2284
2274
|
|
|
2285
2275
|
files.forEach(f => {
|
|
2286
|
-
rimraf$1(path$
|
|
2276
|
+
rimraf$1(path$d.join(p, f), options, er => {
|
|
2287
2277
|
if (errState) {
|
|
2288
2278
|
return
|
|
2289
2279
|
}
|
|
@@ -2365,7 +2355,7 @@ function rmdirSync (p, options, originalEr) {
|
|
|
2365
2355
|
function rmkidsSync (p, options) {
|
|
2366
2356
|
assert(p);
|
|
2367
2357
|
assert(options);
|
|
2368
|
-
options.readdirSync(p).forEach(f => rimrafSync(path$
|
|
2358
|
+
options.readdirSync(p).forEach(f => rimrafSync(path$d.join(p, f), options));
|
|
2369
2359
|
|
|
2370
2360
|
// We only end up here once we got ENOTEMPTY at least once, and
|
|
2371
2361
|
// at this point, we are guaranteed to have removed all the kids.
|
|
@@ -2399,17 +2389,17 @@ var remove$2 = {
|
|
|
2399
2389
|
};
|
|
2400
2390
|
|
|
2401
2391
|
const u$7 = universalify.fromCallback;
|
|
2402
|
-
const fs$
|
|
2403
|
-
const path$
|
|
2392
|
+
const fs$e = fs__default["default"];
|
|
2393
|
+
const path$c = path__default["default"];
|
|
2404
2394
|
const mkdir$5 = mkdirs_1;
|
|
2405
2395
|
const remove$1 = remove$2;
|
|
2406
2396
|
|
|
2407
2397
|
const emptyDir = u$7(function emptyDir (dir, callback) {
|
|
2408
2398
|
callback = callback || function () {};
|
|
2409
|
-
fs$
|
|
2399
|
+
fs$e.readdir(dir, (err, items) => {
|
|
2410
2400
|
if (err) return mkdir$5.mkdirs(dir, callback)
|
|
2411
2401
|
|
|
2412
|
-
items = items.map(item => path$
|
|
2402
|
+
items = items.map(item => path$c.join(dir, item));
|
|
2413
2403
|
|
|
2414
2404
|
deleteItem();
|
|
2415
2405
|
|
|
@@ -2427,13 +2417,13 @@ const emptyDir = u$7(function emptyDir (dir, callback) {
|
|
|
2427
2417
|
function emptyDirSync (dir) {
|
|
2428
2418
|
let items;
|
|
2429
2419
|
try {
|
|
2430
|
-
items = fs$
|
|
2420
|
+
items = fs$e.readdirSync(dir);
|
|
2431
2421
|
} catch (err) {
|
|
2432
2422
|
return mkdir$5.mkdirsSync(dir)
|
|
2433
2423
|
}
|
|
2434
2424
|
|
|
2435
2425
|
items.forEach(item => {
|
|
2436
|
-
item = path$
|
|
2426
|
+
item = path$c.join(dir, item);
|
|
2437
2427
|
remove$1.removeSync(item);
|
|
2438
2428
|
});
|
|
2439
2429
|
}
|
|
@@ -2446,22 +2436,22 @@ var empty = {
|
|
|
2446
2436
|
};
|
|
2447
2437
|
|
|
2448
2438
|
const u$6 = universalify.fromCallback;
|
|
2449
|
-
const path$
|
|
2450
|
-
const fs$
|
|
2439
|
+
const path$b = path__default["default"];
|
|
2440
|
+
const fs$d = gracefulFs;
|
|
2451
2441
|
const mkdir$4 = mkdirs_1;
|
|
2452
2442
|
const pathExists$6 = pathExists_1.pathExists;
|
|
2453
2443
|
|
|
2454
2444
|
function createFile$1 (file, callback) {
|
|
2455
2445
|
function makeFile () {
|
|
2456
|
-
fs$
|
|
2446
|
+
fs$d.writeFile(file, '', err => {
|
|
2457
2447
|
if (err) return callback(err)
|
|
2458
2448
|
callback();
|
|
2459
2449
|
});
|
|
2460
2450
|
}
|
|
2461
2451
|
|
|
2462
|
-
fs$
|
|
2452
|
+
fs$d.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
|
|
2463
2453
|
if (!err && stats.isFile()) return callback()
|
|
2464
|
-
const dir = path$
|
|
2454
|
+
const dir = path$b.dirname(file);
|
|
2465
2455
|
pathExists$6(dir, (err, dirExists) => {
|
|
2466
2456
|
if (err) return callback(err)
|
|
2467
2457
|
if (dirExists) return makeFile()
|
|
@@ -2476,16 +2466,16 @@ function createFile$1 (file, callback) {
|
|
|
2476
2466
|
function createFileSync$1 (file) {
|
|
2477
2467
|
let stats;
|
|
2478
2468
|
try {
|
|
2479
|
-
stats = fs$
|
|
2469
|
+
stats = fs$d.statSync(file);
|
|
2480
2470
|
} catch (e) {}
|
|
2481
2471
|
if (stats && stats.isFile()) return
|
|
2482
2472
|
|
|
2483
|
-
const dir = path$
|
|
2484
|
-
if (!fs$
|
|
2473
|
+
const dir = path$b.dirname(file);
|
|
2474
|
+
if (!fs$d.existsSync(dir)) {
|
|
2485
2475
|
mkdir$4.mkdirsSync(dir);
|
|
2486
2476
|
}
|
|
2487
2477
|
|
|
2488
|
-
fs$
|
|
2478
|
+
fs$d.writeFileSync(file, '');
|
|
2489
2479
|
}
|
|
2490
2480
|
|
|
2491
2481
|
var file$1 = {
|
|
@@ -2494,14 +2484,14 @@ var file$1 = {
|
|
|
2494
2484
|
};
|
|
2495
2485
|
|
|
2496
2486
|
const u$5 = universalify.fromCallback;
|
|
2497
|
-
const path$
|
|
2498
|
-
const fs$
|
|
2487
|
+
const path$a = path__default["default"];
|
|
2488
|
+
const fs$c = gracefulFs;
|
|
2499
2489
|
const mkdir$3 = mkdirs_1;
|
|
2500
2490
|
const pathExists$5 = pathExists_1.pathExists;
|
|
2501
2491
|
|
|
2502
2492
|
function createLink (srcpath, dstpath, callback) {
|
|
2503
2493
|
function makeLink (srcpath, dstpath) {
|
|
2504
|
-
fs$
|
|
2494
|
+
fs$c.link(srcpath, dstpath, err => {
|
|
2505
2495
|
if (err) return callback(err)
|
|
2506
2496
|
callback(null);
|
|
2507
2497
|
});
|
|
@@ -2510,13 +2500,13 @@ function createLink (srcpath, dstpath, callback) {
|
|
|
2510
2500
|
pathExists$5(dstpath, (err, destinationExists) => {
|
|
2511
2501
|
if (err) return callback(err)
|
|
2512
2502
|
if (destinationExists) return callback(null)
|
|
2513
|
-
fs$
|
|
2503
|
+
fs$c.lstat(srcpath, (err) => {
|
|
2514
2504
|
if (err) {
|
|
2515
2505
|
err.message = err.message.replace('lstat', 'ensureLink');
|
|
2516
2506
|
return callback(err)
|
|
2517
2507
|
}
|
|
2518
2508
|
|
|
2519
|
-
const dir = path$
|
|
2509
|
+
const dir = path$a.dirname(dstpath);
|
|
2520
2510
|
pathExists$5(dir, (err, dirExists) => {
|
|
2521
2511
|
if (err) return callback(err)
|
|
2522
2512
|
if (dirExists) return makeLink(srcpath, dstpath)
|
|
@@ -2530,22 +2520,22 @@ function createLink (srcpath, dstpath, callback) {
|
|
|
2530
2520
|
}
|
|
2531
2521
|
|
|
2532
2522
|
function createLinkSync (srcpath, dstpath) {
|
|
2533
|
-
const destinationExists = fs$
|
|
2523
|
+
const destinationExists = fs$c.existsSync(dstpath);
|
|
2534
2524
|
if (destinationExists) return undefined
|
|
2535
2525
|
|
|
2536
2526
|
try {
|
|
2537
|
-
fs$
|
|
2527
|
+
fs$c.lstatSync(srcpath);
|
|
2538
2528
|
} catch (err) {
|
|
2539
2529
|
err.message = err.message.replace('lstat', 'ensureLink');
|
|
2540
2530
|
throw err
|
|
2541
2531
|
}
|
|
2542
2532
|
|
|
2543
|
-
const dir = path$
|
|
2544
|
-
const dirExists = fs$
|
|
2545
|
-
if (dirExists) return fs$
|
|
2533
|
+
const dir = path$a.dirname(dstpath);
|
|
2534
|
+
const dirExists = fs$c.existsSync(dir);
|
|
2535
|
+
if (dirExists) return fs$c.linkSync(srcpath, dstpath)
|
|
2546
2536
|
mkdir$3.mkdirsSync(dir);
|
|
2547
2537
|
|
|
2548
|
-
return fs$
|
|
2538
|
+
return fs$c.linkSync(srcpath, dstpath)
|
|
2549
2539
|
}
|
|
2550
2540
|
|
|
2551
2541
|
var link$1 = {
|
|
@@ -2553,8 +2543,8 @@ var link$1 = {
|
|
|
2553
2543
|
createLinkSync
|
|
2554
2544
|
};
|
|
2555
2545
|
|
|
2556
|
-
const path$
|
|
2557
|
-
const fs$
|
|
2546
|
+
const path$9 = path__default["default"];
|
|
2547
|
+
const fs$b = gracefulFs;
|
|
2558
2548
|
const pathExists$4 = pathExists_1.pathExists;
|
|
2559
2549
|
|
|
2560
2550
|
/**
|
|
@@ -2580,8 +2570,8 @@ const pathExists$4 = pathExists_1.pathExists;
|
|
|
2580
2570
|
*/
|
|
2581
2571
|
|
|
2582
2572
|
function symlinkPaths$1 (srcpath, dstpath, callback) {
|
|
2583
|
-
if (path$
|
|
2584
|
-
return fs$
|
|
2573
|
+
if (path$9.isAbsolute(srcpath)) {
|
|
2574
|
+
return fs$b.lstat(srcpath, (err) => {
|
|
2585
2575
|
if (err) {
|
|
2586
2576
|
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
2587
2577
|
return callback(err)
|
|
@@ -2592,8 +2582,8 @@ function symlinkPaths$1 (srcpath, dstpath, callback) {
|
|
|
2592
2582
|
})
|
|
2593
2583
|
})
|
|
2594
2584
|
} else {
|
|
2595
|
-
const dstdir = path$
|
|
2596
|
-
const relativeToDst = path$
|
|
2585
|
+
const dstdir = path$9.dirname(dstpath);
|
|
2586
|
+
const relativeToDst = path$9.join(dstdir, srcpath);
|
|
2597
2587
|
return pathExists$4(relativeToDst, (err, exists) => {
|
|
2598
2588
|
if (err) return callback(err)
|
|
2599
2589
|
if (exists) {
|
|
@@ -2602,14 +2592,14 @@ function symlinkPaths$1 (srcpath, dstpath, callback) {
|
|
|
2602
2592
|
'toDst': srcpath
|
|
2603
2593
|
})
|
|
2604
2594
|
} else {
|
|
2605
|
-
return fs$
|
|
2595
|
+
return fs$b.lstat(srcpath, (err) => {
|
|
2606
2596
|
if (err) {
|
|
2607
2597
|
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
2608
2598
|
return callback(err)
|
|
2609
2599
|
}
|
|
2610
2600
|
return callback(null, {
|
|
2611
2601
|
'toCwd': srcpath,
|
|
2612
|
-
'toDst': path$
|
|
2602
|
+
'toDst': path$9.relative(dstdir, srcpath)
|
|
2613
2603
|
})
|
|
2614
2604
|
})
|
|
2615
2605
|
}
|
|
@@ -2619,28 +2609,28 @@ function symlinkPaths$1 (srcpath, dstpath, callback) {
|
|
|
2619
2609
|
|
|
2620
2610
|
function symlinkPathsSync$1 (srcpath, dstpath) {
|
|
2621
2611
|
let exists;
|
|
2622
|
-
if (path$
|
|
2623
|
-
exists = fs$
|
|
2612
|
+
if (path$9.isAbsolute(srcpath)) {
|
|
2613
|
+
exists = fs$b.existsSync(srcpath);
|
|
2624
2614
|
if (!exists) throw new Error('absolute srcpath does not exist')
|
|
2625
2615
|
return {
|
|
2626
2616
|
'toCwd': srcpath,
|
|
2627
2617
|
'toDst': srcpath
|
|
2628
2618
|
}
|
|
2629
2619
|
} else {
|
|
2630
|
-
const dstdir = path$
|
|
2631
|
-
const relativeToDst = path$
|
|
2632
|
-
exists = fs$
|
|
2620
|
+
const dstdir = path$9.dirname(dstpath);
|
|
2621
|
+
const relativeToDst = path$9.join(dstdir, srcpath);
|
|
2622
|
+
exists = fs$b.existsSync(relativeToDst);
|
|
2633
2623
|
if (exists) {
|
|
2634
2624
|
return {
|
|
2635
2625
|
'toCwd': relativeToDst,
|
|
2636
2626
|
'toDst': srcpath
|
|
2637
2627
|
}
|
|
2638
2628
|
} else {
|
|
2639
|
-
exists = fs$
|
|
2629
|
+
exists = fs$b.existsSync(srcpath);
|
|
2640
2630
|
if (!exists) throw new Error('relative srcpath does not exist')
|
|
2641
2631
|
return {
|
|
2642
2632
|
'toCwd': srcpath,
|
|
2643
|
-
'toDst': path$
|
|
2633
|
+
'toDst': path$9.relative(dstdir, srcpath)
|
|
2644
2634
|
}
|
|
2645
2635
|
}
|
|
2646
2636
|
}
|
|
@@ -2651,13 +2641,13 @@ var symlinkPaths_1 = {
|
|
|
2651
2641
|
symlinkPathsSync: symlinkPathsSync$1
|
|
2652
2642
|
};
|
|
2653
2643
|
|
|
2654
|
-
const fs$
|
|
2644
|
+
const fs$a = gracefulFs;
|
|
2655
2645
|
|
|
2656
2646
|
function symlinkType$1 (srcpath, type, callback) {
|
|
2657
2647
|
callback = (typeof type === 'function') ? type : callback;
|
|
2658
2648
|
type = (typeof type === 'function') ? false : type;
|
|
2659
2649
|
if (type) return callback(null, type)
|
|
2660
|
-
fs$
|
|
2650
|
+
fs$a.lstat(srcpath, (err, stats) => {
|
|
2661
2651
|
if (err) return callback(null, 'file')
|
|
2662
2652
|
type = (stats && stats.isDirectory()) ? 'dir' : 'file';
|
|
2663
2653
|
callback(null, type);
|
|
@@ -2669,7 +2659,7 @@ function symlinkTypeSync$1 (srcpath, type) {
|
|
|
2669
2659
|
|
|
2670
2660
|
if (type) return type
|
|
2671
2661
|
try {
|
|
2672
|
-
stats = fs$
|
|
2662
|
+
stats = fs$a.lstatSync(srcpath);
|
|
2673
2663
|
} catch (e) {
|
|
2674
2664
|
return 'file'
|
|
2675
2665
|
}
|
|
@@ -2682,8 +2672,8 @@ var symlinkType_1 = {
|
|
|
2682
2672
|
};
|
|
2683
2673
|
|
|
2684
2674
|
const u$4 = universalify.fromCallback;
|
|
2685
|
-
const path$
|
|
2686
|
-
const fs$
|
|
2675
|
+
const path$8 = path__default["default"];
|
|
2676
|
+
const fs$9 = gracefulFs;
|
|
2687
2677
|
const _mkdirs = mkdirs_1;
|
|
2688
2678
|
const mkdirs = _mkdirs.mkdirs;
|
|
2689
2679
|
const mkdirsSync = _mkdirs.mkdirsSync;
|
|
@@ -2710,13 +2700,13 @@ function createSymlink (srcpath, dstpath, type, callback) {
|
|
|
2710
2700
|
srcpath = relative.toDst;
|
|
2711
2701
|
symlinkType(relative.toCwd, type, (err, type) => {
|
|
2712
2702
|
if (err) return callback(err)
|
|
2713
|
-
const dir = path$
|
|
2703
|
+
const dir = path$8.dirname(dstpath);
|
|
2714
2704
|
pathExists$3(dir, (err, dirExists) => {
|
|
2715
2705
|
if (err) return callback(err)
|
|
2716
|
-
if (dirExists) return fs$
|
|
2706
|
+
if (dirExists) return fs$9.symlink(srcpath, dstpath, type, callback)
|
|
2717
2707
|
mkdirs(dir, err => {
|
|
2718
2708
|
if (err) return callback(err)
|
|
2719
|
-
fs$
|
|
2709
|
+
fs$9.symlink(srcpath, dstpath, type, callback);
|
|
2720
2710
|
});
|
|
2721
2711
|
});
|
|
2722
2712
|
});
|
|
@@ -2725,17 +2715,17 @@ function createSymlink (srcpath, dstpath, type, callback) {
|
|
|
2725
2715
|
}
|
|
2726
2716
|
|
|
2727
2717
|
function createSymlinkSync (srcpath, dstpath, type) {
|
|
2728
|
-
const destinationExists = fs$
|
|
2718
|
+
const destinationExists = fs$9.existsSync(dstpath);
|
|
2729
2719
|
if (destinationExists) return undefined
|
|
2730
2720
|
|
|
2731
2721
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
2732
2722
|
srcpath = relative.toDst;
|
|
2733
2723
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
2734
|
-
const dir = path$
|
|
2735
|
-
const exists = fs$
|
|
2736
|
-
if (exists) return fs$
|
|
2724
|
+
const dir = path$8.dirname(dstpath);
|
|
2725
|
+
const exists = fs$9.existsSync(dir);
|
|
2726
|
+
if (exists) return fs$9.symlinkSync(srcpath, dstpath, type)
|
|
2737
2727
|
mkdirsSync(dir);
|
|
2738
|
-
return fs$
|
|
2728
|
+
return fs$9.symlinkSync(srcpath, dstpath, type)
|
|
2739
2729
|
}
|
|
2740
2730
|
|
|
2741
2731
|
var symlink$1 = {
|
|
@@ -2911,7 +2901,7 @@ var jsonfile = {
|
|
|
2911
2901
|
writeJsonSync: jsonFile$3.writeFileSync
|
|
2912
2902
|
};
|
|
2913
2903
|
|
|
2914
|
-
const path$
|
|
2904
|
+
const path$7 = path__default["default"];
|
|
2915
2905
|
const mkdir$2 = mkdirs_1;
|
|
2916
2906
|
const pathExists$2 = pathExists_1.pathExists;
|
|
2917
2907
|
const jsonFile$2 = jsonfile;
|
|
@@ -2922,7 +2912,7 @@ function outputJson (file, data, options, callback) {
|
|
|
2922
2912
|
options = {};
|
|
2923
2913
|
}
|
|
2924
2914
|
|
|
2925
|
-
const dir = path$
|
|
2915
|
+
const dir = path$7.dirname(file);
|
|
2926
2916
|
|
|
2927
2917
|
pathExists$2(dir, (err, itDoes) => {
|
|
2928
2918
|
if (err) return callback(err)
|
|
@@ -2937,15 +2927,15 @@ function outputJson (file, data, options, callback) {
|
|
|
2937
2927
|
|
|
2938
2928
|
var outputJson_1 = outputJson;
|
|
2939
2929
|
|
|
2940
|
-
const fs$
|
|
2941
|
-
const path$
|
|
2930
|
+
const fs$8 = gracefulFs;
|
|
2931
|
+
const path$6 = path__default["default"];
|
|
2942
2932
|
const mkdir$1 = mkdirs_1;
|
|
2943
2933
|
const jsonFile$1 = jsonfile;
|
|
2944
2934
|
|
|
2945
2935
|
function outputJsonSync (file, data, options) {
|
|
2946
|
-
const dir = path$
|
|
2936
|
+
const dir = path$6.dirname(file);
|
|
2947
2937
|
|
|
2948
|
-
if (!fs$
|
|
2938
|
+
if (!fs$8.existsSync(dir)) {
|
|
2949
2939
|
mkdir$1.mkdirsSync(dir);
|
|
2950
2940
|
}
|
|
2951
2941
|
|
|
@@ -2969,8 +2959,8 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
2969
2959
|
|
|
2970
2960
|
var json = jsonFile;
|
|
2971
2961
|
|
|
2972
|
-
const fs$
|
|
2973
|
-
const path$
|
|
2962
|
+
const fs$7 = gracefulFs;
|
|
2963
|
+
const path$5 = path__default["default"];
|
|
2974
2964
|
const copySync = copySync$1.copySync;
|
|
2975
2965
|
const removeSync = remove$2.removeSync;
|
|
2976
2966
|
const mkdirpSync = mkdirs_1.mkdirsSync;
|
|
@@ -2980,20 +2970,20 @@ function moveSync (src, dest, options) {
|
|
|
2980
2970
|
options = options || {};
|
|
2981
2971
|
const overwrite = options.overwrite || options.clobber || false;
|
|
2982
2972
|
|
|
2983
|
-
src = path$
|
|
2984
|
-
dest = path$
|
|
2973
|
+
src = path$5.resolve(src);
|
|
2974
|
+
dest = path$5.resolve(dest);
|
|
2985
2975
|
|
|
2986
|
-
if (src === dest) return fs$
|
|
2976
|
+
if (src === dest) return fs$7.accessSync(src)
|
|
2987
2977
|
|
|
2988
2978
|
if (isSrcSubdir$1(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`)
|
|
2989
2979
|
|
|
2990
|
-
mkdirpSync(path$
|
|
2980
|
+
mkdirpSync(path$5.dirname(dest));
|
|
2991
2981
|
tryRenameSync();
|
|
2992
2982
|
|
|
2993
2983
|
function tryRenameSync () {
|
|
2994
2984
|
if (overwrite) {
|
|
2995
2985
|
try {
|
|
2996
|
-
return fs$
|
|
2986
|
+
return fs$7.renameSync(src, dest)
|
|
2997
2987
|
} catch (err) {
|
|
2998
2988
|
if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST' || err.code === 'EPERM') {
|
|
2999
2989
|
removeSync(dest);
|
|
@@ -3006,8 +2996,8 @@ function moveSync (src, dest, options) {
|
|
|
3006
2996
|
}
|
|
3007
2997
|
} else {
|
|
3008
2998
|
try {
|
|
3009
|
-
fs$
|
|
3010
|
-
return fs$
|
|
2999
|
+
fs$7.linkSync(src, dest);
|
|
3000
|
+
return fs$7.unlinkSync(src)
|
|
3011
3001
|
} catch (err) {
|
|
3012
3002
|
if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
|
|
3013
3003
|
return moveSyncAcrossDevice(src, dest, overwrite)
|
|
@@ -3019,7 +3009,7 @@ function moveSync (src, dest, options) {
|
|
|
3019
3009
|
}
|
|
3020
3010
|
|
|
3021
3011
|
function moveSyncAcrossDevice (src, dest, overwrite) {
|
|
3022
|
-
const stat = fs$
|
|
3012
|
+
const stat = fs$7.statSync(src);
|
|
3023
3013
|
|
|
3024
3014
|
if (stat.isDirectory()) {
|
|
3025
3015
|
return moveDirSyncAcrossDevice(src, dest, overwrite)
|
|
@@ -3034,20 +3024,20 @@ function moveFileSyncAcrossDevice (src, dest, overwrite) {
|
|
|
3034
3024
|
|
|
3035
3025
|
const flags = overwrite ? 'w' : 'wx';
|
|
3036
3026
|
|
|
3037
|
-
const fdr = fs$
|
|
3038
|
-
const stat = fs$
|
|
3039
|
-
const fdw = fs$
|
|
3027
|
+
const fdr = fs$7.openSync(src, 'r');
|
|
3028
|
+
const stat = fs$7.fstatSync(fdr);
|
|
3029
|
+
const fdw = fs$7.openSync(dest, flags, stat.mode);
|
|
3040
3030
|
let pos = 0;
|
|
3041
3031
|
|
|
3042
3032
|
while (pos < stat.size) {
|
|
3043
|
-
const bytesRead = fs$
|
|
3044
|
-
fs$
|
|
3033
|
+
const bytesRead = fs$7.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
|
|
3034
|
+
fs$7.writeSync(fdw, _buff, 0, bytesRead);
|
|
3045
3035
|
pos += bytesRead;
|
|
3046
3036
|
}
|
|
3047
3037
|
|
|
3048
|
-
fs$
|
|
3049
|
-
fs$
|
|
3050
|
-
return fs$
|
|
3038
|
+
fs$7.closeSync(fdr);
|
|
3039
|
+
fs$7.closeSync(fdw);
|
|
3040
|
+
return fs$7.unlinkSync(src)
|
|
3051
3041
|
}
|
|
3052
3042
|
|
|
3053
3043
|
function moveDirSyncAcrossDevice (src, dest, overwrite) {
|
|
@@ -3072,10 +3062,10 @@ function moveDirSyncAcrossDevice (src, dest, overwrite) {
|
|
|
3072
3062
|
// extract dest base dir and check if that is the same as src basename
|
|
3073
3063
|
function isSrcSubdir$1 (src, dest) {
|
|
3074
3064
|
try {
|
|
3075
|
-
return fs$
|
|
3065
|
+
return fs$7.statSync(src).isDirectory() &&
|
|
3076
3066
|
src !== dest &&
|
|
3077
3067
|
dest.indexOf(src) > -1 &&
|
|
3078
|
-
dest.split(path$
|
|
3068
|
+
dest.split(path$5.dirname(src) + path$5.sep)[1].split(path$5.sep)[0] === path$5.basename(src)
|
|
3079
3069
|
} catch (e) {
|
|
3080
3070
|
return false
|
|
3081
3071
|
}
|
|
@@ -3086,8 +3076,8 @@ var moveSync_1 = {
|
|
|
3086
3076
|
};
|
|
3087
3077
|
|
|
3088
3078
|
const u$1 = universalify.fromCallback;
|
|
3089
|
-
const fs$
|
|
3090
|
-
const path$
|
|
3079
|
+
const fs$6 = gracefulFs;
|
|
3080
|
+
const path$4 = path__default["default"];
|
|
3091
3081
|
const copy = copy$1.copy;
|
|
3092
3082
|
const remove = remove$2.remove;
|
|
3093
3083
|
const mkdirp = mkdirs_1.mkdirp;
|
|
@@ -3101,18 +3091,18 @@ function move (src, dest, opts, cb) {
|
|
|
3101
3091
|
|
|
3102
3092
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
3103
3093
|
|
|
3104
|
-
src = path$
|
|
3105
|
-
dest = path$
|
|
3094
|
+
src = path$4.resolve(src);
|
|
3095
|
+
dest = path$4.resolve(dest);
|
|
3106
3096
|
|
|
3107
|
-
if (src === dest) return fs$
|
|
3097
|
+
if (src === dest) return fs$6.access(src, cb)
|
|
3108
3098
|
|
|
3109
|
-
fs$
|
|
3099
|
+
fs$6.stat(src, (err, st) => {
|
|
3110
3100
|
if (err) return cb(err)
|
|
3111
3101
|
|
|
3112
3102
|
if (st.isDirectory() && isSrcSubdir(src, dest)) {
|
|
3113
3103
|
return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`))
|
|
3114
3104
|
}
|
|
3115
|
-
mkdirp(path$
|
|
3105
|
+
mkdirp(path$4.dirname(dest), err => {
|
|
3116
3106
|
if (err) return cb(err)
|
|
3117
3107
|
return doRename(src, dest, overwrite, cb)
|
|
3118
3108
|
});
|
|
@@ -3134,7 +3124,7 @@ function doRename (src, dest, overwrite, cb) {
|
|
|
3134
3124
|
}
|
|
3135
3125
|
|
|
3136
3126
|
function rename (src, dest, overwrite, cb) {
|
|
3137
|
-
fs$
|
|
3127
|
+
fs$6.rename(src, dest, err => {
|
|
3138
3128
|
if (!err) return cb()
|
|
3139
3129
|
if (err.code !== 'EXDEV') return cb(err)
|
|
3140
3130
|
return moveAcrossDevice(src, dest, overwrite, cb)
|
|
@@ -3154,8 +3144,8 @@ function moveAcrossDevice (src, dest, overwrite, cb) {
|
|
|
3154
3144
|
}
|
|
3155
3145
|
|
|
3156
3146
|
function isSrcSubdir (src, dest) {
|
|
3157
|
-
const srcArray = src.split(path$
|
|
3158
|
-
const destArray = dest.split(path$
|
|
3147
|
+
const srcArray = src.split(path$4.sep);
|
|
3148
|
+
const destArray = dest.split(path$4.sep);
|
|
3159
3149
|
|
|
3160
3150
|
return srcArray.reduce((acc, current, i) => {
|
|
3161
3151
|
return acc && destArray[i] === current
|
|
@@ -3167,8 +3157,8 @@ var move_1 = {
|
|
|
3167
3157
|
};
|
|
3168
3158
|
|
|
3169
3159
|
const u = universalify.fromCallback;
|
|
3170
|
-
const fs$
|
|
3171
|
-
const path$
|
|
3160
|
+
const fs$5 = gracefulFs;
|
|
3161
|
+
const path$3 = path__default["default"];
|
|
3172
3162
|
const mkdir = mkdirs_1;
|
|
3173
3163
|
const pathExists = pathExists_1.pathExists;
|
|
3174
3164
|
|
|
@@ -3178,26 +3168,26 @@ function outputFile (file, data, encoding, callback) {
|
|
|
3178
3168
|
encoding = 'utf8';
|
|
3179
3169
|
}
|
|
3180
3170
|
|
|
3181
|
-
const dir = path$
|
|
3171
|
+
const dir = path$3.dirname(file);
|
|
3182
3172
|
pathExists(dir, (err, itDoes) => {
|
|
3183
3173
|
if (err) return callback(err)
|
|
3184
|
-
if (itDoes) return fs$
|
|
3174
|
+
if (itDoes) return fs$5.writeFile(file, data, encoding, callback)
|
|
3185
3175
|
|
|
3186
3176
|
mkdir.mkdirs(dir, err => {
|
|
3187
3177
|
if (err) return callback(err)
|
|
3188
3178
|
|
|
3189
|
-
fs$
|
|
3179
|
+
fs$5.writeFile(file, data, encoding, callback);
|
|
3190
3180
|
});
|
|
3191
3181
|
});
|
|
3192
3182
|
}
|
|
3193
3183
|
|
|
3194
3184
|
function outputFileSync (file, ...args) {
|
|
3195
|
-
const dir = path$
|
|
3196
|
-
if (fs$
|
|
3197
|
-
return fs$
|
|
3185
|
+
const dir = path$3.dirname(file);
|
|
3186
|
+
if (fs$5.existsSync(dir)) {
|
|
3187
|
+
return fs$5.writeFileSync(file, ...args)
|
|
3198
3188
|
}
|
|
3199
3189
|
mkdir.mkdirsSync(dir);
|
|
3200
|
-
fs$
|
|
3190
|
+
fs$5.writeFileSync(file, ...args);
|
|
3201
3191
|
}
|
|
3202
3192
|
|
|
3203
3193
|
var output = {
|
|
@@ -3210,7 +3200,7 @@ var output = {
|
|
|
3210
3200
|
module.exports = Object.assign(
|
|
3211
3201
|
{},
|
|
3212
3202
|
// Export promiseified graceful-fs:
|
|
3213
|
-
fs$
|
|
3203
|
+
fs$n,
|
|
3214
3204
|
// Export extra methods:
|
|
3215
3205
|
copySync$1,
|
|
3216
3206
|
copy$1,
|
|
@@ -3235,13 +3225,13 @@ var output = {
|
|
|
3235
3225
|
}
|
|
3236
3226
|
} (lib$3));
|
|
3237
3227
|
|
|
3238
|
-
var fs$
|
|
3228
|
+
var fs$4 = libExports$1;
|
|
3239
3229
|
|
|
3240
3230
|
class File {
|
|
3241
3231
|
constructor(path, hash) {
|
|
3242
|
-
this._fd = fs$5.openSync(path, "w");
|
|
3243
3232
|
this.path = path;
|
|
3244
3233
|
this.hash = hash;
|
|
3234
|
+
this._fd = fs$4.openSync(path, "w");
|
|
3245
3235
|
this.system = undefined;
|
|
3246
3236
|
this._writing = false;
|
|
3247
3237
|
this.originalPath = undefined;
|
|
@@ -3268,14 +3258,14 @@ class File {
|
|
|
3268
3258
|
if (!this._fd) {
|
|
3269
3259
|
throw new Error(`No fd for ${this.path}`);
|
|
3270
3260
|
}
|
|
3271
|
-
fs$
|
|
3272
|
-
fs$
|
|
3261
|
+
fs$4.closeSync(this._fd);
|
|
3262
|
+
fs$4.unlinkSync(this.path);
|
|
3273
3263
|
}
|
|
3274
3264
|
close() {
|
|
3275
3265
|
if (this._fd === undefined) {
|
|
3276
3266
|
throw new Error(`No fd for ${this.path}`);
|
|
3277
3267
|
}
|
|
3278
|
-
fs$
|
|
3268
|
+
fs$4.closeSync(this._fd);
|
|
3279
3269
|
this._fd = undefined;
|
|
3280
3270
|
}
|
|
3281
3271
|
_write() {
|
|
@@ -3283,7 +3273,7 @@ class File {
|
|
|
3283
3273
|
const pending = this._pending.shift();
|
|
3284
3274
|
if (pending) {
|
|
3285
3275
|
assert__default["default"](this._fd !== undefined);
|
|
3286
|
-
fs$
|
|
3276
|
+
fs$4.write(this._fd, pending.data)
|
|
3287
3277
|
.then(() => {
|
|
3288
3278
|
pending.resolve();
|
|
3289
3279
|
assert__default["default"](this._pending);
|
|
@@ -3298,7 +3288,7 @@ class File {
|
|
|
3298
3288
|
})
|
|
3299
3289
|
.catch((e) => {
|
|
3300
3290
|
assert__default["default"](this._fd !== undefined);
|
|
3301
|
-
fs$
|
|
3291
|
+
fs$4.closeSync(this._fd);
|
|
3302
3292
|
this._fd = undefined;
|
|
3303
3293
|
pending.reject(e);
|
|
3304
3294
|
this._clearPending(e);
|
|
@@ -3320,12 +3310,18 @@ class Links {
|
|
|
3320
3310
|
constructor() {
|
|
3321
3311
|
this._targets = {};
|
|
3322
3312
|
}
|
|
3323
|
-
toString() {
|
|
3324
|
-
return JSON.stringify(this, null, 4);
|
|
3325
|
-
}
|
|
3326
3313
|
get targets() {
|
|
3327
3314
|
return this._targets;
|
|
3328
3315
|
}
|
|
3316
|
+
get targetHashes() {
|
|
3317
|
+
return Object.keys(this._targets);
|
|
3318
|
+
}
|
|
3319
|
+
get size() {
|
|
3320
|
+
return Object.keys(this._targets).length;
|
|
3321
|
+
}
|
|
3322
|
+
toString() {
|
|
3323
|
+
return JSON.stringify(this, null, 4);
|
|
3324
|
+
}
|
|
3329
3325
|
toObject() {
|
|
3330
3326
|
return this._targets;
|
|
3331
3327
|
}
|
|
@@ -3346,12 +3342,6 @@ class Links {
|
|
|
3346
3342
|
unset(targetHash) {
|
|
3347
3343
|
delete this._targets[targetHash];
|
|
3348
3344
|
}
|
|
3349
|
-
get targetHashes() {
|
|
3350
|
-
return Object.keys(this._targets);
|
|
3351
|
-
}
|
|
3352
|
-
get size() {
|
|
3353
|
-
return Object.keys(this._targets).length;
|
|
3354
|
-
}
|
|
3355
3345
|
}
|
|
3356
3346
|
|
|
3357
3347
|
/**
|
|
@@ -3404,7 +3394,7 @@ var randomstring$1 = {
|
|
|
3404
3394
|
generate: generate
|
|
3405
3395
|
};
|
|
3406
3396
|
|
|
3407
|
-
var fs$
|
|
3397
|
+
var fs$3 = fs__default["default"],
|
|
3408
3398
|
randomstring = randomstring$1;
|
|
3409
3399
|
|
|
3410
3400
|
|
|
@@ -3435,7 +3425,7 @@ function createFile(template, callback) {
|
|
|
3435
3425
|
}
|
|
3436
3426
|
}
|
|
3437
3427
|
|
|
3438
|
-
fs$
|
|
3428
|
+
fs$3.open(filename, 'ax+', 384 /*=0600*/, function(err, fd) {
|
|
3439
3429
|
if (err) {
|
|
3440
3430
|
if (err.code === 'EEXIST') {
|
|
3441
3431
|
// FIXME: infinite loop
|
|
@@ -3451,7 +3441,7 @@ function createFile(template, callback) {
|
|
|
3451
3441
|
}
|
|
3452
3442
|
|
|
3453
3443
|
if (fd) {
|
|
3454
|
-
fs$
|
|
3444
|
+
fs$3.close(fd, function(err) {
|
|
3455
3445
|
callback(err, filename);
|
|
3456
3446
|
});
|
|
3457
3447
|
} else {
|
|
@@ -3476,7 +3466,7 @@ function createFileSync(template) {
|
|
|
3476
3466
|
isExist = false;
|
|
3477
3467
|
filename = randomstring.generate(template);
|
|
3478
3468
|
try {
|
|
3479
|
-
fd = fs$
|
|
3469
|
+
fd = fs$3.openSync(filename, 'ax+', 384 /*=0600*/);
|
|
3480
3470
|
} catch (e) {
|
|
3481
3471
|
if (e.code === 'EEXIST') {
|
|
3482
3472
|
isExist = true;
|
|
@@ -3484,7 +3474,7 @@ function createFileSync(template) {
|
|
|
3484
3474
|
throw e;
|
|
3485
3475
|
}
|
|
3486
3476
|
} finally {
|
|
3487
|
-
fd && fs$
|
|
3477
|
+
fd && fs$3.closeSync(fd);
|
|
3488
3478
|
}
|
|
3489
3479
|
} while (isExist);
|
|
3490
3480
|
|
|
@@ -3519,7 +3509,7 @@ function createDir(template, callback) {
|
|
|
3519
3509
|
}
|
|
3520
3510
|
}
|
|
3521
3511
|
|
|
3522
|
-
fs$
|
|
3512
|
+
fs$3.mkdir(dirname, 448 /*=0700*/, function(err) {
|
|
3523
3513
|
if (err) {
|
|
3524
3514
|
if (err.code === 'EEXIST') {
|
|
3525
3515
|
// FIXME: infinite loop
|
|
@@ -3553,7 +3543,7 @@ function createDirSync(template) {
|
|
|
3553
3543
|
isExist = false;
|
|
3554
3544
|
dirname = randomstring.generate(template);
|
|
3555
3545
|
try {
|
|
3556
|
-
fs$
|
|
3546
|
+
fs$3.mkdirSync(dirname, 448 /*=0700*/);
|
|
3557
3547
|
} catch (e) {
|
|
3558
3548
|
if (e.code === 'EEXIST') {
|
|
3559
3549
|
isExist = true;
|
|
@@ -3602,7 +3592,7 @@ function untarFile(archive, file) {
|
|
|
3602
3592
|
child_process__default["default"].exec(`tar -zxf "${archive}" ${file}`, { cwd: tmpdir }, (err) => {
|
|
3603
3593
|
if (err) {
|
|
3604
3594
|
try {
|
|
3605
|
-
fs$
|
|
3595
|
+
fs$4.removeSync(tmpdir);
|
|
3606
3596
|
}
|
|
3607
3597
|
catch (e) {
|
|
3608
3598
|
console.error("Got an error removing the temp dir", tmpdir);
|
|
@@ -3610,15 +3600,15 @@ function untarFile(archive, file) {
|
|
|
3610
3600
|
reject(err);
|
|
3611
3601
|
return;
|
|
3612
3602
|
}
|
|
3613
|
-
fs$
|
|
3603
|
+
fs$4.readFile(path__default["default"].join(tmpdir, file), "utf8", (error, data) => {
|
|
3614
3604
|
try {
|
|
3615
|
-
fs$
|
|
3605
|
+
fs$4.removeSync(tmpdir);
|
|
3616
3606
|
}
|
|
3617
3607
|
catch (e) {
|
|
3618
3608
|
console.error("Got an error removing the temp dir", tmpdir);
|
|
3619
3609
|
}
|
|
3620
|
-
if (
|
|
3621
|
-
reject(
|
|
3610
|
+
if (error) {
|
|
3611
|
+
reject(error);
|
|
3622
3612
|
}
|
|
3623
3613
|
else {
|
|
3624
3614
|
resolve(data);
|
|
@@ -3634,6 +3624,12 @@ class Environments {
|
|
|
3634
3624
|
this._data = {};
|
|
3635
3625
|
this._links = {};
|
|
3636
3626
|
}
|
|
3627
|
+
get environments() {
|
|
3628
|
+
return this._data;
|
|
3629
|
+
}
|
|
3630
|
+
get path() {
|
|
3631
|
+
return this._path || "";
|
|
3632
|
+
}
|
|
3637
3633
|
load(db, p) {
|
|
3638
3634
|
this._db = db;
|
|
3639
3635
|
return db.get("links").then((l) => {
|
|
@@ -3649,12 +3645,12 @@ class Environments {
|
|
|
3649
3645
|
}
|
|
3650
3646
|
}
|
|
3651
3647
|
return new Promise((resolve, reject) => {
|
|
3652
|
-
fs$
|
|
3648
|
+
fs$4.stat(p)
|
|
3653
3649
|
.then((st) => {
|
|
3654
3650
|
if (st.isDirectory()) {
|
|
3655
3651
|
// we're good
|
|
3656
3652
|
this._path = p;
|
|
3657
|
-
fs$
|
|
3653
|
+
fs$4.readdir(p).then((files) => {
|
|
3658
3654
|
const promises = [];
|
|
3659
3655
|
files.forEach((e) => {
|
|
3660
3656
|
if (e.length === 47 && e.indexOf(".tar.gz", 40) === 40) {
|
|
@@ -3689,7 +3685,7 @@ class Environments {
|
|
|
3689
3685
|
.catch((e) => {
|
|
3690
3686
|
if ("code" in e && e.code === "ENOENT") {
|
|
3691
3687
|
// make the directory
|
|
3692
|
-
fs$
|
|
3688
|
+
fs$4.mkdirp(p, (err) => {
|
|
3693
3689
|
if (err) {
|
|
3694
3690
|
reject(`Can't make directory ${p}: ${e.message}`);
|
|
3695
3691
|
return;
|
|
@@ -3711,7 +3707,7 @@ class Environments {
|
|
|
3711
3707
|
return undefined;
|
|
3712
3708
|
}
|
|
3713
3709
|
assert__default["default"](this._path);
|
|
3714
|
-
fs$
|
|
3710
|
+
fs$4.mkdirpSync(this._path);
|
|
3715
3711
|
return new File(path__default["default"].join(this._path, `${environment.hash}.tar.gz`), environment.hash);
|
|
3716
3712
|
}
|
|
3717
3713
|
complete(file) {
|
|
@@ -3780,12 +3776,6 @@ class Environments {
|
|
|
3780
3776
|
}
|
|
3781
3777
|
return this.syncLinks();
|
|
3782
3778
|
}
|
|
3783
|
-
get environments() {
|
|
3784
|
-
return this._data;
|
|
3785
|
-
}
|
|
3786
|
-
get path() {
|
|
3787
|
-
return this._path || "";
|
|
3788
|
-
}
|
|
3789
3779
|
environment(hash) {
|
|
3790
3780
|
if (!(hash in this._data)) {
|
|
3791
3781
|
return undefined;
|
|
@@ -3808,7 +3798,7 @@ class Environments {
|
|
|
3808
3798
|
remove(hash) {
|
|
3809
3799
|
// ### this should be promisified
|
|
3810
3800
|
try {
|
|
3811
|
-
fs$
|
|
3801
|
+
fs$4.removeSync(this._data[hash].path);
|
|
3812
3802
|
delete this._data[hash];
|
|
3813
3803
|
this.unlink(hash);
|
|
3814
3804
|
this.unlink(undefined, hash);
|
|
@@ -3823,14 +3813,15 @@ Environments.instance = new Environments();
|
|
|
3823
3813
|
|
|
3824
3814
|
class NodeData {
|
|
3825
3815
|
constructor(size, maxSize, sha1s) {
|
|
3826
|
-
this.sha1s = sha1s;
|
|
3827
3816
|
this.size = size;
|
|
3828
3817
|
this.maxSize = maxSize;
|
|
3818
|
+
this.sha1s = sha1s;
|
|
3829
3819
|
}
|
|
3830
3820
|
}
|
|
3831
3821
|
|
|
3832
3822
|
class SHA1Data {
|
|
3833
3823
|
constructor(fileSize, node) {
|
|
3824
|
+
this.fileSize = fileSize;
|
|
3834
3825
|
this.fileSize = fileSize;
|
|
3835
3826
|
this.nodes = [node];
|
|
3836
3827
|
}
|
|
@@ -4067,7 +4058,9 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
|
|
|
4067
4058
|
return;
|
|
4068
4059
|
}
|
|
4069
4060
|
this.byNode.delete(node);
|
|
4070
|
-
nodeData.sha1s.forEach((sha1) =>
|
|
4061
|
+
nodeData.sha1s.forEach((sha1) => {
|
|
4062
|
+
removeFromSHA1Map(this.bySHA1, sha1, node);
|
|
4063
|
+
});
|
|
4071
4064
|
}
|
|
4072
4065
|
dump(query) {
|
|
4073
4066
|
if ("clear" in query) {
|
|
@@ -4138,17 +4131,17 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
|
|
|
4138
4131
|
if (this.byNode.size >= 2) {
|
|
4139
4132
|
// let max = 1;
|
|
4140
4133
|
let roundRobinIndex = 0;
|
|
4141
|
-
const processObject = (
|
|
4134
|
+
const processObject = (sha, value) => {
|
|
4142
4135
|
if (max !== undefined && max <= 0) {
|
|
4143
4136
|
return;
|
|
4144
4137
|
}
|
|
4145
4138
|
const needed = Math.min(redundancy + 1 - value.nodes.length, this.byNode.size - 1);
|
|
4146
4139
|
if (needed > 0) {
|
|
4147
|
-
const
|
|
4140
|
+
const needed2 = redundancy + 1 - value.nodes.length;
|
|
4148
4141
|
// console.log("should distribute", key, "to", needed, "nodes");
|
|
4149
4142
|
let firstIdx;
|
|
4150
4143
|
let found = 0;
|
|
4151
|
-
while (found <
|
|
4144
|
+
while (found < needed2) {
|
|
4152
4145
|
if (++nodeIdx === nodes.length) {
|
|
4153
4146
|
nodeIdx = 0;
|
|
4154
4147
|
}
|
|
@@ -4182,7 +4175,7 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
|
|
|
4182
4175
|
++found;
|
|
4183
4176
|
data.available -= value.fileSize;
|
|
4184
4177
|
const src = value.nodes[roundRobinIndex++ % value.nodes.length];
|
|
4185
|
-
data.objects.push({ source: src.ip + ":" + src.port, sha1:
|
|
4178
|
+
data.objects.push({ source: src.ip + ":" + src.port, sha1: sha });
|
|
4186
4179
|
if (max !== undefined && !--max) {
|
|
4187
4180
|
break;
|
|
4188
4181
|
}
|
|
@@ -4200,7 +4193,9 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
|
|
|
4200
4193
|
}
|
|
4201
4194
|
}
|
|
4202
4195
|
else {
|
|
4203
|
-
this.bySHA1.forEach((value, key) =>
|
|
4196
|
+
this.bySHA1.forEach((value, key) => {
|
|
4197
|
+
processObject(key, value);
|
|
4198
|
+
});
|
|
4204
4199
|
}
|
|
4205
4200
|
}
|
|
4206
4201
|
commands.forEach((value, key) => {
|
|
@@ -4336,11 +4331,11 @@ class Peak {
|
|
|
4336
4331
|
class Client extends require$$0__default$2["default"] {
|
|
4337
4332
|
constructor(type, ws, ip, option) {
|
|
4338
4333
|
super();
|
|
4339
|
-
this.created = new Date();
|
|
4340
4334
|
this.type = type;
|
|
4341
4335
|
this.ws = ws;
|
|
4342
4336
|
this.ip = ip;
|
|
4343
4337
|
this.option = option;
|
|
4338
|
+
this.created = new Date();
|
|
4344
4339
|
this.hostname = "";
|
|
4345
4340
|
this.name = "";
|
|
4346
4341
|
this.npmVersion = "";
|
|
@@ -4406,7 +4401,7 @@ class Client extends require$$0__default$2["default"] {
|
|
|
4406
4401
|
|
|
4407
4402
|
class Builder extends Client {
|
|
4408
4403
|
constructor(ws, ip, option) {
|
|
4409
|
-
super(0 /* Builder */, ws, ip, option);
|
|
4404
|
+
super(0 /* ClientType.Builder */, ws, ip, option);
|
|
4410
4405
|
this.jobsPerformed = 0;
|
|
4411
4406
|
this.totalCompileSpeed = 0;
|
|
4412
4407
|
this.totalUploadSpeed = 0;
|
|
@@ -4422,7 +4417,7 @@ class Builder extends Client {
|
|
|
4422
4417
|
|
|
4423
4418
|
class Compile extends Client {
|
|
4424
4419
|
constructor(ws, ip, environment, sourceFile, sha1, option) {
|
|
4425
|
-
super(1 /* Compile */, ws, ip, option);
|
|
4420
|
+
super(1 /* ClientType.Compile */, ws, ip, option);
|
|
4426
4421
|
this.environment = environment;
|
|
4427
4422
|
this.sourceFile = sourceFile;
|
|
4428
4423
|
this.sha1 = sha1;
|
|
@@ -10827,7 +10822,7 @@ function requireHttpErrors () {
|
|
|
10827
10822
|
}
|
|
10828
10823
|
|
|
10829
10824
|
var srcExports = {};
|
|
10830
|
-
var src
|
|
10825
|
+
var src = {
|
|
10831
10826
|
get exports(){ return srcExports; },
|
|
10832
10827
|
set exports(v){ srcExports = v; },
|
|
10833
10828
|
};
|
|
@@ -11680,18 +11675,18 @@ function requireNode () {
|
|
|
11680
11675
|
* treat as a browser.
|
|
11681
11676
|
*/
|
|
11682
11677
|
|
|
11683
|
-
var hasRequiredSrc
|
|
11678
|
+
var hasRequiredSrc;
|
|
11684
11679
|
|
|
11685
|
-
function requireSrc
|
|
11686
|
-
if (hasRequiredSrc
|
|
11687
|
-
hasRequiredSrc
|
|
11680
|
+
function requireSrc () {
|
|
11681
|
+
if (hasRequiredSrc) return srcExports;
|
|
11682
|
+
hasRequiredSrc = 1;
|
|
11688
11683
|
(function (module) {
|
|
11689
11684
|
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
|
11690
11685
|
module.exports = requireBrowser();
|
|
11691
11686
|
} else {
|
|
11692
11687
|
module.exports = requireNode();
|
|
11693
11688
|
}
|
|
11694
|
-
} (src
|
|
11689
|
+
} (src));
|
|
11695
11690
|
return srcExports;
|
|
11696
11691
|
}
|
|
11697
11692
|
|
|
@@ -35511,7 +35506,7 @@ function requireJson () {
|
|
|
35511
35506
|
var bytes = bytesExports;
|
|
35512
35507
|
var contentType = requireContentType();
|
|
35513
35508
|
var createError = requireHttpErrors();
|
|
35514
|
-
var debug = requireSrc
|
|
35509
|
+
var debug = requireSrc()('body-parser:json');
|
|
35515
35510
|
var read = requireRead();
|
|
35516
35511
|
var typeis = requireTypeIs();
|
|
35517
35512
|
|
|
@@ -35751,7 +35746,7 @@ function requireRaw () {
|
|
|
35751
35746
|
*/
|
|
35752
35747
|
|
|
35753
35748
|
var bytes = bytesExports;
|
|
35754
|
-
var debug = requireSrc
|
|
35749
|
+
var debug = requireSrc()('body-parser:raw');
|
|
35755
35750
|
var read = requireRead();
|
|
35756
35751
|
var typeis = requireTypeIs();
|
|
35757
35752
|
|
|
@@ -35861,7 +35856,7 @@ function requireText () {
|
|
|
35861
35856
|
|
|
35862
35857
|
var bytes = bytesExports;
|
|
35863
35858
|
var contentType = requireContentType();
|
|
35864
|
-
var debug = requireSrc
|
|
35859
|
+
var debug = requireSrc()('body-parser:text');
|
|
35865
35860
|
var read = requireRead();
|
|
35866
35861
|
var typeis = requireTypeIs();
|
|
35867
35862
|
|
|
@@ -36042,6 +36037,25 @@ function requireHasSymbols () {
|
|
|
36042
36037
|
return hasSymbols;
|
|
36043
36038
|
}
|
|
36044
36039
|
|
|
36040
|
+
var hasProto;
|
|
36041
|
+
var hasRequiredHasProto;
|
|
36042
|
+
|
|
36043
|
+
function requireHasProto () {
|
|
36044
|
+
if (hasRequiredHasProto) return hasProto;
|
|
36045
|
+
hasRequiredHasProto = 1;
|
|
36046
|
+
|
|
36047
|
+
var test = {
|
|
36048
|
+
foo: {}
|
|
36049
|
+
};
|
|
36050
|
+
|
|
36051
|
+
var $Object = Object;
|
|
36052
|
+
|
|
36053
|
+
hasProto = function hasProto() {
|
|
36054
|
+
return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
|
|
36055
|
+
};
|
|
36056
|
+
return hasProto;
|
|
36057
|
+
}
|
|
36058
|
+
|
|
36045
36059
|
var implementation;
|
|
36046
36060
|
var hasRequiredImplementation;
|
|
36047
36061
|
|
|
@@ -36052,43 +36066,75 @@ function requireImplementation () {
|
|
|
36052
36066
|
/* eslint no-invalid-this: 1 */
|
|
36053
36067
|
|
|
36054
36068
|
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
36055
|
-
var slice = Array.prototype.slice;
|
|
36056
36069
|
var toStr = Object.prototype.toString;
|
|
36070
|
+
var max = Math.max;
|
|
36057
36071
|
var funcType = '[object Function]';
|
|
36058
36072
|
|
|
36073
|
+
var concatty = function concatty(a, b) {
|
|
36074
|
+
var arr = [];
|
|
36075
|
+
|
|
36076
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
36077
|
+
arr[i] = a[i];
|
|
36078
|
+
}
|
|
36079
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
36080
|
+
arr[j + a.length] = b[j];
|
|
36081
|
+
}
|
|
36082
|
+
|
|
36083
|
+
return arr;
|
|
36084
|
+
};
|
|
36085
|
+
|
|
36086
|
+
var slicy = function slicy(arrLike, offset) {
|
|
36087
|
+
var arr = [];
|
|
36088
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
36089
|
+
arr[j] = arrLike[i];
|
|
36090
|
+
}
|
|
36091
|
+
return arr;
|
|
36092
|
+
};
|
|
36093
|
+
|
|
36094
|
+
var joiny = function (arr, joiner) {
|
|
36095
|
+
var str = '';
|
|
36096
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
36097
|
+
str += arr[i];
|
|
36098
|
+
if (i + 1 < arr.length) {
|
|
36099
|
+
str += joiner;
|
|
36100
|
+
}
|
|
36101
|
+
}
|
|
36102
|
+
return str;
|
|
36103
|
+
};
|
|
36104
|
+
|
|
36059
36105
|
implementation = function bind(that) {
|
|
36060
36106
|
var target = this;
|
|
36061
|
-
if (typeof target !== 'function' || toStr.
|
|
36107
|
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
|
36062
36108
|
throw new TypeError(ERROR_MESSAGE + target);
|
|
36063
36109
|
}
|
|
36064
|
-
var args =
|
|
36110
|
+
var args = slicy(arguments, 1);
|
|
36065
36111
|
|
|
36066
36112
|
var bound;
|
|
36067
36113
|
var binder = function () {
|
|
36068
36114
|
if (this instanceof bound) {
|
|
36069
36115
|
var result = target.apply(
|
|
36070
36116
|
this,
|
|
36071
|
-
args
|
|
36117
|
+
concatty(args, arguments)
|
|
36072
36118
|
);
|
|
36073
36119
|
if (Object(result) === result) {
|
|
36074
36120
|
return result;
|
|
36075
36121
|
}
|
|
36076
36122
|
return this;
|
|
36077
|
-
} else {
|
|
36078
|
-
return target.apply(
|
|
36079
|
-
that,
|
|
36080
|
-
args.concat(slice.call(arguments))
|
|
36081
|
-
);
|
|
36082
36123
|
}
|
|
36124
|
+
return target.apply(
|
|
36125
|
+
that,
|
|
36126
|
+
concatty(args, arguments)
|
|
36127
|
+
);
|
|
36128
|
+
|
|
36083
36129
|
};
|
|
36084
36130
|
|
|
36085
|
-
var boundLength =
|
|
36131
|
+
var boundLength = max(0, target.length - args.length);
|
|
36086
36132
|
var boundArgs = [];
|
|
36087
36133
|
for (var i = 0; i < boundLength; i++) {
|
|
36088
|
-
boundArgs
|
|
36134
|
+
boundArgs[i] = '$' + i;
|
|
36089
36135
|
}
|
|
36090
36136
|
|
|
36091
|
-
bound = Function('binder', 'return function (' + boundArgs
|
|
36137
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
36092
36138
|
|
|
36093
36139
|
if (target.prototype) {
|
|
36094
36140
|
var Empty = function Empty() {};
|
|
@@ -36115,17 +36161,20 @@ function requireFunctionBind () {
|
|
|
36115
36161
|
return functionBind;
|
|
36116
36162
|
}
|
|
36117
36163
|
|
|
36118
|
-
var
|
|
36119
|
-
var
|
|
36164
|
+
var hasown;
|
|
36165
|
+
var hasRequiredHasown;
|
|
36120
36166
|
|
|
36121
|
-
function
|
|
36122
|
-
if (
|
|
36123
|
-
|
|
36167
|
+
function requireHasown () {
|
|
36168
|
+
if (hasRequiredHasown) return hasown;
|
|
36169
|
+
hasRequiredHasown = 1;
|
|
36124
36170
|
|
|
36171
|
+
var call = Function.prototype.call;
|
|
36172
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
36125
36173
|
var bind = requireFunctionBind();
|
|
36126
36174
|
|
|
36127
|
-
|
|
36128
|
-
|
|
36175
|
+
/** @type {(o: {}, p: PropertyKey) => p is keyof o} */
|
|
36176
|
+
hasown = bind.call(call, $hasOwn);
|
|
36177
|
+
return hasown;
|
|
36129
36178
|
}
|
|
36130
36179
|
|
|
36131
36180
|
var getIntrinsic;
|
|
@@ -36178,18 +36227,23 @@ function requireGetIntrinsic () {
|
|
|
36178
36227
|
: throwTypeError;
|
|
36179
36228
|
|
|
36180
36229
|
var hasSymbols = requireHasSymbols()();
|
|
36230
|
+
var hasProto = requireHasProto()();
|
|
36181
36231
|
|
|
36182
|
-
var getProto = Object.getPrototypeOf ||
|
|
36232
|
+
var getProto = Object.getPrototypeOf || (
|
|
36233
|
+
hasProto
|
|
36234
|
+
? function (x) { return x.__proto__; } // eslint-disable-line no-proto
|
|
36235
|
+
: null
|
|
36236
|
+
);
|
|
36183
36237
|
|
|
36184
36238
|
var needsEval = {};
|
|
36185
36239
|
|
|
36186
|
-
var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
|
|
36240
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
36187
36241
|
|
|
36188
36242
|
var INTRINSICS = {
|
|
36189
36243
|
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
36190
36244
|
'%Array%': Array,
|
|
36191
36245
|
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
36192
|
-
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
36246
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
36193
36247
|
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
36194
36248
|
'%AsyncFunction%': needsEval,
|
|
36195
36249
|
'%AsyncGenerator%': needsEval,
|
|
@@ -36219,10 +36273,10 @@ function requireGetIntrinsic () {
|
|
|
36219
36273
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
36220
36274
|
'%isFinite%': isFinite,
|
|
36221
36275
|
'%isNaN%': isNaN,
|
|
36222
|
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
36276
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
36223
36277
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
36224
36278
|
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
36225
|
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
36279
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
36226
36280
|
'%Math%': Math,
|
|
36227
36281
|
'%Number%': Number,
|
|
36228
36282
|
'%Object%': Object,
|
|
@@ -36235,10 +36289,10 @@ function requireGetIntrinsic () {
|
|
|
36235
36289
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
36236
36290
|
'%RegExp%': RegExp,
|
|
36237
36291
|
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
36238
|
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
36292
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
36239
36293
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
36240
36294
|
'%String%': String,
|
|
36241
|
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
36295
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
36242
36296
|
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
36243
36297
|
'%SyntaxError%': $SyntaxError,
|
|
36244
36298
|
'%ThrowTypeError%': ThrowTypeError,
|
|
@@ -36254,12 +36308,14 @@ function requireGetIntrinsic () {
|
|
|
36254
36308
|
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
|
36255
36309
|
};
|
|
36256
36310
|
|
|
36257
|
-
|
|
36258
|
-
|
|
36259
|
-
|
|
36260
|
-
|
|
36261
|
-
|
|
36262
|
-
|
|
36311
|
+
if (getProto) {
|
|
36312
|
+
try {
|
|
36313
|
+
null.error; // eslint-disable-line no-unused-expressions
|
|
36314
|
+
} catch (e) {
|
|
36315
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
36316
|
+
var errorProto = getProto(getProto(e));
|
|
36317
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
36318
|
+
}
|
|
36263
36319
|
}
|
|
36264
36320
|
|
|
36265
36321
|
var doEval = function doEval(name) {
|
|
@@ -36277,7 +36333,7 @@ function requireGetIntrinsic () {
|
|
|
36277
36333
|
}
|
|
36278
36334
|
} else if (name === '%AsyncIteratorPrototype%') {
|
|
36279
36335
|
var gen = doEval('%AsyncGenerator%');
|
|
36280
|
-
if (gen) {
|
|
36336
|
+
if (gen && getProto) {
|
|
36281
36337
|
value = getProto(gen.prototype);
|
|
36282
36338
|
}
|
|
36283
36339
|
}
|
|
@@ -36342,7 +36398,7 @@ function requireGetIntrinsic () {
|
|
|
36342
36398
|
};
|
|
36343
36399
|
|
|
36344
36400
|
var bind = requireFunctionBind();
|
|
36345
|
-
var hasOwn =
|
|
36401
|
+
var hasOwn = requireHasown();
|
|
36346
36402
|
var $concat = bind.call(Function.call, Array.prototype.concat);
|
|
36347
36403
|
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
|
36348
36404
|
var $replace = bind.call(Function.call, String.prototype.replace);
|
|
@@ -36486,6 +36542,196 @@ var callBind = {
|
|
|
36486
36542
|
set exports(v){ callBindExports = v; },
|
|
36487
36543
|
};
|
|
36488
36544
|
|
|
36545
|
+
var hasPropertyDescriptors_1;
|
|
36546
|
+
var hasRequiredHasPropertyDescriptors;
|
|
36547
|
+
|
|
36548
|
+
function requireHasPropertyDescriptors () {
|
|
36549
|
+
if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
|
|
36550
|
+
hasRequiredHasPropertyDescriptors = 1;
|
|
36551
|
+
|
|
36552
|
+
var GetIntrinsic = requireGetIntrinsic();
|
|
36553
|
+
|
|
36554
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
36555
|
+
|
|
36556
|
+
var hasPropertyDescriptors = function hasPropertyDescriptors() {
|
|
36557
|
+
if ($defineProperty) {
|
|
36558
|
+
try {
|
|
36559
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
36560
|
+
return true;
|
|
36561
|
+
} catch (e) {
|
|
36562
|
+
// IE 8 has a broken defineProperty
|
|
36563
|
+
return false;
|
|
36564
|
+
}
|
|
36565
|
+
}
|
|
36566
|
+
return false;
|
|
36567
|
+
};
|
|
36568
|
+
|
|
36569
|
+
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
|
36570
|
+
// node v0.6 has a bug where array lengths can be Set but not Defined
|
|
36571
|
+
if (!hasPropertyDescriptors()) {
|
|
36572
|
+
return null;
|
|
36573
|
+
}
|
|
36574
|
+
try {
|
|
36575
|
+
return $defineProperty([], 'length', { value: 1 }).length !== 1;
|
|
36576
|
+
} catch (e) {
|
|
36577
|
+
// In Firefox 4-22, defining length on an array throws an exception.
|
|
36578
|
+
return true;
|
|
36579
|
+
}
|
|
36580
|
+
};
|
|
36581
|
+
|
|
36582
|
+
hasPropertyDescriptors_1 = hasPropertyDescriptors;
|
|
36583
|
+
return hasPropertyDescriptors_1;
|
|
36584
|
+
}
|
|
36585
|
+
|
|
36586
|
+
var gopd;
|
|
36587
|
+
var hasRequiredGopd;
|
|
36588
|
+
|
|
36589
|
+
function requireGopd () {
|
|
36590
|
+
if (hasRequiredGopd) return gopd;
|
|
36591
|
+
hasRequiredGopd = 1;
|
|
36592
|
+
|
|
36593
|
+
var GetIntrinsic = requireGetIntrinsic();
|
|
36594
|
+
|
|
36595
|
+
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
36596
|
+
|
|
36597
|
+
if ($gOPD) {
|
|
36598
|
+
try {
|
|
36599
|
+
$gOPD([], 'length');
|
|
36600
|
+
} catch (e) {
|
|
36601
|
+
// IE 8 has a broken gOPD
|
|
36602
|
+
$gOPD = null;
|
|
36603
|
+
}
|
|
36604
|
+
}
|
|
36605
|
+
|
|
36606
|
+
gopd = $gOPD;
|
|
36607
|
+
return gopd;
|
|
36608
|
+
}
|
|
36609
|
+
|
|
36610
|
+
var defineDataProperty;
|
|
36611
|
+
var hasRequiredDefineDataProperty;
|
|
36612
|
+
|
|
36613
|
+
function requireDefineDataProperty () {
|
|
36614
|
+
if (hasRequiredDefineDataProperty) return defineDataProperty;
|
|
36615
|
+
hasRequiredDefineDataProperty = 1;
|
|
36616
|
+
|
|
36617
|
+
var hasPropertyDescriptors = requireHasPropertyDescriptors()();
|
|
36618
|
+
|
|
36619
|
+
var GetIntrinsic = requireGetIntrinsic();
|
|
36620
|
+
|
|
36621
|
+
var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
|
|
36622
|
+
if ($defineProperty) {
|
|
36623
|
+
try {
|
|
36624
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
36625
|
+
} catch (e) {
|
|
36626
|
+
// IE 8 has a broken defineProperty
|
|
36627
|
+
$defineProperty = false;
|
|
36628
|
+
}
|
|
36629
|
+
}
|
|
36630
|
+
|
|
36631
|
+
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
|
36632
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
36633
|
+
|
|
36634
|
+
var gopd = requireGopd();
|
|
36635
|
+
|
|
36636
|
+
/** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
|
|
36637
|
+
defineDataProperty = function defineDataProperty(
|
|
36638
|
+
obj,
|
|
36639
|
+
property,
|
|
36640
|
+
value
|
|
36641
|
+
) {
|
|
36642
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
36643
|
+
throw new $TypeError('`obj` must be an object or a function`');
|
|
36644
|
+
}
|
|
36645
|
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
|
36646
|
+
throw new $TypeError('`property` must be a string or a symbol`');
|
|
36647
|
+
}
|
|
36648
|
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
|
36649
|
+
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
|
|
36650
|
+
}
|
|
36651
|
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
|
36652
|
+
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
|
|
36653
|
+
}
|
|
36654
|
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
|
36655
|
+
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
|
|
36656
|
+
}
|
|
36657
|
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
|
36658
|
+
throw new $TypeError('`loose`, if provided, must be a boolean');
|
|
36659
|
+
}
|
|
36660
|
+
|
|
36661
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
|
36662
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
|
36663
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
|
36664
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
|
36665
|
+
|
|
36666
|
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
|
36667
|
+
var desc = !!gopd && gopd(obj, property);
|
|
36668
|
+
|
|
36669
|
+
if ($defineProperty) {
|
|
36670
|
+
$defineProperty(obj, property, {
|
|
36671
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
|
36672
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
|
36673
|
+
value: value,
|
|
36674
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
|
36675
|
+
});
|
|
36676
|
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
|
36677
|
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
|
36678
|
+
obj[property] = value; // eslint-disable-line no-param-reassign
|
|
36679
|
+
} else {
|
|
36680
|
+
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
|
36681
|
+
}
|
|
36682
|
+
};
|
|
36683
|
+
return defineDataProperty;
|
|
36684
|
+
}
|
|
36685
|
+
|
|
36686
|
+
var setFunctionLength;
|
|
36687
|
+
var hasRequiredSetFunctionLength;
|
|
36688
|
+
|
|
36689
|
+
function requireSetFunctionLength () {
|
|
36690
|
+
if (hasRequiredSetFunctionLength) return setFunctionLength;
|
|
36691
|
+
hasRequiredSetFunctionLength = 1;
|
|
36692
|
+
|
|
36693
|
+
var GetIntrinsic = requireGetIntrinsic();
|
|
36694
|
+
var define = requireDefineDataProperty();
|
|
36695
|
+
var hasDescriptors = requireHasPropertyDescriptors()();
|
|
36696
|
+
var gOPD = requireGopd();
|
|
36697
|
+
|
|
36698
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
36699
|
+
var $floor = GetIntrinsic('%Math.floor%');
|
|
36700
|
+
|
|
36701
|
+
setFunctionLength = function setFunctionLength(fn, length) {
|
|
36702
|
+
if (typeof fn !== 'function') {
|
|
36703
|
+
throw new $TypeError('`fn` is not a function');
|
|
36704
|
+
}
|
|
36705
|
+
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
|
|
36706
|
+
throw new $TypeError('`length` must be a positive 32-bit integer');
|
|
36707
|
+
}
|
|
36708
|
+
|
|
36709
|
+
var loose = arguments.length > 2 && !!arguments[2];
|
|
36710
|
+
|
|
36711
|
+
var functionLengthIsConfigurable = true;
|
|
36712
|
+
var functionLengthIsWritable = true;
|
|
36713
|
+
if ('length' in fn && gOPD) {
|
|
36714
|
+
var desc = gOPD(fn, 'length');
|
|
36715
|
+
if (desc && !desc.configurable) {
|
|
36716
|
+
functionLengthIsConfigurable = false;
|
|
36717
|
+
}
|
|
36718
|
+
if (desc && !desc.writable) {
|
|
36719
|
+
functionLengthIsWritable = false;
|
|
36720
|
+
}
|
|
36721
|
+
}
|
|
36722
|
+
|
|
36723
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
|
|
36724
|
+
if (hasDescriptors) {
|
|
36725
|
+
define(fn, 'length', length, true, true);
|
|
36726
|
+
} else {
|
|
36727
|
+
define(fn, 'length', length);
|
|
36728
|
+
}
|
|
36729
|
+
}
|
|
36730
|
+
return fn;
|
|
36731
|
+
};
|
|
36732
|
+
return setFunctionLength;
|
|
36733
|
+
}
|
|
36734
|
+
|
|
36489
36735
|
var hasRequiredCallBind;
|
|
36490
36736
|
|
|
36491
36737
|
function requireCallBind () {
|
|
@@ -36495,12 +36741,13 @@ function requireCallBind () {
|
|
|
36495
36741
|
|
|
36496
36742
|
var bind = requireFunctionBind();
|
|
36497
36743
|
var GetIntrinsic = requireGetIntrinsic();
|
|
36744
|
+
var setFunctionLength = requireSetFunctionLength();
|
|
36498
36745
|
|
|
36746
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
36499
36747
|
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
36500
36748
|
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
36501
36749
|
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
36502
36750
|
|
|
36503
|
-
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
36504
36751
|
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
36505
36752
|
var $max = GetIntrinsic('%Math.max%');
|
|
36506
36753
|
|
|
@@ -36514,19 +36761,15 @@ function requireCallBind () {
|
|
|
36514
36761
|
}
|
|
36515
36762
|
|
|
36516
36763
|
module.exports = function callBind(originalFunction) {
|
|
36517
|
-
|
|
36518
|
-
|
|
36519
|
-
var desc = $gOPD(func, 'length');
|
|
36520
|
-
if (desc.configurable) {
|
|
36521
|
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
36522
|
-
$defineProperty(
|
|
36523
|
-
func,
|
|
36524
|
-
'length',
|
|
36525
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
36526
|
-
);
|
|
36527
|
-
}
|
|
36764
|
+
if (typeof originalFunction !== 'function') {
|
|
36765
|
+
throw new $TypeError('a function is required');
|
|
36528
36766
|
}
|
|
36529
|
-
|
|
36767
|
+
var func = $reflectApply(bind, $call, arguments);
|
|
36768
|
+
return setFunctionLength(
|
|
36769
|
+
func,
|
|
36770
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
|
36771
|
+
true
|
|
36772
|
+
);
|
|
36530
36773
|
};
|
|
36531
36774
|
|
|
36532
36775
|
var applyBind = function applyBind() {
|
|
@@ -36822,6 +37065,14 @@ function requireObjectInspect () {
|
|
|
36822
37065
|
if (isString(obj)) {
|
|
36823
37066
|
return markBoxed(inspect(String(obj)));
|
|
36824
37067
|
}
|
|
37068
|
+
// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
37069
|
+
/* eslint-env browser */
|
|
37070
|
+
if (typeof window !== 'undefined' && obj === window) {
|
|
37071
|
+
return '{ [object Window] }';
|
|
37072
|
+
}
|
|
37073
|
+
if (obj === commonjsGlobal) {
|
|
37074
|
+
return '{ [object globalThis] }';
|
|
37075
|
+
}
|
|
36825
37076
|
if (!isDate(obj) && !isRegExp(obj)) {
|
|
36826
37077
|
var ys = arrObjKeys(obj, inspect);
|
|
36827
37078
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
@@ -38169,7 +38420,7 @@ function requireUrlencoded () {
|
|
|
38169
38420
|
var bytes = bytesExports;
|
|
38170
38421
|
var contentType = requireContentType();
|
|
38171
38422
|
var createError = requireHttpErrors();
|
|
38172
|
-
var debug = requireSrc
|
|
38423
|
+
var debug = requireSrc()('body-parser:urlencoded');
|
|
38173
38424
|
var deprecate = depd_1('body-parser');
|
|
38174
38425
|
var read = requireRead();
|
|
38175
38426
|
var typeis = requireTypeIs();
|
|
@@ -38984,7 +39235,7 @@ function fresh$3 (url, parsedUrl) {
|
|
|
38984
39235
|
* @private
|
|
38985
39236
|
*/
|
|
38986
39237
|
|
|
38987
|
-
var debug$5 = requireSrc
|
|
39238
|
+
var debug$5 = requireSrc()('finalhandler');
|
|
38988
39239
|
var encodeUrl$2 = encodeurl;
|
|
38989
39240
|
var escapeHtml$2 = escapeHtml_1;
|
|
38990
39241
|
var onFinished$2 = requireOnFinished();
|
|
@@ -39521,7 +39772,7 @@ function pathtoRegexp(path, keys, options) {
|
|
|
39521
39772
|
*/
|
|
39522
39773
|
|
|
39523
39774
|
var pathRegexp = pathToRegexp;
|
|
39524
|
-
var debug$4 = requireSrc
|
|
39775
|
+
var debug$4 = requireSrc()('express:router:layer');
|
|
39525
39776
|
|
|
39526
39777
|
/**
|
|
39527
39778
|
* Module variables.
|
|
@@ -39768,7 +40019,7 @@ function getBasicNodeMethods() {
|
|
|
39768
40019
|
* @private
|
|
39769
40020
|
*/
|
|
39770
40021
|
|
|
39771
|
-
var debug$3 = requireSrc
|
|
40022
|
+
var debug$3 = requireSrc()('express:router:route');
|
|
39772
40023
|
var flatten$1 = arrayFlatten_1;
|
|
39773
40024
|
var Layer$1 = layer;
|
|
39774
40025
|
var methods$1 = methods$2;
|
|
@@ -40028,7 +40279,7 @@ var Route = route;
|
|
|
40028
40279
|
var Layer = layer;
|
|
40029
40280
|
var methods = methods$2;
|
|
40030
40281
|
var mixin = utilsMergeExports;
|
|
40031
|
-
var debug$2 = requireSrc
|
|
40282
|
+
var debug$2 = requireSrc()('express:router');
|
|
40032
40283
|
var deprecate$3 = depd_1('express');
|
|
40033
40284
|
var flatten = arrayFlatten_1;
|
|
40034
40285
|
var parseUrl = parseurlExports;
|
|
@@ -40794,20 +41045,20 @@ function requireQuery () {
|
|
|
40794
41045
|
* @private
|
|
40795
41046
|
*/
|
|
40796
41047
|
|
|
40797
|
-
var debug$1 = requireSrc
|
|
40798
|
-
var path$
|
|
40799
|
-
var fs$
|
|
41048
|
+
var debug$1 = requireSrc()('express:view');
|
|
41049
|
+
var path$2 = path__default["default"];
|
|
41050
|
+
var fs$2 = fs__default["default"];
|
|
40800
41051
|
|
|
40801
41052
|
/**
|
|
40802
41053
|
* Module variables.
|
|
40803
41054
|
* @private
|
|
40804
41055
|
*/
|
|
40805
41056
|
|
|
40806
|
-
var dirname = path$
|
|
40807
|
-
var basename$1 = path$
|
|
40808
|
-
var extname$2 = path$
|
|
40809
|
-
var join$1 = path$
|
|
40810
|
-
var resolve$3 = path$
|
|
41057
|
+
var dirname = path$2.dirname;
|
|
41058
|
+
var basename$1 = path$2.basename;
|
|
41059
|
+
var extname$2 = path$2.extname;
|
|
41060
|
+
var join$1 = path$2.join;
|
|
41061
|
+
var resolve$3 = path$2.resolve;
|
|
40811
41062
|
|
|
40812
41063
|
/**
|
|
40813
41064
|
* Module exports.
|
|
@@ -40956,7 +41207,7 @@ function tryStat(path) {
|
|
|
40956
41207
|
debug$1('stat "%s"', path);
|
|
40957
41208
|
|
|
40958
41209
|
try {
|
|
40959
|
-
return fs$
|
|
41210
|
+
return fs$2.statSync(path);
|
|
40960
41211
|
} catch (e) {
|
|
40961
41212
|
return undefined;
|
|
40962
41213
|
}
|
|
@@ -44534,7 +44785,7 @@ var require$$2 = {
|
|
|
44534
44785
|
]
|
|
44535
44786
|
};
|
|
44536
44787
|
|
|
44537
|
-
var fs$
|
|
44788
|
+
var fs$1 = fs__default["default"];
|
|
44538
44789
|
|
|
44539
44790
|
function Mime() {
|
|
44540
44791
|
// Map of extension -> mime type
|
|
@@ -44584,7 +44835,7 @@ Mime.prototype.load = function(file) {
|
|
|
44584
44835
|
this._loading = file;
|
|
44585
44836
|
// Read file and split into lines
|
|
44586
44837
|
var map = {},
|
|
44587
|
-
content = fs$
|
|
44838
|
+
content = fs$1.readFileSync(file, 'ascii'),
|
|
44588
44839
|
lines = content.split(/[\r\n]+/);
|
|
44589
44840
|
|
|
44590
44841
|
lines.forEach(function(line) {
|
|
@@ -44979,19 +45230,19 @@ function sortByRangeStart (a, b) {
|
|
|
44979
45230
|
*/
|
|
44980
45231
|
|
|
44981
45232
|
var createError$1 = requireHttpErrors();
|
|
44982
|
-
var debug = requireSrc
|
|
45233
|
+
var debug = requireSrc()('send');
|
|
44983
45234
|
var deprecate$2 = depd_1('send');
|
|
44984
45235
|
var destroy = requireDestroy();
|
|
44985
45236
|
var encodeUrl$1 = encodeurl;
|
|
44986
45237
|
var escapeHtml$1 = escapeHtml_1;
|
|
44987
45238
|
var etag = etag_1;
|
|
44988
45239
|
var fresh$1 = fresh_1;
|
|
44989
|
-
var fs
|
|
45240
|
+
var fs = fs__default["default"];
|
|
44990
45241
|
var mime$2 = mime_1;
|
|
44991
45242
|
var ms = ms$1;
|
|
44992
45243
|
var onFinished$1 = requireOnFinished();
|
|
44993
45244
|
var parseRange$1 = rangeParser_1;
|
|
44994
|
-
var path$
|
|
45245
|
+
var path$1 = path__default["default"];
|
|
44995
45246
|
var statuses$1 = statuses$3;
|
|
44996
45247
|
var Stream = require$$0__default$1["default"];
|
|
44997
45248
|
var util = require$$4__default["default"];
|
|
@@ -45001,11 +45252,11 @@ var util = require$$4__default["default"];
|
|
|
45001
45252
|
* @private
|
|
45002
45253
|
*/
|
|
45003
45254
|
|
|
45004
|
-
var extname$1 = path$
|
|
45005
|
-
var join = path$
|
|
45006
|
-
var normalize = path$
|
|
45007
|
-
var resolve$2 = path$
|
|
45008
|
-
var sep = path$
|
|
45255
|
+
var extname$1 = path$1.extname;
|
|
45256
|
+
var join = path$1.join;
|
|
45257
|
+
var normalize = path$1.normalize;
|
|
45258
|
+
var resolve$2 = path$1.resolve;
|
|
45259
|
+
var sep = path$1.sep;
|
|
45009
45260
|
|
|
45010
45261
|
/**
|
|
45011
45262
|
* Regular expression for identifying a bytes Range header.
|
|
@@ -45680,7 +45931,7 @@ SendStream.prototype.sendFile = function sendFile (path) {
|
|
|
45680
45931
|
var self = this;
|
|
45681
45932
|
|
|
45682
45933
|
debug('stat "%s"', path);
|
|
45683
|
-
fs
|
|
45934
|
+
fs.stat(path, function onstat (err, stat) {
|
|
45684
45935
|
if (err && err.code === 'ENOENT' && !extname$1(path) && path[path.length - 1] !== sep) {
|
|
45685
45936
|
// not found, check extensions
|
|
45686
45937
|
return next(err)
|
|
@@ -45701,7 +45952,7 @@ SendStream.prototype.sendFile = function sendFile (path) {
|
|
|
45701
45952
|
var p = path + '.' + self._extensions[i++];
|
|
45702
45953
|
|
|
45703
45954
|
debug('stat "%s"', p);
|
|
45704
|
-
fs
|
|
45955
|
+
fs.stat(p, function (err, stat) {
|
|
45705
45956
|
if (err) return next(err)
|
|
45706
45957
|
if (stat.isDirectory()) return next()
|
|
45707
45958
|
self.emit('file', p, stat);
|
|
@@ -45729,7 +45980,7 @@ SendStream.prototype.sendIndex = function sendIndex (path) {
|
|
|
45729
45980
|
var p = join(path, self._index[i]);
|
|
45730
45981
|
|
|
45731
45982
|
debug('stat "%s"', p);
|
|
45732
|
-
fs
|
|
45983
|
+
fs.stat(p, function (err, stat) {
|
|
45733
45984
|
if (err) return next(err)
|
|
45734
45985
|
if (stat.isDirectory()) return next()
|
|
45735
45986
|
self.emit('file', p, stat);
|
|
@@ -45753,7 +46004,7 @@ SendStream.prototype.stream = function stream (path, options) {
|
|
|
45753
46004
|
var res = this.res;
|
|
45754
46005
|
|
|
45755
46006
|
// pipe
|
|
45756
|
-
var stream = fs
|
|
46007
|
+
var stream = fs.createReadStream(path, options);
|
|
45757
46008
|
this.emit('stream', stream);
|
|
45758
46009
|
stream.pipe(res);
|
|
45759
46010
|
|
|
@@ -47529,7 +47780,7 @@ function trustSingle (subnet) {
|
|
|
47529
47780
|
var methods = methods$2;
|
|
47530
47781
|
var middleware = init;
|
|
47531
47782
|
var query = requireQuery();
|
|
47532
|
-
var debug = requireSrc
|
|
47783
|
+
var debug = requireSrc()('express:application');
|
|
47533
47784
|
var View = view;
|
|
47534
47785
|
var http = require$$2__default["default"];
|
|
47535
47786
|
var compileETag = utils.compileETag;
|
|
@@ -50366,7 +50617,7 @@ var escapeHtml = escapeHtml_1;
|
|
|
50366
50617
|
var http = require$$2__default["default"];
|
|
50367
50618
|
var isAbsolute = utils.isAbsolute;
|
|
50368
50619
|
var onFinished = requireOnFinished();
|
|
50369
|
-
var path
|
|
50620
|
+
var path = path__default["default"];
|
|
50370
50621
|
var statuses = statuses$3;
|
|
50371
50622
|
var merge = utilsMergeExports;
|
|
50372
50623
|
var sign = cookieSignature.sign;
|
|
@@ -50375,9 +50626,9 @@ var normalizeTypes = utils.normalizeTypes;
|
|
|
50375
50626
|
var setCharset = utils.setCharset;
|
|
50376
50627
|
var cookie = cookie$1;
|
|
50377
50628
|
var send = sendExports;
|
|
50378
|
-
var extname = path
|
|
50629
|
+
var extname = path.extname;
|
|
50379
50630
|
var mime = send.mime;
|
|
50380
|
-
var resolve$1 = path
|
|
50631
|
+
var resolve$1 = path.resolve;
|
|
50381
50632
|
var vary = varyExports;
|
|
50382
50633
|
|
|
50383
50634
|
/**
|
|
@@ -51886,6 +52137,9 @@ class Server extends require$$0__default$2["default"] {
|
|
|
51886
52137
|
this.nonces = new WeakMap();
|
|
51887
52138
|
this.baseUrl = `http://localhost:${this.option.int("port", 8097)}`;
|
|
51888
52139
|
}
|
|
52140
|
+
get express() {
|
|
52141
|
+
return this.app;
|
|
52142
|
+
}
|
|
51889
52143
|
listen() {
|
|
51890
52144
|
return new Promise((resolve) => {
|
|
51891
52145
|
this.app = express();
|
|
@@ -51943,9 +52197,6 @@ class Server extends require$$0__default$2["default"] {
|
|
|
51943
52197
|
});
|
|
51944
52198
|
});
|
|
51945
52199
|
}
|
|
51946
|
-
get express() {
|
|
51947
|
-
return this.app;
|
|
51948
|
-
}
|
|
51949
52200
|
_handleCompile(req, ws, ip) {
|
|
51950
52201
|
// look at headers
|
|
51951
52202
|
if (!("x-fisk-environments" in req.headers)) {
|
|
@@ -52151,6 +52402,7 @@ class Server extends require$$0__default$2["default"] {
|
|
|
52151
52402
|
else {
|
|
52152
52403
|
console.error("Bad message without type", json);
|
|
52153
52404
|
}
|
|
52405
|
+
break;
|
|
52154
52406
|
}
|
|
52155
52407
|
case "object":
|
|
52156
52408
|
if (msg instanceof Buffer) {
|
|
@@ -52204,11 +52456,11 @@ class Server extends require$$0__default$2["default"] {
|
|
|
52204
52456
|
this._handleBuilder(req, client);
|
|
52205
52457
|
break;
|
|
52206
52458
|
case "/monitor":
|
|
52207
|
-
client = new Client(3 /* Monitor */, ws, ip);
|
|
52459
|
+
client = new Client(3 /* ClientType.Monitor */, ws, ip);
|
|
52208
52460
|
this._handleMonitor(req, client);
|
|
52209
52461
|
break;
|
|
52210
52462
|
case "/client_verify":
|
|
52211
|
-
client = new Client(4 /* ClientVerify */, ws, ip);
|
|
52463
|
+
client = new Client(4 /* ClientType.ClientVerify */, ws, ip);
|
|
52212
52464
|
this._handleClientVerify(req, client);
|
|
52213
52465
|
break;
|
|
52214
52466
|
default:
|
|
@@ -52232,7 +52484,7 @@ function validateCache(option) {
|
|
|
52232
52484
|
// console.log(dir);
|
|
52233
52485
|
let version;
|
|
52234
52486
|
try {
|
|
52235
|
-
version = fs$
|
|
52487
|
+
version = fs$4.readFileSync(file);
|
|
52236
52488
|
if (version.readUInt32BE() === Version) {
|
|
52237
52489
|
return;
|
|
52238
52490
|
}
|
|
@@ -52243,11 +52495,11 @@ function validateCache(option) {
|
|
|
52243
52495
|
if (version) {
|
|
52244
52496
|
console.log(`Wrong version. Destroying cache ${dir}`);
|
|
52245
52497
|
}
|
|
52246
|
-
fs$
|
|
52247
|
-
fs$
|
|
52498
|
+
fs$4.removeSync(dir);
|
|
52499
|
+
fs$4.mkdirpSync(dir);
|
|
52248
52500
|
const buf = Buffer.allocUnsafe(4);
|
|
52249
52501
|
buf.writeUInt32BE(Version);
|
|
52250
|
-
fs$
|
|
52502
|
+
fs$4.writeFileSync(file, buf);
|
|
52251
52503
|
}
|
|
52252
52504
|
function common$1(option) {
|
|
52253
52505
|
validateCache(option);
|
|
@@ -53238,273 +53490,269 @@ var xdgBasedir = {};
|
|
|
53238
53490
|
}
|
|
53239
53491
|
} (xdgBasedir));
|
|
53240
53492
|
|
|
53241
|
-
|
|
53242
|
-
var
|
|
53493
|
+
function hasKey(obj, keys) {
|
|
53494
|
+
var o = obj;
|
|
53495
|
+
keys.slice(0, -1).forEach(function (key) {
|
|
53496
|
+
o = o[key] || {};
|
|
53497
|
+
});
|
|
53243
53498
|
|
|
53244
|
-
|
|
53245
|
-
|
|
53246
|
-
|
|
53247
|
-
minimist = function (args, opts) {
|
|
53248
|
-
if (!opts) opts = {};
|
|
53249
|
-
|
|
53250
|
-
var flags = { bools : {}, strings : {}, unknownFn: null };
|
|
53499
|
+
var key = keys[keys.length - 1];
|
|
53500
|
+
return key in o;
|
|
53501
|
+
}
|
|
53251
53502
|
|
|
53252
|
-
|
|
53253
|
-
|
|
53254
|
-
|
|
53503
|
+
function isNumber(x) {
|
|
53504
|
+
if (typeof x === 'number') { return true; }
|
|
53505
|
+
if ((/^0x[0-9a-f]+$/i).test(x)) { return true; }
|
|
53506
|
+
return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x);
|
|
53507
|
+
}
|
|
53255
53508
|
|
|
53256
|
-
|
|
53257
|
-
|
|
53258
|
-
|
|
53259
|
-
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
|
|
53260
|
-
flags.bools[key] = true;
|
|
53261
|
-
});
|
|
53262
|
-
}
|
|
53263
|
-
|
|
53264
|
-
var aliases = {};
|
|
53265
|
-
Object.keys(opts.alias || {}).forEach(function (key) {
|
|
53266
|
-
aliases[key] = [].concat(opts.alias[key]);
|
|
53267
|
-
aliases[key].forEach(function (x) {
|
|
53268
|
-
aliases[x] = [key].concat(aliases[key].filter(function (y) {
|
|
53269
|
-
return x !== y;
|
|
53270
|
-
}));
|
|
53271
|
-
});
|
|
53272
|
-
});
|
|
53509
|
+
function isConstructorOrProto(obj, key) {
|
|
53510
|
+
return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';
|
|
53511
|
+
}
|
|
53273
53512
|
|
|
53274
|
-
|
|
53275
|
-
|
|
53276
|
-
if (aliases[key]) {
|
|
53277
|
-
flags.strings[aliases[key]] = true;
|
|
53278
|
-
}
|
|
53279
|
-
});
|
|
53513
|
+
var minimist = function (args, opts) {
|
|
53514
|
+
if (!opts) { opts = {}; }
|
|
53280
53515
|
|
|
53281
|
-
|
|
53282
|
-
|
|
53283
|
-
|
|
53284
|
-
|
|
53285
|
-
|
|
53286
|
-
});
|
|
53287
|
-
|
|
53288
|
-
var notFlags = [];
|
|
53516
|
+
var flags = {
|
|
53517
|
+
bools: {},
|
|
53518
|
+
strings: {},
|
|
53519
|
+
unknownFn: null,
|
|
53520
|
+
};
|
|
53289
53521
|
|
|
53290
|
-
|
|
53291
|
-
|
|
53292
|
-
|
|
53293
|
-
}
|
|
53522
|
+
if (typeof opts.unknown === 'function') {
|
|
53523
|
+
flags.unknownFn = opts.unknown;
|
|
53524
|
+
}
|
|
53294
53525
|
|
|
53295
|
-
|
|
53296
|
-
|
|
53297
|
-
|
|
53298
|
-
|
|
53526
|
+
if (typeof opts.boolean === 'boolean' && opts.boolean) {
|
|
53527
|
+
flags.allBools = true;
|
|
53528
|
+
} else {
|
|
53529
|
+
[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
|
|
53530
|
+
flags.bools[key] = true;
|
|
53531
|
+
});
|
|
53532
|
+
}
|
|
53299
53533
|
|
|
53300
|
-
|
|
53301
|
-
if (arg && flags.unknownFn && !argDefined(key, arg)) {
|
|
53302
|
-
if (flags.unknownFn(arg) === false) return;
|
|
53303
|
-
}
|
|
53534
|
+
var aliases = {};
|
|
53304
53535
|
|
|
53305
|
-
|
|
53306
|
-
|
|
53307
|
-
|
|
53308
|
-
|
|
53309
|
-
|
|
53310
|
-
(aliases[key] || []).forEach(function (x) {
|
|
53311
|
-
setKey(argv, x.split('.'), value);
|
|
53312
|
-
});
|
|
53313
|
-
}
|
|
53536
|
+
function aliasIsBoolean(key) {
|
|
53537
|
+
return aliases[key].some(function (x) {
|
|
53538
|
+
return flags.bools[x];
|
|
53539
|
+
});
|
|
53540
|
+
}
|
|
53314
53541
|
|
|
53315
|
-
|
|
53316
|
-
|
|
53317
|
-
|
|
53318
|
-
|
|
53319
|
-
|
|
53320
|
-
|
|
53321
|
-
|
|
53322
|
-
|
|
53323
|
-
if (o[key] === Array.prototype) o[key] = [];
|
|
53324
|
-
o = o[key];
|
|
53325
|
-
}
|
|
53542
|
+
Object.keys(opts.alias || {}).forEach(function (key) {
|
|
53543
|
+
aliases[key] = [].concat(opts.alias[key]);
|
|
53544
|
+
aliases[key].forEach(function (x) {
|
|
53545
|
+
aliases[x] = [key].concat(aliases[key].filter(function (y) {
|
|
53546
|
+
return x !== y;
|
|
53547
|
+
}));
|
|
53548
|
+
});
|
|
53549
|
+
});
|
|
53326
53550
|
|
|
53327
|
-
|
|
53328
|
-
|
|
53329
|
-
|
|
53330
|
-
|
|
53331
|
-
|
|
53332
|
-
|
|
53333
|
-
|
|
53334
|
-
|
|
53335
|
-
else if (Array.isArray(o[key])) {
|
|
53336
|
-
o[key].push(value);
|
|
53337
|
-
}
|
|
53338
|
-
else {
|
|
53339
|
-
o[key] = [ o[key], value ];
|
|
53340
|
-
}
|
|
53341
|
-
}
|
|
53342
|
-
|
|
53343
|
-
function aliasIsBoolean(key) {
|
|
53344
|
-
return aliases[key].some(function (x) {
|
|
53345
|
-
return flags.bools[x];
|
|
53346
|
-
});
|
|
53347
|
-
}
|
|
53551
|
+
[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
|
53552
|
+
flags.strings[key] = true;
|
|
53553
|
+
if (aliases[key]) {
|
|
53554
|
+
[].concat(aliases[key]).forEach(function (k) {
|
|
53555
|
+
flags.strings[k] = true;
|
|
53556
|
+
});
|
|
53557
|
+
}
|
|
53558
|
+
});
|
|
53348
53559
|
|
|
53349
|
-
|
|
53350
|
-
var arg = args[i];
|
|
53351
|
-
|
|
53352
|
-
if (/^--.+=/.test(arg)) {
|
|
53353
|
-
// Using [\s\S] instead of . because js doesn't support the
|
|
53354
|
-
// 'dotall' regex modifier. See:
|
|
53355
|
-
// http://stackoverflow.com/a/1068308/13216
|
|
53356
|
-
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
53357
|
-
var key = m[1];
|
|
53358
|
-
var value = m[2];
|
|
53359
|
-
if (flags.bools[key]) {
|
|
53360
|
-
value = value !== 'false';
|
|
53361
|
-
}
|
|
53362
|
-
setArg(key, value, arg);
|
|
53363
|
-
}
|
|
53364
|
-
else if (/^--no-.+/.test(arg)) {
|
|
53365
|
-
var key = arg.match(/^--no-(.+)/)[1];
|
|
53366
|
-
setArg(key, false, arg);
|
|
53367
|
-
}
|
|
53368
|
-
else if (/^--.+/.test(arg)) {
|
|
53369
|
-
var key = arg.match(/^--(.+)/)[1];
|
|
53370
|
-
var next = args[i + 1];
|
|
53371
|
-
if (next !== undefined && !/^-/.test(next)
|
|
53372
|
-
&& !flags.bools[key]
|
|
53373
|
-
&& !flags.allBools
|
|
53374
|
-
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
53375
|
-
setArg(key, next, arg);
|
|
53376
|
-
i++;
|
|
53377
|
-
}
|
|
53378
|
-
else if (/^(true|false)$/.test(next)) {
|
|
53379
|
-
setArg(key, next === 'true', arg);
|
|
53380
|
-
i++;
|
|
53381
|
-
}
|
|
53382
|
-
else {
|
|
53383
|
-
setArg(key, flags.strings[key] ? '' : true, arg);
|
|
53384
|
-
}
|
|
53385
|
-
}
|
|
53386
|
-
else if (/^-[^-]+/.test(arg)) {
|
|
53387
|
-
var letters = arg.slice(1,-1).split('');
|
|
53388
|
-
|
|
53389
|
-
var broken = false;
|
|
53390
|
-
for (var j = 0; j < letters.length; j++) {
|
|
53391
|
-
var next = arg.slice(j+2);
|
|
53392
|
-
|
|
53393
|
-
if (next === '-') {
|
|
53394
|
-
setArg(letters[j], next, arg);
|
|
53395
|
-
continue;
|
|
53396
|
-
}
|
|
53397
|
-
|
|
53398
|
-
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
|
|
53399
|
-
setArg(letters[j], next.split('=')[1], arg);
|
|
53400
|
-
broken = true;
|
|
53401
|
-
break;
|
|
53402
|
-
}
|
|
53403
|
-
|
|
53404
|
-
if (/[A-Za-z]/.test(letters[j])
|
|
53405
|
-
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
|
53406
|
-
setArg(letters[j], next, arg);
|
|
53407
|
-
broken = true;
|
|
53408
|
-
break;
|
|
53409
|
-
}
|
|
53410
|
-
|
|
53411
|
-
if (letters[j+1] && letters[j+1].match(/\W/)) {
|
|
53412
|
-
setArg(letters[j], arg.slice(j+2), arg);
|
|
53413
|
-
broken = true;
|
|
53414
|
-
break;
|
|
53415
|
-
}
|
|
53416
|
-
else {
|
|
53417
|
-
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
|
|
53418
|
-
}
|
|
53419
|
-
}
|
|
53420
|
-
|
|
53421
|
-
var key = arg.slice(-1)[0];
|
|
53422
|
-
if (!broken && key !== '-') {
|
|
53423
|
-
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
|
|
53424
|
-
&& !flags.bools[key]
|
|
53425
|
-
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
53426
|
-
setArg(key, args[i+1], arg);
|
|
53427
|
-
i++;
|
|
53428
|
-
}
|
|
53429
|
-
else if (args[i+1] && /^(true|false)$/.test(args[i+1])) {
|
|
53430
|
-
setArg(key, args[i+1] === 'true', arg);
|
|
53431
|
-
i++;
|
|
53432
|
-
}
|
|
53433
|
-
else {
|
|
53434
|
-
setArg(key, flags.strings[key] ? '' : true, arg);
|
|
53435
|
-
}
|
|
53436
|
-
}
|
|
53437
|
-
}
|
|
53438
|
-
else {
|
|
53439
|
-
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
|
53440
|
-
argv._.push(
|
|
53441
|
-
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
|
|
53442
|
-
);
|
|
53443
|
-
}
|
|
53444
|
-
if (opts.stopEarly) {
|
|
53445
|
-
argv._.push.apply(argv._, args.slice(i + 1));
|
|
53446
|
-
break;
|
|
53447
|
-
}
|
|
53448
|
-
}
|
|
53449
|
-
}
|
|
53450
|
-
|
|
53451
|
-
Object.keys(defaults).forEach(function (key) {
|
|
53452
|
-
if (!hasKey(argv, key.split('.'))) {
|
|
53453
|
-
setKey(argv, key.split('.'), defaults[key]);
|
|
53454
|
-
|
|
53455
|
-
(aliases[key] || []).forEach(function (x) {
|
|
53456
|
-
setKey(argv, x.split('.'), defaults[key]);
|
|
53457
|
-
});
|
|
53458
|
-
}
|
|
53459
|
-
});
|
|
53460
|
-
|
|
53461
|
-
if (opts['--']) {
|
|
53462
|
-
argv['--'] = new Array();
|
|
53463
|
-
notFlags.forEach(function(key) {
|
|
53464
|
-
argv['--'].push(key);
|
|
53465
|
-
});
|
|
53466
|
-
}
|
|
53467
|
-
else {
|
|
53468
|
-
notFlags.forEach(function(key) {
|
|
53469
|
-
argv._.push(key);
|
|
53470
|
-
});
|
|
53471
|
-
}
|
|
53560
|
+
var defaults = opts.default || {};
|
|
53472
53561
|
|
|
53473
|
-
|
|
53474
|
-
};
|
|
53562
|
+
var argv = { _: [] };
|
|
53475
53563
|
|
|
53476
|
-
function
|
|
53477
|
-
|
|
53478
|
-
|
|
53479
|
-
|
|
53480
|
-
|
|
53564
|
+
function argDefined(key, arg) {
|
|
53565
|
+
return (flags.allBools && (/^--[^=]+$/).test(arg))
|
|
53566
|
+
|| flags.strings[key]
|
|
53567
|
+
|| flags.bools[key]
|
|
53568
|
+
|| aliases[key];
|
|
53569
|
+
}
|
|
53570
|
+
|
|
53571
|
+
function setKey(obj, keys, value) {
|
|
53572
|
+
var o = obj;
|
|
53573
|
+
for (var i = 0; i < keys.length - 1; i++) {
|
|
53574
|
+
var key = keys[i];
|
|
53575
|
+
if (isConstructorOrProto(o, key)) { return; }
|
|
53576
|
+
if (o[key] === undefined) { o[key] = {}; }
|
|
53577
|
+
if (
|
|
53578
|
+
o[key] === Object.prototype
|
|
53579
|
+
|| o[key] === Number.prototype
|
|
53580
|
+
|| o[key] === String.prototype
|
|
53581
|
+
) {
|
|
53582
|
+
o[key] = {};
|
|
53583
|
+
}
|
|
53584
|
+
if (o[key] === Array.prototype) { o[key] = []; }
|
|
53585
|
+
o = o[key];
|
|
53586
|
+
}
|
|
53481
53587
|
|
|
53482
|
-
|
|
53483
|
-
|
|
53588
|
+
var lastKey = keys[keys.length - 1];
|
|
53589
|
+
if (isConstructorOrProto(o, lastKey)) { return; }
|
|
53590
|
+
if (
|
|
53591
|
+
o === Object.prototype
|
|
53592
|
+
|| o === Number.prototype
|
|
53593
|
+
|| o === String.prototype
|
|
53594
|
+
) {
|
|
53595
|
+
o = {};
|
|
53596
|
+
}
|
|
53597
|
+
if (o === Array.prototype) { o = []; }
|
|
53598
|
+
if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {
|
|
53599
|
+
o[lastKey] = value;
|
|
53600
|
+
} else if (Array.isArray(o[lastKey])) {
|
|
53601
|
+
o[lastKey].push(value);
|
|
53602
|
+
} else {
|
|
53603
|
+
o[lastKey] = [o[lastKey], value];
|
|
53604
|
+
}
|
|
53484
53605
|
}
|
|
53485
53606
|
|
|
53486
|
-
function
|
|
53487
|
-
|
|
53488
|
-
|
|
53489
|
-
|
|
53607
|
+
function setArg(key, val, arg) {
|
|
53608
|
+
if (arg && flags.unknownFn && !argDefined(key, arg)) {
|
|
53609
|
+
if (flags.unknownFn(arg) === false) { return; }
|
|
53610
|
+
}
|
|
53611
|
+
|
|
53612
|
+
var value = !flags.strings[key] && isNumber(val)
|
|
53613
|
+
? Number(val)
|
|
53614
|
+
: val;
|
|
53615
|
+
setKey(argv, key.split('.'), value);
|
|
53616
|
+
|
|
53617
|
+
(aliases[key] || []).forEach(function (x) {
|
|
53618
|
+
setKey(argv, x.split('.'), value);
|
|
53619
|
+
});
|
|
53490
53620
|
}
|
|
53491
53621
|
|
|
53622
|
+
Object.keys(flags.bools).forEach(function (key) {
|
|
53623
|
+
setArg(key, defaults[key] === undefined ? false : defaults[key]);
|
|
53624
|
+
});
|
|
53625
|
+
|
|
53626
|
+
var notFlags = [];
|
|
53492
53627
|
|
|
53493
|
-
|
|
53494
|
-
|
|
53628
|
+
if (args.indexOf('--') !== -1) {
|
|
53629
|
+
notFlags = args.slice(args.indexOf('--') + 1);
|
|
53630
|
+
args = args.slice(0, args.indexOf('--'));
|
|
53495
53631
|
}
|
|
53496
|
-
return minimist;
|
|
53497
|
-
}
|
|
53498
53632
|
|
|
53499
|
-
|
|
53633
|
+
for (var i = 0; i < args.length; i++) {
|
|
53634
|
+
var arg = args[i];
|
|
53635
|
+
var key;
|
|
53636
|
+
var next;
|
|
53637
|
+
|
|
53638
|
+
if ((/^--.+=/).test(arg)) {
|
|
53639
|
+
// Using [\s\S] instead of . because js doesn't support the
|
|
53640
|
+
// 'dotall' regex modifier. See:
|
|
53641
|
+
// http://stackoverflow.com/a/1068308/13216
|
|
53642
|
+
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
53643
|
+
key = m[1];
|
|
53644
|
+
var value = m[2];
|
|
53645
|
+
if (flags.bools[key]) {
|
|
53646
|
+
value = value !== 'false';
|
|
53647
|
+
}
|
|
53648
|
+
setArg(key, value, arg);
|
|
53649
|
+
} else if ((/^--no-.+/).test(arg)) {
|
|
53650
|
+
key = arg.match(/^--no-(.+)/)[1];
|
|
53651
|
+
setArg(key, false, arg);
|
|
53652
|
+
} else if ((/^--.+/).test(arg)) {
|
|
53653
|
+
key = arg.match(/^--(.+)/)[1];
|
|
53654
|
+
next = args[i + 1];
|
|
53655
|
+
if (
|
|
53656
|
+
next !== undefined
|
|
53657
|
+
&& !(/^(-|--)[^-]/).test(next)
|
|
53658
|
+
&& !flags.bools[key]
|
|
53659
|
+
&& !flags.allBools
|
|
53660
|
+
&& (aliases[key] ? !aliasIsBoolean(key) : true)
|
|
53661
|
+
) {
|
|
53662
|
+
setArg(key, next, arg);
|
|
53663
|
+
i += 1;
|
|
53664
|
+
} else if ((/^(true|false)$/).test(next)) {
|
|
53665
|
+
setArg(key, next === 'true', arg);
|
|
53666
|
+
i += 1;
|
|
53667
|
+
} else {
|
|
53668
|
+
setArg(key, flags.strings[key] ? '' : true, arg);
|
|
53669
|
+
}
|
|
53670
|
+
} else if ((/^-[^-]+/).test(arg)) {
|
|
53671
|
+
var letters = arg.slice(1, -1).split('');
|
|
53672
|
+
|
|
53673
|
+
var broken = false;
|
|
53674
|
+
for (var j = 0; j < letters.length; j++) {
|
|
53675
|
+
next = arg.slice(j + 2);
|
|
53500
53676
|
|
|
53501
|
-
|
|
53502
|
-
|
|
53503
|
-
|
|
53504
|
-
|
|
53677
|
+
if (next === '-') {
|
|
53678
|
+
setArg(letters[j], next, arg);
|
|
53679
|
+
continue;
|
|
53680
|
+
}
|
|
53505
53681
|
|
|
53506
|
-
|
|
53507
|
-
|
|
53682
|
+
if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {
|
|
53683
|
+
setArg(letters[j], next.slice(1), arg);
|
|
53684
|
+
broken = true;
|
|
53685
|
+
break;
|
|
53686
|
+
}
|
|
53687
|
+
|
|
53688
|
+
if (
|
|
53689
|
+
(/[A-Za-z]/).test(letters[j])
|
|
53690
|
+
&& (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next)
|
|
53691
|
+
) {
|
|
53692
|
+
setArg(letters[j], next, arg);
|
|
53693
|
+
broken = true;
|
|
53694
|
+
break;
|
|
53695
|
+
}
|
|
53696
|
+
|
|
53697
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
53698
|
+
setArg(letters[j], arg.slice(j + 2), arg);
|
|
53699
|
+
broken = true;
|
|
53700
|
+
break;
|
|
53701
|
+
} else {
|
|
53702
|
+
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
|
|
53703
|
+
}
|
|
53704
|
+
}
|
|
53705
|
+
|
|
53706
|
+
key = arg.slice(-1)[0];
|
|
53707
|
+
if (!broken && key !== '-') {
|
|
53708
|
+
if (
|
|
53709
|
+
args[i + 1]
|
|
53710
|
+
&& !(/^(-|--)[^-]/).test(args[i + 1])
|
|
53711
|
+
&& !flags.bools[key]
|
|
53712
|
+
&& (aliases[key] ? !aliasIsBoolean(key) : true)
|
|
53713
|
+
) {
|
|
53714
|
+
setArg(key, args[i + 1], arg);
|
|
53715
|
+
i += 1;
|
|
53716
|
+
} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {
|
|
53717
|
+
setArg(key, args[i + 1] === 'true', arg);
|
|
53718
|
+
i += 1;
|
|
53719
|
+
} else {
|
|
53720
|
+
setArg(key, flags.strings[key] ? '' : true, arg);
|
|
53721
|
+
}
|
|
53722
|
+
}
|
|
53723
|
+
} else {
|
|
53724
|
+
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
|
53725
|
+
argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
|
|
53726
|
+
}
|
|
53727
|
+
if (opts.stopEarly) {
|
|
53728
|
+
argv._.push.apply(argv._, args.slice(i + 1));
|
|
53729
|
+
break;
|
|
53730
|
+
}
|
|
53731
|
+
}
|
|
53732
|
+
}
|
|
53733
|
+
|
|
53734
|
+
Object.keys(defaults).forEach(function (k) {
|
|
53735
|
+
if (!hasKey(argv, k.split('.'))) {
|
|
53736
|
+
setKey(argv, k.split('.'), defaults[k]);
|
|
53737
|
+
|
|
53738
|
+
(aliases[k] || []).forEach(function (x) {
|
|
53739
|
+
setKey(argv, x.split('.'), defaults[k]);
|
|
53740
|
+
});
|
|
53741
|
+
}
|
|
53742
|
+
});
|
|
53743
|
+
|
|
53744
|
+
if (opts['--']) {
|
|
53745
|
+
argv['--'] = notFlags.slice();
|
|
53746
|
+
} else {
|
|
53747
|
+
notFlags.forEach(function (k) {
|
|
53748
|
+
argv._.push(k);
|
|
53749
|
+
});
|
|
53750
|
+
}
|
|
53751
|
+
|
|
53752
|
+
return argv;
|
|
53753
|
+
};
|
|
53754
|
+
|
|
53755
|
+
function split(data) {
|
|
53508
53756
|
const pre = data.split("\n");
|
|
53509
53757
|
// rejoin with lines that starts with a whitespace
|
|
53510
53758
|
const out = [];
|
|
@@ -53523,7 +53771,8 @@ function split(data)
|
|
|
53523
53771
|
--idx;
|
|
53524
53772
|
if (idx < cur.length - 1)
|
|
53525
53773
|
cur = cur.substr(0, idx + 1);
|
|
53526
|
-
}
|
|
53774
|
+
}
|
|
53775
|
+
else if (cur.length > 0) {
|
|
53527
53776
|
out.push(cur.trim());
|
|
53528
53777
|
cur = line.trim();
|
|
53529
53778
|
}
|
|
@@ -53533,9 +53782,7 @@ function split(data)
|
|
|
53533
53782
|
}
|
|
53534
53783
|
return out;
|
|
53535
53784
|
}
|
|
53536
|
-
|
|
53537
|
-
function realValue(v)
|
|
53538
|
-
{
|
|
53785
|
+
function realValue(v) {
|
|
53539
53786
|
if (typeof v !== "string")
|
|
53540
53787
|
return v;
|
|
53541
53788
|
if (/^[-0-9.]+$/.exec(v)) {
|
|
@@ -53544,119 +53791,130 @@ function realValue(v)
|
|
|
53544
53791
|
return vf;
|
|
53545
53792
|
}
|
|
53546
53793
|
switch (v) {
|
|
53547
|
-
|
|
53548
|
-
|
|
53549
|
-
|
|
53550
|
-
|
|
53794
|
+
case "true":
|
|
53795
|
+
return true;
|
|
53796
|
+
case "false":
|
|
53797
|
+
return false;
|
|
53551
53798
|
}
|
|
53552
53799
|
return v;
|
|
53553
53800
|
}
|
|
53554
|
-
|
|
53555
|
-
|
|
53801
|
+
class Engine {
|
|
53802
|
+
argv;
|
|
53803
|
+
prefix;
|
|
53804
|
+
additionalFiles;
|
|
53805
|
+
applicationPath;
|
|
53806
|
+
debug;
|
|
53807
|
+
options;
|
|
53808
|
+
configDirs;
|
|
53556
53809
|
constructor(options, argv) {
|
|
53557
53810
|
this.argv = Object.assign({}, argv);
|
|
53558
53811
|
this.prefix = options.prefix;
|
|
53559
53812
|
this.additionalFiles = options.additionalFiles || [];
|
|
53560
|
-
this.applicationPath = options.noApplicationPath ? "" :
|
|
53561
|
-
this.debug = options.debug;
|
|
53813
|
+
this.applicationPath = options.noApplicationPath ? "" : appRootPath.toString();
|
|
53814
|
+
this.debug = options.debug ?? false;
|
|
53562
53815
|
this.options = {};
|
|
53563
|
-
this.configDirs = this.argv["config-dir"] ||
|
|
53816
|
+
this.configDirs = this.argv["config-dir"] || options.configDirs || xdgBasedir.configDirs;
|
|
53564
53817
|
this._read();
|
|
53565
53818
|
}
|
|
53566
|
-
|
|
53567
53819
|
value(name) {
|
|
53568
53820
|
// foo-bar becomes FOO_BAR as env
|
|
53569
|
-
if (name in this.argv)
|
|
53821
|
+
if (name in this.argv) {
|
|
53570
53822
|
return this.argv[name];
|
|
53823
|
+
}
|
|
53571
53824
|
const envname = (this.prefix + "_" + name).replace(/-/g, "_").toUpperCase();
|
|
53572
|
-
if (envname in process.env)
|
|
53825
|
+
if (envname in process.env) {
|
|
53573
53826
|
return realValue(process.env[envname]);
|
|
53574
|
-
|
|
53575
|
-
if (name in this.options)
|
|
53827
|
+
}
|
|
53828
|
+
if (name in this.options) {
|
|
53576
53829
|
return this.options[name];
|
|
53830
|
+
}
|
|
53577
53831
|
return undefined;
|
|
53578
53832
|
}
|
|
53579
|
-
|
|
53833
|
+
string(name) {
|
|
53834
|
+
const ret = this.value(name);
|
|
53835
|
+
if (ret === undefined) {
|
|
53836
|
+
return undefined;
|
|
53837
|
+
}
|
|
53838
|
+
return String(ret);
|
|
53839
|
+
}
|
|
53580
53840
|
_homedir() {
|
|
53581
53841
|
let home = process.env.home;
|
|
53582
53842
|
if (home) {
|
|
53583
|
-
return
|
|
53843
|
+
return path__default["default"].join(home, ".config");
|
|
53584
53844
|
}
|
|
53585
53845
|
return undefined;
|
|
53586
53846
|
}
|
|
53587
|
-
|
|
53588
53847
|
_log(...args) {
|
|
53589
53848
|
if (this.debug)
|
|
53590
53849
|
console.log(...args);
|
|
53591
53850
|
}
|
|
53592
|
-
|
|
53593
53851
|
_read() {
|
|
53594
53852
|
// if we have a config file passed, read it
|
|
53595
|
-
let file = this.
|
|
53853
|
+
let file = this.string("config-file");
|
|
53596
53854
|
if (!file && this.prefix)
|
|
53597
53855
|
file = this.prefix + ".conf";
|
|
53598
53856
|
if (!file)
|
|
53599
53857
|
return;
|
|
53600
|
-
|
|
53601
53858
|
let data = [];
|
|
53602
53859
|
let seen = new Set();
|
|
53603
|
-
const
|
|
53604
|
-
const Success = 1;
|
|
53605
|
-
const Seen = 2;
|
|
53606
|
-
const read = file => {
|
|
53860
|
+
const read = (file) => {
|
|
53607
53861
|
if (seen.has(file))
|
|
53608
|
-
return Seen
|
|
53862
|
+
return 2 /* OptionsReadResult.Seen */;
|
|
53609
53863
|
seen.add(file);
|
|
53610
53864
|
try {
|
|
53611
|
-
const contents =
|
|
53865
|
+
const contents = fs__default["default"].readFileSync(file, "utf8");
|
|
53612
53866
|
this._log(`Loaded ${contents.length} bytes from ${file}`);
|
|
53613
|
-
|
|
53614
53867
|
if (contents) {
|
|
53615
|
-
data.push({ file
|
|
53616
|
-
return Success
|
|
53868
|
+
data.push({ file, contents });
|
|
53869
|
+
return 1 /* OptionsReadResult.Success */;
|
|
53617
53870
|
}
|
|
53618
|
-
}
|
|
53871
|
+
}
|
|
53872
|
+
catch (e) {
|
|
53619
53873
|
this._log(`Failed to load ${file}`);
|
|
53620
53874
|
}
|
|
53621
|
-
return Failed
|
|
53875
|
+
return 0 /* OptionsReadResult.Failed */;
|
|
53622
53876
|
};
|
|
53623
|
-
|
|
53624
53877
|
// console.log("about to read file", file, "additionalFiles", this.additionalFiles, "configDirs", this.configDirs, "applicationPath", this.applicationPath, "homedir", this._homedir());
|
|
53625
|
-
if (
|
|
53878
|
+
if (path__default["default"].isAbsolute(file)) {
|
|
53626
53879
|
read(file);
|
|
53627
|
-
}
|
|
53880
|
+
}
|
|
53881
|
+
else {
|
|
53628
53882
|
this.additionalFiles.forEach(file => {
|
|
53629
|
-
if (
|
|
53883
|
+
if (path__default["default"].isAbsolute(file) && read(file) == 0 /* OptionsReadResult.Failed */) {
|
|
53630
53884
|
read(file + ".conf");
|
|
53885
|
+
}
|
|
53631
53886
|
});
|
|
53632
53887
|
([this.applicationPath, this._homedir()].concat(this.configDirs)).forEach(root => {
|
|
53633
53888
|
// in case we appended with undefined
|
|
53634
|
-
if (!root)
|
|
53889
|
+
if (!root) {
|
|
53635
53890
|
return;
|
|
53891
|
+
}
|
|
53636
53892
|
this.additionalFiles.forEach(additional => {
|
|
53637
|
-
if (!
|
|
53638
|
-
let file =
|
|
53639
|
-
if (read(file) == Failed)
|
|
53893
|
+
if (!path__default["default"].isAbsolute(additional)) {
|
|
53894
|
+
let file = path__default["default"].join(root, additional);
|
|
53895
|
+
if (read(file) == 0 /* OptionsReadResult.Failed */)
|
|
53640
53896
|
read(file + ".conf");
|
|
53641
53897
|
}
|
|
53642
53898
|
});
|
|
53643
|
-
|
|
53644
|
-
|
|
53645
|
-
if (read(filePath) == Failed)
|
|
53899
|
+
let filePath = path__default["default"].join(root, file);
|
|
53900
|
+
if (read(filePath) == 0 /* OptionsReadResult.Failed */) {
|
|
53646
53901
|
read(filePath + ".conf");
|
|
53902
|
+
}
|
|
53647
53903
|
});
|
|
53648
53904
|
}
|
|
53649
53905
|
for (let i = data.length - 1; i >= 0; --i) {
|
|
53650
53906
|
let str = data[i].contents;
|
|
53651
|
-
if (!str)
|
|
53907
|
+
if (!str) {
|
|
53652
53908
|
continue;
|
|
53909
|
+
}
|
|
53653
53910
|
try {
|
|
53654
53911
|
let obj = JSON.parse(str);
|
|
53655
53912
|
for (let key in obj) {
|
|
53656
53913
|
this._log(`Assigning ${JSON.stringify(obj[key])} over ${JSON.stringify(this.options[key])} for ${key} from ${data[i].file} (JSON)`);
|
|
53657
53914
|
this.options[key] = obj[key];
|
|
53658
53915
|
}
|
|
53659
|
-
}
|
|
53916
|
+
}
|
|
53917
|
+
catch (err) {
|
|
53660
53918
|
const items = split(str);
|
|
53661
53919
|
for (let j = 0; j < items.length; ++j) {
|
|
53662
53920
|
const item = items[j].trim();
|
|
@@ -53669,12 +53927,12 @@ class Options {
|
|
|
53669
53927
|
this._log("Couldn't find =", item);
|
|
53670
53928
|
continue;
|
|
53671
53929
|
}
|
|
53672
|
-
const key = item.
|
|
53930
|
+
const key = item.substring(0, eq).trim();
|
|
53673
53931
|
if (!key.length) {
|
|
53674
53932
|
this._log("empty key", item);
|
|
53675
53933
|
continue;
|
|
53676
53934
|
}
|
|
53677
|
-
const value = item.
|
|
53935
|
+
const value = item.substring(eq + 1).trim();
|
|
53678
53936
|
this._log(`Assigning ${value} over ${this.options[key]} for ${key} from ${data[i].file} (INI)`);
|
|
53679
53937
|
this.options[key] = value;
|
|
53680
53938
|
}
|
|
@@ -53682,37 +53940,34 @@ class Options {
|
|
|
53682
53940
|
}
|
|
53683
53941
|
}
|
|
53684
53942
|
}
|
|
53685
|
-
|
|
53686
|
-
|
|
53687
|
-
|
|
53688
|
-
|
|
53689
|
-
if (!
|
|
53690
|
-
|
|
53691
|
-
|
|
53692
|
-
|
|
53693
|
-
|
|
53694
|
-
|
|
53695
|
-
|
|
53696
|
-
const val = data.options.value(name);
|
|
53697
|
-
if (typeof val === "undefined")
|
|
53943
|
+
function options (optionsOptions, argv) {
|
|
53944
|
+
if (!argv) {
|
|
53945
|
+
argv = minimist(process.argv.slice(2));
|
|
53946
|
+
}
|
|
53947
|
+
if (!(optionsOptions instanceof Object)) {
|
|
53948
|
+
optionsOptions = { prefix: optionsOptions || "" };
|
|
53949
|
+
}
|
|
53950
|
+
const engine = new Engine(optionsOptions, argv);
|
|
53951
|
+
function value(name, defaultValue) {
|
|
53952
|
+
const val = engine.value(name);
|
|
53953
|
+
if (val === undefined)
|
|
53698
53954
|
return defaultValue;
|
|
53699
53955
|
return val;
|
|
53700
|
-
}
|
|
53701
|
-
|
|
53702
|
-
|
|
53703
|
-
const v = parseInt(data.options.value(name));
|
|
53956
|
+
}
|
|
53957
|
+
function float(name, defaultValue) {
|
|
53958
|
+
const v = parseFloat(engine.string(name) || "");
|
|
53704
53959
|
if (typeof v === "number" && !isNaN(v))
|
|
53705
53960
|
return v;
|
|
53706
53961
|
return defaultValue;
|
|
53707
|
-
}
|
|
53708
|
-
|
|
53709
|
-
const v =
|
|
53962
|
+
}
|
|
53963
|
+
function int(name, defaultValue) {
|
|
53964
|
+
const v = parseInt(engine.string(name) || "");
|
|
53710
53965
|
if (typeof v === "number" && !isNaN(v))
|
|
53711
53966
|
return v;
|
|
53712
53967
|
return defaultValue;
|
|
53713
|
-
}
|
|
53714
|
-
|
|
53715
|
-
const opt =
|
|
53968
|
+
}
|
|
53969
|
+
function json(name, defaultValue) {
|
|
53970
|
+
const opt = engine.value(name);
|
|
53716
53971
|
if (opt === undefined)
|
|
53717
53972
|
return defaultValue;
|
|
53718
53973
|
if (typeof opt !== "string")
|
|
@@ -53720,12 +53975,22 @@ var options = function(options, argv) {
|
|
|
53720
53975
|
try {
|
|
53721
53976
|
const json = JSON.parse(opt);
|
|
53722
53977
|
return json;
|
|
53723
|
-
}
|
|
53978
|
+
}
|
|
53979
|
+
catch (e) {
|
|
53724
53980
|
}
|
|
53725
53981
|
return defaultValue;
|
|
53726
|
-
}
|
|
53727
|
-
|
|
53728
|
-
|
|
53982
|
+
}
|
|
53983
|
+
function string(name, defaultValue) {
|
|
53984
|
+
return engine.string(name) ?? defaultValue;
|
|
53985
|
+
}
|
|
53986
|
+
return Object.assign(value, {
|
|
53987
|
+
prefix: optionsOptions.prefix,
|
|
53988
|
+
float,
|
|
53989
|
+
int,
|
|
53990
|
+
json,
|
|
53991
|
+
string,
|
|
53992
|
+
});
|
|
53993
|
+
}
|
|
53729
53994
|
|
|
53730
53995
|
const option = options({
|
|
53731
53996
|
prefix: "fisk/scheduler",
|
|
@@ -53739,7 +54004,7 @@ const clientMinimumVersion = "3.4.96";
|
|
|
53739
54004
|
const serverStartTime = Date.now();
|
|
53740
54005
|
process.on("unhandledRejection", (reason, p) => {
|
|
53741
54006
|
console.error("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
|
|
53742
|
-
addLogFile({ source: "no source file", ip: "self", contents: `reason: ${reason.stack}
|
|
54007
|
+
addLogFile({ source: "no source file", ip: "self", contents: `reason: ${reason.stack} promise` });
|
|
53743
54008
|
// process.exit();
|
|
53744
54009
|
});
|
|
53745
54010
|
process.on("uncaughtException", (err) => {
|
|
@@ -53753,7 +54018,7 @@ server.on("error", (error) => {
|
|
|
53753
54018
|
});
|
|
53754
54019
|
let schedulerNpmVersion;
|
|
53755
54020
|
try {
|
|
53756
|
-
schedulerNpmVersion = String(JSON.parse(fs$
|
|
54021
|
+
schedulerNpmVersion = String(JSON.parse(fs$4.readFileSync(path__default["default"].join(__dirname, "../package.json"), "utf8")).version);
|
|
53757
54022
|
}
|
|
53758
54023
|
catch (err) {
|
|
53759
54024
|
console.log("Couldn't parse package json", err);
|
|
@@ -53773,7 +54038,7 @@ const db = new Database(path__default["default"].join(common.cacheDir(), "db.jso
|
|
|
53773
54038
|
let objectCache;
|
|
53774
54039
|
const logFileDir = path__default["default"].join(common.cacheDir(), "logs");
|
|
53775
54040
|
try {
|
|
53776
|
-
fs$
|
|
54041
|
+
fs$4.mkdirSync(logFileDir);
|
|
53777
54042
|
}
|
|
53778
54043
|
catch (err) {
|
|
53779
54044
|
/* */
|
|
@@ -53835,7 +54100,9 @@ function jobStartedOrScheduled(type, job) {
|
|
|
53835
54100
|
if (monitorsLog) {
|
|
53836
54101
|
console.log("send to monitors", info);
|
|
53837
54102
|
}
|
|
53838
|
-
monitors.forEach((monitor) =>
|
|
54103
|
+
monitors.forEach((monitor) => {
|
|
54104
|
+
monitor.send(info);
|
|
54105
|
+
});
|
|
53839
54106
|
}
|
|
53840
54107
|
}
|
|
53841
54108
|
function cacheHit(builder, message) {
|
|
@@ -53873,7 +54140,9 @@ function cacheHit(builder, message) {
|
|
|
53873
54140
|
console.log("send to monitors", info);
|
|
53874
54141
|
}
|
|
53875
54142
|
// console.log("sending info", info);
|
|
53876
|
-
monitors.forEach((monitor) =>
|
|
54143
|
+
monitors.forEach((monitor) => {
|
|
54144
|
+
monitor.send(info);
|
|
54145
|
+
});
|
|
53877
54146
|
}
|
|
53878
54147
|
}
|
|
53879
54148
|
function jobFinished(builder, job) {
|
|
@@ -53900,7 +54169,9 @@ function jobFinished(builder, job) {
|
|
|
53900
54169
|
if (monitorsLog) {
|
|
53901
54170
|
console.log("send to monitors", info);
|
|
53902
54171
|
}
|
|
53903
|
-
monitors.forEach((monitor) =>
|
|
54172
|
+
monitors.forEach((monitor) => {
|
|
54173
|
+
monitor.send(info);
|
|
54174
|
+
});
|
|
53904
54175
|
}
|
|
53905
54176
|
}
|
|
53906
54177
|
function builderKey(ip, port) {
|
|
@@ -53953,9 +54224,13 @@ function onObjectCacheCleared() {
|
|
|
53953
54224
|
jobsScheduled = 0;
|
|
53954
54225
|
jobsFinished = 0;
|
|
53955
54226
|
const msg = { type: "clearObjectCache" };
|
|
53956
|
-
forEachBuilder((builder) =>
|
|
54227
|
+
forEachBuilder((builder) => {
|
|
54228
|
+
builder.send(msg);
|
|
54229
|
+
});
|
|
53957
54230
|
const info = statsMessage();
|
|
53958
|
-
monitors.forEach((monitor) =>
|
|
54231
|
+
monitors.forEach((monitor) => {
|
|
54232
|
+
monitor.send(info);
|
|
54233
|
+
});
|
|
53959
54234
|
}
|
|
53960
54235
|
function setObjectCacheEnabled(on) {
|
|
53961
54236
|
if (on && !objectCache) {
|
|
@@ -54004,14 +54279,14 @@ function purgeEnvironmentsToMaxSize() {
|
|
|
54004
54279
|
const p = Environments.instance.path;
|
|
54005
54280
|
try {
|
|
54006
54281
|
let purged = false;
|
|
54007
|
-
fs$
|
|
54282
|
+
fs$4.readdirSync(p)
|
|
54008
54283
|
.map((file) => {
|
|
54009
54284
|
// console.log("got file", file);
|
|
54010
54285
|
const abs = path__default["default"].join(p, file);
|
|
54011
54286
|
if (file.length !== 47 || file.indexOf(".tar.gz", 40) !== 40) {
|
|
54012
54287
|
try {
|
|
54013
54288
|
console.log("Removing unexpected file", abs);
|
|
54014
|
-
fs$
|
|
54289
|
+
fs$4.removeSync(abs);
|
|
54015
54290
|
}
|
|
54016
54291
|
catch (err) {
|
|
54017
54292
|
console.error("Failed to remove file", abs, err);
|
|
@@ -54020,7 +54295,7 @@ function purgeEnvironmentsToMaxSize() {
|
|
|
54020
54295
|
}
|
|
54021
54296
|
let stat;
|
|
54022
54297
|
try {
|
|
54023
|
-
stat = fs$
|
|
54298
|
+
stat = fs$4.statSync(abs);
|
|
54024
54299
|
}
|
|
54025
54300
|
catch (err) {
|
|
54026
54301
|
return undefined;
|
|
@@ -54099,8 +54374,8 @@ function environmentsInfo() {
|
|
|
54099
54374
|
const max = option("max-environment-size");
|
|
54100
54375
|
ret.maxSizeBytes = max ? bytesExports.parse(String(max)) || 0 : 0;
|
|
54101
54376
|
let usedSizeBytes = 0;
|
|
54102
|
-
for (const
|
|
54103
|
-
const env = Environments.instance.environments[
|
|
54377
|
+
for (const hsh in Environments.instance.environments) {
|
|
54378
|
+
const env = Environments.instance.environments[hsh];
|
|
54104
54379
|
if (env.size) {
|
|
54105
54380
|
usedSizeBytes += env.size;
|
|
54106
54381
|
}
|
|
@@ -54122,8 +54397,8 @@ server.on("listen", (app) => {
|
|
|
54122
54397
|
app.get("/builders", (req, res) => {
|
|
54123
54398
|
const ret = [];
|
|
54124
54399
|
const now = Date.now();
|
|
54125
|
-
for (const
|
|
54126
|
-
const s = builders[
|
|
54400
|
+
for (const bKey in builders) {
|
|
54401
|
+
const s = builders[bKey];
|
|
54127
54402
|
ret.push({
|
|
54128
54403
|
ip: s.ip,
|
|
54129
54404
|
name: s.name,
|
|
@@ -54221,14 +54496,14 @@ server.on("listen", (app) => {
|
|
|
54221
54496
|
}
|
|
54222
54497
|
});
|
|
54223
54498
|
app.get("/environment/*", (req, res) => {
|
|
54224
|
-
const
|
|
54225
|
-
const env = Environments.instance.environment(
|
|
54226
|
-
console.log("got env request",
|
|
54499
|
+
const h = req.path.substr(13);
|
|
54500
|
+
const env = Environments.instance.environment(h);
|
|
54501
|
+
console.log("got env request", h, env);
|
|
54227
54502
|
if (!env) {
|
|
54228
54503
|
res.sendStatus(404);
|
|
54229
54504
|
return;
|
|
54230
54505
|
}
|
|
54231
|
-
const rstream = fs$
|
|
54506
|
+
const rstream = fs$4.createReadStream(env.path);
|
|
54232
54507
|
rstream.on("error", (err) => {
|
|
54233
54508
|
console.error("Got read stream error for", env.path, err);
|
|
54234
54509
|
rstream.close();
|
|
@@ -54239,7 +54514,7 @@ server.on("listen", (app) => {
|
|
|
54239
54514
|
console.log("quitting", req.query);
|
|
54240
54515
|
if ("purge_environments" in req.query) {
|
|
54241
54516
|
try {
|
|
54242
|
-
fs$
|
|
54517
|
+
fs$4.removeSync(path__default["default"].join(common.cacheDir(), "environments"));
|
|
54243
54518
|
}
|
|
54244
54519
|
catch (err) {
|
|
54245
54520
|
/* */
|
|
@@ -54313,26 +54588,28 @@ ${msg.stdout ? "stdout:\n" + msg.stdout + "\n" : ""}${msg.stderr ? "stderr:\n" +
|
|
|
54313
54588
|
});
|
|
54314
54589
|
function updateLogFilesToMonitors() {
|
|
54315
54590
|
if (monitors.length) {
|
|
54316
|
-
fs$
|
|
54591
|
+
fs$4.readdir(logFileDir, (err, files) => {
|
|
54317
54592
|
if (files) {
|
|
54318
54593
|
files = files.reverse();
|
|
54319
54594
|
}
|
|
54320
54595
|
const msg = { type: "logFiles", files: files || [] };
|
|
54321
54596
|
// console.log("sending files", msg);
|
|
54322
|
-
monitors.forEach((monitor) =>
|
|
54597
|
+
monitors.forEach((monitor) => {
|
|
54598
|
+
monitor.send(msg);
|
|
54599
|
+
});
|
|
54323
54600
|
});
|
|
54324
54601
|
}
|
|
54325
54602
|
}
|
|
54326
54603
|
function clearLogFiles() {
|
|
54327
|
-
fs$
|
|
54604
|
+
fs$4.readdir(logFileDir, (err, files) => {
|
|
54328
54605
|
if (err) {
|
|
54329
54606
|
console.log("Got error removing log files", err);
|
|
54330
54607
|
return;
|
|
54331
54608
|
}
|
|
54332
54609
|
for (const file of files) {
|
|
54333
|
-
fs$
|
|
54334
|
-
if (
|
|
54335
|
-
console.log("failed to remove file", path__default["default"].join(logFileDir, file),
|
|
54610
|
+
fs$4.unlink(path__default["default"].join(logFileDir, file), (error) => {
|
|
54611
|
+
if (error) {
|
|
54612
|
+
console.log("failed to remove file", path__default["default"].join(logFileDir, file), error);
|
|
54336
54613
|
}
|
|
54337
54614
|
});
|
|
54338
54615
|
}
|
|
@@ -54340,7 +54617,7 @@ function clearLogFiles() {
|
|
|
54340
54617
|
});
|
|
54341
54618
|
}
|
|
54342
54619
|
try {
|
|
54343
|
-
fs$
|
|
54620
|
+
fs$4.watch(logFileDir, (type) => {
|
|
54344
54621
|
if (type === "rename") {
|
|
54345
54622
|
updateLogFilesToMonitors();
|
|
54346
54623
|
}
|
|
@@ -54375,7 +54652,7 @@ function formatDate(date) {
|
|
|
54375
54652
|
}
|
|
54376
54653
|
function addLogFile(log) {
|
|
54377
54654
|
try {
|
|
54378
|
-
fs$
|
|
54655
|
+
fs$4.writeFileSync(path__default["default"].join(logFileDir, `${formatDate(new Date())} ${log.source} ${log.ip}`), log.contents);
|
|
54379
54656
|
}
|
|
54380
54657
|
catch (err) {
|
|
54381
54658
|
console.error(`Failed to write log file from ${log.ip}`, err);
|
|
@@ -54433,8 +54710,12 @@ server.on("builder", (builder) => {
|
|
|
54433
54710
|
++jobsStarted;
|
|
54434
54711
|
jobStartedOrScheduled("jobStarted", job);
|
|
54435
54712
|
});
|
|
54436
|
-
builder.on("jobFinished", (job) =>
|
|
54437
|
-
|
|
54713
|
+
builder.on("jobFinished", (job) => {
|
|
54714
|
+
jobFinished(builder, job);
|
|
54715
|
+
});
|
|
54716
|
+
builder.on("cacheHit", (job) => {
|
|
54717
|
+
cacheHit(builder, job);
|
|
54718
|
+
});
|
|
54438
54719
|
builder.on("jobAborted", (job) => {
|
|
54439
54720
|
console.log(`builder: ${builder.ip}:${builder.port} aborted a job`, job);
|
|
54440
54721
|
if (monitors.length) {
|
|
@@ -54442,7 +54723,9 @@ server.on("builder", (builder) => {
|
|
|
54442
54723
|
type: "jobAborted",
|
|
54443
54724
|
id: job.id
|
|
54444
54725
|
};
|
|
54445
|
-
monitors.forEach((monitor) =>
|
|
54726
|
+
monitors.forEach((monitor) => {
|
|
54727
|
+
monitor.send(info);
|
|
54728
|
+
});
|
|
54446
54729
|
}
|
|
54447
54730
|
});
|
|
54448
54731
|
});
|
|
@@ -54466,21 +54749,21 @@ function requestEnvironment(compile) {
|
|
|
54466
54749
|
compile.close();
|
|
54467
54750
|
return;
|
|
54468
54751
|
}
|
|
54469
|
-
const
|
|
54470
|
-
compile.on("uploadEnvironmentData", (
|
|
54752
|
+
const hsh = environment.hash;
|
|
54753
|
+
compile.on("uploadEnvironmentData", (env) => {
|
|
54471
54754
|
if (!file) {
|
|
54472
54755
|
console.error("no pending file");
|
|
54473
54756
|
compile.send({ error: "no pending file" });
|
|
54474
54757
|
compile.close();
|
|
54475
54758
|
return;
|
|
54476
54759
|
}
|
|
54477
|
-
if (
|
|
54760
|
+
if (env.last) {
|
|
54478
54761
|
gotLast = true;
|
|
54479
|
-
console.log("Got environmentdata message",
|
|
54762
|
+
console.log("Got environmentdata message", env.data.length, env.last);
|
|
54480
54763
|
}
|
|
54481
|
-
file.save(
|
|
54764
|
+
file.save(env.data)
|
|
54482
54765
|
.then(() => {
|
|
54483
|
-
if (
|
|
54766
|
+
if (env.last) {
|
|
54484
54767
|
assert__default["default"](file);
|
|
54485
54768
|
file.close();
|
|
54486
54769
|
compile.close();
|
|
@@ -54489,16 +54772,15 @@ function requestEnvironment(compile) {
|
|
|
54489
54772
|
return undefined;
|
|
54490
54773
|
})
|
|
54491
54774
|
.then(() => {
|
|
54492
|
-
if (
|
|
54775
|
+
if (env.last) {
|
|
54493
54776
|
file = undefined;
|
|
54494
54777
|
// send any new environments to builders
|
|
54495
|
-
delete pendingEnvironments[
|
|
54496
|
-
|
|
54778
|
+
delete pendingEnvironments[hsh];
|
|
54779
|
+
purgeEnvironmentsToMaxSize();
|
|
54497
54780
|
}
|
|
54498
|
-
return undefined;
|
|
54499
54781
|
})
|
|
54500
54782
|
.then(() => {
|
|
54501
|
-
if (
|
|
54783
|
+
if (env.last) {
|
|
54502
54784
|
syncEnvironments();
|
|
54503
54785
|
}
|
|
54504
54786
|
})
|
|
@@ -54556,17 +54838,17 @@ server.on("compile", (compile) => {
|
|
|
54556
54838
|
++jobsFailed;
|
|
54557
54839
|
return;
|
|
54558
54840
|
}
|
|
54559
|
-
|
|
54841
|
+
const score = (s) => {
|
|
54560
54842
|
const available = Math.min(4, s.slots - s.activeClients);
|
|
54561
54843
|
return available * (1 - s.load);
|
|
54562
|
-
}
|
|
54844
|
+
};
|
|
54563
54845
|
let builder;
|
|
54564
54846
|
let bestScore = Number.MIN_SAFE_INTEGER;
|
|
54565
54847
|
let env;
|
|
54566
54848
|
// console.log("got usableEnvs", usableEnvs);
|
|
54567
54849
|
// ### should have a function match(s) that checks for env, score and compile.builder etc
|
|
54568
54850
|
let foundInCache = false;
|
|
54569
|
-
|
|
54851
|
+
const filterBuilder = (s) => {
|
|
54570
54852
|
if (compile.builder && compile.builder !== s.ip && compile.builder !== s.name) {
|
|
54571
54853
|
return false;
|
|
54572
54854
|
}
|
|
@@ -54578,7 +54860,7 @@ server.on("compile", (compile) => {
|
|
|
54578
54860
|
}
|
|
54579
54861
|
}
|
|
54580
54862
|
return true;
|
|
54581
|
-
}
|
|
54863
|
+
};
|
|
54582
54864
|
if (objectCache && compile.sha1) {
|
|
54583
54865
|
const data = objectCache.get(compile.sha1);
|
|
54584
54866
|
if (data) {
|
|
@@ -54653,7 +54935,9 @@ server.on("compile", (compile) => {
|
|
|
54653
54935
|
});
|
|
54654
54936
|
if (peakInfo && monitors.length) {
|
|
54655
54937
|
const info = statsMessage();
|
|
54656
|
-
monitors.forEach((monitor) =>
|
|
54938
|
+
monitors.forEach((monitor) => {
|
|
54939
|
+
monitor.send(info);
|
|
54940
|
+
});
|
|
54657
54941
|
}
|
|
54658
54942
|
++builder.activeClients;
|
|
54659
54943
|
++builder.jobsScheduled;
|
|
@@ -54708,19 +54992,19 @@ function writeConfiguration(change) {
|
|
|
54708
54992
|
}
|
|
54709
54993
|
function hash(password, salt) {
|
|
54710
54994
|
return new Promise((resolve, reject) => {
|
|
54711
|
-
crypto__default["default"].pbkdf2(password, salt, 12000, 256, "sha512", (err,
|
|
54995
|
+
crypto__default["default"].pbkdf2(password, salt, 12000, 256, "sha512", (err, hsh) => {
|
|
54712
54996
|
if (err) {
|
|
54713
54997
|
reject(err);
|
|
54714
54998
|
}
|
|
54715
54999
|
else {
|
|
54716
|
-
resolve(
|
|
55000
|
+
resolve(hsh);
|
|
54717
55001
|
}
|
|
54718
55002
|
});
|
|
54719
55003
|
});
|
|
54720
55004
|
}
|
|
54721
|
-
function randomBytes(
|
|
55005
|
+
function randomBytes(byteLength) {
|
|
54722
55006
|
return new Promise((resolve, reject) => {
|
|
54723
|
-
crypto__default["default"].randomBytes(
|
|
55007
|
+
crypto__default["default"].randomBytes(byteLength, (err, result) => {
|
|
54724
55008
|
if (err) {
|
|
54725
55009
|
reject(new Error(`Failed to random bytes ${err}`));
|
|
54726
55010
|
}
|
|
@@ -54751,13 +55035,13 @@ server.on("monitor", (client) => {
|
|
|
54751
55035
|
console.log("Got monitor", client.ip, client.hostname);
|
|
54752
55036
|
}
|
|
54753
55037
|
monitors.push(client);
|
|
54754
|
-
|
|
55038
|
+
const remove = () => {
|
|
54755
55039
|
const idx = monitors.indexOf(client);
|
|
54756
55040
|
if (idx !== -1) {
|
|
54757
55041
|
monitors.splice(idx, 1);
|
|
54758
55042
|
}
|
|
54759
55043
|
client.removeAllListeners();
|
|
54760
|
-
}
|
|
55044
|
+
};
|
|
54761
55045
|
let user;
|
|
54762
55046
|
client.on("message", (messageText) => {
|
|
54763
55047
|
var _a, _b, _c, _d;
|
|
@@ -54784,7 +55068,7 @@ server.on("monitor", (client) => {
|
|
|
54784
55068
|
break;
|
|
54785
55069
|
case "logFiles":
|
|
54786
55070
|
// console.log("logFiles:", message);
|
|
54787
|
-
fs$
|
|
55071
|
+
fs$4.readdir(logFileDir, (err, files) => {
|
|
54788
55072
|
if (files) {
|
|
54789
55073
|
files = files.reverse();
|
|
54790
55074
|
}
|
|
@@ -54799,7 +55083,7 @@ server.on("monitor", (client) => {
|
|
|
54799
55083
|
return;
|
|
54800
55084
|
}
|
|
54801
55085
|
const f = path__default["default"].join(logFileDir, message.file);
|
|
54802
|
-
fs$
|
|
55086
|
+
fs$4.readFile(f, "utf8", (err, contents) => {
|
|
54803
55087
|
// console.log("sending file", f, contents.length);
|
|
54804
55088
|
client.send({ type: "logFile", file: f, contents: contents || "" });
|
|
54805
55089
|
});
|
|
@@ -54826,13 +55110,17 @@ server.on("monitor", (client) => {
|
|
|
54826
55110
|
.link((_a = message.srcHash) !== null && _a !== void 0 ? _a : "", (_b = message.targetHash) !== null && _b !== void 0 ? _b : "", (_c = message.arguments) !== null && _c !== void 0 ? _c : [], (_d = message.blacklist) !== null && _d !== void 0 ? _d : [])
|
|
54827
55111
|
.then(() => {
|
|
54828
55112
|
const info = { type: "listEnvironments", environments: environmentsInfo() };
|
|
54829
|
-
monitors.forEach((monitor) =>
|
|
55113
|
+
monitors.forEach((monitor) => {
|
|
55114
|
+
monitor.send(info);
|
|
55115
|
+
});
|
|
54830
55116
|
});
|
|
54831
55117
|
break;
|
|
54832
55118
|
case "unlinkEnvironments":
|
|
54833
55119
|
Environments.instance.unlink(message.srcHash, message.targetHash).then(() => {
|
|
54834
55120
|
const info = { type: "listEnvironments", environments: environmentsInfo() };
|
|
54835
|
-
monitors.forEach((monitor) =>
|
|
55121
|
+
monitors.forEach((monitor) => {
|
|
55122
|
+
monitor.send(info);
|
|
55123
|
+
});
|
|
54836
55124
|
});
|
|
54837
55125
|
break;
|
|
54838
55126
|
case "listUsers": {
|
|
@@ -54933,9 +55221,9 @@ server.on("monitor", (client) => {
|
|
|
54933
55221
|
}
|
|
54934
55222
|
}
|
|
54935
55223
|
else {
|
|
54936
|
-
return hash(message.password || "", Buffer.from(users[message.user].salt, "base64")).then((
|
|
55224
|
+
return hash(message.password || "", Buffer.from(users[message.user].salt, "base64")).then((hsh) => {
|
|
54937
55225
|
var _a;
|
|
54938
|
-
if (((_a = users[message.user || ""]) === null || _a === void 0 ? void 0 : _a.hash) !==
|
|
55226
|
+
if (((_a = users[message.user || ""]) === null || _a === void 0 ? void 0 : _a.hash) !== hsh.toString("base64")) {
|
|
54939
55227
|
throw new Error(`Wrong password ${message.user}`);
|
|
54940
55228
|
}
|
|
54941
55229
|
});
|
|
@@ -54995,8 +55283,8 @@ server.on("monitor", (client) => {
|
|
|
54995
55283
|
};
|
|
54996
55284
|
return hash(message.password || "", salt);
|
|
54997
55285
|
})
|
|
54998
|
-
.then((
|
|
54999
|
-
users[message.user || ""].hash =
|
|
55286
|
+
.then((hsh) => {
|
|
55287
|
+
users[message.user || ""].hash = hsh.toString("base64");
|
|
55000
55288
|
return randomBytes(256);
|
|
55001
55289
|
})
|
|
55002
55290
|
.then((cookie) => {
|