@create-node-app/core 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +121 -2649
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +98 -2651
- package/dist/index.js.map +1 -0
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -1,2620 +1,9 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
1
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
2
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
3
|
}) : x)(function(x) {
|
|
10
4
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
6
|
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
// ../../node_modules/universalify/index.js
|
|
34
|
-
var require_universalify = __commonJS({
|
|
35
|
-
"../../node_modules/universalify/index.js"(exports) {
|
|
36
|
-
"use strict";
|
|
37
|
-
exports.fromCallback = function(fn) {
|
|
38
|
-
return Object.defineProperty(function() {
|
|
39
|
-
if (typeof arguments[arguments.length - 1] === "function") fn.apply(this, arguments);
|
|
40
|
-
else {
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
arguments[arguments.length] = (err, res) => {
|
|
43
|
-
if (err) return reject(err);
|
|
44
|
-
resolve(res);
|
|
45
|
-
};
|
|
46
|
-
arguments.length++;
|
|
47
|
-
fn.apply(this, arguments);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}, "name", { value: fn.name });
|
|
51
|
-
};
|
|
52
|
-
exports.fromPromise = function(fn) {
|
|
53
|
-
return Object.defineProperty(function() {
|
|
54
|
-
const cb = arguments[arguments.length - 1];
|
|
55
|
-
if (typeof cb !== "function") return fn.apply(this, arguments);
|
|
56
|
-
else fn.apply(this, arguments).then((r) => cb(null, r), cb);
|
|
57
|
-
}, "name", { value: fn.name });
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// ../../node_modules/graceful-fs/polyfills.js
|
|
63
|
-
var require_polyfills = __commonJS({
|
|
64
|
-
"../../node_modules/graceful-fs/polyfills.js"(exports, module) {
|
|
65
|
-
"use strict";
|
|
66
|
-
var constants = __require("constants");
|
|
67
|
-
var origCwd = process.cwd;
|
|
68
|
-
var cwd = null;
|
|
69
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
70
|
-
process.cwd = function() {
|
|
71
|
-
if (!cwd)
|
|
72
|
-
cwd = origCwd.call(process);
|
|
73
|
-
return cwd;
|
|
74
|
-
};
|
|
75
|
-
try {
|
|
76
|
-
process.cwd();
|
|
77
|
-
} catch (er) {
|
|
78
|
-
}
|
|
79
|
-
if (typeof process.chdir === "function") {
|
|
80
|
-
chdir = process.chdir;
|
|
81
|
-
process.chdir = function(d) {
|
|
82
|
-
cwd = null;
|
|
83
|
-
chdir.call(process, d);
|
|
84
|
-
};
|
|
85
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
86
|
-
}
|
|
87
|
-
var chdir;
|
|
88
|
-
module.exports = patch;
|
|
89
|
-
function patch(fs5) {
|
|
90
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
91
|
-
patchLchmod(fs5);
|
|
92
|
-
}
|
|
93
|
-
if (!fs5.lutimes) {
|
|
94
|
-
patchLutimes(fs5);
|
|
95
|
-
}
|
|
96
|
-
fs5.chown = chownFix(fs5.chown);
|
|
97
|
-
fs5.fchown = chownFix(fs5.fchown);
|
|
98
|
-
fs5.lchown = chownFix(fs5.lchown);
|
|
99
|
-
fs5.chmod = chmodFix(fs5.chmod);
|
|
100
|
-
fs5.fchmod = chmodFix(fs5.fchmod);
|
|
101
|
-
fs5.lchmod = chmodFix(fs5.lchmod);
|
|
102
|
-
fs5.chownSync = chownFixSync(fs5.chownSync);
|
|
103
|
-
fs5.fchownSync = chownFixSync(fs5.fchownSync);
|
|
104
|
-
fs5.lchownSync = chownFixSync(fs5.lchownSync);
|
|
105
|
-
fs5.chmodSync = chmodFixSync(fs5.chmodSync);
|
|
106
|
-
fs5.fchmodSync = chmodFixSync(fs5.fchmodSync);
|
|
107
|
-
fs5.lchmodSync = chmodFixSync(fs5.lchmodSync);
|
|
108
|
-
fs5.stat = statFix(fs5.stat);
|
|
109
|
-
fs5.fstat = statFix(fs5.fstat);
|
|
110
|
-
fs5.lstat = statFix(fs5.lstat);
|
|
111
|
-
fs5.statSync = statFixSync(fs5.statSync);
|
|
112
|
-
fs5.fstatSync = statFixSync(fs5.fstatSync);
|
|
113
|
-
fs5.lstatSync = statFixSync(fs5.lstatSync);
|
|
114
|
-
if (fs5.chmod && !fs5.lchmod) {
|
|
115
|
-
fs5.lchmod = function(path4, mode, cb) {
|
|
116
|
-
if (cb) process.nextTick(cb);
|
|
117
|
-
};
|
|
118
|
-
fs5.lchmodSync = function() {
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (fs5.chown && !fs5.lchown) {
|
|
122
|
-
fs5.lchown = function(path4, uid, gid, cb) {
|
|
123
|
-
if (cb) process.nextTick(cb);
|
|
124
|
-
};
|
|
125
|
-
fs5.lchownSync = function() {
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
if (platform === "win32") {
|
|
129
|
-
fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : (function(fs$rename) {
|
|
130
|
-
function rename(from, to, cb) {
|
|
131
|
-
var start = Date.now();
|
|
132
|
-
var backoff = 0;
|
|
133
|
-
fs$rename(from, to, function CB(er) {
|
|
134
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
|
|
135
|
-
setTimeout(function() {
|
|
136
|
-
fs5.stat(to, function(stater, st) {
|
|
137
|
-
if (stater && stater.code === "ENOENT")
|
|
138
|
-
fs$rename(from, to, CB);
|
|
139
|
-
else
|
|
140
|
-
cb(er);
|
|
141
|
-
});
|
|
142
|
-
}, backoff);
|
|
143
|
-
if (backoff < 100)
|
|
144
|
-
backoff += 10;
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (cb) cb(er);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
151
|
-
return rename;
|
|
152
|
-
})(fs5.rename);
|
|
153
|
-
}
|
|
154
|
-
fs5.read = typeof fs5.read !== "function" ? fs5.read : (function(fs$read) {
|
|
155
|
-
function read(fd, buffer, offset, length, position, callback_) {
|
|
156
|
-
var callback;
|
|
157
|
-
if (callback_ && typeof callback_ === "function") {
|
|
158
|
-
var eagCounter = 0;
|
|
159
|
-
callback = function(er, _3, __) {
|
|
160
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
161
|
-
eagCounter++;
|
|
162
|
-
return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
|
|
163
|
-
}
|
|
164
|
-
callback_.apply(this, arguments);
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
|
|
168
|
-
}
|
|
169
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
170
|
-
return read;
|
|
171
|
-
})(fs5.read);
|
|
172
|
-
fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
173
|
-
return function(fd, buffer, offset, length, position) {
|
|
174
|
-
var eagCounter = 0;
|
|
175
|
-
while (true) {
|
|
176
|
-
try {
|
|
177
|
-
return fs$readSync.call(fs5, fd, buffer, offset, length, position);
|
|
178
|
-
} catch (er) {
|
|
179
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
180
|
-
eagCounter++;
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
throw er;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
})(fs5.readSync);
|
|
188
|
-
function patchLchmod(fs6) {
|
|
189
|
-
fs6.lchmod = function(path4, mode, callback) {
|
|
190
|
-
fs6.open(
|
|
191
|
-
path4,
|
|
192
|
-
constants.O_WRONLY | constants.O_SYMLINK,
|
|
193
|
-
mode,
|
|
194
|
-
function(err, fd) {
|
|
195
|
-
if (err) {
|
|
196
|
-
if (callback) callback(err);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
fs6.fchmod(fd, mode, function(err2) {
|
|
200
|
-
fs6.close(fd, function(err22) {
|
|
201
|
-
if (callback) callback(err2 || err22);
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
};
|
|
207
|
-
fs6.lchmodSync = function(path4, mode) {
|
|
208
|
-
var fd = fs6.openSync(path4, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
209
|
-
var threw = true;
|
|
210
|
-
var ret;
|
|
211
|
-
try {
|
|
212
|
-
ret = fs6.fchmodSync(fd, mode);
|
|
213
|
-
threw = false;
|
|
214
|
-
} finally {
|
|
215
|
-
if (threw) {
|
|
216
|
-
try {
|
|
217
|
-
fs6.closeSync(fd);
|
|
218
|
-
} catch (er) {
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
fs6.closeSync(fd);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return ret;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function patchLutimes(fs6) {
|
|
228
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs6.futimes) {
|
|
229
|
-
fs6.lutimes = function(path4, at, mt, cb) {
|
|
230
|
-
fs6.open(path4, constants.O_SYMLINK, function(er, fd) {
|
|
231
|
-
if (er) {
|
|
232
|
-
if (cb) cb(er);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
fs6.futimes(fd, at, mt, function(er2) {
|
|
236
|
-
fs6.close(fd, function(er22) {
|
|
237
|
-
if (cb) cb(er2 || er22);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
fs6.lutimesSync = function(path4, at, mt) {
|
|
243
|
-
var fd = fs6.openSync(path4, constants.O_SYMLINK);
|
|
244
|
-
var ret;
|
|
245
|
-
var threw = true;
|
|
246
|
-
try {
|
|
247
|
-
ret = fs6.futimesSync(fd, at, mt);
|
|
248
|
-
threw = false;
|
|
249
|
-
} finally {
|
|
250
|
-
if (threw) {
|
|
251
|
-
try {
|
|
252
|
-
fs6.closeSync(fd);
|
|
253
|
-
} catch (er) {
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
fs6.closeSync(fd);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return ret;
|
|
260
|
-
};
|
|
261
|
-
} else if (fs6.futimes) {
|
|
262
|
-
fs6.lutimes = function(_a, _b, _c, cb) {
|
|
263
|
-
if (cb) process.nextTick(cb);
|
|
264
|
-
};
|
|
265
|
-
fs6.lutimesSync = function() {
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function chmodFix(orig) {
|
|
270
|
-
if (!orig) return orig;
|
|
271
|
-
return function(target, mode, cb) {
|
|
272
|
-
return orig.call(fs5, target, mode, function(er) {
|
|
273
|
-
if (chownErOk(er)) er = null;
|
|
274
|
-
if (cb) cb.apply(this, arguments);
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
function chmodFixSync(orig) {
|
|
279
|
-
if (!orig) return orig;
|
|
280
|
-
return function(target, mode) {
|
|
281
|
-
try {
|
|
282
|
-
return orig.call(fs5, target, mode);
|
|
283
|
-
} catch (er) {
|
|
284
|
-
if (!chownErOk(er)) throw er;
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function chownFix(orig) {
|
|
289
|
-
if (!orig) return orig;
|
|
290
|
-
return function(target, uid, gid, cb) {
|
|
291
|
-
return orig.call(fs5, target, uid, gid, function(er) {
|
|
292
|
-
if (chownErOk(er)) er = null;
|
|
293
|
-
if (cb) cb.apply(this, arguments);
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
function chownFixSync(orig) {
|
|
298
|
-
if (!orig) return orig;
|
|
299
|
-
return function(target, uid, gid) {
|
|
300
|
-
try {
|
|
301
|
-
return orig.call(fs5, target, uid, gid);
|
|
302
|
-
} catch (er) {
|
|
303
|
-
if (!chownErOk(er)) throw er;
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
function statFix(orig) {
|
|
308
|
-
if (!orig) return orig;
|
|
309
|
-
return function(target, options, cb) {
|
|
310
|
-
if (typeof options === "function") {
|
|
311
|
-
cb = options;
|
|
312
|
-
options = null;
|
|
313
|
-
}
|
|
314
|
-
function callback(er, stats) {
|
|
315
|
-
if (stats) {
|
|
316
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
317
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
318
|
-
}
|
|
319
|
-
if (cb) cb.apply(this, arguments);
|
|
320
|
-
}
|
|
321
|
-
return options ? orig.call(fs5, target, options, callback) : orig.call(fs5, target, callback);
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function statFixSync(orig) {
|
|
325
|
-
if (!orig) return orig;
|
|
326
|
-
return function(target, options) {
|
|
327
|
-
var stats = options ? orig.call(fs5, target, options) : orig.call(fs5, target);
|
|
328
|
-
if (stats) {
|
|
329
|
-
if (stats.uid < 0) stats.uid += 4294967296;
|
|
330
|
-
if (stats.gid < 0) stats.gid += 4294967296;
|
|
331
|
-
}
|
|
332
|
-
return stats;
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
function chownErOk(er) {
|
|
336
|
-
if (!er)
|
|
337
|
-
return true;
|
|
338
|
-
if (er.code === "ENOSYS")
|
|
339
|
-
return true;
|
|
340
|
-
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
341
|
-
if (nonroot) {
|
|
342
|
-
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
// ../../node_modules/graceful-fs/legacy-streams.js
|
|
352
|
-
var require_legacy_streams = __commonJS({
|
|
353
|
-
"../../node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
354
|
-
"use strict";
|
|
355
|
-
var Stream = __require("stream").Stream;
|
|
356
|
-
module.exports = legacy;
|
|
357
|
-
function legacy(fs5) {
|
|
358
|
-
return {
|
|
359
|
-
ReadStream,
|
|
360
|
-
WriteStream
|
|
361
|
-
};
|
|
362
|
-
function ReadStream(path4, options) {
|
|
363
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path4, options);
|
|
364
|
-
Stream.call(this);
|
|
365
|
-
var self = this;
|
|
366
|
-
this.path = path4;
|
|
367
|
-
this.fd = null;
|
|
368
|
-
this.readable = true;
|
|
369
|
-
this.paused = false;
|
|
370
|
-
this.flags = "r";
|
|
371
|
-
this.mode = 438;
|
|
372
|
-
this.bufferSize = 64 * 1024;
|
|
373
|
-
options = options || {};
|
|
374
|
-
var keys = Object.keys(options);
|
|
375
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
376
|
-
var key = keys[index];
|
|
377
|
-
this[key] = options[key];
|
|
378
|
-
}
|
|
379
|
-
if (this.encoding) this.setEncoding(this.encoding);
|
|
380
|
-
if (this.start !== void 0) {
|
|
381
|
-
if ("number" !== typeof this.start) {
|
|
382
|
-
throw TypeError("start must be a Number");
|
|
383
|
-
}
|
|
384
|
-
if (this.end === void 0) {
|
|
385
|
-
this.end = Infinity;
|
|
386
|
-
} else if ("number" !== typeof this.end) {
|
|
387
|
-
throw TypeError("end must be a Number");
|
|
388
|
-
}
|
|
389
|
-
if (this.start > this.end) {
|
|
390
|
-
throw new Error("start must be <= end");
|
|
391
|
-
}
|
|
392
|
-
this.pos = this.start;
|
|
393
|
-
}
|
|
394
|
-
if (this.fd !== null) {
|
|
395
|
-
process.nextTick(function() {
|
|
396
|
-
self._read();
|
|
397
|
-
});
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
fs5.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
401
|
-
if (err) {
|
|
402
|
-
self.emit("error", err);
|
|
403
|
-
self.readable = false;
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
self.fd = fd;
|
|
407
|
-
self.emit("open", fd);
|
|
408
|
-
self._read();
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
function WriteStream(path4, options) {
|
|
412
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path4, options);
|
|
413
|
-
Stream.call(this);
|
|
414
|
-
this.path = path4;
|
|
415
|
-
this.fd = null;
|
|
416
|
-
this.writable = true;
|
|
417
|
-
this.flags = "w";
|
|
418
|
-
this.encoding = "binary";
|
|
419
|
-
this.mode = 438;
|
|
420
|
-
this.bytesWritten = 0;
|
|
421
|
-
options = options || {};
|
|
422
|
-
var keys = Object.keys(options);
|
|
423
|
-
for (var index = 0, length = keys.length; index < length; index++) {
|
|
424
|
-
var key = keys[index];
|
|
425
|
-
this[key] = options[key];
|
|
426
|
-
}
|
|
427
|
-
if (this.start !== void 0) {
|
|
428
|
-
if ("number" !== typeof this.start) {
|
|
429
|
-
throw TypeError("start must be a Number");
|
|
430
|
-
}
|
|
431
|
-
if (this.start < 0) {
|
|
432
|
-
throw new Error("start must be >= zero");
|
|
433
|
-
}
|
|
434
|
-
this.pos = this.start;
|
|
435
|
-
}
|
|
436
|
-
this.busy = false;
|
|
437
|
-
this._queue = [];
|
|
438
|
-
if (this.fd === null) {
|
|
439
|
-
this._open = fs5.open;
|
|
440
|
-
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
441
|
-
this.flush();
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
// ../../node_modules/graceful-fs/clone.js
|
|
449
|
-
var require_clone = __commonJS({
|
|
450
|
-
"../../node_modules/graceful-fs/clone.js"(exports, module) {
|
|
451
|
-
"use strict";
|
|
452
|
-
module.exports = clone;
|
|
453
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
454
|
-
return obj.__proto__;
|
|
455
|
-
};
|
|
456
|
-
function clone(obj) {
|
|
457
|
-
if (obj === null || typeof obj !== "object")
|
|
458
|
-
return obj;
|
|
459
|
-
if (obj instanceof Object)
|
|
460
|
-
var copy2 = { __proto__: getPrototypeOf(obj) };
|
|
461
|
-
else
|
|
462
|
-
var copy2 = /* @__PURE__ */ Object.create(null);
|
|
463
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
464
|
-
Object.defineProperty(copy2, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
465
|
-
});
|
|
466
|
-
return copy2;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// ../../node_modules/graceful-fs/graceful-fs.js
|
|
472
|
-
var require_graceful_fs = __commonJS({
|
|
473
|
-
"../../node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
474
|
-
"use strict";
|
|
475
|
-
var fs5 = __require("fs");
|
|
476
|
-
var polyfills = require_polyfills();
|
|
477
|
-
var legacy = require_legacy_streams();
|
|
478
|
-
var clone = require_clone();
|
|
479
|
-
var util = __require("util");
|
|
480
|
-
var gracefulQueue;
|
|
481
|
-
var previousSymbol;
|
|
482
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
483
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
484
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
485
|
-
} else {
|
|
486
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
487
|
-
previousSymbol = "___graceful-fs.previous";
|
|
488
|
-
}
|
|
489
|
-
function noop() {
|
|
490
|
-
}
|
|
491
|
-
function publishQueue(context, queue2) {
|
|
492
|
-
Object.defineProperty(context, gracefulQueue, {
|
|
493
|
-
get: function() {
|
|
494
|
-
return queue2;
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
var debug2 = noop;
|
|
499
|
-
if (util.debuglog)
|
|
500
|
-
debug2 = util.debuglog("gfs4");
|
|
501
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
502
|
-
debug2 = function() {
|
|
503
|
-
var m = util.format.apply(util, arguments);
|
|
504
|
-
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
505
|
-
console.error(m);
|
|
506
|
-
};
|
|
507
|
-
if (!fs5[gracefulQueue]) {
|
|
508
|
-
queue = global[gracefulQueue] || [];
|
|
509
|
-
publishQueue(fs5, queue);
|
|
510
|
-
fs5.close = (function(fs$close) {
|
|
511
|
-
function close(fd, cb) {
|
|
512
|
-
return fs$close.call(fs5, fd, function(err) {
|
|
513
|
-
if (!err) {
|
|
514
|
-
resetQueue();
|
|
515
|
-
}
|
|
516
|
-
if (typeof cb === "function")
|
|
517
|
-
cb.apply(this, arguments);
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
Object.defineProperty(close, previousSymbol, {
|
|
521
|
-
value: fs$close
|
|
522
|
-
});
|
|
523
|
-
return close;
|
|
524
|
-
})(fs5.close);
|
|
525
|
-
fs5.closeSync = (function(fs$closeSync) {
|
|
526
|
-
function closeSync(fd) {
|
|
527
|
-
fs$closeSync.apply(fs5, arguments);
|
|
528
|
-
resetQueue();
|
|
529
|
-
}
|
|
530
|
-
Object.defineProperty(closeSync, previousSymbol, {
|
|
531
|
-
value: fs$closeSync
|
|
532
|
-
});
|
|
533
|
-
return closeSync;
|
|
534
|
-
})(fs5.closeSync);
|
|
535
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
536
|
-
process.on("exit", function() {
|
|
537
|
-
debug2(fs5[gracefulQueue]);
|
|
538
|
-
__require("assert").equal(fs5[gracefulQueue].length, 0);
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
var queue;
|
|
543
|
-
if (!global[gracefulQueue]) {
|
|
544
|
-
publishQueue(global, fs5[gracefulQueue]);
|
|
545
|
-
}
|
|
546
|
-
module.exports = patch(clone(fs5));
|
|
547
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs5.__patched) {
|
|
548
|
-
module.exports = patch(fs5);
|
|
549
|
-
fs5.__patched = true;
|
|
550
|
-
}
|
|
551
|
-
function patch(fs6) {
|
|
552
|
-
polyfills(fs6);
|
|
553
|
-
fs6.gracefulify = patch;
|
|
554
|
-
fs6.createReadStream = createReadStream;
|
|
555
|
-
fs6.createWriteStream = createWriteStream;
|
|
556
|
-
var fs$readFile = fs6.readFile;
|
|
557
|
-
fs6.readFile = readFile;
|
|
558
|
-
function readFile(path4, options, cb) {
|
|
559
|
-
if (typeof options === "function")
|
|
560
|
-
cb = options, options = null;
|
|
561
|
-
return go$readFile(path4, options, cb);
|
|
562
|
-
function go$readFile(path5, options2, cb2, startTime) {
|
|
563
|
-
return fs$readFile(path5, options2, function(err) {
|
|
564
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
565
|
-
enqueue([go$readFile, [path5, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
566
|
-
else {
|
|
567
|
-
if (typeof cb2 === "function")
|
|
568
|
-
cb2.apply(this, arguments);
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
var fs$writeFile = fs6.writeFile;
|
|
574
|
-
fs6.writeFile = writeFile;
|
|
575
|
-
function writeFile(path4, data, options, cb) {
|
|
576
|
-
if (typeof options === "function")
|
|
577
|
-
cb = options, options = null;
|
|
578
|
-
return go$writeFile(path4, data, options, cb);
|
|
579
|
-
function go$writeFile(path5, data2, options2, cb2, startTime) {
|
|
580
|
-
return fs$writeFile(path5, data2, options2, function(err) {
|
|
581
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
582
|
-
enqueue([go$writeFile, [path5, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
583
|
-
else {
|
|
584
|
-
if (typeof cb2 === "function")
|
|
585
|
-
cb2.apply(this, arguments);
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
var fs$appendFile = fs6.appendFile;
|
|
591
|
-
if (fs$appendFile)
|
|
592
|
-
fs6.appendFile = appendFile;
|
|
593
|
-
function appendFile(path4, data, options, cb) {
|
|
594
|
-
if (typeof options === "function")
|
|
595
|
-
cb = options, options = null;
|
|
596
|
-
return go$appendFile(path4, data, options, cb);
|
|
597
|
-
function go$appendFile(path5, data2, options2, cb2, startTime) {
|
|
598
|
-
return fs$appendFile(path5, data2, options2, function(err) {
|
|
599
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
600
|
-
enqueue([go$appendFile, [path5, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
601
|
-
else {
|
|
602
|
-
if (typeof cb2 === "function")
|
|
603
|
-
cb2.apply(this, arguments);
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
var fs$copyFile = fs6.copyFile;
|
|
609
|
-
if (fs$copyFile)
|
|
610
|
-
fs6.copyFile = copyFile;
|
|
611
|
-
function copyFile(src, dest, flags, cb) {
|
|
612
|
-
if (typeof flags === "function") {
|
|
613
|
-
cb = flags;
|
|
614
|
-
flags = 0;
|
|
615
|
-
}
|
|
616
|
-
return go$copyFile(src, dest, flags, cb);
|
|
617
|
-
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
618
|
-
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
619
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
620
|
-
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
621
|
-
else {
|
|
622
|
-
if (typeof cb2 === "function")
|
|
623
|
-
cb2.apply(this, arguments);
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
var fs$readdir = fs6.readdir;
|
|
629
|
-
fs6.readdir = readdir;
|
|
630
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
631
|
-
function readdir(path4, options, cb) {
|
|
632
|
-
if (typeof options === "function")
|
|
633
|
-
cb = options, options = null;
|
|
634
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path5, options2, cb2, startTime) {
|
|
635
|
-
return fs$readdir(path5, fs$readdirCallback(
|
|
636
|
-
path5,
|
|
637
|
-
options2,
|
|
638
|
-
cb2,
|
|
639
|
-
startTime
|
|
640
|
-
));
|
|
641
|
-
} : function go$readdir2(path5, options2, cb2, startTime) {
|
|
642
|
-
return fs$readdir(path5, options2, fs$readdirCallback(
|
|
643
|
-
path5,
|
|
644
|
-
options2,
|
|
645
|
-
cb2,
|
|
646
|
-
startTime
|
|
647
|
-
));
|
|
648
|
-
};
|
|
649
|
-
return go$readdir(path4, options, cb);
|
|
650
|
-
function fs$readdirCallback(path5, options2, cb2, startTime) {
|
|
651
|
-
return function(err, files) {
|
|
652
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
653
|
-
enqueue([
|
|
654
|
-
go$readdir,
|
|
655
|
-
[path5, options2, cb2],
|
|
656
|
-
err,
|
|
657
|
-
startTime || Date.now(),
|
|
658
|
-
Date.now()
|
|
659
|
-
]);
|
|
660
|
-
else {
|
|
661
|
-
if (files && files.sort)
|
|
662
|
-
files.sort();
|
|
663
|
-
if (typeof cb2 === "function")
|
|
664
|
-
cb2.call(this, err, files);
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
670
|
-
var legStreams = legacy(fs6);
|
|
671
|
-
ReadStream = legStreams.ReadStream;
|
|
672
|
-
WriteStream = legStreams.WriteStream;
|
|
673
|
-
}
|
|
674
|
-
var fs$ReadStream = fs6.ReadStream;
|
|
675
|
-
if (fs$ReadStream) {
|
|
676
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
677
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
678
|
-
}
|
|
679
|
-
var fs$WriteStream = fs6.WriteStream;
|
|
680
|
-
if (fs$WriteStream) {
|
|
681
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
682
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
683
|
-
}
|
|
684
|
-
Object.defineProperty(fs6, "ReadStream", {
|
|
685
|
-
get: function() {
|
|
686
|
-
return ReadStream;
|
|
687
|
-
},
|
|
688
|
-
set: function(val) {
|
|
689
|
-
ReadStream = val;
|
|
690
|
-
},
|
|
691
|
-
enumerable: true,
|
|
692
|
-
configurable: true
|
|
693
|
-
});
|
|
694
|
-
Object.defineProperty(fs6, "WriteStream", {
|
|
695
|
-
get: function() {
|
|
696
|
-
return WriteStream;
|
|
697
|
-
},
|
|
698
|
-
set: function(val) {
|
|
699
|
-
WriteStream = val;
|
|
700
|
-
},
|
|
701
|
-
enumerable: true,
|
|
702
|
-
configurable: true
|
|
703
|
-
});
|
|
704
|
-
var FileReadStream = ReadStream;
|
|
705
|
-
Object.defineProperty(fs6, "FileReadStream", {
|
|
706
|
-
get: function() {
|
|
707
|
-
return FileReadStream;
|
|
708
|
-
},
|
|
709
|
-
set: function(val) {
|
|
710
|
-
FileReadStream = val;
|
|
711
|
-
},
|
|
712
|
-
enumerable: true,
|
|
713
|
-
configurable: true
|
|
714
|
-
});
|
|
715
|
-
var FileWriteStream = WriteStream;
|
|
716
|
-
Object.defineProperty(fs6, "FileWriteStream", {
|
|
717
|
-
get: function() {
|
|
718
|
-
return FileWriteStream;
|
|
719
|
-
},
|
|
720
|
-
set: function(val) {
|
|
721
|
-
FileWriteStream = val;
|
|
722
|
-
},
|
|
723
|
-
enumerable: true,
|
|
724
|
-
configurable: true
|
|
725
|
-
});
|
|
726
|
-
function ReadStream(path4, options) {
|
|
727
|
-
if (this instanceof ReadStream)
|
|
728
|
-
return fs$ReadStream.apply(this, arguments), this;
|
|
729
|
-
else
|
|
730
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
731
|
-
}
|
|
732
|
-
function ReadStream$open() {
|
|
733
|
-
var that = this;
|
|
734
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
735
|
-
if (err) {
|
|
736
|
-
if (that.autoClose)
|
|
737
|
-
that.destroy();
|
|
738
|
-
that.emit("error", err);
|
|
739
|
-
} else {
|
|
740
|
-
that.fd = fd;
|
|
741
|
-
that.emit("open", fd);
|
|
742
|
-
that.read();
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
function WriteStream(path4, options) {
|
|
747
|
-
if (this instanceof WriteStream)
|
|
748
|
-
return fs$WriteStream.apply(this, arguments), this;
|
|
749
|
-
else
|
|
750
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
751
|
-
}
|
|
752
|
-
function WriteStream$open() {
|
|
753
|
-
var that = this;
|
|
754
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
755
|
-
if (err) {
|
|
756
|
-
that.destroy();
|
|
757
|
-
that.emit("error", err);
|
|
758
|
-
} else {
|
|
759
|
-
that.fd = fd;
|
|
760
|
-
that.emit("open", fd);
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
function createReadStream(path4, options) {
|
|
765
|
-
return new fs6.ReadStream(path4, options);
|
|
766
|
-
}
|
|
767
|
-
function createWriteStream(path4, options) {
|
|
768
|
-
return new fs6.WriteStream(path4, options);
|
|
769
|
-
}
|
|
770
|
-
var fs$open = fs6.open;
|
|
771
|
-
fs6.open = open;
|
|
772
|
-
function open(path4, flags, mode, cb) {
|
|
773
|
-
if (typeof mode === "function")
|
|
774
|
-
cb = mode, mode = null;
|
|
775
|
-
return go$open(path4, flags, mode, cb);
|
|
776
|
-
function go$open(path5, flags2, mode2, cb2, startTime) {
|
|
777
|
-
return fs$open(path5, flags2, mode2, function(err, fd) {
|
|
778
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
779
|
-
enqueue([go$open, [path5, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
780
|
-
else {
|
|
781
|
-
if (typeof cb2 === "function")
|
|
782
|
-
cb2.apply(this, arguments);
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
return fs6;
|
|
788
|
-
}
|
|
789
|
-
function enqueue(elem) {
|
|
790
|
-
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
791
|
-
fs5[gracefulQueue].push(elem);
|
|
792
|
-
retry();
|
|
793
|
-
}
|
|
794
|
-
var retryTimer;
|
|
795
|
-
function resetQueue() {
|
|
796
|
-
var now = Date.now();
|
|
797
|
-
for (var i = 0; i < fs5[gracefulQueue].length; ++i) {
|
|
798
|
-
if (fs5[gracefulQueue][i].length > 2) {
|
|
799
|
-
fs5[gracefulQueue][i][3] = now;
|
|
800
|
-
fs5[gracefulQueue][i][4] = now;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
retry();
|
|
804
|
-
}
|
|
805
|
-
function retry() {
|
|
806
|
-
clearTimeout(retryTimer);
|
|
807
|
-
retryTimer = void 0;
|
|
808
|
-
if (fs5[gracefulQueue].length === 0)
|
|
809
|
-
return;
|
|
810
|
-
var elem = fs5[gracefulQueue].shift();
|
|
811
|
-
var fn = elem[0];
|
|
812
|
-
var args = elem[1];
|
|
813
|
-
var err = elem[2];
|
|
814
|
-
var startTime = elem[3];
|
|
815
|
-
var lastTime = elem[4];
|
|
816
|
-
if (startTime === void 0) {
|
|
817
|
-
debug2("RETRY", fn.name, args);
|
|
818
|
-
fn.apply(null, args);
|
|
819
|
-
} else if (Date.now() - startTime >= 6e4) {
|
|
820
|
-
debug2("TIMEOUT", fn.name, args);
|
|
821
|
-
var cb = args.pop();
|
|
822
|
-
if (typeof cb === "function")
|
|
823
|
-
cb.call(null, err);
|
|
824
|
-
} else {
|
|
825
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
826
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
827
|
-
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
828
|
-
if (sinceAttempt >= desiredDelay) {
|
|
829
|
-
debug2("RETRY", fn.name, args);
|
|
830
|
-
fn.apply(null, args.concat([startTime]));
|
|
831
|
-
} else {
|
|
832
|
-
fs5[gracefulQueue].push(elem);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
if (retryTimer === void 0) {
|
|
836
|
-
retryTimer = setTimeout(retry, 0);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
// ../../node_modules/fs-extra/lib/fs/index.js
|
|
843
|
-
var require_fs = __commonJS({
|
|
844
|
-
"../../node_modules/fs-extra/lib/fs/index.js"(exports) {
|
|
845
|
-
"use strict";
|
|
846
|
-
var u = require_universalify().fromCallback;
|
|
847
|
-
var fs5 = require_graceful_fs();
|
|
848
|
-
var api = [
|
|
849
|
-
"access",
|
|
850
|
-
"appendFile",
|
|
851
|
-
"chmod",
|
|
852
|
-
"chown",
|
|
853
|
-
"close",
|
|
854
|
-
"copyFile",
|
|
855
|
-
"fchmod",
|
|
856
|
-
"fchown",
|
|
857
|
-
"fdatasync",
|
|
858
|
-
"fstat",
|
|
859
|
-
"fsync",
|
|
860
|
-
"ftruncate",
|
|
861
|
-
"futimes",
|
|
862
|
-
"lchown",
|
|
863
|
-
"lchmod",
|
|
864
|
-
"link",
|
|
865
|
-
"lstat",
|
|
866
|
-
"mkdir",
|
|
867
|
-
"mkdtemp",
|
|
868
|
-
"open",
|
|
869
|
-
"readFile",
|
|
870
|
-
"readdir",
|
|
871
|
-
"readlink",
|
|
872
|
-
"realpath",
|
|
873
|
-
"rename",
|
|
874
|
-
"rmdir",
|
|
875
|
-
"stat",
|
|
876
|
-
"symlink",
|
|
877
|
-
"truncate",
|
|
878
|
-
"unlink",
|
|
879
|
-
"utimes",
|
|
880
|
-
"writeFile"
|
|
881
|
-
].filter((key) => {
|
|
882
|
-
return typeof fs5[key] === "function";
|
|
883
|
-
});
|
|
884
|
-
Object.keys(fs5).forEach((key) => {
|
|
885
|
-
if (key === "promises") {
|
|
886
|
-
return;
|
|
887
|
-
}
|
|
888
|
-
exports[key] = fs5[key];
|
|
889
|
-
});
|
|
890
|
-
api.forEach((method) => {
|
|
891
|
-
exports[method] = u(fs5[method]);
|
|
892
|
-
});
|
|
893
|
-
exports.exists = function(filename, callback) {
|
|
894
|
-
if (typeof callback === "function") {
|
|
895
|
-
return fs5.exists(filename, callback);
|
|
896
|
-
}
|
|
897
|
-
return new Promise((resolve) => {
|
|
898
|
-
return fs5.exists(filename, resolve);
|
|
899
|
-
});
|
|
900
|
-
};
|
|
901
|
-
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
902
|
-
if (typeof callback === "function") {
|
|
903
|
-
return fs5.read(fd, buffer, offset, length, position, callback);
|
|
904
|
-
}
|
|
905
|
-
return new Promise((resolve, reject) => {
|
|
906
|
-
fs5.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
907
|
-
if (err) return reject(err);
|
|
908
|
-
resolve({ bytesRead, buffer: buffer2 });
|
|
909
|
-
});
|
|
910
|
-
});
|
|
911
|
-
};
|
|
912
|
-
exports.write = function(fd, buffer, ...args) {
|
|
913
|
-
if (typeof args[args.length - 1] === "function") {
|
|
914
|
-
return fs5.write(fd, buffer, ...args);
|
|
915
|
-
}
|
|
916
|
-
return new Promise((resolve, reject) => {
|
|
917
|
-
fs5.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
918
|
-
if (err) return reject(err);
|
|
919
|
-
resolve({ bytesWritten, buffer: buffer2 });
|
|
920
|
-
});
|
|
921
|
-
});
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
// ../../node_modules/fs-extra/lib/mkdirs/win32.js
|
|
927
|
-
var require_win32 = __commonJS({
|
|
928
|
-
"../../node_modules/fs-extra/lib/mkdirs/win32.js"(exports, module) {
|
|
929
|
-
"use strict";
|
|
930
|
-
var path4 = __require("path");
|
|
931
|
-
function getRootPath(p) {
|
|
932
|
-
p = path4.normalize(path4.resolve(p)).split(path4.sep);
|
|
933
|
-
if (p.length > 0) return p[0];
|
|
934
|
-
return null;
|
|
935
|
-
}
|
|
936
|
-
var INVALID_PATH_CHARS = /[<>:"|?*]/;
|
|
937
|
-
function invalidWin32Path(p) {
|
|
938
|
-
const rp = getRootPath(p);
|
|
939
|
-
p = p.replace(rp, "");
|
|
940
|
-
return INVALID_PATH_CHARS.test(p);
|
|
941
|
-
}
|
|
942
|
-
module.exports = {
|
|
943
|
-
getRootPath,
|
|
944
|
-
invalidWin32Path
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
});
|
|
948
|
-
|
|
949
|
-
// ../../node_modules/fs-extra/lib/mkdirs/mkdirs.js
|
|
950
|
-
var require_mkdirs = __commonJS({
|
|
951
|
-
"../../node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports, module) {
|
|
952
|
-
"use strict";
|
|
953
|
-
var fs5 = require_graceful_fs();
|
|
954
|
-
var path4 = __require("path");
|
|
955
|
-
var invalidWin32Path = require_win32().invalidWin32Path;
|
|
956
|
-
var o777 = parseInt("0777", 8);
|
|
957
|
-
function mkdirs(p, opts, callback, made) {
|
|
958
|
-
if (typeof opts === "function") {
|
|
959
|
-
callback = opts;
|
|
960
|
-
opts = {};
|
|
961
|
-
} else if (!opts || typeof opts !== "object") {
|
|
962
|
-
opts = { mode: opts };
|
|
963
|
-
}
|
|
964
|
-
if (process.platform === "win32" && invalidWin32Path(p)) {
|
|
965
|
-
const errInval = new Error(p + " contains invalid WIN32 path characters.");
|
|
966
|
-
errInval.code = "EINVAL";
|
|
967
|
-
return callback(errInval);
|
|
968
|
-
}
|
|
969
|
-
let mode = opts.mode;
|
|
970
|
-
const xfs = opts.fs || fs5;
|
|
971
|
-
if (mode === void 0) {
|
|
972
|
-
mode = o777 & ~process.umask();
|
|
973
|
-
}
|
|
974
|
-
if (!made) made = null;
|
|
975
|
-
callback = callback || function() {
|
|
976
|
-
};
|
|
977
|
-
p = path4.resolve(p);
|
|
978
|
-
xfs.mkdir(p, mode, (er) => {
|
|
979
|
-
if (!er) {
|
|
980
|
-
made = made || p;
|
|
981
|
-
return callback(null, made);
|
|
982
|
-
}
|
|
983
|
-
switch (er.code) {
|
|
984
|
-
case "ENOENT":
|
|
985
|
-
if (path4.dirname(p) === p) return callback(er);
|
|
986
|
-
mkdirs(path4.dirname(p), opts, (er2, made2) => {
|
|
987
|
-
if (er2) callback(er2, made2);
|
|
988
|
-
else mkdirs(p, opts, callback, made2);
|
|
989
|
-
});
|
|
990
|
-
break;
|
|
991
|
-
// In the case of any other error, just see if there's a dir
|
|
992
|
-
// there already. If so, then hooray! If not, then something
|
|
993
|
-
// is borked.
|
|
994
|
-
default:
|
|
995
|
-
xfs.stat(p, (er2, stat) => {
|
|
996
|
-
if (er2 || !stat.isDirectory()) callback(er, made);
|
|
997
|
-
else callback(null, made);
|
|
998
|
-
});
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
module.exports = mkdirs;
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1006
|
-
|
|
1007
|
-
// ../../node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js
|
|
1008
|
-
var require_mkdirs_sync = __commonJS({
|
|
1009
|
-
"../../node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports, module) {
|
|
1010
|
-
"use strict";
|
|
1011
|
-
var fs5 = require_graceful_fs();
|
|
1012
|
-
var path4 = __require("path");
|
|
1013
|
-
var invalidWin32Path = require_win32().invalidWin32Path;
|
|
1014
|
-
var o777 = parseInt("0777", 8);
|
|
1015
|
-
function mkdirsSync(p, opts, made) {
|
|
1016
|
-
if (!opts || typeof opts !== "object") {
|
|
1017
|
-
opts = { mode: opts };
|
|
1018
|
-
}
|
|
1019
|
-
let mode = opts.mode;
|
|
1020
|
-
const xfs = opts.fs || fs5;
|
|
1021
|
-
if (process.platform === "win32" && invalidWin32Path(p)) {
|
|
1022
|
-
const errInval = new Error(p + " contains invalid WIN32 path characters.");
|
|
1023
|
-
errInval.code = "EINVAL";
|
|
1024
|
-
throw errInval;
|
|
1025
|
-
}
|
|
1026
|
-
if (mode === void 0) {
|
|
1027
|
-
mode = o777 & ~process.umask();
|
|
1028
|
-
}
|
|
1029
|
-
if (!made) made = null;
|
|
1030
|
-
p = path4.resolve(p);
|
|
1031
|
-
try {
|
|
1032
|
-
xfs.mkdirSync(p, mode);
|
|
1033
|
-
made = made || p;
|
|
1034
|
-
} catch (err0) {
|
|
1035
|
-
if (err0.code === "ENOENT") {
|
|
1036
|
-
if (path4.dirname(p) === p) throw err0;
|
|
1037
|
-
made = mkdirsSync(path4.dirname(p), opts, made);
|
|
1038
|
-
mkdirsSync(p, opts, made);
|
|
1039
|
-
} else {
|
|
1040
|
-
let stat;
|
|
1041
|
-
try {
|
|
1042
|
-
stat = xfs.statSync(p);
|
|
1043
|
-
} catch (err1) {
|
|
1044
|
-
throw err0;
|
|
1045
|
-
}
|
|
1046
|
-
if (!stat.isDirectory()) throw err0;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
return made;
|
|
1050
|
-
}
|
|
1051
|
-
module.exports = mkdirsSync;
|
|
1052
|
-
}
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
|
-
// ../../node_modules/fs-extra/lib/mkdirs/index.js
|
|
1056
|
-
var require_mkdirs2 = __commonJS({
|
|
1057
|
-
"../../node_modules/fs-extra/lib/mkdirs/index.js"(exports, module) {
|
|
1058
|
-
"use strict";
|
|
1059
|
-
var u = require_universalify().fromCallback;
|
|
1060
|
-
var mkdirs = u(require_mkdirs());
|
|
1061
|
-
var mkdirsSync = require_mkdirs_sync();
|
|
1062
|
-
module.exports = {
|
|
1063
|
-
mkdirs,
|
|
1064
|
-
mkdirsSync,
|
|
1065
|
-
// alias
|
|
1066
|
-
mkdirp: mkdirs,
|
|
1067
|
-
mkdirpSync: mkdirsSync,
|
|
1068
|
-
ensureDir: mkdirs,
|
|
1069
|
-
ensureDirSync: mkdirsSync
|
|
1070
|
-
};
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
|
-
// ../../node_modules/fs-extra/lib/util/utimes.js
|
|
1075
|
-
var require_utimes = __commonJS({
|
|
1076
|
-
"../../node_modules/fs-extra/lib/util/utimes.js"(exports, module) {
|
|
1077
|
-
"use strict";
|
|
1078
|
-
var fs5 = require_graceful_fs();
|
|
1079
|
-
var os4 = __require("os");
|
|
1080
|
-
var path4 = __require("path");
|
|
1081
|
-
function hasMillisResSync() {
|
|
1082
|
-
let tmpfile = path4.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2));
|
|
1083
|
-
tmpfile = path4.join(os4.tmpdir(), tmpfile);
|
|
1084
|
-
const d = /* @__PURE__ */ new Date(1435410243862);
|
|
1085
|
-
fs5.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
|
|
1086
|
-
const fd = fs5.openSync(tmpfile, "r+");
|
|
1087
|
-
fs5.futimesSync(fd, d, d);
|
|
1088
|
-
fs5.closeSync(fd);
|
|
1089
|
-
return fs5.statSync(tmpfile).mtime > 1435410243e3;
|
|
1090
|
-
}
|
|
1091
|
-
function hasMillisRes(callback) {
|
|
1092
|
-
let tmpfile = path4.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2));
|
|
1093
|
-
tmpfile = path4.join(os4.tmpdir(), tmpfile);
|
|
1094
|
-
const d = /* @__PURE__ */ new Date(1435410243862);
|
|
1095
|
-
fs5.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
|
|
1096
|
-
if (err) return callback(err);
|
|
1097
|
-
fs5.open(tmpfile, "r+", (err2, fd) => {
|
|
1098
|
-
if (err2) return callback(err2);
|
|
1099
|
-
fs5.futimes(fd, d, d, (err3) => {
|
|
1100
|
-
if (err3) return callback(err3);
|
|
1101
|
-
fs5.close(fd, (err4) => {
|
|
1102
|
-
if (err4) return callback(err4);
|
|
1103
|
-
fs5.stat(tmpfile, (err5, stats) => {
|
|
1104
|
-
if (err5) return callback(err5);
|
|
1105
|
-
callback(null, stats.mtime > 1435410243e3);
|
|
1106
|
-
});
|
|
1107
|
-
});
|
|
1108
|
-
});
|
|
1109
|
-
});
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
function timeRemoveMillis(timestamp) {
|
|
1113
|
-
if (typeof timestamp === "number") {
|
|
1114
|
-
return Math.floor(timestamp / 1e3) * 1e3;
|
|
1115
|
-
} else if (timestamp instanceof Date) {
|
|
1116
|
-
return new Date(Math.floor(timestamp.getTime() / 1e3) * 1e3);
|
|
1117
|
-
} else {
|
|
1118
|
-
throw new Error("fs-extra: timeRemoveMillis() unknown parameter type");
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
function utimesMillis(path5, atime, mtime, callback) {
|
|
1122
|
-
fs5.open(path5, "r+", (err, fd) => {
|
|
1123
|
-
if (err) return callback(err);
|
|
1124
|
-
fs5.futimes(fd, atime, mtime, (futimesErr) => {
|
|
1125
|
-
fs5.close(fd, (closeErr) => {
|
|
1126
|
-
if (callback) callback(futimesErr || closeErr);
|
|
1127
|
-
});
|
|
1128
|
-
});
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
function utimesMillisSync(path5, atime, mtime) {
|
|
1132
|
-
const fd = fs5.openSync(path5, "r+");
|
|
1133
|
-
fs5.futimesSync(fd, atime, mtime);
|
|
1134
|
-
return fs5.closeSync(fd);
|
|
1135
|
-
}
|
|
1136
|
-
module.exports = {
|
|
1137
|
-
hasMillisRes,
|
|
1138
|
-
hasMillisResSync,
|
|
1139
|
-
timeRemoveMillis,
|
|
1140
|
-
utimesMillis,
|
|
1141
|
-
utimesMillisSync
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1144
|
-
});
|
|
1145
|
-
|
|
1146
|
-
// ../../node_modules/fs-extra/lib/util/buffer.js
|
|
1147
|
-
var require_buffer = __commonJS({
|
|
1148
|
-
"../../node_modules/fs-extra/lib/util/buffer.js"(exports, module) {
|
|
1149
|
-
"use strict";
|
|
1150
|
-
module.exports = function(size) {
|
|
1151
|
-
if (typeof Buffer.allocUnsafe === "function") {
|
|
1152
|
-
try {
|
|
1153
|
-
return Buffer.allocUnsafe(size);
|
|
1154
|
-
} catch (e) {
|
|
1155
|
-
return new Buffer(size);
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
return new Buffer(size);
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
});
|
|
1162
|
-
|
|
1163
|
-
// ../../node_modules/fs-extra/lib/copy-sync/copy-sync.js
|
|
1164
|
-
var require_copy_sync = __commonJS({
|
|
1165
|
-
"../../node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports, module) {
|
|
1166
|
-
"use strict";
|
|
1167
|
-
var fs5 = require_graceful_fs();
|
|
1168
|
-
var path4 = __require("path");
|
|
1169
|
-
var mkdirpSync = require_mkdirs2().mkdirsSync;
|
|
1170
|
-
var utimesSync = require_utimes().utimesMillisSync;
|
|
1171
|
-
var notExist = Symbol("notExist");
|
|
1172
|
-
function copySync(src, dest, opts) {
|
|
1173
|
-
if (typeof opts === "function") {
|
|
1174
|
-
opts = { filter: opts };
|
|
1175
|
-
}
|
|
1176
|
-
opts = opts || {};
|
|
1177
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1178
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1179
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1180
|
-
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
1181
|
-
|
|
1182
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`);
|
|
1183
|
-
}
|
|
1184
|
-
const destStat = checkPaths(src, dest);
|
|
1185
|
-
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1186
|
-
const destParent = path4.dirname(dest);
|
|
1187
|
-
if (!fs5.existsSync(destParent)) mkdirpSync(destParent);
|
|
1188
|
-
return startCopy(destStat, src, dest, opts);
|
|
1189
|
-
}
|
|
1190
|
-
function startCopy(destStat, src, dest, opts) {
|
|
1191
|
-
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1192
|
-
return getStats(destStat, src, dest, opts);
|
|
1193
|
-
}
|
|
1194
|
-
function getStats(destStat, src, dest, opts) {
|
|
1195
|
-
const statSync = opts.dereference ? fs5.statSync : fs5.lstatSync;
|
|
1196
|
-
const srcStat = statSync(src);
|
|
1197
|
-
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1198
|
-
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1199
|
-
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1200
|
-
}
|
|
1201
|
-
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1202
|
-
if (destStat === notExist) return copyFile(srcStat, src, dest, opts);
|
|
1203
|
-
return mayCopyFile(srcStat, src, dest, opts);
|
|
1204
|
-
}
|
|
1205
|
-
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1206
|
-
if (opts.overwrite) {
|
|
1207
|
-
fs5.unlinkSync(dest);
|
|
1208
|
-
return copyFile(srcStat, src, dest, opts);
|
|
1209
|
-
} else if (opts.errorOnExist) {
|
|
1210
|
-
throw new Error(`'${dest}' already exists`);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
function copyFile(srcStat, src, dest, opts) {
|
|
1214
|
-
if (typeof fs5.copyFileSync === "function") {
|
|
1215
|
-
fs5.copyFileSync(src, dest);
|
|
1216
|
-
fs5.chmodSync(dest, srcStat.mode);
|
|
1217
|
-
if (opts.preserveTimestamps) {
|
|
1218
|
-
return utimesSync(dest, srcStat.atime, srcStat.mtime);
|
|
1219
|
-
}
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
return copyFileFallback(srcStat, src, dest, opts);
|
|
1223
|
-
}
|
|
1224
|
-
function copyFileFallback(srcStat, src, dest, opts) {
|
|
1225
|
-
const BUF_LENGTH = 64 * 1024;
|
|
1226
|
-
const _buff = require_buffer()(BUF_LENGTH);
|
|
1227
|
-
const fdr = fs5.openSync(src, "r");
|
|
1228
|
-
const fdw = fs5.openSync(dest, "w", srcStat.mode);
|
|
1229
|
-
let pos = 0;
|
|
1230
|
-
while (pos < srcStat.size) {
|
|
1231
|
-
const bytesRead = fs5.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
|
|
1232
|
-
fs5.writeSync(fdw, _buff, 0, bytesRead);
|
|
1233
|
-
pos += bytesRead;
|
|
1234
|
-
}
|
|
1235
|
-
if (opts.preserveTimestamps) fs5.futimesSync(fdw, srcStat.atime, srcStat.mtime);
|
|
1236
|
-
fs5.closeSync(fdr);
|
|
1237
|
-
fs5.closeSync(fdw);
|
|
1238
|
-
}
|
|
1239
|
-
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1240
|
-
if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts);
|
|
1241
|
-
if (destStat && !destStat.isDirectory()) {
|
|
1242
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1243
|
-
}
|
|
1244
|
-
return copyDir(src, dest, opts);
|
|
1245
|
-
}
|
|
1246
|
-
function mkDirAndCopy(srcStat, src, dest, opts) {
|
|
1247
|
-
fs5.mkdirSync(dest);
|
|
1248
|
-
copyDir(src, dest, opts);
|
|
1249
|
-
return fs5.chmodSync(dest, srcStat.mode);
|
|
1250
|
-
}
|
|
1251
|
-
function copyDir(src, dest, opts) {
|
|
1252
|
-
fs5.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
|
|
1253
|
-
}
|
|
1254
|
-
function copyDirItem(item, src, dest, opts) {
|
|
1255
|
-
const srcItem = path4.join(src, item);
|
|
1256
|
-
const destItem = path4.join(dest, item);
|
|
1257
|
-
const destStat = checkPaths(srcItem, destItem);
|
|
1258
|
-
return startCopy(destStat, srcItem, destItem, opts);
|
|
1259
|
-
}
|
|
1260
|
-
function onLink(destStat, src, dest, opts) {
|
|
1261
|
-
let resolvedSrc = fs5.readlinkSync(src);
|
|
1262
|
-
if (opts.dereference) {
|
|
1263
|
-
resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
|
|
1264
|
-
}
|
|
1265
|
-
if (destStat === notExist) {
|
|
1266
|
-
return fs5.symlinkSync(resolvedSrc, dest);
|
|
1267
|
-
} else {
|
|
1268
|
-
let resolvedDest;
|
|
1269
|
-
try {
|
|
1270
|
-
resolvedDest = fs5.readlinkSync(dest);
|
|
1271
|
-
} catch (err) {
|
|
1272
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs5.symlinkSync(resolvedSrc, dest);
|
|
1273
|
-
throw err;
|
|
1274
|
-
}
|
|
1275
|
-
if (opts.dereference) {
|
|
1276
|
-
resolvedDest = path4.resolve(process.cwd(), resolvedDest);
|
|
1277
|
-
}
|
|
1278
|
-
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1279
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1280
|
-
}
|
|
1281
|
-
if (fs5.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1282
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1283
|
-
}
|
|
1284
|
-
return copyLink(resolvedSrc, dest);
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
function copyLink(resolvedSrc, dest) {
|
|
1288
|
-
fs5.unlinkSync(dest);
|
|
1289
|
-
return fs5.symlinkSync(resolvedSrc, dest);
|
|
1290
|
-
}
|
|
1291
|
-
function isSrcSubdir(src, dest) {
|
|
1292
|
-
const srcArray = path4.resolve(src).split(path4.sep);
|
|
1293
|
-
const destArray = path4.resolve(dest).split(path4.sep);
|
|
1294
|
-
return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
|
|
1295
|
-
}
|
|
1296
|
-
function checkStats(src, dest) {
|
|
1297
|
-
const srcStat = fs5.statSync(src);
|
|
1298
|
-
let destStat;
|
|
1299
|
-
try {
|
|
1300
|
-
destStat = fs5.statSync(dest);
|
|
1301
|
-
} catch (err) {
|
|
1302
|
-
if (err.code === "ENOENT") return { srcStat, destStat: notExist };
|
|
1303
|
-
throw err;
|
|
1304
|
-
}
|
|
1305
|
-
return { srcStat, destStat };
|
|
1306
|
-
}
|
|
1307
|
-
function checkPaths(src, dest) {
|
|
1308
|
-
const { srcStat, destStat } = checkStats(src, dest);
|
|
1309
|
-
if (destStat.ino && destStat.ino === srcStat.ino) {
|
|
1310
|
-
throw new Error("Source and destination must not be the same.");
|
|
1311
|
-
}
|
|
1312
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1313
|
-
throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`);
|
|
1314
|
-
}
|
|
1315
|
-
return destStat;
|
|
1316
|
-
}
|
|
1317
|
-
module.exports = copySync;
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
|
|
1321
|
-
// ../../node_modules/fs-extra/lib/copy-sync/index.js
|
|
1322
|
-
var require_copy_sync2 = __commonJS({
|
|
1323
|
-
"../../node_modules/fs-extra/lib/copy-sync/index.js"(exports, module) {
|
|
1324
|
-
"use strict";
|
|
1325
|
-
module.exports = {
|
|
1326
|
-
copySync: require_copy_sync()
|
|
1327
|
-
};
|
|
1328
|
-
}
|
|
1329
|
-
});
|
|
1330
|
-
|
|
1331
|
-
// ../../node_modules/fs-extra/lib/path-exists/index.js
|
|
1332
|
-
var require_path_exists = __commonJS({
|
|
1333
|
-
"../../node_modules/fs-extra/lib/path-exists/index.js"(exports, module) {
|
|
1334
|
-
"use strict";
|
|
1335
|
-
var u = require_universalify().fromPromise;
|
|
1336
|
-
var fs5 = require_fs();
|
|
1337
|
-
function pathExists(path4) {
|
|
1338
|
-
return fs5.access(path4).then(() => true).catch(() => false);
|
|
1339
|
-
}
|
|
1340
|
-
module.exports = {
|
|
1341
|
-
pathExists: u(pathExists),
|
|
1342
|
-
pathExistsSync: fs5.existsSync
|
|
1343
|
-
};
|
|
1344
|
-
}
|
|
1345
|
-
});
|
|
1346
|
-
|
|
1347
|
-
// ../../node_modules/fs-extra/lib/copy/copy.js
|
|
1348
|
-
var require_copy = __commonJS({
|
|
1349
|
-
"../../node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
|
|
1350
|
-
"use strict";
|
|
1351
|
-
var fs5 = require_graceful_fs();
|
|
1352
|
-
var path4 = __require("path");
|
|
1353
|
-
var mkdirp = require_mkdirs2().mkdirs;
|
|
1354
|
-
var pathExists = require_path_exists().pathExists;
|
|
1355
|
-
var utimes = require_utimes().utimesMillis;
|
|
1356
|
-
var notExist = Symbol("notExist");
|
|
1357
|
-
function copy2(src, dest, opts, cb) {
|
|
1358
|
-
if (typeof opts === "function" && !cb) {
|
|
1359
|
-
cb = opts;
|
|
1360
|
-
opts = {};
|
|
1361
|
-
} else if (typeof opts === "function") {
|
|
1362
|
-
opts = { filter: opts };
|
|
1363
|
-
}
|
|
1364
|
-
cb = cb || function() {
|
|
1365
|
-
};
|
|
1366
|
-
opts = opts || {};
|
|
1367
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1368
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1369
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1370
|
-
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
1371
|
-
|
|
1372
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`);
|
|
1373
|
-
}
|
|
1374
|
-
checkPaths(src, dest, (err, destStat) => {
|
|
1375
|
-
if (err) return cb(err);
|
|
1376
|
-
if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb);
|
|
1377
|
-
return checkParentDir(destStat, src, dest, opts, cb);
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
function checkParentDir(destStat, src, dest, opts, cb) {
|
|
1381
|
-
const destParent = path4.dirname(dest);
|
|
1382
|
-
pathExists(destParent, (err, dirExists) => {
|
|
1383
|
-
if (err) return cb(err);
|
|
1384
|
-
if (dirExists) return startCopy(destStat, src, dest, opts, cb);
|
|
1385
|
-
mkdirp(destParent, (err2) => {
|
|
1386
|
-
if (err2) return cb(err2);
|
|
1387
|
-
return startCopy(destStat, src, dest, opts, cb);
|
|
1388
|
-
});
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
function handleFilter(onInclude, destStat, src, dest, opts, cb) {
|
|
1392
|
-
Promise.resolve(opts.filter(src, dest)).then((include) => {
|
|
1393
|
-
if (include) {
|
|
1394
|
-
if (destStat) return onInclude(destStat, src, dest, opts, cb);
|
|
1395
|
-
return onInclude(src, dest, opts, cb);
|
|
1396
|
-
}
|
|
1397
|
-
return cb();
|
|
1398
|
-
}, (error) => cb(error));
|
|
1399
|
-
}
|
|
1400
|
-
function startCopy(destStat, src, dest, opts, cb) {
|
|
1401
|
-
if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb);
|
|
1402
|
-
return getStats(destStat, src, dest, opts, cb);
|
|
1403
|
-
}
|
|
1404
|
-
function getStats(destStat, src, dest, opts, cb) {
|
|
1405
|
-
const stat = opts.dereference ? fs5.stat : fs5.lstat;
|
|
1406
|
-
stat(src, (err, srcStat) => {
|
|
1407
|
-
if (err) return cb(err);
|
|
1408
|
-
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb);
|
|
1409
|
-
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb);
|
|
1410
|
-
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb);
|
|
1411
|
-
});
|
|
1412
|
-
}
|
|
1413
|
-
function onFile(srcStat, destStat, src, dest, opts, cb) {
|
|
1414
|
-
if (destStat === notExist) return copyFile(srcStat, src, dest, opts, cb);
|
|
1415
|
-
return mayCopyFile(srcStat, src, dest, opts, cb);
|
|
1416
|
-
}
|
|
1417
|
-
function mayCopyFile(srcStat, src, dest, opts, cb) {
|
|
1418
|
-
if (opts.overwrite) {
|
|
1419
|
-
fs5.unlink(dest, (err) => {
|
|
1420
|
-
if (err) return cb(err);
|
|
1421
|
-
return copyFile(srcStat, src, dest, opts, cb);
|
|
1422
|
-
});
|
|
1423
|
-
} else if (opts.errorOnExist) {
|
|
1424
|
-
return cb(new Error(`'${dest}' already exists`));
|
|
1425
|
-
} else return cb();
|
|
1426
|
-
}
|
|
1427
|
-
function copyFile(srcStat, src, dest, opts, cb) {
|
|
1428
|
-
if (typeof fs5.copyFile === "function") {
|
|
1429
|
-
return fs5.copyFile(src, dest, (err) => {
|
|
1430
|
-
if (err) return cb(err);
|
|
1431
|
-
return setDestModeAndTimestamps(srcStat, dest, opts, cb);
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
return copyFileFallback(srcStat, src, dest, opts, cb);
|
|
1435
|
-
}
|
|
1436
|
-
function copyFileFallback(srcStat, src, dest, opts, cb) {
|
|
1437
|
-
const rs = fs5.createReadStream(src);
|
|
1438
|
-
rs.on("error", (err) => cb(err)).once("open", () => {
|
|
1439
|
-
const ws = fs5.createWriteStream(dest, { mode: srcStat.mode });
|
|
1440
|
-
ws.on("error", (err) => cb(err)).on("open", () => rs.pipe(ws)).once("close", () => setDestModeAndTimestamps(srcStat, dest, opts, cb));
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
function setDestModeAndTimestamps(srcStat, dest, opts, cb) {
|
|
1444
|
-
fs5.chmod(dest, srcStat.mode, (err) => {
|
|
1445
|
-
if (err) return cb(err);
|
|
1446
|
-
if (opts.preserveTimestamps) {
|
|
1447
|
-
return utimes(dest, srcStat.atime, srcStat.mtime, cb);
|
|
1448
|
-
}
|
|
1449
|
-
return cb();
|
|
1450
|
-
});
|
|
1451
|
-
}
|
|
1452
|
-
function onDir(srcStat, destStat, src, dest, opts, cb) {
|
|
1453
|
-
if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts, cb);
|
|
1454
|
-
if (destStat && !destStat.isDirectory()) {
|
|
1455
|
-
return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
|
|
1456
|
-
}
|
|
1457
|
-
return copyDir(src, dest, opts, cb);
|
|
1458
|
-
}
|
|
1459
|
-
function mkDirAndCopy(srcStat, src, dest, opts, cb) {
|
|
1460
|
-
fs5.mkdir(dest, (err) => {
|
|
1461
|
-
if (err) return cb(err);
|
|
1462
|
-
copyDir(src, dest, opts, (err2) => {
|
|
1463
|
-
if (err2) return cb(err2);
|
|
1464
|
-
return fs5.chmod(dest, srcStat.mode, cb);
|
|
1465
|
-
});
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
function copyDir(src, dest, opts, cb) {
|
|
1469
|
-
fs5.readdir(src, (err, items) => {
|
|
1470
|
-
if (err) return cb(err);
|
|
1471
|
-
return copyDirItems(items, src, dest, opts, cb);
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
function copyDirItems(items, src, dest, opts, cb) {
|
|
1475
|
-
const item = items.pop();
|
|
1476
|
-
if (!item) return cb();
|
|
1477
|
-
return copyDirItem(items, item, src, dest, opts, cb);
|
|
1478
|
-
}
|
|
1479
|
-
function copyDirItem(items, item, src, dest, opts, cb) {
|
|
1480
|
-
const srcItem = path4.join(src, item);
|
|
1481
|
-
const destItem = path4.join(dest, item);
|
|
1482
|
-
checkPaths(srcItem, destItem, (err, destStat) => {
|
|
1483
|
-
if (err) return cb(err);
|
|
1484
|
-
startCopy(destStat, srcItem, destItem, opts, (err2) => {
|
|
1485
|
-
if (err2) return cb(err2);
|
|
1486
|
-
return copyDirItems(items, src, dest, opts, cb);
|
|
1487
|
-
});
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
function onLink(destStat, src, dest, opts, cb) {
|
|
1491
|
-
fs5.readlink(src, (err, resolvedSrc) => {
|
|
1492
|
-
if (err) return cb(err);
|
|
1493
|
-
if (opts.dereference) {
|
|
1494
|
-
resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
|
|
1495
|
-
}
|
|
1496
|
-
if (destStat === notExist) {
|
|
1497
|
-
return fs5.symlink(resolvedSrc, dest, cb);
|
|
1498
|
-
} else {
|
|
1499
|
-
fs5.readlink(dest, (err2, resolvedDest) => {
|
|
1500
|
-
if (err2) {
|
|
1501
|
-
if (err2.code === "EINVAL" || err2.code === "UNKNOWN") return fs5.symlink(resolvedSrc, dest, cb);
|
|
1502
|
-
return cb(err2);
|
|
1503
|
-
}
|
|
1504
|
-
if (opts.dereference) {
|
|
1505
|
-
resolvedDest = path4.resolve(process.cwd(), resolvedDest);
|
|
1506
|
-
}
|
|
1507
|
-
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1508
|
-
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
|
|
1509
|
-
}
|
|
1510
|
-
if (destStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1511
|
-
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
|
|
1512
|
-
}
|
|
1513
|
-
return copyLink(resolvedSrc, dest, cb);
|
|
1514
|
-
});
|
|
1515
|
-
}
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
function copyLink(resolvedSrc, dest, cb) {
|
|
1519
|
-
fs5.unlink(dest, (err) => {
|
|
1520
|
-
if (err) return cb(err);
|
|
1521
|
-
return fs5.symlink(resolvedSrc, dest, cb);
|
|
1522
|
-
});
|
|
1523
|
-
}
|
|
1524
|
-
function isSrcSubdir(src, dest) {
|
|
1525
|
-
const srcArray = path4.resolve(src).split(path4.sep);
|
|
1526
|
-
const destArray = path4.resolve(dest).split(path4.sep);
|
|
1527
|
-
return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true);
|
|
1528
|
-
}
|
|
1529
|
-
function checkStats(src, dest, cb) {
|
|
1530
|
-
fs5.stat(src, (err, srcStat) => {
|
|
1531
|
-
if (err) return cb(err);
|
|
1532
|
-
fs5.stat(dest, (err2, destStat) => {
|
|
1533
|
-
if (err2) {
|
|
1534
|
-
if (err2.code === "ENOENT") return cb(null, { srcStat, destStat: notExist });
|
|
1535
|
-
return cb(err2);
|
|
1536
|
-
}
|
|
1537
|
-
return cb(null, { srcStat, destStat });
|
|
1538
|
-
});
|
|
1539
|
-
});
|
|
1540
|
-
}
|
|
1541
|
-
function checkPaths(src, dest, cb) {
|
|
1542
|
-
checkStats(src, dest, (err, stats) => {
|
|
1543
|
-
if (err) return cb(err);
|
|
1544
|
-
const { srcStat, destStat } = stats;
|
|
1545
|
-
if (destStat.ino && destStat.ino === srcStat.ino) {
|
|
1546
|
-
return cb(new Error("Source and destination must not be the same."));
|
|
1547
|
-
}
|
|
1548
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1549
|
-
return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`));
|
|
1550
|
-
}
|
|
1551
|
-
return cb(null, destStat);
|
|
1552
|
-
});
|
|
1553
|
-
}
|
|
1554
|
-
module.exports = copy2;
|
|
1555
|
-
}
|
|
1556
|
-
});
|
|
1557
|
-
|
|
1558
|
-
// ../../node_modules/fs-extra/lib/copy/index.js
|
|
1559
|
-
var require_copy2 = __commonJS({
|
|
1560
|
-
"../../node_modules/fs-extra/lib/copy/index.js"(exports, module) {
|
|
1561
|
-
"use strict";
|
|
1562
|
-
var u = require_universalify().fromCallback;
|
|
1563
|
-
module.exports = {
|
|
1564
|
-
copy: u(require_copy())
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
});
|
|
1568
|
-
|
|
1569
|
-
// ../../node_modules/fs-extra/lib/remove/rimraf.js
|
|
1570
|
-
var require_rimraf = __commonJS({
|
|
1571
|
-
"../../node_modules/fs-extra/lib/remove/rimraf.js"(exports, module) {
|
|
1572
|
-
"use strict";
|
|
1573
|
-
var fs5 = require_graceful_fs();
|
|
1574
|
-
var path4 = __require("path");
|
|
1575
|
-
var assert = __require("assert");
|
|
1576
|
-
var isWindows = process.platform === "win32";
|
|
1577
|
-
function defaults(options) {
|
|
1578
|
-
const methods = [
|
|
1579
|
-
"unlink",
|
|
1580
|
-
"chmod",
|
|
1581
|
-
"stat",
|
|
1582
|
-
"lstat",
|
|
1583
|
-
"rmdir",
|
|
1584
|
-
"readdir"
|
|
1585
|
-
];
|
|
1586
|
-
methods.forEach((m) => {
|
|
1587
|
-
options[m] = options[m] || fs5[m];
|
|
1588
|
-
m = m + "Sync";
|
|
1589
|
-
options[m] = options[m] || fs5[m];
|
|
1590
|
-
});
|
|
1591
|
-
options.maxBusyTries = options.maxBusyTries || 3;
|
|
1592
|
-
}
|
|
1593
|
-
function rimraf(p, options, cb) {
|
|
1594
|
-
let busyTries = 0;
|
|
1595
|
-
if (typeof options === "function") {
|
|
1596
|
-
cb = options;
|
|
1597
|
-
options = {};
|
|
1598
|
-
}
|
|
1599
|
-
assert(p, "rimraf: missing path");
|
|
1600
|
-
assert.strictEqual(typeof p, "string", "rimraf: path should be a string");
|
|
1601
|
-
assert.strictEqual(typeof cb, "function", "rimraf: callback function required");
|
|
1602
|
-
assert(options, "rimraf: invalid options argument provided");
|
|
1603
|
-
assert.strictEqual(typeof options, "object", "rimraf: options should be object");
|
|
1604
|
-
defaults(options);
|
|
1605
|
-
rimraf_(p, options, function CB(er) {
|
|
1606
|
-
if (er) {
|
|
1607
|
-
if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && busyTries < options.maxBusyTries) {
|
|
1608
|
-
busyTries++;
|
|
1609
|
-
const time = busyTries * 100;
|
|
1610
|
-
return setTimeout(() => rimraf_(p, options, CB), time);
|
|
1611
|
-
}
|
|
1612
|
-
if (er.code === "ENOENT") er = null;
|
|
1613
|
-
}
|
|
1614
|
-
cb(er);
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
function rimraf_(p, options, cb) {
|
|
1618
|
-
assert(p);
|
|
1619
|
-
assert(options);
|
|
1620
|
-
assert(typeof cb === "function");
|
|
1621
|
-
options.lstat(p, (er, st) => {
|
|
1622
|
-
if (er && er.code === "ENOENT") {
|
|
1623
|
-
return cb(null);
|
|
1624
|
-
}
|
|
1625
|
-
if (er && er.code === "EPERM" && isWindows) {
|
|
1626
|
-
return fixWinEPERM(p, options, er, cb);
|
|
1627
|
-
}
|
|
1628
|
-
if (st && st.isDirectory()) {
|
|
1629
|
-
return rmdir(p, options, er, cb);
|
|
1630
|
-
}
|
|
1631
|
-
options.unlink(p, (er2) => {
|
|
1632
|
-
if (er2) {
|
|
1633
|
-
if (er2.code === "ENOENT") {
|
|
1634
|
-
return cb(null);
|
|
1635
|
-
}
|
|
1636
|
-
if (er2.code === "EPERM") {
|
|
1637
|
-
return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
|
|
1638
|
-
}
|
|
1639
|
-
if (er2.code === "EISDIR") {
|
|
1640
|
-
return rmdir(p, options, er2, cb);
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
return cb(er2);
|
|
1644
|
-
});
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
function fixWinEPERM(p, options, er, cb) {
|
|
1648
|
-
assert(p);
|
|
1649
|
-
assert(options);
|
|
1650
|
-
assert(typeof cb === "function");
|
|
1651
|
-
if (er) {
|
|
1652
|
-
assert(er instanceof Error);
|
|
1653
|
-
}
|
|
1654
|
-
options.chmod(p, 438, (er2) => {
|
|
1655
|
-
if (er2) {
|
|
1656
|
-
cb(er2.code === "ENOENT" ? null : er);
|
|
1657
|
-
} else {
|
|
1658
|
-
options.stat(p, (er3, stats) => {
|
|
1659
|
-
if (er3) {
|
|
1660
|
-
cb(er3.code === "ENOENT" ? null : er);
|
|
1661
|
-
} else if (stats.isDirectory()) {
|
|
1662
|
-
rmdir(p, options, er, cb);
|
|
1663
|
-
} else {
|
|
1664
|
-
options.unlink(p, cb);
|
|
1665
|
-
}
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
});
|
|
1669
|
-
}
|
|
1670
|
-
function fixWinEPERMSync(p, options, er) {
|
|
1671
|
-
let stats;
|
|
1672
|
-
assert(p);
|
|
1673
|
-
assert(options);
|
|
1674
|
-
if (er) {
|
|
1675
|
-
assert(er instanceof Error);
|
|
1676
|
-
}
|
|
1677
|
-
try {
|
|
1678
|
-
options.chmodSync(p, 438);
|
|
1679
|
-
} catch (er2) {
|
|
1680
|
-
if (er2.code === "ENOENT") {
|
|
1681
|
-
return;
|
|
1682
|
-
} else {
|
|
1683
|
-
throw er;
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
try {
|
|
1687
|
-
stats = options.statSync(p);
|
|
1688
|
-
} catch (er3) {
|
|
1689
|
-
if (er3.code === "ENOENT") {
|
|
1690
|
-
return;
|
|
1691
|
-
} else {
|
|
1692
|
-
throw er;
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
if (stats.isDirectory()) {
|
|
1696
|
-
rmdirSync(p, options, er);
|
|
1697
|
-
} else {
|
|
1698
|
-
options.unlinkSync(p);
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
function rmdir(p, options, originalEr, cb) {
|
|
1702
|
-
assert(p);
|
|
1703
|
-
assert(options);
|
|
1704
|
-
if (originalEr) {
|
|
1705
|
-
assert(originalEr instanceof Error);
|
|
1706
|
-
}
|
|
1707
|
-
assert(typeof cb === "function");
|
|
1708
|
-
options.rmdir(p, (er) => {
|
|
1709
|
-
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) {
|
|
1710
|
-
rmkids(p, options, cb);
|
|
1711
|
-
} else if (er && er.code === "ENOTDIR") {
|
|
1712
|
-
cb(originalEr);
|
|
1713
|
-
} else {
|
|
1714
|
-
cb(er);
|
|
1715
|
-
}
|
|
1716
|
-
});
|
|
1717
|
-
}
|
|
1718
|
-
function rmkids(p, options, cb) {
|
|
1719
|
-
assert(p);
|
|
1720
|
-
assert(options);
|
|
1721
|
-
assert(typeof cb === "function");
|
|
1722
|
-
options.readdir(p, (er, files) => {
|
|
1723
|
-
if (er) return cb(er);
|
|
1724
|
-
let n = files.length;
|
|
1725
|
-
let errState;
|
|
1726
|
-
if (n === 0) return options.rmdir(p, cb);
|
|
1727
|
-
files.forEach((f) => {
|
|
1728
|
-
rimraf(path4.join(p, f), options, (er2) => {
|
|
1729
|
-
if (errState) {
|
|
1730
|
-
return;
|
|
1731
|
-
}
|
|
1732
|
-
if (er2) return cb(errState = er2);
|
|
1733
|
-
if (--n === 0) {
|
|
1734
|
-
options.rmdir(p, cb);
|
|
1735
|
-
}
|
|
1736
|
-
});
|
|
1737
|
-
});
|
|
1738
|
-
});
|
|
1739
|
-
}
|
|
1740
|
-
function rimrafSync(p, options) {
|
|
1741
|
-
let st;
|
|
1742
|
-
options = options || {};
|
|
1743
|
-
defaults(options);
|
|
1744
|
-
assert(p, "rimraf: missing path");
|
|
1745
|
-
assert.strictEqual(typeof p, "string", "rimraf: path should be a string");
|
|
1746
|
-
assert(options, "rimraf: missing options");
|
|
1747
|
-
assert.strictEqual(typeof options, "object", "rimraf: options should be object");
|
|
1748
|
-
try {
|
|
1749
|
-
st = options.lstatSync(p);
|
|
1750
|
-
} catch (er) {
|
|
1751
|
-
if (er.code === "ENOENT") {
|
|
1752
|
-
return;
|
|
1753
|
-
}
|
|
1754
|
-
if (er.code === "EPERM" && isWindows) {
|
|
1755
|
-
fixWinEPERMSync(p, options, er);
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
try {
|
|
1759
|
-
if (st && st.isDirectory()) {
|
|
1760
|
-
rmdirSync(p, options, null);
|
|
1761
|
-
} else {
|
|
1762
|
-
options.unlinkSync(p);
|
|
1763
|
-
}
|
|
1764
|
-
} catch (er) {
|
|
1765
|
-
if (er.code === "ENOENT") {
|
|
1766
|
-
return;
|
|
1767
|
-
} else if (er.code === "EPERM") {
|
|
1768
|
-
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er);
|
|
1769
|
-
} else if (er.code !== "EISDIR") {
|
|
1770
|
-
throw er;
|
|
1771
|
-
}
|
|
1772
|
-
rmdirSync(p, options, er);
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
function rmdirSync(p, options, originalEr) {
|
|
1776
|
-
assert(p);
|
|
1777
|
-
assert(options);
|
|
1778
|
-
if (originalEr) {
|
|
1779
|
-
assert(originalEr instanceof Error);
|
|
1780
|
-
}
|
|
1781
|
-
try {
|
|
1782
|
-
options.rmdirSync(p);
|
|
1783
|
-
} catch (er) {
|
|
1784
|
-
if (er.code === "ENOTDIR") {
|
|
1785
|
-
throw originalEr;
|
|
1786
|
-
} else if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") {
|
|
1787
|
-
rmkidsSync(p, options);
|
|
1788
|
-
} else if (er.code !== "ENOENT") {
|
|
1789
|
-
throw er;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
function rmkidsSync(p, options) {
|
|
1794
|
-
assert(p);
|
|
1795
|
-
assert(options);
|
|
1796
|
-
options.readdirSync(p).forEach((f) => rimrafSync(path4.join(p, f), options));
|
|
1797
|
-
if (isWindows) {
|
|
1798
|
-
const startTime = Date.now();
|
|
1799
|
-
do {
|
|
1800
|
-
try {
|
|
1801
|
-
const ret = options.rmdirSync(p, options);
|
|
1802
|
-
return ret;
|
|
1803
|
-
} catch (er) {
|
|
1804
|
-
}
|
|
1805
|
-
} while (Date.now() - startTime < 500);
|
|
1806
|
-
} else {
|
|
1807
|
-
const ret = options.rmdirSync(p, options);
|
|
1808
|
-
return ret;
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
module.exports = rimraf;
|
|
1812
|
-
rimraf.sync = rimrafSync;
|
|
1813
|
-
}
|
|
1814
|
-
});
|
|
1815
|
-
|
|
1816
|
-
// ../../node_modules/fs-extra/lib/remove/index.js
|
|
1817
|
-
var require_remove = __commonJS({
|
|
1818
|
-
"../../node_modules/fs-extra/lib/remove/index.js"(exports, module) {
|
|
1819
|
-
"use strict";
|
|
1820
|
-
var u = require_universalify().fromCallback;
|
|
1821
|
-
var rimraf = require_rimraf();
|
|
1822
|
-
module.exports = {
|
|
1823
|
-
remove: u(rimraf),
|
|
1824
|
-
removeSync: rimraf.sync
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1827
|
-
});
|
|
1828
|
-
|
|
1829
|
-
// ../../node_modules/fs-extra/lib/empty/index.js
|
|
1830
|
-
var require_empty = __commonJS({
|
|
1831
|
-
"../../node_modules/fs-extra/lib/empty/index.js"(exports, module) {
|
|
1832
|
-
"use strict";
|
|
1833
|
-
var u = require_universalify().fromCallback;
|
|
1834
|
-
var fs5 = __require("fs");
|
|
1835
|
-
var path4 = __require("path");
|
|
1836
|
-
var mkdir = require_mkdirs2();
|
|
1837
|
-
var remove = require_remove();
|
|
1838
|
-
var emptyDir = u(function emptyDir2(dir, callback) {
|
|
1839
|
-
callback = callback || function() {
|
|
1840
|
-
};
|
|
1841
|
-
fs5.readdir(dir, (err, items) => {
|
|
1842
|
-
if (err) return mkdir.mkdirs(dir, callback);
|
|
1843
|
-
items = items.map((item) => path4.join(dir, item));
|
|
1844
|
-
deleteItem();
|
|
1845
|
-
function deleteItem() {
|
|
1846
|
-
const item = items.pop();
|
|
1847
|
-
if (!item) return callback();
|
|
1848
|
-
remove.remove(item, (err2) => {
|
|
1849
|
-
if (err2) return callback(err2);
|
|
1850
|
-
deleteItem();
|
|
1851
|
-
});
|
|
1852
|
-
}
|
|
1853
|
-
});
|
|
1854
|
-
});
|
|
1855
|
-
function emptyDirSync(dir) {
|
|
1856
|
-
let items;
|
|
1857
|
-
try {
|
|
1858
|
-
items = fs5.readdirSync(dir);
|
|
1859
|
-
} catch (err) {
|
|
1860
|
-
return mkdir.mkdirsSync(dir);
|
|
1861
|
-
}
|
|
1862
|
-
items.forEach((item) => {
|
|
1863
|
-
item = path4.join(dir, item);
|
|
1864
|
-
remove.removeSync(item);
|
|
1865
|
-
});
|
|
1866
|
-
}
|
|
1867
|
-
module.exports = {
|
|
1868
|
-
emptyDirSync,
|
|
1869
|
-
emptydirSync: emptyDirSync,
|
|
1870
|
-
emptyDir,
|
|
1871
|
-
emptydir: emptyDir
|
|
1872
|
-
};
|
|
1873
|
-
}
|
|
1874
|
-
});
|
|
1875
|
-
|
|
1876
|
-
// ../../node_modules/fs-extra/lib/ensure/file.js
|
|
1877
|
-
var require_file = __commonJS({
|
|
1878
|
-
"../../node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
|
|
1879
|
-
"use strict";
|
|
1880
|
-
var u = require_universalify().fromCallback;
|
|
1881
|
-
var path4 = __require("path");
|
|
1882
|
-
var fs5 = require_graceful_fs();
|
|
1883
|
-
var mkdir = require_mkdirs2();
|
|
1884
|
-
var pathExists = require_path_exists().pathExists;
|
|
1885
|
-
function createFile(file, callback) {
|
|
1886
|
-
function makeFile() {
|
|
1887
|
-
fs5.writeFile(file, "", (err) => {
|
|
1888
|
-
if (err) return callback(err);
|
|
1889
|
-
callback();
|
|
1890
|
-
});
|
|
1891
|
-
}
|
|
1892
|
-
fs5.stat(file, (err, stats) => {
|
|
1893
|
-
if (!err && stats.isFile()) return callback();
|
|
1894
|
-
const dir = path4.dirname(file);
|
|
1895
|
-
pathExists(dir, (err2, dirExists) => {
|
|
1896
|
-
if (err2) return callback(err2);
|
|
1897
|
-
if (dirExists) return makeFile();
|
|
1898
|
-
mkdir.mkdirs(dir, (err3) => {
|
|
1899
|
-
if (err3) return callback(err3);
|
|
1900
|
-
makeFile();
|
|
1901
|
-
});
|
|
1902
|
-
});
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
function createFileSync(file) {
|
|
1906
|
-
let stats;
|
|
1907
|
-
try {
|
|
1908
|
-
stats = fs5.statSync(file);
|
|
1909
|
-
} catch (e) {
|
|
1910
|
-
}
|
|
1911
|
-
if (stats && stats.isFile()) return;
|
|
1912
|
-
const dir = path4.dirname(file);
|
|
1913
|
-
if (!fs5.existsSync(dir)) {
|
|
1914
|
-
mkdir.mkdirsSync(dir);
|
|
1915
|
-
}
|
|
1916
|
-
fs5.writeFileSync(file, "");
|
|
1917
|
-
}
|
|
1918
|
-
module.exports = {
|
|
1919
|
-
createFile: u(createFile),
|
|
1920
|
-
createFileSync
|
|
1921
|
-
};
|
|
1922
|
-
}
|
|
1923
|
-
});
|
|
1924
|
-
|
|
1925
|
-
// ../../node_modules/fs-extra/lib/ensure/link.js
|
|
1926
|
-
var require_link = __commonJS({
|
|
1927
|
-
"../../node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
|
|
1928
|
-
"use strict";
|
|
1929
|
-
var u = require_universalify().fromCallback;
|
|
1930
|
-
var path4 = __require("path");
|
|
1931
|
-
var fs5 = require_graceful_fs();
|
|
1932
|
-
var mkdir = require_mkdirs2();
|
|
1933
|
-
var pathExists = require_path_exists().pathExists;
|
|
1934
|
-
function createLink(srcpath, dstpath, callback) {
|
|
1935
|
-
function makeLink(srcpath2, dstpath2) {
|
|
1936
|
-
fs5.link(srcpath2, dstpath2, (err) => {
|
|
1937
|
-
if (err) return callback(err);
|
|
1938
|
-
callback(null);
|
|
1939
|
-
});
|
|
1940
|
-
}
|
|
1941
|
-
pathExists(dstpath, (err, destinationExists) => {
|
|
1942
|
-
if (err) return callback(err);
|
|
1943
|
-
if (destinationExists) return callback(null);
|
|
1944
|
-
fs5.lstat(srcpath, (err2) => {
|
|
1945
|
-
if (err2) {
|
|
1946
|
-
err2.message = err2.message.replace("lstat", "ensureLink");
|
|
1947
|
-
return callback(err2);
|
|
1948
|
-
}
|
|
1949
|
-
const dir = path4.dirname(dstpath);
|
|
1950
|
-
pathExists(dir, (err3, dirExists) => {
|
|
1951
|
-
if (err3) return callback(err3);
|
|
1952
|
-
if (dirExists) return makeLink(srcpath, dstpath);
|
|
1953
|
-
mkdir.mkdirs(dir, (err4) => {
|
|
1954
|
-
if (err4) return callback(err4);
|
|
1955
|
-
makeLink(srcpath, dstpath);
|
|
1956
|
-
});
|
|
1957
|
-
});
|
|
1958
|
-
});
|
|
1959
|
-
});
|
|
1960
|
-
}
|
|
1961
|
-
function createLinkSync(srcpath, dstpath) {
|
|
1962
|
-
const destinationExists = fs5.existsSync(dstpath);
|
|
1963
|
-
if (destinationExists) return void 0;
|
|
1964
|
-
try {
|
|
1965
|
-
fs5.lstatSync(srcpath);
|
|
1966
|
-
} catch (err) {
|
|
1967
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
1968
|
-
throw err;
|
|
1969
|
-
}
|
|
1970
|
-
const dir = path4.dirname(dstpath);
|
|
1971
|
-
const dirExists = fs5.existsSync(dir);
|
|
1972
|
-
if (dirExists) return fs5.linkSync(srcpath, dstpath);
|
|
1973
|
-
mkdir.mkdirsSync(dir);
|
|
1974
|
-
return fs5.linkSync(srcpath, dstpath);
|
|
1975
|
-
}
|
|
1976
|
-
module.exports = {
|
|
1977
|
-
createLink: u(createLink),
|
|
1978
|
-
createLinkSync
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
});
|
|
1982
|
-
|
|
1983
|
-
// ../../node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
1984
|
-
var require_symlink_paths = __commonJS({
|
|
1985
|
-
"../../node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
|
|
1986
|
-
"use strict";
|
|
1987
|
-
var path4 = __require("path");
|
|
1988
|
-
var fs5 = require_graceful_fs();
|
|
1989
|
-
var pathExists = require_path_exists().pathExists;
|
|
1990
|
-
function symlinkPaths(srcpath, dstpath, callback) {
|
|
1991
|
-
if (path4.isAbsolute(srcpath)) {
|
|
1992
|
-
return fs5.lstat(srcpath, (err) => {
|
|
1993
|
-
if (err) {
|
|
1994
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1995
|
-
return callback(err);
|
|
1996
|
-
}
|
|
1997
|
-
return callback(null, {
|
|
1998
|
-
"toCwd": srcpath,
|
|
1999
|
-
"toDst": srcpath
|
|
2000
|
-
});
|
|
2001
|
-
});
|
|
2002
|
-
} else {
|
|
2003
|
-
const dstdir = path4.dirname(dstpath);
|
|
2004
|
-
const relativeToDst = path4.join(dstdir, srcpath);
|
|
2005
|
-
return pathExists(relativeToDst, (err, exists) => {
|
|
2006
|
-
if (err) return callback(err);
|
|
2007
|
-
if (exists) {
|
|
2008
|
-
return callback(null, {
|
|
2009
|
-
"toCwd": relativeToDst,
|
|
2010
|
-
"toDst": srcpath
|
|
2011
|
-
});
|
|
2012
|
-
} else {
|
|
2013
|
-
return fs5.lstat(srcpath, (err2) => {
|
|
2014
|
-
if (err2) {
|
|
2015
|
-
err2.message = err2.message.replace("lstat", "ensureSymlink");
|
|
2016
|
-
return callback(err2);
|
|
2017
|
-
}
|
|
2018
|
-
return callback(null, {
|
|
2019
|
-
"toCwd": srcpath,
|
|
2020
|
-
"toDst": path4.relative(dstdir, srcpath)
|
|
2021
|
-
});
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
});
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
function symlinkPathsSync(srcpath, dstpath) {
|
|
2028
|
-
let exists;
|
|
2029
|
-
if (path4.isAbsolute(srcpath)) {
|
|
2030
|
-
exists = fs5.existsSync(srcpath);
|
|
2031
|
-
if (!exists) throw new Error("absolute srcpath does not exist");
|
|
2032
|
-
return {
|
|
2033
|
-
"toCwd": srcpath,
|
|
2034
|
-
"toDst": srcpath
|
|
2035
|
-
};
|
|
2036
|
-
} else {
|
|
2037
|
-
const dstdir = path4.dirname(dstpath);
|
|
2038
|
-
const relativeToDst = path4.join(dstdir, srcpath);
|
|
2039
|
-
exists = fs5.existsSync(relativeToDst);
|
|
2040
|
-
if (exists) {
|
|
2041
|
-
return {
|
|
2042
|
-
"toCwd": relativeToDst,
|
|
2043
|
-
"toDst": srcpath
|
|
2044
|
-
};
|
|
2045
|
-
} else {
|
|
2046
|
-
exists = fs5.existsSync(srcpath);
|
|
2047
|
-
if (!exists) throw new Error("relative srcpath does not exist");
|
|
2048
|
-
return {
|
|
2049
|
-
"toCwd": srcpath,
|
|
2050
|
-
"toDst": path4.relative(dstdir, srcpath)
|
|
2051
|
-
};
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
module.exports = {
|
|
2056
|
-
symlinkPaths,
|
|
2057
|
-
symlinkPathsSync
|
|
2058
|
-
};
|
|
2059
|
-
}
|
|
2060
|
-
});
|
|
2061
|
-
|
|
2062
|
-
// ../../node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
2063
|
-
var require_symlink_type = __commonJS({
|
|
2064
|
-
"../../node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module) {
|
|
2065
|
-
"use strict";
|
|
2066
|
-
var fs5 = require_graceful_fs();
|
|
2067
|
-
function symlinkType(srcpath, type, callback) {
|
|
2068
|
-
callback = typeof type === "function" ? type : callback;
|
|
2069
|
-
type = typeof type === "function" ? false : type;
|
|
2070
|
-
if (type) return callback(null, type);
|
|
2071
|
-
fs5.lstat(srcpath, (err, stats) => {
|
|
2072
|
-
if (err) return callback(null, "file");
|
|
2073
|
-
type = stats && stats.isDirectory() ? "dir" : "file";
|
|
2074
|
-
callback(null, type);
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
function symlinkTypeSync(srcpath, type) {
|
|
2078
|
-
let stats;
|
|
2079
|
-
if (type) return type;
|
|
2080
|
-
try {
|
|
2081
|
-
stats = fs5.lstatSync(srcpath);
|
|
2082
|
-
} catch (e) {
|
|
2083
|
-
return "file";
|
|
2084
|
-
}
|
|
2085
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
2086
|
-
}
|
|
2087
|
-
module.exports = {
|
|
2088
|
-
symlinkType,
|
|
2089
|
-
symlinkTypeSync
|
|
2090
|
-
};
|
|
2091
|
-
}
|
|
2092
|
-
});
|
|
2093
|
-
|
|
2094
|
-
// ../../node_modules/fs-extra/lib/ensure/symlink.js
|
|
2095
|
-
var require_symlink = __commonJS({
|
|
2096
|
-
"../../node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
|
|
2097
|
-
"use strict";
|
|
2098
|
-
var u = require_universalify().fromCallback;
|
|
2099
|
-
var path4 = __require("path");
|
|
2100
|
-
var fs5 = require_graceful_fs();
|
|
2101
|
-
var _mkdirs = require_mkdirs2();
|
|
2102
|
-
var mkdirs = _mkdirs.mkdirs;
|
|
2103
|
-
var mkdirsSync = _mkdirs.mkdirsSync;
|
|
2104
|
-
var _symlinkPaths = require_symlink_paths();
|
|
2105
|
-
var symlinkPaths = _symlinkPaths.symlinkPaths;
|
|
2106
|
-
var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
|
|
2107
|
-
var _symlinkType = require_symlink_type();
|
|
2108
|
-
var symlinkType = _symlinkType.symlinkType;
|
|
2109
|
-
var symlinkTypeSync = _symlinkType.symlinkTypeSync;
|
|
2110
|
-
var pathExists = require_path_exists().pathExists;
|
|
2111
|
-
function createSymlink(srcpath, dstpath, type, callback) {
|
|
2112
|
-
callback = typeof type === "function" ? type : callback;
|
|
2113
|
-
type = typeof type === "function" ? false : type;
|
|
2114
|
-
pathExists(dstpath, (err, destinationExists) => {
|
|
2115
|
-
if (err) return callback(err);
|
|
2116
|
-
if (destinationExists) return callback(null);
|
|
2117
|
-
symlinkPaths(srcpath, dstpath, (err2, relative) => {
|
|
2118
|
-
if (err2) return callback(err2);
|
|
2119
|
-
srcpath = relative.toDst;
|
|
2120
|
-
symlinkType(relative.toCwd, type, (err3, type2) => {
|
|
2121
|
-
if (err3) return callback(err3);
|
|
2122
|
-
const dir = path4.dirname(dstpath);
|
|
2123
|
-
pathExists(dir, (err4, dirExists) => {
|
|
2124
|
-
if (err4) return callback(err4);
|
|
2125
|
-
if (dirExists) return fs5.symlink(srcpath, dstpath, type2, callback);
|
|
2126
|
-
mkdirs(dir, (err5) => {
|
|
2127
|
-
if (err5) return callback(err5);
|
|
2128
|
-
fs5.symlink(srcpath, dstpath, type2, callback);
|
|
2129
|
-
});
|
|
2130
|
-
});
|
|
2131
|
-
});
|
|
2132
|
-
});
|
|
2133
|
-
});
|
|
2134
|
-
}
|
|
2135
|
-
function createSymlinkSync(srcpath, dstpath, type) {
|
|
2136
|
-
const destinationExists = fs5.existsSync(dstpath);
|
|
2137
|
-
if (destinationExists) return void 0;
|
|
2138
|
-
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
2139
|
-
srcpath = relative.toDst;
|
|
2140
|
-
type = symlinkTypeSync(relative.toCwd, type);
|
|
2141
|
-
const dir = path4.dirname(dstpath);
|
|
2142
|
-
const exists = fs5.existsSync(dir);
|
|
2143
|
-
if (exists) return fs5.symlinkSync(srcpath, dstpath, type);
|
|
2144
|
-
mkdirsSync(dir);
|
|
2145
|
-
return fs5.symlinkSync(srcpath, dstpath, type);
|
|
2146
|
-
}
|
|
2147
|
-
module.exports = {
|
|
2148
|
-
createSymlink: u(createSymlink),
|
|
2149
|
-
createSymlinkSync
|
|
2150
|
-
};
|
|
2151
|
-
}
|
|
2152
|
-
});
|
|
2153
|
-
|
|
2154
|
-
// ../../node_modules/fs-extra/lib/ensure/index.js
|
|
2155
|
-
var require_ensure = __commonJS({
|
|
2156
|
-
"../../node_modules/fs-extra/lib/ensure/index.js"(exports, module) {
|
|
2157
|
-
"use strict";
|
|
2158
|
-
var file = require_file();
|
|
2159
|
-
var link = require_link();
|
|
2160
|
-
var symlink = require_symlink();
|
|
2161
|
-
module.exports = {
|
|
2162
|
-
// file
|
|
2163
|
-
createFile: file.createFile,
|
|
2164
|
-
createFileSync: file.createFileSync,
|
|
2165
|
-
ensureFile: file.createFile,
|
|
2166
|
-
ensureFileSync: file.createFileSync,
|
|
2167
|
-
// link
|
|
2168
|
-
createLink: link.createLink,
|
|
2169
|
-
createLinkSync: link.createLinkSync,
|
|
2170
|
-
ensureLink: link.createLink,
|
|
2171
|
-
ensureLinkSync: link.createLinkSync,
|
|
2172
|
-
// symlink
|
|
2173
|
-
createSymlink: symlink.createSymlink,
|
|
2174
|
-
createSymlinkSync: symlink.createSymlinkSync,
|
|
2175
|
-
ensureSymlink: symlink.createSymlink,
|
|
2176
|
-
ensureSymlinkSync: symlink.createSymlinkSync
|
|
2177
|
-
};
|
|
2178
|
-
}
|
|
2179
|
-
});
|
|
2180
|
-
|
|
2181
|
-
// ../../node_modules/jsonfile/index.js
|
|
2182
|
-
var require_jsonfile = __commonJS({
|
|
2183
|
-
"../../node_modules/jsonfile/index.js"(exports, module) {
|
|
2184
|
-
"use strict";
|
|
2185
|
-
var _fs;
|
|
2186
|
-
try {
|
|
2187
|
-
_fs = require_graceful_fs();
|
|
2188
|
-
} catch (_3) {
|
|
2189
|
-
_fs = __require("fs");
|
|
2190
|
-
}
|
|
2191
|
-
function readFile(file, options, callback) {
|
|
2192
|
-
if (callback == null) {
|
|
2193
|
-
callback = options;
|
|
2194
|
-
options = {};
|
|
2195
|
-
}
|
|
2196
|
-
if (typeof options === "string") {
|
|
2197
|
-
options = { encoding: options };
|
|
2198
|
-
}
|
|
2199
|
-
options = options || {};
|
|
2200
|
-
var fs5 = options.fs || _fs;
|
|
2201
|
-
var shouldThrow = true;
|
|
2202
|
-
if ("throws" in options) {
|
|
2203
|
-
shouldThrow = options.throws;
|
|
2204
|
-
}
|
|
2205
|
-
fs5.readFile(file, options, function(err, data) {
|
|
2206
|
-
if (err) return callback(err);
|
|
2207
|
-
data = stripBom(data);
|
|
2208
|
-
var obj;
|
|
2209
|
-
try {
|
|
2210
|
-
obj = JSON.parse(data, options ? options.reviver : null);
|
|
2211
|
-
} catch (err2) {
|
|
2212
|
-
if (shouldThrow) {
|
|
2213
|
-
err2.message = file + ": " + err2.message;
|
|
2214
|
-
return callback(err2);
|
|
2215
|
-
} else {
|
|
2216
|
-
return callback(null, null);
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
callback(null, obj);
|
|
2220
|
-
});
|
|
2221
|
-
}
|
|
2222
|
-
function readFileSync(file, options) {
|
|
2223
|
-
options = options || {};
|
|
2224
|
-
if (typeof options === "string") {
|
|
2225
|
-
options = { encoding: options };
|
|
2226
|
-
}
|
|
2227
|
-
var fs5 = options.fs || _fs;
|
|
2228
|
-
var shouldThrow = true;
|
|
2229
|
-
if ("throws" in options) {
|
|
2230
|
-
shouldThrow = options.throws;
|
|
2231
|
-
}
|
|
2232
|
-
try {
|
|
2233
|
-
var content = fs5.readFileSync(file, options);
|
|
2234
|
-
content = stripBom(content);
|
|
2235
|
-
return JSON.parse(content, options.reviver);
|
|
2236
|
-
} catch (err) {
|
|
2237
|
-
if (shouldThrow) {
|
|
2238
|
-
err.message = file + ": " + err.message;
|
|
2239
|
-
throw err;
|
|
2240
|
-
} else {
|
|
2241
|
-
return null;
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
function stringify(obj, options) {
|
|
2246
|
-
var spaces;
|
|
2247
|
-
var EOL = "\n";
|
|
2248
|
-
if (typeof options === "object" && options !== null) {
|
|
2249
|
-
if (options.spaces) {
|
|
2250
|
-
spaces = options.spaces;
|
|
2251
|
-
}
|
|
2252
|
-
if (options.EOL) {
|
|
2253
|
-
EOL = options.EOL;
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
var str = JSON.stringify(obj, options ? options.replacer : null, spaces);
|
|
2257
|
-
return str.replace(/\n/g, EOL) + EOL;
|
|
2258
|
-
}
|
|
2259
|
-
function writeFile(file, obj, options, callback) {
|
|
2260
|
-
if (callback == null) {
|
|
2261
|
-
callback = options;
|
|
2262
|
-
options = {};
|
|
2263
|
-
}
|
|
2264
|
-
options = options || {};
|
|
2265
|
-
var fs5 = options.fs || _fs;
|
|
2266
|
-
var str = "";
|
|
2267
|
-
try {
|
|
2268
|
-
str = stringify(obj, options);
|
|
2269
|
-
} catch (err) {
|
|
2270
|
-
if (callback) callback(err, null);
|
|
2271
|
-
return;
|
|
2272
|
-
}
|
|
2273
|
-
fs5.writeFile(file, str, options, callback);
|
|
2274
|
-
}
|
|
2275
|
-
function writeFileSync(file, obj, options) {
|
|
2276
|
-
options = options || {};
|
|
2277
|
-
var fs5 = options.fs || _fs;
|
|
2278
|
-
var str = stringify(obj, options);
|
|
2279
|
-
return fs5.writeFileSync(file, str, options);
|
|
2280
|
-
}
|
|
2281
|
-
function stripBom(content) {
|
|
2282
|
-
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
2283
|
-
content = content.replace(/^\uFEFF/, "");
|
|
2284
|
-
return content;
|
|
2285
|
-
}
|
|
2286
|
-
var jsonfile = {
|
|
2287
|
-
readFile,
|
|
2288
|
-
readFileSync,
|
|
2289
|
-
writeFile,
|
|
2290
|
-
writeFileSync
|
|
2291
|
-
};
|
|
2292
|
-
module.exports = jsonfile;
|
|
2293
|
-
}
|
|
2294
|
-
});
|
|
2295
|
-
|
|
2296
|
-
// ../../node_modules/fs-extra/lib/json/jsonfile.js
|
|
2297
|
-
var require_jsonfile2 = __commonJS({
|
|
2298
|
-
"../../node_modules/fs-extra/lib/json/jsonfile.js"(exports, module) {
|
|
2299
|
-
"use strict";
|
|
2300
|
-
var u = require_universalify().fromCallback;
|
|
2301
|
-
var jsonFile = require_jsonfile();
|
|
2302
|
-
module.exports = {
|
|
2303
|
-
// jsonfile exports
|
|
2304
|
-
readJson: u(jsonFile.readFile),
|
|
2305
|
-
readJsonSync: jsonFile.readFileSync,
|
|
2306
|
-
writeJson: u(jsonFile.writeFile),
|
|
2307
|
-
writeJsonSync: jsonFile.writeFileSync
|
|
2308
|
-
};
|
|
2309
|
-
}
|
|
2310
|
-
});
|
|
2311
|
-
|
|
2312
|
-
// ../../node_modules/fs-extra/lib/json/output-json.js
|
|
2313
|
-
var require_output_json = __commonJS({
|
|
2314
|
-
"../../node_modules/fs-extra/lib/json/output-json.js"(exports, module) {
|
|
2315
|
-
"use strict";
|
|
2316
|
-
var path4 = __require("path");
|
|
2317
|
-
var mkdir = require_mkdirs2();
|
|
2318
|
-
var pathExists = require_path_exists().pathExists;
|
|
2319
|
-
var jsonFile = require_jsonfile2();
|
|
2320
|
-
function outputJson(file, data, options, callback) {
|
|
2321
|
-
if (typeof options === "function") {
|
|
2322
|
-
callback = options;
|
|
2323
|
-
options = {};
|
|
2324
|
-
}
|
|
2325
|
-
const dir = path4.dirname(file);
|
|
2326
|
-
pathExists(dir, (err, itDoes) => {
|
|
2327
|
-
if (err) return callback(err);
|
|
2328
|
-
if (itDoes) return jsonFile.writeJson(file, data, options, callback);
|
|
2329
|
-
mkdir.mkdirs(dir, (err2) => {
|
|
2330
|
-
if (err2) return callback(err2);
|
|
2331
|
-
jsonFile.writeJson(file, data, options, callback);
|
|
2332
|
-
});
|
|
2333
|
-
});
|
|
2334
|
-
}
|
|
2335
|
-
module.exports = outputJson;
|
|
2336
|
-
}
|
|
2337
|
-
});
|
|
2338
|
-
|
|
2339
|
-
// ../../node_modules/fs-extra/lib/json/output-json-sync.js
|
|
2340
|
-
var require_output_json_sync = __commonJS({
|
|
2341
|
-
"../../node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) {
|
|
2342
|
-
"use strict";
|
|
2343
|
-
var fs5 = require_graceful_fs();
|
|
2344
|
-
var path4 = __require("path");
|
|
2345
|
-
var mkdir = require_mkdirs2();
|
|
2346
|
-
var jsonFile = require_jsonfile2();
|
|
2347
|
-
function outputJsonSync(file, data, options) {
|
|
2348
|
-
const dir = path4.dirname(file);
|
|
2349
|
-
if (!fs5.existsSync(dir)) {
|
|
2350
|
-
mkdir.mkdirsSync(dir);
|
|
2351
|
-
}
|
|
2352
|
-
jsonFile.writeJsonSync(file, data, options);
|
|
2353
|
-
}
|
|
2354
|
-
module.exports = outputJsonSync;
|
|
2355
|
-
}
|
|
2356
|
-
});
|
|
2357
|
-
|
|
2358
|
-
// ../../node_modules/fs-extra/lib/json/index.js
|
|
2359
|
-
var require_json = __commonJS({
|
|
2360
|
-
"../../node_modules/fs-extra/lib/json/index.js"(exports, module) {
|
|
2361
|
-
"use strict";
|
|
2362
|
-
var u = require_universalify().fromCallback;
|
|
2363
|
-
var jsonFile = require_jsonfile2();
|
|
2364
|
-
jsonFile.outputJson = u(require_output_json());
|
|
2365
|
-
jsonFile.outputJsonSync = require_output_json_sync();
|
|
2366
|
-
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2367
|
-
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2368
|
-
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2369
|
-
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2370
|
-
jsonFile.readJSON = jsonFile.readJson;
|
|
2371
|
-
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2372
|
-
module.exports = jsonFile;
|
|
2373
|
-
}
|
|
2374
|
-
});
|
|
2375
|
-
|
|
2376
|
-
// ../../node_modules/fs-extra/lib/move-sync/index.js
|
|
2377
|
-
var require_move_sync = __commonJS({
|
|
2378
|
-
"../../node_modules/fs-extra/lib/move-sync/index.js"(exports, module) {
|
|
2379
|
-
"use strict";
|
|
2380
|
-
var fs5 = require_graceful_fs();
|
|
2381
|
-
var path4 = __require("path");
|
|
2382
|
-
var copySync = require_copy_sync2().copySync;
|
|
2383
|
-
var removeSync = require_remove().removeSync;
|
|
2384
|
-
var mkdirpSync = require_mkdirs2().mkdirsSync;
|
|
2385
|
-
var buffer = require_buffer();
|
|
2386
|
-
function moveSync(src, dest, options) {
|
|
2387
|
-
options = options || {};
|
|
2388
|
-
const overwrite = options.overwrite || options.clobber || false;
|
|
2389
|
-
src = path4.resolve(src);
|
|
2390
|
-
dest = path4.resolve(dest);
|
|
2391
|
-
if (src === dest) return fs5.accessSync(src);
|
|
2392
|
-
if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`);
|
|
2393
|
-
mkdirpSync(path4.dirname(dest));
|
|
2394
|
-
tryRenameSync();
|
|
2395
|
-
function tryRenameSync() {
|
|
2396
|
-
if (overwrite) {
|
|
2397
|
-
try {
|
|
2398
|
-
return fs5.renameSync(src, dest);
|
|
2399
|
-
} catch (err) {
|
|
2400
|
-
if (err.code === "ENOTEMPTY" || err.code === "EEXIST" || err.code === "EPERM") {
|
|
2401
|
-
removeSync(dest);
|
|
2402
|
-
options.overwrite = false;
|
|
2403
|
-
return moveSync(src, dest, options);
|
|
2404
|
-
}
|
|
2405
|
-
if (err.code !== "EXDEV") throw err;
|
|
2406
|
-
return moveSyncAcrossDevice(src, dest, overwrite);
|
|
2407
|
-
}
|
|
2408
|
-
} else {
|
|
2409
|
-
try {
|
|
2410
|
-
fs5.linkSync(src, dest);
|
|
2411
|
-
return fs5.unlinkSync(src);
|
|
2412
|
-
} catch (err) {
|
|
2413
|
-
if (err.code === "EXDEV" || err.code === "EISDIR" || err.code === "EPERM" || err.code === "ENOTSUP") {
|
|
2414
|
-
return moveSyncAcrossDevice(src, dest, overwrite);
|
|
2415
|
-
}
|
|
2416
|
-
throw err;
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
function moveSyncAcrossDevice(src, dest, overwrite) {
|
|
2422
|
-
const stat = fs5.statSync(src);
|
|
2423
|
-
if (stat.isDirectory()) {
|
|
2424
|
-
return moveDirSyncAcrossDevice(src, dest, overwrite);
|
|
2425
|
-
} else {
|
|
2426
|
-
return moveFileSyncAcrossDevice(src, dest, overwrite);
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
function moveFileSyncAcrossDevice(src, dest, overwrite) {
|
|
2430
|
-
const BUF_LENGTH = 64 * 1024;
|
|
2431
|
-
const _buff = buffer(BUF_LENGTH);
|
|
2432
|
-
const flags = overwrite ? "w" : "wx";
|
|
2433
|
-
const fdr = fs5.openSync(src, "r");
|
|
2434
|
-
const stat = fs5.fstatSync(fdr);
|
|
2435
|
-
const fdw = fs5.openSync(dest, flags, stat.mode);
|
|
2436
|
-
let pos = 0;
|
|
2437
|
-
while (pos < stat.size) {
|
|
2438
|
-
const bytesRead = fs5.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
|
|
2439
|
-
fs5.writeSync(fdw, _buff, 0, bytesRead);
|
|
2440
|
-
pos += bytesRead;
|
|
2441
|
-
}
|
|
2442
|
-
fs5.closeSync(fdr);
|
|
2443
|
-
fs5.closeSync(fdw);
|
|
2444
|
-
return fs5.unlinkSync(src);
|
|
2445
|
-
}
|
|
2446
|
-
function moveDirSyncAcrossDevice(src, dest, overwrite) {
|
|
2447
|
-
const options = {
|
|
2448
|
-
overwrite: false
|
|
2449
|
-
};
|
|
2450
|
-
if (overwrite) {
|
|
2451
|
-
removeSync(dest);
|
|
2452
|
-
tryCopySync();
|
|
2453
|
-
} else {
|
|
2454
|
-
tryCopySync();
|
|
2455
|
-
}
|
|
2456
|
-
function tryCopySync() {
|
|
2457
|
-
copySync(src, dest, options);
|
|
2458
|
-
return removeSync(src);
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
function isSrcSubdir(src, dest) {
|
|
2462
|
-
try {
|
|
2463
|
-
return fs5.statSync(src).isDirectory() && src !== dest && dest.indexOf(src) > -1 && dest.split(path4.dirname(src) + path4.sep)[1].split(path4.sep)[0] === path4.basename(src);
|
|
2464
|
-
} catch (e) {
|
|
2465
|
-
return false;
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
module.exports = {
|
|
2469
|
-
moveSync
|
|
2470
|
-
};
|
|
2471
|
-
}
|
|
2472
|
-
});
|
|
2473
|
-
|
|
2474
|
-
// ../../node_modules/fs-extra/lib/move/index.js
|
|
2475
|
-
var require_move = __commonJS({
|
|
2476
|
-
"../../node_modules/fs-extra/lib/move/index.js"(exports, module) {
|
|
2477
|
-
"use strict";
|
|
2478
|
-
var u = require_universalify().fromCallback;
|
|
2479
|
-
var fs5 = require_graceful_fs();
|
|
2480
|
-
var path4 = __require("path");
|
|
2481
|
-
var copy2 = require_copy2().copy;
|
|
2482
|
-
var remove = require_remove().remove;
|
|
2483
|
-
var mkdirp = require_mkdirs2().mkdirp;
|
|
2484
|
-
var pathExists = require_path_exists().pathExists;
|
|
2485
|
-
function move(src, dest, opts, cb) {
|
|
2486
|
-
if (typeof opts === "function") {
|
|
2487
|
-
cb = opts;
|
|
2488
|
-
opts = {};
|
|
2489
|
-
}
|
|
2490
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2491
|
-
src = path4.resolve(src);
|
|
2492
|
-
dest = path4.resolve(dest);
|
|
2493
|
-
if (src === dest) return fs5.access(src, cb);
|
|
2494
|
-
fs5.stat(src, (err, st) => {
|
|
2495
|
-
if (err) return cb(err);
|
|
2496
|
-
if (st.isDirectory() && isSrcSubdir(src, dest)) {
|
|
2497
|
-
return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`));
|
|
2498
|
-
}
|
|
2499
|
-
mkdirp(path4.dirname(dest), (err2) => {
|
|
2500
|
-
if (err2) return cb(err2);
|
|
2501
|
-
return doRename(src, dest, overwrite, cb);
|
|
2502
|
-
});
|
|
2503
|
-
});
|
|
2504
|
-
}
|
|
2505
|
-
function doRename(src, dest, overwrite, cb) {
|
|
2506
|
-
if (overwrite) {
|
|
2507
|
-
return remove(dest, (err) => {
|
|
2508
|
-
if (err) return cb(err);
|
|
2509
|
-
return rename(src, dest, overwrite, cb);
|
|
2510
|
-
});
|
|
2511
|
-
}
|
|
2512
|
-
pathExists(dest, (err, destExists) => {
|
|
2513
|
-
if (err) return cb(err);
|
|
2514
|
-
if (destExists) return cb(new Error("dest already exists."));
|
|
2515
|
-
return rename(src, dest, overwrite, cb);
|
|
2516
|
-
});
|
|
2517
|
-
}
|
|
2518
|
-
function rename(src, dest, overwrite, cb) {
|
|
2519
|
-
fs5.rename(src, dest, (err) => {
|
|
2520
|
-
if (!err) return cb();
|
|
2521
|
-
if (err.code !== "EXDEV") return cb(err);
|
|
2522
|
-
return moveAcrossDevice(src, dest, overwrite, cb);
|
|
2523
|
-
});
|
|
2524
|
-
}
|
|
2525
|
-
function moveAcrossDevice(src, dest, overwrite, cb) {
|
|
2526
|
-
const opts = {
|
|
2527
|
-
overwrite,
|
|
2528
|
-
errorOnExist: true
|
|
2529
|
-
};
|
|
2530
|
-
copy2(src, dest, opts, (err) => {
|
|
2531
|
-
if (err) return cb(err);
|
|
2532
|
-
return remove(src, cb);
|
|
2533
|
-
});
|
|
2534
|
-
}
|
|
2535
|
-
function isSrcSubdir(src, dest) {
|
|
2536
|
-
const srcArray = src.split(path4.sep);
|
|
2537
|
-
const destArray = dest.split(path4.sep);
|
|
2538
|
-
return srcArray.reduce((acc, current, i) => {
|
|
2539
|
-
return acc && destArray[i] === current;
|
|
2540
|
-
}, true);
|
|
2541
|
-
}
|
|
2542
|
-
module.exports = {
|
|
2543
|
-
move: u(move)
|
|
2544
|
-
};
|
|
2545
|
-
}
|
|
2546
|
-
});
|
|
2547
|
-
|
|
2548
|
-
// ../../node_modules/fs-extra/lib/output/index.js
|
|
2549
|
-
var require_output = __commonJS({
|
|
2550
|
-
"../../node_modules/fs-extra/lib/output/index.js"(exports, module) {
|
|
2551
|
-
"use strict";
|
|
2552
|
-
var u = require_universalify().fromCallback;
|
|
2553
|
-
var fs5 = require_graceful_fs();
|
|
2554
|
-
var path4 = __require("path");
|
|
2555
|
-
var mkdir = require_mkdirs2();
|
|
2556
|
-
var pathExists = require_path_exists().pathExists;
|
|
2557
|
-
function outputFile(file, data, encoding, callback) {
|
|
2558
|
-
if (typeof encoding === "function") {
|
|
2559
|
-
callback = encoding;
|
|
2560
|
-
encoding = "utf8";
|
|
2561
|
-
}
|
|
2562
|
-
const dir = path4.dirname(file);
|
|
2563
|
-
pathExists(dir, (err, itDoes) => {
|
|
2564
|
-
if (err) return callback(err);
|
|
2565
|
-
if (itDoes) return fs5.writeFile(file, data, encoding, callback);
|
|
2566
|
-
mkdir.mkdirs(dir, (err2) => {
|
|
2567
|
-
if (err2) return callback(err2);
|
|
2568
|
-
fs5.writeFile(file, data, encoding, callback);
|
|
2569
|
-
});
|
|
2570
|
-
});
|
|
2571
|
-
}
|
|
2572
|
-
function outputFileSync(file, ...args) {
|
|
2573
|
-
const dir = path4.dirname(file);
|
|
2574
|
-
if (fs5.existsSync(dir)) {
|
|
2575
|
-
return fs5.writeFileSync(file, ...args);
|
|
2576
|
-
}
|
|
2577
|
-
mkdir.mkdirsSync(dir);
|
|
2578
|
-
fs5.writeFileSync(file, ...args);
|
|
2579
|
-
}
|
|
2580
|
-
module.exports = {
|
|
2581
|
-
outputFile: u(outputFile),
|
|
2582
|
-
outputFileSync
|
|
2583
|
-
};
|
|
2584
|
-
}
|
|
2585
|
-
});
|
|
2586
|
-
|
|
2587
|
-
// ../../node_modules/fs-extra/lib/index.js
|
|
2588
|
-
var require_lib = __commonJS({
|
|
2589
|
-
"../../node_modules/fs-extra/lib/index.js"(exports, module) {
|
|
2590
|
-
"use strict";
|
|
2591
|
-
module.exports = Object.assign(
|
|
2592
|
-
{},
|
|
2593
|
-
// Export promiseified graceful-fs:
|
|
2594
|
-
require_fs(),
|
|
2595
|
-
// Export extra methods:
|
|
2596
|
-
require_copy_sync2(),
|
|
2597
|
-
require_copy2(),
|
|
2598
|
-
require_empty(),
|
|
2599
|
-
require_ensure(),
|
|
2600
|
-
require_json(),
|
|
2601
|
-
require_mkdirs2(),
|
|
2602
|
-
require_move_sync(),
|
|
2603
|
-
require_move(),
|
|
2604
|
-
require_output(),
|
|
2605
|
-
require_path_exists(),
|
|
2606
|
-
require_remove()
|
|
2607
|
-
);
|
|
2608
|
-
var fs5 = __require("fs");
|
|
2609
|
-
if (Object.getOwnPropertyDescriptor(fs5, "promises")) {
|
|
2610
|
-
Object.defineProperty(module.exports, "promises", {
|
|
2611
|
-
get() {
|
|
2612
|
-
return fs5.promises;
|
|
2613
|
-
}
|
|
2614
|
-
});
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
});
|
|
2618
7
|
|
|
2619
8
|
// index.ts
|
|
2620
9
|
import pc4 from "picocolors";
|
|
@@ -2679,7 +68,7 @@ var checkThatNpmCanReadCwd = () => {
|
|
|
2679
68
|
let childOutput = null;
|
|
2680
69
|
try {
|
|
2681
70
|
childOutput = spawn.sync("npm", ["config", "list"]).output.join("");
|
|
2682
|
-
} catch
|
|
71
|
+
} catch {
|
|
2683
72
|
return true;
|
|
2684
73
|
}
|
|
2685
74
|
if (typeof childOutput !== "string") {
|
|
@@ -2738,7 +127,7 @@ var checkPnpmVersion = () => {
|
|
|
2738
127
|
hasMinPnpm = semver.gte(trimmedPnpmVersionMatch[1], minPnpm);
|
|
2739
128
|
}
|
|
2740
129
|
}
|
|
2741
|
-
} catch
|
|
130
|
+
} catch {
|
|
2742
131
|
}
|
|
2743
132
|
return { hasMinPnpm, pnpmVersion };
|
|
2744
133
|
};
|
|
@@ -2763,7 +152,7 @@ var checkYarnVersion = () => {
|
|
|
2763
152
|
}
|
|
2764
153
|
}
|
|
2765
154
|
}
|
|
2766
|
-
} catch
|
|
155
|
+
} catch {
|
|
2767
156
|
}
|
|
2768
157
|
return {
|
|
2769
158
|
hasMinYarnPnp,
|
|
@@ -2777,7 +166,7 @@ var checkNpmVersion = () => {
|
|
|
2777
166
|
try {
|
|
2778
167
|
npmVersion = execSync("npm --version").toString().trim();
|
|
2779
168
|
hasMinNpm = semver.gte(npmVersion, "6.0.0");
|
|
2780
|
-
} catch
|
|
169
|
+
} catch {
|
|
2781
170
|
}
|
|
2782
171
|
return {
|
|
2783
172
|
hasMinNpm,
|
|
@@ -2791,7 +180,7 @@ var getProxy = () => {
|
|
|
2791
180
|
try {
|
|
2792
181
|
const httpsProxy = execSync("npm config get https-proxy").toString().trim();
|
|
2793
182
|
return httpsProxy !== "null" ? httpsProxy : void 0;
|
|
2794
|
-
} catch
|
|
183
|
+
} catch {
|
|
2795
184
|
}
|
|
2796
185
|
return "";
|
|
2797
186
|
};
|
|
@@ -2823,12 +212,12 @@ import os2 from "os";
|
|
|
2823
212
|
import path2 from "path";
|
|
2824
213
|
|
|
2825
214
|
// git.ts
|
|
2826
|
-
var fse = __toESM(require_lib(), 1);
|
|
2827
215
|
import os from "os";
|
|
2828
216
|
import path from "path";
|
|
2829
217
|
import fs from "fs";
|
|
2830
218
|
import debug from "debug";
|
|
2831
219
|
import { simpleGit } from "simple-git";
|
|
220
|
+
import * as fse from "fs-extra";
|
|
2832
221
|
var log = debug("cna:git");
|
|
2833
222
|
var filterGit = (src) => {
|
|
2834
223
|
return !/(\\|\/)\.git\b/.test(src);
|
|
@@ -2906,13 +295,38 @@ var downloadRepository = async ({
|
|
|
2906
295
|
// paths.ts
|
|
2907
296
|
var solveValuesFromTemplateOrExtensionUrl = (templateOrExtension) => {
|
|
2908
297
|
const url = new URL(templateOrExtension);
|
|
2909
|
-
const origin = `${url.protocol}//${url.host}`;
|
|
2910
|
-
const [org, repo, , branch = "", ...subdir] = url.pathname.slice(1).split("/");
|
|
2911
298
|
const ignorePackage = url.searchParams.get("ignorePackage") === "true";
|
|
299
|
+
if (url.protocol === "file:") {
|
|
300
|
+
let pathname = decodeURIComponent(url.pathname);
|
|
301
|
+
if (process.platform === "win32" && /^\/[A-Za-z]:\//.test(pathname)) {
|
|
302
|
+
pathname = pathname.slice(1);
|
|
303
|
+
}
|
|
304
|
+
const subdirParam = url.searchParams.get("subdir") || "";
|
|
305
|
+
return {
|
|
306
|
+
url: templateOrExtension,
|
|
307
|
+
// not used for git cloning when file://
|
|
308
|
+
branch: "",
|
|
309
|
+
subdir: subdirParam,
|
|
310
|
+
protocol: url.protocol,
|
|
311
|
+
host: "",
|
|
312
|
+
// host is unused for file
|
|
313
|
+
pathname,
|
|
314
|
+
ignorePackage
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
const origin = `${url.protocol}//${url.host}`;
|
|
318
|
+
const parts = url.pathname.slice(1).split("/");
|
|
319
|
+
const [org, repo] = parts;
|
|
320
|
+
let branch = "";
|
|
321
|
+
let subdir = "";
|
|
322
|
+
if (parts[2] === "tree") {
|
|
323
|
+
branch = parts[3] || "";
|
|
324
|
+
subdir = parts.slice(4).join("/");
|
|
325
|
+
}
|
|
2912
326
|
return {
|
|
2913
327
|
url: `${origin}/${org}/${repo}`,
|
|
2914
328
|
branch,
|
|
2915
|
-
subdir
|
|
329
|
+
subdir,
|
|
2916
330
|
protocol: url.protocol,
|
|
2917
331
|
host: url.host,
|
|
2918
332
|
pathname: url.pathname,
|
|
@@ -2929,6 +343,9 @@ var solveRepositoryPath = async ({
|
|
|
2929
343
|
"base64"
|
|
2930
344
|
);
|
|
2931
345
|
const target = path2.join(os2.homedir(), ".cna", targetWithSubdir);
|
|
346
|
+
if (process.env.CNA_SKIP_GIT === "1") {
|
|
347
|
+
return { dir: target, subdir };
|
|
348
|
+
}
|
|
2932
349
|
try {
|
|
2933
350
|
await downloadRepository({
|
|
2934
351
|
url,
|
|
@@ -2942,19 +359,13 @@ var solveRepositoryPath = async ({
|
|
|
2942
359
|
};
|
|
2943
360
|
var solveTemplateOrExtensionPath = async (templateOrExtension) => {
|
|
2944
361
|
try {
|
|
2945
|
-
const { url, branch, subdir, protocol,
|
|
362
|
+
const { url, branch, subdir, protocol, pathname, ignorePackage } = solveValuesFromTemplateOrExtensionUrl(templateOrExtension);
|
|
2946
363
|
if (protocol === "file:") {
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
subdir
|
|
2950
|
-
};
|
|
364
|
+
const baseDir = pathname;
|
|
365
|
+
return { dir: baseDir, subdir, ignorePackage };
|
|
2951
366
|
}
|
|
2952
|
-
const gitData = await solveRepositoryPath({
|
|
2953
|
-
|
|
2954
|
-
branch,
|
|
2955
|
-
subdir
|
|
2956
|
-
});
|
|
2957
|
-
return { ...gitData, ignorePackage };
|
|
367
|
+
const gitData = await solveRepositoryPath({ url, branch, subdir });
|
|
368
|
+
return { dir: gitData.dir, subdir: gitData.subdir, ignorePackage };
|
|
2958
369
|
} catch {
|
|
2959
370
|
return {
|
|
2960
371
|
dir: path2.resolve(
|
|
@@ -2963,6 +374,7 @@ var solveTemplateOrExtensionPath = async (templateOrExtension) => {
|
|
|
2963
374
|
"templatesOrExtensions",
|
|
2964
375
|
templateOrExtension
|
|
2965
376
|
),
|
|
377
|
+
subdir: void 0,
|
|
2966
378
|
ignorePackage: void 0
|
|
2967
379
|
};
|
|
2968
380
|
}
|
|
@@ -3279,7 +691,8 @@ var fileLoader = ({
|
|
|
3279
691
|
copy: copyLoader,
|
|
3280
692
|
append: appendLoader,
|
|
3281
693
|
copyTemplate: templateLoader,
|
|
3282
|
-
appendTemplate
|
|
694
|
+
// appendTemplate means treat as a template (interpolate) but append instead of overwrite
|
|
695
|
+
appendTemplate: templateLoader
|
|
3283
696
|
};
|
|
3284
697
|
await loaders[mode]({
|
|
3285
698
|
root,
|
|
@@ -3321,23 +734,39 @@ var loadFiles = async ({
|
|
|
3321
734
|
const operations = [];
|
|
3322
735
|
for await (const { url: templateOrExtensionUrl } of templatesOrExtensions) {
|
|
3323
736
|
const templateDir = await getTemplateDirPath(templateOrExtensionUrl);
|
|
737
|
+
if (verbose) {
|
|
738
|
+
try {
|
|
739
|
+
const stat = fs3.existsSync(templateDir) ? fs3.statSync(templateDir) : void 0;
|
|
740
|
+
console.log(
|
|
741
|
+
pc2.dim(
|
|
742
|
+
`[cna] Template dir resolved: ${templateDir} exists=${!!stat} isDir=$${stat?.isDirectory?.()}`
|
|
743
|
+
)
|
|
744
|
+
);
|
|
745
|
+
} catch {
|
|
746
|
+
}
|
|
747
|
+
}
|
|
3324
748
|
if (fs3.existsSync(templateDir) && fs3.statSync(templateDir).isDirectory()) {
|
|
749
|
+
let debugFirst = true;
|
|
750
|
+
const skipGlobs = [
|
|
751
|
+
/\bpackage\.js$/,
|
|
752
|
+
/\bpackage\.json$/,
|
|
753
|
+
/\bpackage-lock\.json$/,
|
|
754
|
+
/\btemplate\.json$/,
|
|
755
|
+
/\byarn\.lock$/,
|
|
756
|
+
/\bpnpm-lock\.yaml$/
|
|
757
|
+
];
|
|
758
|
+
const skipManager = usePnpm ? [/\.if-npm\./, /\.if-yarn\./] : useYarn ? [/\.if-npm\./, /\.if-pnpm\./] : [/\.if-yarn\./, /\.if-pnpm\./];
|
|
759
|
+
const shouldSkip = (p) => [...skipGlobs, ...skipManager].some((rgx) => rgx.test(p));
|
|
3325
760
|
for await (const entry of readdirp(templateDir, {
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
"!package.json",
|
|
3329
|
-
"!package-lock.json",
|
|
3330
|
-
"!template.json",
|
|
3331
|
-
"!yarn.lock",
|
|
3332
|
-
"!pnpm-lock.yaml",
|
|
3333
|
-
// based on the package manager we want to ignore files containing
|
|
3334
|
-
// the other package as condition.
|
|
3335
|
-
// For example, if `usePnpm` is true, the we need to ignore
|
|
3336
|
-
// all files with `.if-npm` or `.if-yarn` somewhere in the name.
|
|
3337
|
-
...usePnpm ? ["!*.if-npm.*", "!*.if-yarn.*"] : useYarn ? ["!*.if-npm.*", "!*.if-pnpm.*"] : ["!*.if-yarn.*", "!*.if-pnpm.*"]
|
|
3338
|
-
],
|
|
3339
|
-
directoryFilter: ["!package"]
|
|
761
|
+
type: "files",
|
|
762
|
+
alwaysStat: false
|
|
3340
763
|
})) {
|
|
764
|
+
if (shouldSkip(entry.path)) continue;
|
|
765
|
+
if (entry.path.startsWith("package/")) continue;
|
|
766
|
+
if (verbose && debugFirst) {
|
|
767
|
+
console.log(pc2.dim(`[cna] First discovered file: ${entry.path}`));
|
|
768
|
+
debugFirst = false;
|
|
769
|
+
}
|
|
3341
770
|
operations.push({
|
|
3342
771
|
root,
|
|
3343
772
|
templateDir,
|
|
@@ -3355,6 +784,20 @@ var loadFiles = async ({
|
|
|
3355
784
|
}
|
|
3356
785
|
}
|
|
3357
786
|
}
|
|
787
|
+
if (verbose) {
|
|
788
|
+
console.log(
|
|
789
|
+
pc2.dim(
|
|
790
|
+
`[cna] Prepared ${operations.length} file operations from ${templatesOrExtensions.length} template(s)`
|
|
791
|
+
)
|
|
792
|
+
);
|
|
793
|
+
if (operations.length === 0) {
|
|
794
|
+
console.log(
|
|
795
|
+
pc2.yellow(
|
|
796
|
+
"[cna] No files discovered. Check that the template repository was cloned and fileFilter patterns are correct."
|
|
797
|
+
)
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
3358
801
|
await Promise.all(
|
|
3359
802
|
operations.map((operation) => fileLoader(operation)(operation.entry))
|
|
3360
803
|
);
|
|
@@ -3414,7 +857,7 @@ var install = async (root, useYarn = false, usePnpm = false, dependencies = [],
|
|
|
3414
857
|
cwd: root,
|
|
3415
858
|
stdio: "inherit"
|
|
3416
859
|
});
|
|
3417
|
-
} catch
|
|
860
|
+
} catch {
|
|
3418
861
|
throw new Error(`${command} ${args.join(" ")}`);
|
|
3419
862
|
}
|
|
3420
863
|
};
|
|
@@ -3425,7 +868,7 @@ var runCommandInProjectDir = async (root, command, args = [], successMessage = "
|
|
|
3425
868
|
stdio: "ignore"
|
|
3426
869
|
});
|
|
3427
870
|
console.log(pc3.green(successMessage));
|
|
3428
|
-
} catch
|
|
871
|
+
} catch {
|
|
3429
872
|
console.log();
|
|
3430
873
|
console.log(pc3.red(errorMessage));
|
|
3431
874
|
console.log();
|
|
@@ -3550,7 +993,7 @@ var run = async ({
|
|
|
3550
993
|
const git = simpleGit2(root);
|
|
3551
994
|
await git.init();
|
|
3552
995
|
console.log(pc3.green("Successfully initialized git repository."));
|
|
3553
|
-
} catch
|
|
996
|
+
} catch {
|
|
3554
997
|
console.log();
|
|
3555
998
|
console.log(
|
|
3556
999
|
pc3.red(
|
|
@@ -3679,7 +1122,7 @@ Please update to npm 3 or higher for a better, fully supported experience.
|
|
|
3679
1122
|
let yarnUsesDefaultRegistry = true;
|
|
3680
1123
|
try {
|
|
3681
1124
|
yarnUsesDefaultRegistry = execSync2("yarnpkg config get registry").toString().trim() === "https://registry.yarnpkg.com";
|
|
3682
|
-
} catch
|
|
1125
|
+
} catch {
|
|
3683
1126
|
}
|
|
3684
1127
|
if (false) {
|
|
3685
1128
|
fs4.cpSync(
|
|
@@ -3732,7 +1175,7 @@ var checkForLatestVersion = async (packageName) => {
|
|
|
3732
1175
|
return String(json["latest"]);
|
|
3733
1176
|
}
|
|
3734
1177
|
return null;
|
|
3735
|
-
} catch
|
|
1178
|
+
} catch {
|
|
3736
1179
|
try {
|
|
3737
1180
|
return execSync3(`npm view ${packageName} version`).toString().trim();
|
|
3738
1181
|
} catch {
|
|
@@ -3781,5 +1224,9 @@ export {
|
|
|
3781
1224
|
checkForLatestVersion,
|
|
3782
1225
|
checkNodeVersion,
|
|
3783
1226
|
createNodeApp,
|
|
1227
|
+
downloadRepository,
|
|
1228
|
+
getPackagePath,
|
|
1229
|
+
getTemplateDirPath,
|
|
3784
1230
|
printEnvInfo
|
|
3785
1231
|
};
|
|
1232
|
+
//# sourceMappingURL=index.js.map
|