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