routesync 1.0.2 → 1.0.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/cli.js +744 -771
- package/dist/core.d.mts +12 -1
- package/dist/core.d.ts +12 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10,16 +10,9 @@ var __typeError = (msg) => {
|
|
|
10
10
|
throw TypeError(msg);
|
|
11
11
|
};
|
|
12
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
-
};
|
|
16
13
|
var __commonJS = (cb, mod) => function __require() {
|
|
17
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
15
|
};
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all)
|
|
21
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
-
};
|
|
23
16
|
var __copyProps = (to, from, except, desc) => {
|
|
24
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
18
|
for (let key of __getOwnPropNames(from))
|
|
@@ -36,7 +29,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
29
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
37
30
|
mod
|
|
38
31
|
));
|
|
39
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
32
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
41
33
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
42
34
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -991,8 +983,8 @@ var require_command = __commonJS({
|
|
|
991
983
|
"use strict";
|
|
992
984
|
var EventEmitter = require("events").EventEmitter;
|
|
993
985
|
var childProcess = require("child_process");
|
|
994
|
-
var
|
|
995
|
-
var
|
|
986
|
+
var path11 = require("path");
|
|
987
|
+
var fs15 = require("fs");
|
|
996
988
|
var process10 = require("process");
|
|
997
989
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
998
990
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1924,11 +1916,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1924
1916
|
let launchWithNode = false;
|
|
1925
1917
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1926
1918
|
function findFile(baseDir, baseName) {
|
|
1927
|
-
const localBin =
|
|
1928
|
-
if (
|
|
1929
|
-
if (sourceExt.includes(
|
|
1919
|
+
const localBin = path11.resolve(baseDir, baseName);
|
|
1920
|
+
if (fs15.existsSync(localBin)) return localBin;
|
|
1921
|
+
if (sourceExt.includes(path11.extname(baseName))) return void 0;
|
|
1930
1922
|
const foundExt = sourceExt.find(
|
|
1931
|
-
(ext) =>
|
|
1923
|
+
(ext) => fs15.existsSync(`${localBin}${ext}`)
|
|
1932
1924
|
);
|
|
1933
1925
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1934
1926
|
return void 0;
|
|
@@ -1940,21 +1932,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1940
1932
|
if (this._scriptPath) {
|
|
1941
1933
|
let resolvedScriptPath;
|
|
1942
1934
|
try {
|
|
1943
|
-
resolvedScriptPath =
|
|
1935
|
+
resolvedScriptPath = fs15.realpathSync(this._scriptPath);
|
|
1944
1936
|
} catch (err) {
|
|
1945
1937
|
resolvedScriptPath = this._scriptPath;
|
|
1946
1938
|
}
|
|
1947
|
-
executableDir =
|
|
1948
|
-
|
|
1939
|
+
executableDir = path11.resolve(
|
|
1940
|
+
path11.dirname(resolvedScriptPath),
|
|
1949
1941
|
executableDir
|
|
1950
1942
|
);
|
|
1951
1943
|
}
|
|
1952
1944
|
if (executableDir) {
|
|
1953
1945
|
let localFile = findFile(executableDir, executableFile);
|
|
1954
1946
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1955
|
-
const legacyName =
|
|
1947
|
+
const legacyName = path11.basename(
|
|
1956
1948
|
this._scriptPath,
|
|
1957
|
-
|
|
1949
|
+
path11.extname(this._scriptPath)
|
|
1958
1950
|
);
|
|
1959
1951
|
if (legacyName !== this._name) {
|
|
1960
1952
|
localFile = findFile(
|
|
@@ -1965,7 +1957,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1965
1957
|
}
|
|
1966
1958
|
executableFile = localFile || executableFile;
|
|
1967
1959
|
}
|
|
1968
|
-
launchWithNode = sourceExt.includes(
|
|
1960
|
+
launchWithNode = sourceExt.includes(path11.extname(executableFile));
|
|
1969
1961
|
let proc;
|
|
1970
1962
|
if (process10.platform !== "win32") {
|
|
1971
1963
|
if (launchWithNode) {
|
|
@@ -2805,7 +2797,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2805
2797
|
* @return {Command}
|
|
2806
2798
|
*/
|
|
2807
2799
|
nameFromFilename(filename) {
|
|
2808
|
-
this._name =
|
|
2800
|
+
this._name = path11.basename(filename, path11.extname(filename));
|
|
2809
2801
|
return this;
|
|
2810
2802
|
}
|
|
2811
2803
|
/**
|
|
@@ -2819,9 +2811,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2819
2811
|
* @param {string} [path]
|
|
2820
2812
|
* @return {(string|null|Command)}
|
|
2821
2813
|
*/
|
|
2822
|
-
executableDir(
|
|
2823
|
-
if (
|
|
2824
|
-
this._executableDir =
|
|
2814
|
+
executableDir(path12) {
|
|
2815
|
+
if (path12 === void 0) return this._executableDir;
|
|
2816
|
+
this._executableDir = path12;
|
|
2825
2817
|
return this;
|
|
2826
2818
|
}
|
|
2827
2819
|
/**
|
|
@@ -4752,54 +4744,54 @@ var require_polyfills = __commonJS({
|
|
|
4752
4744
|
}
|
|
4753
4745
|
var chdir;
|
|
4754
4746
|
module2.exports = patch;
|
|
4755
|
-
function patch(
|
|
4747
|
+
function patch(fs15) {
|
|
4756
4748
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
4757
|
-
patchLchmod(
|
|
4758
|
-
}
|
|
4759
|
-
if (!
|
|
4760
|
-
patchLutimes(
|
|
4761
|
-
}
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
if (
|
|
4781
|
-
|
|
4749
|
+
patchLchmod(fs15);
|
|
4750
|
+
}
|
|
4751
|
+
if (!fs15.lutimes) {
|
|
4752
|
+
patchLutimes(fs15);
|
|
4753
|
+
}
|
|
4754
|
+
fs15.chown = chownFix(fs15.chown);
|
|
4755
|
+
fs15.fchown = chownFix(fs15.fchown);
|
|
4756
|
+
fs15.lchown = chownFix(fs15.lchown);
|
|
4757
|
+
fs15.chmod = chmodFix(fs15.chmod);
|
|
4758
|
+
fs15.fchmod = chmodFix(fs15.fchmod);
|
|
4759
|
+
fs15.lchmod = chmodFix(fs15.lchmod);
|
|
4760
|
+
fs15.chownSync = chownFixSync(fs15.chownSync);
|
|
4761
|
+
fs15.fchownSync = chownFixSync(fs15.fchownSync);
|
|
4762
|
+
fs15.lchownSync = chownFixSync(fs15.lchownSync);
|
|
4763
|
+
fs15.chmodSync = chmodFixSync(fs15.chmodSync);
|
|
4764
|
+
fs15.fchmodSync = chmodFixSync(fs15.fchmodSync);
|
|
4765
|
+
fs15.lchmodSync = chmodFixSync(fs15.lchmodSync);
|
|
4766
|
+
fs15.stat = statFix(fs15.stat);
|
|
4767
|
+
fs15.fstat = statFix(fs15.fstat);
|
|
4768
|
+
fs15.lstat = statFix(fs15.lstat);
|
|
4769
|
+
fs15.statSync = statFixSync(fs15.statSync);
|
|
4770
|
+
fs15.fstatSync = statFixSync(fs15.fstatSync);
|
|
4771
|
+
fs15.lstatSync = statFixSync(fs15.lstatSync);
|
|
4772
|
+
if (fs15.chmod && !fs15.lchmod) {
|
|
4773
|
+
fs15.lchmod = function(path11, mode, cb) {
|
|
4782
4774
|
if (cb) process.nextTick(cb);
|
|
4783
4775
|
};
|
|
4784
|
-
|
|
4776
|
+
fs15.lchmodSync = function() {
|
|
4785
4777
|
};
|
|
4786
4778
|
}
|
|
4787
|
-
if (
|
|
4788
|
-
|
|
4779
|
+
if (fs15.chown && !fs15.lchown) {
|
|
4780
|
+
fs15.lchown = function(path11, uid, gid, cb) {
|
|
4789
4781
|
if (cb) process.nextTick(cb);
|
|
4790
4782
|
};
|
|
4791
|
-
|
|
4783
|
+
fs15.lchownSync = function() {
|
|
4792
4784
|
};
|
|
4793
4785
|
}
|
|
4794
4786
|
if (platform === "win32") {
|
|
4795
|
-
|
|
4787
|
+
fs15.rename = typeof fs15.rename !== "function" ? fs15.rename : (function(fs$rename) {
|
|
4796
4788
|
function rename(from, to, cb) {
|
|
4797
4789
|
var start = Date.now();
|
|
4798
4790
|
var backoff = 0;
|
|
4799
4791
|
fs$rename(from, to, function CB(er) {
|
|
4800
4792
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
4801
4793
|
setTimeout(function() {
|
|
4802
|
-
|
|
4794
|
+
fs15.stat(to, function(stater, st) {
|
|
4803
4795
|
if (stater && stater.code === "ENOENT")
|
|
4804
4796
|
fs$rename(from, to, CB);
|
|
4805
4797
|
else
|
|
@@ -4815,9 +4807,9 @@ var require_polyfills = __commonJS({
|
|
|
4815
4807
|
}
|
|
4816
4808
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
4817
4809
|
return rename;
|
|
4818
|
-
})(
|
|
4810
|
+
})(fs15.rename);
|
|
4819
4811
|
}
|
|
4820
|
-
|
|
4812
|
+
fs15.read = typeof fs15.read !== "function" ? fs15.read : (function(fs$read) {
|
|
4821
4813
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
4822
4814
|
var callback;
|
|
4823
4815
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -4825,22 +4817,22 @@ var require_polyfills = __commonJS({
|
|
|
4825
4817
|
callback = function(er, _, __) {
|
|
4826
4818
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
4827
4819
|
eagCounter++;
|
|
4828
|
-
return fs$read.call(
|
|
4820
|
+
return fs$read.call(fs15, fd, buffer, offset, length, position, callback);
|
|
4829
4821
|
}
|
|
4830
4822
|
callback_.apply(this, arguments);
|
|
4831
4823
|
};
|
|
4832
4824
|
}
|
|
4833
|
-
return fs$read.call(
|
|
4825
|
+
return fs$read.call(fs15, fd, buffer, offset, length, position, callback);
|
|
4834
4826
|
}
|
|
4835
4827
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
4836
4828
|
return read;
|
|
4837
|
-
})(
|
|
4838
|
-
|
|
4829
|
+
})(fs15.read);
|
|
4830
|
+
fs15.readSync = typeof fs15.readSync !== "function" ? fs15.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
4839
4831
|
return function(fd, buffer, offset, length, position) {
|
|
4840
4832
|
var eagCounter = 0;
|
|
4841
4833
|
while (true) {
|
|
4842
4834
|
try {
|
|
4843
|
-
return fs$readSync.call(
|
|
4835
|
+
return fs$readSync.call(fs15, fd, buffer, offset, length, position);
|
|
4844
4836
|
} catch (er) {
|
|
4845
4837
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
4846
4838
|
eagCounter++;
|
|
@@ -4850,11 +4842,11 @@ var require_polyfills = __commonJS({
|
|
|
4850
4842
|
}
|
|
4851
4843
|
}
|
|
4852
4844
|
};
|
|
4853
|
-
})(
|
|
4854
|
-
function patchLchmod(
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4845
|
+
})(fs15.readSync);
|
|
4846
|
+
function patchLchmod(fs16) {
|
|
4847
|
+
fs16.lchmod = function(path11, mode, callback) {
|
|
4848
|
+
fs16.open(
|
|
4849
|
+
path11,
|
|
4858
4850
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
4859
4851
|
mode,
|
|
4860
4852
|
function(err, fd) {
|
|
@@ -4862,80 +4854,80 @@ var require_polyfills = __commonJS({
|
|
|
4862
4854
|
if (callback) callback(err);
|
|
4863
4855
|
return;
|
|
4864
4856
|
}
|
|
4865
|
-
|
|
4866
|
-
|
|
4857
|
+
fs16.fchmod(fd, mode, function(err2) {
|
|
4858
|
+
fs16.close(fd, function(err22) {
|
|
4867
4859
|
if (callback) callback(err2 || err22);
|
|
4868
4860
|
});
|
|
4869
4861
|
});
|
|
4870
4862
|
}
|
|
4871
4863
|
);
|
|
4872
4864
|
};
|
|
4873
|
-
|
|
4874
|
-
var fd =
|
|
4865
|
+
fs16.lchmodSync = function(path11, mode) {
|
|
4866
|
+
var fd = fs16.openSync(path11, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
4875
4867
|
var threw = true;
|
|
4876
4868
|
var ret;
|
|
4877
4869
|
try {
|
|
4878
|
-
ret =
|
|
4870
|
+
ret = fs16.fchmodSync(fd, mode);
|
|
4879
4871
|
threw = false;
|
|
4880
4872
|
} finally {
|
|
4881
4873
|
if (threw) {
|
|
4882
4874
|
try {
|
|
4883
|
-
|
|
4875
|
+
fs16.closeSync(fd);
|
|
4884
4876
|
} catch (er) {
|
|
4885
4877
|
}
|
|
4886
4878
|
} else {
|
|
4887
|
-
|
|
4879
|
+
fs16.closeSync(fd);
|
|
4888
4880
|
}
|
|
4889
4881
|
}
|
|
4890
4882
|
return ret;
|
|
4891
4883
|
};
|
|
4892
4884
|
}
|
|
4893
|
-
function patchLutimes(
|
|
4894
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
4895
|
-
|
|
4896
|
-
|
|
4885
|
+
function patchLutimes(fs16) {
|
|
4886
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs16.futimes) {
|
|
4887
|
+
fs16.lutimes = function(path11, at, mt, cb) {
|
|
4888
|
+
fs16.open(path11, constants.O_SYMLINK, function(er, fd) {
|
|
4897
4889
|
if (er) {
|
|
4898
4890
|
if (cb) cb(er);
|
|
4899
4891
|
return;
|
|
4900
4892
|
}
|
|
4901
|
-
|
|
4902
|
-
|
|
4893
|
+
fs16.futimes(fd, at, mt, function(er2) {
|
|
4894
|
+
fs16.close(fd, function(er22) {
|
|
4903
4895
|
if (cb) cb(er2 || er22);
|
|
4904
4896
|
});
|
|
4905
4897
|
});
|
|
4906
4898
|
});
|
|
4907
4899
|
};
|
|
4908
|
-
|
|
4909
|
-
var fd =
|
|
4900
|
+
fs16.lutimesSync = function(path11, at, mt) {
|
|
4901
|
+
var fd = fs16.openSync(path11, constants.O_SYMLINK);
|
|
4910
4902
|
var ret;
|
|
4911
4903
|
var threw = true;
|
|
4912
4904
|
try {
|
|
4913
|
-
ret =
|
|
4905
|
+
ret = fs16.futimesSync(fd, at, mt);
|
|
4914
4906
|
threw = false;
|
|
4915
4907
|
} finally {
|
|
4916
4908
|
if (threw) {
|
|
4917
4909
|
try {
|
|
4918
|
-
|
|
4910
|
+
fs16.closeSync(fd);
|
|
4919
4911
|
} catch (er) {
|
|
4920
4912
|
}
|
|
4921
4913
|
} else {
|
|
4922
|
-
|
|
4914
|
+
fs16.closeSync(fd);
|
|
4923
4915
|
}
|
|
4924
4916
|
}
|
|
4925
4917
|
return ret;
|
|
4926
4918
|
};
|
|
4927
|
-
} else if (
|
|
4928
|
-
|
|
4919
|
+
} else if (fs16.futimes) {
|
|
4920
|
+
fs16.lutimes = function(_a, _b, _c, cb) {
|
|
4929
4921
|
if (cb) process.nextTick(cb);
|
|
4930
4922
|
};
|
|
4931
|
-
|
|
4923
|
+
fs16.lutimesSync = function() {
|
|
4932
4924
|
};
|
|
4933
4925
|
}
|
|
4934
4926
|
}
|
|
4935
4927
|
function chmodFix(orig) {
|
|
4936
4928
|
if (!orig) return orig;
|
|
4937
4929
|
return function(target, mode, cb) {
|
|
4938
|
-
return orig.call(
|
|
4930
|
+
return orig.call(fs15, target, mode, function(er) {
|
|
4939
4931
|
if (chownErOk(er)) er = null;
|
|
4940
4932
|
if (cb) cb.apply(this, arguments);
|
|
4941
4933
|
});
|
|
@@ -4945,7 +4937,7 @@ var require_polyfills = __commonJS({
|
|
|
4945
4937
|
if (!orig) return orig;
|
|
4946
4938
|
return function(target, mode) {
|
|
4947
4939
|
try {
|
|
4948
|
-
return orig.call(
|
|
4940
|
+
return orig.call(fs15, target, mode);
|
|
4949
4941
|
} catch (er) {
|
|
4950
4942
|
if (!chownErOk(er)) throw er;
|
|
4951
4943
|
}
|
|
@@ -4954,7 +4946,7 @@ var require_polyfills = __commonJS({
|
|
|
4954
4946
|
function chownFix(orig) {
|
|
4955
4947
|
if (!orig) return orig;
|
|
4956
4948
|
return function(target, uid, gid, cb) {
|
|
4957
|
-
return orig.call(
|
|
4949
|
+
return orig.call(fs15, target, uid, gid, function(er) {
|
|
4958
4950
|
if (chownErOk(er)) er = null;
|
|
4959
4951
|
if (cb) cb.apply(this, arguments);
|
|
4960
4952
|
});
|
|
@@ -4964,7 +4956,7 @@ var require_polyfills = __commonJS({
|
|
|
4964
4956
|
if (!orig) return orig;
|
|
4965
4957
|
return function(target, uid, gid) {
|
|
4966
4958
|
try {
|
|
4967
|
-
return orig.call(
|
|
4959
|
+
return orig.call(fs15, target, uid, gid);
|
|
4968
4960
|
} catch (er) {
|
|
4969
4961
|
if (!chownErOk(er)) throw er;
|
|
4970
4962
|
}
|
|
@@ -4984,13 +4976,13 @@ var require_polyfills = __commonJS({
|
|
|
4984
4976
|
}
|
|
4985
4977
|
if (cb) cb.apply(this, arguments);
|
|
4986
4978
|
}
|
|
4987
|
-
return options ? orig.call(
|
|
4979
|
+
return options ? orig.call(fs15, target, options, callback) : orig.call(fs15, target, callback);
|
|
4988
4980
|
};
|
|
4989
4981
|
}
|
|
4990
4982
|
function statFixSync(orig) {
|
|
4991
4983
|
if (!orig) return orig;
|
|
4992
4984
|
return function(target, options) {
|
|
4993
|
-
var stats = options ? orig.call(
|
|
4985
|
+
var stats = options ? orig.call(fs15, target, options) : orig.call(fs15, target);
|
|
4994
4986
|
if (stats) {
|
|
4995
4987
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
4996
4988
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -5020,16 +5012,16 @@ var require_legacy_streams = __commonJS({
|
|
|
5020
5012
|
"use strict";
|
|
5021
5013
|
var Stream = require("stream").Stream;
|
|
5022
5014
|
module2.exports = legacy;
|
|
5023
|
-
function legacy(
|
|
5015
|
+
function legacy(fs15) {
|
|
5024
5016
|
return {
|
|
5025
5017
|
ReadStream,
|
|
5026
5018
|
WriteStream
|
|
5027
5019
|
};
|
|
5028
|
-
function ReadStream(
|
|
5029
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
5020
|
+
function ReadStream(path11, options) {
|
|
5021
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path11, options);
|
|
5030
5022
|
Stream.call(this);
|
|
5031
5023
|
var self = this;
|
|
5032
|
-
this.path =
|
|
5024
|
+
this.path = path11;
|
|
5033
5025
|
this.fd = null;
|
|
5034
5026
|
this.readable = true;
|
|
5035
5027
|
this.paused = false;
|
|
@@ -5063,7 +5055,7 @@ var require_legacy_streams = __commonJS({
|
|
|
5063
5055
|
});
|
|
5064
5056
|
return;
|
|
5065
5057
|
}
|
|
5066
|
-
|
|
5058
|
+
fs15.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
5067
5059
|
if (err) {
|
|
5068
5060
|
self.emit("error", err);
|
|
5069
5061
|
self.readable = false;
|
|
@@ -5074,10 +5066,10 @@ var require_legacy_streams = __commonJS({
|
|
|
5074
5066
|
self._read();
|
|
5075
5067
|
});
|
|
5076
5068
|
}
|
|
5077
|
-
function WriteStream(
|
|
5078
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
5069
|
+
function WriteStream(path11, options) {
|
|
5070
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path11, options);
|
|
5079
5071
|
Stream.call(this);
|
|
5080
|
-
this.path =
|
|
5072
|
+
this.path = path11;
|
|
5081
5073
|
this.fd = null;
|
|
5082
5074
|
this.writable = true;
|
|
5083
5075
|
this.flags = "w";
|
|
@@ -5102,7 +5094,7 @@ var require_legacy_streams = __commonJS({
|
|
|
5102
5094
|
this.busy = false;
|
|
5103
5095
|
this._queue = [];
|
|
5104
5096
|
if (this.fd === null) {
|
|
5105
|
-
this._open =
|
|
5097
|
+
this._open = fs15.open;
|
|
5106
5098
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
5107
5099
|
this.flush();
|
|
5108
5100
|
}
|
|
@@ -5138,7 +5130,7 @@ var require_clone = __commonJS({
|
|
|
5138
5130
|
var require_graceful_fs = __commonJS({
|
|
5139
5131
|
"node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
|
|
5140
5132
|
"use strict";
|
|
5141
|
-
var
|
|
5133
|
+
var fs15 = require("fs");
|
|
5142
5134
|
var polyfills = require_polyfills();
|
|
5143
5135
|
var legacy = require_legacy_streams();
|
|
5144
5136
|
var clone = require_clone();
|
|
@@ -5170,12 +5162,12 @@ var require_graceful_fs = __commonJS({
|
|
|
5170
5162
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
5171
5163
|
console.error(m);
|
|
5172
5164
|
};
|
|
5173
|
-
if (!
|
|
5165
|
+
if (!fs15[gracefulQueue]) {
|
|
5174
5166
|
queue = global[gracefulQueue] || [];
|
|
5175
|
-
publishQueue(
|
|
5176
|
-
|
|
5167
|
+
publishQueue(fs15, queue);
|
|
5168
|
+
fs15.close = (function(fs$close) {
|
|
5177
5169
|
function close(fd, cb) {
|
|
5178
|
-
return fs$close.call(
|
|
5170
|
+
return fs$close.call(fs15, fd, function(err) {
|
|
5179
5171
|
if (!err) {
|
|
5180
5172
|
resetQueue();
|
|
5181
5173
|
}
|
|
@@ -5187,48 +5179,48 @@ var require_graceful_fs = __commonJS({
|
|
|
5187
5179
|
value: fs$close
|
|
5188
5180
|
});
|
|
5189
5181
|
return close;
|
|
5190
|
-
})(
|
|
5191
|
-
|
|
5182
|
+
})(fs15.close);
|
|
5183
|
+
fs15.closeSync = (function(fs$closeSync) {
|
|
5192
5184
|
function closeSync(fd) {
|
|
5193
|
-
fs$closeSync.apply(
|
|
5185
|
+
fs$closeSync.apply(fs15, arguments);
|
|
5194
5186
|
resetQueue();
|
|
5195
5187
|
}
|
|
5196
5188
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
5197
5189
|
value: fs$closeSync
|
|
5198
5190
|
});
|
|
5199
5191
|
return closeSync;
|
|
5200
|
-
})(
|
|
5192
|
+
})(fs15.closeSync);
|
|
5201
5193
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
5202
5194
|
process.on("exit", function() {
|
|
5203
|
-
debug(
|
|
5204
|
-
require("assert").equal(
|
|
5195
|
+
debug(fs15[gracefulQueue]);
|
|
5196
|
+
require("assert").equal(fs15[gracefulQueue].length, 0);
|
|
5205
5197
|
});
|
|
5206
5198
|
}
|
|
5207
5199
|
}
|
|
5208
5200
|
var queue;
|
|
5209
5201
|
if (!global[gracefulQueue]) {
|
|
5210
|
-
publishQueue(global,
|
|
5211
|
-
}
|
|
5212
|
-
module2.exports = patch(clone(
|
|
5213
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
5214
|
-
module2.exports = patch(
|
|
5215
|
-
|
|
5216
|
-
}
|
|
5217
|
-
function patch(
|
|
5218
|
-
polyfills(
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
var fs$readFile =
|
|
5223
|
-
|
|
5224
|
-
function readFile(
|
|
5202
|
+
publishQueue(global, fs15[gracefulQueue]);
|
|
5203
|
+
}
|
|
5204
|
+
module2.exports = patch(clone(fs15));
|
|
5205
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs15.__patched) {
|
|
5206
|
+
module2.exports = patch(fs15);
|
|
5207
|
+
fs15.__patched = true;
|
|
5208
|
+
}
|
|
5209
|
+
function patch(fs16) {
|
|
5210
|
+
polyfills(fs16);
|
|
5211
|
+
fs16.gracefulify = patch;
|
|
5212
|
+
fs16.createReadStream = createReadStream;
|
|
5213
|
+
fs16.createWriteStream = createWriteStream;
|
|
5214
|
+
var fs$readFile = fs16.readFile;
|
|
5215
|
+
fs16.readFile = readFile;
|
|
5216
|
+
function readFile(path11, options, cb) {
|
|
5225
5217
|
if (typeof options === "function")
|
|
5226
5218
|
cb = options, options = null;
|
|
5227
|
-
return go$readFile(
|
|
5228
|
-
function go$readFile(
|
|
5229
|
-
return fs$readFile(
|
|
5219
|
+
return go$readFile(path11, options, cb);
|
|
5220
|
+
function go$readFile(path12, options2, cb2, startTime) {
|
|
5221
|
+
return fs$readFile(path12, options2, function(err) {
|
|
5230
5222
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5231
|
-
enqueue([go$readFile, [
|
|
5223
|
+
enqueue([go$readFile, [path12, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5232
5224
|
else {
|
|
5233
5225
|
if (typeof cb2 === "function")
|
|
5234
5226
|
cb2.apply(this, arguments);
|
|
@@ -5236,16 +5228,16 @@ var require_graceful_fs = __commonJS({
|
|
|
5236
5228
|
});
|
|
5237
5229
|
}
|
|
5238
5230
|
}
|
|
5239
|
-
var fs$writeFile =
|
|
5240
|
-
|
|
5241
|
-
function writeFile(
|
|
5231
|
+
var fs$writeFile = fs16.writeFile;
|
|
5232
|
+
fs16.writeFile = writeFile;
|
|
5233
|
+
function writeFile(path11, data, options, cb) {
|
|
5242
5234
|
if (typeof options === "function")
|
|
5243
5235
|
cb = options, options = null;
|
|
5244
|
-
return go$writeFile(
|
|
5245
|
-
function go$writeFile(
|
|
5246
|
-
return fs$writeFile(
|
|
5236
|
+
return go$writeFile(path11, data, options, cb);
|
|
5237
|
+
function go$writeFile(path12, data2, options2, cb2, startTime) {
|
|
5238
|
+
return fs$writeFile(path12, data2, options2, function(err) {
|
|
5247
5239
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5248
|
-
enqueue([go$writeFile, [
|
|
5240
|
+
enqueue([go$writeFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5249
5241
|
else {
|
|
5250
5242
|
if (typeof cb2 === "function")
|
|
5251
5243
|
cb2.apply(this, arguments);
|
|
@@ -5253,17 +5245,17 @@ var require_graceful_fs = __commonJS({
|
|
|
5253
5245
|
});
|
|
5254
5246
|
}
|
|
5255
5247
|
}
|
|
5256
|
-
var fs$appendFile =
|
|
5248
|
+
var fs$appendFile = fs16.appendFile;
|
|
5257
5249
|
if (fs$appendFile)
|
|
5258
|
-
|
|
5259
|
-
function appendFile(
|
|
5250
|
+
fs16.appendFile = appendFile;
|
|
5251
|
+
function appendFile(path11, data, options, cb) {
|
|
5260
5252
|
if (typeof options === "function")
|
|
5261
5253
|
cb = options, options = null;
|
|
5262
|
-
return go$appendFile(
|
|
5263
|
-
function go$appendFile(
|
|
5264
|
-
return fs$appendFile(
|
|
5254
|
+
return go$appendFile(path11, data, options, cb);
|
|
5255
|
+
function go$appendFile(path12, data2, options2, cb2, startTime) {
|
|
5256
|
+
return fs$appendFile(path12, data2, options2, function(err) {
|
|
5265
5257
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5266
|
-
enqueue([go$appendFile, [
|
|
5258
|
+
enqueue([go$appendFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5267
5259
|
else {
|
|
5268
5260
|
if (typeof cb2 === "function")
|
|
5269
5261
|
cb2.apply(this, arguments);
|
|
@@ -5271,9 +5263,9 @@ var require_graceful_fs = __commonJS({
|
|
|
5271
5263
|
});
|
|
5272
5264
|
}
|
|
5273
5265
|
}
|
|
5274
|
-
var fs$copyFile =
|
|
5266
|
+
var fs$copyFile = fs16.copyFile;
|
|
5275
5267
|
if (fs$copyFile)
|
|
5276
|
-
|
|
5268
|
+
fs16.copyFile = copyFile;
|
|
5277
5269
|
function copyFile(src, dest, flags, cb) {
|
|
5278
5270
|
if (typeof flags === "function") {
|
|
5279
5271
|
cb = flags;
|
|
@@ -5291,34 +5283,34 @@ var require_graceful_fs = __commonJS({
|
|
|
5291
5283
|
});
|
|
5292
5284
|
}
|
|
5293
5285
|
}
|
|
5294
|
-
var fs$readdir =
|
|
5295
|
-
|
|
5286
|
+
var fs$readdir = fs16.readdir;
|
|
5287
|
+
fs16.readdir = readdir;
|
|
5296
5288
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
5297
|
-
function readdir(
|
|
5289
|
+
function readdir(path11, options, cb) {
|
|
5298
5290
|
if (typeof options === "function")
|
|
5299
5291
|
cb = options, options = null;
|
|
5300
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
5301
|
-
return fs$readdir(
|
|
5302
|
-
|
|
5292
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path12, options2, cb2, startTime) {
|
|
5293
|
+
return fs$readdir(path12, fs$readdirCallback(
|
|
5294
|
+
path12,
|
|
5303
5295
|
options2,
|
|
5304
5296
|
cb2,
|
|
5305
5297
|
startTime
|
|
5306
5298
|
));
|
|
5307
|
-
} : function go$readdir2(
|
|
5308
|
-
return fs$readdir(
|
|
5309
|
-
|
|
5299
|
+
} : function go$readdir2(path12, options2, cb2, startTime) {
|
|
5300
|
+
return fs$readdir(path12, options2, fs$readdirCallback(
|
|
5301
|
+
path12,
|
|
5310
5302
|
options2,
|
|
5311
5303
|
cb2,
|
|
5312
5304
|
startTime
|
|
5313
5305
|
));
|
|
5314
5306
|
};
|
|
5315
|
-
return go$readdir(
|
|
5316
|
-
function fs$readdirCallback(
|
|
5307
|
+
return go$readdir(path11, options, cb);
|
|
5308
|
+
function fs$readdirCallback(path12, options2, cb2, startTime) {
|
|
5317
5309
|
return function(err, files) {
|
|
5318
5310
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5319
5311
|
enqueue([
|
|
5320
5312
|
go$readdir,
|
|
5321
|
-
[
|
|
5313
|
+
[path12, options2, cb2],
|
|
5322
5314
|
err,
|
|
5323
5315
|
startTime || Date.now(),
|
|
5324
5316
|
Date.now()
|
|
@@ -5333,21 +5325,21 @@ var require_graceful_fs = __commonJS({
|
|
|
5333
5325
|
}
|
|
5334
5326
|
}
|
|
5335
5327
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
5336
|
-
var legStreams = legacy(
|
|
5328
|
+
var legStreams = legacy(fs16);
|
|
5337
5329
|
ReadStream = legStreams.ReadStream;
|
|
5338
5330
|
WriteStream = legStreams.WriteStream;
|
|
5339
5331
|
}
|
|
5340
|
-
var fs$ReadStream =
|
|
5332
|
+
var fs$ReadStream = fs16.ReadStream;
|
|
5341
5333
|
if (fs$ReadStream) {
|
|
5342
5334
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
5343
5335
|
ReadStream.prototype.open = ReadStream$open;
|
|
5344
5336
|
}
|
|
5345
|
-
var fs$WriteStream =
|
|
5337
|
+
var fs$WriteStream = fs16.WriteStream;
|
|
5346
5338
|
if (fs$WriteStream) {
|
|
5347
5339
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
5348
5340
|
WriteStream.prototype.open = WriteStream$open;
|
|
5349
5341
|
}
|
|
5350
|
-
Object.defineProperty(
|
|
5342
|
+
Object.defineProperty(fs16, "ReadStream", {
|
|
5351
5343
|
get: function() {
|
|
5352
5344
|
return ReadStream;
|
|
5353
5345
|
},
|
|
@@ -5357,7 +5349,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5357
5349
|
enumerable: true,
|
|
5358
5350
|
configurable: true
|
|
5359
5351
|
});
|
|
5360
|
-
Object.defineProperty(
|
|
5352
|
+
Object.defineProperty(fs16, "WriteStream", {
|
|
5361
5353
|
get: function() {
|
|
5362
5354
|
return WriteStream;
|
|
5363
5355
|
},
|
|
@@ -5368,7 +5360,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5368
5360
|
configurable: true
|
|
5369
5361
|
});
|
|
5370
5362
|
var FileReadStream = ReadStream;
|
|
5371
|
-
Object.defineProperty(
|
|
5363
|
+
Object.defineProperty(fs16, "FileReadStream", {
|
|
5372
5364
|
get: function() {
|
|
5373
5365
|
return FileReadStream;
|
|
5374
5366
|
},
|
|
@@ -5379,7 +5371,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5379
5371
|
configurable: true
|
|
5380
5372
|
});
|
|
5381
5373
|
var FileWriteStream = WriteStream;
|
|
5382
|
-
Object.defineProperty(
|
|
5374
|
+
Object.defineProperty(fs16, "FileWriteStream", {
|
|
5383
5375
|
get: function() {
|
|
5384
5376
|
return FileWriteStream;
|
|
5385
5377
|
},
|
|
@@ -5389,7 +5381,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5389
5381
|
enumerable: true,
|
|
5390
5382
|
configurable: true
|
|
5391
5383
|
});
|
|
5392
|
-
function ReadStream(
|
|
5384
|
+
function ReadStream(path11, options) {
|
|
5393
5385
|
if (this instanceof ReadStream)
|
|
5394
5386
|
return fs$ReadStream.apply(this, arguments), this;
|
|
5395
5387
|
else
|
|
@@ -5409,7 +5401,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5409
5401
|
}
|
|
5410
5402
|
});
|
|
5411
5403
|
}
|
|
5412
|
-
function WriteStream(
|
|
5404
|
+
function WriteStream(path11, options) {
|
|
5413
5405
|
if (this instanceof WriteStream)
|
|
5414
5406
|
return fs$WriteStream.apply(this, arguments), this;
|
|
5415
5407
|
else
|
|
@@ -5427,22 +5419,22 @@ var require_graceful_fs = __commonJS({
|
|
|
5427
5419
|
}
|
|
5428
5420
|
});
|
|
5429
5421
|
}
|
|
5430
|
-
function createReadStream(
|
|
5431
|
-
return new
|
|
5422
|
+
function createReadStream(path11, options) {
|
|
5423
|
+
return new fs16.ReadStream(path11, options);
|
|
5432
5424
|
}
|
|
5433
|
-
function createWriteStream(
|
|
5434
|
-
return new
|
|
5425
|
+
function createWriteStream(path11, options) {
|
|
5426
|
+
return new fs16.WriteStream(path11, options);
|
|
5435
5427
|
}
|
|
5436
|
-
var fs$open =
|
|
5437
|
-
|
|
5438
|
-
function open(
|
|
5428
|
+
var fs$open = fs16.open;
|
|
5429
|
+
fs16.open = open;
|
|
5430
|
+
function open(path11, flags, mode, cb) {
|
|
5439
5431
|
if (typeof mode === "function")
|
|
5440
5432
|
cb = mode, mode = null;
|
|
5441
|
-
return go$open(
|
|
5442
|
-
function go$open(
|
|
5443
|
-
return fs$open(
|
|
5433
|
+
return go$open(path11, flags, mode, cb);
|
|
5434
|
+
function go$open(path12, flags2, mode2, cb2, startTime) {
|
|
5435
|
+
return fs$open(path12, flags2, mode2, function(err, fd) {
|
|
5444
5436
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5445
|
-
enqueue([go$open, [
|
|
5437
|
+
enqueue([go$open, [path12, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5446
5438
|
else {
|
|
5447
5439
|
if (typeof cb2 === "function")
|
|
5448
5440
|
cb2.apply(this, arguments);
|
|
@@ -5450,20 +5442,20 @@ var require_graceful_fs = __commonJS({
|
|
|
5450
5442
|
});
|
|
5451
5443
|
}
|
|
5452
5444
|
}
|
|
5453
|
-
return
|
|
5445
|
+
return fs16;
|
|
5454
5446
|
}
|
|
5455
5447
|
function enqueue(elem) {
|
|
5456
5448
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
5457
|
-
|
|
5449
|
+
fs15[gracefulQueue].push(elem);
|
|
5458
5450
|
retry();
|
|
5459
5451
|
}
|
|
5460
5452
|
var retryTimer;
|
|
5461
5453
|
function resetQueue() {
|
|
5462
5454
|
var now = Date.now();
|
|
5463
|
-
for (var i = 0; i <
|
|
5464
|
-
if (
|
|
5465
|
-
|
|
5466
|
-
|
|
5455
|
+
for (var i = 0; i < fs15[gracefulQueue].length; ++i) {
|
|
5456
|
+
if (fs15[gracefulQueue][i].length > 2) {
|
|
5457
|
+
fs15[gracefulQueue][i][3] = now;
|
|
5458
|
+
fs15[gracefulQueue][i][4] = now;
|
|
5467
5459
|
}
|
|
5468
5460
|
}
|
|
5469
5461
|
retry();
|
|
@@ -5471,9 +5463,9 @@ var require_graceful_fs = __commonJS({
|
|
|
5471
5463
|
function retry() {
|
|
5472
5464
|
clearTimeout(retryTimer);
|
|
5473
5465
|
retryTimer = void 0;
|
|
5474
|
-
if (
|
|
5466
|
+
if (fs15[gracefulQueue].length === 0)
|
|
5475
5467
|
return;
|
|
5476
|
-
var elem =
|
|
5468
|
+
var elem = fs15[gracefulQueue].shift();
|
|
5477
5469
|
var fn = elem[0];
|
|
5478
5470
|
var args = elem[1];
|
|
5479
5471
|
var err = elem[2];
|
|
@@ -5495,7 +5487,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5495
5487
|
debug("RETRY", fn.name, args);
|
|
5496
5488
|
fn.apply(null, args.concat([startTime]));
|
|
5497
5489
|
} else {
|
|
5498
|
-
|
|
5490
|
+
fs15[gracefulQueue].push(elem);
|
|
5499
5491
|
}
|
|
5500
5492
|
}
|
|
5501
5493
|
if (retryTimer === void 0) {
|
|
@@ -5510,7 +5502,7 @@ var require_fs = __commonJS({
|
|
|
5510
5502
|
"node_modules/fs-extra/lib/fs/index.js"(exports2) {
|
|
5511
5503
|
"use strict";
|
|
5512
5504
|
var u = require_universalify().fromCallback;
|
|
5513
|
-
var
|
|
5505
|
+
var fs15 = require_graceful_fs();
|
|
5514
5506
|
var api = [
|
|
5515
5507
|
"access",
|
|
5516
5508
|
"appendFile",
|
|
@@ -5551,26 +5543,26 @@ var require_fs = __commonJS({
|
|
|
5551
5543
|
"utimes",
|
|
5552
5544
|
"writeFile"
|
|
5553
5545
|
].filter((key) => {
|
|
5554
|
-
return typeof
|
|
5546
|
+
return typeof fs15[key] === "function";
|
|
5555
5547
|
});
|
|
5556
|
-
Object.assign(exports2,
|
|
5548
|
+
Object.assign(exports2, fs15);
|
|
5557
5549
|
api.forEach((method) => {
|
|
5558
|
-
exports2[method] = u(
|
|
5550
|
+
exports2[method] = u(fs15[method]);
|
|
5559
5551
|
});
|
|
5560
5552
|
exports2.exists = function(filename, callback) {
|
|
5561
5553
|
if (typeof callback === "function") {
|
|
5562
|
-
return
|
|
5554
|
+
return fs15.exists(filename, callback);
|
|
5563
5555
|
}
|
|
5564
5556
|
return new Promise((resolve) => {
|
|
5565
|
-
return
|
|
5557
|
+
return fs15.exists(filename, resolve);
|
|
5566
5558
|
});
|
|
5567
5559
|
};
|
|
5568
5560
|
exports2.read = function(fd, buffer, offset, length, position, callback) {
|
|
5569
5561
|
if (typeof callback === "function") {
|
|
5570
|
-
return
|
|
5562
|
+
return fs15.read(fd, buffer, offset, length, position, callback);
|
|
5571
5563
|
}
|
|
5572
5564
|
return new Promise((resolve, reject) => {
|
|
5573
|
-
|
|
5565
|
+
fs15.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
5574
5566
|
if (err) return reject(err);
|
|
5575
5567
|
resolve({ bytesRead, buffer: buffer2 });
|
|
5576
5568
|
});
|
|
@@ -5578,10 +5570,10 @@ var require_fs = __commonJS({
|
|
|
5578
5570
|
};
|
|
5579
5571
|
exports2.write = function(fd, buffer, ...args) {
|
|
5580
5572
|
if (typeof args[args.length - 1] === "function") {
|
|
5581
|
-
return
|
|
5573
|
+
return fs15.write(fd, buffer, ...args);
|
|
5582
5574
|
}
|
|
5583
5575
|
return new Promise((resolve, reject) => {
|
|
5584
|
-
|
|
5576
|
+
fs15.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
5585
5577
|
if (err) return reject(err);
|
|
5586
5578
|
resolve({ bytesWritten, buffer: buffer2 });
|
|
5587
5579
|
});
|
|
@@ -5589,10 +5581,10 @@ var require_fs = __commonJS({
|
|
|
5589
5581
|
};
|
|
5590
5582
|
exports2.readv = function(fd, buffers, ...args) {
|
|
5591
5583
|
if (typeof args[args.length - 1] === "function") {
|
|
5592
|
-
return
|
|
5584
|
+
return fs15.readv(fd, buffers, ...args);
|
|
5593
5585
|
}
|
|
5594
5586
|
return new Promise((resolve, reject) => {
|
|
5595
|
-
|
|
5587
|
+
fs15.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
5596
5588
|
if (err) return reject(err);
|
|
5597
5589
|
resolve({ bytesRead, buffers: buffers2 });
|
|
5598
5590
|
});
|
|
@@ -5600,17 +5592,17 @@ var require_fs = __commonJS({
|
|
|
5600
5592
|
};
|
|
5601
5593
|
exports2.writev = function(fd, buffers, ...args) {
|
|
5602
5594
|
if (typeof args[args.length - 1] === "function") {
|
|
5603
|
-
return
|
|
5595
|
+
return fs15.writev(fd, buffers, ...args);
|
|
5604
5596
|
}
|
|
5605
5597
|
return new Promise((resolve, reject) => {
|
|
5606
|
-
|
|
5598
|
+
fs15.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
5607
5599
|
if (err) return reject(err);
|
|
5608
5600
|
resolve({ bytesWritten, buffers: buffers2 });
|
|
5609
5601
|
});
|
|
5610
5602
|
});
|
|
5611
5603
|
};
|
|
5612
|
-
if (typeof
|
|
5613
|
-
exports2.realpath.native = u(
|
|
5604
|
+
if (typeof fs15.realpath.native === "function") {
|
|
5605
|
+
exports2.realpath.native = u(fs15.realpath.native);
|
|
5614
5606
|
} else {
|
|
5615
5607
|
process.emitWarning(
|
|
5616
5608
|
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
@@ -5625,10 +5617,10 @@ var require_fs = __commonJS({
|
|
|
5625
5617
|
var require_utils = __commonJS({
|
|
5626
5618
|
"node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
|
|
5627
5619
|
"use strict";
|
|
5628
|
-
var
|
|
5620
|
+
var path11 = require("path");
|
|
5629
5621
|
module2.exports.checkPath = function checkPath(pth) {
|
|
5630
5622
|
if (process.platform === "win32") {
|
|
5631
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(
|
|
5623
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path11.parse(pth).root, ""));
|
|
5632
5624
|
if (pathHasInvalidWinCharacters) {
|
|
5633
5625
|
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
5634
5626
|
error.code = "EINVAL";
|
|
@@ -5643,7 +5635,7 @@ var require_utils = __commonJS({
|
|
|
5643
5635
|
var require_make_dir = __commonJS({
|
|
5644
5636
|
"node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
|
|
5645
5637
|
"use strict";
|
|
5646
|
-
var
|
|
5638
|
+
var fs15 = require_fs();
|
|
5647
5639
|
var { checkPath } = require_utils();
|
|
5648
5640
|
var getMode = (options) => {
|
|
5649
5641
|
const defaults = { mode: 511 };
|
|
@@ -5652,14 +5644,14 @@ var require_make_dir = __commonJS({
|
|
|
5652
5644
|
};
|
|
5653
5645
|
module2.exports.makeDir = async (dir, options) => {
|
|
5654
5646
|
checkPath(dir);
|
|
5655
|
-
return
|
|
5647
|
+
return fs15.mkdir(dir, {
|
|
5656
5648
|
mode: getMode(options),
|
|
5657
5649
|
recursive: true
|
|
5658
5650
|
});
|
|
5659
5651
|
};
|
|
5660
5652
|
module2.exports.makeDirSync = (dir, options) => {
|
|
5661
5653
|
checkPath(dir);
|
|
5662
|
-
return
|
|
5654
|
+
return fs15.mkdirSync(dir, {
|
|
5663
5655
|
mode: getMode(options),
|
|
5664
5656
|
recursive: true
|
|
5665
5657
|
});
|
|
@@ -5691,13 +5683,13 @@ var require_path_exists = __commonJS({
|
|
|
5691
5683
|
"node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
|
|
5692
5684
|
"use strict";
|
|
5693
5685
|
var u = require_universalify().fromPromise;
|
|
5694
|
-
var
|
|
5695
|
-
function pathExists(
|
|
5696
|
-
return
|
|
5686
|
+
var fs15 = require_fs();
|
|
5687
|
+
function pathExists(path11) {
|
|
5688
|
+
return fs15.access(path11).then(() => true).catch(() => false);
|
|
5697
5689
|
}
|
|
5698
5690
|
module2.exports = {
|
|
5699
5691
|
pathExists: u(pathExists),
|
|
5700
|
-
pathExistsSync:
|
|
5692
|
+
pathExistsSync: fs15.existsSync
|
|
5701
5693
|
};
|
|
5702
5694
|
}
|
|
5703
5695
|
});
|
|
@@ -5706,18 +5698,18 @@ var require_path_exists = __commonJS({
|
|
|
5706
5698
|
var require_utimes = __commonJS({
|
|
5707
5699
|
"node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
|
|
5708
5700
|
"use strict";
|
|
5709
|
-
var
|
|
5701
|
+
var fs15 = require_fs();
|
|
5710
5702
|
var u = require_universalify().fromPromise;
|
|
5711
|
-
async function utimesMillis(
|
|
5712
|
-
const fd = await
|
|
5703
|
+
async function utimesMillis(path11, atime, mtime) {
|
|
5704
|
+
const fd = await fs15.open(path11, "r+");
|
|
5713
5705
|
let error = null;
|
|
5714
5706
|
try {
|
|
5715
|
-
await
|
|
5707
|
+
await fs15.futimes(fd, atime, mtime);
|
|
5716
5708
|
} catch (futimesErr) {
|
|
5717
5709
|
error = futimesErr;
|
|
5718
5710
|
} finally {
|
|
5719
5711
|
try {
|
|
5720
|
-
await
|
|
5712
|
+
await fs15.close(fd);
|
|
5721
5713
|
} catch (closeErr) {
|
|
5722
5714
|
if (!error) error = closeErr;
|
|
5723
5715
|
}
|
|
@@ -5726,16 +5718,16 @@ var require_utimes = __commonJS({
|
|
|
5726
5718
|
throw error;
|
|
5727
5719
|
}
|
|
5728
5720
|
}
|
|
5729
|
-
function utimesMillisSync(
|
|
5730
|
-
const fd =
|
|
5721
|
+
function utimesMillisSync(path11, atime, mtime) {
|
|
5722
|
+
const fd = fs15.openSync(path11, "r+");
|
|
5731
5723
|
let error = null;
|
|
5732
5724
|
try {
|
|
5733
|
-
|
|
5725
|
+
fs15.futimesSync(fd, atime, mtime);
|
|
5734
5726
|
} catch (futimesErr) {
|
|
5735
5727
|
error = futimesErr;
|
|
5736
5728
|
} finally {
|
|
5737
5729
|
try {
|
|
5738
|
-
|
|
5730
|
+
fs15.closeSync(fd);
|
|
5739
5731
|
} catch (closeErr) {
|
|
5740
5732
|
if (!error) error = closeErr;
|
|
5741
5733
|
}
|
|
@@ -5755,11 +5747,11 @@ var require_utimes = __commonJS({
|
|
|
5755
5747
|
var require_stat = __commonJS({
|
|
5756
5748
|
"node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
|
|
5757
5749
|
"use strict";
|
|
5758
|
-
var
|
|
5759
|
-
var
|
|
5750
|
+
var fs15 = require_fs();
|
|
5751
|
+
var path11 = require("path");
|
|
5760
5752
|
var u = require_universalify().fromPromise;
|
|
5761
5753
|
function getStats(src, dest, opts) {
|
|
5762
|
-
const statFunc = opts.dereference ? (file) =>
|
|
5754
|
+
const statFunc = opts.dereference ? (file) => fs15.stat(file, { bigint: true }) : (file) => fs15.lstat(file, { bigint: true });
|
|
5763
5755
|
return Promise.all([
|
|
5764
5756
|
statFunc(src),
|
|
5765
5757
|
statFunc(dest).catch((err) => {
|
|
@@ -5770,7 +5762,7 @@ var require_stat = __commonJS({
|
|
|
5770
5762
|
}
|
|
5771
5763
|
function getStatsSync(src, dest, opts) {
|
|
5772
5764
|
let destStat;
|
|
5773
|
-
const statFunc = opts.dereference ? (file) =>
|
|
5765
|
+
const statFunc = opts.dereference ? (file) => fs15.statSync(file, { bigint: true }) : (file) => fs15.lstatSync(file, { bigint: true });
|
|
5774
5766
|
const srcStat = statFunc(src);
|
|
5775
5767
|
try {
|
|
5776
5768
|
destStat = statFunc(dest);
|
|
@@ -5784,8 +5776,8 @@ var require_stat = __commonJS({
|
|
|
5784
5776
|
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
5785
5777
|
if (destStat) {
|
|
5786
5778
|
if (areIdentical(srcStat, destStat)) {
|
|
5787
|
-
const srcBaseName =
|
|
5788
|
-
const destBaseName =
|
|
5779
|
+
const srcBaseName = path11.basename(src);
|
|
5780
|
+
const destBaseName = path11.basename(dest);
|
|
5789
5781
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
5790
5782
|
return { srcStat, destStat, isChangingCase: true };
|
|
5791
5783
|
}
|
|
@@ -5807,8 +5799,8 @@ var require_stat = __commonJS({
|
|
|
5807
5799
|
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
5808
5800
|
if (destStat) {
|
|
5809
5801
|
if (areIdentical(srcStat, destStat)) {
|
|
5810
|
-
const srcBaseName =
|
|
5811
|
-
const destBaseName =
|
|
5802
|
+
const srcBaseName = path11.basename(src);
|
|
5803
|
+
const destBaseName = path11.basename(dest);
|
|
5812
5804
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
5813
5805
|
return { srcStat, destStat, isChangingCase: true };
|
|
5814
5806
|
}
|
|
@@ -5827,12 +5819,12 @@ var require_stat = __commonJS({
|
|
|
5827
5819
|
return { srcStat, destStat };
|
|
5828
5820
|
}
|
|
5829
5821
|
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
5830
|
-
const srcParent =
|
|
5831
|
-
const destParent =
|
|
5832
|
-
if (destParent === srcParent || destParent ===
|
|
5822
|
+
const srcParent = path11.resolve(path11.dirname(src));
|
|
5823
|
+
const destParent = path11.resolve(path11.dirname(dest));
|
|
5824
|
+
if (destParent === srcParent || destParent === path11.parse(destParent).root) return;
|
|
5833
5825
|
let destStat;
|
|
5834
5826
|
try {
|
|
5835
|
-
destStat = await
|
|
5827
|
+
destStat = await fs15.stat(destParent, { bigint: true });
|
|
5836
5828
|
} catch (err) {
|
|
5837
5829
|
if (err.code === "ENOENT") return;
|
|
5838
5830
|
throw err;
|
|
@@ -5843,12 +5835,12 @@ var require_stat = __commonJS({
|
|
|
5843
5835
|
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
5844
5836
|
}
|
|
5845
5837
|
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
5846
|
-
const srcParent =
|
|
5847
|
-
const destParent =
|
|
5848
|
-
if (destParent === srcParent || destParent ===
|
|
5838
|
+
const srcParent = path11.resolve(path11.dirname(src));
|
|
5839
|
+
const destParent = path11.resolve(path11.dirname(dest));
|
|
5840
|
+
if (destParent === srcParent || destParent === path11.parse(destParent).root) return;
|
|
5849
5841
|
let destStat;
|
|
5850
5842
|
try {
|
|
5851
|
-
destStat =
|
|
5843
|
+
destStat = fs15.statSync(destParent, { bigint: true });
|
|
5852
5844
|
} catch (err) {
|
|
5853
5845
|
if (err.code === "ENOENT") return;
|
|
5854
5846
|
throw err;
|
|
@@ -5862,8 +5854,8 @@ var require_stat = __commonJS({
|
|
|
5862
5854
|
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
5863
5855
|
}
|
|
5864
5856
|
function isSrcSubdir(src, dest) {
|
|
5865
|
-
const srcArr =
|
|
5866
|
-
const destArr =
|
|
5857
|
+
const srcArr = path11.resolve(src).split(path11.sep).filter((i) => i);
|
|
5858
|
+
const destArr = path11.resolve(dest).split(path11.sep).filter((i) => i);
|
|
5867
5859
|
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
5868
5860
|
}
|
|
5869
5861
|
function errMsg(src, dest, funcName) {
|
|
@@ -5915,8 +5907,8 @@ var require_async = __commonJS({
|
|
|
5915
5907
|
var require_copy = __commonJS({
|
|
5916
5908
|
"node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
|
|
5917
5909
|
"use strict";
|
|
5918
|
-
var
|
|
5919
|
-
var
|
|
5910
|
+
var fs15 = require_fs();
|
|
5911
|
+
var path11 = require("path");
|
|
5920
5912
|
var { mkdirs } = require_mkdirs();
|
|
5921
5913
|
var { pathExists } = require_path_exists();
|
|
5922
5914
|
var { utimesMillis } = require_utimes();
|
|
@@ -5939,7 +5931,7 @@ var require_copy = __commonJS({
|
|
|
5939
5931
|
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
5940
5932
|
const include = await runFilter(src, dest, opts);
|
|
5941
5933
|
if (!include) return;
|
|
5942
|
-
const destParent =
|
|
5934
|
+
const destParent = path11.dirname(dest);
|
|
5943
5935
|
const dirExists = await pathExists(destParent);
|
|
5944
5936
|
if (!dirExists) {
|
|
5945
5937
|
await mkdirs(destParent);
|
|
@@ -5951,7 +5943,7 @@ var require_copy = __commonJS({
|
|
|
5951
5943
|
return opts.filter(src, dest);
|
|
5952
5944
|
}
|
|
5953
5945
|
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
5954
|
-
const statFn = opts.dereference ?
|
|
5946
|
+
const statFn = opts.dereference ? fs15.stat : fs15.lstat;
|
|
5955
5947
|
const srcStat = await statFn(src);
|
|
5956
5948
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
5957
5949
|
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -5963,7 +5955,7 @@ var require_copy = __commonJS({
|
|
|
5963
5955
|
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
5964
5956
|
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
5965
5957
|
if (opts.overwrite) {
|
|
5966
|
-
await
|
|
5958
|
+
await fs15.unlink(dest);
|
|
5967
5959
|
return copyFile(srcStat, src, dest, opts);
|
|
5968
5960
|
}
|
|
5969
5961
|
if (opts.errorOnExist) {
|
|
@@ -5971,29 +5963,29 @@ var require_copy = __commonJS({
|
|
|
5971
5963
|
}
|
|
5972
5964
|
}
|
|
5973
5965
|
async function copyFile(srcStat, src, dest, opts) {
|
|
5974
|
-
await
|
|
5966
|
+
await fs15.copyFile(src, dest);
|
|
5975
5967
|
if (opts.preserveTimestamps) {
|
|
5976
5968
|
if (fileIsNotWritable(srcStat.mode)) {
|
|
5977
5969
|
await makeFileWritable(dest, srcStat.mode);
|
|
5978
5970
|
}
|
|
5979
|
-
const updatedSrcStat = await
|
|
5971
|
+
const updatedSrcStat = await fs15.stat(src);
|
|
5980
5972
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
5981
5973
|
}
|
|
5982
|
-
return
|
|
5974
|
+
return fs15.chmod(dest, srcStat.mode);
|
|
5983
5975
|
}
|
|
5984
5976
|
function fileIsNotWritable(srcMode) {
|
|
5985
5977
|
return (srcMode & 128) === 0;
|
|
5986
5978
|
}
|
|
5987
5979
|
function makeFileWritable(dest, srcMode) {
|
|
5988
|
-
return
|
|
5980
|
+
return fs15.chmod(dest, srcMode | 128);
|
|
5989
5981
|
}
|
|
5990
5982
|
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
5991
5983
|
if (!destStat) {
|
|
5992
|
-
await
|
|
5984
|
+
await fs15.mkdir(dest);
|
|
5993
5985
|
}
|
|
5994
|
-
await asyncIteratorConcurrentProcess(await
|
|
5995
|
-
const srcItem =
|
|
5996
|
-
const destItem =
|
|
5986
|
+
await asyncIteratorConcurrentProcess(await fs15.opendir(src), async (item) => {
|
|
5987
|
+
const srcItem = path11.join(src, item.name);
|
|
5988
|
+
const destItem = path11.join(dest, item.name);
|
|
5997
5989
|
const include = await runFilter(srcItem, destItem, opts);
|
|
5998
5990
|
if (include) {
|
|
5999
5991
|
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
@@ -6001,26 +5993,26 @@ var require_copy = __commonJS({
|
|
|
6001
5993
|
}
|
|
6002
5994
|
});
|
|
6003
5995
|
if (!destStat) {
|
|
6004
|
-
await
|
|
5996
|
+
await fs15.chmod(dest, srcStat.mode);
|
|
6005
5997
|
}
|
|
6006
5998
|
}
|
|
6007
5999
|
async function onLink(destStat, src, dest, opts) {
|
|
6008
|
-
let resolvedSrc = await
|
|
6000
|
+
let resolvedSrc = await fs15.readlink(src);
|
|
6009
6001
|
if (opts.dereference) {
|
|
6010
|
-
resolvedSrc =
|
|
6002
|
+
resolvedSrc = path11.resolve(process.cwd(), resolvedSrc);
|
|
6011
6003
|
}
|
|
6012
6004
|
if (!destStat) {
|
|
6013
|
-
return
|
|
6005
|
+
return fs15.symlink(resolvedSrc, dest);
|
|
6014
6006
|
}
|
|
6015
6007
|
let resolvedDest = null;
|
|
6016
6008
|
try {
|
|
6017
|
-
resolvedDest = await
|
|
6009
|
+
resolvedDest = await fs15.readlink(dest);
|
|
6018
6010
|
} catch (e) {
|
|
6019
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return
|
|
6011
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs15.symlink(resolvedSrc, dest);
|
|
6020
6012
|
throw e;
|
|
6021
6013
|
}
|
|
6022
6014
|
if (opts.dereference) {
|
|
6023
|
-
resolvedDest =
|
|
6015
|
+
resolvedDest = path11.resolve(process.cwd(), resolvedDest);
|
|
6024
6016
|
}
|
|
6025
6017
|
if (resolvedSrc !== resolvedDest) {
|
|
6026
6018
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
@@ -6030,8 +6022,8 @@ var require_copy = __commonJS({
|
|
|
6030
6022
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
6031
6023
|
}
|
|
6032
6024
|
}
|
|
6033
|
-
await
|
|
6034
|
-
return
|
|
6025
|
+
await fs15.unlink(dest);
|
|
6026
|
+
return fs15.symlink(resolvedSrc, dest);
|
|
6035
6027
|
}
|
|
6036
6028
|
module2.exports = copy;
|
|
6037
6029
|
}
|
|
@@ -6041,8 +6033,8 @@ var require_copy = __commonJS({
|
|
|
6041
6033
|
var require_copy_sync = __commonJS({
|
|
6042
6034
|
"node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
|
|
6043
6035
|
"use strict";
|
|
6044
|
-
var
|
|
6045
|
-
var
|
|
6036
|
+
var fs15 = require_graceful_fs();
|
|
6037
|
+
var path11 = require("path");
|
|
6046
6038
|
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
6047
6039
|
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
6048
6040
|
var stat = require_stat();
|
|
@@ -6063,12 +6055,12 @@ var require_copy_sync = __commonJS({
|
|
|
6063
6055
|
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
6064
6056
|
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
6065
6057
|
if (opts.filter && !opts.filter(src, dest)) return;
|
|
6066
|
-
const destParent =
|
|
6067
|
-
if (!
|
|
6058
|
+
const destParent = path11.dirname(dest);
|
|
6059
|
+
if (!fs15.existsSync(destParent)) mkdirsSync(destParent);
|
|
6068
6060
|
return getStats(destStat, src, dest, opts);
|
|
6069
6061
|
}
|
|
6070
6062
|
function getStats(destStat, src, dest, opts) {
|
|
6071
|
-
const statSync = opts.dereference ?
|
|
6063
|
+
const statSync = opts.dereference ? fs15.statSync : fs15.lstatSync;
|
|
6072
6064
|
const srcStat = statSync(src);
|
|
6073
6065
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
6074
6066
|
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -6083,14 +6075,14 @@ var require_copy_sync = __commonJS({
|
|
|
6083
6075
|
}
|
|
6084
6076
|
function mayCopyFile(srcStat, src, dest, opts) {
|
|
6085
6077
|
if (opts.overwrite) {
|
|
6086
|
-
|
|
6078
|
+
fs15.unlinkSync(dest);
|
|
6087
6079
|
return copyFile(srcStat, src, dest, opts);
|
|
6088
6080
|
} else if (opts.errorOnExist) {
|
|
6089
6081
|
throw new Error(`'${dest}' already exists`);
|
|
6090
6082
|
}
|
|
6091
6083
|
}
|
|
6092
6084
|
function copyFile(srcStat, src, dest, opts) {
|
|
6093
|
-
|
|
6085
|
+
fs15.copyFileSync(src, dest);
|
|
6094
6086
|
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
6095
6087
|
return setDestMode(dest, srcStat.mode);
|
|
6096
6088
|
}
|
|
@@ -6105,10 +6097,10 @@ var require_copy_sync = __commonJS({
|
|
|
6105
6097
|
return setDestMode(dest, srcMode | 128);
|
|
6106
6098
|
}
|
|
6107
6099
|
function setDestMode(dest, srcMode) {
|
|
6108
|
-
return
|
|
6100
|
+
return fs15.chmodSync(dest, srcMode);
|
|
6109
6101
|
}
|
|
6110
6102
|
function setDestTimestamps(src, dest) {
|
|
6111
|
-
const updatedSrcStat =
|
|
6103
|
+
const updatedSrcStat = fs15.statSync(src);
|
|
6112
6104
|
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
6113
6105
|
}
|
|
6114
6106
|
function onDir(srcStat, destStat, src, dest, opts) {
|
|
@@ -6116,12 +6108,12 @@ var require_copy_sync = __commonJS({
|
|
|
6116
6108
|
return copyDir(src, dest, opts);
|
|
6117
6109
|
}
|
|
6118
6110
|
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
6119
|
-
|
|
6111
|
+
fs15.mkdirSync(dest);
|
|
6120
6112
|
copyDir(src, dest, opts);
|
|
6121
6113
|
return setDestMode(dest, srcMode);
|
|
6122
6114
|
}
|
|
6123
6115
|
function copyDir(src, dest, opts) {
|
|
6124
|
-
const dir =
|
|
6116
|
+
const dir = fs15.opendirSync(src);
|
|
6125
6117
|
try {
|
|
6126
6118
|
let dirent;
|
|
6127
6119
|
while ((dirent = dir.readSync()) !== null) {
|
|
@@ -6132,29 +6124,29 @@ var require_copy_sync = __commonJS({
|
|
|
6132
6124
|
}
|
|
6133
6125
|
}
|
|
6134
6126
|
function copyDirItem(item, src, dest, opts) {
|
|
6135
|
-
const srcItem =
|
|
6136
|
-
const destItem =
|
|
6127
|
+
const srcItem = path11.join(src, item);
|
|
6128
|
+
const destItem = path11.join(dest, item);
|
|
6137
6129
|
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
6138
6130
|
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
6139
6131
|
return getStats(destStat, srcItem, destItem, opts);
|
|
6140
6132
|
}
|
|
6141
6133
|
function onLink(destStat, src, dest, opts) {
|
|
6142
|
-
let resolvedSrc =
|
|
6134
|
+
let resolvedSrc = fs15.readlinkSync(src);
|
|
6143
6135
|
if (opts.dereference) {
|
|
6144
|
-
resolvedSrc =
|
|
6136
|
+
resolvedSrc = path11.resolve(process.cwd(), resolvedSrc);
|
|
6145
6137
|
}
|
|
6146
6138
|
if (!destStat) {
|
|
6147
|
-
return
|
|
6139
|
+
return fs15.symlinkSync(resolvedSrc, dest);
|
|
6148
6140
|
} else {
|
|
6149
6141
|
let resolvedDest;
|
|
6150
6142
|
try {
|
|
6151
|
-
resolvedDest =
|
|
6143
|
+
resolvedDest = fs15.readlinkSync(dest);
|
|
6152
6144
|
} catch (err) {
|
|
6153
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return
|
|
6145
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs15.symlinkSync(resolvedSrc, dest);
|
|
6154
6146
|
throw err;
|
|
6155
6147
|
}
|
|
6156
6148
|
if (opts.dereference) {
|
|
6157
|
-
resolvedDest =
|
|
6149
|
+
resolvedDest = path11.resolve(process.cwd(), resolvedDest);
|
|
6158
6150
|
}
|
|
6159
6151
|
if (resolvedSrc !== resolvedDest) {
|
|
6160
6152
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
@@ -6168,8 +6160,8 @@ var require_copy_sync = __commonJS({
|
|
|
6168
6160
|
}
|
|
6169
6161
|
}
|
|
6170
6162
|
function copyLink(resolvedSrc, dest) {
|
|
6171
|
-
|
|
6172
|
-
return
|
|
6163
|
+
fs15.unlinkSync(dest);
|
|
6164
|
+
return fs15.symlinkSync(resolvedSrc, dest);
|
|
6173
6165
|
}
|
|
6174
6166
|
module2.exports = copySync;
|
|
6175
6167
|
}
|
|
@@ -6191,13 +6183,13 @@ var require_copy2 = __commonJS({
|
|
|
6191
6183
|
var require_remove = __commonJS({
|
|
6192
6184
|
"node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
|
|
6193
6185
|
"use strict";
|
|
6194
|
-
var
|
|
6186
|
+
var fs15 = require_graceful_fs();
|
|
6195
6187
|
var u = require_universalify().fromCallback;
|
|
6196
|
-
function remove(
|
|
6197
|
-
|
|
6188
|
+
function remove(path11, callback) {
|
|
6189
|
+
fs15.rm(path11, { recursive: true, force: true }, callback);
|
|
6198
6190
|
}
|
|
6199
|
-
function removeSync(
|
|
6200
|
-
|
|
6191
|
+
function removeSync(path11) {
|
|
6192
|
+
fs15.rmSync(path11, { recursive: true, force: true });
|
|
6201
6193
|
}
|
|
6202
6194
|
module2.exports = {
|
|
6203
6195
|
remove: u(remove),
|
|
@@ -6211,28 +6203,28 @@ var require_empty = __commonJS({
|
|
|
6211
6203
|
"node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
|
|
6212
6204
|
"use strict";
|
|
6213
6205
|
var u = require_universalify().fromPromise;
|
|
6214
|
-
var
|
|
6215
|
-
var
|
|
6206
|
+
var fs15 = require_fs();
|
|
6207
|
+
var path11 = require("path");
|
|
6216
6208
|
var mkdir = require_mkdirs();
|
|
6217
6209
|
var remove = require_remove();
|
|
6218
6210
|
var emptyDir = u(async function emptyDir2(dir) {
|
|
6219
6211
|
let items;
|
|
6220
6212
|
try {
|
|
6221
|
-
items = await
|
|
6213
|
+
items = await fs15.readdir(dir);
|
|
6222
6214
|
} catch {
|
|
6223
6215
|
return mkdir.mkdirs(dir);
|
|
6224
6216
|
}
|
|
6225
|
-
return Promise.all(items.map((item) => remove.remove(
|
|
6217
|
+
return Promise.all(items.map((item) => remove.remove(path11.join(dir, item))));
|
|
6226
6218
|
});
|
|
6227
6219
|
function emptyDirSync(dir) {
|
|
6228
6220
|
let items;
|
|
6229
6221
|
try {
|
|
6230
|
-
items =
|
|
6222
|
+
items = fs15.readdirSync(dir);
|
|
6231
6223
|
} catch {
|
|
6232
6224
|
return mkdir.mkdirsSync(dir);
|
|
6233
6225
|
}
|
|
6234
6226
|
items.forEach((item) => {
|
|
6235
|
-
item =
|
|
6227
|
+
item = path11.join(dir, item);
|
|
6236
6228
|
remove.removeSync(item);
|
|
6237
6229
|
});
|
|
6238
6230
|
}
|
|
@@ -6250,52 +6242,52 @@ var require_file = __commonJS({
|
|
|
6250
6242
|
"node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
|
|
6251
6243
|
"use strict";
|
|
6252
6244
|
var u = require_universalify().fromPromise;
|
|
6253
|
-
var
|
|
6254
|
-
var
|
|
6245
|
+
var path11 = require("path");
|
|
6246
|
+
var fs15 = require_fs();
|
|
6255
6247
|
var mkdir = require_mkdirs();
|
|
6256
6248
|
async function createFile(file) {
|
|
6257
6249
|
let stats;
|
|
6258
6250
|
try {
|
|
6259
|
-
stats = await
|
|
6251
|
+
stats = await fs15.stat(file);
|
|
6260
6252
|
} catch {
|
|
6261
6253
|
}
|
|
6262
6254
|
if (stats && stats.isFile()) return;
|
|
6263
|
-
const dir =
|
|
6255
|
+
const dir = path11.dirname(file);
|
|
6264
6256
|
let dirStats = null;
|
|
6265
6257
|
try {
|
|
6266
|
-
dirStats = await
|
|
6258
|
+
dirStats = await fs15.stat(dir);
|
|
6267
6259
|
} catch (err) {
|
|
6268
6260
|
if (err.code === "ENOENT") {
|
|
6269
6261
|
await mkdir.mkdirs(dir);
|
|
6270
|
-
await
|
|
6262
|
+
await fs15.writeFile(file, "");
|
|
6271
6263
|
return;
|
|
6272
6264
|
} else {
|
|
6273
6265
|
throw err;
|
|
6274
6266
|
}
|
|
6275
6267
|
}
|
|
6276
6268
|
if (dirStats.isDirectory()) {
|
|
6277
|
-
await
|
|
6269
|
+
await fs15.writeFile(file, "");
|
|
6278
6270
|
} else {
|
|
6279
|
-
await
|
|
6271
|
+
await fs15.readdir(dir);
|
|
6280
6272
|
}
|
|
6281
6273
|
}
|
|
6282
6274
|
function createFileSync(file) {
|
|
6283
6275
|
let stats;
|
|
6284
6276
|
try {
|
|
6285
|
-
stats =
|
|
6277
|
+
stats = fs15.statSync(file);
|
|
6286
6278
|
} catch {
|
|
6287
6279
|
}
|
|
6288
6280
|
if (stats && stats.isFile()) return;
|
|
6289
|
-
const dir =
|
|
6281
|
+
const dir = path11.dirname(file);
|
|
6290
6282
|
try {
|
|
6291
|
-
if (!
|
|
6292
|
-
|
|
6283
|
+
if (!fs15.statSync(dir).isDirectory()) {
|
|
6284
|
+
fs15.readdirSync(dir);
|
|
6293
6285
|
}
|
|
6294
6286
|
} catch (err) {
|
|
6295
6287
|
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
|
|
6296
6288
|
else throw err;
|
|
6297
6289
|
}
|
|
6298
|
-
|
|
6290
|
+
fs15.writeFileSync(file, "");
|
|
6299
6291
|
}
|
|
6300
6292
|
module2.exports = {
|
|
6301
6293
|
createFile: u(createFile),
|
|
@@ -6309,50 +6301,50 @@ var require_link = __commonJS({
|
|
|
6309
6301
|
"node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
|
|
6310
6302
|
"use strict";
|
|
6311
6303
|
var u = require_universalify().fromPromise;
|
|
6312
|
-
var
|
|
6313
|
-
var
|
|
6304
|
+
var path11 = require("path");
|
|
6305
|
+
var fs15 = require_fs();
|
|
6314
6306
|
var mkdir = require_mkdirs();
|
|
6315
6307
|
var { pathExists } = require_path_exists();
|
|
6316
6308
|
var { areIdentical } = require_stat();
|
|
6317
6309
|
async function createLink(srcpath, dstpath) {
|
|
6318
6310
|
let dstStat;
|
|
6319
6311
|
try {
|
|
6320
|
-
dstStat = await
|
|
6312
|
+
dstStat = await fs15.lstat(dstpath, { bigint: true });
|
|
6321
6313
|
} catch {
|
|
6322
6314
|
}
|
|
6323
6315
|
let srcStat;
|
|
6324
6316
|
try {
|
|
6325
|
-
srcStat = await
|
|
6317
|
+
srcStat = await fs15.lstat(srcpath, { bigint: true });
|
|
6326
6318
|
} catch (err) {
|
|
6327
6319
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
6328
6320
|
throw err;
|
|
6329
6321
|
}
|
|
6330
6322
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
6331
|
-
const dir =
|
|
6323
|
+
const dir = path11.dirname(dstpath);
|
|
6332
6324
|
const dirExists = await pathExists(dir);
|
|
6333
6325
|
if (!dirExists) {
|
|
6334
6326
|
await mkdir.mkdirs(dir);
|
|
6335
6327
|
}
|
|
6336
|
-
await
|
|
6328
|
+
await fs15.link(srcpath, dstpath);
|
|
6337
6329
|
}
|
|
6338
6330
|
function createLinkSync(srcpath, dstpath) {
|
|
6339
6331
|
let dstStat;
|
|
6340
6332
|
try {
|
|
6341
|
-
dstStat =
|
|
6333
|
+
dstStat = fs15.lstatSync(dstpath, { bigint: true });
|
|
6342
6334
|
} catch {
|
|
6343
6335
|
}
|
|
6344
6336
|
try {
|
|
6345
|
-
const srcStat =
|
|
6337
|
+
const srcStat = fs15.lstatSync(srcpath, { bigint: true });
|
|
6346
6338
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
6347
6339
|
} catch (err) {
|
|
6348
6340
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
6349
6341
|
throw err;
|
|
6350
6342
|
}
|
|
6351
|
-
const dir =
|
|
6352
|
-
const dirExists =
|
|
6353
|
-
if (dirExists) return
|
|
6343
|
+
const dir = path11.dirname(dstpath);
|
|
6344
|
+
const dirExists = fs15.existsSync(dir);
|
|
6345
|
+
if (dirExists) return fs15.linkSync(srcpath, dstpath);
|
|
6354
6346
|
mkdir.mkdirsSync(dir);
|
|
6355
|
-
return
|
|
6347
|
+
return fs15.linkSync(srcpath, dstpath);
|
|
6356
6348
|
}
|
|
6357
6349
|
module2.exports = {
|
|
6358
6350
|
createLink: u(createLink),
|
|
@@ -6365,14 +6357,14 @@ var require_link = __commonJS({
|
|
|
6365
6357
|
var require_symlink_paths = __commonJS({
|
|
6366
6358
|
"node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
|
|
6367
6359
|
"use strict";
|
|
6368
|
-
var
|
|
6369
|
-
var
|
|
6360
|
+
var path11 = require("path");
|
|
6361
|
+
var fs15 = require_fs();
|
|
6370
6362
|
var { pathExists } = require_path_exists();
|
|
6371
6363
|
var u = require_universalify().fromPromise;
|
|
6372
6364
|
async function symlinkPaths(srcpath, dstpath) {
|
|
6373
|
-
if (
|
|
6365
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6374
6366
|
try {
|
|
6375
|
-
await
|
|
6367
|
+
await fs15.lstat(srcpath);
|
|
6376
6368
|
} catch (err) {
|
|
6377
6369
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
6378
6370
|
throw err;
|
|
@@ -6382,8 +6374,8 @@ var require_symlink_paths = __commonJS({
|
|
|
6382
6374
|
toDst: srcpath
|
|
6383
6375
|
};
|
|
6384
6376
|
}
|
|
6385
|
-
const dstdir =
|
|
6386
|
-
const relativeToDst =
|
|
6377
|
+
const dstdir = path11.dirname(dstpath);
|
|
6378
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6387
6379
|
const exists = await pathExists(relativeToDst);
|
|
6388
6380
|
if (exists) {
|
|
6389
6381
|
return {
|
|
@@ -6392,39 +6384,39 @@ var require_symlink_paths = __commonJS({
|
|
|
6392
6384
|
};
|
|
6393
6385
|
}
|
|
6394
6386
|
try {
|
|
6395
|
-
await
|
|
6387
|
+
await fs15.lstat(srcpath);
|
|
6396
6388
|
} catch (err) {
|
|
6397
6389
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
6398
6390
|
throw err;
|
|
6399
6391
|
}
|
|
6400
6392
|
return {
|
|
6401
6393
|
toCwd: srcpath,
|
|
6402
|
-
toDst:
|
|
6394
|
+
toDst: path11.relative(dstdir, srcpath)
|
|
6403
6395
|
};
|
|
6404
6396
|
}
|
|
6405
6397
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
6406
|
-
if (
|
|
6407
|
-
const exists2 =
|
|
6398
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6399
|
+
const exists2 = fs15.existsSync(srcpath);
|
|
6408
6400
|
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
6409
6401
|
return {
|
|
6410
6402
|
toCwd: srcpath,
|
|
6411
6403
|
toDst: srcpath
|
|
6412
6404
|
};
|
|
6413
6405
|
}
|
|
6414
|
-
const dstdir =
|
|
6415
|
-
const relativeToDst =
|
|
6416
|
-
const exists =
|
|
6406
|
+
const dstdir = path11.dirname(dstpath);
|
|
6407
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6408
|
+
const exists = fs15.existsSync(relativeToDst);
|
|
6417
6409
|
if (exists) {
|
|
6418
6410
|
return {
|
|
6419
6411
|
toCwd: relativeToDst,
|
|
6420
6412
|
toDst: srcpath
|
|
6421
6413
|
};
|
|
6422
6414
|
}
|
|
6423
|
-
const srcExists =
|
|
6415
|
+
const srcExists = fs15.existsSync(srcpath);
|
|
6424
6416
|
if (!srcExists) throw new Error("relative srcpath does not exist");
|
|
6425
6417
|
return {
|
|
6426
6418
|
toCwd: srcpath,
|
|
6427
|
-
toDst:
|
|
6419
|
+
toDst: path11.relative(dstdir, srcpath)
|
|
6428
6420
|
};
|
|
6429
6421
|
}
|
|
6430
6422
|
module2.exports = {
|
|
@@ -6438,13 +6430,13 @@ var require_symlink_paths = __commonJS({
|
|
|
6438
6430
|
var require_symlink_type = __commonJS({
|
|
6439
6431
|
"node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
|
|
6440
6432
|
"use strict";
|
|
6441
|
-
var
|
|
6433
|
+
var fs15 = require_fs();
|
|
6442
6434
|
var u = require_universalify().fromPromise;
|
|
6443
6435
|
async function symlinkType(srcpath, type) {
|
|
6444
6436
|
if (type) return type;
|
|
6445
6437
|
let stats;
|
|
6446
6438
|
try {
|
|
6447
|
-
stats = await
|
|
6439
|
+
stats = await fs15.lstat(srcpath);
|
|
6448
6440
|
} catch {
|
|
6449
6441
|
return "file";
|
|
6450
6442
|
}
|
|
@@ -6454,7 +6446,7 @@ var require_symlink_type = __commonJS({
|
|
|
6454
6446
|
if (type) return type;
|
|
6455
6447
|
let stats;
|
|
6456
6448
|
try {
|
|
6457
|
-
stats =
|
|
6449
|
+
stats = fs15.lstatSync(srcpath);
|
|
6458
6450
|
} catch {
|
|
6459
6451
|
return "file";
|
|
6460
6452
|
}
|
|
@@ -6472,8 +6464,8 @@ var require_symlink = __commonJS({
|
|
|
6472
6464
|
"node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
|
|
6473
6465
|
"use strict";
|
|
6474
6466
|
var u = require_universalify().fromPromise;
|
|
6475
|
-
var
|
|
6476
|
-
var
|
|
6467
|
+
var path11 = require("path");
|
|
6468
|
+
var fs15 = require_fs();
|
|
6477
6469
|
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
6478
6470
|
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
6479
6471
|
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
@@ -6482,64 +6474,64 @@ var require_symlink = __commonJS({
|
|
|
6482
6474
|
async function createSymlink(srcpath, dstpath, type) {
|
|
6483
6475
|
let stats;
|
|
6484
6476
|
try {
|
|
6485
|
-
stats = await
|
|
6477
|
+
stats = await fs15.lstat(dstpath);
|
|
6486
6478
|
} catch {
|
|
6487
6479
|
}
|
|
6488
6480
|
if (stats && stats.isSymbolicLink()) {
|
|
6489
6481
|
let srcStat;
|
|
6490
|
-
if (
|
|
6491
|
-
srcStat = await
|
|
6482
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6483
|
+
srcStat = await fs15.stat(srcpath, { bigint: true });
|
|
6492
6484
|
} else {
|
|
6493
|
-
const dstdir =
|
|
6494
|
-
const relativeToDst =
|
|
6485
|
+
const dstdir = path11.dirname(dstpath);
|
|
6486
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6495
6487
|
try {
|
|
6496
|
-
srcStat = await
|
|
6488
|
+
srcStat = await fs15.stat(relativeToDst, { bigint: true });
|
|
6497
6489
|
} catch {
|
|
6498
|
-
srcStat = await
|
|
6490
|
+
srcStat = await fs15.stat(srcpath, { bigint: true });
|
|
6499
6491
|
}
|
|
6500
6492
|
}
|
|
6501
|
-
const dstStat = await
|
|
6493
|
+
const dstStat = await fs15.stat(dstpath, { bigint: true });
|
|
6502
6494
|
if (areIdentical(srcStat, dstStat)) return;
|
|
6503
6495
|
}
|
|
6504
6496
|
const relative = await symlinkPaths(srcpath, dstpath);
|
|
6505
6497
|
srcpath = relative.toDst;
|
|
6506
6498
|
const toType = await symlinkType(relative.toCwd, type);
|
|
6507
|
-
const dir =
|
|
6499
|
+
const dir = path11.dirname(dstpath);
|
|
6508
6500
|
if (!await pathExists(dir)) {
|
|
6509
6501
|
await mkdirs(dir);
|
|
6510
6502
|
}
|
|
6511
|
-
return
|
|
6503
|
+
return fs15.symlink(srcpath, dstpath, toType);
|
|
6512
6504
|
}
|
|
6513
6505
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
6514
6506
|
let stats;
|
|
6515
6507
|
try {
|
|
6516
|
-
stats =
|
|
6508
|
+
stats = fs15.lstatSync(dstpath);
|
|
6517
6509
|
} catch {
|
|
6518
6510
|
}
|
|
6519
6511
|
if (stats && stats.isSymbolicLink()) {
|
|
6520
6512
|
let srcStat;
|
|
6521
|
-
if (
|
|
6522
|
-
srcStat =
|
|
6513
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6514
|
+
srcStat = fs15.statSync(srcpath, { bigint: true });
|
|
6523
6515
|
} else {
|
|
6524
|
-
const dstdir =
|
|
6525
|
-
const relativeToDst =
|
|
6516
|
+
const dstdir = path11.dirname(dstpath);
|
|
6517
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6526
6518
|
try {
|
|
6527
|
-
srcStat =
|
|
6519
|
+
srcStat = fs15.statSync(relativeToDst, { bigint: true });
|
|
6528
6520
|
} catch {
|
|
6529
|
-
srcStat =
|
|
6521
|
+
srcStat = fs15.statSync(srcpath, { bigint: true });
|
|
6530
6522
|
}
|
|
6531
6523
|
}
|
|
6532
|
-
const dstStat =
|
|
6524
|
+
const dstStat = fs15.statSync(dstpath, { bigint: true });
|
|
6533
6525
|
if (areIdentical(srcStat, dstStat)) return;
|
|
6534
6526
|
}
|
|
6535
6527
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
6536
6528
|
srcpath = relative.toDst;
|
|
6537
6529
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
6538
|
-
const dir =
|
|
6539
|
-
const exists =
|
|
6540
|
-
if (exists) return
|
|
6530
|
+
const dir = path11.dirname(dstpath);
|
|
6531
|
+
const exists = fs15.existsSync(dir);
|
|
6532
|
+
if (exists) return fs15.symlinkSync(srcpath, dstpath, type);
|
|
6541
6533
|
mkdirsSync(dir);
|
|
6542
|
-
return
|
|
6534
|
+
return fs15.symlinkSync(srcpath, dstpath, type);
|
|
6543
6535
|
}
|
|
6544
6536
|
module2.exports = {
|
|
6545
6537
|
createSymlink: u(createSymlink),
|
|
@@ -6611,9 +6603,9 @@ var require_jsonfile = __commonJS({
|
|
|
6611
6603
|
if (typeof options === "string") {
|
|
6612
6604
|
options = { encoding: options };
|
|
6613
6605
|
}
|
|
6614
|
-
const
|
|
6606
|
+
const fs15 = options.fs || _fs;
|
|
6615
6607
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
6616
|
-
let data = await universalify.fromCallback(
|
|
6608
|
+
let data = await universalify.fromCallback(fs15.readFile)(file, options);
|
|
6617
6609
|
data = stripBom(data);
|
|
6618
6610
|
let obj;
|
|
6619
6611
|
try {
|
|
@@ -6633,10 +6625,10 @@ var require_jsonfile = __commonJS({
|
|
|
6633
6625
|
if (typeof options === "string") {
|
|
6634
6626
|
options = { encoding: options };
|
|
6635
6627
|
}
|
|
6636
|
-
const
|
|
6628
|
+
const fs15 = options.fs || _fs;
|
|
6637
6629
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
6638
6630
|
try {
|
|
6639
|
-
let content =
|
|
6631
|
+
let content = fs15.readFileSync(file, options);
|
|
6640
6632
|
content = stripBom(content);
|
|
6641
6633
|
return JSON.parse(content, options.reviver);
|
|
6642
6634
|
} catch (err) {
|
|
@@ -6649,15 +6641,15 @@ var require_jsonfile = __commonJS({
|
|
|
6649
6641
|
}
|
|
6650
6642
|
}
|
|
6651
6643
|
async function _writeFile(file, obj, options = {}) {
|
|
6652
|
-
const
|
|
6644
|
+
const fs15 = options.fs || _fs;
|
|
6653
6645
|
const str = stringify(obj, options);
|
|
6654
|
-
await universalify.fromCallback(
|
|
6646
|
+
await universalify.fromCallback(fs15.writeFile)(file, str, options);
|
|
6655
6647
|
}
|
|
6656
6648
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
6657
6649
|
function writeFileSync(file, obj, options = {}) {
|
|
6658
|
-
const
|
|
6650
|
+
const fs15 = options.fs || _fs;
|
|
6659
6651
|
const str = stringify(obj, options);
|
|
6660
|
-
return
|
|
6652
|
+
return fs15.writeFileSync(file, str, options);
|
|
6661
6653
|
}
|
|
6662
6654
|
module2.exports = {
|
|
6663
6655
|
readFile,
|
|
@@ -6688,23 +6680,23 @@ var require_output_file = __commonJS({
|
|
|
6688
6680
|
"node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
|
|
6689
6681
|
"use strict";
|
|
6690
6682
|
var u = require_universalify().fromPromise;
|
|
6691
|
-
var
|
|
6692
|
-
var
|
|
6683
|
+
var fs15 = require_fs();
|
|
6684
|
+
var path11 = require("path");
|
|
6693
6685
|
var mkdir = require_mkdirs();
|
|
6694
6686
|
var pathExists = require_path_exists().pathExists;
|
|
6695
6687
|
async function outputFile(file, data, encoding = "utf-8") {
|
|
6696
|
-
const dir =
|
|
6688
|
+
const dir = path11.dirname(file);
|
|
6697
6689
|
if (!await pathExists(dir)) {
|
|
6698
6690
|
await mkdir.mkdirs(dir);
|
|
6699
6691
|
}
|
|
6700
|
-
return
|
|
6692
|
+
return fs15.writeFile(file, data, encoding);
|
|
6701
6693
|
}
|
|
6702
6694
|
function outputFileSync(file, ...args) {
|
|
6703
|
-
const dir =
|
|
6704
|
-
if (!
|
|
6695
|
+
const dir = path11.dirname(file);
|
|
6696
|
+
if (!fs15.existsSync(dir)) {
|
|
6705
6697
|
mkdir.mkdirsSync(dir);
|
|
6706
6698
|
}
|
|
6707
|
-
|
|
6699
|
+
fs15.writeFileSync(file, ...args);
|
|
6708
6700
|
}
|
|
6709
6701
|
module2.exports = {
|
|
6710
6702
|
outputFile: u(outputFile),
|
|
@@ -6763,8 +6755,8 @@ var require_json = __commonJS({
|
|
|
6763
6755
|
var require_move = __commonJS({
|
|
6764
6756
|
"node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
|
|
6765
6757
|
"use strict";
|
|
6766
|
-
var
|
|
6767
|
-
var
|
|
6758
|
+
var fs15 = require_fs();
|
|
6759
|
+
var path11 = require("path");
|
|
6768
6760
|
var { copy } = require_copy2();
|
|
6769
6761
|
var { remove } = require_remove();
|
|
6770
6762
|
var { mkdirp } = require_mkdirs();
|
|
@@ -6774,8 +6766,8 @@ var require_move = __commonJS({
|
|
|
6774
6766
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
6775
6767
|
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
6776
6768
|
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
6777
|
-
const destParent =
|
|
6778
|
-
const parsedParentPath =
|
|
6769
|
+
const destParent = path11.dirname(dest);
|
|
6770
|
+
const parsedParentPath = path11.parse(destParent);
|
|
6779
6771
|
if (parsedParentPath.root !== destParent) {
|
|
6780
6772
|
await mkdirp(destParent);
|
|
6781
6773
|
}
|
|
@@ -6790,7 +6782,7 @@ var require_move = __commonJS({
|
|
|
6790
6782
|
}
|
|
6791
6783
|
}
|
|
6792
6784
|
try {
|
|
6793
|
-
await
|
|
6785
|
+
await fs15.rename(src, dest);
|
|
6794
6786
|
} catch (err) {
|
|
6795
6787
|
if (err.code !== "EXDEV") {
|
|
6796
6788
|
throw err;
|
|
@@ -6815,8 +6807,8 @@ var require_move = __commonJS({
|
|
|
6815
6807
|
var require_move_sync = __commonJS({
|
|
6816
6808
|
"node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
|
|
6817
6809
|
"use strict";
|
|
6818
|
-
var
|
|
6819
|
-
var
|
|
6810
|
+
var fs15 = require_graceful_fs();
|
|
6811
|
+
var path11 = require("path");
|
|
6820
6812
|
var copySync = require_copy2().copySync;
|
|
6821
6813
|
var removeSync = require_remove().removeSync;
|
|
6822
6814
|
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
@@ -6826,12 +6818,12 @@ var require_move_sync = __commonJS({
|
|
|
6826
6818
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
6827
6819
|
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
6828
6820
|
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
6829
|
-
if (!isParentRoot(dest)) mkdirpSync(
|
|
6821
|
+
if (!isParentRoot(dest)) mkdirpSync(path11.dirname(dest));
|
|
6830
6822
|
return doRename(src, dest, overwrite, isChangingCase);
|
|
6831
6823
|
}
|
|
6832
6824
|
function isParentRoot(dest) {
|
|
6833
|
-
const parent =
|
|
6834
|
-
const parsedPath =
|
|
6825
|
+
const parent = path11.dirname(dest);
|
|
6826
|
+
const parsedPath = path11.parse(parent);
|
|
6835
6827
|
return parsedPath.root === parent;
|
|
6836
6828
|
}
|
|
6837
6829
|
function doRename(src, dest, overwrite, isChangingCase) {
|
|
@@ -6840,12 +6832,12 @@ var require_move_sync = __commonJS({
|
|
|
6840
6832
|
removeSync(dest);
|
|
6841
6833
|
return rename(src, dest, overwrite);
|
|
6842
6834
|
}
|
|
6843
|
-
if (
|
|
6835
|
+
if (fs15.existsSync(dest)) throw new Error("dest already exists.");
|
|
6844
6836
|
return rename(src, dest, overwrite);
|
|
6845
6837
|
}
|
|
6846
6838
|
function rename(src, dest, overwrite) {
|
|
6847
6839
|
try {
|
|
6848
|
-
|
|
6840
|
+
fs15.renameSync(src, dest);
|
|
6849
6841
|
} catch (err) {
|
|
6850
6842
|
if (err.code !== "EXDEV") throw err;
|
|
6851
6843
|
return moveAcrossDevice(src, dest, overwrite);
|
|
@@ -6897,89 +6889,6 @@ var require_lib = __commonJS({
|
|
|
6897
6889
|
}
|
|
6898
6890
|
});
|
|
6899
6891
|
|
|
6900
|
-
// packages/cli/src/generators/names.ts
|
|
6901
|
-
var names_exports = {};
|
|
6902
|
-
__export(names_exports, {
|
|
6903
|
-
buildGeneratedRoutes: () => buildGeneratedRoutes,
|
|
6904
|
-
toIdentifier: () => toIdentifier,
|
|
6905
|
-
toMethodName: () => toMethodName,
|
|
6906
|
-
toRuntimePath: () => toRuntimePath,
|
|
6907
|
-
toTypeName: () => toTypeName
|
|
6908
|
-
});
|
|
6909
|
-
function buildGeneratedRoutes(routes) {
|
|
6910
|
-
const grouped = {};
|
|
6911
|
-
const usedActions = {};
|
|
6912
|
-
for (const route of routes) {
|
|
6913
|
-
const segments = getPathSegments(route.path);
|
|
6914
|
-
const groupName = toIdentifier(segments[0] ?? "root");
|
|
6915
|
-
const baseActionName = toActionName(route, segments.slice(1));
|
|
6916
|
-
usedActions[groupName] ?? (usedActions[groupName] = /* @__PURE__ */ new Set());
|
|
6917
|
-
const actionName = uniquify(baseActionName, usedActions[groupName]);
|
|
6918
|
-
grouped[groupName] ?? (grouped[groupName] = []);
|
|
6919
|
-
grouped[groupName].push({
|
|
6920
|
-
...route,
|
|
6921
|
-
groupName,
|
|
6922
|
-
actionName,
|
|
6923
|
-
runtimePath: toRuntimePath(route.path)
|
|
6924
|
-
});
|
|
6925
|
-
}
|
|
6926
|
-
return grouped;
|
|
6927
|
-
}
|
|
6928
|
-
function toTypeName(value) {
|
|
6929
|
-
return splitWords(value).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("") || "Root";
|
|
6930
|
-
}
|
|
6931
|
-
function toIdentifier(value) {
|
|
6932
|
-
const [first = "root", ...rest] = splitWords(value);
|
|
6933
|
-
const identifier = [
|
|
6934
|
-
first.toLowerCase(),
|
|
6935
|
-
...rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
6936
|
-
].join("");
|
|
6937
|
-
return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
|
|
6938
|
-
}
|
|
6939
|
-
function toRuntimePath(path10) {
|
|
6940
|
-
return path10.replace(/{([^}/]+)}/g, ":$1");
|
|
6941
|
-
}
|
|
6942
|
-
function toActionName(route, restSegments) {
|
|
6943
|
-
const method = route.method.toLowerCase();
|
|
6944
|
-
const suffix = restSegments.map(normalizeSegment).filter(Boolean).map(toTypeName).join("");
|
|
6945
|
-
return toIdentifier(suffix ? `${method}-${suffix}` : method);
|
|
6946
|
-
}
|
|
6947
|
-
function normalizeSegment(segment) {
|
|
6948
|
-
return segment.replace(/^{([^}/]+)}$/, "$1");
|
|
6949
|
-
}
|
|
6950
|
-
function getPathSegments(path10) {
|
|
6951
|
-
return path10.replace(/^\//, "").split("/").filter(Boolean);
|
|
6952
|
-
}
|
|
6953
|
-
function splitWords(value) {
|
|
6954
|
-
return value.replace(/^{([^}/]+)}$/, "$1").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word.toLowerCase());
|
|
6955
|
-
}
|
|
6956
|
-
function uniquify(baseName, used) {
|
|
6957
|
-
if (!used.has(baseName)) {
|
|
6958
|
-
used.add(baseName);
|
|
6959
|
-
return baseName;
|
|
6960
|
-
}
|
|
6961
|
-
let index = 2;
|
|
6962
|
-
let name = `${baseName}${index}`;
|
|
6963
|
-
while (used.has(name)) {
|
|
6964
|
-
index += 1;
|
|
6965
|
-
name = `${baseName}${index}`;
|
|
6966
|
-
}
|
|
6967
|
-
used.add(name);
|
|
6968
|
-
return name;
|
|
6969
|
-
}
|
|
6970
|
-
function toMethodName(route) {
|
|
6971
|
-
if (route.name) {
|
|
6972
|
-
const parts = route.name.split(".");
|
|
6973
|
-
return toIdentifier(parts.join(" "));
|
|
6974
|
-
}
|
|
6975
|
-
return toIdentifier(route.method + " " + route.path);
|
|
6976
|
-
}
|
|
6977
|
-
var init_names = __esm({
|
|
6978
|
-
"packages/cli/src/generators/names.ts"() {
|
|
6979
|
-
"use strict";
|
|
6980
|
-
}
|
|
6981
|
-
});
|
|
6982
|
-
|
|
6983
6892
|
// packages/cli/node_modules/commander/esm.mjs
|
|
6984
6893
|
var import_index = __toESM(require_commander(), 1);
|
|
6985
6894
|
var {
|
|
@@ -8449,9 +8358,8 @@ function ora(options) {
|
|
|
8449
8358
|
var import_fs_extra = __toESM(require_lib());
|
|
8450
8359
|
var import_child_process = require("child_process");
|
|
8451
8360
|
var import_path = __toESM(require("path"));
|
|
8452
|
-
var import_os = __toESM(require("os"));
|
|
8453
8361
|
var LaravelRouteParser = class {
|
|
8454
|
-
async parse(filePath) {
|
|
8362
|
+
async parse(filePath, options = {}) {
|
|
8455
8363
|
const projectRoot = import_path.default.resolve(import_path.default.dirname(filePath), "..");
|
|
8456
8364
|
const phpScript = `<?php
|
|
8457
8365
|
require __DIR__.'/vendor/autoload.php';
|
|
@@ -8459,9 +8367,13 @@ $app = require_once __DIR__.'/bootstrap/app.php';
|
|
|
8459
8367
|
$kernel = $app->make(Illuminate\\Contracts\\Console\\Kernel::class);
|
|
8460
8368
|
$kernel->bootstrap();
|
|
8461
8369
|
|
|
8462
|
-
$
|
|
8463
|
-
|
|
8370
|
+
$result = [
|
|
8371
|
+
'routes' => [],
|
|
8372
|
+
'models' => []
|
|
8373
|
+
];
|
|
8464
8374
|
|
|
8375
|
+
// Extract Routes
|
|
8376
|
+
$routes = app('router')->getRoutes();
|
|
8465
8377
|
foreach ($routes as $route) {
|
|
8466
8378
|
if (!str_starts_with($route->uri(), 'api/')) continue;
|
|
8467
8379
|
|
|
@@ -8487,7 +8399,6 @@ foreach ($routes as $route) {
|
|
|
8487
8399
|
if ($type && !$type->isBuiltin()) {
|
|
8488
8400
|
$className = $type->getName();
|
|
8489
8401
|
if (is_subclass_of($className, 'Illuminate\\Foundation\\Http\\FormRequest')) {
|
|
8490
|
-
// Instantiate the request and get rules
|
|
8491
8402
|
$request = new $className();
|
|
8492
8403
|
if (method_exists($request, 'rules')) {
|
|
8493
8404
|
$schema = $request->rules();
|
|
@@ -8495,9 +8406,7 @@ foreach ($routes as $route) {
|
|
|
8495
8406
|
}
|
|
8496
8407
|
}
|
|
8497
8408
|
}
|
|
8498
|
-
} catch (\\Exception $e) {
|
|
8499
|
-
// Ignore reflection errors
|
|
8500
|
-
}
|
|
8409
|
+
} catch (\\Exception $e) {}
|
|
8501
8410
|
}
|
|
8502
8411
|
}
|
|
8503
8412
|
|
|
@@ -8508,22 +8417,60 @@ foreach ($routes as $route) {
|
|
|
8508
8417
|
|
|
8509
8418
|
$name = $resource . '.' . strtolower($method);
|
|
8510
8419
|
|
|
8511
|
-
$
|
|
8420
|
+
$result['routes'][] = [
|
|
8512
8421
|
'name' => $route->getName() ?: $name,
|
|
8513
8422
|
'method' => $method,
|
|
8514
8423
|
'path' => '/' . preg_replace('/^api\\//', '', $route->uri()),
|
|
8515
8424
|
'auth' => $auth,
|
|
8516
8425
|
'middleware' => $middlewares,
|
|
8517
|
-
'schema' => $schema
|
|
8426
|
+
'schema' => empty($schema) ? null : ['rules' => $schema]
|
|
8518
8427
|
];
|
|
8519
8428
|
}
|
|
8520
8429
|
}
|
|
8521
8430
|
|
|
8522
|
-
|
|
8431
|
+
// Extract Models if requested
|
|
8432
|
+
$extractModels = ${options.extractModels ? "true" : "false"};
|
|
8433
|
+
if ($extractModels) {
|
|
8434
|
+
$modelsPath = app_path('Models');
|
|
8435
|
+
if (is_dir($modelsPath)) {
|
|
8436
|
+
$files = \\Illuminate\\Support\\Facades\\File::allFiles($modelsPath);
|
|
8437
|
+
foreach ($files as $file) {
|
|
8438
|
+
$class = 'App\\\\Models\\\\' . str_replace('/', '\\\\', $file->getRelativePathname());
|
|
8439
|
+
$class = preg_replace('/\\.php$/', '', $class);
|
|
8440
|
+
|
|
8441
|
+
if (class_exists($class) && is_subclass_of($class, 'Illuminate\\\\Database\\\\Eloquent\\\\Model')) {
|
|
8442
|
+
try {
|
|
8443
|
+
$reflection = new ReflectionClass($class);
|
|
8444
|
+
if ($reflection->isAbstract()) continue;
|
|
8445
|
+
|
|
8446
|
+
$model = new $class();
|
|
8447
|
+
$table = $model->getTable();
|
|
8448
|
+
$columns = \\Illuminate\\Support\\Facades\\Schema::getColumns($table);
|
|
8449
|
+
|
|
8450
|
+
$parsedColumns = [];
|
|
8451
|
+
foreach ($columns as $col) {
|
|
8452
|
+
$parsedColumns[] = [
|
|
8453
|
+
'name' => $col['name'],
|
|
8454
|
+
'type' => $col['type_name'],
|
|
8455
|
+
'nullable' => $col['nullable']
|
|
8456
|
+
];
|
|
8457
|
+
}
|
|
8458
|
+
|
|
8459
|
+
$result['models'][] = [
|
|
8460
|
+
'name' => class_basename($class),
|
|
8461
|
+
'table' => $table,
|
|
8462
|
+
'columns' => $parsedColumns
|
|
8463
|
+
];
|
|
8464
|
+
} catch (\\Exception $e) {}
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
}
|
|
8468
|
+
}
|
|
8469
|
+
|
|
8470
|
+
echo json_encode($result);
|
|
8523
8471
|
`;
|
|
8524
|
-
const
|
|
8472
|
+
const scriptPath = import_path.default.join(projectRoot, "routesync-extractor-temp.php");
|
|
8525
8473
|
try {
|
|
8526
|
-
const scriptPath = import_path.default.join(projectRoot, "routesync-extractor-temp.php");
|
|
8527
8474
|
await import_fs_extra.default.writeFile(scriptPath, phpScript);
|
|
8528
8475
|
const stdout = (0, import_child_process.execSync)(`php routesync-extractor-temp.php`, {
|
|
8529
8476
|
cwd: projectRoot,
|
|
@@ -8532,10 +8479,16 @@ echo json_encode($output);
|
|
|
8532
8479
|
});
|
|
8533
8480
|
await import_fs_extra.default.remove(scriptPath);
|
|
8534
8481
|
const parsed = JSON.parse(stdout);
|
|
8535
|
-
return
|
|
8482
|
+
return {
|
|
8483
|
+
routes: parsed.routes || [],
|
|
8484
|
+
models: parsed.models || []
|
|
8485
|
+
};
|
|
8536
8486
|
} catch (err) {
|
|
8487
|
+
if (import_fs_extra.default.existsSync(scriptPath)) {
|
|
8488
|
+
await import_fs_extra.default.remove(scriptPath);
|
|
8489
|
+
}
|
|
8537
8490
|
console.error("Failed to parse Laravel routes via PHP script:", err);
|
|
8538
|
-
return [];
|
|
8491
|
+
return { routes: [], models: [] };
|
|
8539
8492
|
}
|
|
8540
8493
|
}
|
|
8541
8494
|
};
|
|
@@ -8558,15 +8511,16 @@ var ManifestGenerator = class {
|
|
|
8558
8511
|
};
|
|
8559
8512
|
|
|
8560
8513
|
// packages/cli/src/commands/scan.ts
|
|
8561
|
-
var scanCommand = new Command("scan").description("Scan Laravel/PHP routes and output a route manifest").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output manifest path", "routesync.manifest.json").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").action(async (options) => {
|
|
8514
|
+
var scanCommand = new Command("scan").description("Scan Laravel/PHP routes and output a route manifest").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output manifest path", "routesync.manifest.json").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").option("--models", "Extract Database Schema via Eloquent Models").action(async (options) => {
|
|
8562
8515
|
const spinner = ora("Scanning routes...").start();
|
|
8563
8516
|
try {
|
|
8564
8517
|
const parser = new LaravelRouteParser();
|
|
8565
|
-
const routes = await parser.parse(options.input);
|
|
8518
|
+
const { routes, models } = await parser.parse(options.input, { extractModels: options.models });
|
|
8566
8519
|
const manifest = ManifestGenerator.generate(routes, options.baseURL);
|
|
8520
|
+
if (options.models) manifest.models = models;
|
|
8567
8521
|
await ManifestGenerator.save(manifest, options.output);
|
|
8568
8522
|
spinner.succeed(
|
|
8569
|
-
source_default.green(`Found ${routes.length} routes \u2192 ${options.output}`)
|
|
8523
|
+
source_default.green(`Found ${routes.length} routes, ${models.length} models \u2192 ${options.output}`)
|
|
8570
8524
|
);
|
|
8571
8525
|
routes.forEach((r) => {
|
|
8572
8526
|
console.log(
|
|
@@ -8582,102 +8536,155 @@ var scanCommand = new Command("scan").description("Scan Laravel/PHP routes and o
|
|
|
8582
8536
|
// packages/cli/src/generators/SDKGenerator.ts
|
|
8583
8537
|
var import_path2 = __toESM(require("path"));
|
|
8584
8538
|
var import_fs_extra3 = __toESM(require_lib());
|
|
8585
|
-
|
|
8539
|
+
|
|
8540
|
+
// packages/cli/src/generators/names.ts
|
|
8541
|
+
function buildGeneratedRoutes(routes) {
|
|
8542
|
+
const grouped = {};
|
|
8543
|
+
const usedActions = {};
|
|
8544
|
+
for (const route of routes) {
|
|
8545
|
+
const segments = getPathSegments(route.path);
|
|
8546
|
+
const groupName = toIdentifier(segments[0] ?? "root");
|
|
8547
|
+
const baseActionName = toActionName(route, segments.slice(1));
|
|
8548
|
+
usedActions[groupName] ?? (usedActions[groupName] = /* @__PURE__ */ new Set());
|
|
8549
|
+
const actionName = uniquify(baseActionName, usedActions[groupName]);
|
|
8550
|
+
grouped[groupName] ?? (grouped[groupName] = []);
|
|
8551
|
+
grouped[groupName].push({
|
|
8552
|
+
...route,
|
|
8553
|
+
groupName,
|
|
8554
|
+
actionName,
|
|
8555
|
+
runtimePath: toRuntimePath(route.path)
|
|
8556
|
+
});
|
|
8557
|
+
}
|
|
8558
|
+
return grouped;
|
|
8559
|
+
}
|
|
8560
|
+
function toTypeName(value) {
|
|
8561
|
+
return splitWords(value).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("") || "Root";
|
|
8562
|
+
}
|
|
8563
|
+
function toIdentifier(value) {
|
|
8564
|
+
const [first = "root", ...rest] = splitWords(value);
|
|
8565
|
+
const identifier = [
|
|
8566
|
+
first.toLowerCase(),
|
|
8567
|
+
...rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
8568
|
+
].join("");
|
|
8569
|
+
return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
|
|
8570
|
+
}
|
|
8571
|
+
function toRuntimePath(path11) {
|
|
8572
|
+
return path11.replace(/{([^}/]+)}/g, ":$1");
|
|
8573
|
+
}
|
|
8574
|
+
function toActionName(route, restSegments) {
|
|
8575
|
+
const method = route.method.toLowerCase();
|
|
8576
|
+
const suffix = restSegments.map(normalizeSegment).filter(Boolean).map(toTypeName).join("");
|
|
8577
|
+
return toIdentifier(suffix ? `${method}-${suffix}` : method);
|
|
8578
|
+
}
|
|
8579
|
+
function normalizeSegment(segment) {
|
|
8580
|
+
return segment.replace(/^{([^}/]+)}$/, "$1");
|
|
8581
|
+
}
|
|
8582
|
+
function getPathSegments(path11) {
|
|
8583
|
+
return path11.replace(/^\//, "").split("/").filter(Boolean);
|
|
8584
|
+
}
|
|
8585
|
+
function splitWords(value) {
|
|
8586
|
+
return value.replace(/^{([^}/]+)}$/, "$1").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word.toLowerCase());
|
|
8587
|
+
}
|
|
8588
|
+
function uniquify(baseName, used) {
|
|
8589
|
+
if (!used.has(baseName)) {
|
|
8590
|
+
used.add(baseName);
|
|
8591
|
+
return baseName;
|
|
8592
|
+
}
|
|
8593
|
+
let index = 2;
|
|
8594
|
+
let name = `${baseName}${index}`;
|
|
8595
|
+
while (used.has(name)) {
|
|
8596
|
+
index += 1;
|
|
8597
|
+
name = `${baseName}${index}`;
|
|
8598
|
+
}
|
|
8599
|
+
used.add(name);
|
|
8600
|
+
return name;
|
|
8601
|
+
}
|
|
8602
|
+
function toMethodName(route) {
|
|
8603
|
+
if (route.name) {
|
|
8604
|
+
const parts = route.name.split(".");
|
|
8605
|
+
return toIdentifier(parts.join(" "));
|
|
8606
|
+
}
|
|
8607
|
+
return toIdentifier(route.method + " " + route.path);
|
|
8608
|
+
}
|
|
8609
|
+
|
|
8610
|
+
// packages/cli/src/generators/SDKGenerator.ts
|
|
8586
8611
|
var SDKGenerator = class {
|
|
8587
8612
|
static async generate(manifest, outputDir) {
|
|
8588
8613
|
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
8589
|
-
const
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
rootLines.push(`import { ${group}Def } from './${group}/services/api.generated'`);
|
|
8597
|
-
}
|
|
8598
|
-
rootLines.push(``);
|
|
8599
|
-
rootLines.push(`export const api = defineApi({`);
|
|
8600
|
-
for (const group of groupNames) {
|
|
8601
|
-
rootLines.push(` ${group}: ${group}Def,`);
|
|
8602
|
-
}
|
|
8603
|
-
rootLines.push(`})`);
|
|
8604
|
-
rootLines.push(``);
|
|
8605
|
-
rootLines.push(`export default api`);
|
|
8606
|
-
await import_fs_extra3.default.writeFile(import_path2.default.join(outputDir, "api.ts"), rootLines.join("\n"));
|
|
8614
|
+
const lines = [];
|
|
8615
|
+
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8616
|
+
lines.push(`// Generated at: ${manifest.generatedAt}`);
|
|
8617
|
+
lines.push(``);
|
|
8618
|
+
lines.push(`import { defineApi } from 'routesync'`);
|
|
8619
|
+
lines.push(``);
|
|
8620
|
+
lines.push(`export const api = defineApi({`);
|
|
8607
8621
|
for (const [group, routes] of Object.entries(grouped)) {
|
|
8608
|
-
|
|
8609
|
-
await import_fs_extra3.default.ensureDir(resourceDir);
|
|
8610
|
-
const lines = [];
|
|
8611
|
-
lines.push(`// Auto-generated. Do not edit.`);
|
|
8612
|
-
lines.push(`export const ${group}Def = {`);
|
|
8622
|
+
lines.push(` ${group}: {`);
|
|
8613
8623
|
for (const route of routes) {
|
|
8614
|
-
lines.push(`
|
|
8615
|
-
lines.push(`
|
|
8616
|
-
lines.push(`
|
|
8617
|
-
if (route.auth) lines.push(`
|
|
8618
|
-
lines.push(`
|
|
8624
|
+
lines.push(` ${route.actionName}: {`);
|
|
8625
|
+
lines.push(` method: '${route.method}',`);
|
|
8626
|
+
lines.push(` path: '${route.runtimePath}',`);
|
|
8627
|
+
if (route.auth) lines.push(` auth: true,`);
|
|
8628
|
+
lines.push(` },`);
|
|
8619
8629
|
}
|
|
8620
|
-
lines.push(`}
|
|
8621
|
-
await import_fs_extra3.default.writeFile(import_path2.default.join(resourceDir, "api.generated.ts"), lines.join("\n"));
|
|
8630
|
+
lines.push(` },`);
|
|
8622
8631
|
}
|
|
8632
|
+
lines.push(`})`);
|
|
8633
|
+
lines.push(``);
|
|
8634
|
+
lines.push(`export default api`);
|
|
8635
|
+
await import_fs_extra3.default.writeFile(import_path2.default.join(outputDir, "api.ts"), lines.join("\n"));
|
|
8623
8636
|
}
|
|
8624
8637
|
};
|
|
8625
8638
|
|
|
8626
8639
|
// packages/cli/src/generators/TypeGenerator.ts
|
|
8627
8640
|
var import_path3 = __toESM(require("path"));
|
|
8628
8641
|
var import_fs_extra4 = __toESM(require_lib());
|
|
8629
|
-
init_names();
|
|
8630
8642
|
var TypeGenerator = class {
|
|
8631
8643
|
static async generate(manifest, outputDir) {
|
|
8632
|
-
const
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
coreLines.push(` success: boolean`);
|
|
8639
|
-
coreLines.push(` message?: string`);
|
|
8640
|
-
coreLines.push(` data: T`);
|
|
8641
|
-
coreLines.push(` meta?: PaginationMeta`);
|
|
8642
|
-
coreLines.push(`}`);
|
|
8643
|
-
coreLines.push(``);
|
|
8644
|
-
coreLines.push(`export interface PaginationMeta {`);
|
|
8645
|
-
coreLines.push(` current_page: number`);
|
|
8646
|
-
coreLines.push(` last_page: number`);
|
|
8647
|
-
coreLines.push(` per_page: number`);
|
|
8648
|
-
coreLines.push(` total: number`);
|
|
8649
|
-
coreLines.push(`}`);
|
|
8650
|
-
coreLines.push(``);
|
|
8651
|
-
coreLines.push(`export interface ApiError {`);
|
|
8652
|
-
coreLines.push(` success: false`);
|
|
8653
|
-
coreLines.push(` message: string`);
|
|
8654
|
-
coreLines.push(` errors?: Record<string, string[]>`);
|
|
8655
|
-
coreLines.push(` status?: number`);
|
|
8656
|
-
coreLines.push(`}`);
|
|
8657
|
-
coreLines.push(``);
|
|
8658
|
-
await import_fs_extra4.default.writeFile(import_path3.default.join(coreDir, "types.ts"), coreLines.join("\n"));
|
|
8659
|
-
const { buildGeneratedRoutes: buildGeneratedRoutes3 } = (init_names(), __toCommonJS(names_exports));
|
|
8660
|
-
const grouped = buildGeneratedRoutes3(manifest.routes);
|
|
8661
|
-
for (const [group, routes] of Object.entries(grouped)) {
|
|
8662
|
-
const resourceDir = import_path3.default.join(outputDir, group, "contracts");
|
|
8663
|
-
await import_fs_extra4.default.ensureDir(resourceDir);
|
|
8664
|
-
const lines = [];
|
|
8665
|
-
lines.push(`// Auto-generated. Do not edit.`);
|
|
8666
|
-
lines.push(`import { ApiResponse, PaginationMeta, ApiError } from '../../core/contracts/types'`);
|
|
8667
|
-
const hasSchemas = routes.some((r) => r.schema && Object.keys(r.schema).length > 0);
|
|
8668
|
-
if (hasSchemas) {
|
|
8669
|
-
lines.push(`import { z } from 'zod'`);
|
|
8670
|
-
}
|
|
8644
|
+
const lines = [];
|
|
8645
|
+
const hasSchemas = manifest.routes.some((r) => r.schema && Object.keys(r.schema).length > 0);
|
|
8646
|
+
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8647
|
+
lines.push(``);
|
|
8648
|
+
if (hasSchemas) {
|
|
8649
|
+
lines.push(`import { z } from 'zod'`);
|
|
8671
8650
|
lines.push(``);
|
|
8672
|
-
|
|
8651
|
+
}
|
|
8652
|
+
lines.push(`export interface ApiResponse<T = any> {`);
|
|
8653
|
+
lines.push(` success: boolean`);
|
|
8654
|
+
lines.push(` message?: string`);
|
|
8655
|
+
lines.push(` data: T`);
|
|
8656
|
+
lines.push(` meta?: PaginationMeta`);
|
|
8657
|
+
lines.push(`}`);
|
|
8658
|
+
lines.push(``);
|
|
8659
|
+
lines.push(`export interface PaginationMeta {`);
|
|
8660
|
+
lines.push(` current_page: number`);
|
|
8661
|
+
lines.push(` last_page: number`);
|
|
8662
|
+
lines.push(` per_page: number`);
|
|
8663
|
+
lines.push(` total: number`);
|
|
8664
|
+
lines.push(`}`);
|
|
8665
|
+
lines.push(``);
|
|
8666
|
+
lines.push(`export interface ApiError {`);
|
|
8667
|
+
lines.push(` success: false`);
|
|
8668
|
+
lines.push(` message: string`);
|
|
8669
|
+
lines.push(` errors?: Record<string, string[]>`);
|
|
8670
|
+
lines.push(` status?: number`);
|
|
8671
|
+
lines.push(`}`);
|
|
8672
|
+
lines.push(``);
|
|
8673
|
+
const resources = new Set(
|
|
8674
|
+
manifest.routes.map((r) => r.path.replace(/^\//, "").split("/")[0])
|
|
8675
|
+
);
|
|
8676
|
+
for (const resource of resources) {
|
|
8677
|
+
const typeName = toTypeName(resource ?? "");
|
|
8673
8678
|
lines.push(`export interface ${typeName} {`);
|
|
8674
8679
|
lines.push(` id: number`);
|
|
8675
|
-
lines.push(` // TODO: Add ${
|
|
8680
|
+
lines.push(` // TODO: Add ${resource} fields`);
|
|
8676
8681
|
lines.push(` created_at?: string`);
|
|
8677
8682
|
lines.push(` updated_at?: string`);
|
|
8678
8683
|
lines.push(`}`);
|
|
8679
8684
|
lines.push(``);
|
|
8680
|
-
|
|
8685
|
+
}
|
|
8686
|
+
if (hasSchemas) {
|
|
8687
|
+
for (const route of manifest.routes) {
|
|
8681
8688
|
if (route.schema && Object.keys(route.schema).length > 0) {
|
|
8682
8689
|
const actionName = toMethodName(route);
|
|
8683
8690
|
const schemaName = actionName + "Schema";
|
|
@@ -8711,71 +8718,51 @@ var TypeGenerator = class {
|
|
|
8711
8718
|
lines.push(``);
|
|
8712
8719
|
}
|
|
8713
8720
|
}
|
|
8714
|
-
await import_fs_extra4.default.writeFile(import_path3.default.join(resourceDir, "api.generated.ts"), lines.join("\n"));
|
|
8715
8721
|
}
|
|
8716
|
-
|
|
8717
|
-
rootTypes.push(`// Auto-generated. Do not edit.`);
|
|
8718
|
-
rootTypes.push(`export * from './core/contracts/types'`);
|
|
8719
|
-
for (const group of Object.keys(grouped)) {
|
|
8720
|
-
rootTypes.push(`export * from './${group}/contracts/api.generated'`);
|
|
8721
|
-
}
|
|
8722
|
-
await import_fs_extra4.default.writeFile(import_path3.default.join(outputDir, "types.ts"), rootTypes.join("\n"));
|
|
8722
|
+
await import_fs_extra4.default.writeFile(import_path3.default.join(outputDir, "types.ts"), lines.join("\\n"));
|
|
8723
8723
|
}
|
|
8724
8724
|
};
|
|
8725
8725
|
|
|
8726
8726
|
// packages/cli/src/generators/HookGenerator.ts
|
|
8727
8727
|
var import_path4 = __toESM(require("path"));
|
|
8728
8728
|
var import_fs_extra5 = __toESM(require_lib());
|
|
8729
|
-
|
|
8730
|
-
var HookGenerator = class {
|
|
8729
|
+
var HookGenerator = class _HookGenerator {
|
|
8731
8730
|
static async generate(manifest, outputDir) {
|
|
8731
|
+
const lines = [];
|
|
8732
|
+
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8733
|
+
lines.push(``);
|
|
8734
|
+
lines.push(`import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'`);
|
|
8735
|
+
lines.push(`import { api } from './api'`);
|
|
8736
|
+
lines.push(``);
|
|
8732
8737
|
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
8733
8738
|
for (const [group, routes] of Object.entries(grouped)) {
|
|
8734
|
-
const resourceDir = import_path4.default.join(outputDir, group, "hooks");
|
|
8735
|
-
await import_fs_extra5.default.ensureDir(resourceDir);
|
|
8736
|
-
const lines = [];
|
|
8737
|
-
lines.push(`// Auto-generated. Do not edit.`);
|
|
8738
|
-
lines.push(`import { useQuery, useMutation } from '@tanstack/react-query'`);
|
|
8739
|
-
lines.push(`import { api } from '../../api'`);
|
|
8740
|
-
lines.push(`import type { ${toTypeName(group)} } from '../contracts/api.generated'`);
|
|
8741
|
-
const imports = [];
|
|
8742
|
-
for (const route of routes) {
|
|
8743
|
-
if (route.schema && Object.keys(route.schema).length > 0) {
|
|
8744
|
-
imports.push(toTypeName(toMethodName(route) + "Payload"));
|
|
8745
|
-
}
|
|
8746
|
-
}
|
|
8747
|
-
if (imports.length > 0) {
|
|
8748
|
-
lines.push(`import type { ${imports.join(", ")} } from '../contracts/api.generated'`);
|
|
8749
|
-
}
|
|
8750
|
-
lines.push(``);
|
|
8751
8739
|
for (const route of routes) {
|
|
8752
|
-
const
|
|
8753
|
-
const hookName =
|
|
8754
|
-
const
|
|
8755
|
-
if (
|
|
8756
|
-
lines.push(`export function ${hookName}() {`);
|
|
8740
|
+
const method = route.method.toUpperCase();
|
|
8741
|
+
const hookName = _HookGenerator.toHookName(group, route.actionName);
|
|
8742
|
+
const queryKey = `['${group}', '${route.actionName}']`;
|
|
8743
|
+
if (method === "GET") {
|
|
8744
|
+
lines.push(`export function ${hookName}(params?: Record<string, any>) {`);
|
|
8757
8745
|
lines.push(` return useQuery({`);
|
|
8758
|
-
lines.push(` queryKey:
|
|
8759
|
-
lines.push(` queryFn: () => api.${group}.${actionName}()`);
|
|
8746
|
+
lines.push(` queryKey: ${queryKey},`);
|
|
8747
|
+
lines.push(` queryFn: () => api.${group}.${route.actionName}({ query: params })`);
|
|
8760
8748
|
lines.push(` })`);
|
|
8761
8749
|
lines.push(`}`);
|
|
8750
|
+
lines.push(``);
|
|
8762
8751
|
} else {
|
|
8763
8752
|
lines.push(`export function ${hookName}() {`);
|
|
8753
|
+
lines.push(` const queryClient = useQueryClient()`);
|
|
8764
8754
|
lines.push(` return useMutation({`);
|
|
8765
|
-
lines.push(` mutationFn: (data:
|
|
8755
|
+
lines.push(` mutationFn: (data: any) => api.${group}.${route.actionName}({ body: data }),`);
|
|
8756
|
+
lines.push(` onSuccess: () => {`);
|
|
8757
|
+
lines.push(` queryClient.invalidateQueries({ queryKey: ['${group}'] })`);
|
|
8758
|
+
lines.push(` }`);
|
|
8766
8759
|
lines.push(` })`);
|
|
8767
8760
|
lines.push(`}`);
|
|
8761
|
+
lines.push(``);
|
|
8768
8762
|
}
|
|
8769
|
-
lines.push(``);
|
|
8770
8763
|
}
|
|
8771
|
-
await import_fs_extra5.default.writeFile(import_path4.default.join(resourceDir, "api.generated.ts"), lines.join("\n"));
|
|
8772
8764
|
}
|
|
8773
|
-
|
|
8774
|
-
rootHooks.push(`// Auto-generated. Do not edit.`);
|
|
8775
|
-
for (const group of Object.keys(grouped)) {
|
|
8776
|
-
rootHooks.push(`export * from './${group}/hooks/api.generated'`);
|
|
8777
|
-
}
|
|
8778
|
-
await import_fs_extra5.default.writeFile(import_path4.default.join(outputDir, "hooks.ts"), rootHooks.join("\n"));
|
|
8765
|
+
await import_fs_extra5.default.writeFile(import_path4.default.join(outputDir, "hooks.ts"), lines.join("\n"));
|
|
8779
8766
|
}
|
|
8780
8767
|
static toHookName(group, actionName) {
|
|
8781
8768
|
return `use${toTypeName(group)}${toTypeName(actionName)}`;
|
|
@@ -8785,67 +8772,45 @@ var HookGenerator = class {
|
|
|
8785
8772
|
// packages/cli/src/generators/NextActionGenerator.ts
|
|
8786
8773
|
var import_path5 = __toESM(require("path"));
|
|
8787
8774
|
var import_fs_extra6 = __toESM(require_lib());
|
|
8788
|
-
init_names();
|
|
8789
8775
|
var NextActionGenerator = class {
|
|
8790
8776
|
static async generate(manifest, outputDir) {
|
|
8791
|
-
const
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
const
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
}
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
}
|
|
8777
|
+
const lines = [];
|
|
8778
|
+
lines.push(`// Auto-generated Next.js Server Actions. Do not edit manually.`);
|
|
8779
|
+
lines.push(`"use server";`);
|
|
8780
|
+
lines.push(``);
|
|
8781
|
+
lines.push(`import { api } from './api'`);
|
|
8782
|
+
lines.push(`import { cookies } from 'next/headers'`);
|
|
8783
|
+
lines.push(``);
|
|
8784
|
+
lines.push(`// Helper to auto-inject token from cookies if available`);
|
|
8785
|
+
lines.push(`async function getAuthHeaders() {`);
|
|
8786
|
+
lines.push(` const cookieStore = await cookies()`);
|
|
8787
|
+
lines.push(` const token = cookieStore.get('token')?.value`);
|
|
8788
|
+
lines.push(` return token ? { Authorization: \`Bearer \${token}\` } : {}`);
|
|
8789
|
+
lines.push(`}`);
|
|
8790
|
+
lines.push(``);
|
|
8791
|
+
for (const route of manifest.routes) {
|
|
8792
|
+
const actionName = toMethodName(route);
|
|
8793
|
+
lines.push(`export async function ${actionName}Action(payload?: any) {`);
|
|
8794
|
+
const args = [];
|
|
8795
|
+
if (route.method === "GET") {
|
|
8796
|
+
args.push(`query: payload`);
|
|
8797
|
+
} else {
|
|
8798
|
+
args.push(`body: payload`);
|
|
8799
|
+
}
|
|
8800
|
+
if (route.auth) {
|
|
8801
|
+
args.push(`headers: await getAuthHeaders()`);
|
|
8802
|
+
}
|
|
8803
|
+
const apiCall = `await api.${route.name.split(".")[0]}.${route.name.split(".")[1] || "action"}({ ${args.join(", ")} })`;
|
|
8804
|
+
lines.push(` try {`);
|
|
8805
|
+
lines.push(` const response = ${apiCall}`);
|
|
8806
|
+
lines.push(` return { success: true, data: response.data }`);
|
|
8807
|
+
lines.push(` } catch (error: any) {`);
|
|
8808
|
+
lines.push(` return { success: false, error: error.message }`);
|
|
8809
|
+
lines.push(` }`);
|
|
8810
|
+
lines.push(`}`);
|
|
8826
8811
|
lines.push(``);
|
|
8827
|
-
for (const route of routes) {
|
|
8828
|
-
if (route.method === "GET") continue;
|
|
8829
|
-
const actionName = toMethodName(route);
|
|
8830
|
-
const payloadType = route.schema && Object.keys(route.schema).length > 0 ? toTypeName(actionName + "Payload") : "any";
|
|
8831
|
-
lines.push(`export async function ${actionName}Action(data: ${payloadType}) {`);
|
|
8832
|
-
if (route.auth) {
|
|
8833
|
-
lines.push(` const headers = await getAuthHeaders()`);
|
|
8834
|
-
lines.push(` // Note: SDK must support passing headers if used server-side`);
|
|
8835
|
-
lines.push(` // e.g. api.${group}.${actionName}(data, { headers })`);
|
|
8836
|
-
}
|
|
8837
|
-
lines.push(` return api.${group}.${actionName}(data)`);
|
|
8838
|
-
lines.push(`}`);
|
|
8839
|
-
lines.push(``);
|
|
8840
|
-
}
|
|
8841
|
-
await import_fs_extra6.default.writeFile(import_path5.default.join(resourceDir, "actions.generated.ts"), lines.join("\n"));
|
|
8842
|
-
}
|
|
8843
|
-
const rootActions = [];
|
|
8844
|
-
rootActions.push(`// Auto-generated. Do not edit.`);
|
|
8845
|
-
for (const group of Object.keys(grouped)) {
|
|
8846
|
-
rootActions.push(`export * from './${group}/services/actions.generated'`);
|
|
8847
8812
|
}
|
|
8848
|
-
await import_fs_extra6.default.writeFile(import_path5.default.join(outputDir, "actions.ts"),
|
|
8813
|
+
await import_fs_extra6.default.writeFile(import_path5.default.join(outputDir, "actions.ts"), lines.join("\n"));
|
|
8849
8814
|
}
|
|
8850
8815
|
};
|
|
8851
8816
|
|
|
@@ -8854,55 +8819,32 @@ var import_path6 = __toESM(require("path"));
|
|
|
8854
8819
|
var import_fs_extra7 = __toESM(require_lib());
|
|
8855
8820
|
var MswGenerator = class {
|
|
8856
8821
|
static async generate(manifest, outputDir) {
|
|
8857
|
-
const
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
const
|
|
8862
|
-
for (const
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
lines.push(`import { http, HttpResponse } from 'msw'`);
|
|
8878
|
-
lines.push(``);
|
|
8879
|
-
lines.push(`export const ${group}Mocks = [`);
|
|
8880
|
-
for (const route of routes) {
|
|
8881
|
-
const method = route.method.toLowerCase();
|
|
8882
|
-
const path10 = route.runtimePath.replace(/\{([^}]+)\}/g, ":$1");
|
|
8883
|
-
lines.push(` http.${method}('http://localhost:8000/api${path10}', () => {`);
|
|
8884
|
-
lines.push(` return HttpResponse.json({`);
|
|
8885
|
-
lines.push(` message: 'Mocked response for ${route.actionName}',`);
|
|
8886
|
-
lines.push(` data: {}`);
|
|
8887
|
-
lines.push(` })`);
|
|
8888
|
-
lines.push(` }),`);
|
|
8889
|
-
}
|
|
8890
|
-
lines.push(`]`);
|
|
8891
|
-
await import_fs_extra7.default.writeFile(import_path6.default.join(resourceDir, "mocks.generated.ts"), lines.join("\n"));
|
|
8892
|
-
}
|
|
8893
|
-
const rootMocks = [];
|
|
8894
|
-
rootMocks.push(`// Auto-generated. Do not edit.`);
|
|
8895
|
-
for (const group of Object.keys(grouped)) {
|
|
8896
|
-
rootMocks.push(`export * from './${group}/services/mocks.generated'`);
|
|
8897
|
-
}
|
|
8898
|
-
await import_fs_extra7.default.writeFile(import_path6.default.join(outputDir, "mocks.ts"), rootMocks.join("\n"));
|
|
8822
|
+
const lines = [];
|
|
8823
|
+
lines.push(`// Auto-generated MSW Mocks. Do not edit manually.`);
|
|
8824
|
+
lines.push(`import { http, HttpResponse, delay } from 'msw'`);
|
|
8825
|
+
lines.push(``);
|
|
8826
|
+
lines.push(`export const handlers = [`);
|
|
8827
|
+
for (const route of manifest.routes) {
|
|
8828
|
+
const mswMethod = route.method.toLowerCase();
|
|
8829
|
+
const mswPath = manifest.baseURL + route.path.replace(/\{([^}]+)\}/g, ":$1");
|
|
8830
|
+
const actionName = toMethodName(route);
|
|
8831
|
+
lines.push(" http." + mswMethod + "('" + mswPath + "', async ({ request, params }) => {");
|
|
8832
|
+
lines.push(` await delay(300) // Simulated network latency`);
|
|
8833
|
+
lines.push(` return HttpResponse.json({`);
|
|
8834
|
+
lines.push(` success: true,`);
|
|
8835
|
+
lines.push(` message: 'Mocked response for ${actionName}',`);
|
|
8836
|
+
lines.push(` data: {} // TODO: Add mock data based on your schema`);
|
|
8837
|
+
lines.push(` })`);
|
|
8838
|
+
lines.push(` }),`);
|
|
8839
|
+
}
|
|
8840
|
+
lines.push(`]`);
|
|
8841
|
+
await import_fs_extra7.default.writeFile(import_path6.default.join(outputDir, "mocks.ts"), lines.join("\n"));
|
|
8899
8842
|
}
|
|
8900
8843
|
};
|
|
8901
8844
|
|
|
8902
8845
|
// packages/cli/src/generators/EchoGenerator.ts
|
|
8903
8846
|
var import_fs_extra8 = __toESM(require_lib());
|
|
8904
8847
|
var import_path7 = __toESM(require("path"));
|
|
8905
|
-
init_names();
|
|
8906
8848
|
var EchoGenerator = class {
|
|
8907
8849
|
static async generate(channels, outputDir) {
|
|
8908
8850
|
if (channels.length === 0) return;
|
|
@@ -8913,61 +8855,38 @@ var EchoGenerator = class {
|
|
|
8913
8855
|
lines.push(``);
|
|
8914
8856
|
lines.push(`// Ensure you have configured window.Echo somewhere in your app`);
|
|
8915
8857
|
lines.push(``);
|
|
8916
|
-
const grouped = {};
|
|
8917
8858
|
for (const channel of channels) {
|
|
8918
|
-
const
|
|
8919
|
-
const
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
const params = [...channel.name.matchAll(/\\{([^}]+)\\}/g)].map((m) => m[1]);
|
|
8942
|
-
const paramArgs = params.length > 0 ? params.map((p) => p + ": string | number").join(", ") + ", " : "";
|
|
8943
|
-
const runtimeChannelName = channel.name.replace(/\\{([^}]+)\\}/g, "${$1}");
|
|
8944
|
-
lines2.push("export function " + hookName + "(" + paramArgs + "eventName: string, callback: (event: any) => void) {");
|
|
8945
|
-
lines2.push(` useEffect(() => {`);
|
|
8946
|
-
lines2.push(` if (typeof window === 'undefined' || !(window as any).Echo) return`);
|
|
8947
|
-
lines2.push(` `);
|
|
8948
|
-
lines2.push(` const echo: Echo = (window as any).Echo`);
|
|
8949
|
-
const channelMethod = channel.isPrivate ? "private" : "channel";
|
|
8950
|
-
lines2.push(" const channelInstance = echo." + channelMethod + "(`" + runtimeChannelName + "`)");
|
|
8951
|
-
lines2.push(` channelInstance.listen(eventName, callback)`);
|
|
8952
|
-
lines2.push(` `);
|
|
8953
|
-
lines2.push(` return () => {`);
|
|
8954
|
-
lines2.push(` channelInstance.stopListening(eventName, callback)`);
|
|
8955
|
-
lines2.push(` }`);
|
|
8956
|
-
const deps = params.join(", ");
|
|
8957
|
-
const allDeps = deps ? "[" + deps + ", eventName, callback]" : "[eventName, callback]";
|
|
8958
|
-
lines2.push(" }, " + allDeps + ")");
|
|
8959
|
-
lines2.push(`}`);
|
|
8960
|
-
lines2.push(``);
|
|
8961
|
-
}
|
|
8962
|
-
await import_fs_extra8.default.writeFile(import_path7.default.join(resourceDir, "echo.generated.ts"), lines2.join("\n"));
|
|
8859
|
+
const nameParts = channel.name.replace(/\\{[^}]+\\}/g, "").split(".").filter(Boolean);
|
|
8860
|
+
const hookName = "useListen" + toTypeName(nameParts.join(" ")) + "Channel";
|
|
8861
|
+
const params = [...channel.name.matchAll(/\\{([^}]+)\\}/g)].map((m) => m[1]);
|
|
8862
|
+
const paramArgs = params.length > 0 ? params.map((p) => p + ": string | number").join(", ") + ", " : "";
|
|
8863
|
+
const runtimeChannelName = channel.name.replace(/\\{([^}]+)\\}/g, "${$1}");
|
|
8864
|
+
lines.push("export function " + hookName + "(" + paramArgs + "eventName: string, callback: (event: any) => void) {");
|
|
8865
|
+
lines.push(` useEffect(() => {`);
|
|
8866
|
+
lines.push(` if (typeof window === 'undefined' || !(window as any).Echo) return`);
|
|
8867
|
+
lines.push(` `);
|
|
8868
|
+
lines.push(` const echo: Echo = (window as any).Echo`);
|
|
8869
|
+
const channelMethod = channel.isPrivate ? "private" : "channel";
|
|
8870
|
+
lines.push(" const channelInstance = echo." + channelMethod + "(`" + runtimeChannelName + "`)");
|
|
8871
|
+
lines.push(` channelInstance.listen(eventName, callback)`);
|
|
8872
|
+
lines.push(` `);
|
|
8873
|
+
lines.push(` return () => {`);
|
|
8874
|
+
lines.push(` channelInstance.stopListening(eventName, callback)`);
|
|
8875
|
+
lines.push(` // Optionally echo.leave(...)`);
|
|
8876
|
+
lines.push(` }`);
|
|
8877
|
+
const deps = params.join(", ");
|
|
8878
|
+
const allDeps = deps ? "[" + deps + ", eventName, callback]" : "[eventName, callback]";
|
|
8879
|
+
lines.push(" }, " + allDeps + ")");
|
|
8880
|
+
lines.push(`}`);
|
|
8881
|
+
lines.push(``);
|
|
8963
8882
|
}
|
|
8883
|
+
await import_fs_extra8.default.writeFile(import_path7.default.join(outputDir, "echo.ts"), lines.join("\n"));
|
|
8964
8884
|
}
|
|
8965
8885
|
};
|
|
8966
8886
|
|
|
8967
8887
|
// packages/cli/src/generators/IndexGenerator.ts
|
|
8968
8888
|
var import_path8 = __toESM(require("path"));
|
|
8969
8889
|
var import_fs_extra9 = __toESM(require_lib());
|
|
8970
|
-
init_names();
|
|
8971
8890
|
var IndexGenerator = class {
|
|
8972
8891
|
static async generate(manifest, outputDir, options) {
|
|
8973
8892
|
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
@@ -8982,17 +8901,58 @@ var IndexGenerator = class {
|
|
|
8982
8901
|
};
|
|
8983
8902
|
|
|
8984
8903
|
// packages/cli/src/commands/generate.ts
|
|
8904
|
+
var import_fs_extra11 = __toESM(require_lib());
|
|
8905
|
+
|
|
8906
|
+
// packages/cli/src/generators/ModelGenerator.ts
|
|
8985
8907
|
var import_fs_extra10 = __toESM(require_lib());
|
|
8908
|
+
var import_path9 = __toESM(require("path"));
|
|
8909
|
+
var ModelGenerator = class {
|
|
8910
|
+
static async generate(manifest, outputDir) {
|
|
8911
|
+
if (!manifest.models || manifest.models.length === 0) return;
|
|
8912
|
+
const coreDir = import_path9.default.join(outputDir, "core");
|
|
8913
|
+
await import_fs_extra10.default.ensureDir(coreDir);
|
|
8914
|
+
const lines = [];
|
|
8915
|
+
lines.push(`// Auto-generated. Do not edit.`);
|
|
8916
|
+
lines.push(``);
|
|
8917
|
+
for (const model of manifest.models) {
|
|
8918
|
+
lines.push(`export interface ${model.name} {`);
|
|
8919
|
+
for (const col of model.columns) {
|
|
8920
|
+
const tsType = this.mapSqlTypeToTs(col.type);
|
|
8921
|
+
const nullable = col.nullable ? " | null" : "";
|
|
8922
|
+
const isOptional = col.name === "password" || col.name === "remember_token" ? "?" : "";
|
|
8923
|
+
lines.push(` ${col.name}${isOptional}: ${tsType}${nullable}`);
|
|
8924
|
+
}
|
|
8925
|
+
lines.push(`}`);
|
|
8926
|
+
lines.push(``);
|
|
8927
|
+
}
|
|
8928
|
+
await import_fs_extra10.default.writeFile(import_path9.default.join(coreDir, "models.ts"), lines.join("\n"));
|
|
8929
|
+
}
|
|
8930
|
+
static mapSqlTypeToTs(sqlType) {
|
|
8931
|
+
const type = sqlType.toLowerCase();
|
|
8932
|
+
if (type.includes("int") || type.includes("float") || type.includes("double") || type.includes("decimal") || type.includes("numeric")) {
|
|
8933
|
+
return "number";
|
|
8934
|
+
}
|
|
8935
|
+
if (type.includes("bool") || type.includes("tinyint(1)")) {
|
|
8936
|
+
return "boolean";
|
|
8937
|
+
}
|
|
8938
|
+
if (type.includes("json")) {
|
|
8939
|
+
return "any";
|
|
8940
|
+
}
|
|
8941
|
+
return "string";
|
|
8942
|
+
}
|
|
8943
|
+
};
|
|
8944
|
+
|
|
8945
|
+
// packages/cli/src/commands/generate.ts
|
|
8986
8946
|
var generateCommand = new Command("generate").description("Generate typed SDK, types, and hooks from route manifest").option("-m, --manifest <path>", "Path to route manifest", "routesync.manifest.json").option("-o, --output <path>", "Output directory", "src/api").option("--no-hooks", "Skip generating React hooks").option("--next-actions", "Generate Next.js Server Actions").option("--msw", "Generate MSW Mock Handlers").option("--echo", "Generate Laravel Echo Hooks").action(async (options) => {
|
|
8987
8947
|
const spinner = ora("Generating SDK...").start();
|
|
8988
8948
|
try {
|
|
8989
|
-
if (!
|
|
8949
|
+
if (!import_fs_extra11.default.existsSync(options.manifest)) {
|
|
8990
8950
|
throw new Error(
|
|
8991
8951
|
`Manifest not found: ${options.manifest}. Run 'routesync scan' first.`
|
|
8992
8952
|
);
|
|
8993
8953
|
}
|
|
8994
|
-
const manifest = await
|
|
8995
|
-
await
|
|
8954
|
+
const manifest = await import_fs_extra11.default.readJson(options.manifest);
|
|
8955
|
+
await import_fs_extra11.default.ensureDir(options.output);
|
|
8996
8956
|
spinner.text = "Generating types...";
|
|
8997
8957
|
await TypeGenerator.generate(manifest, options.output);
|
|
8998
8958
|
spinner.text = "Generating SDK...";
|
|
@@ -9013,6 +8973,10 @@ var generateCommand = new Command("generate").description("Generate typed SDK, t
|
|
|
9013
8973
|
spinner.text = "Generating Echo Hooks...";
|
|
9014
8974
|
await EchoGenerator.generate(manifest.channels, options.output);
|
|
9015
8975
|
}
|
|
8976
|
+
if (manifest.models) {
|
|
8977
|
+
spinner.text = "Generating DB Models...";
|
|
8978
|
+
await ModelGenerator.generate(manifest, options.output);
|
|
8979
|
+
}
|
|
9016
8980
|
spinner.text = "Generating Index Files...";
|
|
9017
8981
|
await IndexGenerator.generate(manifest, options.output, options);
|
|
9018
8982
|
spinner.succeed(source_default.green(`SDK generated \u2192 ${options.output}`));
|
|
@@ -9030,6 +8994,9 @@ var generateCommand = new Command("generate").description("Generate typed SDK, t
|
|
|
9030
8994
|
if (options.echo && manifest.channels) {
|
|
9031
8995
|
console.log(` ${source_default.cyan("echo.ts")} Laravel Echo Hooks`);
|
|
9032
8996
|
}
|
|
8997
|
+
if (manifest.models && manifest.models.length > 0) {
|
|
8998
|
+
console.log(` ${source_default.cyan("models.ts")} Eloquent Database Models`);
|
|
8999
|
+
}
|
|
9033
9000
|
} catch (err) {
|
|
9034
9001
|
spinner.fail(source_default.red(`Generate failed: ${err.message}`));
|
|
9035
9002
|
process.exit(1);
|
|
@@ -9037,13 +9004,13 @@ var generateCommand = new Command("generate").description("Generate typed SDK, t
|
|
|
9037
9004
|
});
|
|
9038
9005
|
|
|
9039
9006
|
// packages/cli/src/parsers/LaravelChannelParser.ts
|
|
9040
|
-
var
|
|
9007
|
+
var import_fs_extra12 = __toESM(require_lib());
|
|
9041
9008
|
var LaravelChannelParser = class {
|
|
9042
9009
|
async parse(channelFilePath = "routes/channels.php") {
|
|
9043
|
-
if (!
|
|
9010
|
+
if (!import_fs_extra12.default.existsSync(channelFilePath)) {
|
|
9044
9011
|
return [];
|
|
9045
9012
|
}
|
|
9046
|
-
const content = await
|
|
9013
|
+
const content = await import_fs_extra12.default.readFile(channelFilePath, "utf-8");
|
|
9047
9014
|
const channels = [];
|
|
9048
9015
|
const regex2 = new RegExp(`Broadcast::channel\\(\\s*['"]([^'"]+)['"]`, "g");
|
|
9049
9016
|
let match;
|
|
@@ -9061,8 +9028,8 @@ var LaravelChannelParser = class {
|
|
|
9061
9028
|
};
|
|
9062
9029
|
|
|
9063
9030
|
// packages/cli/src/commands/sync.ts
|
|
9064
|
-
var
|
|
9065
|
-
var syncCommand = new Command("sync").description("Scan routes and generate SDK in one step").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output directory", "src/api").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").option("--no-hooks", "Skip generating React hooks").option("--next-actions", "Generate Next.js Server Actions").option("--msw", "Generate MSW Mock Handlers").option("--echo", "Generate Laravel Echo Hooks").action(async (options) => {
|
|
9031
|
+
var import_fs_extra13 = __toESM(require_lib());
|
|
9032
|
+
var syncCommand = new Command("sync").description("Scan routes and generate SDK in one step").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output directory", "src/api").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").option("--no-hooks", "Skip generating React hooks").option("--next-actions", "Generate Next.js Server Actions").option("--msw", "Generate MSW Mock Handlers").option("--echo", "Generate Laravel Echo Hooks").option("--models", "Extract Database Schema via Eloquent Models").action(async (options) => {
|
|
9066
9033
|
console.log(source_default.bold.blue("\n routesync sync\n"));
|
|
9067
9034
|
const steps = [
|
|
9068
9035
|
{ text: "Scanning Laravel routes" },
|
|
@@ -9074,12 +9041,13 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
9074
9041
|
const spinner = ora(steps[0].text).start();
|
|
9075
9042
|
try {
|
|
9076
9043
|
const parser = new LaravelRouteParser();
|
|
9077
|
-
const routes = await parser.parse(options.input);
|
|
9044
|
+
const { routes, models } = await parser.parse(options.input, { extractModels: options.models });
|
|
9078
9045
|
const channelParser = new LaravelChannelParser();
|
|
9079
9046
|
const channels = options.echo ? await channelParser.parse("routes/channels.php") : [];
|
|
9080
9047
|
const manifest = ManifestGenerator.generate(routes, options.baseURL, channels);
|
|
9081
|
-
|
|
9082
|
-
|
|
9048
|
+
if (options.models) manifest.models = models;
|
|
9049
|
+
spinner.succeed(source_default.green(`\u2714 ${steps[0].text} (${routes.length} routes, ${channels.length} channels, ${models.length} models)`));
|
|
9050
|
+
await import_fs_extra13.default.ensureDir(options.output);
|
|
9083
9051
|
spinner.start(steps[1].text);
|
|
9084
9052
|
await TypeGenerator.generate(manifest, options.output);
|
|
9085
9053
|
spinner.succeed(source_default.green(`\u2714 ${steps[1].text}`));
|
|
@@ -9106,6 +9074,11 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
9106
9074
|
await EchoGenerator.generate(manifest.channels, options.output);
|
|
9107
9075
|
spinner.succeed(source_default.green(`\u2714 Generating Echo Hooks`));
|
|
9108
9076
|
}
|
|
9077
|
+
if (options.models && manifest.models) {
|
|
9078
|
+
spinner.start("Generating DB Models");
|
|
9079
|
+
await ModelGenerator.generate(manifest, options.output);
|
|
9080
|
+
spinner.succeed(source_default.green(`\u2714 Generating DB Models`));
|
|
9081
|
+
}
|
|
9109
9082
|
spinner.start("Generating Index Files");
|
|
9110
9083
|
await IndexGenerator.generate(manifest, options.output, options);
|
|
9111
9084
|
spinner.succeed(source_default.green(`\u2714 Generating Index Files`));
|
|
@@ -9118,8 +9091,8 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
9118
9091
|
});
|
|
9119
9092
|
|
|
9120
9093
|
// packages/cli/src/commands/watch.ts
|
|
9121
|
-
var
|
|
9122
|
-
var
|
|
9094
|
+
var import_fs_extra14 = __toESM(require_lib());
|
|
9095
|
+
var import_path10 = __toESM(require("path"));
|
|
9123
9096
|
var watchCommand = new Command("watch").description("Watch routes file and re-sync on changes").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output directory", "src/api").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").action(async (options) => {
|
|
9124
9097
|
console.log(source_default.bold.blue("\n routesync watch\n"));
|
|
9125
9098
|
console.log(` Watching: ${source_default.cyan(options.input)}`);
|
|
@@ -9140,11 +9113,11 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
|
|
|
9140
9113
|
}
|
|
9141
9114
|
}, 300);
|
|
9142
9115
|
};
|
|
9143
|
-
if (!
|
|
9116
|
+
if (!import_fs_extra14.default.existsSync(options.input)) {
|
|
9144
9117
|
console.error(source_default.red(` File not found: ${options.input}`));
|
|
9145
9118
|
process.exit(1);
|
|
9146
9119
|
}
|
|
9147
|
-
|
|
9120
|
+
import_fs_extra14.default.watch(import_path10.default.resolve(options.input), onChange);
|
|
9148
9121
|
});
|
|
9149
9122
|
|
|
9150
9123
|
// packages/cli/src/index.ts
|