@nemo-cli/shared 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/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -263
- 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,37 +389,22 @@ 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
|
|
394
|
+
const { timeout, quiet, ...execOptions } = options ?? {};
|
|
395
|
+
const execPromise = x$1(command, args, merge({
|
|
396
|
+
nodeOptions: {
|
|
397
|
+
cwd: process$1.cwd(),
|
|
398
|
+
FORCE_COLOR: "1"
|
|
399
|
+
},
|
|
400
|
+
throwOnError: true
|
|
401
|
+
}, execOptions));
|
|
402
|
+
const result = timeout ? await Promise.race([execPromise, new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error(`Command timeout after ${timeout}ms`)), timeout))]) : await execPromise;
|
|
420
403
|
if (result.exitCode) {
|
|
421
|
-
!
|
|
422
|
-
|
|
404
|
+
if (!quiet) {
|
|
405
|
+
log.show(`Failed to execute command ${command}. Command exited with code ${result.exitCode}.`, { type: "error" });
|
|
406
|
+
log.show(result.stderr, { type: "error" });
|
|
407
|
+
}
|
|
423
408
|
return [new Error(result.stderr), null];
|
|
424
409
|
}
|
|
425
410
|
return [null, result];
|
|
@@ -441,9 +426,9 @@ const cached = (fn) => {
|
|
|
441
426
|
};
|
|
442
427
|
};
|
|
443
428
|
const sleep = (millisecond, controller) => {
|
|
444
|
-
return new Promise((resolve
|
|
429
|
+
return new Promise((resolve, reject) => {
|
|
445
430
|
controller?.signal.addEventListener("abort", reject);
|
|
446
|
-
setTimeout(resolve
|
|
431
|
+
setTimeout(resolve, millisecond);
|
|
447
432
|
});
|
|
448
433
|
};
|
|
449
434
|
|
|
@@ -552,8 +537,8 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
552
537
|
function supportsAnsi() {
|
|
553
538
|
return process.stdout.isTTY;
|
|
554
539
|
}
|
|
555
|
-
function dim(text
|
|
556
|
-
return supportsAnsi() ? `\x1b[2m${text
|
|
540
|
+
function dim(text) {
|
|
541
|
+
return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text;
|
|
557
542
|
}
|
|
558
543
|
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
559
544
|
function parse(src) {
|
|
@@ -686,11 +671,11 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
686
671
|
}
|
|
687
672
|
let lastError;
|
|
688
673
|
const parsedAll = {};
|
|
689
|
-
for (const path
|
|
690
|
-
const parsed = DotenvModule.parse(fs$2.readFileSync(path
|
|
674
|
+
for (const path of optionPaths) try {
|
|
675
|
+
const parsed = DotenvModule.parse(fs$2.readFileSync(path, { encoding }));
|
|
691
676
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
692
677
|
} catch (e) {
|
|
693
|
-
if (debug) _debug(`Failed to load ${path
|
|
678
|
+
if (debug) _debug(`Failed to load ${path} ${e.message}`);
|
|
694
679
|
lastError = e;
|
|
695
680
|
}
|
|
696
681
|
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
@@ -802,7 +787,14 @@ const loadEnv = (importMeta, ...paths) => {
|
|
|
802
787
|
});
|
|
803
788
|
return;
|
|
804
789
|
}
|
|
805
|
-
|
|
790
|
+
const examplePath = providedPath + ".example";
|
|
791
|
+
if (existsSync(examplePath)) {
|
|
792
|
+
(0, import_main.config)({
|
|
793
|
+
path: examplePath,
|
|
794
|
+
quiet: true
|
|
795
|
+
});
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
806
798
|
};
|
|
807
799
|
const createStore = (name, options) => {
|
|
808
800
|
if (!options.path) throw Error("Store subpath is necessary!");
|
|
@@ -819,7 +811,7 @@ const isDebug = () => process.argv.includes("-d") || process.argv.includes("--de
|
|
|
819
811
|
//#endregion
|
|
820
812
|
//#region src/utils/format.ts
|
|
821
813
|
const CHINESE_STRING_REGEXP = /[\u4e00-\u9fa5]/;
|
|
822
|
-
const isChinese = (text
|
|
814
|
+
const isChinese = (text) => CHINESE_STRING_REGEXP.test(text);
|
|
823
815
|
|
|
824
816
|
//#endregion
|
|
825
817
|
//#region src/utils/git-handle/index.ts
|
|
@@ -878,8 +870,8 @@ var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
878
870
|
exports.fromCallback = function(fn) {
|
|
879
871
|
return Object.defineProperty(function(...args) {
|
|
880
872
|
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
|
|
873
|
+
else return new Promise((resolve, reject) => {
|
|
874
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
883
875
|
fn.apply(this, args);
|
|
884
876
|
});
|
|
885
877
|
}, "name", { value: fn.name });
|
|
@@ -919,47 +911,47 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
919
911
|
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
920
912
|
}
|
|
921
913
|
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
|
|
914
|
+
function patch(fs) {
|
|
915
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
|
|
916
|
+
if (!fs.lutimes) patchLutimes(fs);
|
|
917
|
+
fs.chown = chownFix(fs.chown);
|
|
918
|
+
fs.fchown = chownFix(fs.fchown);
|
|
919
|
+
fs.lchown = chownFix(fs.lchown);
|
|
920
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
921
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
922
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
923
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
924
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
925
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
926
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
927
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
928
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
929
|
+
fs.stat = statFix(fs.stat);
|
|
930
|
+
fs.fstat = statFix(fs.fstat);
|
|
931
|
+
fs.lstat = statFix(fs.lstat);
|
|
932
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
933
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
934
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
935
|
+
if (fs.chmod && !fs.lchmod) {
|
|
936
|
+
fs.lchmod = function(path, mode, cb) {
|
|
945
937
|
if (cb) process.nextTick(cb);
|
|
946
938
|
};
|
|
947
|
-
fs
|
|
939
|
+
fs.lchmodSync = function() {};
|
|
948
940
|
}
|
|
949
|
-
if (fs
|
|
950
|
-
fs
|
|
941
|
+
if (fs.chown && !fs.lchown) {
|
|
942
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
951
943
|
if (cb) process.nextTick(cb);
|
|
952
944
|
};
|
|
953
|
-
fs
|
|
945
|
+
fs.lchownSync = function() {};
|
|
954
946
|
}
|
|
955
|
-
if (platform === "win32") fs
|
|
947
|
+
if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
956
948
|
function rename(from, to, cb) {
|
|
957
949
|
var start = Date.now();
|
|
958
950
|
var backoff = 0;
|
|
959
951
|
fs$rename(from, to, function CB(er) {
|
|
960
952
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
961
953
|
setTimeout(function() {
|
|
962
|
-
fs
|
|
954
|
+
fs.stat(to, function(stater, st) {
|
|
963
955
|
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
964
956
|
else cb(er);
|
|
965
957
|
});
|
|
@@ -972,8 +964,8 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
972
964
|
}
|
|
973
965
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
974
966
|
return rename;
|
|
975
|
-
})(fs
|
|
976
|
-
fs
|
|
967
|
+
})(fs.rename);
|
|
968
|
+
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
977
969
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
978
970
|
var callback;
|
|
979
971
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -981,21 +973,21 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
981
973
|
callback = function(er, _, __) {
|
|
982
974
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
983
975
|
eagCounter++;
|
|
984
|
-
return fs$read.call(fs
|
|
976
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
985
977
|
}
|
|
986
978
|
callback_.apply(this, arguments);
|
|
987
979
|
};
|
|
988
980
|
}
|
|
989
|
-
return fs$read.call(fs
|
|
981
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
990
982
|
}
|
|
991
983
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
992
984
|
return read;
|
|
993
|
-
})(fs
|
|
994
|
-
fs
|
|
985
|
+
})(fs.read);
|
|
986
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
|
|
995
987
|
return function(fd, buffer, offset, length, position) {
|
|
996
988
|
var eagCounter = 0;
|
|
997
989
|
while (true) try {
|
|
998
|
-
return fs$readSync.call(fs
|
|
990
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
999
991
|
} catch (er) {
|
|
1000
992
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
1001
993
|
eagCounter++;
|
|
@@ -1004,78 +996,78 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1004
996
|
throw er;
|
|
1005
997
|
}
|
|
1006
998
|
};
|
|
1007
|
-
})(fs
|
|
1008
|
-
function patchLchmod(fs
|
|
1009
|
-
fs
|
|
1010
|
-
fs
|
|
999
|
+
})(fs.readSync);
|
|
1000
|
+
function patchLchmod(fs) {
|
|
1001
|
+
fs.lchmod = function(path, mode, callback) {
|
|
1002
|
+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
1011
1003
|
if (err) {
|
|
1012
1004
|
if (callback) callback(err);
|
|
1013
1005
|
return;
|
|
1014
1006
|
}
|
|
1015
|
-
fs
|
|
1016
|
-
fs
|
|
1017
|
-
if (callback) callback(err
|
|
1007
|
+
fs.fchmod(fd, mode, function(err) {
|
|
1008
|
+
fs.close(fd, function(err2) {
|
|
1009
|
+
if (callback) callback(err || err2);
|
|
1018
1010
|
});
|
|
1019
1011
|
});
|
|
1020
1012
|
});
|
|
1021
1013
|
};
|
|
1022
|
-
fs
|
|
1023
|
-
var fd = fs
|
|
1014
|
+
fs.lchmodSync = function(path, mode) {
|
|
1015
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
1024
1016
|
var threw = true;
|
|
1025
1017
|
var ret;
|
|
1026
1018
|
try {
|
|
1027
|
-
ret = fs
|
|
1019
|
+
ret = fs.fchmodSync(fd, mode);
|
|
1028
1020
|
threw = false;
|
|
1029
1021
|
} finally {
|
|
1030
1022
|
if (threw) try {
|
|
1031
|
-
fs
|
|
1023
|
+
fs.closeSync(fd);
|
|
1032
1024
|
} catch (er) {}
|
|
1033
|
-
else fs
|
|
1025
|
+
else fs.closeSync(fd);
|
|
1034
1026
|
}
|
|
1035
1027
|
return ret;
|
|
1036
1028
|
};
|
|
1037
1029
|
}
|
|
1038
|
-
function patchLutimes(fs
|
|
1039
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs
|
|
1040
|
-
fs
|
|
1041
|
-
fs
|
|
1030
|
+
function patchLutimes(fs) {
|
|
1031
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
1032
|
+
fs.lutimes = function(path, at, mt, cb) {
|
|
1033
|
+
fs.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
1042
1034
|
if (er) {
|
|
1043
1035
|
if (cb) cb(er);
|
|
1044
1036
|
return;
|
|
1045
1037
|
}
|
|
1046
|
-
fs
|
|
1047
|
-
fs
|
|
1048
|
-
if (cb) cb(er
|
|
1038
|
+
fs.futimes(fd, at, mt, function(er) {
|
|
1039
|
+
fs.close(fd, function(er2) {
|
|
1040
|
+
if (cb) cb(er || er2);
|
|
1049
1041
|
});
|
|
1050
1042
|
});
|
|
1051
1043
|
});
|
|
1052
1044
|
};
|
|
1053
|
-
fs
|
|
1054
|
-
var fd = fs
|
|
1045
|
+
fs.lutimesSync = function(path, at, mt) {
|
|
1046
|
+
var fd = fs.openSync(path, constants.O_SYMLINK);
|
|
1055
1047
|
var ret;
|
|
1056
1048
|
var threw = true;
|
|
1057
1049
|
try {
|
|
1058
|
-
ret = fs
|
|
1050
|
+
ret = fs.futimesSync(fd, at, mt);
|
|
1059
1051
|
threw = false;
|
|
1060
1052
|
} finally {
|
|
1061
1053
|
if (threw) try {
|
|
1062
|
-
fs
|
|
1054
|
+
fs.closeSync(fd);
|
|
1063
1055
|
} catch (er) {}
|
|
1064
|
-
else fs
|
|
1056
|
+
else fs.closeSync(fd);
|
|
1065
1057
|
}
|
|
1066
1058
|
return ret;
|
|
1067
1059
|
};
|
|
1068
|
-
} else if (fs
|
|
1069
|
-
fs
|
|
1060
|
+
} else if (fs.futimes) {
|
|
1061
|
+
fs.lutimes = function(_a, _b, _c, cb) {
|
|
1070
1062
|
if (cb) process.nextTick(cb);
|
|
1071
1063
|
};
|
|
1072
|
-
fs
|
|
1064
|
+
fs.lutimesSync = function() {};
|
|
1073
1065
|
}
|
|
1074
1066
|
}
|
|
1075
1067
|
function chmodFix(orig) {
|
|
1076
1068
|
if (!orig) return orig;
|
|
1077
1069
|
return function(target, mode, cb) {
|
|
1078
|
-
return orig.call(fs
|
|
1070
|
+
return orig.call(fs, target, mode, function(er) {
|
|
1079
1071
|
if (chownErOk(er)) er = null;
|
|
1080
1072
|
if (cb) cb.apply(this, arguments);
|
|
1081
1073
|
});
|
|
@@ -1085,7 +1077,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1085
1077
|
if (!orig) return orig;
|
|
1086
1078
|
return function(target, mode) {
|
|
1087
1079
|
try {
|
|
1088
|
-
return orig.call(fs
|
|
1080
|
+
return orig.call(fs, target, mode);
|
|
1089
1081
|
} catch (er) {
|
|
1090
1082
|
if (!chownErOk(er)) throw er;
|
|
1091
1083
|
}
|
|
@@ -1094,7 +1086,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1094
1086
|
function chownFix(orig) {
|
|
1095
1087
|
if (!orig) return orig;
|
|
1096
1088
|
return function(target, uid, gid, cb) {
|
|
1097
|
-
return orig.call(fs
|
|
1089
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
1098
1090
|
if (chownErOk(er)) er = null;
|
|
1099
1091
|
if (cb) cb.apply(this, arguments);
|
|
1100
1092
|
});
|
|
@@ -1104,7 +1096,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1104
1096
|
if (!orig) return orig;
|
|
1105
1097
|
return function(target, uid, gid) {
|
|
1106
1098
|
try {
|
|
1107
|
-
return orig.call(fs
|
|
1099
|
+
return orig.call(fs, target, uid, gid);
|
|
1108
1100
|
} catch (er) {
|
|
1109
1101
|
if (!chownErOk(er)) throw er;
|
|
1110
1102
|
}
|
|
@@ -1124,13 +1116,13 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1124
1116
|
}
|
|
1125
1117
|
if (cb) cb.apply(this, arguments);
|
|
1126
1118
|
}
|
|
1127
|
-
return options ? orig.call(fs
|
|
1119
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
1128
1120
|
};
|
|
1129
1121
|
}
|
|
1130
1122
|
function statFixSync(orig) {
|
|
1131
1123
|
if (!orig) return orig;
|
|
1132
1124
|
return function(target, options) {
|
|
1133
|
-
var stats = options ? orig.call(fs
|
|
1125
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
1134
1126
|
if (stats) {
|
|
1135
1127
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
1136
1128
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -1154,16 +1146,16 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1154
1146
|
var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1155
1147
|
var Stream = __require("stream").Stream;
|
|
1156
1148
|
module.exports = legacy;
|
|
1157
|
-
function legacy(fs
|
|
1149
|
+
function legacy(fs) {
|
|
1158
1150
|
return {
|
|
1159
1151
|
ReadStream,
|
|
1160
1152
|
WriteStream
|
|
1161
1153
|
};
|
|
1162
|
-
function ReadStream(path
|
|
1163
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path
|
|
1154
|
+
function ReadStream(path, options) {
|
|
1155
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
1164
1156
|
Stream.call(this);
|
|
1165
1157
|
var self = this;
|
|
1166
|
-
this.path = path
|
|
1158
|
+
this.path = path;
|
|
1167
1159
|
this.fd = null;
|
|
1168
1160
|
this.readable = true;
|
|
1169
1161
|
this.paused = false;
|
|
@@ -1190,7 +1182,7 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1190
1182
|
});
|
|
1191
1183
|
return;
|
|
1192
1184
|
}
|
|
1193
|
-
fs
|
|
1185
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
1194
1186
|
if (err) {
|
|
1195
1187
|
self.emit("error", err);
|
|
1196
1188
|
self.readable = false;
|
|
@@ -1201,10 +1193,10 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1201
1193
|
self._read();
|
|
1202
1194
|
});
|
|
1203
1195
|
}
|
|
1204
|
-
function WriteStream(path
|
|
1205
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path
|
|
1196
|
+
function WriteStream(path, options) {
|
|
1197
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
1206
1198
|
Stream.call(this);
|
|
1207
|
-
this.path = path
|
|
1199
|
+
this.path = path;
|
|
1208
1200
|
this.fd = null;
|
|
1209
1201
|
this.writable = true;
|
|
1210
1202
|
this.flags = "w";
|
|
@@ -1225,7 +1217,7 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1225
1217
|
this.busy = false;
|
|
1226
1218
|
this._queue = [];
|
|
1227
1219
|
if (this.fd === null) {
|
|
1228
|
-
this._open = fs
|
|
1220
|
+
this._open = fs.open;
|
|
1229
1221
|
this._queue.push([
|
|
1230
1222
|
this._open,
|
|
1231
1223
|
this.path,
|
|
@@ -1248,12 +1240,12 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1248
1240
|
};
|
|
1249
1241
|
function clone(obj) {
|
|
1250
1242
|
if (obj === null || typeof obj !== "object") return obj;
|
|
1251
|
-
if (obj instanceof Object) var copy
|
|
1252
|
-
else var copy
|
|
1243
|
+
if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
|
|
1244
|
+
else var copy = Object.create(null);
|
|
1253
1245
|
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
1254
|
-
Object.defineProperty(copy
|
|
1246
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
1255
1247
|
});
|
|
1256
|
-
return copy
|
|
1248
|
+
return copy;
|
|
1257
1249
|
}
|
|
1258
1250
|
}));
|
|
1259
1251
|
|
|
@@ -1320,124 +1312,124 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1320
1312
|
module.exports = patch(fs$1);
|
|
1321
1313
|
fs$1.__patched = true;
|
|
1322
1314
|
}
|
|
1323
|
-
function patch(fs
|
|
1324
|
-
polyfills(fs
|
|
1325
|
-
fs
|
|
1326
|
-
fs
|
|
1327
|
-
fs
|
|
1328
|
-
var fs$readFile = fs
|
|
1329
|
-
fs
|
|
1330
|
-
function readFile
|
|
1315
|
+
function patch(fs) {
|
|
1316
|
+
polyfills(fs);
|
|
1317
|
+
fs.gracefulify = patch;
|
|
1318
|
+
fs.createReadStream = createReadStream;
|
|
1319
|
+
fs.createWriteStream = createWriteStream;
|
|
1320
|
+
var fs$readFile = fs.readFile;
|
|
1321
|
+
fs.readFile = readFile;
|
|
1322
|
+
function readFile(path, options, cb) {
|
|
1331
1323
|
if (typeof options === "function") cb = options, options = null;
|
|
1332
|
-
return go$readFile(path
|
|
1333
|
-
function go$readFile(path
|
|
1334
|
-
return fs$readFile(path
|
|
1324
|
+
return go$readFile(path, options, cb);
|
|
1325
|
+
function go$readFile(path, options, cb, startTime) {
|
|
1326
|
+
return fs$readFile(path, options, function(err) {
|
|
1335
1327
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1336
1328
|
go$readFile,
|
|
1337
1329
|
[
|
|
1338
|
-
path
|
|
1339
|
-
options
|
|
1340
|
-
cb
|
|
1330
|
+
path,
|
|
1331
|
+
options,
|
|
1332
|
+
cb
|
|
1341
1333
|
],
|
|
1342
1334
|
err,
|
|
1343
1335
|
startTime || Date.now(),
|
|
1344
1336
|
Date.now()
|
|
1345
1337
|
]);
|
|
1346
|
-
else if (typeof cb
|
|
1338
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1347
1339
|
});
|
|
1348
1340
|
}
|
|
1349
1341
|
}
|
|
1350
|
-
var fs$writeFile = fs
|
|
1351
|
-
fs
|
|
1352
|
-
function writeFile(path
|
|
1342
|
+
var fs$writeFile = fs.writeFile;
|
|
1343
|
+
fs.writeFile = writeFile;
|
|
1344
|
+
function writeFile(path, data, options, cb) {
|
|
1353
1345
|
if (typeof options === "function") cb = options, options = null;
|
|
1354
|
-
return go$writeFile(path
|
|
1355
|
-
function go$writeFile(path
|
|
1356
|
-
return fs$writeFile(path
|
|
1346
|
+
return go$writeFile(path, data, options, cb);
|
|
1347
|
+
function go$writeFile(path, data, options, cb, startTime) {
|
|
1348
|
+
return fs$writeFile(path, data, options, function(err) {
|
|
1357
1349
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1358
1350
|
go$writeFile,
|
|
1359
1351
|
[
|
|
1360
|
-
path
|
|
1361
|
-
data
|
|
1362
|
-
options
|
|
1363
|
-
cb
|
|
1352
|
+
path,
|
|
1353
|
+
data,
|
|
1354
|
+
options,
|
|
1355
|
+
cb
|
|
1364
1356
|
],
|
|
1365
1357
|
err,
|
|
1366
1358
|
startTime || Date.now(),
|
|
1367
1359
|
Date.now()
|
|
1368
1360
|
]);
|
|
1369
|
-
else if (typeof cb
|
|
1361
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1370
1362
|
});
|
|
1371
1363
|
}
|
|
1372
1364
|
}
|
|
1373
|
-
var fs$appendFile = fs
|
|
1374
|
-
if (fs$appendFile) fs
|
|
1375
|
-
function appendFile(path
|
|
1365
|
+
var fs$appendFile = fs.appendFile;
|
|
1366
|
+
if (fs$appendFile) fs.appendFile = appendFile;
|
|
1367
|
+
function appendFile(path, data, options, cb) {
|
|
1376
1368
|
if (typeof options === "function") cb = options, options = null;
|
|
1377
|
-
return go$appendFile(path
|
|
1378
|
-
function go$appendFile(path
|
|
1379
|
-
return fs$appendFile(path
|
|
1369
|
+
return go$appendFile(path, data, options, cb);
|
|
1370
|
+
function go$appendFile(path, data, options, cb, startTime) {
|
|
1371
|
+
return fs$appendFile(path, data, options, function(err) {
|
|
1380
1372
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1381
1373
|
go$appendFile,
|
|
1382
1374
|
[
|
|
1383
|
-
path
|
|
1384
|
-
data
|
|
1385
|
-
options
|
|
1386
|
-
cb
|
|
1375
|
+
path,
|
|
1376
|
+
data,
|
|
1377
|
+
options,
|
|
1378
|
+
cb
|
|
1387
1379
|
],
|
|
1388
1380
|
err,
|
|
1389
1381
|
startTime || Date.now(),
|
|
1390
1382
|
Date.now()
|
|
1391
1383
|
]);
|
|
1392
|
-
else if (typeof cb
|
|
1384
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1393
1385
|
});
|
|
1394
1386
|
}
|
|
1395
1387
|
}
|
|
1396
|
-
var fs$copyFile = fs
|
|
1397
|
-
if (fs$copyFile) fs
|
|
1398
|
-
function copyFile
|
|
1388
|
+
var fs$copyFile = fs.copyFile;
|
|
1389
|
+
if (fs$copyFile) fs.copyFile = copyFile;
|
|
1390
|
+
function copyFile(src, dest, flags, cb) {
|
|
1399
1391
|
if (typeof flags === "function") {
|
|
1400
1392
|
cb = flags;
|
|
1401
1393
|
flags = 0;
|
|
1402
1394
|
}
|
|
1403
1395
|
return go$copyFile(src, dest, flags, cb);
|
|
1404
|
-
function go$copyFile(src
|
|
1405
|
-
return fs$copyFile(src
|
|
1396
|
+
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
1397
|
+
return fs$copyFile(src, dest, flags, function(err) {
|
|
1406
1398
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1407
1399
|
go$copyFile,
|
|
1408
1400
|
[
|
|
1409
|
-
src
|
|
1410
|
-
dest
|
|
1411
|
-
flags
|
|
1412
|
-
cb
|
|
1401
|
+
src,
|
|
1402
|
+
dest,
|
|
1403
|
+
flags,
|
|
1404
|
+
cb
|
|
1413
1405
|
],
|
|
1414
1406
|
err,
|
|
1415
1407
|
startTime || Date.now(),
|
|
1416
1408
|
Date.now()
|
|
1417
1409
|
]);
|
|
1418
|
-
else if (typeof cb
|
|
1410
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1419
1411
|
});
|
|
1420
1412
|
}
|
|
1421
1413
|
}
|
|
1422
|
-
var fs$readdir = fs
|
|
1423
|
-
fs
|
|
1414
|
+
var fs$readdir = fs.readdir;
|
|
1415
|
+
fs.readdir = readdir;
|
|
1424
1416
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1425
|
-
function readdir(path
|
|
1417
|
+
function readdir(path, options, cb) {
|
|
1426
1418
|
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
|
|
1419
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
1420
|
+
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
1421
|
+
} : function go$readdir(path, options, cb, startTime) {
|
|
1422
|
+
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
1431
1423
|
};
|
|
1432
|
-
return go$readdir(path
|
|
1433
|
-
function fs$readdirCallback(path
|
|
1424
|
+
return go$readdir(path, options, cb);
|
|
1425
|
+
function fs$readdirCallback(path, options, cb, startTime) {
|
|
1434
1426
|
return function(err, files) {
|
|
1435
1427
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1436
1428
|
go$readdir,
|
|
1437
1429
|
[
|
|
1438
|
-
path
|
|
1439
|
-
options
|
|
1440
|
-
cb
|
|
1430
|
+
path,
|
|
1431
|
+
options,
|
|
1432
|
+
cb
|
|
1441
1433
|
],
|
|
1442
1434
|
err,
|
|
1443
1435
|
startTime || Date.now(),
|
|
@@ -1445,27 +1437,27 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1445
1437
|
]);
|
|
1446
1438
|
else {
|
|
1447
1439
|
if (files && files.sort) files.sort();
|
|
1448
|
-
if (typeof cb
|
|
1440
|
+
if (typeof cb === "function") cb.call(this, err, files);
|
|
1449
1441
|
}
|
|
1450
1442
|
};
|
|
1451
1443
|
}
|
|
1452
1444
|
}
|
|
1453
1445
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
1454
|
-
var legStreams = legacy(fs
|
|
1446
|
+
var legStreams = legacy(fs);
|
|
1455
1447
|
ReadStream = legStreams.ReadStream;
|
|
1456
1448
|
WriteStream = legStreams.WriteStream;
|
|
1457
1449
|
}
|
|
1458
|
-
var fs$ReadStream = fs
|
|
1450
|
+
var fs$ReadStream = fs.ReadStream;
|
|
1459
1451
|
if (fs$ReadStream) {
|
|
1460
1452
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
1461
1453
|
ReadStream.prototype.open = ReadStream$open;
|
|
1462
1454
|
}
|
|
1463
|
-
var fs$WriteStream = fs
|
|
1455
|
+
var fs$WriteStream = fs.WriteStream;
|
|
1464
1456
|
if (fs$WriteStream) {
|
|
1465
1457
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
1466
1458
|
WriteStream.prototype.open = WriteStream$open;
|
|
1467
1459
|
}
|
|
1468
|
-
Object.defineProperty(fs
|
|
1460
|
+
Object.defineProperty(fs, "ReadStream", {
|
|
1469
1461
|
get: function() {
|
|
1470
1462
|
return ReadStream;
|
|
1471
1463
|
},
|
|
@@ -1475,7 +1467,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1475
1467
|
enumerable: true,
|
|
1476
1468
|
configurable: true
|
|
1477
1469
|
});
|
|
1478
|
-
Object.defineProperty(fs
|
|
1470
|
+
Object.defineProperty(fs, "WriteStream", {
|
|
1479
1471
|
get: function() {
|
|
1480
1472
|
return WriteStream;
|
|
1481
1473
|
},
|
|
@@ -1486,7 +1478,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1486
1478
|
configurable: true
|
|
1487
1479
|
});
|
|
1488
1480
|
var FileReadStream = ReadStream;
|
|
1489
|
-
Object.defineProperty(fs
|
|
1481
|
+
Object.defineProperty(fs, "FileReadStream", {
|
|
1490
1482
|
get: function() {
|
|
1491
1483
|
return FileReadStream;
|
|
1492
1484
|
},
|
|
@@ -1497,7 +1489,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1497
1489
|
configurable: true
|
|
1498
1490
|
});
|
|
1499
1491
|
var FileWriteStream = WriteStream;
|
|
1500
|
-
Object.defineProperty(fs
|
|
1492
|
+
Object.defineProperty(fs, "FileWriteStream", {
|
|
1501
1493
|
get: function() {
|
|
1502
1494
|
return FileWriteStream;
|
|
1503
1495
|
},
|
|
@@ -1507,13 +1499,13 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1507
1499
|
enumerable: true,
|
|
1508
1500
|
configurable: true
|
|
1509
1501
|
});
|
|
1510
|
-
function ReadStream(path
|
|
1502
|
+
function ReadStream(path, options) {
|
|
1511
1503
|
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
1512
1504
|
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
1513
1505
|
}
|
|
1514
1506
|
function ReadStream$open() {
|
|
1515
1507
|
var that = this;
|
|
1516
|
-
open
|
|
1508
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
1517
1509
|
if (err) {
|
|
1518
1510
|
if (that.autoClose) that.destroy();
|
|
1519
1511
|
that.emit("error", err);
|
|
@@ -1524,13 +1516,13 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1524
1516
|
}
|
|
1525
1517
|
});
|
|
1526
1518
|
}
|
|
1527
|
-
function WriteStream(path
|
|
1519
|
+
function WriteStream(path, options) {
|
|
1528
1520
|
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
1529
1521
|
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
1530
1522
|
}
|
|
1531
1523
|
function WriteStream$open() {
|
|
1532
1524
|
var that = this;
|
|
1533
|
-
open
|
|
1525
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
1534
1526
|
if (err) {
|
|
1535
1527
|
that.destroy();
|
|
1536
1528
|
that.emit("error", err);
|
|
@@ -1540,36 +1532,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1540
1532
|
}
|
|
1541
1533
|
});
|
|
1542
1534
|
}
|
|
1543
|
-
function createReadStream(path
|
|
1544
|
-
return new fs
|
|
1535
|
+
function createReadStream(path, options) {
|
|
1536
|
+
return new fs.ReadStream(path, options);
|
|
1545
1537
|
}
|
|
1546
|
-
function createWriteStream(path
|
|
1547
|
-
return new fs
|
|
1538
|
+
function createWriteStream(path, options) {
|
|
1539
|
+
return new fs.WriteStream(path, options);
|
|
1548
1540
|
}
|
|
1549
|
-
var fs$open = fs
|
|
1550
|
-
fs
|
|
1551
|
-
function open
|
|
1541
|
+
var fs$open = fs.open;
|
|
1542
|
+
fs.open = open;
|
|
1543
|
+
function open(path, flags, mode, cb) {
|
|
1552
1544
|
if (typeof mode === "function") cb = mode, mode = null;
|
|
1553
|
-
return go$open(path
|
|
1554
|
-
function go$open(path
|
|
1555
|
-
return fs$open(path
|
|
1545
|
+
return go$open(path, flags, mode, cb);
|
|
1546
|
+
function go$open(path, flags, mode, cb, startTime) {
|
|
1547
|
+
return fs$open(path, flags, mode, function(err, fd) {
|
|
1556
1548
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1557
1549
|
go$open,
|
|
1558
1550
|
[
|
|
1559
|
-
path
|
|
1560
|
-
flags
|
|
1561
|
-
mode
|
|
1562
|
-
cb
|
|
1551
|
+
path,
|
|
1552
|
+
flags,
|
|
1553
|
+
mode,
|
|
1554
|
+
cb
|
|
1563
1555
|
],
|
|
1564
1556
|
err,
|
|
1565
1557
|
startTime || Date.now(),
|
|
1566
1558
|
Date.now()
|
|
1567
1559
|
]);
|
|
1568
|
-
else if (typeof cb
|
|
1560
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
1569
1561
|
});
|
|
1570
1562
|
}
|
|
1571
1563
|
}
|
|
1572
|
-
return fs
|
|
1564
|
+
return fs;
|
|
1573
1565
|
}
|
|
1574
1566
|
function enqueue(elem) {
|
|
1575
1567
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
@@ -1665,56 +1657,56 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1665
1657
|
api.forEach((method) => {
|
|
1666
1658
|
exports[method] = u(fs[method]);
|
|
1667
1659
|
});
|
|
1668
|
-
exports.exists = function(filename
|
|
1669
|
-
if (typeof callback === "function") return fs.exists(filename
|
|
1670
|
-
return new Promise((resolve
|
|
1671
|
-
return fs.exists(filename
|
|
1660
|
+
exports.exists = function(filename, callback) {
|
|
1661
|
+
if (typeof callback === "function") return fs.exists(filename, callback);
|
|
1662
|
+
return new Promise((resolve) => {
|
|
1663
|
+
return fs.exists(filename, resolve);
|
|
1672
1664
|
});
|
|
1673
1665
|
};
|
|
1674
1666
|
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
1675
1667
|
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
|
|
1668
|
+
return new Promise((resolve, reject) => {
|
|
1669
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
|
1678
1670
|
if (err) return reject(err);
|
|
1679
|
-
resolve
|
|
1671
|
+
resolve({
|
|
1680
1672
|
bytesRead,
|
|
1681
|
-
buffer
|
|
1673
|
+
buffer
|
|
1682
1674
|
});
|
|
1683
1675
|
});
|
|
1684
1676
|
});
|
|
1685
1677
|
};
|
|
1686
1678
|
exports.write = function(fd, buffer, ...args) {
|
|
1687
1679
|
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
|
|
1680
|
+
return new Promise((resolve, reject) => {
|
|
1681
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
|
1690
1682
|
if (err) return reject(err);
|
|
1691
|
-
resolve
|
|
1683
|
+
resolve({
|
|
1692
1684
|
bytesWritten,
|
|
1693
|
-
buffer
|
|
1685
|
+
buffer
|
|
1694
1686
|
});
|
|
1695
1687
|
});
|
|
1696
1688
|
});
|
|
1697
1689
|
};
|
|
1698
1690
|
exports.readv = function(fd, buffers, ...args) {
|
|
1699
1691
|
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
|
|
1692
|
+
return new Promise((resolve, reject) => {
|
|
1693
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
|
|
1702
1694
|
if (err) return reject(err);
|
|
1703
|
-
resolve
|
|
1695
|
+
resolve({
|
|
1704
1696
|
bytesRead,
|
|
1705
|
-
buffers
|
|
1697
|
+
buffers
|
|
1706
1698
|
});
|
|
1707
1699
|
});
|
|
1708
1700
|
});
|
|
1709
1701
|
};
|
|
1710
1702
|
exports.writev = function(fd, buffers, ...args) {
|
|
1711
1703
|
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
|
|
1704
|
+
return new Promise((resolve, reject) => {
|
|
1705
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
|
1714
1706
|
if (err) return reject(err);
|
|
1715
|
-
resolve
|
|
1707
|
+
resolve({
|
|
1716
1708
|
bytesWritten,
|
|
1717
|
-
buffers
|
|
1709
|
+
buffers
|
|
1718
1710
|
});
|
|
1719
1711
|
});
|
|
1720
1712
|
});
|
|
@@ -1788,8 +1780,8 @@ var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1788
1780
|
var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1789
1781
|
const u = require_universalify().fromPromise;
|
|
1790
1782
|
const fs = require_fs();
|
|
1791
|
-
function pathExists(path
|
|
1792
|
-
return fs.access(path
|
|
1783
|
+
function pathExists(path) {
|
|
1784
|
+
return fs.access(path).then(() => true).catch(() => false);
|
|
1793
1785
|
}
|
|
1794
1786
|
module.exports = {
|
|
1795
1787
|
pathExists: u(pathExists),
|
|
@@ -1802,8 +1794,8 @@ var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1802
1794
|
var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1803
1795
|
const fs = require_fs();
|
|
1804
1796
|
const u = require_universalify().fromPromise;
|
|
1805
|
-
async function utimesMillis(path
|
|
1806
|
-
const fd = await fs.open(path
|
|
1797
|
+
async function utimesMillis(path, atime, mtime) {
|
|
1798
|
+
const fd = await fs.open(path, "r+");
|
|
1807
1799
|
let closeErr = null;
|
|
1808
1800
|
try {
|
|
1809
1801
|
await fs.futimes(fd, atime, mtime);
|
|
@@ -1816,8 +1808,8 @@ var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1816
1808
|
}
|
|
1817
1809
|
if (closeErr) throw closeErr;
|
|
1818
1810
|
}
|
|
1819
|
-
function utimesMillisSync(path
|
|
1820
|
-
const fd = fs.openSync(path
|
|
1811
|
+
function utimesMillisSync(path, atime, mtime) {
|
|
1812
|
+
const fd = fs.openSync(path, "r+");
|
|
1821
1813
|
fs.futimesSync(fd, atime, mtime);
|
|
1822
1814
|
return fs.closeSync(fd);
|
|
1823
1815
|
}
|
|
@@ -2031,8 +2023,8 @@ var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2031
2023
|
const srcItem = path$10.join(src, item.name);
|
|
2032
2024
|
const destItem = path$10.join(dest, item.name);
|
|
2033
2025
|
if (await runFilter(srcItem, destItem, opts)) {
|
|
2034
|
-
const { destStat
|
|
2035
|
-
await getStatsAndPerformCopy(destStat
|
|
2026
|
+
const { destStat } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
2027
|
+
await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
|
|
2036
2028
|
}
|
|
2037
2029
|
});
|
|
2038
2030
|
if (!destStat) await fs.chmod(dest, srcStat.mode);
|
|
@@ -2188,14 +2180,14 @@ var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2188
2180
|
var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2189
2181
|
const fs = require_graceful_fs();
|
|
2190
2182
|
const u = require_universalify().fromCallback;
|
|
2191
|
-
function remove(path
|
|
2192
|
-
fs.rm(path
|
|
2183
|
+
function remove(path, callback) {
|
|
2184
|
+
fs.rm(path, {
|
|
2193
2185
|
recursive: true,
|
|
2194
2186
|
force: true
|
|
2195
2187
|
}, callback);
|
|
2196
2188
|
}
|
|
2197
|
-
function removeSync(path
|
|
2198
|
-
fs.rmSync(path
|
|
2189
|
+
function removeSync(path) {
|
|
2190
|
+
fs.rmSync(path, {
|
|
2199
2191
|
recursive: true,
|
|
2200
2192
|
force: true
|
|
2201
2193
|
});
|
|
@@ -2214,7 +2206,7 @@ var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2214
2206
|
const path$8 = __require("path");
|
|
2215
2207
|
const mkdir = require_mkdirs();
|
|
2216
2208
|
const remove = require_remove();
|
|
2217
|
-
const emptyDir = u(async function emptyDir
|
|
2209
|
+
const emptyDir = u(async function emptyDir(dir) {
|
|
2218
2210
|
let items;
|
|
2219
2211
|
try {
|
|
2220
2212
|
items = await fs.readdir(dir);
|
|
@@ -2556,9 +2548,9 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2556
2548
|
const { stringify, stripBom } = require_utils();
|
|
2557
2549
|
async function _readFile(file, options = {}) {
|
|
2558
2550
|
if (typeof options === "string") options = { encoding: options };
|
|
2559
|
-
const fs
|
|
2551
|
+
const fs = options.fs || _fs;
|
|
2560
2552
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2561
|
-
let data = await universalify.fromCallback(fs
|
|
2553
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options);
|
|
2562
2554
|
data = stripBom(data);
|
|
2563
2555
|
let obj;
|
|
2564
2556
|
try {
|
|
@@ -2574,10 +2566,10 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2574
2566
|
const readFile = universalify.fromPromise(_readFile);
|
|
2575
2567
|
function readFileSync(file, options = {}) {
|
|
2576
2568
|
if (typeof options === "string") options = { encoding: options };
|
|
2577
|
-
const fs
|
|
2569
|
+
const fs = options.fs || _fs;
|
|
2578
2570
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2579
2571
|
try {
|
|
2580
|
-
let content = fs
|
|
2572
|
+
let content = fs.readFileSync(file, options);
|
|
2581
2573
|
content = stripBom(content);
|
|
2582
2574
|
return JSON.parse(content, options.reviver);
|
|
2583
2575
|
} catch (err) {
|
|
@@ -2588,15 +2580,15 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2588
2580
|
}
|
|
2589
2581
|
}
|
|
2590
2582
|
async function _writeFile(file, obj, options = {}) {
|
|
2591
|
-
const fs
|
|
2583
|
+
const fs = options.fs || _fs;
|
|
2592
2584
|
const str = stringify(obj, options);
|
|
2593
|
-
await universalify.fromCallback(fs
|
|
2585
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
2594
2586
|
}
|
|
2595
2587
|
const writeFile = universalify.fromPromise(_writeFile);
|
|
2596
2588
|
function writeFileSync(file, obj, options = {}) {
|
|
2597
|
-
const fs
|
|
2589
|
+
const fs = options.fs || _fs;
|
|
2598
2590
|
const str = stringify(obj, options);
|
|
2599
|
-
return fs
|
|
2591
|
+
return fs.writeFileSync(file, str, options);
|
|
2600
2592
|
}
|
|
2601
2593
|
module.exports = {
|
|
2602
2594
|
readFile,
|
|
@@ -3074,5 +3066,5 @@ async function getWorkspaceNames() {
|
|
|
3074
3066
|
const pkg = readPackage(import.meta, "..");
|
|
3075
3067
|
|
|
3076
3068
|
//#endregion
|
|
3077
|
-
export { $, BASE_OPTIONS, CONFIG_NAME, Configstore, LOWEST_NODE_VERSION, addFiles, buildCommand, cached,
|
|
3069
|
+
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
3070
|
//# sourceMappingURL=index.js.map
|