vis-dev-utils 3.0.118 → 3.0.120
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/babel-register/index.js +26 -12
- package/babel-register/index.js.map +1 -1
- package/bin/ci-utils.js +4 -8
- package/bin/ci-utils.js.map +1 -1
- package/bin/generate-examples-index.js +755 -1015
- package/bin/generate-examples-index.js.map +1 -1
- package/bin/test-e2e-interop.js +2827 -828
- package/bin/test-e2e-interop.js.map +1 -1
- package/declarations/generate-rollup-configuration/index.d.ts +2 -1
- package/declarations/generate-rollup-configuration/index.d.ts.map +1 -1
- package/dist/vis-dev-utils.cjs.js +368 -347
- package/dist/vis-dev-utils.cjs.js.map +1 -1
- package/dist/vis-dev-utils.esm.js +336 -336
- package/dist/vis-dev-utils.esm.js.map +1 -1
- package/package.json +15 -16
package/bin/test-e2e-interop.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Development utilities for the Vis family projects.
|
|
8
8
|
*
|
|
9
|
-
* @version 3.0.
|
|
10
|
-
* @date 2023-02-
|
|
9
|
+
* @version 3.0.120
|
|
10
|
+
* @date 2023-02-15T20:06:40.240Z
|
|
11
11
|
*
|
|
12
12
|
* @copyright (c) 2011-2017 Almende B.V, http://almende.com
|
|
13
13
|
* @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
|
|
@@ -38,7 +38,7 @@ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instan
|
|
|
38
38
|
var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
|
|
39
39
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
40
40
|
var yargs = require('yargs');
|
|
41
|
-
var
|
|
41
|
+
var require$$1 = require('node:path');
|
|
42
42
|
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
43
43
|
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
44
44
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
@@ -57,7 +57,11 @@ var _repeatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
57
57
|
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
58
58
|
var tmp = require('tmp');
|
|
59
59
|
var findUp = require('find-up');
|
|
60
|
-
var
|
|
60
|
+
var require$$0$2 = require('node:fs');
|
|
61
|
+
var require$$0 = require('node:constants');
|
|
62
|
+
var require$$0$1 = require('node:stream');
|
|
63
|
+
var require$$4 = require('node:util');
|
|
64
|
+
var require$$5 = require('node:assert');
|
|
61
65
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
62
66
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
63
67
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
@@ -67,7 +71,7 @@ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
|
67
71
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
68
72
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
69
73
|
var _padStartInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/pad-start');
|
|
70
|
-
var
|
|
74
|
+
var node_child_process = require('node:child_process');
|
|
71
75
|
|
|
72
76
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
73
77
|
|
|
@@ -81,6 +85,7 @@ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_mapInsta
|
|
|
81
85
|
var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_flatMapInstanceProperty);
|
|
82
86
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_sliceInstanceProperty);
|
|
83
87
|
var yargs__default = /*#__PURE__*/_interopDefaultLegacy(yargs);
|
|
88
|
+
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
84
89
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
85
90
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
86
91
|
var _Set__default = /*#__PURE__*/_interopDefaultLegacy(_Set);
|
|
@@ -98,6 +103,11 @@ var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_value
|
|
|
98
103
|
var _repeatInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_repeatInstanceProperty);
|
|
99
104
|
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
100
105
|
var findUp__default = /*#__PURE__*/_interopDefaultLegacy(findUp);
|
|
106
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
107
|
+
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
108
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
109
|
+
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4);
|
|
110
|
+
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5);
|
|
101
111
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefaultLegacy(_Object$getOwnPropertySymbols);
|
|
102
112
|
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefaultLegacy(_Object$getOwnPropertyDescriptor);
|
|
103
113
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefaultLegacy(_Object$getOwnPropertyDescriptors);
|
|
@@ -137,15 +147,2246 @@ var y = yargs__default["default"].strict(true).usage("test-e2e-interop [options]
|
|
|
137
147
|
/**
|
|
138
148
|
*
|
|
139
149
|
*/
|
|
140
|
-
|
|
141
150
|
function parseArguments() {
|
|
142
151
|
return y.parserConfiguration({
|
|
143
152
|
"camel-case-expansion": false
|
|
144
153
|
}).parseSync();
|
|
145
154
|
}
|
|
146
155
|
|
|
147
|
-
|
|
156
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
157
|
+
|
|
158
|
+
var fs$h = {};
|
|
159
|
+
|
|
160
|
+
var universalify$1 = {};
|
|
161
|
+
|
|
162
|
+
universalify$1.fromCallback = function (fn) {
|
|
163
|
+
return Object.defineProperty(function (...args) {
|
|
164
|
+
if (typeof args[args.length - 1] === 'function') fn.apply(this, args);else {
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
fn.call(this, ...args, (err, res) => err != null ? reject(err) : resolve(res));
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}, 'name', {
|
|
170
|
+
value: fn.name
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
universalify$1.fromPromise = function (fn) {
|
|
174
|
+
return Object.defineProperty(function (...args) {
|
|
175
|
+
const cb = args[args.length - 1];
|
|
176
|
+
if (typeof cb !== 'function') return fn.apply(this, args);else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb);
|
|
177
|
+
}, 'name', {
|
|
178
|
+
value: fn.name
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
var constants = require$$0__default["default"];
|
|
183
|
+
var origCwd = process.cwd;
|
|
184
|
+
var cwd = null;
|
|
185
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
186
|
+
process.cwd = function () {
|
|
187
|
+
if (!cwd) cwd = origCwd.call(process);
|
|
188
|
+
return cwd;
|
|
189
|
+
};
|
|
190
|
+
try {
|
|
191
|
+
process.cwd();
|
|
192
|
+
} catch (er) {}
|
|
193
|
+
|
|
194
|
+
// This check is needed until node.js 12 is required
|
|
195
|
+
if (typeof process.chdir === 'function') {
|
|
196
|
+
var chdir = process.chdir;
|
|
197
|
+
process.chdir = function (d) {
|
|
198
|
+
cwd = null;
|
|
199
|
+
chdir.call(process, d);
|
|
200
|
+
};
|
|
201
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
202
|
+
}
|
|
203
|
+
var polyfills$1 = patch$1;
|
|
204
|
+
function patch$1(fs) {
|
|
205
|
+
// (re-)implement some things that are known busted or missing.
|
|
206
|
+
|
|
207
|
+
// lchmod, broken prior to 0.6.2
|
|
208
|
+
// back-port the fix here.
|
|
209
|
+
if (constants.hasOwnProperty('O_SYMLINK') && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
210
|
+
patchLchmod(fs);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// lutimes implementation, or no-op
|
|
214
|
+
if (!fs.lutimes) {
|
|
215
|
+
patchLutimes(fs);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// https://github.com/isaacs/node-graceful-fs/issues/4
|
|
219
|
+
// Chown should not fail on einval or eperm if non-root.
|
|
220
|
+
// It should not fail on enosys ever, as this just indicates
|
|
221
|
+
// that a fs doesn't support the intended operation.
|
|
222
|
+
|
|
223
|
+
fs.chown = chownFix(fs.chown);
|
|
224
|
+
fs.fchown = chownFix(fs.fchown);
|
|
225
|
+
fs.lchown = chownFix(fs.lchown);
|
|
226
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
227
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
228
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
229
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
230
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
231
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
232
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
233
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
234
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
235
|
+
fs.stat = statFix(fs.stat);
|
|
236
|
+
fs.fstat = statFix(fs.fstat);
|
|
237
|
+
fs.lstat = statFix(fs.lstat);
|
|
238
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
239
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
240
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
241
|
+
|
|
242
|
+
// if lchmod/lchown do not exist, then make them no-ops
|
|
243
|
+
if (fs.chmod && !fs.lchmod) {
|
|
244
|
+
fs.lchmod = function (path, mode, cb) {
|
|
245
|
+
if (cb) process.nextTick(cb);
|
|
246
|
+
};
|
|
247
|
+
fs.lchmodSync = function () {};
|
|
248
|
+
}
|
|
249
|
+
if (fs.chown && !fs.lchown) {
|
|
250
|
+
fs.lchown = function (path, uid, gid, cb) {
|
|
251
|
+
if (cb) process.nextTick(cb);
|
|
252
|
+
};
|
|
253
|
+
fs.lchownSync = function () {};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// on Windows, A/V software can lock the directory, causing this
|
|
257
|
+
// to fail with an EACCES or EPERM if the directory contains newly
|
|
258
|
+
// created files. Try again on failure, for up to 60 seconds.
|
|
259
|
+
|
|
260
|
+
// Set the timeout this long because some Windows Anti-Virus, such as Parity
|
|
261
|
+
// bit9, may lock files for up to a minute, causing npm package install
|
|
262
|
+
// failures. Also, take care to yield the scheduler. Windows scheduling gives
|
|
263
|
+
// CPU to a busy looping process, which can cause the program causing the lock
|
|
264
|
+
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
265
|
+
if (platform === "win32") {
|
|
266
|
+
fs.rename = typeof fs.rename !== 'function' ? fs.rename : function (fs$rename) {
|
|
267
|
+
function rename(from, to, cb) {
|
|
268
|
+
var start = Date.now();
|
|
269
|
+
var backoff = 0;
|
|
270
|
+
fs$rename(from, to, function CB(er) {
|
|
271
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 60000) {
|
|
272
|
+
setTimeout(function () {
|
|
273
|
+
fs.stat(to, function (stater, st) {
|
|
274
|
+
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);else cb(er);
|
|
275
|
+
});
|
|
276
|
+
}, backoff);
|
|
277
|
+
if (backoff < 100) backoff += 10;
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (cb) cb(er);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
284
|
+
return rename;
|
|
285
|
+
}(fs.rename);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// if read() returns EAGAIN, then just try it again.
|
|
289
|
+
fs.read = typeof fs.read !== 'function' ? fs.read : function (fs$read) {
|
|
290
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
291
|
+
var callback;
|
|
292
|
+
if (callback_ && typeof callback_ === 'function') {
|
|
293
|
+
var eagCounter = 0;
|
|
294
|
+
callback = function (er, _, __) {
|
|
295
|
+
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
|
296
|
+
eagCounter++;
|
|
297
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
298
|
+
}
|
|
299
|
+
callback_.apply(this, arguments);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// This ensures `util.promisify` works as it does for native `fs.read`.
|
|
306
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
307
|
+
return read;
|
|
308
|
+
}(fs.read);
|
|
309
|
+
fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync : function (fs$readSync) {
|
|
310
|
+
return function (fd, buffer, offset, length, position) {
|
|
311
|
+
var eagCounter = 0;
|
|
312
|
+
while (true) {
|
|
313
|
+
try {
|
|
314
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
315
|
+
} catch (er) {
|
|
316
|
+
if (er.code === 'EAGAIN' && eagCounter < 10) {
|
|
317
|
+
eagCounter++;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
throw er;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}(fs.readSync);
|
|
325
|
+
function patchLchmod(fs) {
|
|
326
|
+
fs.lchmod = function (path, mode, callback) {
|
|
327
|
+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function (err, fd) {
|
|
328
|
+
if (err) {
|
|
329
|
+
if (callback) callback(err);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
// prefer to return the chmod error, if one occurs,
|
|
333
|
+
// but still try to close, and report closing errors if they occur.
|
|
334
|
+
fs.fchmod(fd, mode, function (err) {
|
|
335
|
+
fs.close(fd, function (err2) {
|
|
336
|
+
if (callback) callback(err || err2);
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
fs.lchmodSync = function (path, mode) {
|
|
342
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
343
|
+
|
|
344
|
+
// prefer to return the chmod error, if one occurs,
|
|
345
|
+
// but still try to close, and report closing errors if they occur.
|
|
346
|
+
var threw = true;
|
|
347
|
+
var ret;
|
|
348
|
+
try {
|
|
349
|
+
ret = fs.fchmodSync(fd, mode);
|
|
350
|
+
threw = false;
|
|
351
|
+
} finally {
|
|
352
|
+
if (threw) {
|
|
353
|
+
try {
|
|
354
|
+
fs.closeSync(fd);
|
|
355
|
+
} catch (er) {}
|
|
356
|
+
} else {
|
|
357
|
+
fs.closeSync(fd);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return ret;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function patchLutimes(fs) {
|
|
364
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
365
|
+
fs.lutimes = function (path, at, mt, cb) {
|
|
366
|
+
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
367
|
+
if (er) {
|
|
368
|
+
if (cb) cb(er);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
fs.futimes(fd, at, mt, function (er) {
|
|
372
|
+
fs.close(fd, function (er2) {
|
|
373
|
+
if (cb) cb(er || er2);
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
fs.lutimesSync = function (path, at, mt) {
|
|
379
|
+
var fd = fs.openSync(path, constants.O_SYMLINK);
|
|
380
|
+
var ret;
|
|
381
|
+
var threw = true;
|
|
382
|
+
try {
|
|
383
|
+
ret = fs.futimesSync(fd, at, mt);
|
|
384
|
+
threw = false;
|
|
385
|
+
} finally {
|
|
386
|
+
if (threw) {
|
|
387
|
+
try {
|
|
388
|
+
fs.closeSync(fd);
|
|
389
|
+
} catch (er) {}
|
|
390
|
+
} else {
|
|
391
|
+
fs.closeSync(fd);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return ret;
|
|
395
|
+
};
|
|
396
|
+
} else if (fs.futimes) {
|
|
397
|
+
fs.lutimes = function (_a, _b, _c, cb) {
|
|
398
|
+
if (cb) process.nextTick(cb);
|
|
399
|
+
};
|
|
400
|
+
fs.lutimesSync = function () {};
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function chmodFix(orig) {
|
|
404
|
+
if (!orig) return orig;
|
|
405
|
+
return function (target, mode, cb) {
|
|
406
|
+
return orig.call(fs, target, mode, function (er) {
|
|
407
|
+
if (chownErOk(er)) er = null;
|
|
408
|
+
if (cb) cb.apply(this, arguments);
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function chmodFixSync(orig) {
|
|
413
|
+
if (!orig) return orig;
|
|
414
|
+
return function (target, mode) {
|
|
415
|
+
try {
|
|
416
|
+
return orig.call(fs, target, mode);
|
|
417
|
+
} catch (er) {
|
|
418
|
+
if (!chownErOk(er)) throw er;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function chownFix(orig) {
|
|
423
|
+
if (!orig) return orig;
|
|
424
|
+
return function (target, uid, gid, cb) {
|
|
425
|
+
return orig.call(fs, target, uid, gid, function (er) {
|
|
426
|
+
if (chownErOk(er)) er = null;
|
|
427
|
+
if (cb) cb.apply(this, arguments);
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function chownFixSync(orig) {
|
|
432
|
+
if (!orig) return orig;
|
|
433
|
+
return function (target, uid, gid) {
|
|
434
|
+
try {
|
|
435
|
+
return orig.call(fs, target, uid, gid);
|
|
436
|
+
} catch (er) {
|
|
437
|
+
if (!chownErOk(er)) throw er;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function statFix(orig) {
|
|
442
|
+
if (!orig) return orig;
|
|
443
|
+
// Older versions of Node erroneously returned signed integers for
|
|
444
|
+
// uid + gid.
|
|
445
|
+
return function (target, options, cb) {
|
|
446
|
+
if (typeof options === 'function') {
|
|
447
|
+
cb = options;
|
|
448
|
+
options = null;
|
|
449
|
+
}
|
|
450
|
+
function callback(er, stats) {
|
|
451
|
+
if (stats) {
|
|
452
|
+
if (stats.uid < 0) stats.uid += 0x100000000;
|
|
453
|
+
if (stats.gid < 0) stats.gid += 0x100000000;
|
|
454
|
+
}
|
|
455
|
+
if (cb) cb.apply(this, arguments);
|
|
456
|
+
}
|
|
457
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function statFixSync(orig) {
|
|
461
|
+
if (!orig) return orig;
|
|
462
|
+
// Older versions of Node erroneously returned signed integers for
|
|
463
|
+
// uid + gid.
|
|
464
|
+
return function (target, options) {
|
|
465
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
466
|
+
if (stats) {
|
|
467
|
+
if (stats.uid < 0) stats.uid += 0x100000000;
|
|
468
|
+
if (stats.gid < 0) stats.gid += 0x100000000;
|
|
469
|
+
}
|
|
470
|
+
return stats;
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// ENOSYS means that the fs doesn't support the op. Just ignore
|
|
475
|
+
// that, because it doesn't matter.
|
|
476
|
+
//
|
|
477
|
+
// if there's no getuid, or if getuid() is something other
|
|
478
|
+
// than 0, and the error is EINVAL or EPERM, then just ignore
|
|
479
|
+
// it.
|
|
480
|
+
//
|
|
481
|
+
// This specific case is a silent failure in cp, install, tar,
|
|
482
|
+
// and most other unix tools that manage permissions.
|
|
483
|
+
//
|
|
484
|
+
// When running as root, or if other types of errors are
|
|
485
|
+
// encountered, then it's strict.
|
|
486
|
+
function chownErOk(er) {
|
|
487
|
+
if (!er) return true;
|
|
488
|
+
if (er.code === "ENOSYS") return true;
|
|
489
|
+
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
490
|
+
if (nonroot) {
|
|
491
|
+
if (er.code === "EINVAL" || er.code === "EPERM") return true;
|
|
492
|
+
}
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
var Stream = require$$0__default$1["default"].Stream;
|
|
498
|
+
var legacyStreams = legacy$1;
|
|
499
|
+
function legacy$1(fs) {
|
|
500
|
+
return {
|
|
501
|
+
ReadStream: ReadStream,
|
|
502
|
+
WriteStream: WriteStream
|
|
503
|
+
};
|
|
504
|
+
function ReadStream(path, options) {
|
|
505
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
506
|
+
Stream.call(this);
|
|
507
|
+
var self = this;
|
|
508
|
+
this.path = path;
|
|
509
|
+
this.fd = null;
|
|
510
|
+
this.readable = true;
|
|
511
|
+
this.paused = false;
|
|
512
|
+
this.flags = 'r';
|
|
513
|
+
this.mode = 438; /*=0666*/
|
|
514
|
+
this.bufferSize = 64 * 1024;
|
|
515
|
+
options = options || {};
|
|
516
|
+
|
|
517
|
+
// Mixin options into this
|
|
518
|
+
var keys = Object.keys(options);
|
|
519
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
520
|
+
var key = keys[index];
|
|
521
|
+
this[key] = options[key];
|
|
522
|
+
}
|
|
523
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
524
|
+
if (this.start !== undefined) {
|
|
525
|
+
if ('number' !== typeof this.start) {
|
|
526
|
+
throw TypeError('start must be a Number');
|
|
527
|
+
}
|
|
528
|
+
if (this.end === undefined) {
|
|
529
|
+
this.end = Infinity;
|
|
530
|
+
} else if ('number' !== typeof this.end) {
|
|
531
|
+
throw TypeError('end must be a Number');
|
|
532
|
+
}
|
|
533
|
+
if (this.start > this.end) {
|
|
534
|
+
throw new Error('start must be <= end');
|
|
535
|
+
}
|
|
536
|
+
this.pos = this.start;
|
|
537
|
+
}
|
|
538
|
+
if (this.fd !== null) {
|
|
539
|
+
process.nextTick(function () {
|
|
540
|
+
self._read();
|
|
541
|
+
});
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
fs.open(this.path, this.flags, this.mode, function (err, fd) {
|
|
545
|
+
if (err) {
|
|
546
|
+
self.emit('error', err);
|
|
547
|
+
self.readable = false;
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
self.fd = fd;
|
|
551
|
+
self.emit('open', fd);
|
|
552
|
+
self._read();
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function WriteStream(path, options) {
|
|
556
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
557
|
+
Stream.call(this);
|
|
558
|
+
this.path = path;
|
|
559
|
+
this.fd = null;
|
|
560
|
+
this.writable = true;
|
|
561
|
+
this.flags = 'w';
|
|
562
|
+
this.encoding = 'binary';
|
|
563
|
+
this.mode = 438; /*=0666*/
|
|
564
|
+
this.bytesWritten = 0;
|
|
565
|
+
options = options || {};
|
|
566
|
+
|
|
567
|
+
// Mixin options into this
|
|
568
|
+
var keys = Object.keys(options);
|
|
569
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
570
|
+
var key = keys[index];
|
|
571
|
+
this[key] = options[key];
|
|
572
|
+
}
|
|
573
|
+
if (this.start !== undefined) {
|
|
574
|
+
if ('number' !== typeof this.start) {
|
|
575
|
+
throw TypeError('start must be a Number');
|
|
576
|
+
}
|
|
577
|
+
if (this.start < 0) {
|
|
578
|
+
throw new Error('start must be >= zero');
|
|
579
|
+
}
|
|
580
|
+
this.pos = this.start;
|
|
581
|
+
}
|
|
582
|
+
this.busy = false;
|
|
583
|
+
this._queue = [];
|
|
584
|
+
if (this.fd === null) {
|
|
585
|
+
this._open = fs.open;
|
|
586
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
587
|
+
this.flush();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
var clone_1 = clone$2;
|
|
593
|
+
var getPrototypeOf = Object.getPrototypeOf || function (obj) {
|
|
594
|
+
return obj.__proto__;
|
|
595
|
+
};
|
|
596
|
+
function clone$2(obj) {
|
|
597
|
+
if (obj === null || typeof obj !== 'object') return obj;
|
|
598
|
+
if (obj instanceof Object) var copy = {
|
|
599
|
+
__proto__: getPrototypeOf(obj)
|
|
600
|
+
};else var copy = Object.create(null);
|
|
601
|
+
Object.getOwnPropertyNames(obj).forEach(function (key) {
|
|
602
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
603
|
+
});
|
|
604
|
+
return copy;
|
|
605
|
+
}
|
|
148
606
|
|
|
607
|
+
var fs$g = require$$0__default$2["default"];
|
|
608
|
+
var polyfills = polyfills$1;
|
|
609
|
+
var legacy = legacyStreams;
|
|
610
|
+
var clone$1 = clone_1;
|
|
611
|
+
var util$1 = require$$4__default["default"];
|
|
612
|
+
|
|
613
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
614
|
+
var gracefulQueue;
|
|
615
|
+
var previousSymbol;
|
|
616
|
+
|
|
617
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
618
|
+
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
|
619
|
+
gracefulQueue = Symbol.for('graceful-fs.queue');
|
|
620
|
+
// This is used in testing by future versions
|
|
621
|
+
previousSymbol = Symbol.for('graceful-fs.previous');
|
|
622
|
+
} else {
|
|
623
|
+
gracefulQueue = '___graceful-fs.queue';
|
|
624
|
+
previousSymbol = '___graceful-fs.previous';
|
|
625
|
+
}
|
|
626
|
+
function noop() {}
|
|
627
|
+
function publishQueue(context, queue) {
|
|
628
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
629
|
+
get: function () {
|
|
630
|
+
return queue;
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
var debug = noop;
|
|
635
|
+
if (util$1.debuglog) debug = util$1.debuglog('gfs4');else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) debug = function () {
|
|
636
|
+
var m = util$1.format.apply(util$1, arguments);
|
|
637
|
+
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ');
|
|
638
|
+
console.error(m);
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
// Once time initialization
|
|
642
|
+
if (!fs$g[gracefulQueue]) {
|
|
643
|
+
// This queue can be shared by multiple loaded instances
|
|
644
|
+
var queue = commonjsGlobal[gracefulQueue] || [];
|
|
645
|
+
publishQueue(fs$g, queue);
|
|
646
|
+
|
|
647
|
+
// Patch fs.close/closeSync to shared queue version, because we need
|
|
648
|
+
// to retry() whenever a close happens *anywhere* in the program.
|
|
649
|
+
// This is essential when multiple graceful-fs instances are
|
|
650
|
+
// in play at the same time.
|
|
651
|
+
fs$g.close = function (fs$close) {
|
|
652
|
+
function close(fd, cb) {
|
|
653
|
+
return fs$close.call(fs$g, fd, function (err) {
|
|
654
|
+
// This function uses the graceful-fs shared queue
|
|
655
|
+
if (!err) {
|
|
656
|
+
resetQueue();
|
|
657
|
+
}
|
|
658
|
+
if (typeof cb === 'function') cb.apply(this, arguments);
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
Object.defineProperty(close, previousSymbol, {
|
|
662
|
+
value: fs$close
|
|
663
|
+
});
|
|
664
|
+
return close;
|
|
665
|
+
}(fs$g.close);
|
|
666
|
+
fs$g.closeSync = function (fs$closeSync) {
|
|
667
|
+
function closeSync(fd) {
|
|
668
|
+
// This function uses the graceful-fs shared queue
|
|
669
|
+
fs$closeSync.apply(fs$g, arguments);
|
|
670
|
+
resetQueue();
|
|
671
|
+
}
|
|
672
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
673
|
+
value: fs$closeSync
|
|
674
|
+
});
|
|
675
|
+
return closeSync;
|
|
676
|
+
}(fs$g.closeSync);
|
|
677
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
678
|
+
process.on('exit', function () {
|
|
679
|
+
debug(fs$g[gracefulQueue]);
|
|
680
|
+
require$$5__default["default"].equal(fs$g[gracefulQueue].length, 0);
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (!commonjsGlobal[gracefulQueue]) {
|
|
685
|
+
publishQueue(commonjsGlobal, fs$g[gracefulQueue]);
|
|
686
|
+
}
|
|
687
|
+
var gracefulFs = patch(clone$1(fs$g));
|
|
688
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$g.__patched) {
|
|
689
|
+
gracefulFs = patch(fs$g);
|
|
690
|
+
fs$g.__patched = true;
|
|
691
|
+
}
|
|
692
|
+
function patch(fs) {
|
|
693
|
+
// Everything that references the open() function needs to be in here
|
|
694
|
+
polyfills(fs);
|
|
695
|
+
fs.gracefulify = patch;
|
|
696
|
+
fs.createReadStream = createReadStream;
|
|
697
|
+
fs.createWriteStream = createWriteStream;
|
|
698
|
+
var fs$readFile = fs.readFile;
|
|
699
|
+
fs.readFile = readFile;
|
|
700
|
+
function readFile(path, options, cb) {
|
|
701
|
+
if (typeof options === 'function') cb = options, options = null;
|
|
702
|
+
return go$readFile(path, options, cb);
|
|
703
|
+
function go$readFile(path, options, cb, startTime) {
|
|
704
|
+
return fs$readFile(path, options, function (err) {
|
|
705
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]);else {
|
|
706
|
+
if (typeof cb === 'function') cb.apply(this, arguments);
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
var fs$writeFile = fs.writeFile;
|
|
712
|
+
fs.writeFile = writeFile;
|
|
713
|
+
function writeFile(path, data, options, cb) {
|
|
714
|
+
if (typeof options === 'function') cb = options, options = null;
|
|
715
|
+
return go$writeFile(path, data, options, cb);
|
|
716
|
+
function go$writeFile(path, data, options, cb, startTime) {
|
|
717
|
+
return fs$writeFile(path, data, options, function (err) {
|
|
718
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]);else {
|
|
719
|
+
if (typeof cb === 'function') cb.apply(this, arguments);
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
var fs$appendFile = fs.appendFile;
|
|
725
|
+
if (fs$appendFile) fs.appendFile = appendFile;
|
|
726
|
+
function appendFile(path, data, options, cb) {
|
|
727
|
+
if (typeof options === 'function') cb = options, options = null;
|
|
728
|
+
return go$appendFile(path, data, options, cb);
|
|
729
|
+
function go$appendFile(path, data, options, cb, startTime) {
|
|
730
|
+
return fs$appendFile(path, data, options, function (err) {
|
|
731
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]);else {
|
|
732
|
+
if (typeof cb === 'function') cb.apply(this, arguments);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
var fs$copyFile = fs.copyFile;
|
|
738
|
+
if (fs$copyFile) fs.copyFile = copyFile;
|
|
739
|
+
function copyFile(src, dest, flags, cb) {
|
|
740
|
+
if (typeof flags === 'function') {
|
|
741
|
+
cb = flags;
|
|
742
|
+
flags = 0;
|
|
743
|
+
}
|
|
744
|
+
return go$copyFile(src, dest, flags, cb);
|
|
745
|
+
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
746
|
+
return fs$copyFile(src, dest, flags, function (err) {
|
|
747
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]);else {
|
|
748
|
+
if (typeof cb === 'function') cb.apply(this, arguments);
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
var fs$readdir = fs.readdir;
|
|
754
|
+
fs.readdir = readdir;
|
|
755
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
756
|
+
function readdir(path, options, cb) {
|
|
757
|
+
if (typeof options === 'function') cb = options, options = null;
|
|
758
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
759
|
+
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
760
|
+
} : function go$readdir(path, options, cb, startTime) {
|
|
761
|
+
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
762
|
+
};
|
|
763
|
+
return go$readdir(path, options, cb);
|
|
764
|
+
function fs$readdirCallback(path, options, cb, startTime) {
|
|
765
|
+
return function (err, files) {
|
|
766
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]);else {
|
|
767
|
+
if (files && files.sort) files.sort();
|
|
768
|
+
if (typeof cb === 'function') cb.call(this, err, files);
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (process.version.substr(0, 4) === 'v0.8') {
|
|
774
|
+
var legStreams = legacy(fs);
|
|
775
|
+
ReadStream = legStreams.ReadStream;
|
|
776
|
+
WriteStream = legStreams.WriteStream;
|
|
777
|
+
}
|
|
778
|
+
var fs$ReadStream = fs.ReadStream;
|
|
779
|
+
if (fs$ReadStream) {
|
|
780
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
781
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
782
|
+
}
|
|
783
|
+
var fs$WriteStream = fs.WriteStream;
|
|
784
|
+
if (fs$WriteStream) {
|
|
785
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
786
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
787
|
+
}
|
|
788
|
+
Object.defineProperty(fs, 'ReadStream', {
|
|
789
|
+
get: function () {
|
|
790
|
+
return ReadStream;
|
|
791
|
+
},
|
|
792
|
+
set: function (val) {
|
|
793
|
+
ReadStream = val;
|
|
794
|
+
},
|
|
795
|
+
enumerable: true,
|
|
796
|
+
configurable: true
|
|
797
|
+
});
|
|
798
|
+
Object.defineProperty(fs, 'WriteStream', {
|
|
799
|
+
get: function () {
|
|
800
|
+
return WriteStream;
|
|
801
|
+
},
|
|
802
|
+
set: function (val) {
|
|
803
|
+
WriteStream = val;
|
|
804
|
+
},
|
|
805
|
+
enumerable: true,
|
|
806
|
+
configurable: true
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
// legacy names
|
|
810
|
+
var FileReadStream = ReadStream;
|
|
811
|
+
Object.defineProperty(fs, 'FileReadStream', {
|
|
812
|
+
get: function () {
|
|
813
|
+
return FileReadStream;
|
|
814
|
+
},
|
|
815
|
+
set: function (val) {
|
|
816
|
+
FileReadStream = val;
|
|
817
|
+
},
|
|
818
|
+
enumerable: true,
|
|
819
|
+
configurable: true
|
|
820
|
+
});
|
|
821
|
+
var FileWriteStream = WriteStream;
|
|
822
|
+
Object.defineProperty(fs, 'FileWriteStream', {
|
|
823
|
+
get: function () {
|
|
824
|
+
return FileWriteStream;
|
|
825
|
+
},
|
|
826
|
+
set: function (val) {
|
|
827
|
+
FileWriteStream = val;
|
|
828
|
+
},
|
|
829
|
+
enumerable: true,
|
|
830
|
+
configurable: true
|
|
831
|
+
});
|
|
832
|
+
function ReadStream(path, options) {
|
|
833
|
+
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
834
|
+
}
|
|
835
|
+
function ReadStream$open() {
|
|
836
|
+
var that = this;
|
|
837
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
838
|
+
if (err) {
|
|
839
|
+
if (that.autoClose) that.destroy();
|
|
840
|
+
that.emit('error', err);
|
|
841
|
+
} else {
|
|
842
|
+
that.fd = fd;
|
|
843
|
+
that.emit('open', fd);
|
|
844
|
+
that.read();
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
function WriteStream(path, options) {
|
|
849
|
+
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
850
|
+
}
|
|
851
|
+
function WriteStream$open() {
|
|
852
|
+
var that = this;
|
|
853
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
854
|
+
if (err) {
|
|
855
|
+
that.destroy();
|
|
856
|
+
that.emit('error', err);
|
|
857
|
+
} else {
|
|
858
|
+
that.fd = fd;
|
|
859
|
+
that.emit('open', fd);
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
function createReadStream(path, options) {
|
|
864
|
+
return new fs.ReadStream(path, options);
|
|
865
|
+
}
|
|
866
|
+
function createWriteStream(path, options) {
|
|
867
|
+
return new fs.WriteStream(path, options);
|
|
868
|
+
}
|
|
869
|
+
var fs$open = fs.open;
|
|
870
|
+
fs.open = open;
|
|
871
|
+
function open(path, flags, mode, cb) {
|
|
872
|
+
if (typeof mode === 'function') cb = mode, mode = null;
|
|
873
|
+
return go$open(path, flags, mode, cb);
|
|
874
|
+
function go$open(path, flags, mode, cb, startTime) {
|
|
875
|
+
return fs$open(path, flags, mode, function (err, fd) {
|
|
876
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]);else {
|
|
877
|
+
if (typeof cb === 'function') cb.apply(this, arguments);
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return fs;
|
|
883
|
+
}
|
|
884
|
+
function enqueue(elem) {
|
|
885
|
+
debug('ENQUEUE', elem[0].name, elem[1]);
|
|
886
|
+
fs$g[gracefulQueue].push(elem);
|
|
887
|
+
retry();
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// keep track of the timeout between retry() calls
|
|
891
|
+
var retryTimer;
|
|
892
|
+
|
|
893
|
+
// reset the startTime and lastTime to now
|
|
894
|
+
// this resets the start of the 60 second overall timeout as well as the
|
|
895
|
+
// delay between attempts so that we'll retry these jobs sooner
|
|
896
|
+
function resetQueue() {
|
|
897
|
+
var now = Date.now();
|
|
898
|
+
for (var i = 0; i < fs$g[gracefulQueue].length; ++i) {
|
|
899
|
+
// entries that are only a length of 2 are from an older version, don't
|
|
900
|
+
// bother modifying those since they'll be retried anyway.
|
|
901
|
+
if (fs$g[gracefulQueue][i].length > 2) {
|
|
902
|
+
fs$g[gracefulQueue][i][3] = now; // startTime
|
|
903
|
+
fs$g[gracefulQueue][i][4] = now; // lastTime
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
// call retry to make sure we're actively processing the queue
|
|
907
|
+
retry();
|
|
908
|
+
}
|
|
909
|
+
function retry() {
|
|
910
|
+
// clear the timer and remove it to help prevent unintended concurrency
|
|
911
|
+
clearTimeout(retryTimer);
|
|
912
|
+
retryTimer = undefined;
|
|
913
|
+
if (fs$g[gracefulQueue].length === 0) return;
|
|
914
|
+
var elem = fs$g[gracefulQueue].shift();
|
|
915
|
+
var fn = elem[0];
|
|
916
|
+
var args = elem[1];
|
|
917
|
+
// these items may be unset if they were added by an older graceful-fs
|
|
918
|
+
var err = elem[2];
|
|
919
|
+
var startTime = elem[3];
|
|
920
|
+
var lastTime = elem[4];
|
|
921
|
+
|
|
922
|
+
// if we don't have a startTime we have no way of knowing if we've waited
|
|
923
|
+
// long enough, so go ahead and retry this item now
|
|
924
|
+
if (startTime === undefined) {
|
|
925
|
+
debug('RETRY', fn.name, args);
|
|
926
|
+
fn.apply(null, args);
|
|
927
|
+
} else if (Date.now() - startTime >= 60000) {
|
|
928
|
+
// it's been more than 60 seconds total, bail now
|
|
929
|
+
debug('TIMEOUT', fn.name, args);
|
|
930
|
+
var cb = args.pop();
|
|
931
|
+
if (typeof cb === 'function') cb.call(null, err);
|
|
932
|
+
} else {
|
|
933
|
+
// the amount of time between the last attempt and right now
|
|
934
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
935
|
+
// the amount of time between when we first tried, and when we last tried
|
|
936
|
+
// rounded up to at least 1
|
|
937
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
938
|
+
// backoff. wait longer than the total time we've been retrying, but only
|
|
939
|
+
// up to a maximum of 100ms
|
|
940
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
941
|
+
// it's been long enough since the last retry, do it again
|
|
942
|
+
if (sinceAttempt >= desiredDelay) {
|
|
943
|
+
debug('RETRY', fn.name, args);
|
|
944
|
+
fn.apply(null, args.concat([startTime]));
|
|
945
|
+
} else {
|
|
946
|
+
// if we can't do this job yet, push it to the end of the queue
|
|
947
|
+
// and let the next iteration check again
|
|
948
|
+
fs$g[gracefulQueue].push(elem);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// schedule our next run if one isn't already scheduled
|
|
953
|
+
if (retryTimer === undefined) {
|
|
954
|
+
retryTimer = setTimeout(retry, 0);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
(function (exports) {
|
|
959
|
+
|
|
960
|
+
// This is adapted from https://github.com/normalize/mz
|
|
961
|
+
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
|
962
|
+
const u = universalify$1.fromCallback;
|
|
963
|
+
const fs = gracefulFs;
|
|
964
|
+
const api = ['access', 'appendFile', 'chmod', 'chown', 'close', 'copyFile', 'fchmod', 'fchown', 'fdatasync', 'fstat', 'fsync', 'ftruncate', 'futimes', 'lchmod', 'lchown', 'link', 'lstat', 'mkdir', 'mkdtemp', 'open', 'opendir', 'readdir', 'readFile', 'readlink', 'realpath', 'rename', 'rm', 'rmdir', 'stat', 'symlink', 'truncate', 'unlink', 'utimes', 'writeFile'].filter(key => {
|
|
965
|
+
// Some commands are not available on some systems. Ex:
|
|
966
|
+
// fs.cp was added in Node.js v16.7.0
|
|
967
|
+
// fs.lchown is not available on at least some Linux
|
|
968
|
+
return typeof fs[key] === 'function';
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
// Export cloned fs:
|
|
972
|
+
Object.assign(exports, fs);
|
|
973
|
+
|
|
974
|
+
// Universalify async methods:
|
|
975
|
+
api.forEach(method => {
|
|
976
|
+
exports[method] = u(fs[method]);
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
// We differ from mz/fs in that we still ship the old, broken, fs.exists()
|
|
980
|
+
// since we are a drop-in replacement for the native module
|
|
981
|
+
exports.exists = function (filename, callback) {
|
|
982
|
+
if (typeof callback === 'function') {
|
|
983
|
+
return fs.exists(filename, callback);
|
|
984
|
+
}
|
|
985
|
+
return new Promise(resolve => {
|
|
986
|
+
return fs.exists(filename, resolve);
|
|
987
|
+
});
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
// fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
|
|
991
|
+
|
|
992
|
+
exports.read = function (fd, buffer, offset, length, position, callback) {
|
|
993
|
+
if (typeof callback === 'function') {
|
|
994
|
+
return fs.read(fd, buffer, offset, length, position, callback);
|
|
995
|
+
}
|
|
996
|
+
return new Promise((resolve, reject) => {
|
|
997
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
|
998
|
+
if (err) return reject(err);
|
|
999
|
+
resolve({
|
|
1000
|
+
bytesRead,
|
|
1001
|
+
buffer
|
|
1002
|
+
});
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
// Function signature can be
|
|
1008
|
+
// fs.write(fd, buffer[, offset[, length[, position]]], callback)
|
|
1009
|
+
// OR
|
|
1010
|
+
// fs.write(fd, string[, position[, encoding]], callback)
|
|
1011
|
+
// We need to handle both cases, so we use ...args
|
|
1012
|
+
exports.write = function (fd, buffer, ...args) {
|
|
1013
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
1014
|
+
return fs.write(fd, buffer, ...args);
|
|
1015
|
+
}
|
|
1016
|
+
return new Promise((resolve, reject) => {
|
|
1017
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
|
1018
|
+
if (err) return reject(err);
|
|
1019
|
+
resolve({
|
|
1020
|
+
bytesWritten,
|
|
1021
|
+
buffer
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
});
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
// Function signature is
|
|
1028
|
+
// s.readv(fd, buffers[, position], callback)
|
|
1029
|
+
// We need to handle the optional arg, so we use ...args
|
|
1030
|
+
exports.readv = function (fd, buffers, ...args) {
|
|
1031
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
1032
|
+
return fs.readv(fd, buffers, ...args);
|
|
1033
|
+
}
|
|
1034
|
+
return new Promise((resolve, reject) => {
|
|
1035
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
|
|
1036
|
+
if (err) return reject(err);
|
|
1037
|
+
resolve({
|
|
1038
|
+
bytesRead,
|
|
1039
|
+
buffers
|
|
1040
|
+
});
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
// Function signature is
|
|
1046
|
+
// s.writev(fd, buffers[, position], callback)
|
|
1047
|
+
// We need to handle the optional arg, so we use ...args
|
|
1048
|
+
exports.writev = function (fd, buffers, ...args) {
|
|
1049
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
1050
|
+
return fs.writev(fd, buffers, ...args);
|
|
1051
|
+
}
|
|
1052
|
+
return new Promise((resolve, reject) => {
|
|
1053
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
|
1054
|
+
if (err) return reject(err);
|
|
1055
|
+
resolve({
|
|
1056
|
+
bytesWritten,
|
|
1057
|
+
buffers
|
|
1058
|
+
});
|
|
1059
|
+
});
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
// fs.realpath.native sometimes not available if fs is monkey-patched
|
|
1064
|
+
if (typeof fs.realpath.native === 'function') {
|
|
1065
|
+
exports.realpath.native = u(fs.realpath.native);
|
|
1066
|
+
} else {
|
|
1067
|
+
process.emitWarning('fs.realpath.native is not a function. Is fs being monkey-patched?', 'Warning', 'fs-extra-WARN0003');
|
|
1068
|
+
}
|
|
1069
|
+
})(fs$h);
|
|
1070
|
+
|
|
1071
|
+
var makeDir$1 = {};
|
|
1072
|
+
|
|
1073
|
+
var utils$1 = {};
|
|
1074
|
+
|
|
1075
|
+
const path$b = require$$1__default["default"];
|
|
1076
|
+
|
|
1077
|
+
// https://github.com/nodejs/node/issues/8987
|
|
1078
|
+
// https://github.com/libuv/libuv/pull/1088
|
|
1079
|
+
utils$1.checkPath = function checkPath(pth) {
|
|
1080
|
+
if (process.platform === 'win32') {
|
|
1081
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path$b.parse(pth).root, ''));
|
|
1082
|
+
if (pathHasInvalidWinCharacters) {
|
|
1083
|
+
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
1084
|
+
error.code = 'EINVAL';
|
|
1085
|
+
throw error;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
const fs$f = fs$h;
|
|
1091
|
+
const {
|
|
1092
|
+
checkPath
|
|
1093
|
+
} = utils$1;
|
|
1094
|
+
const getMode = options => {
|
|
1095
|
+
const defaults = {
|
|
1096
|
+
mode: 0o777
|
|
1097
|
+
};
|
|
1098
|
+
if (typeof options === 'number') return options;
|
|
1099
|
+
return {
|
|
1100
|
+
...defaults,
|
|
1101
|
+
...options
|
|
1102
|
+
}.mode;
|
|
1103
|
+
};
|
|
1104
|
+
makeDir$1.makeDir = async (dir, options) => {
|
|
1105
|
+
checkPath(dir);
|
|
1106
|
+
return fs$f.mkdir(dir, {
|
|
1107
|
+
mode: getMode(options),
|
|
1108
|
+
recursive: true
|
|
1109
|
+
});
|
|
1110
|
+
};
|
|
1111
|
+
makeDir$1.makeDirSync = (dir, options) => {
|
|
1112
|
+
checkPath(dir);
|
|
1113
|
+
return fs$f.mkdirSync(dir, {
|
|
1114
|
+
mode: getMode(options),
|
|
1115
|
+
recursive: true
|
|
1116
|
+
});
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
const u$a = universalify$1.fromPromise;
|
|
1120
|
+
const {
|
|
1121
|
+
makeDir: _makeDir,
|
|
1122
|
+
makeDirSync
|
|
1123
|
+
} = makeDir$1;
|
|
1124
|
+
const makeDir = u$a(_makeDir);
|
|
1125
|
+
var mkdirs$2 = {
|
|
1126
|
+
mkdirs: makeDir,
|
|
1127
|
+
mkdirsSync: makeDirSync,
|
|
1128
|
+
// alias
|
|
1129
|
+
mkdirp: makeDir,
|
|
1130
|
+
mkdirpSync: makeDirSync,
|
|
1131
|
+
ensureDir: makeDir,
|
|
1132
|
+
ensureDirSync: makeDirSync
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
const u$9 = universalify$1.fromPromise;
|
|
1136
|
+
const fs$e = fs$h;
|
|
1137
|
+
function pathExists$6(path) {
|
|
1138
|
+
return fs$e.access(path).then(() => true).catch(() => false);
|
|
1139
|
+
}
|
|
1140
|
+
var pathExists_1 = {
|
|
1141
|
+
pathExists: u$9(pathExists$6),
|
|
1142
|
+
pathExistsSync: fs$e.existsSync
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
const fs$d = gracefulFs;
|
|
1146
|
+
function utimesMillis$1(path, atime, mtime, callback) {
|
|
1147
|
+
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
1148
|
+
fs$d.open(path, 'r+', (err, fd) => {
|
|
1149
|
+
if (err) return callback(err);
|
|
1150
|
+
fs$d.futimes(fd, atime, mtime, futimesErr => {
|
|
1151
|
+
fs$d.close(fd, closeErr => {
|
|
1152
|
+
if (callback) callback(futimesErr || closeErr);
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
function utimesMillisSync$1(path, atime, mtime) {
|
|
1158
|
+
const fd = fs$d.openSync(path, 'r+');
|
|
1159
|
+
fs$d.futimesSync(fd, atime, mtime);
|
|
1160
|
+
return fs$d.closeSync(fd);
|
|
1161
|
+
}
|
|
1162
|
+
var utimes = {
|
|
1163
|
+
utimesMillis: utimesMillis$1,
|
|
1164
|
+
utimesMillisSync: utimesMillisSync$1
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
const fs$c = fs$h;
|
|
1168
|
+
const path$a = require$$1__default["default"];
|
|
1169
|
+
const util = require$$4__default["default"];
|
|
1170
|
+
function getStats$2(src, dest, opts) {
|
|
1171
|
+
const statFunc = opts.dereference ? file => fs$c.stat(file, {
|
|
1172
|
+
bigint: true
|
|
1173
|
+
}) : file => fs$c.lstat(file, {
|
|
1174
|
+
bigint: true
|
|
1175
|
+
});
|
|
1176
|
+
return Promise.all([statFunc(src), statFunc(dest).catch(err => {
|
|
1177
|
+
if (err.code === 'ENOENT') return null;
|
|
1178
|
+
throw err;
|
|
1179
|
+
})]).then(([srcStat, destStat]) => ({
|
|
1180
|
+
srcStat,
|
|
1181
|
+
destStat
|
|
1182
|
+
}));
|
|
1183
|
+
}
|
|
1184
|
+
function getStatsSync(src, dest, opts) {
|
|
1185
|
+
let destStat;
|
|
1186
|
+
const statFunc = opts.dereference ? file => fs$c.statSync(file, {
|
|
1187
|
+
bigint: true
|
|
1188
|
+
}) : file => fs$c.lstatSync(file, {
|
|
1189
|
+
bigint: true
|
|
1190
|
+
});
|
|
1191
|
+
const srcStat = statFunc(src);
|
|
1192
|
+
try {
|
|
1193
|
+
destStat = statFunc(dest);
|
|
1194
|
+
} catch (err) {
|
|
1195
|
+
if (err.code === 'ENOENT') return {
|
|
1196
|
+
srcStat,
|
|
1197
|
+
destStat: null
|
|
1198
|
+
};
|
|
1199
|
+
throw err;
|
|
1200
|
+
}
|
|
1201
|
+
return {
|
|
1202
|
+
srcStat,
|
|
1203
|
+
destStat
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
function checkPaths(src, dest, funcName, opts, cb) {
|
|
1207
|
+
util.callbackify(getStats$2)(src, dest, opts, (err, stats) => {
|
|
1208
|
+
if (err) return cb(err);
|
|
1209
|
+
const {
|
|
1210
|
+
srcStat,
|
|
1211
|
+
destStat
|
|
1212
|
+
} = stats;
|
|
1213
|
+
if (destStat) {
|
|
1214
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1215
|
+
const srcBaseName = path$a.basename(src);
|
|
1216
|
+
const destBaseName = path$a.basename(dest);
|
|
1217
|
+
if (funcName === 'move' && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1218
|
+
return cb(null, {
|
|
1219
|
+
srcStat,
|
|
1220
|
+
destStat,
|
|
1221
|
+
isChangingCase: true
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
return cb(new Error('Source and destination must not be the same.'));
|
|
1225
|
+
}
|
|
1226
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1227
|
+
return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
|
|
1228
|
+
}
|
|
1229
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1230
|
+
return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`));
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1234
|
+
return cb(new Error(errMsg(src, dest, funcName)));
|
|
1235
|
+
}
|
|
1236
|
+
return cb(null, {
|
|
1237
|
+
srcStat,
|
|
1238
|
+
destStat
|
|
1239
|
+
});
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
function checkPathsSync(src, dest, funcName, opts) {
|
|
1243
|
+
const {
|
|
1244
|
+
srcStat,
|
|
1245
|
+
destStat
|
|
1246
|
+
} = getStatsSync(src, dest, opts);
|
|
1247
|
+
if (destStat) {
|
|
1248
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1249
|
+
const srcBaseName = path$a.basename(src);
|
|
1250
|
+
const destBaseName = path$a.basename(dest);
|
|
1251
|
+
if (funcName === 'move' && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1252
|
+
return {
|
|
1253
|
+
srcStat,
|
|
1254
|
+
destStat,
|
|
1255
|
+
isChangingCase: true
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
throw new Error('Source and destination must not be the same.');
|
|
1259
|
+
}
|
|
1260
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1261
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1262
|
+
}
|
|
1263
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1264
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1268
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1269
|
+
}
|
|
1270
|
+
return {
|
|
1271
|
+
srcStat,
|
|
1272
|
+
destStat
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// recursively check if dest parent is a subdirectory of src.
|
|
1277
|
+
// It works for all file types including symlinks since it
|
|
1278
|
+
// checks the src and dest inodes. It starts from the deepest
|
|
1279
|
+
// parent and stops once it reaches the src parent or the root path.
|
|
1280
|
+
function checkParentPaths(src, srcStat, dest, funcName, cb) {
|
|
1281
|
+
const srcParent = path$a.resolve(path$a.dirname(src));
|
|
1282
|
+
const destParent = path$a.resolve(path$a.dirname(dest));
|
|
1283
|
+
if (destParent === srcParent || destParent === path$a.parse(destParent).root) return cb();
|
|
1284
|
+
fs$c.stat(destParent, {
|
|
1285
|
+
bigint: true
|
|
1286
|
+
}, (err, destStat) => {
|
|
1287
|
+
if (err) {
|
|
1288
|
+
if (err.code === 'ENOENT') return cb();
|
|
1289
|
+
return cb(err);
|
|
1290
|
+
}
|
|
1291
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1292
|
+
return cb(new Error(errMsg(src, dest, funcName)));
|
|
1293
|
+
}
|
|
1294
|
+
return checkParentPaths(src, srcStat, destParent, funcName, cb);
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1298
|
+
const srcParent = path$a.resolve(path$a.dirname(src));
|
|
1299
|
+
const destParent = path$a.resolve(path$a.dirname(dest));
|
|
1300
|
+
if (destParent === srcParent || destParent === path$a.parse(destParent).root) return;
|
|
1301
|
+
let destStat;
|
|
1302
|
+
try {
|
|
1303
|
+
destStat = fs$c.statSync(destParent, {
|
|
1304
|
+
bigint: true
|
|
1305
|
+
});
|
|
1306
|
+
} catch (err) {
|
|
1307
|
+
if (err.code === 'ENOENT') return;
|
|
1308
|
+
throw err;
|
|
1309
|
+
}
|
|
1310
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1311
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1312
|
+
}
|
|
1313
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1314
|
+
}
|
|
1315
|
+
function areIdentical$2(srcStat, destStat) {
|
|
1316
|
+
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// return true if dest is a subdir of src, otherwise false.
|
|
1320
|
+
// It only checks the path strings.
|
|
1321
|
+
function isSrcSubdir(src, dest) {
|
|
1322
|
+
const srcArr = path$a.resolve(src).split(path$a.sep).filter(i => i);
|
|
1323
|
+
const destArr = path$a.resolve(dest).split(path$a.sep).filter(i => i);
|
|
1324
|
+
return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true);
|
|
1325
|
+
}
|
|
1326
|
+
function errMsg(src, dest, funcName) {
|
|
1327
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1328
|
+
}
|
|
1329
|
+
var stat$4 = {
|
|
1330
|
+
checkPaths,
|
|
1331
|
+
checkPathsSync,
|
|
1332
|
+
checkParentPaths,
|
|
1333
|
+
checkParentPathsSync,
|
|
1334
|
+
isSrcSubdir,
|
|
1335
|
+
areIdentical: areIdentical$2
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
const fs$b = gracefulFs;
|
|
1339
|
+
const path$9 = require$$1__default["default"];
|
|
1340
|
+
const mkdirs$1 = mkdirs$2.mkdirs;
|
|
1341
|
+
const pathExists$5 = pathExists_1.pathExists;
|
|
1342
|
+
const utimesMillis = utimes.utimesMillis;
|
|
1343
|
+
const stat$3 = stat$4;
|
|
1344
|
+
function copy$2(src, dest, opts, cb) {
|
|
1345
|
+
if (typeof opts === 'function' && !cb) {
|
|
1346
|
+
cb = opts;
|
|
1347
|
+
opts = {};
|
|
1348
|
+
} else if (typeof opts === 'function') {
|
|
1349
|
+
opts = {
|
|
1350
|
+
filter: opts
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
cb = cb || function () {};
|
|
1354
|
+
opts = opts || {};
|
|
1355
|
+
opts.clobber = 'clobber' in opts ? !!opts.clobber : true; // default to true for now
|
|
1356
|
+
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber; // overwrite falls back to clobber
|
|
1357
|
+
|
|
1358
|
+
// Warn about using preserveTimestamps on 32-bit node
|
|
1359
|
+
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
|
1360
|
+
process.emitWarning('Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', 'Warning', 'fs-extra-WARN0001');
|
|
1361
|
+
}
|
|
1362
|
+
stat$3.checkPaths(src, dest, 'copy', opts, (err, stats) => {
|
|
1363
|
+
if (err) return cb(err);
|
|
1364
|
+
const {
|
|
1365
|
+
srcStat,
|
|
1366
|
+
destStat
|
|
1367
|
+
} = stats;
|
|
1368
|
+
stat$3.checkParentPaths(src, srcStat, dest, 'copy', err => {
|
|
1369
|
+
if (err) return cb(err);
|
|
1370
|
+
runFilter(src, dest, opts, (err, include) => {
|
|
1371
|
+
if (err) return cb(err);
|
|
1372
|
+
if (!include) return cb();
|
|
1373
|
+
checkParentDir(destStat, src, dest, opts, cb);
|
|
1374
|
+
});
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
function checkParentDir(destStat, src, dest, opts, cb) {
|
|
1379
|
+
const destParent = path$9.dirname(dest);
|
|
1380
|
+
pathExists$5(destParent, (err, dirExists) => {
|
|
1381
|
+
if (err) return cb(err);
|
|
1382
|
+
if (dirExists) return getStats$1(destStat, src, dest, opts, cb);
|
|
1383
|
+
mkdirs$1(destParent, err => {
|
|
1384
|
+
if (err) return cb(err);
|
|
1385
|
+
return getStats$1(destStat, src, dest, opts, cb);
|
|
1386
|
+
});
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
function runFilter(src, dest, opts, cb) {
|
|
1390
|
+
if (!opts.filter) return cb(null, true);
|
|
1391
|
+
Promise.resolve(opts.filter(src, dest)).then(include => cb(null, include), error => cb(error));
|
|
1392
|
+
}
|
|
1393
|
+
function getStats$1(destStat, src, dest, opts, cb) {
|
|
1394
|
+
const stat = opts.dereference ? fs$b.stat : fs$b.lstat;
|
|
1395
|
+
stat(src, (err, srcStat) => {
|
|
1396
|
+
if (err) return cb(err);
|
|
1397
|
+
if (srcStat.isDirectory()) return onDir$1(srcStat, destStat, src, dest, opts, cb);else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile$1(srcStat, destStat, src, dest, opts, cb);else if (srcStat.isSymbolicLink()) return onLink$1(destStat, src, dest, opts, cb);else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`));else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`));
|
|
1398
|
+
return cb(new Error(`Unknown file: ${src}`));
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
function onFile$1(srcStat, destStat, src, dest, opts, cb) {
|
|
1402
|
+
if (!destStat) return copyFile$1(srcStat, src, dest, opts, cb);
|
|
1403
|
+
return mayCopyFile$1(srcStat, src, dest, opts, cb);
|
|
1404
|
+
}
|
|
1405
|
+
function mayCopyFile$1(srcStat, src, dest, opts, cb) {
|
|
1406
|
+
if (opts.overwrite) {
|
|
1407
|
+
fs$b.unlink(dest, err => {
|
|
1408
|
+
if (err) return cb(err);
|
|
1409
|
+
return copyFile$1(srcStat, src, dest, opts, cb);
|
|
1410
|
+
});
|
|
1411
|
+
} else if (opts.errorOnExist) {
|
|
1412
|
+
return cb(new Error(`'${dest}' already exists`));
|
|
1413
|
+
} else return cb();
|
|
1414
|
+
}
|
|
1415
|
+
function copyFile$1(srcStat, src, dest, opts, cb) {
|
|
1416
|
+
fs$b.copyFile(src, dest, err => {
|
|
1417
|
+
if (err) return cb(err);
|
|
1418
|
+
if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb);
|
|
1419
|
+
return setDestMode$1(dest, srcStat.mode, cb);
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
function handleTimestampsAndMode(srcMode, src, dest, cb) {
|
|
1423
|
+
// Make sure the file is writable before setting the timestamp
|
|
1424
|
+
// otherwise open fails with EPERM when invoked with 'r+'
|
|
1425
|
+
// (through utimes call)
|
|
1426
|
+
if (fileIsNotWritable$1(srcMode)) {
|
|
1427
|
+
return makeFileWritable$1(dest, srcMode, err => {
|
|
1428
|
+
if (err) return cb(err);
|
|
1429
|
+
return setDestTimestampsAndMode(srcMode, src, dest, cb);
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
return setDestTimestampsAndMode(srcMode, src, dest, cb);
|
|
1433
|
+
}
|
|
1434
|
+
function fileIsNotWritable$1(srcMode) {
|
|
1435
|
+
return (srcMode & 0o200) === 0;
|
|
1436
|
+
}
|
|
1437
|
+
function makeFileWritable$1(dest, srcMode, cb) {
|
|
1438
|
+
return setDestMode$1(dest, srcMode | 0o200, cb);
|
|
1439
|
+
}
|
|
1440
|
+
function setDestTimestampsAndMode(srcMode, src, dest, cb) {
|
|
1441
|
+
setDestTimestamps$1(src, dest, err => {
|
|
1442
|
+
if (err) return cb(err);
|
|
1443
|
+
return setDestMode$1(dest, srcMode, cb);
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
function setDestMode$1(dest, srcMode, cb) {
|
|
1447
|
+
return fs$b.chmod(dest, srcMode, cb);
|
|
1448
|
+
}
|
|
1449
|
+
function setDestTimestamps$1(src, dest, cb) {
|
|
1450
|
+
// The initial srcStat.atime cannot be trusted
|
|
1451
|
+
// because it is modified by the read(2) system call
|
|
1452
|
+
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
|
1453
|
+
fs$b.stat(src, (err, updatedSrcStat) => {
|
|
1454
|
+
if (err) return cb(err);
|
|
1455
|
+
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb);
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
function onDir$1(srcStat, destStat, src, dest, opts, cb) {
|
|
1459
|
+
if (!destStat) return mkDirAndCopy$1(srcStat.mode, src, dest, opts, cb);
|
|
1460
|
+
return copyDir$1(src, dest, opts, cb);
|
|
1461
|
+
}
|
|
1462
|
+
function mkDirAndCopy$1(srcMode, src, dest, opts, cb) {
|
|
1463
|
+
fs$b.mkdir(dest, err => {
|
|
1464
|
+
if (err) return cb(err);
|
|
1465
|
+
copyDir$1(src, dest, opts, err => {
|
|
1466
|
+
if (err) return cb(err);
|
|
1467
|
+
return setDestMode$1(dest, srcMode, cb);
|
|
1468
|
+
});
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
function copyDir$1(src, dest, opts, cb) {
|
|
1472
|
+
fs$b.readdir(src, (err, items) => {
|
|
1473
|
+
if (err) return cb(err);
|
|
1474
|
+
return copyDirItems(items, src, dest, opts, cb);
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
function copyDirItems(items, src, dest, opts, cb) {
|
|
1478
|
+
const item = items.pop();
|
|
1479
|
+
if (!item) return cb();
|
|
1480
|
+
return copyDirItem$1(items, item, src, dest, opts, cb);
|
|
1481
|
+
}
|
|
1482
|
+
function copyDirItem$1(items, item, src, dest, opts, cb) {
|
|
1483
|
+
const srcItem = path$9.join(src, item);
|
|
1484
|
+
const destItem = path$9.join(dest, item);
|
|
1485
|
+
runFilter(srcItem, destItem, opts, (err, include) => {
|
|
1486
|
+
if (err) return cb(err);
|
|
1487
|
+
if (!include) return copyDirItems(items, src, dest, opts, cb);
|
|
1488
|
+
stat$3.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
|
|
1489
|
+
if (err) return cb(err);
|
|
1490
|
+
const {
|
|
1491
|
+
destStat
|
|
1492
|
+
} = stats;
|
|
1493
|
+
getStats$1(destStat, srcItem, destItem, opts, err => {
|
|
1494
|
+
if (err) return cb(err);
|
|
1495
|
+
return copyDirItems(items, src, dest, opts, cb);
|
|
1496
|
+
});
|
|
1497
|
+
});
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
function onLink$1(destStat, src, dest, opts, cb) {
|
|
1501
|
+
fs$b.readlink(src, (err, resolvedSrc) => {
|
|
1502
|
+
if (err) return cb(err);
|
|
1503
|
+
if (opts.dereference) {
|
|
1504
|
+
resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
|
|
1505
|
+
}
|
|
1506
|
+
if (!destStat) {
|
|
1507
|
+
return fs$b.symlink(resolvedSrc, dest, cb);
|
|
1508
|
+
} else {
|
|
1509
|
+
fs$b.readlink(dest, (err, resolvedDest) => {
|
|
1510
|
+
if (err) {
|
|
1511
|
+
// dest exists and is a regular file or directory,
|
|
1512
|
+
// Windows may throw UNKNOWN error. If dest already exists,
|
|
1513
|
+
// fs throws error anyway, so no need to guard against it here.
|
|
1514
|
+
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$b.symlink(resolvedSrc, dest, cb);
|
|
1515
|
+
return cb(err);
|
|
1516
|
+
}
|
|
1517
|
+
if (opts.dereference) {
|
|
1518
|
+
resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
|
|
1519
|
+
}
|
|
1520
|
+
if (stat$3.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1521
|
+
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
// do not copy if src is a subdir of dest since unlinking
|
|
1525
|
+
// dest in this case would result in removing src contents
|
|
1526
|
+
// and therefore a broken symlink would be created.
|
|
1527
|
+
if (stat$3.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1528
|
+
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
|
|
1529
|
+
}
|
|
1530
|
+
return copyLink$1(resolvedSrc, dest, cb);
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
function copyLink$1(resolvedSrc, dest, cb) {
|
|
1536
|
+
fs$b.unlink(dest, err => {
|
|
1537
|
+
if (err) return cb(err);
|
|
1538
|
+
return fs$b.symlink(resolvedSrc, dest, cb);
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
var copy_1 = copy$2;
|
|
1542
|
+
|
|
1543
|
+
const fs$a = gracefulFs;
|
|
1544
|
+
const path$8 = require$$1__default["default"];
|
|
1545
|
+
const mkdirsSync$1 = mkdirs$2.mkdirsSync;
|
|
1546
|
+
const utimesMillisSync = utimes.utimesMillisSync;
|
|
1547
|
+
const stat$2 = stat$4;
|
|
1548
|
+
function copySync$1(src, dest, opts) {
|
|
1549
|
+
if (typeof opts === 'function') {
|
|
1550
|
+
opts = {
|
|
1551
|
+
filter: opts
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
opts = opts || {};
|
|
1555
|
+
opts.clobber = 'clobber' in opts ? !!opts.clobber : true; // default to true for now
|
|
1556
|
+
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber; // overwrite falls back to clobber
|
|
1557
|
+
|
|
1558
|
+
// Warn about using preserveTimestamps on 32-bit node
|
|
1559
|
+
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
|
1560
|
+
process.emitWarning('Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', 'Warning', 'fs-extra-WARN0002');
|
|
1561
|
+
}
|
|
1562
|
+
const {
|
|
1563
|
+
srcStat,
|
|
1564
|
+
destStat
|
|
1565
|
+
} = stat$2.checkPathsSync(src, dest, 'copy', opts);
|
|
1566
|
+
stat$2.checkParentPathsSync(src, srcStat, dest, 'copy');
|
|
1567
|
+
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1568
|
+
const destParent = path$8.dirname(dest);
|
|
1569
|
+
if (!fs$a.existsSync(destParent)) mkdirsSync$1(destParent);
|
|
1570
|
+
return getStats(destStat, src, dest, opts);
|
|
1571
|
+
}
|
|
1572
|
+
function getStats(destStat, src, dest, opts) {
|
|
1573
|
+
const statSync = opts.dereference ? fs$a.statSync : fs$a.lstatSync;
|
|
1574
|
+
const srcStat = statSync(src);
|
|
1575
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1576
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1577
|
+
}
|
|
1578
|
+
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1579
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1580
|
+
return mayCopyFile(srcStat, src, dest, opts);
|
|
1581
|
+
}
|
|
1582
|
+
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1583
|
+
if (opts.overwrite) {
|
|
1584
|
+
fs$a.unlinkSync(dest);
|
|
1585
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1586
|
+
} else if (opts.errorOnExist) {
|
|
1587
|
+
throw new Error(`'${dest}' already exists`);
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
function copyFile(srcStat, src, dest, opts) {
|
|
1591
|
+
fs$a.copyFileSync(src, dest);
|
|
1592
|
+
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
1593
|
+
return setDestMode(dest, srcStat.mode);
|
|
1594
|
+
}
|
|
1595
|
+
function handleTimestamps(srcMode, src, dest) {
|
|
1596
|
+
// Make sure the file is writable before setting the timestamp
|
|
1597
|
+
// otherwise open fails with EPERM when invoked with 'r+'
|
|
1598
|
+
// (through utimes call)
|
|
1599
|
+
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
|
|
1600
|
+
return setDestTimestamps(src, dest);
|
|
1601
|
+
}
|
|
1602
|
+
function fileIsNotWritable(srcMode) {
|
|
1603
|
+
return (srcMode & 0o200) === 0;
|
|
1604
|
+
}
|
|
1605
|
+
function makeFileWritable(dest, srcMode) {
|
|
1606
|
+
return setDestMode(dest, srcMode | 0o200);
|
|
1607
|
+
}
|
|
1608
|
+
function setDestMode(dest, srcMode) {
|
|
1609
|
+
return fs$a.chmodSync(dest, srcMode);
|
|
1610
|
+
}
|
|
1611
|
+
function setDestTimestamps(src, dest) {
|
|
1612
|
+
// The initial srcStat.atime cannot be trusted
|
|
1613
|
+
// because it is modified by the read(2) system call
|
|
1614
|
+
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
|
1615
|
+
const updatedSrcStat = fs$a.statSync(src);
|
|
1616
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1617
|
+
}
|
|
1618
|
+
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1619
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1620
|
+
return copyDir(src, dest, opts);
|
|
1621
|
+
}
|
|
1622
|
+
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1623
|
+
fs$a.mkdirSync(dest);
|
|
1624
|
+
copyDir(src, dest, opts);
|
|
1625
|
+
return setDestMode(dest, srcMode);
|
|
1626
|
+
}
|
|
1627
|
+
function copyDir(src, dest, opts) {
|
|
1628
|
+
fs$a.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts));
|
|
1629
|
+
}
|
|
1630
|
+
function copyDirItem(item, src, dest, opts) {
|
|
1631
|
+
const srcItem = path$8.join(src, item);
|
|
1632
|
+
const destItem = path$8.join(dest, item);
|
|
1633
|
+
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
1634
|
+
const {
|
|
1635
|
+
destStat
|
|
1636
|
+
} = stat$2.checkPathsSync(srcItem, destItem, 'copy', opts);
|
|
1637
|
+
return getStats(destStat, srcItem, destItem, opts);
|
|
1638
|
+
}
|
|
1639
|
+
function onLink(destStat, src, dest, opts) {
|
|
1640
|
+
let resolvedSrc = fs$a.readlinkSync(src);
|
|
1641
|
+
if (opts.dereference) {
|
|
1642
|
+
resolvedSrc = path$8.resolve(process.cwd(), resolvedSrc);
|
|
1643
|
+
}
|
|
1644
|
+
if (!destStat) {
|
|
1645
|
+
return fs$a.symlinkSync(resolvedSrc, dest);
|
|
1646
|
+
} else {
|
|
1647
|
+
let resolvedDest;
|
|
1648
|
+
try {
|
|
1649
|
+
resolvedDest = fs$a.readlinkSync(dest);
|
|
1650
|
+
} catch (err) {
|
|
1651
|
+
// dest exists and is a regular file or directory,
|
|
1652
|
+
// Windows may throw UNKNOWN error. If dest already exists,
|
|
1653
|
+
// fs throws error anyway, so no need to guard against it here.
|
|
1654
|
+
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$a.symlinkSync(resolvedSrc, dest);
|
|
1655
|
+
throw err;
|
|
1656
|
+
}
|
|
1657
|
+
if (opts.dereference) {
|
|
1658
|
+
resolvedDest = path$8.resolve(process.cwd(), resolvedDest);
|
|
1659
|
+
}
|
|
1660
|
+
if (stat$2.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1661
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// prevent copy if src is a subdir of dest since unlinking
|
|
1665
|
+
// dest in this case would result in removing src contents
|
|
1666
|
+
// and therefore a broken symlink would be created.
|
|
1667
|
+
if (stat$2.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1668
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1669
|
+
}
|
|
1670
|
+
return copyLink(resolvedSrc, dest);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
function copyLink(resolvedSrc, dest) {
|
|
1674
|
+
fs$a.unlinkSync(dest);
|
|
1675
|
+
return fs$a.symlinkSync(resolvedSrc, dest);
|
|
1676
|
+
}
|
|
1677
|
+
var copySync_1 = copySync$1;
|
|
1678
|
+
|
|
1679
|
+
const u$8 = universalify$1.fromCallback;
|
|
1680
|
+
var copy$1 = {
|
|
1681
|
+
copy: u$8(copy_1),
|
|
1682
|
+
copySync: copySync_1
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
const fs$9 = gracefulFs;
|
|
1686
|
+
const u$7 = universalify$1.fromCallback;
|
|
1687
|
+
function remove$2(path, callback) {
|
|
1688
|
+
fs$9.rm(path, {
|
|
1689
|
+
recursive: true,
|
|
1690
|
+
force: true
|
|
1691
|
+
}, callback);
|
|
1692
|
+
}
|
|
1693
|
+
function removeSync$1(path) {
|
|
1694
|
+
fs$9.rmSync(path, {
|
|
1695
|
+
recursive: true,
|
|
1696
|
+
force: true
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
var remove_1 = {
|
|
1700
|
+
remove: u$7(remove$2),
|
|
1701
|
+
removeSync: removeSync$1
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1704
|
+
const u$6 = universalify$1.fromPromise;
|
|
1705
|
+
const fs$8 = fs$h;
|
|
1706
|
+
const path$7 = require$$1__default["default"];
|
|
1707
|
+
const mkdir$3 = mkdirs$2;
|
|
1708
|
+
const remove$1 = remove_1;
|
|
1709
|
+
const emptyDir = u$6(async function emptyDir(dir) {
|
|
1710
|
+
let items;
|
|
1711
|
+
try {
|
|
1712
|
+
items = await fs$8.readdir(dir);
|
|
1713
|
+
} catch {
|
|
1714
|
+
return mkdir$3.mkdirs(dir);
|
|
1715
|
+
}
|
|
1716
|
+
return Promise.all(items.map(item => remove$1.remove(path$7.join(dir, item))));
|
|
1717
|
+
});
|
|
1718
|
+
function emptyDirSync(dir) {
|
|
1719
|
+
let items;
|
|
1720
|
+
try {
|
|
1721
|
+
items = fs$8.readdirSync(dir);
|
|
1722
|
+
} catch {
|
|
1723
|
+
return mkdir$3.mkdirsSync(dir);
|
|
1724
|
+
}
|
|
1725
|
+
items.forEach(item => {
|
|
1726
|
+
item = path$7.join(dir, item);
|
|
1727
|
+
remove$1.removeSync(item);
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
var empty = {
|
|
1731
|
+
emptyDirSync,
|
|
1732
|
+
emptydirSync: emptyDirSync,
|
|
1733
|
+
emptyDir,
|
|
1734
|
+
emptydir: emptyDir
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
const u$5 = universalify$1.fromCallback;
|
|
1738
|
+
const path$6 = require$$1__default["default"];
|
|
1739
|
+
const fs$7 = gracefulFs;
|
|
1740
|
+
const mkdir$2 = mkdirs$2;
|
|
1741
|
+
function createFile$1(file, callback) {
|
|
1742
|
+
function makeFile() {
|
|
1743
|
+
fs$7.writeFile(file, '', err => {
|
|
1744
|
+
if (err) return callback(err);
|
|
1745
|
+
callback();
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
fs$7.stat(file, (err, stats) => {
|
|
1749
|
+
// eslint-disable-line handle-callback-err
|
|
1750
|
+
if (!err && stats.isFile()) return callback();
|
|
1751
|
+
const dir = path$6.dirname(file);
|
|
1752
|
+
fs$7.stat(dir, (err, stats) => {
|
|
1753
|
+
if (err) {
|
|
1754
|
+
// if the directory doesn't exist, make it
|
|
1755
|
+
if (err.code === 'ENOENT') {
|
|
1756
|
+
return mkdir$2.mkdirs(dir, err => {
|
|
1757
|
+
if (err) return callback(err);
|
|
1758
|
+
makeFile();
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
return callback(err);
|
|
1762
|
+
}
|
|
1763
|
+
if (stats.isDirectory()) makeFile();else {
|
|
1764
|
+
// parent is not a directory
|
|
1765
|
+
// This is just to cause an internal ENOTDIR error to be thrown
|
|
1766
|
+
fs$7.readdir(dir, err => {
|
|
1767
|
+
if (err) return callback(err);
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
function createFileSync$1(file) {
|
|
1774
|
+
let stats;
|
|
1775
|
+
try {
|
|
1776
|
+
stats = fs$7.statSync(file);
|
|
1777
|
+
} catch {}
|
|
1778
|
+
if (stats && stats.isFile()) return;
|
|
1779
|
+
const dir = path$6.dirname(file);
|
|
1780
|
+
try {
|
|
1781
|
+
if (!fs$7.statSync(dir).isDirectory()) {
|
|
1782
|
+
// parent is not a directory
|
|
1783
|
+
// This is just to cause an internal ENOTDIR error to be thrown
|
|
1784
|
+
fs$7.readdirSync(dir);
|
|
1785
|
+
}
|
|
1786
|
+
} catch (err) {
|
|
1787
|
+
// If the stat call above failed because the directory doesn't exist, create it
|
|
1788
|
+
if (err && err.code === 'ENOENT') mkdir$2.mkdirsSync(dir);else throw err;
|
|
1789
|
+
}
|
|
1790
|
+
fs$7.writeFileSync(file, '');
|
|
1791
|
+
}
|
|
1792
|
+
var file = {
|
|
1793
|
+
createFile: u$5(createFile$1),
|
|
1794
|
+
createFileSync: createFileSync$1
|
|
1795
|
+
};
|
|
1796
|
+
|
|
1797
|
+
const u$4 = universalify$1.fromCallback;
|
|
1798
|
+
const path$5 = require$$1__default["default"];
|
|
1799
|
+
const fs$6 = gracefulFs;
|
|
1800
|
+
const mkdir$1 = mkdirs$2;
|
|
1801
|
+
const pathExists$4 = pathExists_1.pathExists;
|
|
1802
|
+
const {
|
|
1803
|
+
areIdentical: areIdentical$1
|
|
1804
|
+
} = stat$4;
|
|
1805
|
+
function createLink$1(srcpath, dstpath, callback) {
|
|
1806
|
+
function makeLink(srcpath, dstpath) {
|
|
1807
|
+
fs$6.link(srcpath, dstpath, err => {
|
|
1808
|
+
if (err) return callback(err);
|
|
1809
|
+
callback(null);
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
fs$6.lstat(dstpath, (_, dstStat) => {
|
|
1813
|
+
fs$6.lstat(srcpath, (err, srcStat) => {
|
|
1814
|
+
if (err) {
|
|
1815
|
+
err.message = err.message.replace('lstat', 'ensureLink');
|
|
1816
|
+
return callback(err);
|
|
1817
|
+
}
|
|
1818
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return callback(null);
|
|
1819
|
+
const dir = path$5.dirname(dstpath);
|
|
1820
|
+
pathExists$4(dir, (err, dirExists) => {
|
|
1821
|
+
if (err) return callback(err);
|
|
1822
|
+
if (dirExists) return makeLink(srcpath, dstpath);
|
|
1823
|
+
mkdir$1.mkdirs(dir, err => {
|
|
1824
|
+
if (err) return callback(err);
|
|
1825
|
+
makeLink(srcpath, dstpath);
|
|
1826
|
+
});
|
|
1827
|
+
});
|
|
1828
|
+
});
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
function createLinkSync$1(srcpath, dstpath) {
|
|
1832
|
+
let dstStat;
|
|
1833
|
+
try {
|
|
1834
|
+
dstStat = fs$6.lstatSync(dstpath);
|
|
1835
|
+
} catch {}
|
|
1836
|
+
try {
|
|
1837
|
+
const srcStat = fs$6.lstatSync(srcpath);
|
|
1838
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return;
|
|
1839
|
+
} catch (err) {
|
|
1840
|
+
err.message = err.message.replace('lstat', 'ensureLink');
|
|
1841
|
+
throw err;
|
|
1842
|
+
}
|
|
1843
|
+
const dir = path$5.dirname(dstpath);
|
|
1844
|
+
const dirExists = fs$6.existsSync(dir);
|
|
1845
|
+
if (dirExists) return fs$6.linkSync(srcpath, dstpath);
|
|
1846
|
+
mkdir$1.mkdirsSync(dir);
|
|
1847
|
+
return fs$6.linkSync(srcpath, dstpath);
|
|
1848
|
+
}
|
|
1849
|
+
var link = {
|
|
1850
|
+
createLink: u$4(createLink$1),
|
|
1851
|
+
createLinkSync: createLinkSync$1
|
|
1852
|
+
};
|
|
1853
|
+
|
|
1854
|
+
const path$4 = require$$1__default["default"];
|
|
1855
|
+
const fs$5 = gracefulFs;
|
|
1856
|
+
const pathExists$3 = pathExists_1.pathExists;
|
|
1857
|
+
|
|
1858
|
+
/**
|
|
1859
|
+
* Function that returns two types of paths, one relative to symlink, and one
|
|
1860
|
+
* relative to the current working directory. Checks if path is absolute or
|
|
1861
|
+
* relative. If the path is relative, this function checks if the path is
|
|
1862
|
+
* relative to symlink or relative to current working directory. This is an
|
|
1863
|
+
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
|
1864
|
+
* This allows you to determine which path to use out of one of three possible
|
|
1865
|
+
* types of source paths. The first is an absolute path. This is detected by
|
|
1866
|
+
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
|
1867
|
+
* see if it exists. If it does it's used, if not an error is returned
|
|
1868
|
+
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
|
1869
|
+
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
|
1870
|
+
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
|
1871
|
+
* created symlink. If you provide a `srcpath` that does not exist on the file
|
|
1872
|
+
* system it results in a broken symlink. To minimize this, the function
|
|
1873
|
+
* checks to see if the 'relative to symlink' source file exists, and if it
|
|
1874
|
+
* does it will use it. If it does not, it checks if there's a file that
|
|
1875
|
+
* exists that is relative to the current working directory, if does its used.
|
|
1876
|
+
* This preserves the expectations of the original fs.symlink spec and adds
|
|
1877
|
+
* the ability to pass in `relative to current working direcotry` paths.
|
|
1878
|
+
*/
|
|
1879
|
+
|
|
1880
|
+
function symlinkPaths$1(srcpath, dstpath, callback) {
|
|
1881
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
1882
|
+
return fs$5.lstat(srcpath, err => {
|
|
1883
|
+
if (err) {
|
|
1884
|
+
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
1885
|
+
return callback(err);
|
|
1886
|
+
}
|
|
1887
|
+
return callback(null, {
|
|
1888
|
+
toCwd: srcpath,
|
|
1889
|
+
toDst: srcpath
|
|
1890
|
+
});
|
|
1891
|
+
});
|
|
1892
|
+
} else {
|
|
1893
|
+
const dstdir = path$4.dirname(dstpath);
|
|
1894
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
1895
|
+
return pathExists$3(relativeToDst, (err, exists) => {
|
|
1896
|
+
if (err) return callback(err);
|
|
1897
|
+
if (exists) {
|
|
1898
|
+
return callback(null, {
|
|
1899
|
+
toCwd: relativeToDst,
|
|
1900
|
+
toDst: srcpath
|
|
1901
|
+
});
|
|
1902
|
+
} else {
|
|
1903
|
+
return fs$5.lstat(srcpath, err => {
|
|
1904
|
+
if (err) {
|
|
1905
|
+
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
1906
|
+
return callback(err);
|
|
1907
|
+
}
|
|
1908
|
+
return callback(null, {
|
|
1909
|
+
toCwd: srcpath,
|
|
1910
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
1911
|
+
});
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function symlinkPathsSync$1(srcpath, dstpath) {
|
|
1918
|
+
let exists;
|
|
1919
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
1920
|
+
exists = fs$5.existsSync(srcpath);
|
|
1921
|
+
if (!exists) throw new Error('absolute srcpath does not exist');
|
|
1922
|
+
return {
|
|
1923
|
+
toCwd: srcpath,
|
|
1924
|
+
toDst: srcpath
|
|
1925
|
+
};
|
|
1926
|
+
} else {
|
|
1927
|
+
const dstdir = path$4.dirname(dstpath);
|
|
1928
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
1929
|
+
exists = fs$5.existsSync(relativeToDst);
|
|
1930
|
+
if (exists) {
|
|
1931
|
+
return {
|
|
1932
|
+
toCwd: relativeToDst,
|
|
1933
|
+
toDst: srcpath
|
|
1934
|
+
};
|
|
1935
|
+
} else {
|
|
1936
|
+
exists = fs$5.existsSync(srcpath);
|
|
1937
|
+
if (!exists) throw new Error('relative srcpath does not exist');
|
|
1938
|
+
return {
|
|
1939
|
+
toCwd: srcpath,
|
|
1940
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
var symlinkPaths_1 = {
|
|
1946
|
+
symlinkPaths: symlinkPaths$1,
|
|
1947
|
+
symlinkPathsSync: symlinkPathsSync$1
|
|
1948
|
+
};
|
|
1949
|
+
|
|
1950
|
+
const fs$4 = gracefulFs;
|
|
1951
|
+
function symlinkType$1(srcpath, type, callback) {
|
|
1952
|
+
callback = typeof type === 'function' ? type : callback;
|
|
1953
|
+
type = typeof type === 'function' ? false : type;
|
|
1954
|
+
if (type) return callback(null, type);
|
|
1955
|
+
fs$4.lstat(srcpath, (err, stats) => {
|
|
1956
|
+
if (err) return callback(null, 'file');
|
|
1957
|
+
type = stats && stats.isDirectory() ? 'dir' : 'file';
|
|
1958
|
+
callback(null, type);
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
function symlinkTypeSync$1(srcpath, type) {
|
|
1962
|
+
let stats;
|
|
1963
|
+
if (type) return type;
|
|
1964
|
+
try {
|
|
1965
|
+
stats = fs$4.lstatSync(srcpath);
|
|
1966
|
+
} catch {
|
|
1967
|
+
return 'file';
|
|
1968
|
+
}
|
|
1969
|
+
return stats && stats.isDirectory() ? 'dir' : 'file';
|
|
1970
|
+
}
|
|
1971
|
+
var symlinkType_1 = {
|
|
1972
|
+
symlinkType: symlinkType$1,
|
|
1973
|
+
symlinkTypeSync: symlinkTypeSync$1
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
const u$3 = universalify$1.fromCallback;
|
|
1977
|
+
const path$3 = require$$1__default["default"];
|
|
1978
|
+
const fs$3 = fs$h;
|
|
1979
|
+
const _mkdirs = mkdirs$2;
|
|
1980
|
+
const mkdirs = _mkdirs.mkdirs;
|
|
1981
|
+
const mkdirsSync = _mkdirs.mkdirsSync;
|
|
1982
|
+
const _symlinkPaths = symlinkPaths_1;
|
|
1983
|
+
const symlinkPaths = _symlinkPaths.symlinkPaths;
|
|
1984
|
+
const symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
|
|
1985
|
+
const _symlinkType = symlinkType_1;
|
|
1986
|
+
const symlinkType = _symlinkType.symlinkType;
|
|
1987
|
+
const symlinkTypeSync = _symlinkType.symlinkTypeSync;
|
|
1988
|
+
const pathExists$2 = pathExists_1.pathExists;
|
|
1989
|
+
const {
|
|
1990
|
+
areIdentical
|
|
1991
|
+
} = stat$4;
|
|
1992
|
+
function createSymlink$1(srcpath, dstpath, type, callback) {
|
|
1993
|
+
callback = typeof type === 'function' ? type : callback;
|
|
1994
|
+
type = typeof type === 'function' ? false : type;
|
|
1995
|
+
fs$3.lstat(dstpath, (err, stats) => {
|
|
1996
|
+
if (!err && stats.isSymbolicLink()) {
|
|
1997
|
+
Promise.all([fs$3.stat(srcpath), fs$3.stat(dstpath)]).then(([srcStat, dstStat]) => {
|
|
1998
|
+
if (areIdentical(srcStat, dstStat)) return callback(null);
|
|
1999
|
+
_createSymlink(srcpath, dstpath, type, callback);
|
|
2000
|
+
});
|
|
2001
|
+
} else _createSymlink(srcpath, dstpath, type, callback);
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
function _createSymlink(srcpath, dstpath, type, callback) {
|
|
2005
|
+
symlinkPaths(srcpath, dstpath, (err, relative) => {
|
|
2006
|
+
if (err) return callback(err);
|
|
2007
|
+
srcpath = relative.toDst;
|
|
2008
|
+
symlinkType(relative.toCwd, type, (err, type) => {
|
|
2009
|
+
if (err) return callback(err);
|
|
2010
|
+
const dir = path$3.dirname(dstpath);
|
|
2011
|
+
pathExists$2(dir, (err, dirExists) => {
|
|
2012
|
+
if (err) return callback(err);
|
|
2013
|
+
if (dirExists) return fs$3.symlink(srcpath, dstpath, type, callback);
|
|
2014
|
+
mkdirs(dir, err => {
|
|
2015
|
+
if (err) return callback(err);
|
|
2016
|
+
fs$3.symlink(srcpath, dstpath, type, callback);
|
|
2017
|
+
});
|
|
2018
|
+
});
|
|
2019
|
+
});
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
function createSymlinkSync$1(srcpath, dstpath, type) {
|
|
2023
|
+
let stats;
|
|
2024
|
+
try {
|
|
2025
|
+
stats = fs$3.lstatSync(dstpath);
|
|
2026
|
+
} catch {}
|
|
2027
|
+
if (stats && stats.isSymbolicLink()) {
|
|
2028
|
+
const srcStat = fs$3.statSync(srcpath);
|
|
2029
|
+
const dstStat = fs$3.statSync(dstpath);
|
|
2030
|
+
if (areIdentical(srcStat, dstStat)) return;
|
|
2031
|
+
}
|
|
2032
|
+
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
2033
|
+
srcpath = relative.toDst;
|
|
2034
|
+
type = symlinkTypeSync(relative.toCwd, type);
|
|
2035
|
+
const dir = path$3.dirname(dstpath);
|
|
2036
|
+
const exists = fs$3.existsSync(dir);
|
|
2037
|
+
if (exists) return fs$3.symlinkSync(srcpath, dstpath, type);
|
|
2038
|
+
mkdirsSync(dir);
|
|
2039
|
+
return fs$3.symlinkSync(srcpath, dstpath, type);
|
|
2040
|
+
}
|
|
2041
|
+
var symlink = {
|
|
2042
|
+
createSymlink: u$3(createSymlink$1),
|
|
2043
|
+
createSymlinkSync: createSymlinkSync$1
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
const {
|
|
2047
|
+
createFile,
|
|
2048
|
+
createFileSync
|
|
2049
|
+
} = file;
|
|
2050
|
+
const {
|
|
2051
|
+
createLink,
|
|
2052
|
+
createLinkSync
|
|
2053
|
+
} = link;
|
|
2054
|
+
const {
|
|
2055
|
+
createSymlink,
|
|
2056
|
+
createSymlinkSync
|
|
2057
|
+
} = symlink;
|
|
2058
|
+
var ensure = {
|
|
2059
|
+
// file
|
|
2060
|
+
createFile,
|
|
2061
|
+
createFileSync,
|
|
2062
|
+
ensureFile: createFile,
|
|
2063
|
+
ensureFileSync: createFileSync,
|
|
2064
|
+
// link
|
|
2065
|
+
createLink,
|
|
2066
|
+
createLinkSync,
|
|
2067
|
+
ensureLink: createLink,
|
|
2068
|
+
ensureLinkSync: createLinkSync,
|
|
2069
|
+
// symlink
|
|
2070
|
+
createSymlink,
|
|
2071
|
+
createSymlinkSync,
|
|
2072
|
+
ensureSymlink: createSymlink,
|
|
2073
|
+
ensureSymlinkSync: createSymlinkSync
|
|
2074
|
+
};
|
|
2075
|
+
|
|
2076
|
+
function stringify$3(obj, {
|
|
2077
|
+
EOL = '\n',
|
|
2078
|
+
finalEOL = true,
|
|
2079
|
+
replacer = null,
|
|
2080
|
+
spaces
|
|
2081
|
+
} = {}) {
|
|
2082
|
+
const EOF = finalEOL ? EOL : '';
|
|
2083
|
+
const str = JSON.stringify(obj, replacer, spaces);
|
|
2084
|
+
return str.replace(/\n/g, EOL) + EOF;
|
|
2085
|
+
}
|
|
2086
|
+
function stripBom$1(content) {
|
|
2087
|
+
// we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
|
|
2088
|
+
if (Buffer.isBuffer(content)) content = content.toString('utf8');
|
|
2089
|
+
return content.replace(/^\uFEFF/, '');
|
|
2090
|
+
}
|
|
2091
|
+
var utils = {
|
|
2092
|
+
stringify: stringify$3,
|
|
2093
|
+
stripBom: stripBom$1
|
|
2094
|
+
};
|
|
2095
|
+
|
|
2096
|
+
let _fs;
|
|
2097
|
+
try {
|
|
2098
|
+
_fs = gracefulFs;
|
|
2099
|
+
} catch (_) {
|
|
2100
|
+
_fs = require$$0__default$2["default"];
|
|
2101
|
+
}
|
|
2102
|
+
const universalify = universalify$1;
|
|
2103
|
+
const {
|
|
2104
|
+
stringify: stringify$2,
|
|
2105
|
+
stripBom
|
|
2106
|
+
} = utils;
|
|
2107
|
+
async function _readFile(file, options = {}) {
|
|
2108
|
+
if (typeof options === 'string') {
|
|
2109
|
+
options = {
|
|
2110
|
+
encoding: options
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
const fs = options.fs || _fs;
|
|
2114
|
+
const shouldThrow = 'throws' in options ? options.throws : true;
|
|
2115
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options);
|
|
2116
|
+
data = stripBom(data);
|
|
2117
|
+
let obj;
|
|
2118
|
+
try {
|
|
2119
|
+
obj = JSON.parse(data, options ? options.reviver : null);
|
|
2120
|
+
} catch (err) {
|
|
2121
|
+
if (shouldThrow) {
|
|
2122
|
+
err.message = `${file}: ${err.message}`;
|
|
2123
|
+
throw err;
|
|
2124
|
+
} else {
|
|
2125
|
+
return null;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
return obj;
|
|
2129
|
+
}
|
|
2130
|
+
const readFile = universalify.fromPromise(_readFile);
|
|
2131
|
+
function readFileSync(file, options = {}) {
|
|
2132
|
+
if (typeof options === 'string') {
|
|
2133
|
+
options = {
|
|
2134
|
+
encoding: options
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
const fs = options.fs || _fs;
|
|
2138
|
+
const shouldThrow = 'throws' in options ? options.throws : true;
|
|
2139
|
+
try {
|
|
2140
|
+
let content = fs.readFileSync(file, options);
|
|
2141
|
+
content = stripBom(content);
|
|
2142
|
+
return JSON.parse(content, options.reviver);
|
|
2143
|
+
} catch (err) {
|
|
2144
|
+
if (shouldThrow) {
|
|
2145
|
+
err.message = `${file}: ${err.message}`;
|
|
2146
|
+
throw err;
|
|
2147
|
+
} else {
|
|
2148
|
+
return null;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
async function _writeFile(file, obj, options = {}) {
|
|
2153
|
+
const fs = options.fs || _fs;
|
|
2154
|
+
const str = stringify$2(obj, options);
|
|
2155
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
2156
|
+
}
|
|
2157
|
+
const writeFile = universalify.fromPromise(_writeFile);
|
|
2158
|
+
function writeFileSync(file, obj, options = {}) {
|
|
2159
|
+
const fs = options.fs || _fs;
|
|
2160
|
+
const str = stringify$2(obj, options);
|
|
2161
|
+
// not sure if fs.writeFileSync returns anything, but just in case
|
|
2162
|
+
return fs.writeFileSync(file, str, options);
|
|
2163
|
+
}
|
|
2164
|
+
const jsonfile$1 = {
|
|
2165
|
+
readFile,
|
|
2166
|
+
readFileSync,
|
|
2167
|
+
writeFile,
|
|
2168
|
+
writeFileSync
|
|
2169
|
+
};
|
|
2170
|
+
var jsonfile_1 = jsonfile$1;
|
|
2171
|
+
|
|
2172
|
+
const jsonFile$1 = jsonfile_1;
|
|
2173
|
+
var jsonfile = {
|
|
2174
|
+
// jsonfile exports
|
|
2175
|
+
readJson: jsonFile$1.readFile,
|
|
2176
|
+
readJsonSync: jsonFile$1.readFileSync,
|
|
2177
|
+
writeJson: jsonFile$1.writeFile,
|
|
2178
|
+
writeJsonSync: jsonFile$1.writeFileSync
|
|
2179
|
+
};
|
|
2180
|
+
|
|
2181
|
+
const u$2 = universalify$1.fromCallback;
|
|
2182
|
+
const fs$2 = gracefulFs;
|
|
2183
|
+
const path$2 = require$$1__default["default"];
|
|
2184
|
+
const mkdir = mkdirs$2;
|
|
2185
|
+
const pathExists$1 = pathExists_1.pathExists;
|
|
2186
|
+
function outputFile$1(file, data, encoding, callback) {
|
|
2187
|
+
if (typeof encoding === 'function') {
|
|
2188
|
+
callback = encoding;
|
|
2189
|
+
encoding = 'utf8';
|
|
2190
|
+
}
|
|
2191
|
+
const dir = path$2.dirname(file);
|
|
2192
|
+
pathExists$1(dir, (err, itDoes) => {
|
|
2193
|
+
if (err) return callback(err);
|
|
2194
|
+
if (itDoes) return fs$2.writeFile(file, data, encoding, callback);
|
|
2195
|
+
mkdir.mkdirs(dir, err => {
|
|
2196
|
+
if (err) return callback(err);
|
|
2197
|
+
fs$2.writeFile(file, data, encoding, callback);
|
|
2198
|
+
});
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
function outputFileSync$1(file, ...args) {
|
|
2202
|
+
const dir = path$2.dirname(file);
|
|
2203
|
+
if (fs$2.existsSync(dir)) {
|
|
2204
|
+
return fs$2.writeFileSync(file, ...args);
|
|
2205
|
+
}
|
|
2206
|
+
mkdir.mkdirsSync(dir);
|
|
2207
|
+
fs$2.writeFileSync(file, ...args);
|
|
2208
|
+
}
|
|
2209
|
+
var outputFile_1 = {
|
|
2210
|
+
outputFile: u$2(outputFile$1),
|
|
2211
|
+
outputFileSync: outputFileSync$1
|
|
2212
|
+
};
|
|
2213
|
+
|
|
2214
|
+
const {
|
|
2215
|
+
stringify: stringify$1
|
|
2216
|
+
} = utils;
|
|
2217
|
+
const {
|
|
2218
|
+
outputFile
|
|
2219
|
+
} = outputFile_1;
|
|
2220
|
+
async function outputJson(file, data, options = {}) {
|
|
2221
|
+
const str = stringify$1(data, options);
|
|
2222
|
+
await outputFile(file, str, options);
|
|
2223
|
+
}
|
|
2224
|
+
var outputJson_1 = outputJson;
|
|
2225
|
+
|
|
2226
|
+
const {
|
|
2227
|
+
stringify
|
|
2228
|
+
} = utils;
|
|
2229
|
+
const {
|
|
2230
|
+
outputFileSync
|
|
2231
|
+
} = outputFile_1;
|
|
2232
|
+
function outputJsonSync(file, data, options) {
|
|
2233
|
+
const str = stringify(data, options);
|
|
2234
|
+
outputFileSync(file, str, options);
|
|
2235
|
+
}
|
|
2236
|
+
var outputJsonSync_1 = outputJsonSync;
|
|
2237
|
+
|
|
2238
|
+
const u$1 = universalify$1.fromPromise;
|
|
2239
|
+
const jsonFile = jsonfile;
|
|
2240
|
+
jsonFile.outputJson = u$1(outputJson_1);
|
|
2241
|
+
jsonFile.outputJsonSync = outputJsonSync_1;
|
|
2242
|
+
// aliases
|
|
2243
|
+
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2244
|
+
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2245
|
+
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2246
|
+
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2247
|
+
jsonFile.readJSON = jsonFile.readJson;
|
|
2248
|
+
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2249
|
+
var json = jsonFile;
|
|
2250
|
+
|
|
2251
|
+
const fs$1 = gracefulFs;
|
|
2252
|
+
const path$1 = require$$1__default["default"];
|
|
2253
|
+
const copy = copy$1.copy;
|
|
2254
|
+
const remove = remove_1.remove;
|
|
2255
|
+
const mkdirp = mkdirs$2.mkdirp;
|
|
2256
|
+
const pathExists = pathExists_1.pathExists;
|
|
2257
|
+
const stat$1 = stat$4;
|
|
2258
|
+
function move$1(src, dest, opts, cb) {
|
|
2259
|
+
if (typeof opts === 'function') {
|
|
2260
|
+
cb = opts;
|
|
2261
|
+
opts = {};
|
|
2262
|
+
}
|
|
2263
|
+
opts = opts || {};
|
|
2264
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2265
|
+
stat$1.checkPaths(src, dest, 'move', opts, (err, stats) => {
|
|
2266
|
+
if (err) return cb(err);
|
|
2267
|
+
const {
|
|
2268
|
+
srcStat,
|
|
2269
|
+
isChangingCase = false
|
|
2270
|
+
} = stats;
|
|
2271
|
+
stat$1.checkParentPaths(src, srcStat, dest, 'move', err => {
|
|
2272
|
+
if (err) return cb(err);
|
|
2273
|
+
if (isParentRoot$1(dest)) return doRename$1(src, dest, overwrite, isChangingCase, cb);
|
|
2274
|
+
mkdirp(path$1.dirname(dest), err => {
|
|
2275
|
+
if (err) return cb(err);
|
|
2276
|
+
return doRename$1(src, dest, overwrite, isChangingCase, cb);
|
|
2277
|
+
});
|
|
2278
|
+
});
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
function isParentRoot$1(dest) {
|
|
2282
|
+
const parent = path$1.dirname(dest);
|
|
2283
|
+
const parsedPath = path$1.parse(parent);
|
|
2284
|
+
return parsedPath.root === parent;
|
|
2285
|
+
}
|
|
2286
|
+
function doRename$1(src, dest, overwrite, isChangingCase, cb) {
|
|
2287
|
+
if (isChangingCase) return rename$1(src, dest, overwrite, cb);
|
|
2288
|
+
if (overwrite) {
|
|
2289
|
+
return remove(dest, err => {
|
|
2290
|
+
if (err) return cb(err);
|
|
2291
|
+
return rename$1(src, dest, overwrite, cb);
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
pathExists(dest, (err, destExists) => {
|
|
2295
|
+
if (err) return cb(err);
|
|
2296
|
+
if (destExists) return cb(new Error('dest already exists.'));
|
|
2297
|
+
return rename$1(src, dest, overwrite, cb);
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
function rename$1(src, dest, overwrite, cb) {
|
|
2301
|
+
fs$1.rename(src, dest, err => {
|
|
2302
|
+
if (!err) return cb();
|
|
2303
|
+
if (err.code !== 'EXDEV') return cb(err);
|
|
2304
|
+
return moveAcrossDevice$1(src, dest, overwrite, cb);
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
function moveAcrossDevice$1(src, dest, overwrite, cb) {
|
|
2308
|
+
const opts = {
|
|
2309
|
+
overwrite,
|
|
2310
|
+
errorOnExist: true
|
|
2311
|
+
};
|
|
2312
|
+
copy(src, dest, opts, err => {
|
|
2313
|
+
if (err) return cb(err);
|
|
2314
|
+
return remove(src, cb);
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
var move_1 = move$1;
|
|
2318
|
+
|
|
2319
|
+
const fs = gracefulFs;
|
|
2320
|
+
const path = require$$1__default["default"];
|
|
2321
|
+
const copySync = copy$1.copySync;
|
|
2322
|
+
const removeSync = remove_1.removeSync;
|
|
2323
|
+
const mkdirpSync = mkdirs$2.mkdirpSync;
|
|
2324
|
+
const stat = stat$4;
|
|
2325
|
+
function moveSync(src, dest, opts) {
|
|
2326
|
+
opts = opts || {};
|
|
2327
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2328
|
+
const {
|
|
2329
|
+
srcStat,
|
|
2330
|
+
isChangingCase = false
|
|
2331
|
+
} = stat.checkPathsSync(src, dest, 'move', opts);
|
|
2332
|
+
stat.checkParentPathsSync(src, srcStat, dest, 'move');
|
|
2333
|
+
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
|
|
2334
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
2335
|
+
}
|
|
2336
|
+
function isParentRoot(dest) {
|
|
2337
|
+
const parent = path.dirname(dest);
|
|
2338
|
+
const parsedPath = path.parse(parent);
|
|
2339
|
+
return parsedPath.root === parent;
|
|
2340
|
+
}
|
|
2341
|
+
function doRename(src, dest, overwrite, isChangingCase) {
|
|
2342
|
+
if (isChangingCase) return rename(src, dest, overwrite);
|
|
2343
|
+
if (overwrite) {
|
|
2344
|
+
removeSync(dest);
|
|
2345
|
+
return rename(src, dest, overwrite);
|
|
2346
|
+
}
|
|
2347
|
+
if (fs.existsSync(dest)) throw new Error('dest already exists.');
|
|
2348
|
+
return rename(src, dest, overwrite);
|
|
2349
|
+
}
|
|
2350
|
+
function rename(src, dest, overwrite) {
|
|
2351
|
+
try {
|
|
2352
|
+
fs.renameSync(src, dest);
|
|
2353
|
+
} catch (err) {
|
|
2354
|
+
if (err.code !== 'EXDEV') throw err;
|
|
2355
|
+
return moveAcrossDevice(src, dest, overwrite);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
|
2359
|
+
const opts = {
|
|
2360
|
+
overwrite,
|
|
2361
|
+
errorOnExist: true
|
|
2362
|
+
};
|
|
2363
|
+
copySync(src, dest, opts);
|
|
2364
|
+
return removeSync(src);
|
|
2365
|
+
}
|
|
2366
|
+
var moveSync_1 = moveSync;
|
|
2367
|
+
|
|
2368
|
+
const u = universalify$1.fromCallback;
|
|
2369
|
+
var move = {
|
|
2370
|
+
move: u(move_1),
|
|
2371
|
+
moveSync: moveSync_1
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2374
|
+
var lib = {
|
|
2375
|
+
// Export promiseified graceful-fs:
|
|
2376
|
+
...fs$h,
|
|
2377
|
+
// Export extra methods:
|
|
2378
|
+
...copy$1,
|
|
2379
|
+
...empty,
|
|
2380
|
+
...ensure,
|
|
2381
|
+
...json,
|
|
2382
|
+
...mkdirs$2,
|
|
2383
|
+
...move,
|
|
2384
|
+
...outputFile_1,
|
|
2385
|
+
...pathExists_1,
|
|
2386
|
+
...remove_1
|
|
2387
|
+
};
|
|
2388
|
+
|
|
2389
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
149
2390
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context8, _context9; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(source), !0)).call(_context8, function (key) { _defineProperty__default["default"](target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
150
2391
|
var ProjectState = /*#__PURE__*/_createClass__default["default"](
|
|
151
2392
|
/**
|
|
@@ -164,19 +2405,14 @@ var ProjectState = /*#__PURE__*/_createClass__default["default"](
|
|
|
164
2405
|
/**
|
|
165
2406
|
* Provide information about current state of the project.
|
|
166
2407
|
*/
|
|
2408
|
+
|
|
167
2409
|
function ProjectState() {
|
|
168
2410
|
var _this = this;
|
|
169
|
-
|
|
170
2411
|
_classCallCheck__default["default"](this, ProjectState);
|
|
171
|
-
|
|
172
2412
|
_defineProperty__default["default"](this, "promise", void 0);
|
|
173
|
-
|
|
174
2413
|
_defineProperty__default["default"](this, "resolve", void 0);
|
|
175
|
-
|
|
176
2414
|
_defineProperty__default["default"](this, "reject", void 0);
|
|
177
|
-
|
|
178
2415
|
_defineProperty__default["default"](this, "stage", "pending");
|
|
179
|
-
|
|
180
2416
|
this.promise = new _Promise__default["default"](function (resolve, reject) {
|
|
181
2417
|
_this.resolve = resolve;
|
|
182
2418
|
_this.reject = reject;
|
|
@@ -188,10 +2424,8 @@ function ProjectState() {
|
|
|
188
2424
|
* @param title - Some explanatory text as to what's going on.
|
|
189
2425
|
* @param details - The error or some other message as to what went wrong.
|
|
190
2426
|
*/
|
|
191
|
-
|
|
192
2427
|
function logError(title, details) {
|
|
193
2428
|
var _context;
|
|
194
|
-
|
|
195
2429
|
var wrappedDetails = details != null ? "\n".concat(details instanceof Error ? details.message : details) : "";
|
|
196
2430
|
process.stderr.write(_concatInstanceProperty__default["default"](_context = "\n==> ".concat(title)).call(_context, wrappedDetails, "\n"));
|
|
197
2431
|
}
|
|
@@ -199,10 +2433,8 @@ function logError(title, details) {
|
|
|
199
2433
|
* @param title
|
|
200
2434
|
* @param details
|
|
201
2435
|
*/
|
|
202
|
-
|
|
203
2436
|
function logInfo(title, details) {
|
|
204
2437
|
var _context2;
|
|
205
|
-
|
|
206
2438
|
var wrappedDetails = details ? ":\n".concat(details) : "";
|
|
207
2439
|
process.stdout.write(_concatInstanceProperty__default["default"](_context2 = "\n==> ".concat(title)).call(_context2, wrappedDetails, "\n"));
|
|
208
2440
|
}
|
|
@@ -211,15 +2443,13 @@ function logInfo(title, details) {
|
|
|
211
2443
|
* @param failCommand
|
|
212
2444
|
* @param error
|
|
213
2445
|
*/
|
|
214
|
-
|
|
215
2446
|
function execFail(cwd, failCommand, error) {
|
|
216
2447
|
if (failCommand) {
|
|
217
2448
|
console.error("\n\nReason for debugging:");
|
|
218
2449
|
console.error(error);
|
|
219
2450
|
console.error("\n\nDebuging:");
|
|
220
|
-
|
|
221
2451
|
try {
|
|
222
|
-
|
|
2452
|
+
node_child_process.execSync(failCommand, {
|
|
223
2453
|
cwd: cwd,
|
|
224
2454
|
encoding: "utf8",
|
|
225
2455
|
env: _objectSpread(_objectSpread({}, process.env), {}, {
|
|
@@ -237,41 +2467,34 @@ function execFail(cwd, failCommand, error) {
|
|
|
237
2467
|
* @param logDir
|
|
238
2468
|
* @param getState
|
|
239
2469
|
*/
|
|
240
|
-
|
|
241
2470
|
function createSpawner(logDir, getState) {
|
|
242
2471
|
var nextId = 1;
|
|
243
2472
|
return function spawnThrow(_ref) {
|
|
244
2473
|
var cmd = _ref.cmd,
|
|
245
|
-
|
|
246
|
-
|
|
2474
|
+
cwd = _ref.cwd,
|
|
2475
|
+
failCommand = _ref.failCommand;
|
|
247
2476
|
var id = nextId++;
|
|
248
|
-
|
|
249
2477
|
var getHeaderLines = function getHeaderLines() {
|
|
250
2478
|
var _context3;
|
|
251
|
-
|
|
252
2479
|
return _concatInstanceProperty__default["default"](_context3 = ["time: " + new Date().toISOString(), "id: " + id, "cwd: " + cwd, "cmd: " + _mapInstanceProperty__default["default"](cmd).call(cmd, function (word) {
|
|
253
2480
|
return _JSON$stringify__default["default"](word);
|
|
254
2481
|
}).join(" "), "states:"]).call(_context3, _toConsumableArray__default["default"](getState()));
|
|
255
2482
|
};
|
|
256
|
-
|
|
257
2483
|
var getLogMessage = function getLogMessage() {
|
|
258
2484
|
var _context4;
|
|
259
|
-
|
|
260
2485
|
return _mapInstanceProperty__default["default"](_context4 = getHeaderLines()).call(_context4, function (line) {
|
|
261
2486
|
return " " + line;
|
|
262
2487
|
}).join("\n");
|
|
263
2488
|
};
|
|
264
|
-
|
|
265
2489
|
logInfo("Start", getLogMessage());
|
|
266
2490
|
return new _Promise__default["default"](function (resolve, reject) {
|
|
267
2491
|
var _context5;
|
|
268
|
-
|
|
269
|
-
var
|
|
270
|
-
var logStream = fsExtra.createWriteStream(commandLogPath, {
|
|
2492
|
+
var commandLogPath = require$$1.join(logDir, [require$$1.basename(cwd).replace(/[^a-zA-Z0-9]+/g, "-"), cmd.join("-").replace(/[^a-zA-Z0-9]+/g, "-"), "id-" + _padStartInstanceProperty__default["default"](_context5 = "" + id).call(_context5, 3, "0"), "log"].join("."));
|
|
2493
|
+
var logStream = lib.createWriteStream(commandLogPath, {
|
|
271
2494
|
flags: "a"
|
|
272
2495
|
});
|
|
273
2496
|
logStream.write(getHeaderLines().join("\n") + "\n\n");
|
|
274
|
-
var child =
|
|
2497
|
+
var child = node_child_process.spawn(cmd[0], _sliceInstanceProperty__default["default"](cmd).call(cmd, 1), {
|
|
275
2498
|
cwd: cwd,
|
|
276
2499
|
env: _objectSpread(_objectSpread({}, process.env), {}, {
|
|
277
2500
|
VIS_INTEROP: "1"
|
|
@@ -286,55 +2509,44 @@ function createSpawner(logDir, getState) {
|
|
|
286
2509
|
*
|
|
287
2510
|
* @param code - The code or other kind of status to append.
|
|
288
2511
|
*/
|
|
289
|
-
|
|
290
2512
|
function addStatusCodeToFilename(code) {
|
|
291
2513
|
var newPath = _sliceInstanceProperty__default["default"](commandLogPath).call(commandLogPath, 0, -4) + ".status-" + code + ".log";
|
|
292
|
-
|
|
2514
|
+
lib.rename(commandLogPath, newPath).catch(function (error) {
|
|
293
2515
|
console.error("Failed to rename log file to ".concat(newPath, "."), error);
|
|
294
2516
|
});
|
|
295
2517
|
}
|
|
296
|
-
|
|
297
2518
|
var failed = false;
|
|
298
2519
|
child.on("close", function (code) {
|
|
299
2520
|
if (failed) ; else if (code !== 0) {
|
|
300
2521
|
var _context6;
|
|
301
|
-
|
|
302
2522
|
logError("Fail", getLogMessage());
|
|
303
|
-
|
|
304
2523
|
var errorMessage = _concatInstanceProperty__default["default"](_context6 = "".concat(_mapInstanceProperty__default["default"](cmd).call(cmd, function (word) {
|
|
305
2524
|
return "\"".concat(word, "\"");
|
|
306
2525
|
}).join(" "), ": exited with ")).call(_context6, code, ".");
|
|
307
|
-
|
|
308
2526
|
logStream.end(function () {
|
|
309
2527
|
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
310
2528
|
var commandOutput;
|
|
311
2529
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context7) {
|
|
312
|
-
while (1) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
execFail(cwd, failCommand, commandOutput + "\n\n" + errorMessage);
|
|
333
|
-
|
|
334
|
-
case 12:
|
|
335
|
-
case "end":
|
|
336
|
-
return _context7.stop();
|
|
337
|
-
}
|
|
2530
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2531
|
+
case 0:
|
|
2532
|
+
commandOutput = "";
|
|
2533
|
+
_context7.prev = 1;
|
|
2534
|
+
_context7.t0 = commandOutput;
|
|
2535
|
+
_context7.next = 5;
|
|
2536
|
+
return lib.readFile(commandLogPath, "utf-8");
|
|
2537
|
+
case 5:
|
|
2538
|
+
commandOutput = _context7.t0 += _context7.sent;
|
|
2539
|
+
_context7.next = 11;
|
|
2540
|
+
break;
|
|
2541
|
+
case 8:
|
|
2542
|
+
_context7.prev = 8;
|
|
2543
|
+
_context7.t1 = _context7["catch"](1);
|
|
2544
|
+
commandOutput += "Failed to log command output.";
|
|
2545
|
+
case 11:
|
|
2546
|
+
execFail(cwd, failCommand, commandOutput + "\n\n" + errorMessage);
|
|
2547
|
+
case 12:
|
|
2548
|
+
case "end":
|
|
2549
|
+
return _context7.stop();
|
|
338
2550
|
}
|
|
339
2551
|
}, _callee, null, [[1, 8]]);
|
|
340
2552
|
}))();
|
|
@@ -359,59 +2571,47 @@ function createSpawner(logDir, getState) {
|
|
|
359
2571
|
}
|
|
360
2572
|
|
|
361
2573
|
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof _Symbol__default["default"] !== "undefined" && _getIteratorMethod__default["default"](o) || o["@@iterator"]; if (!it) { if (_Array$isArray__default["default"](o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
362
|
-
|
|
363
2574
|
function _unsupportedIterableToArray$1(o, minLen) { var _context33; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty__default["default"](_context33 = Object.prototype.toString.call(o)).call(_context33, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from__default["default"](o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
2575
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2576
|
+
// Remove all temporary files on process exit.
|
|
367
2577
|
tmp.setGracefulCleanup();
|
|
368
2578
|
/**
|
|
369
2579
|
* @param tmpPath
|
|
370
2580
|
*/
|
|
371
|
-
|
|
372
2581
|
function prepareTmpDir(_x) {
|
|
373
2582
|
return _prepareTmpDir.apply(this, arguments);
|
|
374
2583
|
}
|
|
375
2584
|
/**
|
|
376
2585
|
* @param projectName
|
|
377
2586
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
380
2587
|
function _prepareTmpDir() {
|
|
381
2588
|
_prepareTmpDir = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(tmpPath) {
|
|
382
2589
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
383
|
-
while (1) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}));
|
|
404
|
-
|
|
405
|
-
case 7:
|
|
406
|
-
case "end":
|
|
407
|
-
return _context.stop();
|
|
408
|
-
}
|
|
2590
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2591
|
+
case 0:
|
|
2592
|
+
if (!tmpPath) {
|
|
2593
|
+
_context.next = 6;
|
|
2594
|
+
break;
|
|
2595
|
+
}
|
|
2596
|
+
_context.next = 3;
|
|
2597
|
+
return lib.mkdirp(tmpPath);
|
|
2598
|
+
case 3:
|
|
2599
|
+
return _context.abrupt("return", {
|
|
2600
|
+
name: tmpPath,
|
|
2601
|
+
removeCallback: function removeCallback() {}
|
|
2602
|
+
});
|
|
2603
|
+
case 6:
|
|
2604
|
+
return _context.abrupt("return", tmp.dirSync({
|
|
2605
|
+
unsafeCleanup: true
|
|
2606
|
+
}));
|
|
2607
|
+
case 7:
|
|
2608
|
+
case "end":
|
|
2609
|
+
return _context.stop();
|
|
409
2610
|
}
|
|
410
2611
|
}, _callee);
|
|
411
2612
|
}));
|
|
412
2613
|
return _prepareTmpDir.apply(this, arguments);
|
|
413
2614
|
}
|
|
414
|
-
|
|
415
2615
|
function getTarballName(projectName) {
|
|
416
2616
|
return "".concat(projectName, "-0.0.0-no-version.tgz");
|
|
417
2617
|
}
|
|
@@ -420,8 +2620,6 @@ function getTarballName(projectName) {
|
|
|
420
2620
|
* @param root0.tmpRootResolve
|
|
421
2621
|
* @param projectName
|
|
422
2622
|
*/
|
|
423
|
-
|
|
424
|
-
|
|
425
2623
|
function getTarballPath(_ref, projectName) {
|
|
426
2624
|
var tmpRootResolve = _ref.tmpRootResolve;
|
|
427
2625
|
return tmpRootResolve("".concat(projectName, ".tgz"));
|
|
@@ -430,35 +2628,27 @@ function getTarballPath(_ref, projectName) {
|
|
|
430
2628
|
* @param data
|
|
431
2629
|
* @param projectName
|
|
432
2630
|
*/
|
|
433
|
-
|
|
434
|
-
|
|
435
2631
|
function copyTarball(_x2, _x3) {
|
|
436
2632
|
return _copyTarball.apply(this, arguments);
|
|
437
2633
|
}
|
|
438
2634
|
/**
|
|
439
2635
|
* @param cwd
|
|
440
2636
|
*/
|
|
441
|
-
|
|
442
|
-
|
|
443
2637
|
function _copyTarball() {
|
|
444
2638
|
_copyTarball = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(data, projectName) {
|
|
445
2639
|
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
446
|
-
while (1) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
case "end":
|
|
454
|
-
return _context2.stop();
|
|
455
|
-
}
|
|
2640
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2641
|
+
case 0:
|
|
2642
|
+
_context2.next = 2;
|
|
2643
|
+
return lib.copyFile(data.tmpReposResolve(projectName, getTarballName(projectName)), getTarballPath(data, projectName));
|
|
2644
|
+
case 2:
|
|
2645
|
+
case "end":
|
|
2646
|
+
return _context2.stop();
|
|
456
2647
|
}
|
|
457
2648
|
}, _callee2);
|
|
458
2649
|
}));
|
|
459
2650
|
return _copyTarball.apply(this, arguments);
|
|
460
2651
|
}
|
|
461
|
-
|
|
462
2652
|
function getPackageDeps(_x4) {
|
|
463
2653
|
return _getPackageDeps.apply(this, arguments);
|
|
464
2654
|
}
|
|
@@ -466,52 +2656,40 @@ function getPackageDeps(_x4) {
|
|
|
466
2656
|
* @param data
|
|
467
2657
|
* @param projectName
|
|
468
2658
|
*/
|
|
469
|
-
|
|
470
|
-
|
|
471
2659
|
function _getPackageDeps() {
|
|
472
2660
|
_getPackageDeps = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(cwd) {
|
|
473
2661
|
var _context3;
|
|
474
|
-
|
|
475
2662
|
var packageJSONPath, packageJSON;
|
|
476
2663
|
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context4) {
|
|
477
|
-
while (1) {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
_context4.t1 = _context4.sent;
|
|
502
|
-
packageJSON = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
|
503
|
-
return _context4.abrupt("return", _toConsumableArray__default["default"](new _Set__default["default"](_concatInstanceProperty__default["default"](_context3 = []).call(_context3, _toConsumableArray__default["default"](_Object$keys__default["default"](packageJSON.dependencies || {})), _toConsumableArray__default["default"](_Object$keys__default["default"](packageJSON.devDependencies || {})), _toConsumableArray__default["default"](_Object$keys__default["default"](packageJSON.peerDependencies || {}))))));
|
|
504
|
-
|
|
505
|
-
case 11:
|
|
506
|
-
case "end":
|
|
507
|
-
return _context4.stop();
|
|
508
|
-
}
|
|
2664
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2665
|
+
case 0:
|
|
2666
|
+
_context4.next = 2;
|
|
2667
|
+
return findUp__default["default"]("package.json", {
|
|
2668
|
+
cwd: cwd
|
|
2669
|
+
});
|
|
2670
|
+
case 2:
|
|
2671
|
+
packageJSONPath = _context4.sent;
|
|
2672
|
+
if (!(packageJSONPath == null)) {
|
|
2673
|
+
_context4.next = 5;
|
|
2674
|
+
break;
|
|
2675
|
+
}
|
|
2676
|
+
throw new Error("Project's package.json file not found.");
|
|
2677
|
+
case 5:
|
|
2678
|
+
_context4.t0 = JSON;
|
|
2679
|
+
_context4.next = 8;
|
|
2680
|
+
return lib.readFile(packageJSONPath, "utf8");
|
|
2681
|
+
case 8:
|
|
2682
|
+
_context4.t1 = _context4.sent;
|
|
2683
|
+
packageJSON = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
|
2684
|
+
return _context4.abrupt("return", _toConsumableArray__default["default"](new _Set__default["default"](_concatInstanceProperty__default["default"](_context3 = []).call(_context3, _toConsumableArray__default["default"](_Object$keys__default["default"](packageJSON.dependencies || {})), _toConsumableArray__default["default"](_Object$keys__default["default"](packageJSON.devDependencies || {})), _toConsumableArray__default["default"](_Object$keys__default["default"](packageJSON.peerDependencies || {}))))));
|
|
2685
|
+
case 11:
|
|
2686
|
+
case "end":
|
|
2687
|
+
return _context4.stop();
|
|
509
2688
|
}
|
|
510
2689
|
}, _callee3);
|
|
511
2690
|
}));
|
|
512
2691
|
return _getPackageDeps.apply(this, arguments);
|
|
513
2692
|
}
|
|
514
|
-
|
|
515
2693
|
function getPackageLocalDeps(_x5, _x6) {
|
|
516
2694
|
return _getPackageLocalDeps.apply(this, arguments);
|
|
517
2695
|
}
|
|
@@ -520,39 +2698,31 @@ function getPackageLocalDeps(_x5, _x6) {
|
|
|
520
2698
|
* @param data
|
|
521
2699
|
* @param projectName
|
|
522
2700
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
2701
|
function _getPackageLocalDeps() {
|
|
526
2702
|
_getPackageLocalDeps = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(data, projectName) {
|
|
527
2703
|
var _context5;
|
|
528
|
-
|
|
529
2704
|
var projectPaths, tmpReposResolve, cwd;
|
|
530
2705
|
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context6) {
|
|
531
|
-
while (1) {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
case 7:
|
|
547
|
-
case "end":
|
|
548
|
-
return _context6.stop();
|
|
549
|
-
}
|
|
2706
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2707
|
+
case 0:
|
|
2708
|
+
projectPaths = data.projectPaths, tmpReposResolve = data.tmpReposResolve;
|
|
2709
|
+
cwd = tmpReposResolve(projectName);
|
|
2710
|
+
_context6.t0 = _filterInstanceProperty__default["default"];
|
|
2711
|
+
_context6.next = 5;
|
|
2712
|
+
return getPackageDeps(cwd);
|
|
2713
|
+
case 5:
|
|
2714
|
+
_context6.t1 = _context5 = _context6.sent;
|
|
2715
|
+
return _context6.abrupt("return", (0, _context6.t0)(_context6.t1).call(_context5, function (depName) {
|
|
2716
|
+
return projectPaths[depName] != null;
|
|
2717
|
+
}));
|
|
2718
|
+
case 7:
|
|
2719
|
+
case "end":
|
|
2720
|
+
return _context6.stop();
|
|
550
2721
|
}
|
|
551
2722
|
}, _callee4);
|
|
552
2723
|
}));
|
|
553
2724
|
return _getPackageLocalDeps.apply(this, arguments);
|
|
554
2725
|
}
|
|
555
|
-
|
|
556
2726
|
function clone(_x7, _x8, _x9) {
|
|
557
2727
|
return _clone.apply(this, arguments);
|
|
558
2728
|
}
|
|
@@ -560,53 +2730,43 @@ function clone(_x7, _x8, _x9) {
|
|
|
560
2730
|
* @param cwd
|
|
561
2731
|
* @param deps
|
|
562
2732
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
2733
|
function _clone() {
|
|
566
2734
|
_clone = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(spawn, data, projectName) {
|
|
567
2735
|
var failCommand, projectPaths, tmpReposResolve, cwd, projectPath;
|
|
568
2736
|
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context7) {
|
|
569
|
-
while (1) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if (!/\.git$/.test(projectPath)) {
|
|
577
|
-
_context7.next = 8;
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
_context7.next = 6;
|
|
582
|
-
return spawn({
|
|
583
|
-
cmd: ["git", "clone", projectPath, "--single-branch", "--branch", "master", "--depth", "1"],
|
|
584
|
-
cwd: cwd,
|
|
585
|
-
failCommand: failCommand
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
case 6:
|
|
589
|
-
_context7.next = 10;
|
|
2737
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2738
|
+
case 0:
|
|
2739
|
+
failCommand = data.failCommand, projectPaths = data.projectPaths, tmpReposResolve = data.tmpReposResolve;
|
|
2740
|
+
cwd = tmpReposResolve();
|
|
2741
|
+
projectPath = projectPaths[projectName];
|
|
2742
|
+
if (!/\.git$/.test(projectPath)) {
|
|
2743
|
+
_context7.next = 8;
|
|
590
2744
|
break;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
2745
|
+
}
|
|
2746
|
+
_context7.next = 6;
|
|
2747
|
+
return spawn({
|
|
2748
|
+
cmd: ["git", "clone", projectPath, "--single-branch", "--branch", "master", "--depth", "1"],
|
|
2749
|
+
cwd: cwd,
|
|
2750
|
+
failCommand: failCommand
|
|
2751
|
+
});
|
|
2752
|
+
case 6:
|
|
2753
|
+
_context7.next = 10;
|
|
2754
|
+
break;
|
|
2755
|
+
case 8:
|
|
2756
|
+
_context7.next = 10;
|
|
2757
|
+
return lib.copy(projectPath, tmpReposResolve(projectName), {
|
|
2758
|
+
filter: function filter(_src, dest) {
|
|
2759
|
+
return !/[\\/].git[\\/]/.test(dest) && !/[\\/]node_modules[\\/]/.test(dest);
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2762
|
+
case 10:
|
|
2763
|
+
case "end":
|
|
2764
|
+
return _context7.stop();
|
|
604
2765
|
}
|
|
605
2766
|
}, _callee5);
|
|
606
2767
|
}));
|
|
607
2768
|
return _clone.apply(this, arguments);
|
|
608
2769
|
}
|
|
609
|
-
|
|
610
2770
|
function updatePackageDepVersions(_x10, _x11) {
|
|
611
2771
|
return _updatePackageDepVersions.apply(this, arguments);
|
|
612
2772
|
}
|
|
@@ -615,221 +2775,172 @@ function updatePackageDepVersions(_x10, _x11) {
|
|
|
615
2775
|
* @param data
|
|
616
2776
|
* @param projectName
|
|
617
2777
|
*/
|
|
618
|
-
|
|
619
|
-
|
|
620
2778
|
function _updatePackageDepVersions() {
|
|
621
2779
|
_updatePackageDepVersions = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(cwd, deps) {
|
|
622
2780
|
var _context8, _packageJSON$dependen, _context9, _packageJSON$devDepen, _context10, _packageJSON$peerDepe;
|
|
623
|
-
|
|
624
2781
|
var packageJSONPath, packageJSON;
|
|
625
2782
|
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context11) {
|
|
626
|
-
while (1) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
2783
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
2784
|
+
case 0:
|
|
2785
|
+
_context11.next = 2;
|
|
2786
|
+
return findUp__default["default"]("package.json", {
|
|
2787
|
+
cwd: cwd
|
|
2788
|
+
});
|
|
2789
|
+
case 2:
|
|
2790
|
+
packageJSONPath = _context11.sent;
|
|
2791
|
+
if (!(packageJSONPath == null)) {
|
|
2792
|
+
_context11.next = 5;
|
|
2793
|
+
break;
|
|
2794
|
+
}
|
|
2795
|
+
throw new Error("Project's package.json file not found.");
|
|
2796
|
+
case 5:
|
|
2797
|
+
_context11.t0 = JSON;
|
|
2798
|
+
_context11.next = 8;
|
|
2799
|
+
return lib.readFile(packageJSONPath, "utf8");
|
|
2800
|
+
case 8:
|
|
2801
|
+
_context11.t1 = _context11.sent;
|
|
2802
|
+
packageJSON = _context11.t0.parse.call(_context11.t0, _context11.t1);
|
|
2803
|
+
_forEachInstanceProperty__default["default"](_context8 = _Object$keys__default["default"]((_packageJSON$dependen = packageJSON.dependencies) !== null && _packageJSON$dependen !== void 0 ? _packageJSON$dependen : {})).call(_context8, function (key) {
|
|
2804
|
+
if (Object.prototype.hasOwnProperty.call(deps, key)) {
|
|
2805
|
+
packageJSON.dependencies[key] = "file:" + deps[key];
|
|
640
2806
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
_forEachInstanceProperty__default["default"](_context9 = _Object$keys__default["default"]((_packageJSON$devDepen = packageJSON.devDependencies) !== null && _packageJSON$devDepen !== void 0 ? _packageJSON$devDepen : {})).call(_context9, function (key) {
|
|
660
|
-
if (Object.prototype.hasOwnProperty.call(deps, key)) {
|
|
661
|
-
packageJSON.devDependencies[key] = "file:" + deps[key];
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
|
|
665
|
-
_forEachInstanceProperty__default["default"](_context10 = _Object$keys__default["default"]((_packageJSON$peerDepe = packageJSON.peerDependencies) !== null && _packageJSON$peerDepe !== void 0 ? _packageJSON$peerDepe : {})).call(_context10, function (key) {
|
|
666
|
-
if (Object.prototype.hasOwnProperty.call(deps, key)) {
|
|
667
|
-
packageJSON.peerDependencies[key] = "file:" + deps[key];
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
_context11.next = 15;
|
|
672
|
-
return fsExtra.writeFile(packageJSONPath, _JSON$stringify__default["default"](packageJSON, undefined, 4));
|
|
673
|
-
|
|
674
|
-
case 15:
|
|
675
|
-
case "end":
|
|
676
|
-
return _context11.stop();
|
|
677
|
-
}
|
|
2807
|
+
});
|
|
2808
|
+
_forEachInstanceProperty__default["default"](_context9 = _Object$keys__default["default"]((_packageJSON$devDepen = packageJSON.devDependencies) !== null && _packageJSON$devDepen !== void 0 ? _packageJSON$devDepen : {})).call(_context9, function (key) {
|
|
2809
|
+
if (Object.prototype.hasOwnProperty.call(deps, key)) {
|
|
2810
|
+
packageJSON.devDependencies[key] = "file:" + deps[key];
|
|
2811
|
+
}
|
|
2812
|
+
});
|
|
2813
|
+
_forEachInstanceProperty__default["default"](_context10 = _Object$keys__default["default"]((_packageJSON$peerDepe = packageJSON.peerDependencies) !== null && _packageJSON$peerDepe !== void 0 ? _packageJSON$peerDepe : {})).call(_context10, function (key) {
|
|
2814
|
+
if (Object.prototype.hasOwnProperty.call(deps, key)) {
|
|
2815
|
+
packageJSON.peerDependencies[key] = "file:" + deps[key];
|
|
2816
|
+
}
|
|
2817
|
+
});
|
|
2818
|
+
_context11.next = 15;
|
|
2819
|
+
return lib.writeFile(packageJSONPath, _JSON$stringify__default["default"](packageJSON, undefined, 4));
|
|
2820
|
+
case 15:
|
|
2821
|
+
case "end":
|
|
2822
|
+
return _context11.stop();
|
|
678
2823
|
}
|
|
679
2824
|
}, _callee6);
|
|
680
2825
|
}));
|
|
681
2826
|
return _updatePackageDepVersions.apply(this, arguments);
|
|
682
2827
|
}
|
|
683
|
-
|
|
684
2828
|
function buildTestPack(_x12, _x13, _x14) {
|
|
685
2829
|
return _buildTestPack.apply(this, arguments);
|
|
686
2830
|
}
|
|
687
2831
|
/**
|
|
688
2832
|
* @param data
|
|
689
2833
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
2834
|
function _buildTestPack() {
|
|
693
2835
|
_buildTestPack = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(spawn, data, projectName) {
|
|
694
2836
|
var _context12;
|
|
695
|
-
|
|
696
2837
|
var failCommand, packageScripts, tmpReposResolve, cwd, packageLockPath, _iterator, _step, _step$value, packageName, scriptName, skipIfMissing;
|
|
697
|
-
|
|
698
2838
|
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context13) {
|
|
699
|
-
while (1) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
case 13:
|
|
726
|
-
packageLockPath = _context13.sent;
|
|
727
|
-
|
|
728
|
-
if (!(packageLockPath != null)) {
|
|
729
|
-
_context13.next = 17;
|
|
730
|
-
break;
|
|
731
|
-
}
|
|
732
|
-
|
|
2839
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2840
|
+
case 0:
|
|
2841
|
+
failCommand = data.failCommand, packageScripts = data.packageScripts, tmpReposResolve = data.tmpReposResolve;
|
|
2842
|
+
cwd = tmpReposResolve(projectName);
|
|
2843
|
+
_context13.t0 = updatePackageDepVersions;
|
|
2844
|
+
_context13.t1 = cwd;
|
|
2845
|
+
_context13.t2 = _reduceInstanceProperty__default["default"];
|
|
2846
|
+
_context13.next = 7;
|
|
2847
|
+
return getPackageLocalDeps(data, projectName);
|
|
2848
|
+
case 7:
|
|
2849
|
+
_context13.t3 = _context12 = _context13.sent;
|
|
2850
|
+
_context13.t4 = (0, _context13.t2)(_context13.t3).call(_context12, function (acc, key) {
|
|
2851
|
+
acc[key] = getTarballPath(data, key);
|
|
2852
|
+
return acc;
|
|
2853
|
+
}, _Object$create__default["default"](null));
|
|
2854
|
+
_context13.next = 11;
|
|
2855
|
+
return (0, _context13.t0)(_context13.t1, _context13.t4);
|
|
2856
|
+
case 11:
|
|
2857
|
+
_context13.next = 13;
|
|
2858
|
+
return findUp__default["default"]("package-lock.json", {
|
|
2859
|
+
cwd: cwd
|
|
2860
|
+
});
|
|
2861
|
+
case 13:
|
|
2862
|
+
packageLockPath = _context13.sent;
|
|
2863
|
+
if (!(packageLockPath != null)) {
|
|
733
2864
|
_context13.next = 17;
|
|
734
|
-
return fsExtra.unlink(packageLockPath);
|
|
735
|
-
|
|
736
|
-
case 17:
|
|
737
|
-
_context13.next = 19;
|
|
738
|
-
return spawn({
|
|
739
|
-
cmd: ["npm", "install"],
|
|
740
|
-
cwd: cwd,
|
|
741
|
-
failCommand: failCommand
|
|
742
|
-
});
|
|
743
|
-
|
|
744
|
-
case 19:
|
|
745
|
-
_iterator = _createForOfIteratorHelper$1(packageScripts);
|
|
746
|
-
_context13.prev = 20;
|
|
747
|
-
|
|
748
|
-
_iterator.s();
|
|
749
|
-
|
|
750
|
-
case 22:
|
|
751
|
-
if ((_step = _iterator.n()).done) {
|
|
752
|
-
_context13.next = 37;
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
_step$value = _step.value, packageName = _step$value.packageName, scriptName = _step$value.scriptName, skipIfMissing = _step$value.skipIfMissing;
|
|
757
|
-
|
|
758
|
-
if (!(packageName != null && packageName !== projectName)) {
|
|
759
|
-
_context13.next = 28;
|
|
760
|
-
break;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
return _context13.abrupt("continue", 35);
|
|
764
|
-
|
|
765
|
-
case 28:
|
|
766
|
-
if (!skipIfMissing) {
|
|
767
|
-
_context13.next = 33;
|
|
768
|
-
break;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
_context13.next = 31;
|
|
772
|
-
return spawn({
|
|
773
|
-
cmd: ["npm", "run", scriptName, "--if-present"],
|
|
774
|
-
cwd: cwd,
|
|
775
|
-
failCommand: failCommand
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
case 31:
|
|
779
|
-
_context13.next = 35;
|
|
780
2865
|
break;
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
2866
|
+
}
|
|
2867
|
+
_context13.next = 17;
|
|
2868
|
+
return lib.unlink(packageLockPath);
|
|
2869
|
+
case 17:
|
|
2870
|
+
_context13.next = 19;
|
|
2871
|
+
return spawn({
|
|
2872
|
+
cmd: ["npm", "install"],
|
|
2873
|
+
cwd: cwd,
|
|
2874
|
+
failCommand: failCommand
|
|
2875
|
+
});
|
|
2876
|
+
case 19:
|
|
2877
|
+
_iterator = _createForOfIteratorHelper$1(packageScripts);
|
|
2878
|
+
_context13.prev = 20;
|
|
2879
|
+
_iterator.s();
|
|
2880
|
+
case 22:
|
|
2881
|
+
if ((_step = _iterator.n()).done) {
|
|
2882
|
+
_context13.next = 37;
|
|
792
2883
|
break;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
2884
|
+
}
|
|
2885
|
+
_step$value = _step.value, packageName = _step$value.packageName, scriptName = _step$value.scriptName, skipIfMissing = _step$value.skipIfMissing;
|
|
2886
|
+
if (!(packageName != null && packageName !== projectName)) {
|
|
2887
|
+
_context13.next = 28;
|
|
796
2888
|
break;
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
2889
|
+
}
|
|
2890
|
+
return _context13.abrupt("continue", 35);
|
|
2891
|
+
case 28:
|
|
2892
|
+
if (!skipIfMissing) {
|
|
2893
|
+
_context13.next = 33;
|
|
2894
|
+
break;
|
|
2895
|
+
}
|
|
2896
|
+
_context13.next = 31;
|
|
2897
|
+
return spawn({
|
|
2898
|
+
cmd: ["npm", "run", scriptName, "--if-present"],
|
|
2899
|
+
cwd: cwd,
|
|
2900
|
+
failCommand: failCommand
|
|
2901
|
+
});
|
|
2902
|
+
case 31:
|
|
2903
|
+
_context13.next = 35;
|
|
2904
|
+
break;
|
|
2905
|
+
case 33:
|
|
2906
|
+
_context13.next = 35;
|
|
2907
|
+
return spawn({
|
|
2908
|
+
cmd: ["npm", "run", scriptName],
|
|
2909
|
+
cwd: cwd,
|
|
2910
|
+
failCommand: failCommand
|
|
2911
|
+
});
|
|
2912
|
+
case 35:
|
|
2913
|
+
_context13.next = 22;
|
|
2914
|
+
break;
|
|
2915
|
+
case 37:
|
|
2916
|
+
_context13.next = 42;
|
|
2917
|
+
break;
|
|
2918
|
+
case 39:
|
|
2919
|
+
_context13.prev = 39;
|
|
2920
|
+
_context13.t5 = _context13["catch"](20);
|
|
2921
|
+
_iterator.e(_context13.t5);
|
|
2922
|
+
case 42:
|
|
2923
|
+
_context13.prev = 42;
|
|
2924
|
+
_iterator.f();
|
|
2925
|
+
return _context13.finish(42);
|
|
2926
|
+
case 45:
|
|
2927
|
+
_context13.next = 47;
|
|
2928
|
+
return spawn({
|
|
2929
|
+
cmd: ["npm", "pack"],
|
|
2930
|
+
cwd: cwd,
|
|
2931
|
+
failCommand: failCommand
|
|
2932
|
+
});
|
|
2933
|
+
case 47:
|
|
2934
|
+
_context13.next = 49;
|
|
2935
|
+
return copyTarball(data, projectName);
|
|
2936
|
+
case 49:
|
|
2937
|
+
case "end":
|
|
2938
|
+
return _context13.stop();
|
|
827
2939
|
}
|
|
828
2940
|
}, _callee7, null, [[20, 39, 42, 45]]);
|
|
829
2941
|
}));
|
|
830
2942
|
return _buildTestPack.apply(this, arguments);
|
|
831
2943
|
}
|
|
832
|
-
|
|
833
2944
|
function checkTmpPath(_x15) {
|
|
834
2945
|
return _checkTmpPath.apply(this, arguments);
|
|
835
2946
|
}
|
|
@@ -841,437 +2952,339 @@ function checkTmpPath(_x15) {
|
|
|
841
2952
|
* @param root0.projectPaths
|
|
842
2953
|
* @param root0.tmpPath
|
|
843
2954
|
*/
|
|
844
|
-
|
|
845
|
-
|
|
846
2955
|
function _checkTmpPath() {
|
|
847
2956
|
_checkTmpPath = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8(data) {
|
|
848
2957
|
var tmpDir;
|
|
849
2958
|
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context14) {
|
|
850
|
-
while (1) {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
_context14.
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
throw new Error("The tmp dir (\"".concat(tmpDir, "\") is not empty."));
|
|
866
|
-
|
|
867
|
-
case 6:
|
|
868
|
-
case "end":
|
|
869
|
-
return _context14.stop();
|
|
870
|
-
}
|
|
2959
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2960
|
+
case 0:
|
|
2961
|
+
tmpDir = data.tmpRootResolve();
|
|
2962
|
+
_context14.next = 3;
|
|
2963
|
+
return lib.readdir(tmpDir);
|
|
2964
|
+
case 3:
|
|
2965
|
+
_context14.t0 = _context14.sent.length;
|
|
2966
|
+
if (!(_context14.t0 !== 0)) {
|
|
2967
|
+
_context14.next = 6;
|
|
2968
|
+
break;
|
|
2969
|
+
}
|
|
2970
|
+
throw new Error("The tmp dir (\"".concat(tmpDir, "\") is not empty."));
|
|
2971
|
+
case 6:
|
|
2972
|
+
case "end":
|
|
2973
|
+
return _context14.stop();
|
|
871
2974
|
}
|
|
872
2975
|
}, _callee8);
|
|
873
2976
|
}));
|
|
874
2977
|
return _checkTmpPath.apply(this, arguments);
|
|
875
2978
|
}
|
|
876
|
-
|
|
877
2979
|
function test(_x16) {
|
|
878
2980
|
return _test.apply(this, arguments);
|
|
879
2981
|
}
|
|
880
|
-
|
|
881
2982
|
function _test() {
|
|
882
2983
|
_test = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11(_ref2) {
|
|
883
2984
|
var _context18;
|
|
884
|
-
|
|
885
2985
|
var failCommand, logsToStdout, packageScripts, projectPaths, tmpPath, data, projectStatuses, getStages, _context21, _context22, _context26, _context27, spawn, allSucceeded, _iterator3, _step3, _step3$value, projectName, promise, _context28, _context29, _context30, _context31;
|
|
886
|
-
|
|
887
2986
|
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context32) {
|
|
888
|
-
while (1) {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
2987
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2988
|
+
case 0:
|
|
2989
|
+
getStages = function _getStages() {
|
|
2990
|
+
var _context19;
|
|
2991
|
+
return _mapInstanceProperty__default["default"](_context19 = _toConsumableArray__default["default"](projectStatuses)).call(_context19, function (_ref3) {
|
|
2992
|
+
var _context20;
|
|
2993
|
+
var _ref4 = _slicedToArray__default["default"](_ref3, 2),
|
|
2994
|
+
key = _ref4[0],
|
|
2995
|
+
stage = _ref4[1].stage;
|
|
2996
|
+
return _concatInstanceProperty__default["default"](_context20 = " ".concat(key, ": ")).call(_context20, stage);
|
|
2997
|
+
});
|
|
2998
|
+
};
|
|
2999
|
+
failCommand = _ref2.failCommand, logsToStdout = _ref2.logsToStdout, packageScripts = _ref2.packageScripts, projectPaths = _ref2.projectPaths, tmpPath = _ref2.tmpPath;
|
|
3000
|
+
if (!(process.env.VIS_INTEROP === "1")) {
|
|
3001
|
+
_context32.next = 5;
|
|
3002
|
+
break;
|
|
3003
|
+
}
|
|
3004
|
+
// This would result in infinite loop otherwise.
|
|
3005
|
+
logInfo("Skipping interop test.");
|
|
3006
|
+
return _context32.abrupt("return", true);
|
|
3007
|
+
case 5:
|
|
3008
|
+
_context32.t0 = _Object$freeze__default["default"];
|
|
3009
|
+
_context32.t1 = failCommand;
|
|
3010
|
+
_context32.t2 = packageScripts;
|
|
3011
|
+
_context32.t3 = projectPaths;
|
|
3012
|
+
_context32.next = 11;
|
|
3013
|
+
return prepareTmpDir(tmpPath ? require$$1.resolve(tmpPath, "repos") : undefined);
|
|
3014
|
+
case 11:
|
|
3015
|
+
_context32.t4 = _context32.sent;
|
|
3016
|
+
_context32.t5 = function tmpLogsResolve() {
|
|
3017
|
+
var _context15;
|
|
3018
|
+
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3019
|
+
paths[_key] = arguments[_key];
|
|
910
3020
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
return fsExtra.mkdir(path.resolve(data.tmpDir.name, dir));
|
|
985
|
-
}));
|
|
986
|
-
|
|
987
|
-
case 25:
|
|
988
|
-
logInfo("Begin", getStages().join("\n"));
|
|
989
|
-
_context32.next = 28;
|
|
990
|
-
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](_context22 = _toConsumableArray__default["default"](projectStatuses)).call(_context22, /*#__PURE__*/function () {
|
|
991
|
-
var _ref6 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(_ref5) {
|
|
992
|
-
var _ref7, projectName, state, projectPath, stats, failedDeps, localDeps, _iterator2, _step2, localDep, depStatus, _context24;
|
|
993
|
-
|
|
994
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context25) {
|
|
995
|
-
while (1) {
|
|
996
|
-
switch (_context25.prev = _context25.next) {
|
|
997
|
-
case 0:
|
|
998
|
-
_ref7 = _slicedToArray__default["default"](_ref5, 2), projectName = _ref7[0], state = _ref7[1];
|
|
999
|
-
_context25.prev = 1;
|
|
1000
|
-
state.stage = "preparing";
|
|
1001
|
-
projectPath = data.projectPaths[projectName];
|
|
1002
|
-
_context25.next = 6;
|
|
1003
|
-
return _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9() {
|
|
1004
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context23) {
|
|
1005
|
-
while (1) {
|
|
1006
|
-
switch (_context23.prev = _context23.next) {
|
|
1007
|
-
case 0:
|
|
1008
|
-
_context23.prev = 0;
|
|
1009
|
-
_context23.next = 3;
|
|
1010
|
-
return fsExtra.lstat(projectPath);
|
|
1011
|
-
|
|
1012
|
-
case 3:
|
|
1013
|
-
return _context23.abrupt("return", _context23.sent);
|
|
1014
|
-
|
|
1015
|
-
case 6:
|
|
1016
|
-
_context23.prev = 6;
|
|
1017
|
-
_context23.t0 = _context23["catch"](0);
|
|
1018
|
-
return _context23.abrupt("return", null);
|
|
1019
|
-
|
|
1020
|
-
case 9:
|
|
1021
|
-
case "end":
|
|
1022
|
-
return _context23.stop();
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
}, _callee9, null, [[0, 6]]);
|
|
1026
|
-
}))();
|
|
1027
|
-
|
|
1028
|
-
case 6:
|
|
1029
|
-
stats = _context25.sent;
|
|
1030
|
-
|
|
1031
|
-
if (!(stats !== null && stats !== void 0 && stats.isFile())) {
|
|
1032
|
-
_context25.next = 14;
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
// The path points to a ready to install tarball.
|
|
1037
|
-
state.stage = "copying tarball";
|
|
1038
|
-
_context25.next = 11;
|
|
1039
|
-
return fsExtra.copyFile(projectPath, getTarballPath(data, projectName));
|
|
1040
|
-
|
|
1041
|
-
case 11:
|
|
1042
|
-
state.stage = "tarball copied";
|
|
1043
|
-
_context25.next = 56;
|
|
1044
|
-
break;
|
|
1045
|
-
|
|
1046
|
-
case 14:
|
|
1047
|
-
// The path points to a repo (maybe remote) that has to be built,
|
|
1048
|
-
// tested and packed first.
|
|
1049
|
-
state.stage = "cloning";
|
|
1050
|
-
_context25.next = 17;
|
|
1051
|
-
return clone(spawn, data, projectName);
|
|
1052
|
-
|
|
1053
|
-
case 17:
|
|
1054
|
-
state.stage = "gathering dependencies";
|
|
1055
|
-
failedDeps = [];
|
|
1056
|
-
_context25.next = 21;
|
|
1057
|
-
return getPackageLocalDeps(data, projectName);
|
|
1058
|
-
|
|
1059
|
-
case 21:
|
|
1060
|
-
localDeps = _context25.sent;
|
|
1061
|
-
state.stage = "waiting for dependencies (".concat(localDeps.join(", "), ")");
|
|
1062
|
-
_iterator2 = _createForOfIteratorHelper$1(localDeps);
|
|
1063
|
-
_context25.prev = 24;
|
|
1064
|
-
|
|
1065
|
-
_iterator2.s();
|
|
1066
|
-
|
|
1067
|
-
case 26:
|
|
1068
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
1069
|
-
_context25.next = 41;
|
|
1070
|
-
break;
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
localDep = _step2.value;
|
|
1074
|
-
depStatus = projectStatuses.get(localDep);
|
|
1075
|
-
|
|
1076
|
-
if (!(depStatus == null)) {
|
|
1077
|
-
_context25.next = 31;
|
|
1078
|
-
break;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
throw new Error("Dependency ".concat(localDep, " not found."));
|
|
1082
|
-
|
|
1083
|
-
case 31:
|
|
1084
|
-
_context25.prev = 31;
|
|
1085
|
-
_context25.next = 34;
|
|
1086
|
-
return depStatus.promise;
|
|
1087
|
-
|
|
1088
|
-
case 34:
|
|
1089
|
-
_context25.next = 39;
|
|
1090
|
-
break;
|
|
1091
|
-
|
|
1092
|
-
case 36:
|
|
1093
|
-
_context25.prev = 36;
|
|
1094
|
-
_context25.t0 = _context25["catch"](31);
|
|
1095
|
-
failedDeps.push(localDep);
|
|
1096
|
-
|
|
1097
|
-
case 39:
|
|
1098
|
-
_context25.next = 26;
|
|
1099
|
-
break;
|
|
1100
|
-
|
|
1101
|
-
case 41:
|
|
1102
|
-
_context25.next = 46;
|
|
1103
|
-
break;
|
|
1104
|
-
|
|
1105
|
-
case 43:
|
|
1106
|
-
_context25.prev = 43;
|
|
1107
|
-
_context25.t1 = _context25["catch"](24);
|
|
1108
|
-
|
|
1109
|
-
_iterator2.e(_context25.t1);
|
|
1110
|
-
|
|
1111
|
-
case 46:
|
|
1112
|
-
_context25.prev = 46;
|
|
1113
|
-
|
|
1114
|
-
_iterator2.f();
|
|
1115
|
-
|
|
1116
|
-
return _context25.finish(46);
|
|
1117
|
-
|
|
1118
|
-
case 49:
|
|
1119
|
-
if (!(failedDeps.length > 0)) {
|
|
1120
|
-
_context25.next = 52;
|
|
1121
|
-
break;
|
|
3021
|
+
return require$$1.resolve.apply(void 0, _concatInstanceProperty__default["default"](_context15 = [data.tmpDir.name, "logs"]).call(_context15, paths));
|
|
3022
|
+
};
|
|
3023
|
+
_context32.t6 = function tmpReposResolve() {
|
|
3024
|
+
var _context16;
|
|
3025
|
+
for (var _len2 = arguments.length, paths = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
3026
|
+
paths[_key2] = arguments[_key2];
|
|
3027
|
+
}
|
|
3028
|
+
return require$$1.resolve.apply(void 0, _concatInstanceProperty__default["default"](_context16 = [data.tmpDir.name, "repos"]).call(_context16, paths));
|
|
3029
|
+
};
|
|
3030
|
+
_context32.t7 = function tmpRootResolve() {
|
|
3031
|
+
var _context17;
|
|
3032
|
+
for (var _len3 = arguments.length, paths = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
3033
|
+
paths[_key3] = arguments[_key3];
|
|
3034
|
+
}
|
|
3035
|
+
return require$$1.resolve.apply(void 0, _concatInstanceProperty__default["default"](_context17 = [data.tmpDir.name]).call(_context17, paths));
|
|
3036
|
+
};
|
|
3037
|
+
_context32.t8 = process.cwd();
|
|
3038
|
+
_context32.t9 = {
|
|
3039
|
+
failCommand: _context32.t1,
|
|
3040
|
+
packageScripts: _context32.t2,
|
|
3041
|
+
projectPaths: _context32.t3,
|
|
3042
|
+
tmpDir: _context32.t4,
|
|
3043
|
+
tmpLogsResolve: _context32.t5,
|
|
3044
|
+
tmpReposResolve: _context32.t6,
|
|
3045
|
+
tmpRootResolve: _context32.t7,
|
|
3046
|
+
visDevUtilsPath: _context32.t8
|
|
3047
|
+
};
|
|
3048
|
+
data = (0, _context32.t0)(_context32.t9);
|
|
3049
|
+
projectStatuses = new _Map__default["default"](_mapInstanceProperty__default["default"](_context18 = _Object$keys__default["default"](data.projectPaths)).call(_context18, function (project) {
|
|
3050
|
+
return [project, new ProjectState()];
|
|
3051
|
+
}));
|
|
3052
|
+
/**
|
|
3053
|
+
*
|
|
3054
|
+
*/
|
|
3055
|
+
_context32.prev = 19;
|
|
3056
|
+
spawn = createSpawner(data.tmpLogsResolve(), getStages);
|
|
3057
|
+
_context32.next = 23;
|
|
3058
|
+
return checkTmpPath(data);
|
|
3059
|
+
case 23:
|
|
3060
|
+
_context32.next = 25;
|
|
3061
|
+
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](_context21 = ["repos", "logs"]).call(_context21, function (dir) {
|
|
3062
|
+
return lib.mkdir(require$$1.resolve(data.tmpDir.name, dir));
|
|
3063
|
+
}));
|
|
3064
|
+
case 25:
|
|
3065
|
+
logInfo("Begin", getStages().join("\n"));
|
|
3066
|
+
_context32.next = 28;
|
|
3067
|
+
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](_context22 = _toConsumableArray__default["default"](projectStatuses)).call(_context22, /*#__PURE__*/function () {
|
|
3068
|
+
var _ref6 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(_ref5) {
|
|
3069
|
+
var _ref7, projectName, state, projectPath, stats, failedDeps, localDeps, _iterator2, _step2, localDep, depStatus, _context24;
|
|
3070
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context25) {
|
|
3071
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
3072
|
+
case 0:
|
|
3073
|
+
_ref7 = _slicedToArray__default["default"](_ref5, 2), projectName = _ref7[0], state = _ref7[1];
|
|
3074
|
+
_context25.prev = 1;
|
|
3075
|
+
state.stage = "preparing";
|
|
3076
|
+
projectPath = data.projectPaths[projectName];
|
|
3077
|
+
_context25.next = 6;
|
|
3078
|
+
return _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9() {
|
|
3079
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context23) {
|
|
3080
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
3081
|
+
case 0:
|
|
3082
|
+
_context23.prev = 0;
|
|
3083
|
+
_context23.next = 3;
|
|
3084
|
+
return lib.lstat(projectPath);
|
|
3085
|
+
case 3:
|
|
3086
|
+
return _context23.abrupt("return", _context23.sent);
|
|
3087
|
+
case 6:
|
|
3088
|
+
_context23.prev = 6;
|
|
3089
|
+
_context23.t0 = _context23["catch"](0);
|
|
3090
|
+
return _context23.abrupt("return", null);
|
|
3091
|
+
case 9:
|
|
3092
|
+
case "end":
|
|
3093
|
+
return _context23.stop();
|
|
1122
3094
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
3095
|
+
}, _callee9, null, [[0, 6]]);
|
|
3096
|
+
}))();
|
|
3097
|
+
case 6:
|
|
3098
|
+
stats = _context25.sent;
|
|
3099
|
+
if (!(stats !== null && stats !== void 0 && stats.isFile())) {
|
|
3100
|
+
_context25.next = 14;
|
|
3101
|
+
break;
|
|
3102
|
+
}
|
|
3103
|
+
// The path points to a ready to install tarball.
|
|
3104
|
+
state.stage = "copying tarball";
|
|
3105
|
+
_context25.next = 11;
|
|
3106
|
+
return lib.copyFile(projectPath, getTarballPath(data, projectName));
|
|
3107
|
+
case 11:
|
|
3108
|
+
state.stage = "tarball copied";
|
|
3109
|
+
_context25.next = 56;
|
|
3110
|
+
break;
|
|
3111
|
+
case 14:
|
|
3112
|
+
// The path points to a repo (maybe remote) that has to be built,
|
|
3113
|
+
// tested and packed first.
|
|
3114
|
+
state.stage = "cloning";
|
|
3115
|
+
_context25.next = 17;
|
|
3116
|
+
return clone(spawn, data, projectName);
|
|
3117
|
+
case 17:
|
|
3118
|
+
state.stage = "gathering dependencies";
|
|
3119
|
+
failedDeps = [];
|
|
3120
|
+
_context25.next = 21;
|
|
3121
|
+
return getPackageLocalDeps(data, projectName);
|
|
3122
|
+
case 21:
|
|
3123
|
+
localDeps = _context25.sent;
|
|
3124
|
+
state.stage = "waiting for dependencies (".concat(localDeps.join(", "), ")");
|
|
3125
|
+
_iterator2 = _createForOfIteratorHelper$1(localDeps);
|
|
3126
|
+
_context25.prev = 24;
|
|
3127
|
+
_iterator2.s();
|
|
3128
|
+
case 26:
|
|
3129
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
3130
|
+
_context25.next = 41;
|
|
3131
|
+
break;
|
|
3132
|
+
}
|
|
3133
|
+
localDep = _step2.value;
|
|
3134
|
+
depStatus = projectStatuses.get(localDep);
|
|
3135
|
+
if (!(depStatus == null)) {
|
|
3136
|
+
_context25.next = 31;
|
|
3137
|
+
break;
|
|
3138
|
+
}
|
|
3139
|
+
throw new Error("Dependency ".concat(localDep, " not found."));
|
|
3140
|
+
case 31:
|
|
3141
|
+
_context25.prev = 31;
|
|
3142
|
+
_context25.next = 34;
|
|
3143
|
+
return depStatus.promise;
|
|
3144
|
+
case 34:
|
|
3145
|
+
_context25.next = 39;
|
|
3146
|
+
break;
|
|
3147
|
+
case 36:
|
|
3148
|
+
_context25.prev = 36;
|
|
3149
|
+
_context25.t0 = _context25["catch"](31);
|
|
3150
|
+
failedDeps.push(localDep);
|
|
3151
|
+
case 39:
|
|
3152
|
+
_context25.next = 26;
|
|
3153
|
+
break;
|
|
3154
|
+
case 41:
|
|
3155
|
+
_context25.next = 46;
|
|
3156
|
+
break;
|
|
3157
|
+
case 43:
|
|
3158
|
+
_context25.prev = 43;
|
|
3159
|
+
_context25.t1 = _context25["catch"](24);
|
|
3160
|
+
_iterator2.e(_context25.t1);
|
|
3161
|
+
case 46:
|
|
3162
|
+
_context25.prev = 46;
|
|
3163
|
+
_iterator2.f();
|
|
3164
|
+
return _context25.finish(46);
|
|
3165
|
+
case 49:
|
|
3166
|
+
if (!(failedDeps.length > 0)) {
|
|
3167
|
+
_context25.next = 52;
|
|
3168
|
+
break;
|
|
1150
3169
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
3170
|
+
state.stage = "dependencies failed: ".concat(failedDeps.join(", "));
|
|
3171
|
+
throw new Error(state.stage);
|
|
3172
|
+
case 52:
|
|
3173
|
+
state.stage = "running CI tasks";
|
|
3174
|
+
_context25.next = 55;
|
|
3175
|
+
return buildTestPack(spawn, data, projectName);
|
|
3176
|
+
case 55:
|
|
3177
|
+
state.stage = "cloned, built, tested and packed";
|
|
3178
|
+
case 56:
|
|
3179
|
+
logInfo("Okay ".concat(projectName), getStages().join("\n"));
|
|
3180
|
+
state.resolve();
|
|
3181
|
+
_context25.next = 64;
|
|
3182
|
+
break;
|
|
3183
|
+
case 60:
|
|
3184
|
+
_context25.prev = 60;
|
|
3185
|
+
_context25.t2 = _context25["catch"](1);
|
|
3186
|
+
logError(_concatInstanceProperty__default["default"](_context24 = "Fail ".concat(projectName, " (")).call(_context24, state.stage, "):"), getStages().join("\n"));
|
|
3187
|
+
state.reject(_context25.t2 instanceof Error ? _context25.t2 : new Error("" + _context25.t2));
|
|
3188
|
+
case 64:
|
|
3189
|
+
case "end":
|
|
3190
|
+
return _context25.stop();
|
|
3191
|
+
}
|
|
3192
|
+
}, _callee10, null, [[1, 60], [24, 43, 46, 49], [31, 36]]);
|
|
1165
3193
|
}));
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
case 38:
|
|
1185
|
-
_context32.prev = 38;
|
|
1186
|
-
// Wait for all the projects to finish and log the state summary and any
|
|
1187
|
-
// errors encountered.
|
|
1188
|
-
logInfo("End", getStages().join("\n"));
|
|
1189
|
-
_iterator3 = _createForOfIteratorHelper$1(projectStatuses);
|
|
1190
|
-
_context32.prev = 41;
|
|
1191
|
-
|
|
1192
|
-
_iterator3.s();
|
|
1193
|
-
|
|
1194
|
-
case 43:
|
|
1195
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
1196
|
-
_context32.next = 55;
|
|
1197
|
-
break;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
_step3$value = _slicedToArray__default["default"](_step3.value, 2), projectName = _step3$value[0], promise = _step3$value[1].promise;
|
|
1201
|
-
_context32.prev = 45;
|
|
1202
|
-
_context32.next = 48;
|
|
1203
|
-
return promise;
|
|
1204
|
-
|
|
1205
|
-
case 48:
|
|
1206
|
-
_context32.next = 53;
|
|
3194
|
+
return function (_x17) {
|
|
3195
|
+
return _ref6.apply(this, arguments);
|
|
3196
|
+
};
|
|
3197
|
+
}()));
|
|
3198
|
+
case 28:
|
|
3199
|
+
_context32.t10 = _everyInstanceProperty__default["default"];
|
|
3200
|
+
_context32.next = 31;
|
|
3201
|
+
return _Promise__default["default"].allSettled(_mapInstanceProperty__default["default"](_context27 = _toConsumableArray__default["default"](_valuesInstanceProperty__default["default"](projectStatuses).call(projectStatuses))).call(_context27, function (status) {
|
|
3202
|
+
return status.promise;
|
|
3203
|
+
}));
|
|
3204
|
+
case 31:
|
|
3205
|
+
_context32.t11 = _context26 = _context32.sent;
|
|
3206
|
+
allSucceeded = (0, _context32.t10)(_context32.t11).call(_context26, function (_ref9) {
|
|
3207
|
+
var status = _ref9.status;
|
|
3208
|
+
return status === "fulfilled";
|
|
3209
|
+
});
|
|
3210
|
+
if (!allSucceeded) {
|
|
3211
|
+
_context32.next = 37;
|
|
1207
3212
|
break;
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
3213
|
+
}
|
|
3214
|
+
return _context32.abrupt("return", true);
|
|
3215
|
+
case 37:
|
|
3216
|
+
return _context32.abrupt("return", false);
|
|
3217
|
+
case 38:
|
|
3218
|
+
_context32.prev = 38;
|
|
3219
|
+
// Wait for all the projects to finish and log the state summary and any
|
|
3220
|
+
// errors encountered.
|
|
3221
|
+
logInfo("End", getStages().join("\n"));
|
|
3222
|
+
_iterator3 = _createForOfIteratorHelper$1(projectStatuses);
|
|
3223
|
+
_context32.prev = 41;
|
|
3224
|
+
_iterator3.s();
|
|
3225
|
+
case 43:
|
|
3226
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
3227
|
+
_context32.next = 55;
|
|
1216
3228
|
break;
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
3229
|
+
}
|
|
3230
|
+
_step3$value = _slicedToArray__default["default"](_step3.value, 2), projectName = _step3$value[0], promise = _step3$value[1].promise;
|
|
3231
|
+
_context32.prev = 45;
|
|
3232
|
+
_context32.next = 48;
|
|
3233
|
+
return promise;
|
|
3234
|
+
case 48:
|
|
3235
|
+
_context32.next = 53;
|
|
3236
|
+
break;
|
|
3237
|
+
case 50:
|
|
3238
|
+
_context32.prev = 50;
|
|
3239
|
+
_context32.t12 = _context32["catch"](45);
|
|
3240
|
+
logError("".concat(projectName, " failed with"), _context32.t12);
|
|
3241
|
+
case 53:
|
|
3242
|
+
_context32.next = 43;
|
|
3243
|
+
break;
|
|
3244
|
+
case 55:
|
|
3245
|
+
_context32.next = 60;
|
|
3246
|
+
break;
|
|
3247
|
+
case 57:
|
|
3248
|
+
_context32.prev = 57;
|
|
3249
|
+
_context32.t13 = _context32["catch"](41);
|
|
3250
|
+
_iterator3.e(_context32.t13);
|
|
3251
|
+
case 60:
|
|
3252
|
+
_context32.prev = 60;
|
|
3253
|
+
_iterator3.f();
|
|
3254
|
+
return _context32.finish(60);
|
|
3255
|
+
case 63:
|
|
3256
|
+
if (!logsToStdout) {
|
|
3257
|
+
_context32.next = 82;
|
|
1220
3258
|
break;
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
case 73:
|
|
1252
|
-
_context32.t20 = _context29 = _context32.sent;
|
|
1253
|
-
_context32.t21 = (0, _context32.t19)(_context32.t20).call(_context29, function (filename) {
|
|
1254
|
-
return fsExtra.readFile(data.tmpLogsResolve(filename), "UTF-8");
|
|
1255
|
-
});
|
|
1256
|
-
_context32.next = 77;
|
|
1257
|
-
return _context32.t18.all.call(_context32.t18, _context32.t21);
|
|
1258
|
-
|
|
1259
|
-
case 77:
|
|
1260
|
-
_context32.t22 = _context32.sent;
|
|
1261
|
-
_context32.t23 = (0, _context32.t17)(_context32.t22);
|
|
1262
|
-
_context32.t24 = [""];
|
|
1263
|
-
_context32.t25 = _context32.t15.call.call(_context32.t15, _context32.t16, _context32.t23, _context32.t24).join("\n\n" + _repeatInstanceProperty__default["default"](_context30 = _repeatInstanceProperty__default["default"](_context31 = "-").call(_context31, 80) + "\n").call(_context30, 2) + "\n");
|
|
1264
|
-
|
|
1265
|
-
_context32.t14.write.call(_context32.t14, _context32.t25);
|
|
1266
|
-
|
|
1267
|
-
case 82:
|
|
1268
|
-
execFail(data.tmpDir.name, failCommand, "Allow the state to be inspected in debug mode before the data is lost.");
|
|
1269
|
-
return _context32.finish(38);
|
|
1270
|
-
|
|
1271
|
-
case 84:
|
|
1272
|
-
case "end":
|
|
1273
|
-
return _context32.stop();
|
|
1274
|
-
}
|
|
3259
|
+
}
|
|
3260
|
+
logInfo("Outputs");
|
|
3261
|
+
_context32.t14 = process.stdout;
|
|
3262
|
+
_context32.t15 = _concatInstanceProperty__default["default"](_context28 = [""]);
|
|
3263
|
+
_context32.t16 = _context28;
|
|
3264
|
+
_context32.t17 = _toConsumableArray__default["default"];
|
|
3265
|
+
_context32.t18 = _Promise__default["default"];
|
|
3266
|
+
_context32.t19 = _mapInstanceProperty__default["default"];
|
|
3267
|
+
_context32.next = 73;
|
|
3268
|
+
return lib.readdir(data.tmpLogsResolve());
|
|
3269
|
+
case 73:
|
|
3270
|
+
_context32.t20 = _context29 = _context32.sent;
|
|
3271
|
+
_context32.t21 = (0, _context32.t19)(_context32.t20).call(_context29, function (filename) {
|
|
3272
|
+
return lib.readFile(data.tmpLogsResolve(filename), "UTF-8");
|
|
3273
|
+
});
|
|
3274
|
+
_context32.next = 77;
|
|
3275
|
+
return _context32.t18.all.call(_context32.t18, _context32.t21);
|
|
3276
|
+
case 77:
|
|
3277
|
+
_context32.t22 = _context32.sent;
|
|
3278
|
+
_context32.t23 = (0, _context32.t17)(_context32.t22);
|
|
3279
|
+
_context32.t24 = [""];
|
|
3280
|
+
_context32.t25 = _context32.t15.call.call(_context32.t15, _context32.t16, _context32.t23, _context32.t24).join("\n\n" + _repeatInstanceProperty__default["default"](_context30 = _repeatInstanceProperty__default["default"](_context31 = "-").call(_context31, 80) + "\n").call(_context30, 2) + "\n");
|
|
3281
|
+
_context32.t14.write.call(_context32.t14, _context32.t25);
|
|
3282
|
+
case 82:
|
|
3283
|
+
execFail(data.tmpDir.name, failCommand, "Allow the state to be inspected in debug mode before the data is lost.");
|
|
3284
|
+
return _context32.finish(38);
|
|
3285
|
+
case 84:
|
|
3286
|
+
case "end":
|
|
3287
|
+
return _context32.stop();
|
|
1275
3288
|
}
|
|
1276
3289
|
}, _callee11, null, [[19,, 38, 84], [41, 57, 60, 63], [45, 50]]);
|
|
1277
3290
|
}));
|
|
@@ -1279,27 +3292,22 @@ function _test() {
|
|
|
1279
3292
|
}
|
|
1280
3293
|
|
|
1281
3294
|
var _context, _context2;
|
|
1282
|
-
|
|
1283
3295
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol__default["default"] !== "undefined" && _getIteratorMethod__default["default"](o) || o["@@iterator"]; if (!it) { if (_Array$isArray__default["default"](o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1284
|
-
|
|
1285
3296
|
function _unsupportedIterableToArray(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty__default["default"](_context3 = Object.prototype.toString.call(o)).call(_context3, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from__default["default"](o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1286
|
-
|
|
1287
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
3297
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1288
3298
|
var argv = parseArguments();
|
|
1289
|
-
|
|
1290
3299
|
var projectPaths = _reduceInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = argv["project"]).call(_context2, function (raw) {
|
|
1291
3300
|
var _raw$split = raw.split(" ", 2),
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
if (/^[a-zA-Z0-9]+:\/\//.test(path$1)) {
|
|
3301
|
+
_raw$split2 = _slicedToArray__default["default"](_raw$split, 2),
|
|
3302
|
+
name = _raw$split2[0],
|
|
3303
|
+
path = _raw$split2[1];
|
|
3304
|
+
if (typeof name === "string" && typeof path === "string") {
|
|
3305
|
+
if (/^[a-zA-Z0-9]+:\/\//.test(path)) {
|
|
1298
3306
|
// Remote URL, use as is.
|
|
1299
|
-
return [name, path
|
|
3307
|
+
return [name, path];
|
|
1300
3308
|
} else {
|
|
1301
3309
|
// Local path, resolve to prevent CWD issues.
|
|
1302
|
-
return [name,
|
|
3310
|
+
return [name, require$$1.resolve(path)];
|
|
1303
3311
|
}
|
|
1304
3312
|
} else {
|
|
1305
3313
|
console.error("--project-path should be in 'project-name ./path' format, got '".concat(raw, "'."));
|
|
@@ -1307,28 +3315,21 @@ var projectPaths = _reduceInstanceProperty__default["default"](_context = _mapIn
|
|
|
1307
3315
|
}
|
|
1308
3316
|
})).call(_context, function (acc, _ref) {
|
|
1309
3317
|
var _ref2 = _slicedToArray__default["default"](_ref, 2),
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
3318
|
+
name = _ref2[0],
|
|
3319
|
+
path = _ref2[1];
|
|
1313
3320
|
acc[name] = path;
|
|
1314
3321
|
return acc;
|
|
1315
3322
|
}, {});
|
|
1316
|
-
|
|
1317
3323
|
var rawPackageScriptArg = argv["package-script"];
|
|
1318
|
-
|
|
1319
3324
|
var packageScripts = _flatMapInstanceProperty__default["default"](rawPackageScriptArg).call(rawPackageScriptArg, function (raw) {
|
|
1320
3325
|
var packageScripts = [];
|
|
1321
3326
|
var packageName = null;
|
|
1322
|
-
|
|
1323
3327
|
var _iterator = _createForOfIteratorHelper(raw.split(" ")),
|
|
1324
|
-
|
|
1325
|
-
|
|
3328
|
+
_step;
|
|
1326
3329
|
try {
|
|
1327
3330
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1328
3331
|
var part = _step.value;
|
|
1329
|
-
|
|
1330
3332
|
var mode = _sliceInstanceProperty__default["default"](part).call(part, -1);
|
|
1331
|
-
|
|
1332
3333
|
if (mode === "?" || mode === "!") {
|
|
1333
3334
|
packageScripts.push({
|
|
1334
3335
|
packageName: packageName,
|
|
@@ -1344,11 +3345,9 @@ var packageScripts = _flatMapInstanceProperty__default["default"](rawPackageScri
|
|
|
1344
3345
|
} finally {
|
|
1345
3346
|
_iterator.f();
|
|
1346
3347
|
}
|
|
1347
|
-
|
|
1348
3348
|
return packageScripts;
|
|
1349
3349
|
});
|
|
1350
|
-
|
|
1351
|
-
var tmpPath = argv["tmp-dir"] ? path.resolve(argv["tmp-dir"]) : undefined;
|
|
3350
|
+
var tmpPath = argv["tmp-dir"] ? require$$1.resolve(argv["tmp-dir"]) : undefined;
|
|
1352
3351
|
var failCommand = argv["fail-command"];
|
|
1353
3352
|
var logsToStdout = argv["logs-to-stdout"];
|
|
1354
3353
|
test({
|