@vivliostyle/cli 8.1.0 → 8.1.1
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/const.d.ts +0 -1
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +0 -1
- package/dist/const.js.map +1 -1
- package/dist/input/config.d.ts +1 -12
- package/dist/input/config.d.ts.map +1 -1
- package/dist/input/config.js +1 -33
- package/dist/input/config.js.map +1 -1
- package/dist/processor/compile.d.ts.map +1 -1
- package/dist/processor/compile.js +17 -29
- package/dist/processor/compile.js.map +1 -1
- package/dist/processor/html.d.ts +0 -7
- package/dist/processor/html.d.ts.map +1 -1
- package/dist/processor/html.js +0 -38
- package/dist/processor/html.js.map +1 -1
- package/package.json +1 -1
- package/vendors/index.js +2029 -0
package/vendors/index.js
ADDED
|
@@ -0,0 +1,2029 @@
|
|
|
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
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/upath/build/code/upath.js
|
|
28
|
+
import __import_path from "path";
|
|
29
|
+
var require_upath = __commonJS({
|
|
30
|
+
"node_modules/upath/build/code/upath.js"(exports) {
|
|
31
|
+
var VERSION = "2.0.1";
|
|
32
|
+
var extraFn;
|
|
33
|
+
var extraFunctions;
|
|
34
|
+
var isFunction;
|
|
35
|
+
var isString;
|
|
36
|
+
var isValidExt;
|
|
37
|
+
var name;
|
|
38
|
+
var path;
|
|
39
|
+
var propName;
|
|
40
|
+
var propValue;
|
|
41
|
+
var toUnix;
|
|
42
|
+
var upath2;
|
|
43
|
+
var slice = [].slice;
|
|
44
|
+
var indexOf = [].indexOf || function(item) {
|
|
45
|
+
for (var i = 0, l = this.length; i < l; i++) {
|
|
46
|
+
if (i in this && this[i] === item)
|
|
47
|
+
return i;
|
|
48
|
+
}
|
|
49
|
+
return -1;
|
|
50
|
+
};
|
|
51
|
+
var hasProp = {}.hasOwnProperty;
|
|
52
|
+
path = __import_path;
|
|
53
|
+
isFunction = function(val) {
|
|
54
|
+
return typeof val === "function";
|
|
55
|
+
};
|
|
56
|
+
isString = function(val) {
|
|
57
|
+
return typeof val === "string" || !!val && typeof val === "object" && Object.prototype.toString.call(val) === "[object String]";
|
|
58
|
+
};
|
|
59
|
+
upath2 = exports;
|
|
60
|
+
upath2.VERSION = typeof VERSION !== "undefined" && VERSION !== null ? VERSION : "NO-VERSION";
|
|
61
|
+
toUnix = function(p) {
|
|
62
|
+
p = p.replace(/\\/g, "/");
|
|
63
|
+
p = p.replace(/(?<!^)\/+/g, "/");
|
|
64
|
+
return p;
|
|
65
|
+
};
|
|
66
|
+
for (propName in path) {
|
|
67
|
+
propValue = path[propName];
|
|
68
|
+
if (isFunction(propValue)) {
|
|
69
|
+
upath2[propName] = function(propName2) {
|
|
70
|
+
return function() {
|
|
71
|
+
var args, result;
|
|
72
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
73
|
+
args = args.map(function(p) {
|
|
74
|
+
if (isString(p)) {
|
|
75
|
+
return toUnix(p);
|
|
76
|
+
} else {
|
|
77
|
+
return p;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
result = path[propName2].apply(path, args);
|
|
81
|
+
if (isString(result)) {
|
|
82
|
+
return toUnix(result);
|
|
83
|
+
} else {
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}(propName);
|
|
88
|
+
} else {
|
|
89
|
+
upath2[propName] = propValue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
upath2.sep = "/";
|
|
93
|
+
extraFunctions = {
|
|
94
|
+
toUnix,
|
|
95
|
+
normalizeSafe: function(p) {
|
|
96
|
+
var result;
|
|
97
|
+
p = toUnix(p);
|
|
98
|
+
result = upath2.normalize(p);
|
|
99
|
+
if (p.startsWith("./") && !result.startsWith("./") && !result.startsWith("..")) {
|
|
100
|
+
result = "./" + result;
|
|
101
|
+
} else if (p.startsWith("//") && !result.startsWith("//")) {
|
|
102
|
+
if (p.startsWith("//./")) {
|
|
103
|
+
result = "//." + result;
|
|
104
|
+
} else {
|
|
105
|
+
result = "/" + result;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
},
|
|
110
|
+
normalizeTrim: function(p) {
|
|
111
|
+
p = upath2.normalizeSafe(p);
|
|
112
|
+
if (p.endsWith("/")) {
|
|
113
|
+
return p.slice(0, +(p.length - 2) + 1 || 9e9);
|
|
114
|
+
} else {
|
|
115
|
+
return p;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
joinSafe: function() {
|
|
119
|
+
var p, p0, result;
|
|
120
|
+
p = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
121
|
+
result = upath2.join.apply(null, p);
|
|
122
|
+
if (p.length > 0) {
|
|
123
|
+
p0 = toUnix(p[0]);
|
|
124
|
+
if (p0.startsWith("./") && !result.startsWith("./") && !result.startsWith("..")) {
|
|
125
|
+
result = "./" + result;
|
|
126
|
+
} else if (p0.startsWith("//") && !result.startsWith("//")) {
|
|
127
|
+
if (p0.startsWith("//./")) {
|
|
128
|
+
result = "//." + result;
|
|
129
|
+
} else {
|
|
130
|
+
result = "/" + result;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
},
|
|
136
|
+
addExt: function(file, ext) {
|
|
137
|
+
if (!ext) {
|
|
138
|
+
return file;
|
|
139
|
+
} else {
|
|
140
|
+
if (ext[0] !== ".") {
|
|
141
|
+
ext = "." + ext;
|
|
142
|
+
}
|
|
143
|
+
return file + (file.endsWith(ext) ? "" : ext);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
trimExt: function(filename, ignoreExts, maxSize) {
|
|
147
|
+
var oldExt;
|
|
148
|
+
if (maxSize == null) {
|
|
149
|
+
maxSize = 7;
|
|
150
|
+
}
|
|
151
|
+
oldExt = upath2.extname(filename);
|
|
152
|
+
if (isValidExt(oldExt, ignoreExts, maxSize)) {
|
|
153
|
+
return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9e9);
|
|
154
|
+
} else {
|
|
155
|
+
return filename;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
removeExt: function(filename, ext) {
|
|
159
|
+
if (!ext) {
|
|
160
|
+
return filename;
|
|
161
|
+
} else {
|
|
162
|
+
ext = ext[0] === "." ? ext : "." + ext;
|
|
163
|
+
if (upath2.extname(filename) === ext) {
|
|
164
|
+
return upath2.trimExt(filename, [], ext.length);
|
|
165
|
+
} else {
|
|
166
|
+
return filename;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
changeExt: function(filename, ext, ignoreExts, maxSize) {
|
|
171
|
+
if (maxSize == null) {
|
|
172
|
+
maxSize = 7;
|
|
173
|
+
}
|
|
174
|
+
return upath2.trimExt(filename, ignoreExts, maxSize) + (!ext ? "" : ext[0] === "." ? ext : "." + ext);
|
|
175
|
+
},
|
|
176
|
+
defaultExt: function(filename, ext, ignoreExts, maxSize) {
|
|
177
|
+
var oldExt;
|
|
178
|
+
if (maxSize == null) {
|
|
179
|
+
maxSize = 7;
|
|
180
|
+
}
|
|
181
|
+
oldExt = upath2.extname(filename);
|
|
182
|
+
if (isValidExt(oldExt, ignoreExts, maxSize)) {
|
|
183
|
+
return filename;
|
|
184
|
+
} else {
|
|
185
|
+
return upath2.addExt(filename, ext);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
isValidExt = function(ext, ignoreExts, maxSize) {
|
|
190
|
+
if (ignoreExts == null) {
|
|
191
|
+
ignoreExts = [];
|
|
192
|
+
}
|
|
193
|
+
return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map(function(e) {
|
|
194
|
+
return (e && e[0] !== "." ? "." : "") + e;
|
|
195
|
+
}), ext) < 0;
|
|
196
|
+
};
|
|
197
|
+
for (name in extraFunctions) {
|
|
198
|
+
if (!hasProp.call(extraFunctions, name))
|
|
199
|
+
continue;
|
|
200
|
+
extraFn = extraFunctions[name];
|
|
201
|
+
if (upath2[name] !== void 0) {
|
|
202
|
+
throw new Error("path." + name + " already exists.");
|
|
203
|
+
} else {
|
|
204
|
+
upath2[name] = extraFn;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// node_modules/universalify/index.js
|
|
211
|
+
var require_universalify = __commonJS({
|
|
212
|
+
"node_modules/universalify/index.js"(exports) {
|
|
213
|
+
"use strict";
|
|
214
|
+
exports.fromCallback = function(fn) {
|
|
215
|
+
return Object.defineProperty(function(...args) {
|
|
216
|
+
if (typeof args[args.length - 1] === "function")
|
|
217
|
+
fn.apply(this, args);
|
|
218
|
+
else {
|
|
219
|
+
return new Promise((resolve, reject) => {
|
|
220
|
+
fn.call(
|
|
221
|
+
this,
|
|
222
|
+
...args,
|
|
223
|
+
(err, res) => err != null ? reject(err) : resolve(res)
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}, "name", { value: fn.name });
|
|
228
|
+
};
|
|
229
|
+
exports.fromPromise = function(fn) {
|
|
230
|
+
return Object.defineProperty(function(...args) {
|
|
231
|
+
const cb = args[args.length - 1];
|
|
232
|
+
if (typeof cb !== "function")
|
|
233
|
+
return fn.apply(this, args);
|
|
234
|
+
else
|
|
235
|
+
fn.apply(this, args.slice(0, -1)).then((r) => cb(null, r), cb);
|
|
236
|
+
}, "name", { value: fn.name });
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// node_modules/graceful-fs/polyfills.js
|
|
242
|
+
import __import_constants from "constants";
|
|
243
|
+
var require_polyfills = __commonJS({
|
|
244
|
+
"node_modules/graceful-fs/polyfills.js"(exports, module) {
|
|
245
|
+
var constants = __import_constants;
|
|
246
|
+
var origCwd = process.cwd;
|
|
247
|
+
var cwd = null;
|
|
248
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
249
|
+
process.cwd = function() {
|
|
250
|
+
if (!cwd)
|
|
251
|
+
cwd = origCwd.call(process);
|
|
252
|
+
return cwd;
|
|
253
|
+
};
|
|
254
|
+
try {
|
|
255
|
+
process.cwd();
|
|
256
|
+
} catch (er) {
|
|
257
|
+
}
|
|
258
|
+
if (typeof process.chdir === "function") {
|
|
259
|
+
chdir = process.chdir;
|
|
260
|
+
process.chdir = function(d) {
|
|
261
|
+
cwd = null;
|
|
262
|
+
chdir.call(process, d);
|
|
263
|
+
};
|
|
264
|
+
if (Object.setPrototypeOf)
|
|
265
|
+
Object.setPrototypeOf(process.chdir, chdir);
|
|
266
|
+
}
|
|
267
|
+
var chdir;
|
|
268
|
+
module.exports = patch;
|
|
269
|
+
function patch(fs) {
|
|
270
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
271
|
+
patchLchmod(fs);
|
|
272
|
+
}
|
|
273
|
+
if (!fs.lutimes) {
|
|
274
|
+
patchLutimes(fs);
|
|
275
|
+
}
|
|
276
|
+
fs.chown = chownFix(fs.chown);
|
|
277
|
+
fs.fchown = chownFix(fs.fchown);
|
|
278
|
+
fs.lchown = chownFix(fs.lchown);
|
|
279
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
280
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
281
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
282
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
283
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
284
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
285
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
286
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
287
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
288
|
+
fs.stat = statFix(fs.stat);
|
|
289
|
+
fs.fstat = statFix(fs.fstat);
|
|
290
|
+
fs.lstat = statFix(fs.lstat);
|
|
291
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
292
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
293
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
294
|
+
if (fs.chmod && !fs.lchmod) {
|
|
295
|
+
fs.lchmod = function(path, mode, cb) {
|
|
296
|
+
if (cb)
|
|
297
|
+
process.nextTick(cb);
|
|
298
|
+
};
|
|
299
|
+
fs.lchmodSync = function() {
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
if (fs.chown && !fs.lchown) {
|
|
303
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
304
|
+
if (cb)
|
|
305
|
+
process.nextTick(cb);
|
|
306
|
+
};
|
|
307
|
+
fs.lchownSync = function() {
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
if (platform === "win32") {
|
|
311
|
+
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
|
|
312
|
+
function rename(from, to, cb) {
|
|
313
|
+
var start = Date.now();
|
|
314
|
+
var backoff = 0;
|
|
315
|
+
fs$rename(from, to, function CB(er) {
|
|
316
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
|
|
317
|
+
setTimeout(function() {
|
|
318
|
+
fs.stat(to, function(stater, st) {
|
|
319
|
+
if (stater && stater.code === "ENOENT")
|
|
320
|
+
fs$rename(from, to, CB);
|
|
321
|
+
else
|
|
322
|
+
cb(er);
|
|
323
|
+
});
|
|
324
|
+
}, backoff);
|
|
325
|
+
if (backoff < 100)
|
|
326
|
+
backoff += 10;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (cb)
|
|
330
|
+
cb(er);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (Object.setPrototypeOf)
|
|
334
|
+
Object.setPrototypeOf(rename, fs$rename);
|
|
335
|
+
return rename;
|
|
336
|
+
}(fs.rename);
|
|
337
|
+
}
|
|
338
|
+
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
|
|
339
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
340
|
+
var callback;
|
|
341
|
+
if (callback_ && typeof callback_ === "function") {
|
|
342
|
+
var eagCounter = 0;
|
|
343
|
+
callback = function(er, _, __) {
|
|
344
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
345
|
+
eagCounter++;
|
|
346
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
347
|
+
}
|
|
348
|
+
callback_.apply(this, arguments);
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
352
|
+
}
|
|
353
|
+
if (Object.setPrototypeOf)
|
|
354
|
+
Object.setPrototypeOf(read, fs$read);
|
|
355
|
+
return read;
|
|
356
|
+
}(fs.read);
|
|
357
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
|
|
358
|
+
return function(fd, buffer, offset, length, position) {
|
|
359
|
+
var eagCounter = 0;
|
|
360
|
+
while (true) {
|
|
361
|
+
try {
|
|
362
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
363
|
+
} catch (er) {
|
|
364
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
365
|
+
eagCounter++;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
throw er;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}(fs.readSync);
|
|
373
|
+
function patchLchmod(fs2) {
|
|
374
|
+
fs2.lchmod = function(path, mode, callback) {
|
|
375
|
+
fs2.open(
|
|
376
|
+
path,
|
|
377
|
+
constants.O_WRONLY | constants.O_SYMLINK,
|
|
378
|
+
mode,
|
|
379
|
+
function(err, fd) {
|
|
380
|
+
if (err) {
|
|
381
|
+
if (callback)
|
|
382
|
+
callback(err);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
fs2.fchmod(fd, mode, function(err2) {
|
|
386
|
+
fs2.close(fd, function(err22) {
|
|
387
|
+
if (callback)
|
|
388
|
+
callback(err2 || err22);
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
fs2.lchmodSync = function(path, mode) {
|
|
395
|
+
var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
396
|
+
var threw = true;
|
|
397
|
+
var ret;
|
|
398
|
+
try {
|
|
399
|
+
ret = fs2.fchmodSync(fd, mode);
|
|
400
|
+
threw = false;
|
|
401
|
+
} finally {
|
|
402
|
+
if (threw) {
|
|
403
|
+
try {
|
|
404
|
+
fs2.closeSync(fd);
|
|
405
|
+
} catch (er) {
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
fs2.closeSync(fd);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return ret;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function patchLutimes(fs2) {
|
|
415
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
416
|
+
fs2.lutimes = function(path, at, mt, cb) {
|
|
417
|
+
fs2.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
418
|
+
if (er) {
|
|
419
|
+
if (cb)
|
|
420
|
+
cb(er);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
fs2.futimes(fd, at, mt, function(er2) {
|
|
424
|
+
fs2.close(fd, function(er22) {
|
|
425
|
+
if (cb)
|
|
426
|
+
cb(er2 || er22);
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
fs2.lutimesSync = function(path, at, mt) {
|
|
432
|
+
var fd = fs2.openSync(path, constants.O_SYMLINK);
|
|
433
|
+
var ret;
|
|
434
|
+
var threw = true;
|
|
435
|
+
try {
|
|
436
|
+
ret = fs2.futimesSync(fd, at, mt);
|
|
437
|
+
threw = false;
|
|
438
|
+
} finally {
|
|
439
|
+
if (threw) {
|
|
440
|
+
try {
|
|
441
|
+
fs2.closeSync(fd);
|
|
442
|
+
} catch (er) {
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
fs2.closeSync(fd);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return ret;
|
|
449
|
+
};
|
|
450
|
+
} else if (fs2.futimes) {
|
|
451
|
+
fs2.lutimes = function(_a, _b, _c, cb) {
|
|
452
|
+
if (cb)
|
|
453
|
+
process.nextTick(cb);
|
|
454
|
+
};
|
|
455
|
+
fs2.lutimesSync = function() {
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function chmodFix(orig) {
|
|
460
|
+
if (!orig)
|
|
461
|
+
return orig;
|
|
462
|
+
return function(target, mode, cb) {
|
|
463
|
+
return orig.call(fs, target, mode, function(er) {
|
|
464
|
+
if (chownErOk(er))
|
|
465
|
+
er = null;
|
|
466
|
+
if (cb)
|
|
467
|
+
cb.apply(this, arguments);
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function chmodFixSync(orig) {
|
|
472
|
+
if (!orig)
|
|
473
|
+
return orig;
|
|
474
|
+
return function(target, mode) {
|
|
475
|
+
try {
|
|
476
|
+
return orig.call(fs, target, mode);
|
|
477
|
+
} catch (er) {
|
|
478
|
+
if (!chownErOk(er))
|
|
479
|
+
throw er;
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
function chownFix(orig) {
|
|
484
|
+
if (!orig)
|
|
485
|
+
return orig;
|
|
486
|
+
return function(target, uid, gid, cb) {
|
|
487
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
488
|
+
if (chownErOk(er))
|
|
489
|
+
er = null;
|
|
490
|
+
if (cb)
|
|
491
|
+
cb.apply(this, arguments);
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function chownFixSync(orig) {
|
|
496
|
+
if (!orig)
|
|
497
|
+
return orig;
|
|
498
|
+
return function(target, uid, gid) {
|
|
499
|
+
try {
|
|
500
|
+
return orig.call(fs, target, uid, gid);
|
|
501
|
+
} catch (er) {
|
|
502
|
+
if (!chownErOk(er))
|
|
503
|
+
throw er;
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function statFix(orig) {
|
|
508
|
+
if (!orig)
|
|
509
|
+
return orig;
|
|
510
|
+
return function(target, options, cb) {
|
|
511
|
+
if (typeof options === "function") {
|
|
512
|
+
cb = options;
|
|
513
|
+
options = null;
|
|
514
|
+
}
|
|
515
|
+
function callback(er, stats) {
|
|
516
|
+
if (stats) {
|
|
517
|
+
if (stats.uid < 0)
|
|
518
|
+
stats.uid += 4294967296;
|
|
519
|
+
if (stats.gid < 0)
|
|
520
|
+
stats.gid += 4294967296;
|
|
521
|
+
}
|
|
522
|
+
if (cb)
|
|
523
|
+
cb.apply(this, arguments);
|
|
524
|
+
}
|
|
525
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function statFixSync(orig) {
|
|
529
|
+
if (!orig)
|
|
530
|
+
return orig;
|
|
531
|
+
return function(target, options) {
|
|
532
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
533
|
+
if (stats) {
|
|
534
|
+
if (stats.uid < 0)
|
|
535
|
+
stats.uid += 4294967296;
|
|
536
|
+
if (stats.gid < 0)
|
|
537
|
+
stats.gid += 4294967296;
|
|
538
|
+
}
|
|
539
|
+
return stats;
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function chownErOk(er) {
|
|
543
|
+
if (!er)
|
|
544
|
+
return true;
|
|
545
|
+
if (er.code === "ENOSYS")
|
|
546
|
+
return true;
|
|
547
|
+
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
548
|
+
if (nonroot) {
|
|
549
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
// node_modules/graceful-fs/legacy-streams.js
|
|
559
|
+
import __import_stream from "stream";
|
|
560
|
+
var require_legacy_streams = __commonJS({
|
|
561
|
+
"node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
562
|
+
var Stream = __import_stream.Stream;
|
|
563
|
+
module.exports = legacy;
|
|
564
|
+
function legacy(fs) {
|
|
565
|
+
return {
|
|
566
|
+
ReadStream,
|
|
567
|
+
WriteStream
|
|
568
|
+
};
|
|
569
|
+
function ReadStream(path, options) {
|
|
570
|
+
if (!(this instanceof ReadStream))
|
|
571
|
+
return new ReadStream(path, options);
|
|
572
|
+
Stream.call(this);
|
|
573
|
+
var self = this;
|
|
574
|
+
this.path = path;
|
|
575
|
+
this.fd = null;
|
|
576
|
+
this.readable = true;
|
|
577
|
+
this.paused = false;
|
|
578
|
+
this.flags = "r";
|
|
579
|
+
this.mode = 438;
|
|
580
|
+
this.bufferSize = 64 * 1024;
|
|
581
|
+
options = options || {};
|
|
582
|
+
var keys = Object.keys(options);
|
|
583
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
584
|
+
var key = keys[index];
|
|
585
|
+
this[key] = options[key];
|
|
586
|
+
}
|
|
587
|
+
if (this.encoding)
|
|
588
|
+
this.setEncoding(this.encoding);
|
|
589
|
+
if (this.start !== void 0) {
|
|
590
|
+
if ("number" !== typeof this.start) {
|
|
591
|
+
throw TypeError("start must be a Number");
|
|
592
|
+
}
|
|
593
|
+
if (this.end === void 0) {
|
|
594
|
+
this.end = Infinity;
|
|
595
|
+
} else if ("number" !== typeof this.end) {
|
|
596
|
+
throw TypeError("end must be a Number");
|
|
597
|
+
}
|
|
598
|
+
if (this.start > this.end) {
|
|
599
|
+
throw new Error("start must be <= end");
|
|
600
|
+
}
|
|
601
|
+
this.pos = this.start;
|
|
602
|
+
}
|
|
603
|
+
if (this.fd !== null) {
|
|
604
|
+
process.nextTick(function() {
|
|
605
|
+
self._read();
|
|
606
|
+
});
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
610
|
+
if (err) {
|
|
611
|
+
self.emit("error", err);
|
|
612
|
+
self.readable = false;
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
self.fd = fd;
|
|
616
|
+
self.emit("open", fd);
|
|
617
|
+
self._read();
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
function WriteStream(path, options) {
|
|
621
|
+
if (!(this instanceof WriteStream))
|
|
622
|
+
return new WriteStream(path, options);
|
|
623
|
+
Stream.call(this);
|
|
624
|
+
this.path = path;
|
|
625
|
+
this.fd = null;
|
|
626
|
+
this.writable = true;
|
|
627
|
+
this.flags = "w";
|
|
628
|
+
this.encoding = "binary";
|
|
629
|
+
this.mode = 438;
|
|
630
|
+
this.bytesWritten = 0;
|
|
631
|
+
options = options || {};
|
|
632
|
+
var keys = Object.keys(options);
|
|
633
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
634
|
+
var key = keys[index];
|
|
635
|
+
this[key] = options[key];
|
|
636
|
+
}
|
|
637
|
+
if (this.start !== void 0) {
|
|
638
|
+
if ("number" !== typeof this.start) {
|
|
639
|
+
throw TypeError("start must be a Number");
|
|
640
|
+
}
|
|
641
|
+
if (this.start < 0) {
|
|
642
|
+
throw new Error("start must be >= zero");
|
|
643
|
+
}
|
|
644
|
+
this.pos = this.start;
|
|
645
|
+
}
|
|
646
|
+
this.busy = false;
|
|
647
|
+
this._queue = [];
|
|
648
|
+
if (this.fd === null) {
|
|
649
|
+
this._open = fs.open;
|
|
650
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
651
|
+
this.flush();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
// node_modules/graceful-fs/clone.js
|
|
659
|
+
var require_clone = __commonJS({
|
|
660
|
+
"node_modules/graceful-fs/clone.js"(exports, module) {
|
|
661
|
+
"use strict";
|
|
662
|
+
module.exports = clone;
|
|
663
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
664
|
+
return obj.__proto__;
|
|
665
|
+
};
|
|
666
|
+
function clone(obj) {
|
|
667
|
+
if (obj === null || typeof obj !== "object")
|
|
668
|
+
return obj;
|
|
669
|
+
if (obj instanceof Object)
|
|
670
|
+
var copy2 = { __proto__: getPrototypeOf(obj) };
|
|
671
|
+
else
|
|
672
|
+
var copy2 = /* @__PURE__ */ Object.create(null);
|
|
673
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
674
|
+
Object.defineProperty(copy2, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
675
|
+
});
|
|
676
|
+
return copy2;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// node_modules/graceful-fs/graceful-fs.js
|
|
682
|
+
import __import_fs from "fs";
|
|
683
|
+
import __import_util from "util";
|
|
684
|
+
import __import_assert from "assert";
|
|
685
|
+
var require_graceful_fs = __commonJS({
|
|
686
|
+
"node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
687
|
+
var import_polyfills = __toESM(require_polyfills());
|
|
688
|
+
var import_legacy_streams = __toESM(require_legacy_streams());
|
|
689
|
+
var import_clone = __toESM(require_clone());
|
|
690
|
+
var fs = __import_fs;
|
|
691
|
+
var polyfills = import_polyfills.default;
|
|
692
|
+
var legacy = import_legacy_streams.default;
|
|
693
|
+
var clone = import_clone.default;
|
|
694
|
+
var util = __import_util;
|
|
695
|
+
var gracefulQueue;
|
|
696
|
+
var previousSymbol;
|
|
697
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
698
|
+
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
699
|
+
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
700
|
+
} else {
|
|
701
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
702
|
+
previousSymbol = "___graceful-fs.previous";
|
|
703
|
+
}
|
|
704
|
+
function noop() {
|
|
705
|
+
}
|
|
706
|
+
function publishQueue(context, queue2) {
|
|
707
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
708
|
+
get: function() {
|
|
709
|
+
return queue2;
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
var debug = noop;
|
|
714
|
+
if (util.debuglog)
|
|
715
|
+
debug = util.debuglog("gfs4");
|
|
716
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
717
|
+
debug = function() {
|
|
718
|
+
var m = util.format.apply(util, arguments);
|
|
719
|
+
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
720
|
+
console.error(m);
|
|
721
|
+
};
|
|
722
|
+
if (!fs[gracefulQueue]) {
|
|
723
|
+
queue = global[gracefulQueue] || [];
|
|
724
|
+
publishQueue(fs, queue);
|
|
725
|
+
fs.close = function(fs$close) {
|
|
726
|
+
function close(fd, cb) {
|
|
727
|
+
return fs$close.call(fs, fd, function(err) {
|
|
728
|
+
if (!err) {
|
|
729
|
+
resetQueue();
|
|
730
|
+
}
|
|
731
|
+
if (typeof cb === "function")
|
|
732
|
+
cb.apply(this, arguments);
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
Object.defineProperty(close, previousSymbol, {
|
|
736
|
+
value: fs$close
|
|
737
|
+
});
|
|
738
|
+
return close;
|
|
739
|
+
}(fs.close);
|
|
740
|
+
fs.closeSync = function(fs$closeSync) {
|
|
741
|
+
function closeSync(fd) {
|
|
742
|
+
fs$closeSync.apply(fs, arguments);
|
|
743
|
+
resetQueue();
|
|
744
|
+
}
|
|
745
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
746
|
+
value: fs$closeSync
|
|
747
|
+
});
|
|
748
|
+
return closeSync;
|
|
749
|
+
}(fs.closeSync);
|
|
750
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
751
|
+
process.on("exit", function() {
|
|
752
|
+
debug(fs[gracefulQueue]);
|
|
753
|
+
__import_assert.equal(fs[gracefulQueue].length, 0);
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
var queue;
|
|
758
|
+
if (!global[gracefulQueue]) {
|
|
759
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
760
|
+
}
|
|
761
|
+
module.exports = patch(clone(fs));
|
|
762
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
763
|
+
module.exports = patch(fs);
|
|
764
|
+
fs.__patched = true;
|
|
765
|
+
}
|
|
766
|
+
function patch(fs2) {
|
|
767
|
+
polyfills(fs2);
|
|
768
|
+
fs2.gracefulify = patch;
|
|
769
|
+
fs2.createReadStream = createReadStream;
|
|
770
|
+
fs2.createWriteStream = createWriteStream;
|
|
771
|
+
var fs$readFile = fs2.readFile;
|
|
772
|
+
fs2.readFile = readFile;
|
|
773
|
+
function readFile(path, options, cb) {
|
|
774
|
+
if (typeof options === "function")
|
|
775
|
+
cb = options, options = null;
|
|
776
|
+
return go$readFile(path, options, cb);
|
|
777
|
+
function go$readFile(path2, options2, cb2, startTime) {
|
|
778
|
+
return fs$readFile(path2, options2, function(err) {
|
|
779
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
780
|
+
enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
781
|
+
else {
|
|
782
|
+
if (typeof cb2 === "function")
|
|
783
|
+
cb2.apply(this, arguments);
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
var fs$writeFile = fs2.writeFile;
|
|
789
|
+
fs2.writeFile = writeFile;
|
|
790
|
+
function writeFile(path, data, options, cb) {
|
|
791
|
+
if (typeof options === "function")
|
|
792
|
+
cb = options, options = null;
|
|
793
|
+
return go$writeFile(path, data, options, cb);
|
|
794
|
+
function go$writeFile(path2, data2, options2, cb2, startTime) {
|
|
795
|
+
return fs$writeFile(path2, data2, options2, function(err) {
|
|
796
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
797
|
+
enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
798
|
+
else {
|
|
799
|
+
if (typeof cb2 === "function")
|
|
800
|
+
cb2.apply(this, arguments);
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
var fs$appendFile = fs2.appendFile;
|
|
806
|
+
if (fs$appendFile)
|
|
807
|
+
fs2.appendFile = appendFile;
|
|
808
|
+
function appendFile(path, data, options, cb) {
|
|
809
|
+
if (typeof options === "function")
|
|
810
|
+
cb = options, options = null;
|
|
811
|
+
return go$appendFile(path, data, options, cb);
|
|
812
|
+
function go$appendFile(path2, data2, options2, cb2, startTime) {
|
|
813
|
+
return fs$appendFile(path2, data2, options2, function(err) {
|
|
814
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
815
|
+
enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
816
|
+
else {
|
|
817
|
+
if (typeof cb2 === "function")
|
|
818
|
+
cb2.apply(this, arguments);
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
var fs$copyFile = fs2.copyFile;
|
|
824
|
+
if (fs$copyFile)
|
|
825
|
+
fs2.copyFile = copyFile;
|
|
826
|
+
function copyFile(src, dest, flags, cb) {
|
|
827
|
+
if (typeof flags === "function") {
|
|
828
|
+
cb = flags;
|
|
829
|
+
flags = 0;
|
|
830
|
+
}
|
|
831
|
+
return go$copyFile(src, dest, flags, cb);
|
|
832
|
+
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
833
|
+
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
834
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
835
|
+
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
836
|
+
else {
|
|
837
|
+
if (typeof cb2 === "function")
|
|
838
|
+
cb2.apply(this, arguments);
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
var fs$readdir = fs2.readdir;
|
|
844
|
+
fs2.readdir = readdir;
|
|
845
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
846
|
+
function readdir(path, options, cb) {
|
|
847
|
+
if (typeof options === "function")
|
|
848
|
+
cb = options, options = null;
|
|
849
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
|
|
850
|
+
return fs$readdir(path2, fs$readdirCallback(
|
|
851
|
+
path2,
|
|
852
|
+
options2,
|
|
853
|
+
cb2,
|
|
854
|
+
startTime
|
|
855
|
+
));
|
|
856
|
+
} : function go$readdir2(path2, options2, cb2, startTime) {
|
|
857
|
+
return fs$readdir(path2, options2, fs$readdirCallback(
|
|
858
|
+
path2,
|
|
859
|
+
options2,
|
|
860
|
+
cb2,
|
|
861
|
+
startTime
|
|
862
|
+
));
|
|
863
|
+
};
|
|
864
|
+
return go$readdir(path, options, cb);
|
|
865
|
+
function fs$readdirCallback(path2, options2, cb2, startTime) {
|
|
866
|
+
return function(err, files) {
|
|
867
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
868
|
+
enqueue([
|
|
869
|
+
go$readdir,
|
|
870
|
+
[path2, options2, cb2],
|
|
871
|
+
err,
|
|
872
|
+
startTime || Date.now(),
|
|
873
|
+
Date.now()
|
|
874
|
+
]);
|
|
875
|
+
else {
|
|
876
|
+
if (files && files.sort)
|
|
877
|
+
files.sort();
|
|
878
|
+
if (typeof cb2 === "function")
|
|
879
|
+
cb2.call(this, err, files);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
885
|
+
var legStreams = legacy(fs2);
|
|
886
|
+
ReadStream = legStreams.ReadStream;
|
|
887
|
+
WriteStream = legStreams.WriteStream;
|
|
888
|
+
}
|
|
889
|
+
var fs$ReadStream = fs2.ReadStream;
|
|
890
|
+
if (fs$ReadStream) {
|
|
891
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
892
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
893
|
+
}
|
|
894
|
+
var fs$WriteStream = fs2.WriteStream;
|
|
895
|
+
if (fs$WriteStream) {
|
|
896
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
897
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
898
|
+
}
|
|
899
|
+
Object.defineProperty(fs2, "ReadStream", {
|
|
900
|
+
get: function() {
|
|
901
|
+
return ReadStream;
|
|
902
|
+
},
|
|
903
|
+
set: function(val) {
|
|
904
|
+
ReadStream = val;
|
|
905
|
+
},
|
|
906
|
+
enumerable: true,
|
|
907
|
+
configurable: true
|
|
908
|
+
});
|
|
909
|
+
Object.defineProperty(fs2, "WriteStream", {
|
|
910
|
+
get: function() {
|
|
911
|
+
return WriteStream;
|
|
912
|
+
},
|
|
913
|
+
set: function(val) {
|
|
914
|
+
WriteStream = val;
|
|
915
|
+
},
|
|
916
|
+
enumerable: true,
|
|
917
|
+
configurable: true
|
|
918
|
+
});
|
|
919
|
+
var FileReadStream = ReadStream;
|
|
920
|
+
Object.defineProperty(fs2, "FileReadStream", {
|
|
921
|
+
get: function() {
|
|
922
|
+
return FileReadStream;
|
|
923
|
+
},
|
|
924
|
+
set: function(val) {
|
|
925
|
+
FileReadStream = val;
|
|
926
|
+
},
|
|
927
|
+
enumerable: true,
|
|
928
|
+
configurable: true
|
|
929
|
+
});
|
|
930
|
+
var FileWriteStream = WriteStream;
|
|
931
|
+
Object.defineProperty(fs2, "FileWriteStream", {
|
|
932
|
+
get: function() {
|
|
933
|
+
return FileWriteStream;
|
|
934
|
+
},
|
|
935
|
+
set: function(val) {
|
|
936
|
+
FileWriteStream = val;
|
|
937
|
+
},
|
|
938
|
+
enumerable: true,
|
|
939
|
+
configurable: true
|
|
940
|
+
});
|
|
941
|
+
function ReadStream(path, options) {
|
|
942
|
+
if (this instanceof ReadStream)
|
|
943
|
+
return fs$ReadStream.apply(this, arguments), this;
|
|
944
|
+
else
|
|
945
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
946
|
+
}
|
|
947
|
+
function ReadStream$open() {
|
|
948
|
+
var that = this;
|
|
949
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
950
|
+
if (err) {
|
|
951
|
+
if (that.autoClose)
|
|
952
|
+
that.destroy();
|
|
953
|
+
that.emit("error", err);
|
|
954
|
+
} else {
|
|
955
|
+
that.fd = fd;
|
|
956
|
+
that.emit("open", fd);
|
|
957
|
+
that.read();
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
function WriteStream(path, options) {
|
|
962
|
+
if (this instanceof WriteStream)
|
|
963
|
+
return fs$WriteStream.apply(this, arguments), this;
|
|
964
|
+
else
|
|
965
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
966
|
+
}
|
|
967
|
+
function WriteStream$open() {
|
|
968
|
+
var that = this;
|
|
969
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
970
|
+
if (err) {
|
|
971
|
+
that.destroy();
|
|
972
|
+
that.emit("error", err);
|
|
973
|
+
} else {
|
|
974
|
+
that.fd = fd;
|
|
975
|
+
that.emit("open", fd);
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
function createReadStream(path, options) {
|
|
980
|
+
return new fs2.ReadStream(path, options);
|
|
981
|
+
}
|
|
982
|
+
function createWriteStream(path, options) {
|
|
983
|
+
return new fs2.WriteStream(path, options);
|
|
984
|
+
}
|
|
985
|
+
var fs$open = fs2.open;
|
|
986
|
+
fs2.open = open;
|
|
987
|
+
function open(path, flags, mode, cb) {
|
|
988
|
+
if (typeof mode === "function")
|
|
989
|
+
cb = mode, mode = null;
|
|
990
|
+
return go$open(path, flags, mode, cb);
|
|
991
|
+
function go$open(path2, flags2, mode2, cb2, startTime) {
|
|
992
|
+
return fs$open(path2, flags2, mode2, function(err, fd) {
|
|
993
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
994
|
+
enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
995
|
+
else {
|
|
996
|
+
if (typeof cb2 === "function")
|
|
997
|
+
cb2.apply(this, arguments);
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
return fs2;
|
|
1003
|
+
}
|
|
1004
|
+
function enqueue(elem) {
|
|
1005
|
+
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
1006
|
+
fs[gracefulQueue].push(elem);
|
|
1007
|
+
retry();
|
|
1008
|
+
}
|
|
1009
|
+
var retryTimer;
|
|
1010
|
+
function resetQueue() {
|
|
1011
|
+
var now = Date.now();
|
|
1012
|
+
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
|
|
1013
|
+
if (fs[gracefulQueue][i].length > 2) {
|
|
1014
|
+
fs[gracefulQueue][i][3] = now;
|
|
1015
|
+
fs[gracefulQueue][i][4] = now;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
retry();
|
|
1019
|
+
}
|
|
1020
|
+
function retry() {
|
|
1021
|
+
clearTimeout(retryTimer);
|
|
1022
|
+
retryTimer = void 0;
|
|
1023
|
+
if (fs[gracefulQueue].length === 0)
|
|
1024
|
+
return;
|
|
1025
|
+
var elem = fs[gracefulQueue].shift();
|
|
1026
|
+
var fn = elem[0];
|
|
1027
|
+
var args = elem[1];
|
|
1028
|
+
var err = elem[2];
|
|
1029
|
+
var startTime = elem[3];
|
|
1030
|
+
var lastTime = elem[4];
|
|
1031
|
+
if (startTime === void 0) {
|
|
1032
|
+
debug("RETRY", fn.name, args);
|
|
1033
|
+
fn.apply(null, args);
|
|
1034
|
+
} else if (Date.now() - startTime >= 6e4) {
|
|
1035
|
+
debug("TIMEOUT", fn.name, args);
|
|
1036
|
+
var cb = args.pop();
|
|
1037
|
+
if (typeof cb === "function")
|
|
1038
|
+
cb.call(null, err);
|
|
1039
|
+
} else {
|
|
1040
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
1041
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
1042
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
1043
|
+
if (sinceAttempt >= desiredDelay) {
|
|
1044
|
+
debug("RETRY", fn.name, args);
|
|
1045
|
+
fn.apply(null, args.concat([startTime]));
|
|
1046
|
+
} else {
|
|
1047
|
+
fs[gracefulQueue].push(elem);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
if (retryTimer === void 0) {
|
|
1051
|
+
retryTimer = setTimeout(retry, 0);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
// node_modules/fs-extra/lib/fs/index.js
|
|
1058
|
+
var require_fs = __commonJS({
|
|
1059
|
+
"node_modules/fs-extra/lib/fs/index.js"(exports) {
|
|
1060
|
+
var import_universalify = __toESM(require_universalify());
|
|
1061
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1062
|
+
var u = import_universalify.default.fromCallback;
|
|
1063
|
+
var fs = import_graceful_fs.default;
|
|
1064
|
+
var api = [
|
|
1065
|
+
"access",
|
|
1066
|
+
"appendFile",
|
|
1067
|
+
"chmod",
|
|
1068
|
+
"chown",
|
|
1069
|
+
"close",
|
|
1070
|
+
"copyFile",
|
|
1071
|
+
"fchmod",
|
|
1072
|
+
"fchown",
|
|
1073
|
+
"fdatasync",
|
|
1074
|
+
"fstat",
|
|
1075
|
+
"fsync",
|
|
1076
|
+
"ftruncate",
|
|
1077
|
+
"futimes",
|
|
1078
|
+
"lchmod",
|
|
1079
|
+
"lchown",
|
|
1080
|
+
"link",
|
|
1081
|
+
"lstat",
|
|
1082
|
+
"mkdir",
|
|
1083
|
+
"mkdtemp",
|
|
1084
|
+
"open",
|
|
1085
|
+
"opendir",
|
|
1086
|
+
"readdir",
|
|
1087
|
+
"readFile",
|
|
1088
|
+
"readlink",
|
|
1089
|
+
"realpath",
|
|
1090
|
+
"rename",
|
|
1091
|
+
"rm",
|
|
1092
|
+
"rmdir",
|
|
1093
|
+
"stat",
|
|
1094
|
+
"symlink",
|
|
1095
|
+
"truncate",
|
|
1096
|
+
"unlink",
|
|
1097
|
+
"utimes",
|
|
1098
|
+
"writeFile"
|
|
1099
|
+
].filter((key) => {
|
|
1100
|
+
return typeof fs[key] === "function";
|
|
1101
|
+
});
|
|
1102
|
+
Object.assign(exports, fs);
|
|
1103
|
+
api.forEach((method) => {
|
|
1104
|
+
exports[method] = u(fs[method]);
|
|
1105
|
+
});
|
|
1106
|
+
exports.exists = function(filename, callback) {
|
|
1107
|
+
if (typeof callback === "function") {
|
|
1108
|
+
return fs.exists(filename, callback);
|
|
1109
|
+
}
|
|
1110
|
+
return new Promise((resolve) => {
|
|
1111
|
+
return fs.exists(filename, resolve);
|
|
1112
|
+
});
|
|
1113
|
+
};
|
|
1114
|
+
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
1115
|
+
if (typeof callback === "function") {
|
|
1116
|
+
return fs.read(fd, buffer, offset, length, position, callback);
|
|
1117
|
+
}
|
|
1118
|
+
return new Promise((resolve, reject) => {
|
|
1119
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
1120
|
+
if (err)
|
|
1121
|
+
return reject(err);
|
|
1122
|
+
resolve({ bytesRead, buffer: buffer2 });
|
|
1123
|
+
});
|
|
1124
|
+
});
|
|
1125
|
+
};
|
|
1126
|
+
exports.write = function(fd, buffer, ...args) {
|
|
1127
|
+
if (typeof args[args.length - 1] === "function") {
|
|
1128
|
+
return fs.write(fd, buffer, ...args);
|
|
1129
|
+
}
|
|
1130
|
+
return new Promise((resolve, reject) => {
|
|
1131
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
1132
|
+
if (err)
|
|
1133
|
+
return reject(err);
|
|
1134
|
+
resolve({ bytesWritten, buffer: buffer2 });
|
|
1135
|
+
});
|
|
1136
|
+
});
|
|
1137
|
+
};
|
|
1138
|
+
exports.readv = function(fd, buffers, ...args) {
|
|
1139
|
+
if (typeof args[args.length - 1] === "function") {
|
|
1140
|
+
return fs.readv(fd, buffers, ...args);
|
|
1141
|
+
}
|
|
1142
|
+
return new Promise((resolve, reject) => {
|
|
1143
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
1144
|
+
if (err)
|
|
1145
|
+
return reject(err);
|
|
1146
|
+
resolve({ bytesRead, buffers: buffers2 });
|
|
1147
|
+
});
|
|
1148
|
+
});
|
|
1149
|
+
};
|
|
1150
|
+
exports.writev = function(fd, buffers, ...args) {
|
|
1151
|
+
if (typeof args[args.length - 1] === "function") {
|
|
1152
|
+
return fs.writev(fd, buffers, ...args);
|
|
1153
|
+
}
|
|
1154
|
+
return new Promise((resolve, reject) => {
|
|
1155
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
1156
|
+
if (err)
|
|
1157
|
+
return reject(err);
|
|
1158
|
+
resolve({ bytesWritten, buffers: buffers2 });
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
};
|
|
1162
|
+
if (typeof fs.realpath.native === "function") {
|
|
1163
|
+
exports.realpath.native = u(fs.realpath.native);
|
|
1164
|
+
} else {
|
|
1165
|
+
process.emitWarning(
|
|
1166
|
+
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
1167
|
+
"Warning",
|
|
1168
|
+
"fs-extra-WARN0003"
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
// node_modules/fs-extra/lib/mkdirs/utils.js
|
|
1175
|
+
import __import_path2 from "path";
|
|
1176
|
+
var require_utils = __commonJS({
|
|
1177
|
+
"node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
|
|
1178
|
+
var path = __import_path2;
|
|
1179
|
+
module.exports.checkPath = function checkPath(pth) {
|
|
1180
|
+
if (process.platform === "win32") {
|
|
1181
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
|
|
1182
|
+
if (pathHasInvalidWinCharacters) {
|
|
1183
|
+
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
1184
|
+
error.code = "EINVAL";
|
|
1185
|
+
throw error;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
// node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
1193
|
+
var require_make_dir = __commonJS({
|
|
1194
|
+
"node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module) {
|
|
1195
|
+
var import_fs2 = __toESM(require_fs());
|
|
1196
|
+
var import_utils = __toESM(require_utils());
|
|
1197
|
+
var fs = import_fs2.default;
|
|
1198
|
+
var { checkPath } = import_utils.default;
|
|
1199
|
+
var getMode = (options) => {
|
|
1200
|
+
const defaults = { mode: 511 };
|
|
1201
|
+
if (typeof options === "number")
|
|
1202
|
+
return options;
|
|
1203
|
+
return { ...defaults, ...options }.mode;
|
|
1204
|
+
};
|
|
1205
|
+
module.exports.makeDir = async (dir, options) => {
|
|
1206
|
+
checkPath(dir);
|
|
1207
|
+
return fs.mkdir(dir, {
|
|
1208
|
+
mode: getMode(options),
|
|
1209
|
+
recursive: true
|
|
1210
|
+
});
|
|
1211
|
+
};
|
|
1212
|
+
module.exports.makeDirSync = (dir, options) => {
|
|
1213
|
+
checkPath(dir);
|
|
1214
|
+
return fs.mkdirSync(dir, {
|
|
1215
|
+
mode: getMode(options),
|
|
1216
|
+
recursive: true
|
|
1217
|
+
});
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
|
|
1222
|
+
// node_modules/fs-extra/lib/mkdirs/index.js
|
|
1223
|
+
var require_mkdirs = __commonJS({
|
|
1224
|
+
"node_modules/fs-extra/lib/mkdirs/index.js"(exports, module) {
|
|
1225
|
+
var import_universalify = __toESM(require_universalify());
|
|
1226
|
+
var import_make_dir = __toESM(require_make_dir());
|
|
1227
|
+
var u = import_universalify.default.fromPromise;
|
|
1228
|
+
var { makeDir: _makeDir, makeDirSync } = import_make_dir.default;
|
|
1229
|
+
var makeDir = u(_makeDir);
|
|
1230
|
+
module.exports = {
|
|
1231
|
+
mkdirs: makeDir,
|
|
1232
|
+
mkdirsSync: makeDirSync,
|
|
1233
|
+
// alias
|
|
1234
|
+
mkdirp: makeDir,
|
|
1235
|
+
mkdirpSync: makeDirSync,
|
|
1236
|
+
ensureDir: makeDir,
|
|
1237
|
+
ensureDirSync: makeDirSync
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
// node_modules/fs-extra/lib/path-exists/index.js
|
|
1243
|
+
var require_path_exists = __commonJS({
|
|
1244
|
+
"node_modules/fs-extra/lib/path-exists/index.js"(exports, module) {
|
|
1245
|
+
var import_universalify = __toESM(require_universalify());
|
|
1246
|
+
var import_fs2 = __toESM(require_fs());
|
|
1247
|
+
var u = import_universalify.default.fromPromise;
|
|
1248
|
+
var fs = import_fs2.default;
|
|
1249
|
+
function pathExists(path) {
|
|
1250
|
+
return fs.access(path).then(() => true).catch(() => false);
|
|
1251
|
+
}
|
|
1252
|
+
module.exports = {
|
|
1253
|
+
pathExists: u(pathExists),
|
|
1254
|
+
pathExistsSync: fs.existsSync
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
|
|
1259
|
+
// node_modules/fs-extra/lib/util/utimes.js
|
|
1260
|
+
var require_utimes = __commonJS({
|
|
1261
|
+
"node_modules/fs-extra/lib/util/utimes.js"(exports, module) {
|
|
1262
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1263
|
+
var fs = import_graceful_fs.default;
|
|
1264
|
+
function utimesMillis(path, atime, mtime, callback) {
|
|
1265
|
+
fs.open(path, "r+", (err, fd) => {
|
|
1266
|
+
if (err)
|
|
1267
|
+
return callback(err);
|
|
1268
|
+
fs.futimes(fd, atime, mtime, (futimesErr) => {
|
|
1269
|
+
fs.close(fd, (closeErr) => {
|
|
1270
|
+
if (callback)
|
|
1271
|
+
callback(futimesErr || closeErr);
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
function utimesMillisSync(path, atime, mtime) {
|
|
1277
|
+
const fd = fs.openSync(path, "r+");
|
|
1278
|
+
fs.futimesSync(fd, atime, mtime);
|
|
1279
|
+
return fs.closeSync(fd);
|
|
1280
|
+
}
|
|
1281
|
+
module.exports = {
|
|
1282
|
+
utimesMillis,
|
|
1283
|
+
utimesMillisSync
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
// node_modules/fs-extra/lib/util/stat.js
|
|
1289
|
+
import __import_path3 from "path";
|
|
1290
|
+
import __import_util2 from "util";
|
|
1291
|
+
var require_stat = __commonJS({
|
|
1292
|
+
"node_modules/fs-extra/lib/util/stat.js"(exports, module) {
|
|
1293
|
+
var import_fs2 = __toESM(require_fs());
|
|
1294
|
+
var fs = import_fs2.default;
|
|
1295
|
+
var path = __import_path3;
|
|
1296
|
+
var util = __import_util2;
|
|
1297
|
+
function getStats(src, dest, opts) {
|
|
1298
|
+
const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
|
|
1299
|
+
return Promise.all([
|
|
1300
|
+
statFunc(src),
|
|
1301
|
+
statFunc(dest).catch((err) => {
|
|
1302
|
+
if (err.code === "ENOENT")
|
|
1303
|
+
return null;
|
|
1304
|
+
throw err;
|
|
1305
|
+
})
|
|
1306
|
+
]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
|
|
1307
|
+
}
|
|
1308
|
+
function getStatsSync(src, dest, opts) {
|
|
1309
|
+
let destStat;
|
|
1310
|
+
const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
|
|
1311
|
+
const srcStat = statFunc(src);
|
|
1312
|
+
try {
|
|
1313
|
+
destStat = statFunc(dest);
|
|
1314
|
+
} catch (err) {
|
|
1315
|
+
if (err.code === "ENOENT")
|
|
1316
|
+
return { srcStat, destStat: null };
|
|
1317
|
+
throw err;
|
|
1318
|
+
}
|
|
1319
|
+
return { srcStat, destStat };
|
|
1320
|
+
}
|
|
1321
|
+
function checkPaths(src, dest, funcName, opts, cb) {
|
|
1322
|
+
util.callbackify(getStats)(src, dest, opts, (err, stats) => {
|
|
1323
|
+
if (err)
|
|
1324
|
+
return cb(err);
|
|
1325
|
+
const { srcStat, destStat } = stats;
|
|
1326
|
+
if (destStat) {
|
|
1327
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1328
|
+
const srcBaseName = path.basename(src);
|
|
1329
|
+
const destBaseName = path.basename(dest);
|
|
1330
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1331
|
+
return cb(null, { srcStat, destStat, isChangingCase: true });
|
|
1332
|
+
}
|
|
1333
|
+
return cb(new Error("Source and destination must not be the same."));
|
|
1334
|
+
}
|
|
1335
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1336
|
+
return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
|
|
1337
|
+
}
|
|
1338
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1339
|
+
return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`));
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1343
|
+
return cb(new Error(errMsg(src, dest, funcName)));
|
|
1344
|
+
}
|
|
1345
|
+
return cb(null, { srcStat, destStat });
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
function checkPathsSync(src, dest, funcName, opts) {
|
|
1349
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1350
|
+
if (destStat) {
|
|
1351
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1352
|
+
const srcBaseName = path.basename(src);
|
|
1353
|
+
const destBaseName = path.basename(dest);
|
|
1354
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1355
|
+
return { srcStat, destStat, isChangingCase: true };
|
|
1356
|
+
}
|
|
1357
|
+
throw new Error("Source and destination must not be the same.");
|
|
1358
|
+
}
|
|
1359
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1360
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1361
|
+
}
|
|
1362
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1363
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1367
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1368
|
+
}
|
|
1369
|
+
return { srcStat, destStat };
|
|
1370
|
+
}
|
|
1371
|
+
function checkParentPaths(src, srcStat, dest, funcName, cb) {
|
|
1372
|
+
const srcParent = path.resolve(path.dirname(src));
|
|
1373
|
+
const destParent = path.resolve(path.dirname(dest));
|
|
1374
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root)
|
|
1375
|
+
return cb();
|
|
1376
|
+
fs.stat(destParent, { bigint: true }, (err, destStat) => {
|
|
1377
|
+
if (err) {
|
|
1378
|
+
if (err.code === "ENOENT")
|
|
1379
|
+
return cb();
|
|
1380
|
+
return cb(err);
|
|
1381
|
+
}
|
|
1382
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1383
|
+
return cb(new Error(errMsg(src, dest, funcName)));
|
|
1384
|
+
}
|
|
1385
|
+
return checkParentPaths(src, srcStat, destParent, funcName, cb);
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1389
|
+
const srcParent = path.resolve(path.dirname(src));
|
|
1390
|
+
const destParent = path.resolve(path.dirname(dest));
|
|
1391
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root)
|
|
1392
|
+
return;
|
|
1393
|
+
let destStat;
|
|
1394
|
+
try {
|
|
1395
|
+
destStat = fs.statSync(destParent, { bigint: true });
|
|
1396
|
+
} catch (err) {
|
|
1397
|
+
if (err.code === "ENOENT")
|
|
1398
|
+
return;
|
|
1399
|
+
throw err;
|
|
1400
|
+
}
|
|
1401
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1402
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1403
|
+
}
|
|
1404
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1405
|
+
}
|
|
1406
|
+
function areIdentical(srcStat, destStat) {
|
|
1407
|
+
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1408
|
+
}
|
|
1409
|
+
function isSrcSubdir(src, dest) {
|
|
1410
|
+
const srcArr = path.resolve(src).split(path.sep).filter((i) => i);
|
|
1411
|
+
const destArr = path.resolve(dest).split(path.sep).filter((i) => i);
|
|
1412
|
+
return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true);
|
|
1413
|
+
}
|
|
1414
|
+
function errMsg(src, dest, funcName) {
|
|
1415
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1416
|
+
}
|
|
1417
|
+
module.exports = {
|
|
1418
|
+
checkPaths,
|
|
1419
|
+
checkPathsSync,
|
|
1420
|
+
checkParentPaths,
|
|
1421
|
+
checkParentPathsSync,
|
|
1422
|
+
isSrcSubdir,
|
|
1423
|
+
areIdentical
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
// node_modules/fs-extra/lib/copy/copy.js
|
|
1429
|
+
import __import_path4 from "path";
|
|
1430
|
+
var require_copy = __commonJS({
|
|
1431
|
+
"node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
|
|
1432
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1433
|
+
var import_mkdirs = __toESM(require_mkdirs());
|
|
1434
|
+
var import_path_exists = __toESM(require_path_exists());
|
|
1435
|
+
var import_utimes = __toESM(require_utimes());
|
|
1436
|
+
var import_stat = __toESM(require_stat());
|
|
1437
|
+
var fs = import_graceful_fs.default;
|
|
1438
|
+
var path = __import_path4;
|
|
1439
|
+
var mkdirs = import_mkdirs.default.mkdirs;
|
|
1440
|
+
var pathExists = import_path_exists.default.pathExists;
|
|
1441
|
+
var utimesMillis = import_utimes.default.utimesMillis;
|
|
1442
|
+
var stat = import_stat.default;
|
|
1443
|
+
function copy2(src, dest, opts, cb) {
|
|
1444
|
+
if (typeof opts === "function" && !cb) {
|
|
1445
|
+
cb = opts;
|
|
1446
|
+
opts = {};
|
|
1447
|
+
} else if (typeof opts === "function") {
|
|
1448
|
+
opts = { filter: opts };
|
|
1449
|
+
}
|
|
1450
|
+
cb = cb || function() {
|
|
1451
|
+
};
|
|
1452
|
+
opts = opts || {};
|
|
1453
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1454
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1455
|
+
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1456
|
+
process.emitWarning(
|
|
1457
|
+
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
|
|
1458
|
+
"Warning",
|
|
1459
|
+
"fs-extra-WARN0001"
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
stat.checkPaths(src, dest, "copy", opts, (err, stats) => {
|
|
1463
|
+
if (err)
|
|
1464
|
+
return cb(err);
|
|
1465
|
+
const { srcStat, destStat } = stats;
|
|
1466
|
+
stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => {
|
|
1467
|
+
if (err2)
|
|
1468
|
+
return cb(err2);
|
|
1469
|
+
runFilter(src, dest, opts, (err3, include) => {
|
|
1470
|
+
if (err3)
|
|
1471
|
+
return cb(err3);
|
|
1472
|
+
if (!include)
|
|
1473
|
+
return cb();
|
|
1474
|
+
checkParentDir(destStat, src, dest, opts, cb);
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
function checkParentDir(destStat, src, dest, opts, cb) {
|
|
1480
|
+
const destParent = path.dirname(dest);
|
|
1481
|
+
pathExists(destParent, (err, dirExists) => {
|
|
1482
|
+
if (err)
|
|
1483
|
+
return cb(err);
|
|
1484
|
+
if (dirExists)
|
|
1485
|
+
return getStats(destStat, src, dest, opts, cb);
|
|
1486
|
+
mkdirs(destParent, (err2) => {
|
|
1487
|
+
if (err2)
|
|
1488
|
+
return cb(err2);
|
|
1489
|
+
return getStats(destStat, src, dest, opts, cb);
|
|
1490
|
+
});
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
function runFilter(src, dest, opts, cb) {
|
|
1494
|
+
if (!opts.filter)
|
|
1495
|
+
return cb(null, true);
|
|
1496
|
+
Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error));
|
|
1497
|
+
}
|
|
1498
|
+
function getStats(destStat, src, dest, opts, cb) {
|
|
1499
|
+
const stat2 = opts.dereference ? fs.stat : fs.lstat;
|
|
1500
|
+
stat2(src, (err, srcStat) => {
|
|
1501
|
+
if (err)
|
|
1502
|
+
return cb(err);
|
|
1503
|
+
if (srcStat.isDirectory())
|
|
1504
|
+
return onDir(srcStat, destStat, src, dest, opts, cb);
|
|
1505
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1506
|
+
return onFile(srcStat, destStat, src, dest, opts, cb);
|
|
1507
|
+
else if (srcStat.isSymbolicLink())
|
|
1508
|
+
return onLink(destStat, src, dest, opts, cb);
|
|
1509
|
+
else if (srcStat.isSocket())
|
|
1510
|
+
return cb(new Error(`Cannot copy a socket file: ${src}`));
|
|
1511
|
+
else if (srcStat.isFIFO())
|
|
1512
|
+
return cb(new Error(`Cannot copy a FIFO pipe: ${src}`));
|
|
1513
|
+
return cb(new Error(`Unknown file: ${src}`));
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
function onFile(srcStat, destStat, src, dest, opts, cb) {
|
|
1517
|
+
if (!destStat)
|
|
1518
|
+
return copyFile(srcStat, src, dest, opts, cb);
|
|
1519
|
+
return mayCopyFile(srcStat, src, dest, opts, cb);
|
|
1520
|
+
}
|
|
1521
|
+
function mayCopyFile(srcStat, src, dest, opts, cb) {
|
|
1522
|
+
if (opts.overwrite) {
|
|
1523
|
+
fs.unlink(dest, (err) => {
|
|
1524
|
+
if (err)
|
|
1525
|
+
return cb(err);
|
|
1526
|
+
return copyFile(srcStat, src, dest, opts, cb);
|
|
1527
|
+
});
|
|
1528
|
+
} else if (opts.errorOnExist) {
|
|
1529
|
+
return cb(new Error(`'${dest}' already exists`));
|
|
1530
|
+
} else
|
|
1531
|
+
return cb();
|
|
1532
|
+
}
|
|
1533
|
+
function copyFile(srcStat, src, dest, opts, cb) {
|
|
1534
|
+
fs.copyFile(src, dest, (err) => {
|
|
1535
|
+
if (err)
|
|
1536
|
+
return cb(err);
|
|
1537
|
+
if (opts.preserveTimestamps)
|
|
1538
|
+
return handleTimestampsAndMode(srcStat.mode, src, dest, cb);
|
|
1539
|
+
return setDestMode(dest, srcStat.mode, cb);
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
function handleTimestampsAndMode(srcMode, src, dest, cb) {
|
|
1543
|
+
if (fileIsNotWritable(srcMode)) {
|
|
1544
|
+
return makeFileWritable(dest, srcMode, (err) => {
|
|
1545
|
+
if (err)
|
|
1546
|
+
return cb(err);
|
|
1547
|
+
return setDestTimestampsAndMode(srcMode, src, dest, cb);
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
return setDestTimestampsAndMode(srcMode, src, dest, cb);
|
|
1551
|
+
}
|
|
1552
|
+
function fileIsNotWritable(srcMode) {
|
|
1553
|
+
return (srcMode & 128) === 0;
|
|
1554
|
+
}
|
|
1555
|
+
function makeFileWritable(dest, srcMode, cb) {
|
|
1556
|
+
return setDestMode(dest, srcMode | 128, cb);
|
|
1557
|
+
}
|
|
1558
|
+
function setDestTimestampsAndMode(srcMode, src, dest, cb) {
|
|
1559
|
+
setDestTimestamps(src, dest, (err) => {
|
|
1560
|
+
if (err)
|
|
1561
|
+
return cb(err);
|
|
1562
|
+
return setDestMode(dest, srcMode, cb);
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
function setDestMode(dest, srcMode, cb) {
|
|
1566
|
+
return fs.chmod(dest, srcMode, cb);
|
|
1567
|
+
}
|
|
1568
|
+
function setDestTimestamps(src, dest, cb) {
|
|
1569
|
+
fs.stat(src, (err, updatedSrcStat) => {
|
|
1570
|
+
if (err)
|
|
1571
|
+
return cb(err);
|
|
1572
|
+
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb);
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
function onDir(srcStat, destStat, src, dest, opts, cb) {
|
|
1576
|
+
if (!destStat)
|
|
1577
|
+
return mkDirAndCopy(srcStat.mode, src, dest, opts, cb);
|
|
1578
|
+
return copyDir(src, dest, opts, cb);
|
|
1579
|
+
}
|
|
1580
|
+
function mkDirAndCopy(srcMode, src, dest, opts, cb) {
|
|
1581
|
+
fs.mkdir(dest, (err) => {
|
|
1582
|
+
if (err)
|
|
1583
|
+
return cb(err);
|
|
1584
|
+
copyDir(src, dest, opts, (err2) => {
|
|
1585
|
+
if (err2)
|
|
1586
|
+
return cb(err2);
|
|
1587
|
+
return setDestMode(dest, srcMode, cb);
|
|
1588
|
+
});
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
function copyDir(src, dest, opts, cb) {
|
|
1592
|
+
fs.readdir(src, (err, items) => {
|
|
1593
|
+
if (err)
|
|
1594
|
+
return cb(err);
|
|
1595
|
+
return copyDirItems(items, src, dest, opts, cb);
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
function copyDirItems(items, src, dest, opts, cb) {
|
|
1599
|
+
const item = items.pop();
|
|
1600
|
+
if (!item)
|
|
1601
|
+
return cb();
|
|
1602
|
+
return copyDirItem(items, item, src, dest, opts, cb);
|
|
1603
|
+
}
|
|
1604
|
+
function copyDirItem(items, item, src, dest, opts, cb) {
|
|
1605
|
+
const srcItem = path.join(src, item);
|
|
1606
|
+
const destItem = path.join(dest, item);
|
|
1607
|
+
runFilter(srcItem, destItem, opts, (err, include) => {
|
|
1608
|
+
if (err)
|
|
1609
|
+
return cb(err);
|
|
1610
|
+
if (!include)
|
|
1611
|
+
return copyDirItems(items, src, dest, opts, cb);
|
|
1612
|
+
stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => {
|
|
1613
|
+
if (err2)
|
|
1614
|
+
return cb(err2);
|
|
1615
|
+
const { destStat } = stats;
|
|
1616
|
+
getStats(destStat, srcItem, destItem, opts, (err3) => {
|
|
1617
|
+
if (err3)
|
|
1618
|
+
return cb(err3);
|
|
1619
|
+
return copyDirItems(items, src, dest, opts, cb);
|
|
1620
|
+
});
|
|
1621
|
+
});
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
function onLink(destStat, src, dest, opts, cb) {
|
|
1625
|
+
fs.readlink(src, (err, resolvedSrc) => {
|
|
1626
|
+
if (err)
|
|
1627
|
+
return cb(err);
|
|
1628
|
+
if (opts.dereference) {
|
|
1629
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
|
|
1630
|
+
}
|
|
1631
|
+
if (!destStat) {
|
|
1632
|
+
return fs.symlink(resolvedSrc, dest, cb);
|
|
1633
|
+
} else {
|
|
1634
|
+
fs.readlink(dest, (err2, resolvedDest) => {
|
|
1635
|
+
if (err2) {
|
|
1636
|
+
if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
|
|
1637
|
+
return fs.symlink(resolvedSrc, dest, cb);
|
|
1638
|
+
return cb(err2);
|
|
1639
|
+
}
|
|
1640
|
+
if (opts.dereference) {
|
|
1641
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest);
|
|
1642
|
+
}
|
|
1643
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1644
|
+
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
|
|
1645
|
+
}
|
|
1646
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1647
|
+
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
|
|
1648
|
+
}
|
|
1649
|
+
return copyLink(resolvedSrc, dest, cb);
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
function copyLink(resolvedSrc, dest, cb) {
|
|
1655
|
+
fs.unlink(dest, (err) => {
|
|
1656
|
+
if (err)
|
|
1657
|
+
return cb(err);
|
|
1658
|
+
return fs.symlink(resolvedSrc, dest, cb);
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
module.exports = copy2;
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
|
|
1665
|
+
// node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1666
|
+
import __import_path5 from "path";
|
|
1667
|
+
var require_copy_sync = __commonJS({
|
|
1668
|
+
"node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
|
|
1669
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1670
|
+
var import_mkdirs = __toESM(require_mkdirs());
|
|
1671
|
+
var import_utimes = __toESM(require_utimes());
|
|
1672
|
+
var import_stat = __toESM(require_stat());
|
|
1673
|
+
var fs = import_graceful_fs.default;
|
|
1674
|
+
var path = __import_path5;
|
|
1675
|
+
var mkdirsSync = import_mkdirs.default.mkdirsSync;
|
|
1676
|
+
var utimesMillisSync = import_utimes.default.utimesMillisSync;
|
|
1677
|
+
var stat = import_stat.default;
|
|
1678
|
+
function copySync2(src, dest, opts) {
|
|
1679
|
+
if (typeof opts === "function") {
|
|
1680
|
+
opts = { filter: opts };
|
|
1681
|
+
}
|
|
1682
|
+
opts = opts || {};
|
|
1683
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1684
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1685
|
+
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1686
|
+
process.emitWarning(
|
|
1687
|
+
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
|
|
1688
|
+
"Warning",
|
|
1689
|
+
"fs-extra-WARN0002"
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
1693
|
+
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1694
|
+
if (opts.filter && !opts.filter(src, dest))
|
|
1695
|
+
return;
|
|
1696
|
+
const destParent = path.dirname(dest);
|
|
1697
|
+
if (!fs.existsSync(destParent))
|
|
1698
|
+
mkdirsSync(destParent);
|
|
1699
|
+
return getStats(destStat, src, dest, opts);
|
|
1700
|
+
}
|
|
1701
|
+
function getStats(destStat, src, dest, opts) {
|
|
1702
|
+
const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
|
|
1703
|
+
const srcStat = statSync(src);
|
|
1704
|
+
if (srcStat.isDirectory())
|
|
1705
|
+
return onDir(srcStat, destStat, src, dest, opts);
|
|
1706
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1707
|
+
return onFile(srcStat, destStat, src, dest, opts);
|
|
1708
|
+
else if (srcStat.isSymbolicLink())
|
|
1709
|
+
return onLink(destStat, src, dest, opts);
|
|
1710
|
+
else if (srcStat.isSocket())
|
|
1711
|
+
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1712
|
+
else if (srcStat.isFIFO())
|
|
1713
|
+
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1714
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1715
|
+
}
|
|
1716
|
+
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1717
|
+
if (!destStat)
|
|
1718
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1719
|
+
return mayCopyFile(srcStat, src, dest, opts);
|
|
1720
|
+
}
|
|
1721
|
+
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1722
|
+
if (opts.overwrite) {
|
|
1723
|
+
fs.unlinkSync(dest);
|
|
1724
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1725
|
+
} else if (opts.errorOnExist) {
|
|
1726
|
+
throw new Error(`'${dest}' already exists`);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
function copyFile(srcStat, src, dest, opts) {
|
|
1730
|
+
fs.copyFileSync(src, dest);
|
|
1731
|
+
if (opts.preserveTimestamps)
|
|
1732
|
+
handleTimestamps(srcStat.mode, src, dest);
|
|
1733
|
+
return setDestMode(dest, srcStat.mode);
|
|
1734
|
+
}
|
|
1735
|
+
function handleTimestamps(srcMode, src, dest) {
|
|
1736
|
+
if (fileIsNotWritable(srcMode))
|
|
1737
|
+
makeFileWritable(dest, srcMode);
|
|
1738
|
+
return setDestTimestamps(src, dest);
|
|
1739
|
+
}
|
|
1740
|
+
function fileIsNotWritable(srcMode) {
|
|
1741
|
+
return (srcMode & 128) === 0;
|
|
1742
|
+
}
|
|
1743
|
+
function makeFileWritable(dest, srcMode) {
|
|
1744
|
+
return setDestMode(dest, srcMode | 128);
|
|
1745
|
+
}
|
|
1746
|
+
function setDestMode(dest, srcMode) {
|
|
1747
|
+
return fs.chmodSync(dest, srcMode);
|
|
1748
|
+
}
|
|
1749
|
+
function setDestTimestamps(src, dest) {
|
|
1750
|
+
const updatedSrcStat = fs.statSync(src);
|
|
1751
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1752
|
+
}
|
|
1753
|
+
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1754
|
+
if (!destStat)
|
|
1755
|
+
return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1756
|
+
return copyDir(src, dest, opts);
|
|
1757
|
+
}
|
|
1758
|
+
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1759
|
+
fs.mkdirSync(dest);
|
|
1760
|
+
copyDir(src, dest, opts);
|
|
1761
|
+
return setDestMode(dest, srcMode);
|
|
1762
|
+
}
|
|
1763
|
+
function copyDir(src, dest, opts) {
|
|
1764
|
+
fs.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
|
|
1765
|
+
}
|
|
1766
|
+
function copyDirItem(item, src, dest, opts) {
|
|
1767
|
+
const srcItem = path.join(src, item);
|
|
1768
|
+
const destItem = path.join(dest, item);
|
|
1769
|
+
if (opts.filter && !opts.filter(srcItem, destItem))
|
|
1770
|
+
return;
|
|
1771
|
+
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1772
|
+
return getStats(destStat, srcItem, destItem, opts);
|
|
1773
|
+
}
|
|
1774
|
+
function onLink(destStat, src, dest, opts) {
|
|
1775
|
+
let resolvedSrc = fs.readlinkSync(src);
|
|
1776
|
+
if (opts.dereference) {
|
|
1777
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
|
|
1778
|
+
}
|
|
1779
|
+
if (!destStat) {
|
|
1780
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1781
|
+
} else {
|
|
1782
|
+
let resolvedDest;
|
|
1783
|
+
try {
|
|
1784
|
+
resolvedDest = fs.readlinkSync(dest);
|
|
1785
|
+
} catch (err) {
|
|
1786
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN")
|
|
1787
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1788
|
+
throw err;
|
|
1789
|
+
}
|
|
1790
|
+
if (opts.dereference) {
|
|
1791
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest);
|
|
1792
|
+
}
|
|
1793
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1794
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1795
|
+
}
|
|
1796
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1797
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1798
|
+
}
|
|
1799
|
+
return copyLink(resolvedSrc, dest);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
function copyLink(resolvedSrc, dest) {
|
|
1803
|
+
fs.unlinkSync(dest);
|
|
1804
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1805
|
+
}
|
|
1806
|
+
module.exports = copySync2;
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
|
|
1810
|
+
// node_modules/fs-extra/lib/copy/index.js
|
|
1811
|
+
var require_copy2 = __commonJS({
|
|
1812
|
+
"node_modules/fs-extra/lib/copy/index.js"(exports, module) {
|
|
1813
|
+
var import_universalify = __toESM(require_universalify());
|
|
1814
|
+
var import_copy2 = __toESM(require_copy());
|
|
1815
|
+
var import_copy_sync = __toESM(require_copy_sync());
|
|
1816
|
+
var u = import_universalify.default.fromCallback;
|
|
1817
|
+
module.exports = {
|
|
1818
|
+
copy: u(import_copy2.default),
|
|
1819
|
+
copySync: import_copy_sync.default
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1824
|
+
// node_modules/fs-extra/lib/remove/index.js
|
|
1825
|
+
var require_remove = __commonJS({
|
|
1826
|
+
"node_modules/fs-extra/lib/remove/index.js"(exports, module) {
|
|
1827
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1828
|
+
var import_universalify = __toESM(require_universalify());
|
|
1829
|
+
var fs = import_graceful_fs.default;
|
|
1830
|
+
var u = import_universalify.default.fromCallback;
|
|
1831
|
+
function remove2(path, callback) {
|
|
1832
|
+
fs.rm(path, { recursive: true, force: true }, callback);
|
|
1833
|
+
}
|
|
1834
|
+
function removeSync2(path) {
|
|
1835
|
+
fs.rmSync(path, { recursive: true, force: true });
|
|
1836
|
+
}
|
|
1837
|
+
module.exports = {
|
|
1838
|
+
remove: u(remove2),
|
|
1839
|
+
removeSync: removeSync2
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
|
|
1844
|
+
// node_modules/fs-extra/lib/move/move.js
|
|
1845
|
+
import __import_path6 from "path";
|
|
1846
|
+
var require_move = __commonJS({
|
|
1847
|
+
"node_modules/fs-extra/lib/move/move.js"(exports, module) {
|
|
1848
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1849
|
+
var import_copy2 = __toESM(require_copy2());
|
|
1850
|
+
var import_remove2 = __toESM(require_remove());
|
|
1851
|
+
var import_mkdirs = __toESM(require_mkdirs());
|
|
1852
|
+
var import_path_exists = __toESM(require_path_exists());
|
|
1853
|
+
var import_stat = __toESM(require_stat());
|
|
1854
|
+
var fs = import_graceful_fs.default;
|
|
1855
|
+
var path = __import_path6;
|
|
1856
|
+
var copy2 = import_copy2.default.copy;
|
|
1857
|
+
var remove2 = import_remove2.default.remove;
|
|
1858
|
+
var mkdirp = import_mkdirs.default.mkdirp;
|
|
1859
|
+
var pathExists = import_path_exists.default.pathExists;
|
|
1860
|
+
var stat = import_stat.default;
|
|
1861
|
+
function move2(src, dest, opts, cb) {
|
|
1862
|
+
if (typeof opts === "function") {
|
|
1863
|
+
cb = opts;
|
|
1864
|
+
opts = {};
|
|
1865
|
+
}
|
|
1866
|
+
opts = opts || {};
|
|
1867
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
1868
|
+
stat.checkPaths(src, dest, "move", opts, (err, stats) => {
|
|
1869
|
+
if (err)
|
|
1870
|
+
return cb(err);
|
|
1871
|
+
const { srcStat, isChangingCase = false } = stats;
|
|
1872
|
+
stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
|
|
1873
|
+
if (err2)
|
|
1874
|
+
return cb(err2);
|
|
1875
|
+
if (isParentRoot(dest))
|
|
1876
|
+
return doRename(src, dest, overwrite, isChangingCase, cb);
|
|
1877
|
+
mkdirp(path.dirname(dest), (err3) => {
|
|
1878
|
+
if (err3)
|
|
1879
|
+
return cb(err3);
|
|
1880
|
+
return doRename(src, dest, overwrite, isChangingCase, cb);
|
|
1881
|
+
});
|
|
1882
|
+
});
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
function isParentRoot(dest) {
|
|
1886
|
+
const parent = path.dirname(dest);
|
|
1887
|
+
const parsedPath = path.parse(parent);
|
|
1888
|
+
return parsedPath.root === parent;
|
|
1889
|
+
}
|
|
1890
|
+
function doRename(src, dest, overwrite, isChangingCase, cb) {
|
|
1891
|
+
if (isChangingCase)
|
|
1892
|
+
return rename(src, dest, overwrite, cb);
|
|
1893
|
+
if (overwrite) {
|
|
1894
|
+
return remove2(dest, (err) => {
|
|
1895
|
+
if (err)
|
|
1896
|
+
return cb(err);
|
|
1897
|
+
return rename(src, dest, overwrite, cb);
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
pathExists(dest, (err, destExists) => {
|
|
1901
|
+
if (err)
|
|
1902
|
+
return cb(err);
|
|
1903
|
+
if (destExists)
|
|
1904
|
+
return cb(new Error("dest already exists."));
|
|
1905
|
+
return rename(src, dest, overwrite, cb);
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
function rename(src, dest, overwrite, cb) {
|
|
1909
|
+
fs.rename(src, dest, (err) => {
|
|
1910
|
+
if (!err)
|
|
1911
|
+
return cb();
|
|
1912
|
+
if (err.code !== "EXDEV")
|
|
1913
|
+
return cb(err);
|
|
1914
|
+
return moveAcrossDevice(src, dest, overwrite, cb);
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
function moveAcrossDevice(src, dest, overwrite, cb) {
|
|
1918
|
+
const opts = {
|
|
1919
|
+
overwrite,
|
|
1920
|
+
errorOnExist: true,
|
|
1921
|
+
preserveTimestamps: true
|
|
1922
|
+
};
|
|
1923
|
+
copy2(src, dest, opts, (err) => {
|
|
1924
|
+
if (err)
|
|
1925
|
+
return cb(err);
|
|
1926
|
+
return remove2(src, cb);
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
module.exports = move2;
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
|
|
1933
|
+
// node_modules/fs-extra/lib/move/move-sync.js
|
|
1934
|
+
import __import_path7 from "path";
|
|
1935
|
+
var require_move_sync = __commonJS({
|
|
1936
|
+
"node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
|
|
1937
|
+
var import_graceful_fs = __toESM(require_graceful_fs());
|
|
1938
|
+
var import_copy2 = __toESM(require_copy2());
|
|
1939
|
+
var import_remove2 = __toESM(require_remove());
|
|
1940
|
+
var import_mkdirs = __toESM(require_mkdirs());
|
|
1941
|
+
var import_stat = __toESM(require_stat());
|
|
1942
|
+
var fs = import_graceful_fs.default;
|
|
1943
|
+
var path = __import_path7;
|
|
1944
|
+
var copySync2 = import_copy2.default.copySync;
|
|
1945
|
+
var removeSync2 = import_remove2.default.removeSync;
|
|
1946
|
+
var mkdirpSync = import_mkdirs.default.mkdirpSync;
|
|
1947
|
+
var stat = import_stat.default;
|
|
1948
|
+
function moveSync2(src, dest, opts) {
|
|
1949
|
+
opts = opts || {};
|
|
1950
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
1951
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
1952
|
+
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
1953
|
+
if (!isParentRoot(dest))
|
|
1954
|
+
mkdirpSync(path.dirname(dest));
|
|
1955
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
1956
|
+
}
|
|
1957
|
+
function isParentRoot(dest) {
|
|
1958
|
+
const parent = path.dirname(dest);
|
|
1959
|
+
const parsedPath = path.parse(parent);
|
|
1960
|
+
return parsedPath.root === parent;
|
|
1961
|
+
}
|
|
1962
|
+
function doRename(src, dest, overwrite, isChangingCase) {
|
|
1963
|
+
if (isChangingCase)
|
|
1964
|
+
return rename(src, dest, overwrite);
|
|
1965
|
+
if (overwrite) {
|
|
1966
|
+
removeSync2(dest);
|
|
1967
|
+
return rename(src, dest, overwrite);
|
|
1968
|
+
}
|
|
1969
|
+
if (fs.existsSync(dest))
|
|
1970
|
+
throw new Error("dest already exists.");
|
|
1971
|
+
return rename(src, dest, overwrite);
|
|
1972
|
+
}
|
|
1973
|
+
function rename(src, dest, overwrite) {
|
|
1974
|
+
try {
|
|
1975
|
+
fs.renameSync(src, dest);
|
|
1976
|
+
} catch (err) {
|
|
1977
|
+
if (err.code !== "EXDEV")
|
|
1978
|
+
throw err;
|
|
1979
|
+
return moveAcrossDevice(src, dest, overwrite);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
|
1983
|
+
const opts = {
|
|
1984
|
+
overwrite,
|
|
1985
|
+
errorOnExist: true,
|
|
1986
|
+
preserveTimestamps: true
|
|
1987
|
+
};
|
|
1988
|
+
copySync2(src, dest, opts);
|
|
1989
|
+
return removeSync2(src);
|
|
1990
|
+
}
|
|
1991
|
+
module.exports = moveSync2;
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
|
|
1995
|
+
// node_modules/fs-extra/lib/move/index.js
|
|
1996
|
+
var require_move2 = __commonJS({
|
|
1997
|
+
"node_modules/fs-extra/lib/move/index.js"(exports, module) {
|
|
1998
|
+
var import_universalify = __toESM(require_universalify());
|
|
1999
|
+
var import_move2 = __toESM(require_move());
|
|
2000
|
+
var import_move_sync = __toESM(require_move_sync());
|
|
2001
|
+
var u = import_universalify.default.fromCallback;
|
|
2002
|
+
module.exports = {
|
|
2003
|
+
move: u(import_move2.default),
|
|
2004
|
+
moveSync: import_move_sync.default
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
});
|
|
2008
|
+
|
|
2009
|
+
// vendors/index.src.js
|
|
2010
|
+
var import_upath = __toESM(require_upath(), 1);
|
|
2011
|
+
var import_copy = __toESM(require_copy2(), 1);
|
|
2012
|
+
var import_move = __toESM(require_move2(), 1);
|
|
2013
|
+
var import_remove = __toESM(require_remove(), 1);
|
|
2014
|
+
var export_copy = import_copy.copy;
|
|
2015
|
+
var export_copySync = import_copy.copySync;
|
|
2016
|
+
var export_move = import_move.move;
|
|
2017
|
+
var export_moveSync = import_move.moveSync;
|
|
2018
|
+
var export_remove = import_remove.remove;
|
|
2019
|
+
var export_removeSync = import_remove.removeSync;
|
|
2020
|
+
var export_upath = import_upath.default;
|
|
2021
|
+
export {
|
|
2022
|
+
export_copy as copy,
|
|
2023
|
+
export_copySync as copySync,
|
|
2024
|
+
export_move as move,
|
|
2025
|
+
export_moveSync as moveSync,
|
|
2026
|
+
export_remove as remove,
|
|
2027
|
+
export_removeSync as removeSync,
|
|
2028
|
+
export_upath as upath
|
|
2029
|
+
};
|