@nemo-cli/shared 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -260
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import instance, { spinners } from "ora";
|
|
|
23
23
|
import fs from "node:fs/promises";
|
|
24
24
|
import yaml from "yaml";
|
|
25
25
|
|
|
26
|
-
//#region
|
|
26
|
+
//#region \0rolldown/runtime.js
|
|
27
27
|
var __create = Object.create;
|
|
28
28
|
var __defProp = Object.defineProperty;
|
|
29
29
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -143,11 +143,11 @@ const log = {
|
|
|
143
143
|
logger.level = "warn";
|
|
144
144
|
logger.warn("current winston level", logger.level);
|
|
145
145
|
},
|
|
146
|
-
show(message, options) {
|
|
147
|
-
const text
|
|
146
|
+
show(message = "", options) {
|
|
147
|
+
const text = options?.colors?.bold(message) ?? message;
|
|
148
148
|
const type = options?.type ?? "info";
|
|
149
|
-
if (options?.symbol) log$1.message(text
|
|
150
|
-
else log$1[type](text
|
|
149
|
+
if (options?.symbol) log$1.message(text, { symbol: options.symbol });
|
|
150
|
+
else log$1[type](text);
|
|
151
151
|
},
|
|
152
152
|
info(...messages) {
|
|
153
153
|
for (const message of transformMessage(messages)) if (isString(message)) logger.info(`${message}`);
|
|
@@ -214,17 +214,17 @@ const readPackage = (importMeta, ...paths) => {
|
|
|
214
214
|
process.exit(0);
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
|
-
const readJSON = (path
|
|
218
|
-
if (fse.existsSync(path
|
|
219
|
-
log.error("file", `你所查找的${path
|
|
217
|
+
const readJSON = (path, _overwrite = false) => {
|
|
218
|
+
if (fse.existsSync(path)) return fse.readJsonSync(path);
|
|
219
|
+
log.error("file", `你所查找的${path}文件不存在`);
|
|
220
220
|
};
|
|
221
|
-
const writeJSON = (path
|
|
222
|
-
if (!fse.existsSync(path
|
|
223
|
-
return fse.writeFileSync(path
|
|
221
|
+
const writeJSON = (path, content, force = false) => {
|
|
222
|
+
if (!fse.existsSync(path)) force ? fse.mkdirSync(dirname$1(path), { recursive: true }) : log.error("file", `你所查找的${path}文件不存在`);
|
|
223
|
+
return fse.writeFileSync(path, JSON.stringify(content, null, 2));
|
|
224
224
|
};
|
|
225
225
|
const readFile = (importMeta, ...paths) => {
|
|
226
|
-
const path
|
|
227
|
-
return fse.readFileSync(path
|
|
226
|
+
const path = resolve(dirname(importMeta), ...paths);
|
|
227
|
+
return fse.readFileSync(path, "utf-8");
|
|
228
228
|
};
|
|
229
229
|
const copyFile = (src, dest, _overwrite = false) => {
|
|
230
230
|
if (fse.existsSync(dest)) log.error("file", `${dest}`);
|
|
@@ -389,34 +389,15 @@ const zx = (baseCommand, dynamicParts = [], options = {}) => {
|
|
|
389
389
|
throw error;
|
|
390
390
|
}
|
|
391
391
|
};
|
|
392
|
-
const checkCommand = async (_command) => {
|
|
393
|
-
try {
|
|
394
|
-
const a = await $`command -v git >/dev/null 2>&1`;
|
|
395
|
-
console.log("🚀 : checkCommand : a:", a);
|
|
396
|
-
const b = await x$1("command", [
|
|
397
|
-
"-v",
|
|
398
|
-
"git",
|
|
399
|
-
">/dev/null",
|
|
400
|
-
"2>&1"
|
|
401
|
-
]);
|
|
402
|
-
console.log("🚀 : checkCommand : b:", b);
|
|
403
|
-
const [error, result] = await xASync("command", [
|
|
404
|
-
"-v",
|
|
405
|
-
_command,
|
|
406
|
-
">/dev/null",
|
|
407
|
-
"2>&1"
|
|
408
|
-
]);
|
|
409
|
-
console.log("🚀 : checkCommand : result:", result);
|
|
410
|
-
if (error) return false;
|
|
411
|
-
return !!result.stdout;
|
|
412
|
-
} catch (error) {
|
|
413
|
-
console.log(error);
|
|
414
|
-
return false;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
392
|
const xASync = async (command, args, options) => {
|
|
418
393
|
try {
|
|
419
|
-
const result = await x$1(command, args,
|
|
394
|
+
const result = await x$1(command, args, merge({
|
|
395
|
+
nodeOptions: {
|
|
396
|
+
cwd: process$1.cwd(),
|
|
397
|
+
FORCE_COLOR: "1"
|
|
398
|
+
},
|
|
399
|
+
throwOnError: true
|
|
400
|
+
}, options ?? {}));
|
|
420
401
|
if (result.exitCode) {
|
|
421
402
|
!options?.quiet && log.show(`Failed to execute command ${command}. Command exited with code ${result.exitCode}.`, { type: "error" });
|
|
422
403
|
!options?.quiet && log.show(result.stderr, { type: "error" });
|
|
@@ -441,9 +422,9 @@ const cached = (fn) => {
|
|
|
441
422
|
};
|
|
442
423
|
};
|
|
443
424
|
const sleep = (millisecond, controller) => {
|
|
444
|
-
return new Promise((resolve
|
|
425
|
+
return new Promise((resolve, reject) => {
|
|
445
426
|
controller?.signal.addEventListener("abort", reject);
|
|
446
|
-
setTimeout(resolve
|
|
427
|
+
setTimeout(resolve, millisecond);
|
|
447
428
|
});
|
|
448
429
|
};
|
|
449
430
|
|
|
@@ -552,8 +533,8 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
552
533
|
function supportsAnsi() {
|
|
553
534
|
return process.stdout.isTTY;
|
|
554
535
|
}
|
|
555
|
-
function dim(text
|
|
556
|
-
return supportsAnsi() ? `\x1b[2m${text
|
|
536
|
+
function dim(text) {
|
|
537
|
+
return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text;
|
|
557
538
|
}
|
|
558
539
|
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
559
540
|
function parse(src) {
|
|
@@ -686,11 +667,11 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
686
667
|
}
|
|
687
668
|
let lastError;
|
|
688
669
|
const parsedAll = {};
|
|
689
|
-
for (const path
|
|
690
|
-
const parsed = DotenvModule.parse(fs$2.readFileSync(path
|
|
670
|
+
for (const path of optionPaths) try {
|
|
671
|
+
const parsed = DotenvModule.parse(fs$2.readFileSync(path, { encoding }));
|
|
691
672
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
692
673
|
} catch (e) {
|
|
693
|
-
if (debug) _debug(`Failed to load ${path
|
|
674
|
+
if (debug) _debug(`Failed to load ${path} ${e.message}`);
|
|
694
675
|
lastError = e;
|
|
695
676
|
}
|
|
696
677
|
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
@@ -819,7 +800,7 @@ const isDebug = () => process.argv.includes("-d") || process.argv.includes("--de
|
|
|
819
800
|
//#endregion
|
|
820
801
|
//#region src/utils/format.ts
|
|
821
802
|
const CHINESE_STRING_REGEXP = /[\u4e00-\u9fa5]/;
|
|
822
|
-
const isChinese = (text
|
|
803
|
+
const isChinese = (text) => CHINESE_STRING_REGEXP.test(text);
|
|
823
804
|
|
|
824
805
|
//#endregion
|
|
825
806
|
//#region src/utils/git-handle/index.ts
|
|
@@ -878,8 +859,8 @@ var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
878
859
|
exports.fromCallback = function(fn) {
|
|
879
860
|
return Object.defineProperty(function(...args) {
|
|
880
861
|
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
|
|
881
|
-
else return new Promise((resolve
|
|
882
|
-
args.push((err, res) => err != null ? reject(err) : resolve
|
|
862
|
+
else return new Promise((resolve, reject) => {
|
|
863
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
883
864
|
fn.apply(this, args);
|
|
884
865
|
});
|
|
885
866
|
}, "name", { value: fn.name });
|
|
@@ -919,47 +900,47 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
919
900
|
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
920
901
|
}
|
|
921
902
|
module.exports = patch;
|
|
922
|
-
function patch(fs
|
|
923
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs
|
|
924
|
-
if (!fs
|
|
925
|
-
fs
|
|
926
|
-
fs
|
|
927
|
-
fs
|
|
928
|
-
fs
|
|
929
|
-
fs
|
|
930
|
-
fs
|
|
931
|
-
fs
|
|
932
|
-
fs
|
|
933
|
-
fs
|
|
934
|
-
fs
|
|
935
|
-
fs
|
|
936
|
-
fs
|
|
937
|
-
fs
|
|
938
|
-
fs
|
|
939
|
-
fs
|
|
940
|
-
fs
|
|
941
|
-
fs
|
|
942
|
-
fs
|
|
943
|
-
if (fs
|
|
944
|
-
fs
|
|
903
|
+
function patch(fs) {
|
|
904
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
|
|
905
|
+
if (!fs.lutimes) patchLutimes(fs);
|
|
906
|
+
fs.chown = chownFix(fs.chown);
|
|
907
|
+
fs.fchown = chownFix(fs.fchown);
|
|
908
|
+
fs.lchown = chownFix(fs.lchown);
|
|
909
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
910
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
911
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
912
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
913
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
914
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
915
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
916
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
917
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
918
|
+
fs.stat = statFix(fs.stat);
|
|
919
|
+
fs.fstat = statFix(fs.fstat);
|
|
920
|
+
fs.lstat = statFix(fs.lstat);
|
|
921
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
922
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
923
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
924
|
+
if (fs.chmod && !fs.lchmod) {
|
|
925
|
+
fs.lchmod = function(path, mode, cb) {
|
|
945
926
|
if (cb) process.nextTick(cb);
|
|
946
927
|
};
|
|
947
|
-
fs
|
|
928
|
+
fs.lchmodSync = function() {};
|
|
948
929
|
}
|
|
949
|
-
if (fs
|
|
950
|
-
fs
|
|
930
|
+
if (fs.chown && !fs.lchown) {
|
|
931
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
951
932
|
if (cb) process.nextTick(cb);
|
|
952
933
|
};
|
|
953
|
-
fs
|
|
934
|
+
fs.lchownSync = function() {};
|
|
954
935
|
}
|
|
955
|
-
if (platform === "win32") fs
|
|
936
|
+
if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
956
937
|
function rename(from, to, cb) {
|
|
957
938
|
var start = Date.now();
|
|
958
939
|
var backoff = 0;
|
|
959
940
|
fs$rename(from, to, function CB(er) {
|
|
960
941
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
961
942
|
setTimeout(function() {
|
|
962
|
-
fs
|
|
943
|
+
fs.stat(to, function(stater, st) {
|
|
963
944
|
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
964
945
|
else cb(er);
|
|
965
946
|
});
|
|
@@ -972,8 +953,8 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
972
953
|
}
|
|
973
954
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
974
955
|
return rename;
|
|
975
|
-
})(fs
|
|
976
|
-
fs
|
|
956
|
+
})(fs.rename);
|
|
957
|
+
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
977
958
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
978
959
|
var callback;
|
|
979
960
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -981,21 +962,21 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
981
962
|
callback = function(er, _, __) {
|
|
982
963
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
983
964
|
eagCounter++;
|
|
984
|
-
return fs$read.call(fs
|
|
965
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
985
966
|
}
|
|
986
967
|
callback_.apply(this, arguments);
|
|
987
968
|
};
|
|
988
969
|
}
|
|
989
|
-
return fs$read.call(fs
|
|
970
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
990
971
|
}
|
|
991
972
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
992
973
|
return read;
|
|
993
|
-
})(fs
|
|
994
|
-
fs
|
|
974
|
+
})(fs.read);
|
|
975
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
|
|
995
976
|
return function(fd, buffer, offset, length, position) {
|
|
996
977
|
var eagCounter = 0;
|
|
997
978
|
while (true) try {
|
|
998
|
-
return fs$readSync.call(fs
|
|
979
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
999
980
|
} catch (er) {
|
|
1000
981
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
1001
982
|
eagCounter++;
|
|
@@ -1004,78 +985,78 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1004
985
|
throw er;
|
|
1005
986
|
}
|
|
1006
987
|
};
|
|
1007
|
-
})(fs
|
|
1008
|
-
function patchLchmod(fs
|
|
1009
|
-
fs
|
|
1010
|
-
fs
|
|
988
|
+
})(fs.readSync);
|
|
989
|
+
function patchLchmod(fs) {
|
|
990
|
+
fs.lchmod = function(path, mode, callback) {
|
|
991
|
+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
1011
992
|
if (err) {
|
|
1012
993
|
if (callback) callback(err);
|
|
1013
994
|
return;
|
|
1014
995
|
}
|
|
1015
|
-
fs
|
|
1016
|
-
fs
|
|
1017
|
-
if (callback) callback(err
|
|
996
|
+
fs.fchmod(fd, mode, function(err) {
|
|
997
|
+
fs.close(fd, function(err2) {
|
|
998
|
+
if (callback) callback(err || err2);
|
|
1018
999
|
});
|
|
1019
1000
|
});
|
|
1020
1001
|
});
|
|
1021
1002
|
};
|
|
1022
|
-
fs
|
|
1023
|
-
var fd = fs
|
|
1003
|
+
fs.lchmodSync = function(path, mode) {
|
|
1004
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
1024
1005
|
var threw = true;
|
|
1025
1006
|
var ret;
|
|
1026
1007
|
try {
|
|
1027
|
-
ret = fs
|
|
1008
|
+
ret = fs.fchmodSync(fd, mode);
|
|
1028
1009
|
threw = false;
|
|
1029
1010
|
} finally {
|
|
1030
1011
|
if (threw) try {
|
|
1031
|
-
fs
|
|
1012
|
+
fs.closeSync(fd);
|
|
1032
1013
|
} catch (er) {}
|
|
1033
|
-
else fs
|
|
1014
|
+
else fs.closeSync(fd);
|
|
1034
1015
|
}
|
|
1035
1016
|
return ret;
|
|
1036
1017
|
};
|
|
1037
1018
|
}
|
|
1038
|
-
function patchLutimes(fs
|
|
1039
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs
|
|
1040
|
-
fs
|
|
1041
|
-
fs
|
|
1019
|
+
function patchLutimes(fs) {
|
|
1020
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
1021
|
+
fs.lutimes = function(path, at, mt, cb) {
|
|
1022
|
+
fs.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
1042
1023
|
if (er) {
|
|
1043
1024
|
if (cb) cb(er);
|
|
1044
1025
|
return;
|
|
1045
1026
|
}
|
|
1046
|
-
fs
|
|
1047
|
-
fs
|
|
1048
|
-
if (cb) cb(er
|
|
1027
|
+
fs.futimes(fd, at, mt, function(er) {
|
|
1028
|
+
fs.close(fd, function(er2) {
|
|
1029
|
+
if (cb) cb(er || er2);
|
|
1049
1030
|
});
|
|
1050
1031
|
});
|
|
1051
1032
|
});
|
|
1052
1033
|
};
|
|
1053
|
-
fs
|
|
1054
|
-
var fd = fs
|
|
1034
|
+
fs.lutimesSync = function(path, at, mt) {
|
|
1035
|
+
var fd = fs.openSync(path, constants.O_SYMLINK);
|
|
1055
1036
|
var ret;
|
|
1056
1037
|
var threw = true;
|
|
1057
1038
|
try {
|
|
1058
|
-
ret = fs
|
|
1039
|
+
ret = fs.futimesSync(fd, at, mt);
|
|
1059
1040
|
threw = false;
|
|
1060
1041
|
} finally {
|
|
1061
1042
|
if (threw) try {
|
|
1062
|
-
fs
|
|
1043
|
+
fs.closeSync(fd);
|
|
1063
1044
|
} catch (er) {}
|
|
1064
|
-
else fs
|
|
1045
|
+
else fs.closeSync(fd);
|
|
1065
1046
|
}
|
|
1066
1047
|
return ret;
|
|
1067
1048
|
};
|
|
1068
|
-
} else if (fs
|
|
1069
|
-
fs
|
|
1049
|
+
} else if (fs.futimes) {
|
|
1050
|
+
fs.lutimes = function(_a, _b, _c, cb) {
|
|
1070
1051
|
if (cb) process.nextTick(cb);
|
|
1071
1052
|
};
|
|
1072
|
-
fs
|
|
1053
|
+
fs.lutimesSync = function() {};
|
|
1073
1054
|
}
|
|
1074
1055
|
}
|
|
1075
1056
|
function chmodFix(orig) {
|
|
1076
1057
|
if (!orig) return orig;
|
|
1077
1058
|
return function(target, mode, cb) {
|
|
1078
|
-
return orig.call(fs
|
|
1059
|
+
return orig.call(fs, target, mode, function(er) {
|
|
1079
1060
|
if (chownErOk(er)) er = null;
|
|
1080
1061
|
if (cb) cb.apply(this, arguments);
|
|
1081
1062
|
});
|
|
@@ -1085,7 +1066,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1085
1066
|
if (!orig) return orig;
|
|
1086
1067
|
return function(target, mode) {
|
|
1087
1068
|
try {
|
|
1088
|
-
return orig.call(fs
|
|
1069
|
+
return orig.call(fs, target, mode);
|
|
1089
1070
|
} catch (er) {
|
|
1090
1071
|
if (!chownErOk(er)) throw er;
|
|
1091
1072
|
}
|
|
@@ -1094,7 +1075,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1094
1075
|
function chownFix(orig) {
|
|
1095
1076
|
if (!orig) return orig;
|
|
1096
1077
|
return function(target, uid, gid, cb) {
|
|
1097
|
-
return orig.call(fs
|
|
1078
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
1098
1079
|
if (chownErOk(er)) er = null;
|
|
1099
1080
|
if (cb) cb.apply(this, arguments);
|
|
1100
1081
|
});
|
|
@@ -1104,7 +1085,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1104
1085
|
if (!orig) return orig;
|
|
1105
1086
|
return function(target, uid, gid) {
|
|
1106
1087
|
try {
|
|
1107
|
-
return orig.call(fs
|
|
1088
|
+
return orig.call(fs, target, uid, gid);
|
|
1108
1089
|
} catch (er) {
|
|
1109
1090
|
if (!chownErOk(er)) throw er;
|
|
1110
1091
|
}
|
|
@@ -1124,13 +1105,13 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1124
1105
|
}
|
|
1125
1106
|
if (cb) cb.apply(this, arguments);
|
|
1126
1107
|
}
|
|
1127
|
-
return options ? orig.call(fs
|
|
1108
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
1128
1109
|
};
|
|
1129
1110
|
}
|
|
1130
1111
|
function statFixSync(orig) {
|
|
1131
1112
|
if (!orig) return orig;
|
|
1132
1113
|
return function(target, options) {
|
|
1133
|
-
var stats = options ? orig.call(fs
|
|
1114
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
1134
1115
|
if (stats) {
|
|
1135
1116
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
1136
1117
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -1154,16 +1135,16 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1154
1135
|
var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1155
1136
|
var Stream = __require("stream").Stream;
|
|
1156
1137
|
module.exports = legacy;
|
|
1157
|
-
function legacy(fs
|
|
1138
|
+
function legacy(fs) {
|
|
1158
1139
|
return {
|
|
1159
1140
|
ReadStream,
|
|
1160
1141
|
WriteStream
|
|
1161
1142
|
};
|
|
1162
|
-
function ReadStream(path
|
|
1163
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path
|
|
1143
|
+
function ReadStream(path, options) {
|
|
1144
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
1164
1145
|
Stream.call(this);
|
|
1165
1146
|
var self = this;
|
|
1166
|
-
this.path = path
|
|
1147
|
+
this.path = path;
|
|
1167
1148
|
this.fd = null;
|
|
1168
1149
|
this.readable = true;
|
|
1169
1150
|
this.paused = false;
|
|
@@ -1190,7 +1171,7 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1190
1171
|
});
|
|
1191
1172
|
return;
|
|
1192
1173
|
}
|
|
1193
|
-
fs
|
|
1174
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
1194
1175
|
if (err) {
|
|
1195
1176
|
self.emit("error", err);
|
|
1196
1177
|
self.readable = false;
|
|
@@ -1201,10 +1182,10 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1201
1182
|
self._read();
|
|
1202
1183
|
});
|
|
1203
1184
|
}
|
|
1204
|
-
function WriteStream(path
|
|
1205
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path
|
|
1185
|
+
function WriteStream(path, options) {
|
|
1186
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
1206
1187
|
Stream.call(this);
|
|
1207
|
-
this.path = path
|
|
1188
|
+
this.path = path;
|
|
1208
1189
|
this.fd = null;
|
|
1209
1190
|
this.writable = true;
|
|
1210
1191
|
this.flags = "w";
|
|
@@ -1225,7 +1206,7 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1225
1206
|
this.busy = false;
|
|
1226
1207
|
this._queue = [];
|
|
1227
1208
|
if (this.fd === null) {
|
|
1228
|
-
this._open = fs
|
|
1209
|
+
this._open = fs.open;
|
|
1229
1210
|
this._queue.push([
|
|
1230
1211
|
this._open,
|
|
1231
1212
|
this.path,
|
|
@@ -1248,12 +1229,12 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1248
1229
|
};
|
|
1249
1230
|
function clone(obj) {
|
|
1250
1231
|
if (obj === null || typeof obj !== "object") return obj;
|
|
1251
|
-
if (obj instanceof Object) var copy
|
|
1252
|
-
else var copy
|
|
1232
|
+
if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
|
|
1233
|
+
else var copy = Object.create(null);
|
|
1253
1234
|
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
1254
|
-
Object.defineProperty(copy
|
|
1235
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
1255
1236
|
});
|
|
1256
|
-
return copy
|
|
1237
|
+
return copy;
|
|
1257
1238
|
}
|
|
1258
1239
|
}));
|
|
1259
1240
|
|
|
@@ -1320,124 +1301,124 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1320
1301
|
module.exports = patch(fs$1);
|
|
1321
1302
|
fs$1.__patched = true;
|
|
1322
1303
|
}
|
|
1323
|
-
function patch(fs
|
|
1324
|
-
polyfills(fs
|
|
1325
|
-
fs
|
|
1326
|
-
fs
|
|
1327
|
-
fs
|
|
1328
|
-
var fs$readFile = fs
|
|
1329
|
-
fs
|
|
1330
|
-
function readFile
|
|
1304
|
+
function patch(fs) {
|
|
1305
|
+
polyfills(fs);
|
|
1306
|
+
fs.gracefulify = patch;
|
|
1307
|
+
fs.createReadStream = createReadStream;
|
|
1308
|
+
fs.createWriteStream = createWriteStream;
|
|
1309
|
+
var fs$readFile = fs.readFile;
|
|
1310
|
+
fs.readFile = readFile;
|
|
1311
|
+
function readFile(path, options, cb) {
|
|
1331
1312
|
if (typeof options === "function") cb = options, options = null;
|
|
1332
|
-
return go$readFile(path
|
|
1333
|
-
function go$readFile(path
|
|
1334
|
-
return fs$readFile(path
|
|
1313
|
+
return go$readFile(path, options, cb);
|
|
1314
|
+
function go$readFile(path, options, cb, startTime) {
|
|
1315
|
+
return fs$readFile(path, options, function(err) {
|
|
1335
1316
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1336
1317
|
go$readFile,
|
|
1337
1318
|
[
|
|
1338
|
-
path
|
|
1339
|
-
options
|
|
1340
|
-
cb
|
|
1319
|
+
path,
|
|
1320
|
+
options,
|
|
1321
|
+
cb
|
|
1341
1322
|
],
|
|
1342
1323
|
err,
|
|
1343
1324
|
startTime || Date.now(),
|
|
1344
1325
|
Date.now()
|
|
1345
1326
|
]);
|
|
1346
|
-
else if (typeof cb
|
|
1327
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1347
1328
|
});
|
|
1348
1329
|
}
|
|
1349
1330
|
}
|
|
1350
|
-
var fs$writeFile = fs
|
|
1351
|
-
fs
|
|
1352
|
-
function writeFile(path
|
|
1331
|
+
var fs$writeFile = fs.writeFile;
|
|
1332
|
+
fs.writeFile = writeFile;
|
|
1333
|
+
function writeFile(path, data, options, cb) {
|
|
1353
1334
|
if (typeof options === "function") cb = options, options = null;
|
|
1354
|
-
return go$writeFile(path
|
|
1355
|
-
function go$writeFile(path
|
|
1356
|
-
return fs$writeFile(path
|
|
1335
|
+
return go$writeFile(path, data, options, cb);
|
|
1336
|
+
function go$writeFile(path, data, options, cb, startTime) {
|
|
1337
|
+
return fs$writeFile(path, data, options, function(err) {
|
|
1357
1338
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1358
1339
|
go$writeFile,
|
|
1359
1340
|
[
|
|
1360
|
-
path
|
|
1361
|
-
data
|
|
1362
|
-
options
|
|
1363
|
-
cb
|
|
1341
|
+
path,
|
|
1342
|
+
data,
|
|
1343
|
+
options,
|
|
1344
|
+
cb
|
|
1364
1345
|
],
|
|
1365
1346
|
err,
|
|
1366
1347
|
startTime || Date.now(),
|
|
1367
1348
|
Date.now()
|
|
1368
1349
|
]);
|
|
1369
|
-
else if (typeof cb
|
|
1350
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1370
1351
|
});
|
|
1371
1352
|
}
|
|
1372
1353
|
}
|
|
1373
|
-
var fs$appendFile = fs
|
|
1374
|
-
if (fs$appendFile) fs
|
|
1375
|
-
function appendFile(path
|
|
1354
|
+
var fs$appendFile = fs.appendFile;
|
|
1355
|
+
if (fs$appendFile) fs.appendFile = appendFile;
|
|
1356
|
+
function appendFile(path, data, options, cb) {
|
|
1376
1357
|
if (typeof options === "function") cb = options, options = null;
|
|
1377
|
-
return go$appendFile(path
|
|
1378
|
-
function go$appendFile(path
|
|
1379
|
-
return fs$appendFile(path
|
|
1358
|
+
return go$appendFile(path, data, options, cb);
|
|
1359
|
+
function go$appendFile(path, data, options, cb, startTime) {
|
|
1360
|
+
return fs$appendFile(path, data, options, function(err) {
|
|
1380
1361
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1381
1362
|
go$appendFile,
|
|
1382
1363
|
[
|
|
1383
|
-
path
|
|
1384
|
-
data
|
|
1385
|
-
options
|
|
1386
|
-
cb
|
|
1364
|
+
path,
|
|
1365
|
+
data,
|
|
1366
|
+
options,
|
|
1367
|
+
cb
|
|
1387
1368
|
],
|
|
1388
1369
|
err,
|
|
1389
1370
|
startTime || Date.now(),
|
|
1390
1371
|
Date.now()
|
|
1391
1372
|
]);
|
|
1392
|
-
else if (typeof cb
|
|
1373
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1393
1374
|
});
|
|
1394
1375
|
}
|
|
1395
1376
|
}
|
|
1396
|
-
var fs$copyFile = fs
|
|
1397
|
-
if (fs$copyFile) fs
|
|
1398
|
-
function copyFile
|
|
1377
|
+
var fs$copyFile = fs.copyFile;
|
|
1378
|
+
if (fs$copyFile) fs.copyFile = copyFile;
|
|
1379
|
+
function copyFile(src, dest, flags, cb) {
|
|
1399
1380
|
if (typeof flags === "function") {
|
|
1400
1381
|
cb = flags;
|
|
1401
1382
|
flags = 0;
|
|
1402
1383
|
}
|
|
1403
1384
|
return go$copyFile(src, dest, flags, cb);
|
|
1404
|
-
function go$copyFile(src
|
|
1405
|
-
return fs$copyFile(src
|
|
1385
|
+
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
1386
|
+
return fs$copyFile(src, dest, flags, function(err) {
|
|
1406
1387
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1407
1388
|
go$copyFile,
|
|
1408
1389
|
[
|
|
1409
|
-
src
|
|
1410
|
-
dest
|
|
1411
|
-
flags
|
|
1412
|
-
cb
|
|
1390
|
+
src,
|
|
1391
|
+
dest,
|
|
1392
|
+
flags,
|
|
1393
|
+
cb
|
|
1413
1394
|
],
|
|
1414
1395
|
err,
|
|
1415
1396
|
startTime || Date.now(),
|
|
1416
1397
|
Date.now()
|
|
1417
1398
|
]);
|
|
1418
|
-
else if (typeof cb
|
|
1399
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1419
1400
|
});
|
|
1420
1401
|
}
|
|
1421
1402
|
}
|
|
1422
|
-
var fs$readdir = fs
|
|
1423
|
-
fs
|
|
1403
|
+
var fs$readdir = fs.readdir;
|
|
1404
|
+
fs.readdir = readdir;
|
|
1424
1405
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1425
|
-
function readdir(path
|
|
1406
|
+
function readdir(path, options, cb) {
|
|
1426
1407
|
if (typeof options === "function") cb = options, options = null;
|
|
1427
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir
|
|
1428
|
-
return fs$readdir(path
|
|
1429
|
-
} : function go$readdir
|
|
1430
|
-
return fs$readdir(path
|
|
1408
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
1409
|
+
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
1410
|
+
} : function go$readdir(path, options, cb, startTime) {
|
|
1411
|
+
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
1431
1412
|
};
|
|
1432
|
-
return go$readdir(path
|
|
1433
|
-
function fs$readdirCallback(path
|
|
1413
|
+
return go$readdir(path, options, cb);
|
|
1414
|
+
function fs$readdirCallback(path, options, cb, startTime) {
|
|
1434
1415
|
return function(err, files) {
|
|
1435
1416
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1436
1417
|
go$readdir,
|
|
1437
1418
|
[
|
|
1438
|
-
path
|
|
1439
|
-
options
|
|
1440
|
-
cb
|
|
1419
|
+
path,
|
|
1420
|
+
options,
|
|
1421
|
+
cb
|
|
1441
1422
|
],
|
|
1442
1423
|
err,
|
|
1443
1424
|
startTime || Date.now(),
|
|
@@ -1445,27 +1426,27 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1445
1426
|
]);
|
|
1446
1427
|
else {
|
|
1447
1428
|
if (files && files.sort) files.sort();
|
|
1448
|
-
if (typeof cb
|
|
1429
|
+
if (typeof cb === "function") cb.call(this, err, files);
|
|
1449
1430
|
}
|
|
1450
1431
|
};
|
|
1451
1432
|
}
|
|
1452
1433
|
}
|
|
1453
1434
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
1454
|
-
var legStreams = legacy(fs
|
|
1435
|
+
var legStreams = legacy(fs);
|
|
1455
1436
|
ReadStream = legStreams.ReadStream;
|
|
1456
1437
|
WriteStream = legStreams.WriteStream;
|
|
1457
1438
|
}
|
|
1458
|
-
var fs$ReadStream = fs
|
|
1439
|
+
var fs$ReadStream = fs.ReadStream;
|
|
1459
1440
|
if (fs$ReadStream) {
|
|
1460
1441
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
1461
1442
|
ReadStream.prototype.open = ReadStream$open;
|
|
1462
1443
|
}
|
|
1463
|
-
var fs$WriteStream = fs
|
|
1444
|
+
var fs$WriteStream = fs.WriteStream;
|
|
1464
1445
|
if (fs$WriteStream) {
|
|
1465
1446
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
1466
1447
|
WriteStream.prototype.open = WriteStream$open;
|
|
1467
1448
|
}
|
|
1468
|
-
Object.defineProperty(fs
|
|
1449
|
+
Object.defineProperty(fs, "ReadStream", {
|
|
1469
1450
|
get: function() {
|
|
1470
1451
|
return ReadStream;
|
|
1471
1452
|
},
|
|
@@ -1475,7 +1456,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1475
1456
|
enumerable: true,
|
|
1476
1457
|
configurable: true
|
|
1477
1458
|
});
|
|
1478
|
-
Object.defineProperty(fs
|
|
1459
|
+
Object.defineProperty(fs, "WriteStream", {
|
|
1479
1460
|
get: function() {
|
|
1480
1461
|
return WriteStream;
|
|
1481
1462
|
},
|
|
@@ -1486,7 +1467,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1486
1467
|
configurable: true
|
|
1487
1468
|
});
|
|
1488
1469
|
var FileReadStream = ReadStream;
|
|
1489
|
-
Object.defineProperty(fs
|
|
1470
|
+
Object.defineProperty(fs, "FileReadStream", {
|
|
1490
1471
|
get: function() {
|
|
1491
1472
|
return FileReadStream;
|
|
1492
1473
|
},
|
|
@@ -1497,7 +1478,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1497
1478
|
configurable: true
|
|
1498
1479
|
});
|
|
1499
1480
|
var FileWriteStream = WriteStream;
|
|
1500
|
-
Object.defineProperty(fs
|
|
1481
|
+
Object.defineProperty(fs, "FileWriteStream", {
|
|
1501
1482
|
get: function() {
|
|
1502
1483
|
return FileWriteStream;
|
|
1503
1484
|
},
|
|
@@ -1507,13 +1488,13 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1507
1488
|
enumerable: true,
|
|
1508
1489
|
configurable: true
|
|
1509
1490
|
});
|
|
1510
|
-
function ReadStream(path
|
|
1491
|
+
function ReadStream(path, options) {
|
|
1511
1492
|
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
1512
1493
|
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
1513
1494
|
}
|
|
1514
1495
|
function ReadStream$open() {
|
|
1515
1496
|
var that = this;
|
|
1516
|
-
open
|
|
1497
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
1517
1498
|
if (err) {
|
|
1518
1499
|
if (that.autoClose) that.destroy();
|
|
1519
1500
|
that.emit("error", err);
|
|
@@ -1524,13 +1505,13 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1524
1505
|
}
|
|
1525
1506
|
});
|
|
1526
1507
|
}
|
|
1527
|
-
function WriteStream(path
|
|
1508
|
+
function WriteStream(path, options) {
|
|
1528
1509
|
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
1529
1510
|
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
1530
1511
|
}
|
|
1531
1512
|
function WriteStream$open() {
|
|
1532
1513
|
var that = this;
|
|
1533
|
-
open
|
|
1514
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
1534
1515
|
if (err) {
|
|
1535
1516
|
that.destroy();
|
|
1536
1517
|
that.emit("error", err);
|
|
@@ -1540,36 +1521,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1540
1521
|
}
|
|
1541
1522
|
});
|
|
1542
1523
|
}
|
|
1543
|
-
function createReadStream(path
|
|
1544
|
-
return new fs
|
|
1524
|
+
function createReadStream(path, options) {
|
|
1525
|
+
return new fs.ReadStream(path, options);
|
|
1545
1526
|
}
|
|
1546
|
-
function createWriteStream(path
|
|
1547
|
-
return new fs
|
|
1527
|
+
function createWriteStream(path, options) {
|
|
1528
|
+
return new fs.WriteStream(path, options);
|
|
1548
1529
|
}
|
|
1549
|
-
var fs$open = fs
|
|
1550
|
-
fs
|
|
1551
|
-
function open
|
|
1530
|
+
var fs$open = fs.open;
|
|
1531
|
+
fs.open = open;
|
|
1532
|
+
function open(path, flags, mode, cb) {
|
|
1552
1533
|
if (typeof mode === "function") cb = mode, mode = null;
|
|
1553
|
-
return go$open(path
|
|
1554
|
-
function go$open(path
|
|
1555
|
-
return fs$open(path
|
|
1534
|
+
return go$open(path, flags, mode, cb);
|
|
1535
|
+
function go$open(path, flags, mode, cb, startTime) {
|
|
1536
|
+
return fs$open(path, flags, mode, function(err, fd) {
|
|
1556
1537
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1557
1538
|
go$open,
|
|
1558
1539
|
[
|
|
1559
|
-
path
|
|
1560
|
-
flags
|
|
1561
|
-
mode
|
|
1562
|
-
cb
|
|
1540
|
+
path,
|
|
1541
|
+
flags,
|
|
1542
|
+
mode,
|
|
1543
|
+
cb
|
|
1563
1544
|
],
|
|
1564
1545
|
err,
|
|
1565
1546
|
startTime || Date.now(),
|
|
1566
1547
|
Date.now()
|
|
1567
1548
|
]);
|
|
1568
|
-
else if (typeof cb
|
|
1549
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1569
1550
|
});
|
|
1570
1551
|
}
|
|
1571
1552
|
}
|
|
1572
|
-
return fs
|
|
1553
|
+
return fs;
|
|
1573
1554
|
}
|
|
1574
1555
|
function enqueue(elem) {
|
|
1575
1556
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
@@ -1665,56 +1646,56 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1665
1646
|
api.forEach((method) => {
|
|
1666
1647
|
exports[method] = u(fs[method]);
|
|
1667
1648
|
});
|
|
1668
|
-
exports.exists = function(filename
|
|
1669
|
-
if (typeof callback === "function") return fs.exists(filename
|
|
1670
|
-
return new Promise((resolve
|
|
1671
|
-
return fs.exists(filename
|
|
1649
|
+
exports.exists = function(filename, callback) {
|
|
1650
|
+
if (typeof callback === "function") return fs.exists(filename, callback);
|
|
1651
|
+
return new Promise((resolve) => {
|
|
1652
|
+
return fs.exists(filename, resolve);
|
|
1672
1653
|
});
|
|
1673
1654
|
};
|
|
1674
1655
|
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
1675
1656
|
if (typeof callback === "function") return fs.read(fd, buffer, offset, length, position, callback);
|
|
1676
|
-
return new Promise((resolve
|
|
1677
|
-
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer
|
|
1657
|
+
return new Promise((resolve, reject) => {
|
|
1658
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
|
1678
1659
|
if (err) return reject(err);
|
|
1679
|
-
resolve
|
|
1660
|
+
resolve({
|
|
1680
1661
|
bytesRead,
|
|
1681
|
-
buffer
|
|
1662
|
+
buffer
|
|
1682
1663
|
});
|
|
1683
1664
|
});
|
|
1684
1665
|
});
|
|
1685
1666
|
};
|
|
1686
1667
|
exports.write = function(fd, buffer, ...args) {
|
|
1687
1668
|
if (typeof args[args.length - 1] === "function") return fs.write(fd, buffer, ...args);
|
|
1688
|
-
return new Promise((resolve
|
|
1689
|
-
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer
|
|
1669
|
+
return new Promise((resolve, reject) => {
|
|
1670
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
|
1690
1671
|
if (err) return reject(err);
|
|
1691
|
-
resolve
|
|
1672
|
+
resolve({
|
|
1692
1673
|
bytesWritten,
|
|
1693
|
-
buffer
|
|
1674
|
+
buffer
|
|
1694
1675
|
});
|
|
1695
1676
|
});
|
|
1696
1677
|
});
|
|
1697
1678
|
};
|
|
1698
1679
|
exports.readv = function(fd, buffers, ...args) {
|
|
1699
1680
|
if (typeof args[args.length - 1] === "function") return fs.readv(fd, buffers, ...args);
|
|
1700
|
-
return new Promise((resolve
|
|
1701
|
-
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers
|
|
1681
|
+
return new Promise((resolve, reject) => {
|
|
1682
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
|
|
1702
1683
|
if (err) return reject(err);
|
|
1703
|
-
resolve
|
|
1684
|
+
resolve({
|
|
1704
1685
|
bytesRead,
|
|
1705
|
-
buffers
|
|
1686
|
+
buffers
|
|
1706
1687
|
});
|
|
1707
1688
|
});
|
|
1708
1689
|
});
|
|
1709
1690
|
};
|
|
1710
1691
|
exports.writev = function(fd, buffers, ...args) {
|
|
1711
1692
|
if (typeof args[args.length - 1] === "function") return fs.writev(fd, buffers, ...args);
|
|
1712
|
-
return new Promise((resolve
|
|
1713
|
-
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers
|
|
1693
|
+
return new Promise((resolve, reject) => {
|
|
1694
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
|
1714
1695
|
if (err) return reject(err);
|
|
1715
|
-
resolve
|
|
1696
|
+
resolve({
|
|
1716
1697
|
bytesWritten,
|
|
1717
|
-
buffers
|
|
1698
|
+
buffers
|
|
1718
1699
|
});
|
|
1719
1700
|
});
|
|
1720
1701
|
});
|
|
@@ -1788,8 +1769,8 @@ var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1788
1769
|
var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1789
1770
|
const u = require_universalify().fromPromise;
|
|
1790
1771
|
const fs = require_fs();
|
|
1791
|
-
function pathExists(path
|
|
1792
|
-
return fs.access(path
|
|
1772
|
+
function pathExists(path) {
|
|
1773
|
+
return fs.access(path).then(() => true).catch(() => false);
|
|
1793
1774
|
}
|
|
1794
1775
|
module.exports = {
|
|
1795
1776
|
pathExists: u(pathExists),
|
|
@@ -1802,8 +1783,8 @@ var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1802
1783
|
var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1803
1784
|
const fs = require_fs();
|
|
1804
1785
|
const u = require_universalify().fromPromise;
|
|
1805
|
-
async function utimesMillis(path
|
|
1806
|
-
const fd = await fs.open(path
|
|
1786
|
+
async function utimesMillis(path, atime, mtime) {
|
|
1787
|
+
const fd = await fs.open(path, "r+");
|
|
1807
1788
|
let closeErr = null;
|
|
1808
1789
|
try {
|
|
1809
1790
|
await fs.futimes(fd, atime, mtime);
|
|
@@ -1816,8 +1797,8 @@ var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1816
1797
|
}
|
|
1817
1798
|
if (closeErr) throw closeErr;
|
|
1818
1799
|
}
|
|
1819
|
-
function utimesMillisSync(path
|
|
1820
|
-
const fd = fs.openSync(path
|
|
1800
|
+
function utimesMillisSync(path, atime, mtime) {
|
|
1801
|
+
const fd = fs.openSync(path, "r+");
|
|
1821
1802
|
fs.futimesSync(fd, atime, mtime);
|
|
1822
1803
|
return fs.closeSync(fd);
|
|
1823
1804
|
}
|
|
@@ -2031,8 +2012,8 @@ var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2031
2012
|
const srcItem = path$10.join(src, item.name);
|
|
2032
2013
|
const destItem = path$10.join(dest, item.name);
|
|
2033
2014
|
if (await runFilter(srcItem, destItem, opts)) {
|
|
2034
|
-
const { destStat
|
|
2035
|
-
await getStatsAndPerformCopy(destStat
|
|
2015
|
+
const { destStat } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
2016
|
+
await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
|
|
2036
2017
|
}
|
|
2037
2018
|
});
|
|
2038
2019
|
if (!destStat) await fs.chmod(dest, srcStat.mode);
|
|
@@ -2188,14 +2169,14 @@ var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2188
2169
|
var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2189
2170
|
const fs = require_graceful_fs();
|
|
2190
2171
|
const u = require_universalify().fromCallback;
|
|
2191
|
-
function remove(path
|
|
2192
|
-
fs.rm(path
|
|
2172
|
+
function remove(path, callback) {
|
|
2173
|
+
fs.rm(path, {
|
|
2193
2174
|
recursive: true,
|
|
2194
2175
|
force: true
|
|
2195
2176
|
}, callback);
|
|
2196
2177
|
}
|
|
2197
|
-
function removeSync(path
|
|
2198
|
-
fs.rmSync(path
|
|
2178
|
+
function removeSync(path) {
|
|
2179
|
+
fs.rmSync(path, {
|
|
2199
2180
|
recursive: true,
|
|
2200
2181
|
force: true
|
|
2201
2182
|
});
|
|
@@ -2214,7 +2195,7 @@ var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2214
2195
|
const path$8 = __require("path");
|
|
2215
2196
|
const mkdir = require_mkdirs();
|
|
2216
2197
|
const remove = require_remove();
|
|
2217
|
-
const emptyDir = u(async function emptyDir
|
|
2198
|
+
const emptyDir = u(async function emptyDir(dir) {
|
|
2218
2199
|
let items;
|
|
2219
2200
|
try {
|
|
2220
2201
|
items = await fs.readdir(dir);
|
|
@@ -2556,9 +2537,9 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2556
2537
|
const { stringify, stripBom } = require_utils();
|
|
2557
2538
|
async function _readFile(file, options = {}) {
|
|
2558
2539
|
if (typeof options === "string") options = { encoding: options };
|
|
2559
|
-
const fs
|
|
2540
|
+
const fs = options.fs || _fs;
|
|
2560
2541
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2561
|
-
let data = await universalify.fromCallback(fs
|
|
2542
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options);
|
|
2562
2543
|
data = stripBom(data);
|
|
2563
2544
|
let obj;
|
|
2564
2545
|
try {
|
|
@@ -2574,10 +2555,10 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2574
2555
|
const readFile = universalify.fromPromise(_readFile);
|
|
2575
2556
|
function readFileSync(file, options = {}) {
|
|
2576
2557
|
if (typeof options === "string") options = { encoding: options };
|
|
2577
|
-
const fs
|
|
2558
|
+
const fs = options.fs || _fs;
|
|
2578
2559
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2579
2560
|
try {
|
|
2580
|
-
let content = fs
|
|
2561
|
+
let content = fs.readFileSync(file, options);
|
|
2581
2562
|
content = stripBom(content);
|
|
2582
2563
|
return JSON.parse(content, options.reviver);
|
|
2583
2564
|
} catch (err) {
|
|
@@ -2588,15 +2569,15 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2588
2569
|
}
|
|
2589
2570
|
}
|
|
2590
2571
|
async function _writeFile(file, obj, options = {}) {
|
|
2591
|
-
const fs
|
|
2572
|
+
const fs = options.fs || _fs;
|
|
2592
2573
|
const str = stringify(obj, options);
|
|
2593
|
-
await universalify.fromCallback(fs
|
|
2574
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
2594
2575
|
}
|
|
2595
2576
|
const writeFile = universalify.fromPromise(_writeFile);
|
|
2596
2577
|
function writeFileSync(file, obj, options = {}) {
|
|
2597
|
-
const fs
|
|
2578
|
+
const fs = options.fs || _fs;
|
|
2598
2579
|
const str = stringify(obj, options);
|
|
2599
|
-
return fs
|
|
2580
|
+
return fs.writeFileSync(file, str, options);
|
|
2600
2581
|
}
|
|
2601
2582
|
module.exports = {
|
|
2602
2583
|
readFile,
|
|
@@ -3074,5 +3055,5 @@ async function getWorkspaceNames() {
|
|
|
3074
3055
|
const pkg = readPackage(import.meta, "..");
|
|
3075
3056
|
|
|
3076
3057
|
//#endregion
|
|
3077
|
-
export { $, BASE_OPTIONS, CONFIG_NAME, Configstore, LOWEST_NODE_VERSION, addFiles, buildCommand, cached,
|
|
3058
|
+
export { $, BASE_OPTIONS, CONFIG_NAME, Configstore, LOWEST_NODE_VERSION, addFiles, buildCommand, cached, checkFile, clearScreen, clearTerminal, colors, copyFile, createCheckbox, createCommand, createConfirm, createGroup, createGroupMultiSelect, createHelpExample, createInput, createNote, createOptions, createSearch, createSelect, createShowList, createSpinner, createStore, createTaskLog, createTasks, cwdPathname, deleteFile, deleteFiles, dirList, dirname, emptyDir, emptyDirs, exit, fileList, filename, filterDirList, getBrowserApps, getCurrentBranch, getDiffFiles, getGitStatus, getLocalBranches, getPackageDependencies, getWorkspaceDirs, getWorkspaceNames, glob, handleError, has, hasOwn, intro, isArray, isBoolean, isChinese, isDate, isDebug, isEmpty, isEmptyDir, isError, isFormData, isFunction, isMap, isNull, isNumber, isPlainObject, isPromise, isSet, isString, isSymbol, isURLSearchParams, isUndefined, loadConfig, loadEnv, log, logger, openBrowser, openBrowserApp, ora, outro, parseNames, pkg, progress, readFile, readGitignore, readJSON, readPackage, require$1 as require, safeAwait, sleep, stream, writeJSON, x, xASync, zx };
|
|
3078
3059
|
//# sourceMappingURL=index.js.map
|