bunki 0.1.2 → 0.1.4
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/README.md +1 -1
- package/dist/cli.js +128 -2165
- package/dist/index.js +64 -2100
- package/package.json +1 -3
package/dist/index.js
CHANGED
|
@@ -20254,8 +20254,8 @@ var require_core2 = __commonJS((exports, module) => {
|
|
|
20254
20254
|
endMultiClass(mode);
|
|
20255
20255
|
}
|
|
20256
20256
|
function compileLanguage(language) {
|
|
20257
|
-
function langRe(value,
|
|
20258
|
-
return new RegExp(source(value), "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (
|
|
20257
|
+
function langRe(value, global) {
|
|
20258
|
+
return new RegExp(source(value), "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : ""));
|
|
20259
20259
|
}
|
|
20260
20260
|
|
|
20261
20261
|
class MultiRegex {
|
|
@@ -21085,2079 +21085,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`);
|
|
|
21085
21085
|
highlight.HighlightJS = highlight;
|
|
21086
21086
|
highlight.default = highlight;
|
|
21087
21087
|
});
|
|
21088
|
-
|
|
21089
|
-
// node_modules/universalify/index.js
|
|
21090
|
-
var require_universalify = __commonJS((exports) => {
|
|
21091
|
-
exports.fromCallback = function(fn) {
|
|
21092
|
-
return Object.defineProperty(function(...args) {
|
|
21093
|
-
if (typeof args[args.length - 1] === "function")
|
|
21094
|
-
fn.apply(this, args);
|
|
21095
|
-
else {
|
|
21096
|
-
return new Promise((resolve, reject) => {
|
|
21097
|
-
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
21098
|
-
fn.apply(this, args);
|
|
21099
|
-
});
|
|
21100
|
-
}
|
|
21101
|
-
}, "name", { value: fn.name });
|
|
21102
|
-
};
|
|
21103
|
-
exports.fromPromise = function(fn) {
|
|
21104
|
-
return Object.defineProperty(function(...args) {
|
|
21105
|
-
const cb = args[args.length - 1];
|
|
21106
|
-
if (typeof cb !== "function")
|
|
21107
|
-
return fn.apply(this, args);
|
|
21108
|
-
else {
|
|
21109
|
-
args.pop();
|
|
21110
|
-
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
21111
|
-
}
|
|
21112
|
-
}, "name", { value: fn.name });
|
|
21113
|
-
};
|
|
21114
|
-
});
|
|
21115
|
-
|
|
21116
|
-
// node_modules/graceful-fs/polyfills.js
|
|
21117
|
-
var require_polyfills = __commonJS((exports, module) => {
|
|
21118
|
-
var constants = __require("constants");
|
|
21119
|
-
var origCwd = process.cwd;
|
|
21120
|
-
var cwd = null;
|
|
21121
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
21122
|
-
process.cwd = function() {
|
|
21123
|
-
if (!cwd)
|
|
21124
|
-
cwd = origCwd.call(process);
|
|
21125
|
-
return cwd;
|
|
21126
|
-
};
|
|
21127
|
-
try {
|
|
21128
|
-
process.cwd();
|
|
21129
|
-
} catch (er) {}
|
|
21130
|
-
if (typeof process.chdir === "function") {
|
|
21131
|
-
chdir = process.chdir;
|
|
21132
|
-
process.chdir = function(d) {
|
|
21133
|
-
cwd = null;
|
|
21134
|
-
chdir.call(process, d);
|
|
21135
|
-
};
|
|
21136
|
-
if (Object.setPrototypeOf)
|
|
21137
|
-
Object.setPrototypeOf(process.chdir, chdir);
|
|
21138
|
-
}
|
|
21139
|
-
var chdir;
|
|
21140
|
-
module.exports = patch;
|
|
21141
|
-
function patch(fs) {
|
|
21142
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
21143
|
-
patchLchmod(fs);
|
|
21144
|
-
}
|
|
21145
|
-
if (!fs.lutimes) {
|
|
21146
|
-
patchLutimes(fs);
|
|
21147
|
-
}
|
|
21148
|
-
fs.chown = chownFix(fs.chown);
|
|
21149
|
-
fs.fchown = chownFix(fs.fchown);
|
|
21150
|
-
fs.lchown = chownFix(fs.lchown);
|
|
21151
|
-
fs.chmod = chmodFix(fs.chmod);
|
|
21152
|
-
fs.fchmod = chmodFix(fs.fchmod);
|
|
21153
|
-
fs.lchmod = chmodFix(fs.lchmod);
|
|
21154
|
-
fs.chownSync = chownFixSync(fs.chownSync);
|
|
21155
|
-
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
21156
|
-
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
21157
|
-
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
21158
|
-
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
21159
|
-
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
21160
|
-
fs.stat = statFix(fs.stat);
|
|
21161
|
-
fs.fstat = statFix(fs.fstat);
|
|
21162
|
-
fs.lstat = statFix(fs.lstat);
|
|
21163
|
-
fs.statSync = statFixSync(fs.statSync);
|
|
21164
|
-
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
21165
|
-
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
21166
|
-
if (fs.chmod && !fs.lchmod) {
|
|
21167
|
-
fs.lchmod = function(path3, mode, cb) {
|
|
21168
|
-
if (cb)
|
|
21169
|
-
process.nextTick(cb);
|
|
21170
|
-
};
|
|
21171
|
-
fs.lchmodSync = function() {};
|
|
21172
|
-
}
|
|
21173
|
-
if (fs.chown && !fs.lchown) {
|
|
21174
|
-
fs.lchown = function(path3, uid, gid, cb) {
|
|
21175
|
-
if (cb)
|
|
21176
|
-
process.nextTick(cb);
|
|
21177
|
-
};
|
|
21178
|
-
fs.lchownSync = function() {};
|
|
21179
|
-
}
|
|
21180
|
-
if (platform === "win32") {
|
|
21181
|
-
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
|
|
21182
|
-
function rename(from, to, cb) {
|
|
21183
|
-
var start = Date.now();
|
|
21184
|
-
var backoff = 0;
|
|
21185
|
-
fs$rename(from, to, function CB(er) {
|
|
21186
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 60000) {
|
|
21187
|
-
setTimeout(function() {
|
|
21188
|
-
fs.stat(to, function(stater, st) {
|
|
21189
|
-
if (stater && stater.code === "ENOENT")
|
|
21190
|
-
fs$rename(from, to, CB);
|
|
21191
|
-
else
|
|
21192
|
-
cb(er);
|
|
21193
|
-
});
|
|
21194
|
-
}, backoff);
|
|
21195
|
-
if (backoff < 100)
|
|
21196
|
-
backoff += 10;
|
|
21197
|
-
return;
|
|
21198
|
-
}
|
|
21199
|
-
if (cb)
|
|
21200
|
-
cb(er);
|
|
21201
|
-
});
|
|
21202
|
-
}
|
|
21203
|
-
if (Object.setPrototypeOf)
|
|
21204
|
-
Object.setPrototypeOf(rename, fs$rename);
|
|
21205
|
-
return rename;
|
|
21206
|
-
}(fs.rename);
|
|
21207
|
-
}
|
|
21208
|
-
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
|
|
21209
|
-
function read(fd, buffer, offset, length, position, callback_) {
|
|
21210
|
-
var callback;
|
|
21211
|
-
if (callback_ && typeof callback_ === "function") {
|
|
21212
|
-
var eagCounter = 0;
|
|
21213
|
-
callback = function(er, _, __) {
|
|
21214
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
21215
|
-
eagCounter++;
|
|
21216
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
21217
|
-
}
|
|
21218
|
-
callback_.apply(this, arguments);
|
|
21219
|
-
};
|
|
21220
|
-
}
|
|
21221
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
21222
|
-
}
|
|
21223
|
-
if (Object.setPrototypeOf)
|
|
21224
|
-
Object.setPrototypeOf(read, fs$read);
|
|
21225
|
-
return read;
|
|
21226
|
-
}(fs.read);
|
|
21227
|
-
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
|
|
21228
|
-
return function(fd, buffer, offset, length, position) {
|
|
21229
|
-
var eagCounter = 0;
|
|
21230
|
-
while (true) {
|
|
21231
|
-
try {
|
|
21232
|
-
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
21233
|
-
} catch (er) {
|
|
21234
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
21235
|
-
eagCounter++;
|
|
21236
|
-
continue;
|
|
21237
|
-
}
|
|
21238
|
-
throw er;
|
|
21239
|
-
}
|
|
21240
|
-
}
|
|
21241
|
-
};
|
|
21242
|
-
}(fs.readSync);
|
|
21243
|
-
function patchLchmod(fs2) {
|
|
21244
|
-
fs2.lchmod = function(path3, mode, callback) {
|
|
21245
|
-
fs2.open(path3, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
21246
|
-
if (err) {
|
|
21247
|
-
if (callback)
|
|
21248
|
-
callback(err);
|
|
21249
|
-
return;
|
|
21250
|
-
}
|
|
21251
|
-
fs2.fchmod(fd, mode, function(err2) {
|
|
21252
|
-
fs2.close(fd, function(err22) {
|
|
21253
|
-
if (callback)
|
|
21254
|
-
callback(err2 || err22);
|
|
21255
|
-
});
|
|
21256
|
-
});
|
|
21257
|
-
});
|
|
21258
|
-
};
|
|
21259
|
-
fs2.lchmodSync = function(path3, mode) {
|
|
21260
|
-
var fd = fs2.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
21261
|
-
var threw = true;
|
|
21262
|
-
var ret;
|
|
21263
|
-
try {
|
|
21264
|
-
ret = fs2.fchmodSync(fd, mode);
|
|
21265
|
-
threw = false;
|
|
21266
|
-
} finally {
|
|
21267
|
-
if (threw) {
|
|
21268
|
-
try {
|
|
21269
|
-
fs2.closeSync(fd);
|
|
21270
|
-
} catch (er) {}
|
|
21271
|
-
} else {
|
|
21272
|
-
fs2.closeSync(fd);
|
|
21273
|
-
}
|
|
21274
|
-
}
|
|
21275
|
-
return ret;
|
|
21276
|
-
};
|
|
21277
|
-
}
|
|
21278
|
-
function patchLutimes(fs2) {
|
|
21279
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
21280
|
-
fs2.lutimes = function(path3, at, mt, cb) {
|
|
21281
|
-
fs2.open(path3, constants.O_SYMLINK, function(er, fd) {
|
|
21282
|
-
if (er) {
|
|
21283
|
-
if (cb)
|
|
21284
|
-
cb(er);
|
|
21285
|
-
return;
|
|
21286
|
-
}
|
|
21287
|
-
fs2.futimes(fd, at, mt, function(er2) {
|
|
21288
|
-
fs2.close(fd, function(er22) {
|
|
21289
|
-
if (cb)
|
|
21290
|
-
cb(er2 || er22);
|
|
21291
|
-
});
|
|
21292
|
-
});
|
|
21293
|
-
});
|
|
21294
|
-
};
|
|
21295
|
-
fs2.lutimesSync = function(path3, at, mt) {
|
|
21296
|
-
var fd = fs2.openSync(path3, constants.O_SYMLINK);
|
|
21297
|
-
var ret;
|
|
21298
|
-
var threw = true;
|
|
21299
|
-
try {
|
|
21300
|
-
ret = fs2.futimesSync(fd, at, mt);
|
|
21301
|
-
threw = false;
|
|
21302
|
-
} finally {
|
|
21303
|
-
if (threw) {
|
|
21304
|
-
try {
|
|
21305
|
-
fs2.closeSync(fd);
|
|
21306
|
-
} catch (er) {}
|
|
21307
|
-
} else {
|
|
21308
|
-
fs2.closeSync(fd);
|
|
21309
|
-
}
|
|
21310
|
-
}
|
|
21311
|
-
return ret;
|
|
21312
|
-
};
|
|
21313
|
-
} else if (fs2.futimes) {
|
|
21314
|
-
fs2.lutimes = function(_a, _b, _c, cb) {
|
|
21315
|
-
if (cb)
|
|
21316
|
-
process.nextTick(cb);
|
|
21317
|
-
};
|
|
21318
|
-
fs2.lutimesSync = function() {};
|
|
21319
|
-
}
|
|
21320
|
-
}
|
|
21321
|
-
function chmodFix(orig) {
|
|
21322
|
-
if (!orig)
|
|
21323
|
-
return orig;
|
|
21324
|
-
return function(target, mode, cb) {
|
|
21325
|
-
return orig.call(fs, target, mode, function(er) {
|
|
21326
|
-
if (chownErOk(er))
|
|
21327
|
-
er = null;
|
|
21328
|
-
if (cb)
|
|
21329
|
-
cb.apply(this, arguments);
|
|
21330
|
-
});
|
|
21331
|
-
};
|
|
21332
|
-
}
|
|
21333
|
-
function chmodFixSync(orig) {
|
|
21334
|
-
if (!orig)
|
|
21335
|
-
return orig;
|
|
21336
|
-
return function(target, mode) {
|
|
21337
|
-
try {
|
|
21338
|
-
return orig.call(fs, target, mode);
|
|
21339
|
-
} catch (er) {
|
|
21340
|
-
if (!chownErOk(er))
|
|
21341
|
-
throw er;
|
|
21342
|
-
}
|
|
21343
|
-
};
|
|
21344
|
-
}
|
|
21345
|
-
function chownFix(orig) {
|
|
21346
|
-
if (!orig)
|
|
21347
|
-
return orig;
|
|
21348
|
-
return function(target, uid, gid, cb) {
|
|
21349
|
-
return orig.call(fs, target, uid, gid, function(er) {
|
|
21350
|
-
if (chownErOk(er))
|
|
21351
|
-
er = null;
|
|
21352
|
-
if (cb)
|
|
21353
|
-
cb.apply(this, arguments);
|
|
21354
|
-
});
|
|
21355
|
-
};
|
|
21356
|
-
}
|
|
21357
|
-
function chownFixSync(orig) {
|
|
21358
|
-
if (!orig)
|
|
21359
|
-
return orig;
|
|
21360
|
-
return function(target, uid, gid) {
|
|
21361
|
-
try {
|
|
21362
|
-
return orig.call(fs, target, uid, gid);
|
|
21363
|
-
} catch (er) {
|
|
21364
|
-
if (!chownErOk(er))
|
|
21365
|
-
throw er;
|
|
21366
|
-
}
|
|
21367
|
-
};
|
|
21368
|
-
}
|
|
21369
|
-
function statFix(orig) {
|
|
21370
|
-
if (!orig)
|
|
21371
|
-
return orig;
|
|
21372
|
-
return function(target, options3, cb) {
|
|
21373
|
-
if (typeof options3 === "function") {
|
|
21374
|
-
cb = options3;
|
|
21375
|
-
options3 = null;
|
|
21376
|
-
}
|
|
21377
|
-
function callback(er, stats) {
|
|
21378
|
-
if (stats) {
|
|
21379
|
-
if (stats.uid < 0)
|
|
21380
|
-
stats.uid += 4294967296;
|
|
21381
|
-
if (stats.gid < 0)
|
|
21382
|
-
stats.gid += 4294967296;
|
|
21383
|
-
}
|
|
21384
|
-
if (cb)
|
|
21385
|
-
cb.apply(this, arguments);
|
|
21386
|
-
}
|
|
21387
|
-
return options3 ? orig.call(fs, target, options3, callback) : orig.call(fs, target, callback);
|
|
21388
|
-
};
|
|
21389
|
-
}
|
|
21390
|
-
function statFixSync(orig) {
|
|
21391
|
-
if (!orig)
|
|
21392
|
-
return orig;
|
|
21393
|
-
return function(target, options3) {
|
|
21394
|
-
var stats = options3 ? orig.call(fs, target, options3) : orig.call(fs, target);
|
|
21395
|
-
if (stats) {
|
|
21396
|
-
if (stats.uid < 0)
|
|
21397
|
-
stats.uid += 4294967296;
|
|
21398
|
-
if (stats.gid < 0)
|
|
21399
|
-
stats.gid += 4294967296;
|
|
21400
|
-
}
|
|
21401
|
-
return stats;
|
|
21402
|
-
};
|
|
21403
|
-
}
|
|
21404
|
-
function chownErOk(er) {
|
|
21405
|
-
if (!er)
|
|
21406
|
-
return true;
|
|
21407
|
-
if (er.code === "ENOSYS")
|
|
21408
|
-
return true;
|
|
21409
|
-
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
21410
|
-
if (nonroot) {
|
|
21411
|
-
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
21412
|
-
return true;
|
|
21413
|
-
}
|
|
21414
|
-
return false;
|
|
21415
|
-
}
|
|
21416
|
-
}
|
|
21417
|
-
});
|
|
21418
|
-
|
|
21419
|
-
// node_modules/graceful-fs/legacy-streams.js
|
|
21420
|
-
var require_legacy_streams = __commonJS((exports, module) => {
|
|
21421
|
-
var Stream = __require("stream").Stream;
|
|
21422
|
-
module.exports = legacy;
|
|
21423
|
-
function legacy(fs) {
|
|
21424
|
-
return {
|
|
21425
|
-
ReadStream,
|
|
21426
|
-
WriteStream
|
|
21427
|
-
};
|
|
21428
|
-
function ReadStream(path3, options3) {
|
|
21429
|
-
if (!(this instanceof ReadStream))
|
|
21430
|
-
return new ReadStream(path3, options3);
|
|
21431
|
-
Stream.call(this);
|
|
21432
|
-
var self = this;
|
|
21433
|
-
this.path = path3;
|
|
21434
|
-
this.fd = null;
|
|
21435
|
-
this.readable = true;
|
|
21436
|
-
this.paused = false;
|
|
21437
|
-
this.flags = "r";
|
|
21438
|
-
this.mode = 438;
|
|
21439
|
-
this.bufferSize = 64 * 1024;
|
|
21440
|
-
options3 = options3 || {};
|
|
21441
|
-
var keys = Object.keys(options3);
|
|
21442
|
-
for (var index = 0, length = keys.length;index < length; index++) {
|
|
21443
|
-
var key = keys[index];
|
|
21444
|
-
this[key] = options3[key];
|
|
21445
|
-
}
|
|
21446
|
-
if (this.encoding)
|
|
21447
|
-
this.setEncoding(this.encoding);
|
|
21448
|
-
if (this.start !== undefined) {
|
|
21449
|
-
if (typeof this.start !== "number") {
|
|
21450
|
-
throw TypeError("start must be a Number");
|
|
21451
|
-
}
|
|
21452
|
-
if (this.end === undefined) {
|
|
21453
|
-
this.end = Infinity;
|
|
21454
|
-
} else if (typeof this.end !== "number") {
|
|
21455
|
-
throw TypeError("end must be a Number");
|
|
21456
|
-
}
|
|
21457
|
-
if (this.start > this.end) {
|
|
21458
|
-
throw new Error("start must be <= end");
|
|
21459
|
-
}
|
|
21460
|
-
this.pos = this.start;
|
|
21461
|
-
}
|
|
21462
|
-
if (this.fd !== null) {
|
|
21463
|
-
process.nextTick(function() {
|
|
21464
|
-
self._read();
|
|
21465
|
-
});
|
|
21466
|
-
return;
|
|
21467
|
-
}
|
|
21468
|
-
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
21469
|
-
if (err) {
|
|
21470
|
-
self.emit("error", err);
|
|
21471
|
-
self.readable = false;
|
|
21472
|
-
return;
|
|
21473
|
-
}
|
|
21474
|
-
self.fd = fd;
|
|
21475
|
-
self.emit("open", fd);
|
|
21476
|
-
self._read();
|
|
21477
|
-
});
|
|
21478
|
-
}
|
|
21479
|
-
function WriteStream(path3, options3) {
|
|
21480
|
-
if (!(this instanceof WriteStream))
|
|
21481
|
-
return new WriteStream(path3, options3);
|
|
21482
|
-
Stream.call(this);
|
|
21483
|
-
this.path = path3;
|
|
21484
|
-
this.fd = null;
|
|
21485
|
-
this.writable = true;
|
|
21486
|
-
this.flags = "w";
|
|
21487
|
-
this.encoding = "binary";
|
|
21488
|
-
this.mode = 438;
|
|
21489
|
-
this.bytesWritten = 0;
|
|
21490
|
-
options3 = options3 || {};
|
|
21491
|
-
var keys = Object.keys(options3);
|
|
21492
|
-
for (var index = 0, length = keys.length;index < length; index++) {
|
|
21493
|
-
var key = keys[index];
|
|
21494
|
-
this[key] = options3[key];
|
|
21495
|
-
}
|
|
21496
|
-
if (this.start !== undefined) {
|
|
21497
|
-
if (typeof this.start !== "number") {
|
|
21498
|
-
throw TypeError("start must be a Number");
|
|
21499
|
-
}
|
|
21500
|
-
if (this.start < 0) {
|
|
21501
|
-
throw new Error("start must be >= zero");
|
|
21502
|
-
}
|
|
21503
|
-
this.pos = this.start;
|
|
21504
|
-
}
|
|
21505
|
-
this.busy = false;
|
|
21506
|
-
this._queue = [];
|
|
21507
|
-
if (this.fd === null) {
|
|
21508
|
-
this._open = fs.open;
|
|
21509
|
-
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
21510
|
-
this.flush();
|
|
21511
|
-
}
|
|
21512
|
-
}
|
|
21513
|
-
}
|
|
21514
|
-
});
|
|
21515
|
-
|
|
21516
|
-
// node_modules/graceful-fs/clone.js
|
|
21517
|
-
var require_clone = __commonJS((exports, module) => {
|
|
21518
|
-
module.exports = clone;
|
|
21519
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
21520
|
-
return obj.__proto__;
|
|
21521
|
-
};
|
|
21522
|
-
function clone(obj) {
|
|
21523
|
-
if (obj === null || typeof obj !== "object")
|
|
21524
|
-
return obj;
|
|
21525
|
-
if (obj instanceof Object)
|
|
21526
|
-
var copy = { __proto__: getPrototypeOf(obj) };
|
|
21527
|
-
else
|
|
21528
|
-
var copy = Object.create(null);
|
|
21529
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
21530
|
-
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
21531
|
-
});
|
|
21532
|
-
return copy;
|
|
21533
|
-
}
|
|
21534
|
-
});
|
|
21535
|
-
|
|
21536
|
-
// node_modules/graceful-fs/graceful-fs.js
|
|
21537
|
-
var require_graceful_fs = __commonJS((exports, module) => {
|
|
21538
|
-
var fs = __require("fs");
|
|
21539
|
-
var polyfills = require_polyfills();
|
|
21540
|
-
var legacy = require_legacy_streams();
|
|
21541
|
-
var clone = require_clone();
|
|
21542
|
-
var util = __require("util");
|
|
21543
|
-
var gracefulQueue;
|
|
21544
|
-
var previousSymbol;
|
|
21545
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
21546
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
21547
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
21548
|
-
} else {
|
|
21549
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
21550
|
-
previousSymbol = "___graceful-fs.previous";
|
|
21551
|
-
}
|
|
21552
|
-
function noop() {}
|
|
21553
|
-
function publishQueue(context, queue2) {
|
|
21554
|
-
Object.defineProperty(context, gracefulQueue, {
|
|
21555
|
-
get: function() {
|
|
21556
|
-
return queue2;
|
|
21557
|
-
}
|
|
21558
|
-
});
|
|
21559
|
-
}
|
|
21560
|
-
var debug = noop;
|
|
21561
|
-
if (util.debuglog)
|
|
21562
|
-
debug = util.debuglog("gfs4");
|
|
21563
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
21564
|
-
debug = function() {
|
|
21565
|
-
var m = util.format.apply(util, arguments);
|
|
21566
|
-
m = "GFS4: " + m.split(/\n/).join(`
|
|
21567
|
-
GFS4: `);
|
|
21568
|
-
console.error(m);
|
|
21569
|
-
};
|
|
21570
|
-
if (!fs[gracefulQueue]) {
|
|
21571
|
-
queue = global[gracefulQueue] || [];
|
|
21572
|
-
publishQueue(fs, queue);
|
|
21573
|
-
fs.close = function(fs$close) {
|
|
21574
|
-
function close(fd, cb) {
|
|
21575
|
-
return fs$close.call(fs, fd, function(err) {
|
|
21576
|
-
if (!err) {
|
|
21577
|
-
resetQueue();
|
|
21578
|
-
}
|
|
21579
|
-
if (typeof cb === "function")
|
|
21580
|
-
cb.apply(this, arguments);
|
|
21581
|
-
});
|
|
21582
|
-
}
|
|
21583
|
-
Object.defineProperty(close, previousSymbol, {
|
|
21584
|
-
value: fs$close
|
|
21585
|
-
});
|
|
21586
|
-
return close;
|
|
21587
|
-
}(fs.close);
|
|
21588
|
-
fs.closeSync = function(fs$closeSync) {
|
|
21589
|
-
function closeSync(fd) {
|
|
21590
|
-
fs$closeSync.apply(fs, arguments);
|
|
21591
|
-
resetQueue();
|
|
21592
|
-
}
|
|
21593
|
-
Object.defineProperty(closeSync, previousSymbol, {
|
|
21594
|
-
value: fs$closeSync
|
|
21595
|
-
});
|
|
21596
|
-
return closeSync;
|
|
21597
|
-
}(fs.closeSync);
|
|
21598
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
21599
|
-
process.on("exit", function() {
|
|
21600
|
-
debug(fs[gracefulQueue]);
|
|
21601
|
-
__require("assert").equal(fs[gracefulQueue].length, 0);
|
|
21602
|
-
});
|
|
21603
|
-
}
|
|
21604
|
-
}
|
|
21605
|
-
var queue;
|
|
21606
|
-
if (!global[gracefulQueue]) {
|
|
21607
|
-
publishQueue(global, fs[gracefulQueue]);
|
|
21608
|
-
}
|
|
21609
|
-
module.exports = patch(clone(fs));
|
|
21610
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
21611
|
-
module.exports = patch(fs);
|
|
21612
|
-
fs.__patched = true;
|
|
21613
|
-
}
|
|
21614
|
-
function patch(fs2) {
|
|
21615
|
-
polyfills(fs2);
|
|
21616
|
-
fs2.gracefulify = patch;
|
|
21617
|
-
fs2.createReadStream = createReadStream;
|
|
21618
|
-
fs2.createWriteStream = createWriteStream;
|
|
21619
|
-
var fs$readFile = fs2.readFile;
|
|
21620
|
-
fs2.readFile = readFile;
|
|
21621
|
-
function readFile(path3, options3, cb) {
|
|
21622
|
-
if (typeof options3 === "function")
|
|
21623
|
-
cb = options3, options3 = null;
|
|
21624
|
-
return go$readFile(path3, options3, cb);
|
|
21625
|
-
function go$readFile(path4, options4, cb2, startTime) {
|
|
21626
|
-
return fs$readFile(path4, options4, function(err) {
|
|
21627
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
21628
|
-
enqueue([go$readFile, [path4, options4, cb2], err, startTime || Date.now(), Date.now()]);
|
|
21629
|
-
else {
|
|
21630
|
-
if (typeof cb2 === "function")
|
|
21631
|
-
cb2.apply(this, arguments);
|
|
21632
|
-
}
|
|
21633
|
-
});
|
|
21634
|
-
}
|
|
21635
|
-
}
|
|
21636
|
-
var fs$writeFile = fs2.writeFile;
|
|
21637
|
-
fs2.writeFile = writeFile;
|
|
21638
|
-
function writeFile(path3, data, options3, cb) {
|
|
21639
|
-
if (typeof options3 === "function")
|
|
21640
|
-
cb = options3, options3 = null;
|
|
21641
|
-
return go$writeFile(path3, data, options3, cb);
|
|
21642
|
-
function go$writeFile(path4, data2, options4, cb2, startTime) {
|
|
21643
|
-
return fs$writeFile(path4, data2, options4, function(err) {
|
|
21644
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
21645
|
-
enqueue([go$writeFile, [path4, data2, options4, cb2], err, startTime || Date.now(), Date.now()]);
|
|
21646
|
-
else {
|
|
21647
|
-
if (typeof cb2 === "function")
|
|
21648
|
-
cb2.apply(this, arguments);
|
|
21649
|
-
}
|
|
21650
|
-
});
|
|
21651
|
-
}
|
|
21652
|
-
}
|
|
21653
|
-
var fs$appendFile = fs2.appendFile;
|
|
21654
|
-
if (fs$appendFile)
|
|
21655
|
-
fs2.appendFile = appendFile;
|
|
21656
|
-
function appendFile(path3, data, options3, cb) {
|
|
21657
|
-
if (typeof options3 === "function")
|
|
21658
|
-
cb = options3, options3 = null;
|
|
21659
|
-
return go$appendFile(path3, data, options3, cb);
|
|
21660
|
-
function go$appendFile(path4, data2, options4, cb2, startTime) {
|
|
21661
|
-
return fs$appendFile(path4, data2, options4, function(err) {
|
|
21662
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
21663
|
-
enqueue([go$appendFile, [path4, data2, options4, cb2], err, startTime || Date.now(), Date.now()]);
|
|
21664
|
-
else {
|
|
21665
|
-
if (typeof cb2 === "function")
|
|
21666
|
-
cb2.apply(this, arguments);
|
|
21667
|
-
}
|
|
21668
|
-
});
|
|
21669
|
-
}
|
|
21670
|
-
}
|
|
21671
|
-
var fs$copyFile = fs2.copyFile;
|
|
21672
|
-
if (fs$copyFile)
|
|
21673
|
-
fs2.copyFile = copyFile2;
|
|
21674
|
-
function copyFile2(src, dest, flags, cb) {
|
|
21675
|
-
if (typeof flags === "function") {
|
|
21676
|
-
cb = flags;
|
|
21677
|
-
flags = 0;
|
|
21678
|
-
}
|
|
21679
|
-
return go$copyFile(src, dest, flags, cb);
|
|
21680
|
-
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
21681
|
-
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
21682
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
21683
|
-
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
21684
|
-
else {
|
|
21685
|
-
if (typeof cb2 === "function")
|
|
21686
|
-
cb2.apply(this, arguments);
|
|
21687
|
-
}
|
|
21688
|
-
});
|
|
21689
|
-
}
|
|
21690
|
-
}
|
|
21691
|
-
var fs$readdir = fs2.readdir;
|
|
21692
|
-
fs2.readdir = readdir;
|
|
21693
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
21694
|
-
function readdir(path3, options3, cb) {
|
|
21695
|
-
if (typeof options3 === "function")
|
|
21696
|
-
cb = options3, options3 = null;
|
|
21697
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path4, options4, cb2, startTime) {
|
|
21698
|
-
return fs$readdir(path4, fs$readdirCallback(path4, options4, cb2, startTime));
|
|
21699
|
-
} : function go$readdir(path4, options4, cb2, startTime) {
|
|
21700
|
-
return fs$readdir(path4, options4, fs$readdirCallback(path4, options4, cb2, startTime));
|
|
21701
|
-
};
|
|
21702
|
-
return go$readdir(path3, options3, cb);
|
|
21703
|
-
function fs$readdirCallback(path4, options4, cb2, startTime) {
|
|
21704
|
-
return function(err, files) {
|
|
21705
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
21706
|
-
enqueue([
|
|
21707
|
-
go$readdir,
|
|
21708
|
-
[path4, options4, cb2],
|
|
21709
|
-
err,
|
|
21710
|
-
startTime || Date.now(),
|
|
21711
|
-
Date.now()
|
|
21712
|
-
]);
|
|
21713
|
-
else {
|
|
21714
|
-
if (files && files.sort)
|
|
21715
|
-
files.sort();
|
|
21716
|
-
if (typeof cb2 === "function")
|
|
21717
|
-
cb2.call(this, err, files);
|
|
21718
|
-
}
|
|
21719
|
-
};
|
|
21720
|
-
}
|
|
21721
|
-
}
|
|
21722
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
21723
|
-
var legStreams = legacy(fs2);
|
|
21724
|
-
ReadStream = legStreams.ReadStream;
|
|
21725
|
-
WriteStream = legStreams.WriteStream;
|
|
21726
|
-
}
|
|
21727
|
-
var fs$ReadStream = fs2.ReadStream;
|
|
21728
|
-
if (fs$ReadStream) {
|
|
21729
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
21730
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
21731
|
-
}
|
|
21732
|
-
var fs$WriteStream = fs2.WriteStream;
|
|
21733
|
-
if (fs$WriteStream) {
|
|
21734
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
21735
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
21736
|
-
}
|
|
21737
|
-
Object.defineProperty(fs2, "ReadStream", {
|
|
21738
|
-
get: function() {
|
|
21739
|
-
return ReadStream;
|
|
21740
|
-
},
|
|
21741
|
-
set: function(val) {
|
|
21742
|
-
ReadStream = val;
|
|
21743
|
-
},
|
|
21744
|
-
enumerable: true,
|
|
21745
|
-
configurable: true
|
|
21746
|
-
});
|
|
21747
|
-
Object.defineProperty(fs2, "WriteStream", {
|
|
21748
|
-
get: function() {
|
|
21749
|
-
return WriteStream;
|
|
21750
|
-
},
|
|
21751
|
-
set: function(val) {
|
|
21752
|
-
WriteStream = val;
|
|
21753
|
-
},
|
|
21754
|
-
enumerable: true,
|
|
21755
|
-
configurable: true
|
|
21756
|
-
});
|
|
21757
|
-
var FileReadStream = ReadStream;
|
|
21758
|
-
Object.defineProperty(fs2, "FileReadStream", {
|
|
21759
|
-
get: function() {
|
|
21760
|
-
return FileReadStream;
|
|
21761
|
-
},
|
|
21762
|
-
set: function(val) {
|
|
21763
|
-
FileReadStream = val;
|
|
21764
|
-
},
|
|
21765
|
-
enumerable: true,
|
|
21766
|
-
configurable: true
|
|
21767
|
-
});
|
|
21768
|
-
var FileWriteStream = WriteStream;
|
|
21769
|
-
Object.defineProperty(fs2, "FileWriteStream", {
|
|
21770
|
-
get: function() {
|
|
21771
|
-
return FileWriteStream;
|
|
21772
|
-
},
|
|
21773
|
-
set: function(val) {
|
|
21774
|
-
FileWriteStream = val;
|
|
21775
|
-
},
|
|
21776
|
-
enumerable: true,
|
|
21777
|
-
configurable: true
|
|
21778
|
-
});
|
|
21779
|
-
function ReadStream(path3, options3) {
|
|
21780
|
-
if (this instanceof ReadStream)
|
|
21781
|
-
return fs$ReadStream.apply(this, arguments), this;
|
|
21782
|
-
else
|
|
21783
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
21784
|
-
}
|
|
21785
|
-
function ReadStream$open() {
|
|
21786
|
-
var that = this;
|
|
21787
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
21788
|
-
if (err) {
|
|
21789
|
-
if (that.autoClose)
|
|
21790
|
-
that.destroy();
|
|
21791
|
-
that.emit("error", err);
|
|
21792
|
-
} else {
|
|
21793
|
-
that.fd = fd;
|
|
21794
|
-
that.emit("open", fd);
|
|
21795
|
-
that.read();
|
|
21796
|
-
}
|
|
21797
|
-
});
|
|
21798
|
-
}
|
|
21799
|
-
function WriteStream(path3, options3) {
|
|
21800
|
-
if (this instanceof WriteStream)
|
|
21801
|
-
return fs$WriteStream.apply(this, arguments), this;
|
|
21802
|
-
else
|
|
21803
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
21804
|
-
}
|
|
21805
|
-
function WriteStream$open() {
|
|
21806
|
-
var that = this;
|
|
21807
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
21808
|
-
if (err) {
|
|
21809
|
-
that.destroy();
|
|
21810
|
-
that.emit("error", err);
|
|
21811
|
-
} else {
|
|
21812
|
-
that.fd = fd;
|
|
21813
|
-
that.emit("open", fd);
|
|
21814
|
-
}
|
|
21815
|
-
});
|
|
21816
|
-
}
|
|
21817
|
-
function createReadStream(path3, options3) {
|
|
21818
|
-
return new fs2.ReadStream(path3, options3);
|
|
21819
|
-
}
|
|
21820
|
-
function createWriteStream(path3, options3) {
|
|
21821
|
-
return new fs2.WriteStream(path3, options3);
|
|
21822
|
-
}
|
|
21823
|
-
var fs$open = fs2.open;
|
|
21824
|
-
fs2.open = open;
|
|
21825
|
-
function open(path3, flags, mode, cb) {
|
|
21826
|
-
if (typeof mode === "function")
|
|
21827
|
-
cb = mode, mode = null;
|
|
21828
|
-
return go$open(path3, flags, mode, cb);
|
|
21829
|
-
function go$open(path4, flags2, mode2, cb2, startTime) {
|
|
21830
|
-
return fs$open(path4, flags2, mode2, function(err, fd) {
|
|
21831
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
21832
|
-
enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
21833
|
-
else {
|
|
21834
|
-
if (typeof cb2 === "function")
|
|
21835
|
-
cb2.apply(this, arguments);
|
|
21836
|
-
}
|
|
21837
|
-
});
|
|
21838
|
-
}
|
|
21839
|
-
}
|
|
21840
|
-
return fs2;
|
|
21841
|
-
}
|
|
21842
|
-
function enqueue(elem) {
|
|
21843
|
-
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
21844
|
-
fs[gracefulQueue].push(elem);
|
|
21845
|
-
retry();
|
|
21846
|
-
}
|
|
21847
|
-
var retryTimer;
|
|
21848
|
-
function resetQueue() {
|
|
21849
|
-
var now = Date.now();
|
|
21850
|
-
for (var i = 0;i < fs[gracefulQueue].length; ++i) {
|
|
21851
|
-
if (fs[gracefulQueue][i].length > 2) {
|
|
21852
|
-
fs[gracefulQueue][i][3] = now;
|
|
21853
|
-
fs[gracefulQueue][i][4] = now;
|
|
21854
|
-
}
|
|
21855
|
-
}
|
|
21856
|
-
retry();
|
|
21857
|
-
}
|
|
21858
|
-
function retry() {
|
|
21859
|
-
clearTimeout(retryTimer);
|
|
21860
|
-
retryTimer = undefined;
|
|
21861
|
-
if (fs[gracefulQueue].length === 0)
|
|
21862
|
-
return;
|
|
21863
|
-
var elem = fs[gracefulQueue].shift();
|
|
21864
|
-
var fn = elem[0];
|
|
21865
|
-
var args = elem[1];
|
|
21866
|
-
var err = elem[2];
|
|
21867
|
-
var startTime = elem[3];
|
|
21868
|
-
var lastTime = elem[4];
|
|
21869
|
-
if (startTime === undefined) {
|
|
21870
|
-
debug("RETRY", fn.name, args);
|
|
21871
|
-
fn.apply(null, args);
|
|
21872
|
-
} else if (Date.now() - startTime >= 60000) {
|
|
21873
|
-
debug("TIMEOUT", fn.name, args);
|
|
21874
|
-
var cb = args.pop();
|
|
21875
|
-
if (typeof cb === "function")
|
|
21876
|
-
cb.call(null, err);
|
|
21877
|
-
} else {
|
|
21878
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
21879
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
21880
|
-
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
21881
|
-
if (sinceAttempt >= desiredDelay) {
|
|
21882
|
-
debug("RETRY", fn.name, args);
|
|
21883
|
-
fn.apply(null, args.concat([startTime]));
|
|
21884
|
-
} else {
|
|
21885
|
-
fs[gracefulQueue].push(elem);
|
|
21886
|
-
}
|
|
21887
|
-
}
|
|
21888
|
-
if (retryTimer === undefined) {
|
|
21889
|
-
retryTimer = setTimeout(retry, 0);
|
|
21890
|
-
}
|
|
21891
|
-
}
|
|
21892
|
-
});
|
|
21893
|
-
|
|
21894
|
-
// node_modules/fs-extra/lib/fs/index.js
|
|
21895
|
-
var require_fs = __commonJS((exports) => {
|
|
21896
|
-
var u = require_universalify().fromCallback;
|
|
21897
|
-
var fs = require_graceful_fs();
|
|
21898
|
-
var api = [
|
|
21899
|
-
"access",
|
|
21900
|
-
"appendFile",
|
|
21901
|
-
"chmod",
|
|
21902
|
-
"chown",
|
|
21903
|
-
"close",
|
|
21904
|
-
"copyFile",
|
|
21905
|
-
"cp",
|
|
21906
|
-
"fchmod",
|
|
21907
|
-
"fchown",
|
|
21908
|
-
"fdatasync",
|
|
21909
|
-
"fstat",
|
|
21910
|
-
"fsync",
|
|
21911
|
-
"ftruncate",
|
|
21912
|
-
"futimes",
|
|
21913
|
-
"glob",
|
|
21914
|
-
"lchmod",
|
|
21915
|
-
"lchown",
|
|
21916
|
-
"lutimes",
|
|
21917
|
-
"link",
|
|
21918
|
-
"lstat",
|
|
21919
|
-
"mkdir",
|
|
21920
|
-
"mkdtemp",
|
|
21921
|
-
"open",
|
|
21922
|
-
"opendir",
|
|
21923
|
-
"readdir",
|
|
21924
|
-
"readFile",
|
|
21925
|
-
"readlink",
|
|
21926
|
-
"realpath",
|
|
21927
|
-
"rename",
|
|
21928
|
-
"rm",
|
|
21929
|
-
"rmdir",
|
|
21930
|
-
"stat",
|
|
21931
|
-
"statfs",
|
|
21932
|
-
"symlink",
|
|
21933
|
-
"truncate",
|
|
21934
|
-
"unlink",
|
|
21935
|
-
"utimes",
|
|
21936
|
-
"writeFile"
|
|
21937
|
-
].filter((key) => {
|
|
21938
|
-
return typeof fs[key] === "function";
|
|
21939
|
-
});
|
|
21940
|
-
Object.assign(exports, fs);
|
|
21941
|
-
api.forEach((method) => {
|
|
21942
|
-
exports[method] = u(fs[method]);
|
|
21943
|
-
});
|
|
21944
|
-
exports.exists = function(filename, callback) {
|
|
21945
|
-
if (typeof callback === "function") {
|
|
21946
|
-
return fs.exists(filename, callback);
|
|
21947
|
-
}
|
|
21948
|
-
return new Promise((resolve) => {
|
|
21949
|
-
return fs.exists(filename, resolve);
|
|
21950
|
-
});
|
|
21951
|
-
};
|
|
21952
|
-
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
21953
|
-
if (typeof callback === "function") {
|
|
21954
|
-
return fs.read(fd, buffer, offset, length, position, callback);
|
|
21955
|
-
}
|
|
21956
|
-
return new Promise((resolve, reject) => {
|
|
21957
|
-
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
21958
|
-
if (err)
|
|
21959
|
-
return reject(err);
|
|
21960
|
-
resolve({ bytesRead, buffer: buffer2 });
|
|
21961
|
-
});
|
|
21962
|
-
});
|
|
21963
|
-
};
|
|
21964
|
-
exports.write = function(fd, buffer, ...args) {
|
|
21965
|
-
if (typeof args[args.length - 1] === "function") {
|
|
21966
|
-
return fs.write(fd, buffer, ...args);
|
|
21967
|
-
}
|
|
21968
|
-
return new Promise((resolve, reject) => {
|
|
21969
|
-
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
21970
|
-
if (err)
|
|
21971
|
-
return reject(err);
|
|
21972
|
-
resolve({ bytesWritten, buffer: buffer2 });
|
|
21973
|
-
});
|
|
21974
|
-
});
|
|
21975
|
-
};
|
|
21976
|
-
exports.readv = function(fd, buffers, ...args) {
|
|
21977
|
-
if (typeof args[args.length - 1] === "function") {
|
|
21978
|
-
return fs.readv(fd, buffers, ...args);
|
|
21979
|
-
}
|
|
21980
|
-
return new Promise((resolve, reject) => {
|
|
21981
|
-
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
21982
|
-
if (err)
|
|
21983
|
-
return reject(err);
|
|
21984
|
-
resolve({ bytesRead, buffers: buffers2 });
|
|
21985
|
-
});
|
|
21986
|
-
});
|
|
21987
|
-
};
|
|
21988
|
-
exports.writev = function(fd, buffers, ...args) {
|
|
21989
|
-
if (typeof args[args.length - 1] === "function") {
|
|
21990
|
-
return fs.writev(fd, buffers, ...args);
|
|
21991
|
-
}
|
|
21992
|
-
return new Promise((resolve, reject) => {
|
|
21993
|
-
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
21994
|
-
if (err)
|
|
21995
|
-
return reject(err);
|
|
21996
|
-
resolve({ bytesWritten, buffers: buffers2 });
|
|
21997
|
-
});
|
|
21998
|
-
});
|
|
21999
|
-
};
|
|
22000
|
-
if (typeof fs.realpath.native === "function") {
|
|
22001
|
-
exports.realpath.native = u(fs.realpath.native);
|
|
22002
|
-
} else {
|
|
22003
|
-
process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
|
|
22004
|
-
}
|
|
22005
|
-
});
|
|
22006
|
-
|
|
22007
|
-
// node_modules/fs-extra/lib/mkdirs/utils.js
|
|
22008
|
-
var require_utils2 = __commonJS((exports, module) => {
|
|
22009
|
-
var path3 = __require("path");
|
|
22010
|
-
exports.checkPath = function checkPath(pth) {
|
|
22011
|
-
if (process.platform === "win32") {
|
|
22012
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path3.parse(pth).root, ""));
|
|
22013
|
-
if (pathHasInvalidWinCharacters) {
|
|
22014
|
-
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
22015
|
-
error.code = "EINVAL";
|
|
22016
|
-
throw error;
|
|
22017
|
-
}
|
|
22018
|
-
}
|
|
22019
|
-
};
|
|
22020
|
-
});
|
|
22021
|
-
|
|
22022
|
-
// node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
22023
|
-
var require_make_dir = __commonJS((exports, module) => {
|
|
22024
|
-
var fs = require_fs();
|
|
22025
|
-
var { checkPath } = require_utils2();
|
|
22026
|
-
var getMode = (options3) => {
|
|
22027
|
-
const defaults = { mode: 511 };
|
|
22028
|
-
if (typeof options3 === "number")
|
|
22029
|
-
return options3;
|
|
22030
|
-
return { ...defaults, ...options3 }.mode;
|
|
22031
|
-
};
|
|
22032
|
-
exports.makeDir = async (dir, options3) => {
|
|
22033
|
-
checkPath(dir);
|
|
22034
|
-
return fs.mkdir(dir, {
|
|
22035
|
-
mode: getMode(options3),
|
|
22036
|
-
recursive: true
|
|
22037
|
-
});
|
|
22038
|
-
};
|
|
22039
|
-
exports.makeDirSync = (dir, options3) => {
|
|
22040
|
-
checkPath(dir);
|
|
22041
|
-
return fs.mkdirSync(dir, {
|
|
22042
|
-
mode: getMode(options3),
|
|
22043
|
-
recursive: true
|
|
22044
|
-
});
|
|
22045
|
-
};
|
|
22046
|
-
});
|
|
22047
|
-
|
|
22048
|
-
// node_modules/fs-extra/lib/mkdirs/index.js
|
|
22049
|
-
var require_mkdirs = __commonJS((exports, module) => {
|
|
22050
|
-
var u = require_universalify().fromPromise;
|
|
22051
|
-
var { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
22052
|
-
var makeDir = u(_makeDir);
|
|
22053
|
-
module.exports = {
|
|
22054
|
-
mkdirs: makeDir,
|
|
22055
|
-
mkdirsSync: makeDirSync,
|
|
22056
|
-
mkdirp: makeDir,
|
|
22057
|
-
mkdirpSync: makeDirSync,
|
|
22058
|
-
ensureDir: makeDir,
|
|
22059
|
-
ensureDirSync: makeDirSync
|
|
22060
|
-
};
|
|
22061
|
-
});
|
|
22062
|
-
|
|
22063
|
-
// node_modules/fs-extra/lib/path-exists/index.js
|
|
22064
|
-
var require_path_exists = __commonJS((exports, module) => {
|
|
22065
|
-
var u = require_universalify().fromPromise;
|
|
22066
|
-
var fs = require_fs();
|
|
22067
|
-
function pathExists(path3) {
|
|
22068
|
-
return fs.access(path3).then(() => true).catch(() => false);
|
|
22069
|
-
}
|
|
22070
|
-
module.exports = {
|
|
22071
|
-
pathExists: u(pathExists),
|
|
22072
|
-
pathExistsSync: fs.existsSync
|
|
22073
|
-
};
|
|
22074
|
-
});
|
|
22075
|
-
|
|
22076
|
-
// node_modules/fs-extra/lib/util/utimes.js
|
|
22077
|
-
var require_utimes = __commonJS((exports, module) => {
|
|
22078
|
-
var fs = require_fs();
|
|
22079
|
-
var u = require_universalify().fromPromise;
|
|
22080
|
-
async function utimesMillis(path3, atime, mtime) {
|
|
22081
|
-
const fd = await fs.open(path3, "r+");
|
|
22082
|
-
let closeErr = null;
|
|
22083
|
-
try {
|
|
22084
|
-
await fs.futimes(fd, atime, mtime);
|
|
22085
|
-
} finally {
|
|
22086
|
-
try {
|
|
22087
|
-
await fs.close(fd);
|
|
22088
|
-
} catch (e) {
|
|
22089
|
-
closeErr = e;
|
|
22090
|
-
}
|
|
22091
|
-
}
|
|
22092
|
-
if (closeErr) {
|
|
22093
|
-
throw closeErr;
|
|
22094
|
-
}
|
|
22095
|
-
}
|
|
22096
|
-
function utimesMillisSync(path3, atime, mtime) {
|
|
22097
|
-
const fd = fs.openSync(path3, "r+");
|
|
22098
|
-
fs.futimesSync(fd, atime, mtime);
|
|
22099
|
-
return fs.closeSync(fd);
|
|
22100
|
-
}
|
|
22101
|
-
module.exports = {
|
|
22102
|
-
utimesMillis: u(utimesMillis),
|
|
22103
|
-
utimesMillisSync
|
|
22104
|
-
};
|
|
22105
|
-
});
|
|
22106
|
-
|
|
22107
|
-
// node_modules/fs-extra/lib/util/stat.js
|
|
22108
|
-
var require_stat = __commonJS((exports, module) => {
|
|
22109
|
-
var fs = require_fs();
|
|
22110
|
-
var path3 = __require("path");
|
|
22111
|
-
var u = require_universalify().fromPromise;
|
|
22112
|
-
function getStats(src, dest, opts) {
|
|
22113
|
-
const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
|
|
22114
|
-
return Promise.all([
|
|
22115
|
-
statFunc(src),
|
|
22116
|
-
statFunc(dest).catch((err) => {
|
|
22117
|
-
if (err.code === "ENOENT")
|
|
22118
|
-
return null;
|
|
22119
|
-
throw err;
|
|
22120
|
-
})
|
|
22121
|
-
]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
|
|
22122
|
-
}
|
|
22123
|
-
function getStatsSync(src, dest, opts) {
|
|
22124
|
-
let destStat;
|
|
22125
|
-
const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
|
|
22126
|
-
const srcStat = statFunc(src);
|
|
22127
|
-
try {
|
|
22128
|
-
destStat = statFunc(dest);
|
|
22129
|
-
} catch (err) {
|
|
22130
|
-
if (err.code === "ENOENT")
|
|
22131
|
-
return { srcStat, destStat: null };
|
|
22132
|
-
throw err;
|
|
22133
|
-
}
|
|
22134
|
-
return { srcStat, destStat };
|
|
22135
|
-
}
|
|
22136
|
-
async function checkPaths(src, dest, funcName, opts) {
|
|
22137
|
-
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
22138
|
-
if (destStat) {
|
|
22139
|
-
if (areIdentical(srcStat, destStat)) {
|
|
22140
|
-
const srcBaseName = path3.basename(src);
|
|
22141
|
-
const destBaseName = path3.basename(dest);
|
|
22142
|
-
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
22143
|
-
return { srcStat, destStat, isChangingCase: true };
|
|
22144
|
-
}
|
|
22145
|
-
throw new Error("Source and destination must not be the same.");
|
|
22146
|
-
}
|
|
22147
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
22148
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
22149
|
-
}
|
|
22150
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
22151
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
22152
|
-
}
|
|
22153
|
-
}
|
|
22154
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
22155
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
22156
|
-
}
|
|
22157
|
-
return { srcStat, destStat };
|
|
22158
|
-
}
|
|
22159
|
-
function checkPathsSync(src, dest, funcName, opts) {
|
|
22160
|
-
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
22161
|
-
if (destStat) {
|
|
22162
|
-
if (areIdentical(srcStat, destStat)) {
|
|
22163
|
-
const srcBaseName = path3.basename(src);
|
|
22164
|
-
const destBaseName = path3.basename(dest);
|
|
22165
|
-
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
22166
|
-
return { srcStat, destStat, isChangingCase: true };
|
|
22167
|
-
}
|
|
22168
|
-
throw new Error("Source and destination must not be the same.");
|
|
22169
|
-
}
|
|
22170
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
22171
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
22172
|
-
}
|
|
22173
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
22174
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
22175
|
-
}
|
|
22176
|
-
}
|
|
22177
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
22178
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
22179
|
-
}
|
|
22180
|
-
return { srcStat, destStat };
|
|
22181
|
-
}
|
|
22182
|
-
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
22183
|
-
const srcParent = path3.resolve(path3.dirname(src));
|
|
22184
|
-
const destParent = path3.resolve(path3.dirname(dest));
|
|
22185
|
-
if (destParent === srcParent || destParent === path3.parse(destParent).root)
|
|
22186
|
-
return;
|
|
22187
|
-
let destStat;
|
|
22188
|
-
try {
|
|
22189
|
-
destStat = await fs.stat(destParent, { bigint: true });
|
|
22190
|
-
} catch (err) {
|
|
22191
|
-
if (err.code === "ENOENT")
|
|
22192
|
-
return;
|
|
22193
|
-
throw err;
|
|
22194
|
-
}
|
|
22195
|
-
if (areIdentical(srcStat, destStat)) {
|
|
22196
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
22197
|
-
}
|
|
22198
|
-
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
22199
|
-
}
|
|
22200
|
-
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
22201
|
-
const srcParent = path3.resolve(path3.dirname(src));
|
|
22202
|
-
const destParent = path3.resolve(path3.dirname(dest));
|
|
22203
|
-
if (destParent === srcParent || destParent === path3.parse(destParent).root)
|
|
22204
|
-
return;
|
|
22205
|
-
let destStat;
|
|
22206
|
-
try {
|
|
22207
|
-
destStat = fs.statSync(destParent, { bigint: true });
|
|
22208
|
-
} catch (err) {
|
|
22209
|
-
if (err.code === "ENOENT")
|
|
22210
|
-
return;
|
|
22211
|
-
throw err;
|
|
22212
|
-
}
|
|
22213
|
-
if (areIdentical(srcStat, destStat)) {
|
|
22214
|
-
throw new Error(errMsg(src, dest, funcName));
|
|
22215
|
-
}
|
|
22216
|
-
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
22217
|
-
}
|
|
22218
|
-
function areIdentical(srcStat, destStat) {
|
|
22219
|
-
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
22220
|
-
}
|
|
22221
|
-
function isSrcSubdir(src, dest) {
|
|
22222
|
-
const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
|
|
22223
|
-
const destArr = path3.resolve(dest).split(path3.sep).filter((i) => i);
|
|
22224
|
-
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
22225
|
-
}
|
|
22226
|
-
function errMsg(src, dest, funcName) {
|
|
22227
|
-
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
22228
|
-
}
|
|
22229
|
-
module.exports = {
|
|
22230
|
-
checkPaths: u(checkPaths),
|
|
22231
|
-
checkPathsSync,
|
|
22232
|
-
checkParentPaths: u(checkParentPaths),
|
|
22233
|
-
checkParentPathsSync,
|
|
22234
|
-
isSrcSubdir,
|
|
22235
|
-
areIdentical
|
|
22236
|
-
};
|
|
22237
|
-
});
|
|
22238
|
-
|
|
22239
|
-
// node_modules/fs-extra/lib/copy/copy.js
|
|
22240
|
-
var require_copy = __commonJS((exports, module) => {
|
|
22241
|
-
var fs = require_fs();
|
|
22242
|
-
var path3 = __require("path");
|
|
22243
|
-
var { mkdirs } = require_mkdirs();
|
|
22244
|
-
var { pathExists } = require_path_exists();
|
|
22245
|
-
var { utimesMillis } = require_utimes();
|
|
22246
|
-
var stat = require_stat();
|
|
22247
|
-
async function copy(src, dest, opts = {}) {
|
|
22248
|
-
if (typeof opts === "function") {
|
|
22249
|
-
opts = { filter: opts };
|
|
22250
|
-
}
|
|
22251
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
22252
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
22253
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
22254
|
-
process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
22255
|
-
|
|
22256
|
-
` + "\tsee https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
|
|
22257
|
-
}
|
|
22258
|
-
const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
|
|
22259
|
-
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
22260
|
-
const include = await runFilter(src, dest, opts);
|
|
22261
|
-
if (!include)
|
|
22262
|
-
return;
|
|
22263
|
-
const destParent = path3.dirname(dest);
|
|
22264
|
-
const dirExists = await pathExists(destParent);
|
|
22265
|
-
if (!dirExists) {
|
|
22266
|
-
await mkdirs(destParent);
|
|
22267
|
-
}
|
|
22268
|
-
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
22269
|
-
}
|
|
22270
|
-
async function runFilter(src, dest, opts) {
|
|
22271
|
-
if (!opts.filter)
|
|
22272
|
-
return true;
|
|
22273
|
-
return opts.filter(src, dest);
|
|
22274
|
-
}
|
|
22275
|
-
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
22276
|
-
const statFn = opts.dereference ? fs.stat : fs.lstat;
|
|
22277
|
-
const srcStat = await statFn(src);
|
|
22278
|
-
if (srcStat.isDirectory())
|
|
22279
|
-
return onDir(srcStat, destStat, src, dest, opts);
|
|
22280
|
-
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
22281
|
-
return onFile(srcStat, destStat, src, dest, opts);
|
|
22282
|
-
if (srcStat.isSymbolicLink())
|
|
22283
|
-
return onLink(destStat, src, dest, opts);
|
|
22284
|
-
if (srcStat.isSocket())
|
|
22285
|
-
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
22286
|
-
if (srcStat.isFIFO())
|
|
22287
|
-
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
22288
|
-
throw new Error(`Unknown file: ${src}`);
|
|
22289
|
-
}
|
|
22290
|
-
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
22291
|
-
if (!destStat)
|
|
22292
|
-
return copyFile2(srcStat, src, dest, opts);
|
|
22293
|
-
if (opts.overwrite) {
|
|
22294
|
-
await fs.unlink(dest);
|
|
22295
|
-
return copyFile2(srcStat, src, dest, opts);
|
|
22296
|
-
}
|
|
22297
|
-
if (opts.errorOnExist) {
|
|
22298
|
-
throw new Error(`'${dest}' already exists`);
|
|
22299
|
-
}
|
|
22300
|
-
}
|
|
22301
|
-
async function copyFile2(srcStat, src, dest, opts) {
|
|
22302
|
-
await fs.copyFile(src, dest);
|
|
22303
|
-
if (opts.preserveTimestamps) {
|
|
22304
|
-
if (fileIsNotWritable(srcStat.mode)) {
|
|
22305
|
-
await makeFileWritable(dest, srcStat.mode);
|
|
22306
|
-
}
|
|
22307
|
-
const updatedSrcStat = await fs.stat(src);
|
|
22308
|
-
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
22309
|
-
}
|
|
22310
|
-
return fs.chmod(dest, srcStat.mode);
|
|
22311
|
-
}
|
|
22312
|
-
function fileIsNotWritable(srcMode) {
|
|
22313
|
-
return (srcMode & 128) === 0;
|
|
22314
|
-
}
|
|
22315
|
-
function makeFileWritable(dest, srcMode) {
|
|
22316
|
-
return fs.chmod(dest, srcMode | 128);
|
|
22317
|
-
}
|
|
22318
|
-
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
22319
|
-
if (!destStat) {
|
|
22320
|
-
await fs.mkdir(dest);
|
|
22321
|
-
}
|
|
22322
|
-
const promises = [];
|
|
22323
|
-
for await (const item of await fs.opendir(src)) {
|
|
22324
|
-
const srcItem = path3.join(src, item.name);
|
|
22325
|
-
const destItem = path3.join(dest, item.name);
|
|
22326
|
-
promises.push(runFilter(srcItem, destItem, opts).then((include) => {
|
|
22327
|
-
if (include) {
|
|
22328
|
-
return stat.checkPaths(srcItem, destItem, "copy", opts).then(({ destStat: destStat2 }) => {
|
|
22329
|
-
return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
|
|
22330
|
-
});
|
|
22331
|
-
}
|
|
22332
|
-
}));
|
|
22333
|
-
}
|
|
22334
|
-
await Promise.all(promises);
|
|
22335
|
-
if (!destStat) {
|
|
22336
|
-
await fs.chmod(dest, srcStat.mode);
|
|
22337
|
-
}
|
|
22338
|
-
}
|
|
22339
|
-
async function onLink(destStat, src, dest, opts) {
|
|
22340
|
-
let resolvedSrc = await fs.readlink(src);
|
|
22341
|
-
if (opts.dereference) {
|
|
22342
|
-
resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
|
|
22343
|
-
}
|
|
22344
|
-
if (!destStat) {
|
|
22345
|
-
return fs.symlink(resolvedSrc, dest);
|
|
22346
|
-
}
|
|
22347
|
-
let resolvedDest = null;
|
|
22348
|
-
try {
|
|
22349
|
-
resolvedDest = await fs.readlink(dest);
|
|
22350
|
-
} catch (e) {
|
|
22351
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN")
|
|
22352
|
-
return fs.symlink(resolvedSrc, dest);
|
|
22353
|
-
throw e;
|
|
22354
|
-
}
|
|
22355
|
-
if (opts.dereference) {
|
|
22356
|
-
resolvedDest = path3.resolve(process.cwd(), resolvedDest);
|
|
22357
|
-
}
|
|
22358
|
-
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
22359
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
22360
|
-
}
|
|
22361
|
-
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
22362
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
22363
|
-
}
|
|
22364
|
-
await fs.unlink(dest);
|
|
22365
|
-
return fs.symlink(resolvedSrc, dest);
|
|
22366
|
-
}
|
|
22367
|
-
module.exports = copy;
|
|
22368
|
-
});
|
|
22369
|
-
|
|
22370
|
-
// node_modules/fs-extra/lib/copy/copy-sync.js
|
|
22371
|
-
var require_copy_sync = __commonJS((exports, module) => {
|
|
22372
|
-
var fs = require_graceful_fs();
|
|
22373
|
-
var path3 = __require("path");
|
|
22374
|
-
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
22375
|
-
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
22376
|
-
var stat = require_stat();
|
|
22377
|
-
function copySync(src, dest, opts) {
|
|
22378
|
-
if (typeof opts === "function") {
|
|
22379
|
-
opts = { filter: opts };
|
|
22380
|
-
}
|
|
22381
|
-
opts = opts || {};
|
|
22382
|
-
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
22383
|
-
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
22384
|
-
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
22385
|
-
process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
22386
|
-
|
|
22387
|
-
` + "\tsee https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
|
|
22388
|
-
}
|
|
22389
|
-
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
22390
|
-
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
22391
|
-
if (opts.filter && !opts.filter(src, dest))
|
|
22392
|
-
return;
|
|
22393
|
-
const destParent = path3.dirname(dest);
|
|
22394
|
-
if (!fs.existsSync(destParent))
|
|
22395
|
-
mkdirsSync(destParent);
|
|
22396
|
-
return getStats(destStat, src, dest, opts);
|
|
22397
|
-
}
|
|
22398
|
-
function getStats(destStat, src, dest, opts) {
|
|
22399
|
-
const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
|
|
22400
|
-
const srcStat = statSync(src);
|
|
22401
|
-
if (srcStat.isDirectory())
|
|
22402
|
-
return onDir(srcStat, destStat, src, dest, opts);
|
|
22403
|
-
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
22404
|
-
return onFile(srcStat, destStat, src, dest, opts);
|
|
22405
|
-
else if (srcStat.isSymbolicLink())
|
|
22406
|
-
return onLink(destStat, src, dest, opts);
|
|
22407
|
-
else if (srcStat.isSocket())
|
|
22408
|
-
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
22409
|
-
else if (srcStat.isFIFO())
|
|
22410
|
-
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
22411
|
-
throw new Error(`Unknown file: ${src}`);
|
|
22412
|
-
}
|
|
22413
|
-
function onFile(srcStat, destStat, src, dest, opts) {
|
|
22414
|
-
if (!destStat)
|
|
22415
|
-
return copyFile2(srcStat, src, dest, opts);
|
|
22416
|
-
return mayCopyFile(srcStat, src, dest, opts);
|
|
22417
|
-
}
|
|
22418
|
-
function mayCopyFile(srcStat, src, dest, opts) {
|
|
22419
|
-
if (opts.overwrite) {
|
|
22420
|
-
fs.unlinkSync(dest);
|
|
22421
|
-
return copyFile2(srcStat, src, dest, opts);
|
|
22422
|
-
} else if (opts.errorOnExist) {
|
|
22423
|
-
throw new Error(`'${dest}' already exists`);
|
|
22424
|
-
}
|
|
22425
|
-
}
|
|
22426
|
-
function copyFile2(srcStat, src, dest, opts) {
|
|
22427
|
-
fs.copyFileSync(src, dest);
|
|
22428
|
-
if (opts.preserveTimestamps)
|
|
22429
|
-
handleTimestamps(srcStat.mode, src, dest);
|
|
22430
|
-
return setDestMode(dest, srcStat.mode);
|
|
22431
|
-
}
|
|
22432
|
-
function handleTimestamps(srcMode, src, dest) {
|
|
22433
|
-
if (fileIsNotWritable(srcMode))
|
|
22434
|
-
makeFileWritable(dest, srcMode);
|
|
22435
|
-
return setDestTimestamps(src, dest);
|
|
22436
|
-
}
|
|
22437
|
-
function fileIsNotWritable(srcMode) {
|
|
22438
|
-
return (srcMode & 128) === 0;
|
|
22439
|
-
}
|
|
22440
|
-
function makeFileWritable(dest, srcMode) {
|
|
22441
|
-
return setDestMode(dest, srcMode | 128);
|
|
22442
|
-
}
|
|
22443
|
-
function setDestMode(dest, srcMode) {
|
|
22444
|
-
return fs.chmodSync(dest, srcMode);
|
|
22445
|
-
}
|
|
22446
|
-
function setDestTimestamps(src, dest) {
|
|
22447
|
-
const updatedSrcStat = fs.statSync(src);
|
|
22448
|
-
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
22449
|
-
}
|
|
22450
|
-
function onDir(srcStat, destStat, src, dest, opts) {
|
|
22451
|
-
if (!destStat)
|
|
22452
|
-
return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
22453
|
-
return copyDir(src, dest, opts);
|
|
22454
|
-
}
|
|
22455
|
-
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
22456
|
-
fs.mkdirSync(dest);
|
|
22457
|
-
copyDir(src, dest, opts);
|
|
22458
|
-
return setDestMode(dest, srcMode);
|
|
22459
|
-
}
|
|
22460
|
-
function copyDir(src, dest, opts) {
|
|
22461
|
-
const dir = fs.opendirSync(src);
|
|
22462
|
-
try {
|
|
22463
|
-
let dirent;
|
|
22464
|
-
while ((dirent = dir.readSync()) !== null) {
|
|
22465
|
-
copyDirItem(dirent.name, src, dest, opts);
|
|
22466
|
-
}
|
|
22467
|
-
} finally {
|
|
22468
|
-
dir.closeSync();
|
|
22469
|
-
}
|
|
22470
|
-
}
|
|
22471
|
-
function copyDirItem(item, src, dest, opts) {
|
|
22472
|
-
const srcItem = path3.join(src, item);
|
|
22473
|
-
const destItem = path3.join(dest, item);
|
|
22474
|
-
if (opts.filter && !opts.filter(srcItem, destItem))
|
|
22475
|
-
return;
|
|
22476
|
-
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
22477
|
-
return getStats(destStat, srcItem, destItem, opts);
|
|
22478
|
-
}
|
|
22479
|
-
function onLink(destStat, src, dest, opts) {
|
|
22480
|
-
let resolvedSrc = fs.readlinkSync(src);
|
|
22481
|
-
if (opts.dereference) {
|
|
22482
|
-
resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
|
|
22483
|
-
}
|
|
22484
|
-
if (!destStat) {
|
|
22485
|
-
return fs.symlinkSync(resolvedSrc, dest);
|
|
22486
|
-
} else {
|
|
22487
|
-
let resolvedDest;
|
|
22488
|
-
try {
|
|
22489
|
-
resolvedDest = fs.readlinkSync(dest);
|
|
22490
|
-
} catch (err) {
|
|
22491
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN")
|
|
22492
|
-
return fs.symlinkSync(resolvedSrc, dest);
|
|
22493
|
-
throw err;
|
|
22494
|
-
}
|
|
22495
|
-
if (opts.dereference) {
|
|
22496
|
-
resolvedDest = path3.resolve(process.cwd(), resolvedDest);
|
|
22497
|
-
}
|
|
22498
|
-
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
22499
|
-
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
22500
|
-
}
|
|
22501
|
-
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
22502
|
-
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
22503
|
-
}
|
|
22504
|
-
return copyLink(resolvedSrc, dest);
|
|
22505
|
-
}
|
|
22506
|
-
}
|
|
22507
|
-
function copyLink(resolvedSrc, dest) {
|
|
22508
|
-
fs.unlinkSync(dest);
|
|
22509
|
-
return fs.symlinkSync(resolvedSrc, dest);
|
|
22510
|
-
}
|
|
22511
|
-
module.exports = copySync;
|
|
22512
|
-
});
|
|
22513
|
-
|
|
22514
|
-
// node_modules/fs-extra/lib/copy/index.js
|
|
22515
|
-
var require_copy2 = __commonJS((exports, module) => {
|
|
22516
|
-
var u = require_universalify().fromPromise;
|
|
22517
|
-
module.exports = {
|
|
22518
|
-
copy: u(require_copy()),
|
|
22519
|
-
copySync: require_copy_sync()
|
|
22520
|
-
};
|
|
22521
|
-
});
|
|
22522
|
-
|
|
22523
|
-
// node_modules/fs-extra/lib/remove/index.js
|
|
22524
|
-
var require_remove = __commonJS((exports, module) => {
|
|
22525
|
-
var fs = require_graceful_fs();
|
|
22526
|
-
var u = require_universalify().fromCallback;
|
|
22527
|
-
function remove(path3, callback) {
|
|
22528
|
-
fs.rm(path3, { recursive: true, force: true }, callback);
|
|
22529
|
-
}
|
|
22530
|
-
function removeSync(path3) {
|
|
22531
|
-
fs.rmSync(path3, { recursive: true, force: true });
|
|
22532
|
-
}
|
|
22533
|
-
module.exports = {
|
|
22534
|
-
remove: u(remove),
|
|
22535
|
-
removeSync
|
|
22536
|
-
};
|
|
22537
|
-
});
|
|
22538
|
-
|
|
22539
|
-
// node_modules/fs-extra/lib/empty/index.js
|
|
22540
|
-
var require_empty = __commonJS((exports, module) => {
|
|
22541
|
-
var u = require_universalify().fromPromise;
|
|
22542
|
-
var fs = require_fs();
|
|
22543
|
-
var path3 = __require("path");
|
|
22544
|
-
var mkdir = require_mkdirs();
|
|
22545
|
-
var remove = require_remove();
|
|
22546
|
-
var emptyDir = u(async function emptyDir(dir) {
|
|
22547
|
-
let items;
|
|
22548
|
-
try {
|
|
22549
|
-
items = await fs.readdir(dir);
|
|
22550
|
-
} catch {
|
|
22551
|
-
return mkdir.mkdirs(dir);
|
|
22552
|
-
}
|
|
22553
|
-
return Promise.all(items.map((item) => remove.remove(path3.join(dir, item))));
|
|
22554
|
-
});
|
|
22555
|
-
function emptyDirSync(dir) {
|
|
22556
|
-
let items;
|
|
22557
|
-
try {
|
|
22558
|
-
items = fs.readdirSync(dir);
|
|
22559
|
-
} catch {
|
|
22560
|
-
return mkdir.mkdirsSync(dir);
|
|
22561
|
-
}
|
|
22562
|
-
items.forEach((item) => {
|
|
22563
|
-
item = path3.join(dir, item);
|
|
22564
|
-
remove.removeSync(item);
|
|
22565
|
-
});
|
|
22566
|
-
}
|
|
22567
|
-
module.exports = {
|
|
22568
|
-
emptyDirSync,
|
|
22569
|
-
emptydirSync: emptyDirSync,
|
|
22570
|
-
emptyDir,
|
|
22571
|
-
emptydir: emptyDir
|
|
22572
|
-
};
|
|
22573
|
-
});
|
|
22574
|
-
|
|
22575
|
-
// node_modules/fs-extra/lib/ensure/file.js
|
|
22576
|
-
var require_file = __commonJS((exports, module) => {
|
|
22577
|
-
var u = require_universalify().fromPromise;
|
|
22578
|
-
var path3 = __require("path");
|
|
22579
|
-
var fs = require_fs();
|
|
22580
|
-
var mkdir = require_mkdirs();
|
|
22581
|
-
async function createFile(file) {
|
|
22582
|
-
let stats;
|
|
22583
|
-
try {
|
|
22584
|
-
stats = await fs.stat(file);
|
|
22585
|
-
} catch {}
|
|
22586
|
-
if (stats && stats.isFile())
|
|
22587
|
-
return;
|
|
22588
|
-
const dir = path3.dirname(file);
|
|
22589
|
-
let dirStats = null;
|
|
22590
|
-
try {
|
|
22591
|
-
dirStats = await fs.stat(dir);
|
|
22592
|
-
} catch (err) {
|
|
22593
|
-
if (err.code === "ENOENT") {
|
|
22594
|
-
await mkdir.mkdirs(dir);
|
|
22595
|
-
await fs.writeFile(file, "");
|
|
22596
|
-
return;
|
|
22597
|
-
} else {
|
|
22598
|
-
throw err;
|
|
22599
|
-
}
|
|
22600
|
-
}
|
|
22601
|
-
if (dirStats.isDirectory()) {
|
|
22602
|
-
await fs.writeFile(file, "");
|
|
22603
|
-
} else {
|
|
22604
|
-
await fs.readdir(dir);
|
|
22605
|
-
}
|
|
22606
|
-
}
|
|
22607
|
-
function createFileSync(file) {
|
|
22608
|
-
let stats;
|
|
22609
|
-
try {
|
|
22610
|
-
stats = fs.statSync(file);
|
|
22611
|
-
} catch {}
|
|
22612
|
-
if (stats && stats.isFile())
|
|
22613
|
-
return;
|
|
22614
|
-
const dir = path3.dirname(file);
|
|
22615
|
-
try {
|
|
22616
|
-
if (!fs.statSync(dir).isDirectory()) {
|
|
22617
|
-
fs.readdirSync(dir);
|
|
22618
|
-
}
|
|
22619
|
-
} catch (err) {
|
|
22620
|
-
if (err && err.code === "ENOENT")
|
|
22621
|
-
mkdir.mkdirsSync(dir);
|
|
22622
|
-
else
|
|
22623
|
-
throw err;
|
|
22624
|
-
}
|
|
22625
|
-
fs.writeFileSync(file, "");
|
|
22626
|
-
}
|
|
22627
|
-
module.exports = {
|
|
22628
|
-
createFile: u(createFile),
|
|
22629
|
-
createFileSync
|
|
22630
|
-
};
|
|
22631
|
-
});
|
|
22632
|
-
|
|
22633
|
-
// node_modules/fs-extra/lib/ensure/link.js
|
|
22634
|
-
var require_link = __commonJS((exports, module) => {
|
|
22635
|
-
var u = require_universalify().fromPromise;
|
|
22636
|
-
var path3 = __require("path");
|
|
22637
|
-
var fs = require_fs();
|
|
22638
|
-
var mkdir = require_mkdirs();
|
|
22639
|
-
var { pathExists } = require_path_exists();
|
|
22640
|
-
var { areIdentical } = require_stat();
|
|
22641
|
-
async function createLink(srcpath, dstpath) {
|
|
22642
|
-
let dstStat;
|
|
22643
|
-
try {
|
|
22644
|
-
dstStat = await fs.lstat(dstpath);
|
|
22645
|
-
} catch {}
|
|
22646
|
-
let srcStat;
|
|
22647
|
-
try {
|
|
22648
|
-
srcStat = await fs.lstat(srcpath);
|
|
22649
|
-
} catch (err) {
|
|
22650
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
22651
|
-
throw err;
|
|
22652
|
-
}
|
|
22653
|
-
if (dstStat && areIdentical(srcStat, dstStat))
|
|
22654
|
-
return;
|
|
22655
|
-
const dir = path3.dirname(dstpath);
|
|
22656
|
-
const dirExists = await pathExists(dir);
|
|
22657
|
-
if (!dirExists) {
|
|
22658
|
-
await mkdir.mkdirs(dir);
|
|
22659
|
-
}
|
|
22660
|
-
await fs.link(srcpath, dstpath);
|
|
22661
|
-
}
|
|
22662
|
-
function createLinkSync(srcpath, dstpath) {
|
|
22663
|
-
let dstStat;
|
|
22664
|
-
try {
|
|
22665
|
-
dstStat = fs.lstatSync(dstpath);
|
|
22666
|
-
} catch {}
|
|
22667
|
-
try {
|
|
22668
|
-
const srcStat = fs.lstatSync(srcpath);
|
|
22669
|
-
if (dstStat && areIdentical(srcStat, dstStat))
|
|
22670
|
-
return;
|
|
22671
|
-
} catch (err) {
|
|
22672
|
-
err.message = err.message.replace("lstat", "ensureLink");
|
|
22673
|
-
throw err;
|
|
22674
|
-
}
|
|
22675
|
-
const dir = path3.dirname(dstpath);
|
|
22676
|
-
const dirExists = fs.existsSync(dir);
|
|
22677
|
-
if (dirExists)
|
|
22678
|
-
return fs.linkSync(srcpath, dstpath);
|
|
22679
|
-
mkdir.mkdirsSync(dir);
|
|
22680
|
-
return fs.linkSync(srcpath, dstpath);
|
|
22681
|
-
}
|
|
22682
|
-
module.exports = {
|
|
22683
|
-
createLink: u(createLink),
|
|
22684
|
-
createLinkSync
|
|
22685
|
-
};
|
|
22686
|
-
});
|
|
22687
|
-
|
|
22688
|
-
// node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
22689
|
-
var require_symlink_paths = __commonJS((exports, module) => {
|
|
22690
|
-
var path3 = __require("path");
|
|
22691
|
-
var fs = require_fs();
|
|
22692
|
-
var { pathExists } = require_path_exists();
|
|
22693
|
-
var u = require_universalify().fromPromise;
|
|
22694
|
-
async function symlinkPaths(srcpath, dstpath) {
|
|
22695
|
-
if (path3.isAbsolute(srcpath)) {
|
|
22696
|
-
try {
|
|
22697
|
-
await fs.lstat(srcpath);
|
|
22698
|
-
} catch (err) {
|
|
22699
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
22700
|
-
throw err;
|
|
22701
|
-
}
|
|
22702
|
-
return {
|
|
22703
|
-
toCwd: srcpath,
|
|
22704
|
-
toDst: srcpath
|
|
22705
|
-
};
|
|
22706
|
-
}
|
|
22707
|
-
const dstdir = path3.dirname(dstpath);
|
|
22708
|
-
const relativeToDst = path3.join(dstdir, srcpath);
|
|
22709
|
-
const exists = await pathExists(relativeToDst);
|
|
22710
|
-
if (exists) {
|
|
22711
|
-
return {
|
|
22712
|
-
toCwd: relativeToDst,
|
|
22713
|
-
toDst: srcpath
|
|
22714
|
-
};
|
|
22715
|
-
}
|
|
22716
|
-
try {
|
|
22717
|
-
await fs.lstat(srcpath);
|
|
22718
|
-
} catch (err) {
|
|
22719
|
-
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
22720
|
-
throw err;
|
|
22721
|
-
}
|
|
22722
|
-
return {
|
|
22723
|
-
toCwd: srcpath,
|
|
22724
|
-
toDst: path3.relative(dstdir, srcpath)
|
|
22725
|
-
};
|
|
22726
|
-
}
|
|
22727
|
-
function symlinkPathsSync(srcpath, dstpath) {
|
|
22728
|
-
if (path3.isAbsolute(srcpath)) {
|
|
22729
|
-
const exists2 = fs.existsSync(srcpath);
|
|
22730
|
-
if (!exists2)
|
|
22731
|
-
throw new Error("absolute srcpath does not exist");
|
|
22732
|
-
return {
|
|
22733
|
-
toCwd: srcpath,
|
|
22734
|
-
toDst: srcpath
|
|
22735
|
-
};
|
|
22736
|
-
}
|
|
22737
|
-
const dstdir = path3.dirname(dstpath);
|
|
22738
|
-
const relativeToDst = path3.join(dstdir, srcpath);
|
|
22739
|
-
const exists = fs.existsSync(relativeToDst);
|
|
22740
|
-
if (exists) {
|
|
22741
|
-
return {
|
|
22742
|
-
toCwd: relativeToDst,
|
|
22743
|
-
toDst: srcpath
|
|
22744
|
-
};
|
|
22745
|
-
}
|
|
22746
|
-
const srcExists = fs.existsSync(srcpath);
|
|
22747
|
-
if (!srcExists)
|
|
22748
|
-
throw new Error("relative srcpath does not exist");
|
|
22749
|
-
return {
|
|
22750
|
-
toCwd: srcpath,
|
|
22751
|
-
toDst: path3.relative(dstdir, srcpath)
|
|
22752
|
-
};
|
|
22753
|
-
}
|
|
22754
|
-
module.exports = {
|
|
22755
|
-
symlinkPaths: u(symlinkPaths),
|
|
22756
|
-
symlinkPathsSync
|
|
22757
|
-
};
|
|
22758
|
-
});
|
|
22759
|
-
|
|
22760
|
-
// node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
22761
|
-
var require_symlink_type = __commonJS((exports, module) => {
|
|
22762
|
-
var fs = require_fs();
|
|
22763
|
-
var u = require_universalify().fromPromise;
|
|
22764
|
-
async function symlinkType(srcpath, type) {
|
|
22765
|
-
if (type)
|
|
22766
|
-
return type;
|
|
22767
|
-
let stats;
|
|
22768
|
-
try {
|
|
22769
|
-
stats = await fs.lstat(srcpath);
|
|
22770
|
-
} catch {
|
|
22771
|
-
return "file";
|
|
22772
|
-
}
|
|
22773
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
22774
|
-
}
|
|
22775
|
-
function symlinkTypeSync(srcpath, type) {
|
|
22776
|
-
if (type)
|
|
22777
|
-
return type;
|
|
22778
|
-
let stats;
|
|
22779
|
-
try {
|
|
22780
|
-
stats = fs.lstatSync(srcpath);
|
|
22781
|
-
} catch {
|
|
22782
|
-
return "file";
|
|
22783
|
-
}
|
|
22784
|
-
return stats && stats.isDirectory() ? "dir" : "file";
|
|
22785
|
-
}
|
|
22786
|
-
module.exports = {
|
|
22787
|
-
symlinkType: u(symlinkType),
|
|
22788
|
-
symlinkTypeSync
|
|
22789
|
-
};
|
|
22790
|
-
});
|
|
22791
|
-
|
|
22792
|
-
// node_modules/fs-extra/lib/ensure/symlink.js
|
|
22793
|
-
var require_symlink = __commonJS((exports, module) => {
|
|
22794
|
-
var u = require_universalify().fromPromise;
|
|
22795
|
-
var path3 = __require("path");
|
|
22796
|
-
var fs = require_fs();
|
|
22797
|
-
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
22798
|
-
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
22799
|
-
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
22800
|
-
var { pathExists } = require_path_exists();
|
|
22801
|
-
var { areIdentical } = require_stat();
|
|
22802
|
-
async function createSymlink(srcpath, dstpath, type) {
|
|
22803
|
-
let stats;
|
|
22804
|
-
try {
|
|
22805
|
-
stats = await fs.lstat(dstpath);
|
|
22806
|
-
} catch {}
|
|
22807
|
-
if (stats && stats.isSymbolicLink()) {
|
|
22808
|
-
const [srcStat, dstStat] = await Promise.all([
|
|
22809
|
-
fs.stat(srcpath),
|
|
22810
|
-
fs.stat(dstpath)
|
|
22811
|
-
]);
|
|
22812
|
-
if (areIdentical(srcStat, dstStat))
|
|
22813
|
-
return;
|
|
22814
|
-
}
|
|
22815
|
-
const relative = await symlinkPaths(srcpath, dstpath);
|
|
22816
|
-
srcpath = relative.toDst;
|
|
22817
|
-
const toType = await symlinkType(relative.toCwd, type);
|
|
22818
|
-
const dir = path3.dirname(dstpath);
|
|
22819
|
-
if (!await pathExists(dir)) {
|
|
22820
|
-
await mkdirs(dir);
|
|
22821
|
-
}
|
|
22822
|
-
return fs.symlink(srcpath, dstpath, toType);
|
|
22823
|
-
}
|
|
22824
|
-
function createSymlinkSync(srcpath, dstpath, type) {
|
|
22825
|
-
let stats;
|
|
22826
|
-
try {
|
|
22827
|
-
stats = fs.lstatSync(dstpath);
|
|
22828
|
-
} catch {}
|
|
22829
|
-
if (stats && stats.isSymbolicLink()) {
|
|
22830
|
-
const srcStat = fs.statSync(srcpath);
|
|
22831
|
-
const dstStat = fs.statSync(dstpath);
|
|
22832
|
-
if (areIdentical(srcStat, dstStat))
|
|
22833
|
-
return;
|
|
22834
|
-
}
|
|
22835
|
-
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
22836
|
-
srcpath = relative.toDst;
|
|
22837
|
-
type = symlinkTypeSync(relative.toCwd, type);
|
|
22838
|
-
const dir = path3.dirname(dstpath);
|
|
22839
|
-
const exists = fs.existsSync(dir);
|
|
22840
|
-
if (exists)
|
|
22841
|
-
return fs.symlinkSync(srcpath, dstpath, type);
|
|
22842
|
-
mkdirsSync(dir);
|
|
22843
|
-
return fs.symlinkSync(srcpath, dstpath, type);
|
|
22844
|
-
}
|
|
22845
|
-
module.exports = {
|
|
22846
|
-
createSymlink: u(createSymlink),
|
|
22847
|
-
createSymlinkSync
|
|
22848
|
-
};
|
|
22849
|
-
});
|
|
22850
|
-
|
|
22851
|
-
// node_modules/fs-extra/lib/ensure/index.js
|
|
22852
|
-
var require_ensure = __commonJS((exports, module) => {
|
|
22853
|
-
var { createFile, createFileSync } = require_file();
|
|
22854
|
-
var { createLink, createLinkSync } = require_link();
|
|
22855
|
-
var { createSymlink, createSymlinkSync } = require_symlink();
|
|
22856
|
-
module.exports = {
|
|
22857
|
-
createFile,
|
|
22858
|
-
createFileSync,
|
|
22859
|
-
ensureFile: createFile,
|
|
22860
|
-
ensureFileSync: createFileSync,
|
|
22861
|
-
createLink,
|
|
22862
|
-
createLinkSync,
|
|
22863
|
-
ensureLink: createLink,
|
|
22864
|
-
ensureLinkSync: createLinkSync,
|
|
22865
|
-
createSymlink,
|
|
22866
|
-
createSymlinkSync,
|
|
22867
|
-
ensureSymlink: createSymlink,
|
|
22868
|
-
ensureSymlinkSync: createSymlinkSync
|
|
22869
|
-
};
|
|
22870
|
-
});
|
|
22871
|
-
|
|
22872
|
-
// node_modules/jsonfile/utils.js
|
|
22873
|
-
var require_utils3 = __commonJS((exports, module) => {
|
|
22874
|
-
function stringify(obj, { EOL = `
|
|
22875
|
-
`, finalEOL = true, replacer = null, spaces } = {}) {
|
|
22876
|
-
const EOF = finalEOL ? EOL : "";
|
|
22877
|
-
const str2 = JSON.stringify(obj, replacer, spaces);
|
|
22878
|
-
return str2.replace(/\n/g, EOL) + EOF;
|
|
22879
|
-
}
|
|
22880
|
-
function stripBom(content) {
|
|
22881
|
-
if (Buffer.isBuffer(content))
|
|
22882
|
-
content = content.toString("utf8");
|
|
22883
|
-
return content.replace(/^\uFEFF/, "");
|
|
22884
|
-
}
|
|
22885
|
-
module.exports = { stringify, stripBom };
|
|
22886
|
-
});
|
|
22887
|
-
|
|
22888
|
-
// node_modules/jsonfile/index.js
|
|
22889
|
-
var require_jsonfile = __commonJS((exports, module) => {
|
|
22890
|
-
var _fs;
|
|
22891
|
-
try {
|
|
22892
|
-
_fs = require_graceful_fs();
|
|
22893
|
-
} catch (_) {
|
|
22894
|
-
_fs = __require("fs");
|
|
22895
|
-
}
|
|
22896
|
-
var universalify = require_universalify();
|
|
22897
|
-
var { stringify, stripBom } = require_utils3();
|
|
22898
|
-
async function _readFile(file, options3 = {}) {
|
|
22899
|
-
if (typeof options3 === "string") {
|
|
22900
|
-
options3 = { encoding: options3 };
|
|
22901
|
-
}
|
|
22902
|
-
const fs = options3.fs || _fs;
|
|
22903
|
-
const shouldThrow = "throws" in options3 ? options3.throws : true;
|
|
22904
|
-
let data = await universalify.fromCallback(fs.readFile)(file, options3);
|
|
22905
|
-
data = stripBom(data);
|
|
22906
|
-
let obj;
|
|
22907
|
-
try {
|
|
22908
|
-
obj = JSON.parse(data, options3 ? options3.reviver : null);
|
|
22909
|
-
} catch (err) {
|
|
22910
|
-
if (shouldThrow) {
|
|
22911
|
-
err.message = `${file}: ${err.message}`;
|
|
22912
|
-
throw err;
|
|
22913
|
-
} else {
|
|
22914
|
-
return null;
|
|
22915
|
-
}
|
|
22916
|
-
}
|
|
22917
|
-
return obj;
|
|
22918
|
-
}
|
|
22919
|
-
var readFile = universalify.fromPromise(_readFile);
|
|
22920
|
-
function readFileSync(file, options3 = {}) {
|
|
22921
|
-
if (typeof options3 === "string") {
|
|
22922
|
-
options3 = { encoding: options3 };
|
|
22923
|
-
}
|
|
22924
|
-
const fs = options3.fs || _fs;
|
|
22925
|
-
const shouldThrow = "throws" in options3 ? options3.throws : true;
|
|
22926
|
-
try {
|
|
22927
|
-
let content = fs.readFileSync(file, options3);
|
|
22928
|
-
content = stripBom(content);
|
|
22929
|
-
return JSON.parse(content, options3.reviver);
|
|
22930
|
-
} catch (err) {
|
|
22931
|
-
if (shouldThrow) {
|
|
22932
|
-
err.message = `${file}: ${err.message}`;
|
|
22933
|
-
throw err;
|
|
22934
|
-
} else {
|
|
22935
|
-
return null;
|
|
22936
|
-
}
|
|
22937
|
-
}
|
|
22938
|
-
}
|
|
22939
|
-
async function _writeFile(file, obj, options3 = {}) {
|
|
22940
|
-
const fs = options3.fs || _fs;
|
|
22941
|
-
const str2 = stringify(obj, options3);
|
|
22942
|
-
await universalify.fromCallback(fs.writeFile)(file, str2, options3);
|
|
22943
|
-
}
|
|
22944
|
-
var writeFile = universalify.fromPromise(_writeFile);
|
|
22945
|
-
function writeFileSync(file, obj, options3 = {}) {
|
|
22946
|
-
const fs = options3.fs || _fs;
|
|
22947
|
-
const str2 = stringify(obj, options3);
|
|
22948
|
-
return fs.writeFileSync(file, str2, options3);
|
|
22949
|
-
}
|
|
22950
|
-
var jsonfile = {
|
|
22951
|
-
readFile,
|
|
22952
|
-
readFileSync,
|
|
22953
|
-
writeFile,
|
|
22954
|
-
writeFileSync
|
|
22955
|
-
};
|
|
22956
|
-
module.exports = jsonfile;
|
|
22957
|
-
});
|
|
22958
|
-
|
|
22959
|
-
// node_modules/fs-extra/lib/json/jsonfile.js
|
|
22960
|
-
var require_jsonfile2 = __commonJS((exports, module) => {
|
|
22961
|
-
var jsonFile = require_jsonfile();
|
|
22962
|
-
module.exports = {
|
|
22963
|
-
readJson: jsonFile.readFile,
|
|
22964
|
-
readJsonSync: jsonFile.readFileSync,
|
|
22965
|
-
writeJson: jsonFile.writeFile,
|
|
22966
|
-
writeJsonSync: jsonFile.writeFileSync
|
|
22967
|
-
};
|
|
22968
|
-
});
|
|
22969
|
-
|
|
22970
|
-
// node_modules/fs-extra/lib/output-file/index.js
|
|
22971
|
-
var require_output_file = __commonJS((exports, module) => {
|
|
22972
|
-
var u = require_universalify().fromPromise;
|
|
22973
|
-
var fs = require_fs();
|
|
22974
|
-
var path3 = __require("path");
|
|
22975
|
-
var mkdir = require_mkdirs();
|
|
22976
|
-
var pathExists = require_path_exists().pathExists;
|
|
22977
|
-
async function outputFile(file, data, encoding = "utf-8") {
|
|
22978
|
-
const dir = path3.dirname(file);
|
|
22979
|
-
if (!await pathExists(dir)) {
|
|
22980
|
-
await mkdir.mkdirs(dir);
|
|
22981
|
-
}
|
|
22982
|
-
return fs.writeFile(file, data, encoding);
|
|
22983
|
-
}
|
|
22984
|
-
function outputFileSync(file, ...args) {
|
|
22985
|
-
const dir = path3.dirname(file);
|
|
22986
|
-
if (!fs.existsSync(dir)) {
|
|
22987
|
-
mkdir.mkdirsSync(dir);
|
|
22988
|
-
}
|
|
22989
|
-
fs.writeFileSync(file, ...args);
|
|
22990
|
-
}
|
|
22991
|
-
module.exports = {
|
|
22992
|
-
outputFile: u(outputFile),
|
|
22993
|
-
outputFileSync
|
|
22994
|
-
};
|
|
22995
|
-
});
|
|
22996
|
-
|
|
22997
|
-
// node_modules/fs-extra/lib/json/output-json.js
|
|
22998
|
-
var require_output_json = __commonJS((exports, module) => {
|
|
22999
|
-
var { stringify } = require_utils3();
|
|
23000
|
-
var { outputFile } = require_output_file();
|
|
23001
|
-
async function outputJson(file, data, options3 = {}) {
|
|
23002
|
-
const str2 = stringify(data, options3);
|
|
23003
|
-
await outputFile(file, str2, options3);
|
|
23004
|
-
}
|
|
23005
|
-
module.exports = outputJson;
|
|
23006
|
-
});
|
|
23007
|
-
|
|
23008
|
-
// node_modules/fs-extra/lib/json/output-json-sync.js
|
|
23009
|
-
var require_output_json_sync = __commonJS((exports, module) => {
|
|
23010
|
-
var { stringify } = require_utils3();
|
|
23011
|
-
var { outputFileSync } = require_output_file();
|
|
23012
|
-
function outputJsonSync(file, data, options3) {
|
|
23013
|
-
const str2 = stringify(data, options3);
|
|
23014
|
-
outputFileSync(file, str2, options3);
|
|
23015
|
-
}
|
|
23016
|
-
module.exports = outputJsonSync;
|
|
23017
|
-
});
|
|
23018
|
-
|
|
23019
|
-
// node_modules/fs-extra/lib/json/index.js
|
|
23020
|
-
var require_json2 = __commonJS((exports, module) => {
|
|
23021
|
-
var u = require_universalify().fromPromise;
|
|
23022
|
-
var jsonFile = require_jsonfile2();
|
|
23023
|
-
jsonFile.outputJson = u(require_output_json());
|
|
23024
|
-
jsonFile.outputJsonSync = require_output_json_sync();
|
|
23025
|
-
jsonFile.outputJSON = jsonFile.outputJson;
|
|
23026
|
-
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
23027
|
-
jsonFile.writeJSON = jsonFile.writeJson;
|
|
23028
|
-
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
23029
|
-
jsonFile.readJSON = jsonFile.readJson;
|
|
23030
|
-
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
23031
|
-
module.exports = jsonFile;
|
|
23032
|
-
});
|
|
23033
|
-
|
|
23034
|
-
// node_modules/fs-extra/lib/move/move.js
|
|
23035
|
-
var require_move = __commonJS((exports, module) => {
|
|
23036
|
-
var fs = require_fs();
|
|
23037
|
-
var path3 = __require("path");
|
|
23038
|
-
var { copy } = require_copy2();
|
|
23039
|
-
var { remove } = require_remove();
|
|
23040
|
-
var { mkdirp } = require_mkdirs();
|
|
23041
|
-
var { pathExists } = require_path_exists();
|
|
23042
|
-
var stat = require_stat();
|
|
23043
|
-
async function move(src, dest, opts = {}) {
|
|
23044
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
23045
|
-
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
23046
|
-
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
23047
|
-
const destParent = path3.dirname(dest);
|
|
23048
|
-
const parsedParentPath = path3.parse(destParent);
|
|
23049
|
-
if (parsedParentPath.root !== destParent) {
|
|
23050
|
-
await mkdirp(destParent);
|
|
23051
|
-
}
|
|
23052
|
-
return doRename(src, dest, overwrite, isChangingCase);
|
|
23053
|
-
}
|
|
23054
|
-
async function doRename(src, dest, overwrite, isChangingCase) {
|
|
23055
|
-
if (!isChangingCase) {
|
|
23056
|
-
if (overwrite) {
|
|
23057
|
-
await remove(dest);
|
|
23058
|
-
} else if (await pathExists(dest)) {
|
|
23059
|
-
throw new Error("dest already exists.");
|
|
23060
|
-
}
|
|
23061
|
-
}
|
|
23062
|
-
try {
|
|
23063
|
-
await fs.rename(src, dest);
|
|
23064
|
-
} catch (err) {
|
|
23065
|
-
if (err.code !== "EXDEV") {
|
|
23066
|
-
throw err;
|
|
23067
|
-
}
|
|
23068
|
-
await moveAcrossDevice(src, dest, overwrite);
|
|
23069
|
-
}
|
|
23070
|
-
}
|
|
23071
|
-
async function moveAcrossDevice(src, dest, overwrite) {
|
|
23072
|
-
const opts = {
|
|
23073
|
-
overwrite,
|
|
23074
|
-
errorOnExist: true,
|
|
23075
|
-
preserveTimestamps: true
|
|
23076
|
-
};
|
|
23077
|
-
await copy(src, dest, opts);
|
|
23078
|
-
return remove(src);
|
|
23079
|
-
}
|
|
23080
|
-
module.exports = move;
|
|
23081
|
-
});
|
|
23082
|
-
|
|
23083
|
-
// node_modules/fs-extra/lib/move/move-sync.js
|
|
23084
|
-
var require_move_sync = __commonJS((exports, module) => {
|
|
23085
|
-
var fs = require_graceful_fs();
|
|
23086
|
-
var path3 = __require("path");
|
|
23087
|
-
var copySync = require_copy2().copySync;
|
|
23088
|
-
var removeSync = require_remove().removeSync;
|
|
23089
|
-
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
23090
|
-
var stat = require_stat();
|
|
23091
|
-
function moveSync(src, dest, opts) {
|
|
23092
|
-
opts = opts || {};
|
|
23093
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
|
23094
|
-
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
23095
|
-
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
23096
|
-
if (!isParentRoot(dest))
|
|
23097
|
-
mkdirpSync(path3.dirname(dest));
|
|
23098
|
-
return doRename(src, dest, overwrite, isChangingCase);
|
|
23099
|
-
}
|
|
23100
|
-
function isParentRoot(dest) {
|
|
23101
|
-
const parent = path3.dirname(dest);
|
|
23102
|
-
const parsedPath = path3.parse(parent);
|
|
23103
|
-
return parsedPath.root === parent;
|
|
23104
|
-
}
|
|
23105
|
-
function doRename(src, dest, overwrite, isChangingCase) {
|
|
23106
|
-
if (isChangingCase)
|
|
23107
|
-
return rename(src, dest, overwrite);
|
|
23108
|
-
if (overwrite) {
|
|
23109
|
-
removeSync(dest);
|
|
23110
|
-
return rename(src, dest, overwrite);
|
|
23111
|
-
}
|
|
23112
|
-
if (fs.existsSync(dest))
|
|
23113
|
-
throw new Error("dest already exists.");
|
|
23114
|
-
return rename(src, dest, overwrite);
|
|
23115
|
-
}
|
|
23116
|
-
function rename(src, dest, overwrite) {
|
|
23117
|
-
try {
|
|
23118
|
-
fs.renameSync(src, dest);
|
|
23119
|
-
} catch (err) {
|
|
23120
|
-
if (err.code !== "EXDEV")
|
|
23121
|
-
throw err;
|
|
23122
|
-
return moveAcrossDevice(src, dest, overwrite);
|
|
23123
|
-
}
|
|
23124
|
-
}
|
|
23125
|
-
function moveAcrossDevice(src, dest, overwrite) {
|
|
23126
|
-
const opts = {
|
|
23127
|
-
overwrite,
|
|
23128
|
-
errorOnExist: true,
|
|
23129
|
-
preserveTimestamps: true
|
|
23130
|
-
};
|
|
23131
|
-
copySync(src, dest, opts);
|
|
23132
|
-
return removeSync(src);
|
|
23133
|
-
}
|
|
23134
|
-
module.exports = moveSync;
|
|
23135
|
-
});
|
|
23136
|
-
|
|
23137
|
-
// node_modules/fs-extra/lib/move/index.js
|
|
23138
|
-
var require_move2 = __commonJS((exports, module) => {
|
|
23139
|
-
var u = require_universalify().fromPromise;
|
|
23140
|
-
module.exports = {
|
|
23141
|
-
move: u(require_move()),
|
|
23142
|
-
moveSync: require_move_sync()
|
|
23143
|
-
};
|
|
23144
|
-
});
|
|
23145
|
-
|
|
23146
|
-
// node_modules/fs-extra/lib/index.js
|
|
23147
|
-
var require_lib8 = __commonJS((exports, module) => {
|
|
23148
|
-
module.exports = {
|
|
23149
|
-
...require_fs(),
|
|
23150
|
-
...require_copy2(),
|
|
23151
|
-
...require_empty(),
|
|
23152
|
-
...require_ensure(),
|
|
23153
|
-
...require_json2(),
|
|
23154
|
-
...require_mkdirs(),
|
|
23155
|
-
...require_move2(),
|
|
23156
|
-
...require_output_file(),
|
|
23157
|
-
...require_path_exists(),
|
|
23158
|
-
...require_remove()
|
|
23159
|
-
};
|
|
23160
|
-
});
|
|
23161
21088
|
// src/site-generator.ts
|
|
23162
21089
|
var import_nunjucks = __toESM(require_nunjucks(), 1);
|
|
23163
21090
|
var import_slugify = __toESM(require_slugify(), 1);
|
|
@@ -27463,11 +25390,10 @@ var marked2 = new Marked(markedHighlight({
|
|
|
27463
25390
|
return core_default.highlight(code, { language }).value;
|
|
27464
25391
|
}
|
|
27465
25392
|
}));
|
|
27466
|
-
|
|
25393
|
+
marked2.setOptions({
|
|
27467
25394
|
gfm: true,
|
|
27468
25395
|
breaks: true
|
|
27469
|
-
};
|
|
27470
|
-
marked2.setOptions(markedOptions);
|
|
25396
|
+
});
|
|
27471
25397
|
marked2.use({
|
|
27472
25398
|
walkTokens(token) {
|
|
27473
25399
|
if (token.type === "link") {
|
|
@@ -27503,7 +25429,14 @@ function extractExcerpt(content, maxLength = 200) {
|
|
|
27503
25429
|
function convertMarkdownToHtml(markdownContent) {
|
|
27504
25430
|
const html = marked2.parse(markdownContent);
|
|
27505
25431
|
return import_sanitize_html.default(html.toString(), {
|
|
27506
|
-
allowedTags: import_sanitize_html.default.defaults.allowedTags.concat([
|
|
25432
|
+
allowedTags: import_sanitize_html.default.defaults.allowedTags.concat([
|
|
25433
|
+
"img",
|
|
25434
|
+
"h1",
|
|
25435
|
+
"h2",
|
|
25436
|
+
"span",
|
|
25437
|
+
"iframe",
|
|
25438
|
+
"div"
|
|
25439
|
+
]),
|
|
27507
25440
|
allowedAttributes: {
|
|
27508
25441
|
...import_sanitize_html.default.defaults.allowedAttributes,
|
|
27509
25442
|
a: ["href", "name", "target", "rel", "title"],
|
|
@@ -27537,7 +25470,9 @@ async function parseMarkdownFile(filePath) {
|
|
|
27537
25470
|
}
|
|
27538
25471
|
let slug = data.slug || getBaseFilename(filePath);
|
|
27539
25472
|
const sanitizedHtml = convertMarkdownToHtml(content);
|
|
27540
|
-
const pacificDate = new Date(new Date(data.date).toLocaleString("en-US", {
|
|
25473
|
+
const pacificDate = new Date(new Date(data.date).toLocaleString("en-US", {
|
|
25474
|
+
timeZone: "America/Los_Angeles"
|
|
25475
|
+
}));
|
|
27541
25476
|
const postYear = pacificDate.getFullYear();
|
|
27542
25477
|
const post = {
|
|
27543
25478
|
title: data.title,
|
|
@@ -27576,11 +25511,15 @@ class SiteGenerator {
|
|
|
27576
25511
|
options;
|
|
27577
25512
|
site;
|
|
27578
25513
|
formatRSSDate(date) {
|
|
27579
|
-
const pacificDate = new Date(new Date(date).toLocaleString("en-US", {
|
|
25514
|
+
const pacificDate = new Date(new Date(date).toLocaleString("en-US", {
|
|
25515
|
+
timeZone: "America/Los_Angeles"
|
|
25516
|
+
}));
|
|
27580
25517
|
return pacificDate.toUTCString();
|
|
27581
25518
|
}
|
|
27582
25519
|
getPacificDate(date) {
|
|
27583
|
-
return new Date(new Date(date).toLocaleString("en-US", {
|
|
25520
|
+
return new Date(new Date(date).toLocaleString("en-US", {
|
|
25521
|
+
timeZone: "America/Los_Angeles"
|
|
25522
|
+
}));
|
|
27584
25523
|
}
|
|
27585
25524
|
createPagination(items, currentPage, pageSize, pagePath) {
|
|
27586
25525
|
const totalItems = items.length;
|
|
@@ -27609,9 +25548,24 @@ class SiteGenerator {
|
|
|
27609
25548
|
watch: false
|
|
27610
25549
|
});
|
|
27611
25550
|
env.addFilter("date", function(date, format) {
|
|
27612
|
-
const pstDate = new Date(date).toLocaleString("en-US", {
|
|
25551
|
+
const pstDate = new Date(date).toLocaleString("en-US", {
|
|
25552
|
+
timeZone: "America/Los_Angeles"
|
|
25553
|
+
});
|
|
27613
25554
|
const d = new Date(pstDate);
|
|
27614
|
-
const months = [
|
|
25555
|
+
const months = [
|
|
25556
|
+
"January",
|
|
25557
|
+
"February",
|
|
25558
|
+
"March",
|
|
25559
|
+
"April",
|
|
25560
|
+
"May",
|
|
25561
|
+
"June",
|
|
25562
|
+
"July",
|
|
25563
|
+
"August",
|
|
25564
|
+
"September",
|
|
25565
|
+
"October",
|
|
25566
|
+
"November",
|
|
25567
|
+
"December"
|
|
25568
|
+
];
|
|
27615
25569
|
if (format === "YYYY") {
|
|
27616
25570
|
return d.getFullYear();
|
|
27617
25571
|
} else if (format === "MMMM D, YYYY") {
|
|
@@ -27621,7 +25575,9 @@ class SiteGenerator {
|
|
|
27621
25575
|
const ampm = d.getHours() >= 12 ? "PM" : "AM";
|
|
27622
25576
|
return `${months[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()} @ ${hours} ${ampm}`;
|
|
27623
25577
|
} else {
|
|
27624
|
-
return d.toLocaleDateString("en-US", {
|
|
25578
|
+
return d.toLocaleDateString("en-US", {
|
|
25579
|
+
timeZone: "America/Los_Angeles"
|
|
25580
|
+
});
|
|
27625
25581
|
}
|
|
27626
25582
|
});
|
|
27627
25583
|
}
|
|
@@ -27817,7 +25773,10 @@ class SiteGenerator {
|
|
|
27817
25773
|
const assetGlob = new Glob2("**/*.*");
|
|
27818
25774
|
const assetsOutputDir = path2.join(this.options.outputDir, "assets");
|
|
27819
25775
|
await ensureDir(assetsOutputDir);
|
|
27820
|
-
for await (const file of assetGlob.scan({
|
|
25776
|
+
for await (const file of assetGlob.scan({
|
|
25777
|
+
cwd: assetsDir,
|
|
25778
|
+
absolute: true
|
|
25779
|
+
})) {
|
|
27821
25780
|
const relativePath = path2.relative(assetsDir, file);
|
|
27822
25781
|
const targetPath = path2.join(assetsOutputDir, relativePath);
|
|
27823
25782
|
const targetDir = path2.dirname(targetPath);
|
|
@@ -27828,7 +25787,10 @@ class SiteGenerator {
|
|
|
27828
25787
|
const publicDirFile = Bun.file(publicDir);
|
|
27829
25788
|
if (await publicDirFile.exists()) {
|
|
27830
25789
|
const publicGlob = new Glob2("**/*.*");
|
|
27831
|
-
for await (const file of publicGlob.scan({
|
|
25790
|
+
for await (const file of publicGlob.scan({
|
|
25791
|
+
cwd: publicDir,
|
|
25792
|
+
absolute: true
|
|
25793
|
+
})) {
|
|
27832
25794
|
const relativePath = path2.relative(publicDir, file);
|
|
27833
25795
|
const targetPath = path2.join(this.options.outputDir, relativePath);
|
|
27834
25796
|
const targetDir = path2.dirname(targetPath);
|
|
@@ -27972,22 +25934,23 @@ ${rssItems}
|
|
|
27972
25934
|
}
|
|
27973
25935
|
// src/server.ts
|
|
27974
25936
|
import path4 from "path";
|
|
27975
|
-
import
|
|
25937
|
+
import fs from "fs/promises";
|
|
27976
25938
|
|
|
27977
25939
|
// src/config.ts
|
|
27978
|
-
var import_fs_extra = __toESM(require_lib8(), 1);
|
|
27979
25940
|
import path3 from "path";
|
|
27980
25941
|
var DEFAULT_CONTENT_DIR = path3.join(process.cwd(), "content");
|
|
27981
25942
|
var DEFAULT_OUTPUT_DIR = path3.join(process.cwd(), "dist");
|
|
27982
25943
|
var DEFAULT_TEMPLATES_DIR = path3.join(process.cwd(), "templates");
|
|
27983
25944
|
var DEFAULT_CONFIG_FILE = path3.join(process.cwd(), "bunki.config.json");
|
|
27984
25945
|
function configExists(configPath = DEFAULT_CONFIG_FILE) {
|
|
27985
|
-
return
|
|
25946
|
+
return Bun.file(configPath).size > 0;
|
|
27986
25947
|
}
|
|
27987
|
-
function loadConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
27988
|
-
|
|
25948
|
+
async function loadConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
25949
|
+
const configFile = Bun.file(configPath);
|
|
25950
|
+
if (await configFile.exists()) {
|
|
27989
25951
|
try {
|
|
27990
|
-
|
|
25952
|
+
const configText = await configFile.text();
|
|
25953
|
+
return JSON.parse(configText);
|
|
27991
25954
|
} catch (error) {
|
|
27992
25955
|
console.error(`Error loading config file ${configPath}:`, error);
|
|
27993
25956
|
return getDefaultConfig();
|
|
@@ -28003,8 +25966,9 @@ function getDefaultConfig() {
|
|
|
28003
25966
|
domain: "blog"
|
|
28004
25967
|
};
|
|
28005
25968
|
}
|
|
28006
|
-
function createDefaultConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
28007
|
-
|
|
25969
|
+
async function createDefaultConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
25970
|
+
const configFile = Bun.file(configPath);
|
|
25971
|
+
if (await configFile.exists()) {
|
|
28008
25972
|
console.log(`Config file already exists at ${configPath}`);
|
|
28009
25973
|
return false;
|
|
28010
25974
|
}
|
|
@@ -28015,7 +25979,7 @@ function createDefaultConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
|
28015
25979
|
domain: "blog"
|
|
28016
25980
|
};
|
|
28017
25981
|
try {
|
|
28018
|
-
|
|
25982
|
+
await Bun.write(configPath, JSON.stringify(defaultConfig, null, 2));
|
|
28019
25983
|
console.log(`Created default config file at ${configPath}`);
|
|
28020
25984
|
return true;
|
|
28021
25985
|
} catch (error) {
|
|
@@ -28023,9 +25987,9 @@ function createDefaultConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
|
28023
25987
|
return false;
|
|
28024
25988
|
}
|
|
28025
25989
|
}
|
|
28026
|
-
function saveConfig(config, configPath = DEFAULT_CONFIG_FILE) {
|
|
25990
|
+
async function saveConfig(config, configPath = DEFAULT_CONFIG_FILE) {
|
|
28027
25991
|
try {
|
|
28028
|
-
|
|
25992
|
+
await Bun.write(configPath, JSON.stringify(config, null, 2));
|
|
28029
25993
|
console.log(`Saved config file to ${configPath}`);
|
|
28030
25994
|
return true;
|
|
28031
25995
|
} catch (error) {
|
|
@@ -28036,9 +26000,9 @@ function saveConfig(config, configPath = DEFAULT_CONFIG_FILE) {
|
|
|
28036
26000
|
|
|
28037
26001
|
// src/server.ts
|
|
28038
26002
|
function startServer(outputDir = DEFAULT_OUTPUT_DIR, port = 3000) {
|
|
28039
|
-
|
|
26003
|
+
fs.access(outputDir).then(() => {
|
|
28040
26004
|
console.log(`Starting server for site in ${outputDir}...`);
|
|
28041
|
-
|
|
26005
|
+
Bun.serve({
|
|
28042
26006
|
port,
|
|
28043
26007
|
async fetch(req) {
|
|
28044
26008
|
try {
|