routesync 1.0.1 → 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 +849 -477
- package/dist/core.d.mts +23 -1
- package/dist/core.d.ts +23 -1
- package/dist/core.js +50 -3
- package/dist/core.mjs +50 -3
- package/dist/sdk.d.mts +4 -0
- package/dist/sdk.d.ts +4 -0
- package/dist/sdk.js +50 -3
- package/dist/sdk.mjs +50 -3
- package/dist/vue.d.mts +4 -0
- package/dist/vue.d.ts +4 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -983,8 +983,8 @@ var require_command = __commonJS({
|
|
|
983
983
|
"use strict";
|
|
984
984
|
var EventEmitter = require("events").EventEmitter;
|
|
985
985
|
var childProcess = require("child_process");
|
|
986
|
-
var
|
|
987
|
-
var
|
|
986
|
+
var path11 = require("path");
|
|
987
|
+
var fs15 = require("fs");
|
|
988
988
|
var process10 = require("process");
|
|
989
989
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
990
990
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1916,11 +1916,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1916
1916
|
let launchWithNode = false;
|
|
1917
1917
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1918
1918
|
function findFile(baseDir, baseName) {
|
|
1919
|
-
const localBin =
|
|
1920
|
-
if (
|
|
1921
|
-
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;
|
|
1922
1922
|
const foundExt = sourceExt.find(
|
|
1923
|
-
(ext) =>
|
|
1923
|
+
(ext) => fs15.existsSync(`${localBin}${ext}`)
|
|
1924
1924
|
);
|
|
1925
1925
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1926
1926
|
return void 0;
|
|
@@ -1932,21 +1932,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1932
1932
|
if (this._scriptPath) {
|
|
1933
1933
|
let resolvedScriptPath;
|
|
1934
1934
|
try {
|
|
1935
|
-
resolvedScriptPath =
|
|
1935
|
+
resolvedScriptPath = fs15.realpathSync(this._scriptPath);
|
|
1936
1936
|
} catch (err) {
|
|
1937
1937
|
resolvedScriptPath = this._scriptPath;
|
|
1938
1938
|
}
|
|
1939
|
-
executableDir =
|
|
1940
|
-
|
|
1939
|
+
executableDir = path11.resolve(
|
|
1940
|
+
path11.dirname(resolvedScriptPath),
|
|
1941
1941
|
executableDir
|
|
1942
1942
|
);
|
|
1943
1943
|
}
|
|
1944
1944
|
if (executableDir) {
|
|
1945
1945
|
let localFile = findFile(executableDir, executableFile);
|
|
1946
1946
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1947
|
-
const legacyName =
|
|
1947
|
+
const legacyName = path11.basename(
|
|
1948
1948
|
this._scriptPath,
|
|
1949
|
-
|
|
1949
|
+
path11.extname(this._scriptPath)
|
|
1950
1950
|
);
|
|
1951
1951
|
if (legacyName !== this._name) {
|
|
1952
1952
|
localFile = findFile(
|
|
@@ -1957,7 +1957,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1957
1957
|
}
|
|
1958
1958
|
executableFile = localFile || executableFile;
|
|
1959
1959
|
}
|
|
1960
|
-
launchWithNode = sourceExt.includes(
|
|
1960
|
+
launchWithNode = sourceExt.includes(path11.extname(executableFile));
|
|
1961
1961
|
let proc;
|
|
1962
1962
|
if (process10.platform !== "win32") {
|
|
1963
1963
|
if (launchWithNode) {
|
|
@@ -2797,7 +2797,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2797
2797
|
* @return {Command}
|
|
2798
2798
|
*/
|
|
2799
2799
|
nameFromFilename(filename) {
|
|
2800
|
-
this._name =
|
|
2800
|
+
this._name = path11.basename(filename, path11.extname(filename));
|
|
2801
2801
|
return this;
|
|
2802
2802
|
}
|
|
2803
2803
|
/**
|
|
@@ -2811,9 +2811,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2811
2811
|
* @param {string} [path]
|
|
2812
2812
|
* @return {(string|null|Command)}
|
|
2813
2813
|
*/
|
|
2814
|
-
executableDir(
|
|
2815
|
-
if (
|
|
2816
|
-
this._executableDir =
|
|
2814
|
+
executableDir(path12) {
|
|
2815
|
+
if (path12 === void 0) return this._executableDir;
|
|
2816
|
+
this._executableDir = path12;
|
|
2817
2817
|
return this;
|
|
2818
2818
|
}
|
|
2819
2819
|
/**
|
|
@@ -4744,54 +4744,54 @@ var require_polyfills = __commonJS({
|
|
|
4744
4744
|
}
|
|
4745
4745
|
var chdir;
|
|
4746
4746
|
module2.exports = patch;
|
|
4747
|
-
function patch(
|
|
4747
|
+
function patch(fs15) {
|
|
4748
4748
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
4749
|
-
patchLchmod(
|
|
4750
|
-
}
|
|
4751
|
-
if (!
|
|
4752
|
-
patchLutimes(
|
|
4753
|
-
}
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
if (
|
|
4773
|
-
|
|
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) {
|
|
4774
4774
|
if (cb) process.nextTick(cb);
|
|
4775
4775
|
};
|
|
4776
|
-
|
|
4776
|
+
fs15.lchmodSync = function() {
|
|
4777
4777
|
};
|
|
4778
4778
|
}
|
|
4779
|
-
if (
|
|
4780
|
-
|
|
4779
|
+
if (fs15.chown && !fs15.lchown) {
|
|
4780
|
+
fs15.lchown = function(path11, uid, gid, cb) {
|
|
4781
4781
|
if (cb) process.nextTick(cb);
|
|
4782
4782
|
};
|
|
4783
|
-
|
|
4783
|
+
fs15.lchownSync = function() {
|
|
4784
4784
|
};
|
|
4785
4785
|
}
|
|
4786
4786
|
if (platform === "win32") {
|
|
4787
|
-
|
|
4787
|
+
fs15.rename = typeof fs15.rename !== "function" ? fs15.rename : (function(fs$rename) {
|
|
4788
4788
|
function rename(from, to, cb) {
|
|
4789
4789
|
var start = Date.now();
|
|
4790
4790
|
var backoff = 0;
|
|
4791
4791
|
fs$rename(from, to, function CB(er) {
|
|
4792
4792
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
4793
4793
|
setTimeout(function() {
|
|
4794
|
-
|
|
4794
|
+
fs15.stat(to, function(stater, st) {
|
|
4795
4795
|
if (stater && stater.code === "ENOENT")
|
|
4796
4796
|
fs$rename(from, to, CB);
|
|
4797
4797
|
else
|
|
@@ -4807,9 +4807,9 @@ var require_polyfills = __commonJS({
|
|
|
4807
4807
|
}
|
|
4808
4808
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
4809
4809
|
return rename;
|
|
4810
|
-
})(
|
|
4810
|
+
})(fs15.rename);
|
|
4811
4811
|
}
|
|
4812
|
-
|
|
4812
|
+
fs15.read = typeof fs15.read !== "function" ? fs15.read : (function(fs$read) {
|
|
4813
4813
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
4814
4814
|
var callback;
|
|
4815
4815
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -4817,22 +4817,22 @@ var require_polyfills = __commonJS({
|
|
|
4817
4817
|
callback = function(er, _, __) {
|
|
4818
4818
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
4819
4819
|
eagCounter++;
|
|
4820
|
-
return fs$read.call(
|
|
4820
|
+
return fs$read.call(fs15, fd, buffer, offset, length, position, callback);
|
|
4821
4821
|
}
|
|
4822
4822
|
callback_.apply(this, arguments);
|
|
4823
4823
|
};
|
|
4824
4824
|
}
|
|
4825
|
-
return fs$read.call(
|
|
4825
|
+
return fs$read.call(fs15, fd, buffer, offset, length, position, callback);
|
|
4826
4826
|
}
|
|
4827
4827
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
4828
4828
|
return read;
|
|
4829
|
-
})(
|
|
4830
|
-
|
|
4829
|
+
})(fs15.read);
|
|
4830
|
+
fs15.readSync = typeof fs15.readSync !== "function" ? fs15.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
4831
4831
|
return function(fd, buffer, offset, length, position) {
|
|
4832
4832
|
var eagCounter = 0;
|
|
4833
4833
|
while (true) {
|
|
4834
4834
|
try {
|
|
4835
|
-
return fs$readSync.call(
|
|
4835
|
+
return fs$readSync.call(fs15, fd, buffer, offset, length, position);
|
|
4836
4836
|
} catch (er) {
|
|
4837
4837
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
4838
4838
|
eagCounter++;
|
|
@@ -4842,11 +4842,11 @@ var require_polyfills = __commonJS({
|
|
|
4842
4842
|
}
|
|
4843
4843
|
}
|
|
4844
4844
|
};
|
|
4845
|
-
})(
|
|
4846
|
-
function patchLchmod(
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4845
|
+
})(fs15.readSync);
|
|
4846
|
+
function patchLchmod(fs16) {
|
|
4847
|
+
fs16.lchmod = function(path11, mode, callback) {
|
|
4848
|
+
fs16.open(
|
|
4849
|
+
path11,
|
|
4850
4850
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
4851
4851
|
mode,
|
|
4852
4852
|
function(err, fd) {
|
|
@@ -4854,80 +4854,80 @@ var require_polyfills = __commonJS({
|
|
|
4854
4854
|
if (callback) callback(err);
|
|
4855
4855
|
return;
|
|
4856
4856
|
}
|
|
4857
|
-
|
|
4858
|
-
|
|
4857
|
+
fs16.fchmod(fd, mode, function(err2) {
|
|
4858
|
+
fs16.close(fd, function(err22) {
|
|
4859
4859
|
if (callback) callback(err2 || err22);
|
|
4860
4860
|
});
|
|
4861
4861
|
});
|
|
4862
4862
|
}
|
|
4863
4863
|
);
|
|
4864
4864
|
};
|
|
4865
|
-
|
|
4866
|
-
var fd =
|
|
4865
|
+
fs16.lchmodSync = function(path11, mode) {
|
|
4866
|
+
var fd = fs16.openSync(path11, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
4867
4867
|
var threw = true;
|
|
4868
4868
|
var ret;
|
|
4869
4869
|
try {
|
|
4870
|
-
ret =
|
|
4870
|
+
ret = fs16.fchmodSync(fd, mode);
|
|
4871
4871
|
threw = false;
|
|
4872
4872
|
} finally {
|
|
4873
4873
|
if (threw) {
|
|
4874
4874
|
try {
|
|
4875
|
-
|
|
4875
|
+
fs16.closeSync(fd);
|
|
4876
4876
|
} catch (er) {
|
|
4877
4877
|
}
|
|
4878
4878
|
} else {
|
|
4879
|
-
|
|
4879
|
+
fs16.closeSync(fd);
|
|
4880
4880
|
}
|
|
4881
4881
|
}
|
|
4882
4882
|
return ret;
|
|
4883
4883
|
};
|
|
4884
4884
|
}
|
|
4885
|
-
function patchLutimes(
|
|
4886
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
4887
|
-
|
|
4888
|
-
|
|
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) {
|
|
4889
4889
|
if (er) {
|
|
4890
4890
|
if (cb) cb(er);
|
|
4891
4891
|
return;
|
|
4892
4892
|
}
|
|
4893
|
-
|
|
4894
|
-
|
|
4893
|
+
fs16.futimes(fd, at, mt, function(er2) {
|
|
4894
|
+
fs16.close(fd, function(er22) {
|
|
4895
4895
|
if (cb) cb(er2 || er22);
|
|
4896
4896
|
});
|
|
4897
4897
|
});
|
|
4898
4898
|
});
|
|
4899
4899
|
};
|
|
4900
|
-
|
|
4901
|
-
var fd =
|
|
4900
|
+
fs16.lutimesSync = function(path11, at, mt) {
|
|
4901
|
+
var fd = fs16.openSync(path11, constants.O_SYMLINK);
|
|
4902
4902
|
var ret;
|
|
4903
4903
|
var threw = true;
|
|
4904
4904
|
try {
|
|
4905
|
-
ret =
|
|
4905
|
+
ret = fs16.futimesSync(fd, at, mt);
|
|
4906
4906
|
threw = false;
|
|
4907
4907
|
} finally {
|
|
4908
4908
|
if (threw) {
|
|
4909
4909
|
try {
|
|
4910
|
-
|
|
4910
|
+
fs16.closeSync(fd);
|
|
4911
4911
|
} catch (er) {
|
|
4912
4912
|
}
|
|
4913
4913
|
} else {
|
|
4914
|
-
|
|
4914
|
+
fs16.closeSync(fd);
|
|
4915
4915
|
}
|
|
4916
4916
|
}
|
|
4917
4917
|
return ret;
|
|
4918
4918
|
};
|
|
4919
|
-
} else if (
|
|
4920
|
-
|
|
4919
|
+
} else if (fs16.futimes) {
|
|
4920
|
+
fs16.lutimes = function(_a, _b, _c, cb) {
|
|
4921
4921
|
if (cb) process.nextTick(cb);
|
|
4922
4922
|
};
|
|
4923
|
-
|
|
4923
|
+
fs16.lutimesSync = function() {
|
|
4924
4924
|
};
|
|
4925
4925
|
}
|
|
4926
4926
|
}
|
|
4927
4927
|
function chmodFix(orig) {
|
|
4928
4928
|
if (!orig) return orig;
|
|
4929
4929
|
return function(target, mode, cb) {
|
|
4930
|
-
return orig.call(
|
|
4930
|
+
return orig.call(fs15, target, mode, function(er) {
|
|
4931
4931
|
if (chownErOk(er)) er = null;
|
|
4932
4932
|
if (cb) cb.apply(this, arguments);
|
|
4933
4933
|
});
|
|
@@ -4937,7 +4937,7 @@ var require_polyfills = __commonJS({
|
|
|
4937
4937
|
if (!orig) return orig;
|
|
4938
4938
|
return function(target, mode) {
|
|
4939
4939
|
try {
|
|
4940
|
-
return orig.call(
|
|
4940
|
+
return orig.call(fs15, target, mode);
|
|
4941
4941
|
} catch (er) {
|
|
4942
4942
|
if (!chownErOk(er)) throw er;
|
|
4943
4943
|
}
|
|
@@ -4946,7 +4946,7 @@ var require_polyfills = __commonJS({
|
|
|
4946
4946
|
function chownFix(orig) {
|
|
4947
4947
|
if (!orig) return orig;
|
|
4948
4948
|
return function(target, uid, gid, cb) {
|
|
4949
|
-
return orig.call(
|
|
4949
|
+
return orig.call(fs15, target, uid, gid, function(er) {
|
|
4950
4950
|
if (chownErOk(er)) er = null;
|
|
4951
4951
|
if (cb) cb.apply(this, arguments);
|
|
4952
4952
|
});
|
|
@@ -4956,7 +4956,7 @@ var require_polyfills = __commonJS({
|
|
|
4956
4956
|
if (!orig) return orig;
|
|
4957
4957
|
return function(target, uid, gid) {
|
|
4958
4958
|
try {
|
|
4959
|
-
return orig.call(
|
|
4959
|
+
return orig.call(fs15, target, uid, gid);
|
|
4960
4960
|
} catch (er) {
|
|
4961
4961
|
if (!chownErOk(er)) throw er;
|
|
4962
4962
|
}
|
|
@@ -4976,13 +4976,13 @@ var require_polyfills = __commonJS({
|
|
|
4976
4976
|
}
|
|
4977
4977
|
if (cb) cb.apply(this, arguments);
|
|
4978
4978
|
}
|
|
4979
|
-
return options ? orig.call(
|
|
4979
|
+
return options ? orig.call(fs15, target, options, callback) : orig.call(fs15, target, callback);
|
|
4980
4980
|
};
|
|
4981
4981
|
}
|
|
4982
4982
|
function statFixSync(orig) {
|
|
4983
4983
|
if (!orig) return orig;
|
|
4984
4984
|
return function(target, options) {
|
|
4985
|
-
var stats = options ? orig.call(
|
|
4985
|
+
var stats = options ? orig.call(fs15, target, options) : orig.call(fs15, target);
|
|
4986
4986
|
if (stats) {
|
|
4987
4987
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
4988
4988
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -5012,16 +5012,16 @@ var require_legacy_streams = __commonJS({
|
|
|
5012
5012
|
"use strict";
|
|
5013
5013
|
var Stream = require("stream").Stream;
|
|
5014
5014
|
module2.exports = legacy;
|
|
5015
|
-
function legacy(
|
|
5015
|
+
function legacy(fs15) {
|
|
5016
5016
|
return {
|
|
5017
5017
|
ReadStream,
|
|
5018
5018
|
WriteStream
|
|
5019
5019
|
};
|
|
5020
|
-
function ReadStream(
|
|
5021
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
5020
|
+
function ReadStream(path11, options) {
|
|
5021
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path11, options);
|
|
5022
5022
|
Stream.call(this);
|
|
5023
5023
|
var self = this;
|
|
5024
|
-
this.path =
|
|
5024
|
+
this.path = path11;
|
|
5025
5025
|
this.fd = null;
|
|
5026
5026
|
this.readable = true;
|
|
5027
5027
|
this.paused = false;
|
|
@@ -5055,7 +5055,7 @@ var require_legacy_streams = __commonJS({
|
|
|
5055
5055
|
});
|
|
5056
5056
|
return;
|
|
5057
5057
|
}
|
|
5058
|
-
|
|
5058
|
+
fs15.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
5059
5059
|
if (err) {
|
|
5060
5060
|
self.emit("error", err);
|
|
5061
5061
|
self.readable = false;
|
|
@@ -5066,10 +5066,10 @@ var require_legacy_streams = __commonJS({
|
|
|
5066
5066
|
self._read();
|
|
5067
5067
|
});
|
|
5068
5068
|
}
|
|
5069
|
-
function WriteStream(
|
|
5070
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
5069
|
+
function WriteStream(path11, options) {
|
|
5070
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path11, options);
|
|
5071
5071
|
Stream.call(this);
|
|
5072
|
-
this.path =
|
|
5072
|
+
this.path = path11;
|
|
5073
5073
|
this.fd = null;
|
|
5074
5074
|
this.writable = true;
|
|
5075
5075
|
this.flags = "w";
|
|
@@ -5094,7 +5094,7 @@ var require_legacy_streams = __commonJS({
|
|
|
5094
5094
|
this.busy = false;
|
|
5095
5095
|
this._queue = [];
|
|
5096
5096
|
if (this.fd === null) {
|
|
5097
|
-
this._open =
|
|
5097
|
+
this._open = fs15.open;
|
|
5098
5098
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
5099
5099
|
this.flush();
|
|
5100
5100
|
}
|
|
@@ -5130,7 +5130,7 @@ var require_clone = __commonJS({
|
|
|
5130
5130
|
var require_graceful_fs = __commonJS({
|
|
5131
5131
|
"node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
|
|
5132
5132
|
"use strict";
|
|
5133
|
-
var
|
|
5133
|
+
var fs15 = require("fs");
|
|
5134
5134
|
var polyfills = require_polyfills();
|
|
5135
5135
|
var legacy = require_legacy_streams();
|
|
5136
5136
|
var clone = require_clone();
|
|
@@ -5162,12 +5162,12 @@ var require_graceful_fs = __commonJS({
|
|
|
5162
5162
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
5163
5163
|
console.error(m);
|
|
5164
5164
|
};
|
|
5165
|
-
if (!
|
|
5165
|
+
if (!fs15[gracefulQueue]) {
|
|
5166
5166
|
queue = global[gracefulQueue] || [];
|
|
5167
|
-
publishQueue(
|
|
5168
|
-
|
|
5167
|
+
publishQueue(fs15, queue);
|
|
5168
|
+
fs15.close = (function(fs$close) {
|
|
5169
5169
|
function close(fd, cb) {
|
|
5170
|
-
return fs$close.call(
|
|
5170
|
+
return fs$close.call(fs15, fd, function(err) {
|
|
5171
5171
|
if (!err) {
|
|
5172
5172
|
resetQueue();
|
|
5173
5173
|
}
|
|
@@ -5179,48 +5179,48 @@ var require_graceful_fs = __commonJS({
|
|
|
5179
5179
|
value: fs$close
|
|
5180
5180
|
});
|
|
5181
5181
|
return close;
|
|
5182
|
-
})(
|
|
5183
|
-
|
|
5182
|
+
})(fs15.close);
|
|
5183
|
+
fs15.closeSync = (function(fs$closeSync) {
|
|
5184
5184
|
function closeSync(fd) {
|
|
5185
|
-
fs$closeSync.apply(
|
|
5185
|
+
fs$closeSync.apply(fs15, arguments);
|
|
5186
5186
|
resetQueue();
|
|
5187
5187
|
}
|
|
5188
5188
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
5189
5189
|
value: fs$closeSync
|
|
5190
5190
|
});
|
|
5191
5191
|
return closeSync;
|
|
5192
|
-
})(
|
|
5192
|
+
})(fs15.closeSync);
|
|
5193
5193
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
5194
5194
|
process.on("exit", function() {
|
|
5195
|
-
debug(
|
|
5196
|
-
require("assert").equal(
|
|
5195
|
+
debug(fs15[gracefulQueue]);
|
|
5196
|
+
require("assert").equal(fs15[gracefulQueue].length, 0);
|
|
5197
5197
|
});
|
|
5198
5198
|
}
|
|
5199
5199
|
}
|
|
5200
5200
|
var queue;
|
|
5201
5201
|
if (!global[gracefulQueue]) {
|
|
5202
|
-
publishQueue(global,
|
|
5203
|
-
}
|
|
5204
|
-
module2.exports = patch(clone(
|
|
5205
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
5206
|
-
module2.exports = patch(
|
|
5207
|
-
|
|
5208
|
-
}
|
|
5209
|
-
function patch(
|
|
5210
|
-
polyfills(
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
var fs$readFile =
|
|
5215
|
-
|
|
5216
|
-
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) {
|
|
5217
5217
|
if (typeof options === "function")
|
|
5218
5218
|
cb = options, options = null;
|
|
5219
|
-
return go$readFile(
|
|
5220
|
-
function go$readFile(
|
|
5221
|
-
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) {
|
|
5222
5222
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5223
|
-
enqueue([go$readFile, [
|
|
5223
|
+
enqueue([go$readFile, [path12, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5224
5224
|
else {
|
|
5225
5225
|
if (typeof cb2 === "function")
|
|
5226
5226
|
cb2.apply(this, arguments);
|
|
@@ -5228,16 +5228,16 @@ var require_graceful_fs = __commonJS({
|
|
|
5228
5228
|
});
|
|
5229
5229
|
}
|
|
5230
5230
|
}
|
|
5231
|
-
var fs$writeFile =
|
|
5232
|
-
|
|
5233
|
-
function writeFile(
|
|
5231
|
+
var fs$writeFile = fs16.writeFile;
|
|
5232
|
+
fs16.writeFile = writeFile;
|
|
5233
|
+
function writeFile(path11, data, options, cb) {
|
|
5234
5234
|
if (typeof options === "function")
|
|
5235
5235
|
cb = options, options = null;
|
|
5236
|
-
return go$writeFile(
|
|
5237
|
-
function go$writeFile(
|
|
5238
|
-
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) {
|
|
5239
5239
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5240
|
-
enqueue([go$writeFile, [
|
|
5240
|
+
enqueue([go$writeFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5241
5241
|
else {
|
|
5242
5242
|
if (typeof cb2 === "function")
|
|
5243
5243
|
cb2.apply(this, arguments);
|
|
@@ -5245,17 +5245,17 @@ var require_graceful_fs = __commonJS({
|
|
|
5245
5245
|
});
|
|
5246
5246
|
}
|
|
5247
5247
|
}
|
|
5248
|
-
var fs$appendFile =
|
|
5248
|
+
var fs$appendFile = fs16.appendFile;
|
|
5249
5249
|
if (fs$appendFile)
|
|
5250
|
-
|
|
5251
|
-
function appendFile(
|
|
5250
|
+
fs16.appendFile = appendFile;
|
|
5251
|
+
function appendFile(path11, data, options, cb) {
|
|
5252
5252
|
if (typeof options === "function")
|
|
5253
5253
|
cb = options, options = null;
|
|
5254
|
-
return go$appendFile(
|
|
5255
|
-
function go$appendFile(
|
|
5256
|
-
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) {
|
|
5257
5257
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5258
|
-
enqueue([go$appendFile, [
|
|
5258
|
+
enqueue([go$appendFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5259
5259
|
else {
|
|
5260
5260
|
if (typeof cb2 === "function")
|
|
5261
5261
|
cb2.apply(this, arguments);
|
|
@@ -5263,9 +5263,9 @@ var require_graceful_fs = __commonJS({
|
|
|
5263
5263
|
});
|
|
5264
5264
|
}
|
|
5265
5265
|
}
|
|
5266
|
-
var fs$copyFile =
|
|
5266
|
+
var fs$copyFile = fs16.copyFile;
|
|
5267
5267
|
if (fs$copyFile)
|
|
5268
|
-
|
|
5268
|
+
fs16.copyFile = copyFile;
|
|
5269
5269
|
function copyFile(src, dest, flags, cb) {
|
|
5270
5270
|
if (typeof flags === "function") {
|
|
5271
5271
|
cb = flags;
|
|
@@ -5283,34 +5283,34 @@ var require_graceful_fs = __commonJS({
|
|
|
5283
5283
|
});
|
|
5284
5284
|
}
|
|
5285
5285
|
}
|
|
5286
|
-
var fs$readdir =
|
|
5287
|
-
|
|
5286
|
+
var fs$readdir = fs16.readdir;
|
|
5287
|
+
fs16.readdir = readdir;
|
|
5288
5288
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
5289
|
-
function readdir(
|
|
5289
|
+
function readdir(path11, options, cb) {
|
|
5290
5290
|
if (typeof options === "function")
|
|
5291
5291
|
cb = options, options = null;
|
|
5292
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
5293
|
-
return fs$readdir(
|
|
5294
|
-
|
|
5292
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path12, options2, cb2, startTime) {
|
|
5293
|
+
return fs$readdir(path12, fs$readdirCallback(
|
|
5294
|
+
path12,
|
|
5295
5295
|
options2,
|
|
5296
5296
|
cb2,
|
|
5297
5297
|
startTime
|
|
5298
5298
|
));
|
|
5299
|
-
} : function go$readdir2(
|
|
5300
|
-
return fs$readdir(
|
|
5301
|
-
|
|
5299
|
+
} : function go$readdir2(path12, options2, cb2, startTime) {
|
|
5300
|
+
return fs$readdir(path12, options2, fs$readdirCallback(
|
|
5301
|
+
path12,
|
|
5302
5302
|
options2,
|
|
5303
5303
|
cb2,
|
|
5304
5304
|
startTime
|
|
5305
5305
|
));
|
|
5306
5306
|
};
|
|
5307
|
-
return go$readdir(
|
|
5308
|
-
function fs$readdirCallback(
|
|
5307
|
+
return go$readdir(path11, options, cb);
|
|
5308
|
+
function fs$readdirCallback(path12, options2, cb2, startTime) {
|
|
5309
5309
|
return function(err, files) {
|
|
5310
5310
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5311
5311
|
enqueue([
|
|
5312
5312
|
go$readdir,
|
|
5313
|
-
[
|
|
5313
|
+
[path12, options2, cb2],
|
|
5314
5314
|
err,
|
|
5315
5315
|
startTime || Date.now(),
|
|
5316
5316
|
Date.now()
|
|
@@ -5325,21 +5325,21 @@ var require_graceful_fs = __commonJS({
|
|
|
5325
5325
|
}
|
|
5326
5326
|
}
|
|
5327
5327
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
5328
|
-
var legStreams = legacy(
|
|
5328
|
+
var legStreams = legacy(fs16);
|
|
5329
5329
|
ReadStream = legStreams.ReadStream;
|
|
5330
5330
|
WriteStream = legStreams.WriteStream;
|
|
5331
5331
|
}
|
|
5332
|
-
var fs$ReadStream =
|
|
5332
|
+
var fs$ReadStream = fs16.ReadStream;
|
|
5333
5333
|
if (fs$ReadStream) {
|
|
5334
5334
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
5335
5335
|
ReadStream.prototype.open = ReadStream$open;
|
|
5336
5336
|
}
|
|
5337
|
-
var fs$WriteStream =
|
|
5337
|
+
var fs$WriteStream = fs16.WriteStream;
|
|
5338
5338
|
if (fs$WriteStream) {
|
|
5339
5339
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
5340
5340
|
WriteStream.prototype.open = WriteStream$open;
|
|
5341
5341
|
}
|
|
5342
|
-
Object.defineProperty(
|
|
5342
|
+
Object.defineProperty(fs16, "ReadStream", {
|
|
5343
5343
|
get: function() {
|
|
5344
5344
|
return ReadStream;
|
|
5345
5345
|
},
|
|
@@ -5349,7 +5349,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5349
5349
|
enumerable: true,
|
|
5350
5350
|
configurable: true
|
|
5351
5351
|
});
|
|
5352
|
-
Object.defineProperty(
|
|
5352
|
+
Object.defineProperty(fs16, "WriteStream", {
|
|
5353
5353
|
get: function() {
|
|
5354
5354
|
return WriteStream;
|
|
5355
5355
|
},
|
|
@@ -5360,7 +5360,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5360
5360
|
configurable: true
|
|
5361
5361
|
});
|
|
5362
5362
|
var FileReadStream = ReadStream;
|
|
5363
|
-
Object.defineProperty(
|
|
5363
|
+
Object.defineProperty(fs16, "FileReadStream", {
|
|
5364
5364
|
get: function() {
|
|
5365
5365
|
return FileReadStream;
|
|
5366
5366
|
},
|
|
@@ -5371,7 +5371,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5371
5371
|
configurable: true
|
|
5372
5372
|
});
|
|
5373
5373
|
var FileWriteStream = WriteStream;
|
|
5374
|
-
Object.defineProperty(
|
|
5374
|
+
Object.defineProperty(fs16, "FileWriteStream", {
|
|
5375
5375
|
get: function() {
|
|
5376
5376
|
return FileWriteStream;
|
|
5377
5377
|
},
|
|
@@ -5381,7 +5381,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5381
5381
|
enumerable: true,
|
|
5382
5382
|
configurable: true
|
|
5383
5383
|
});
|
|
5384
|
-
function ReadStream(
|
|
5384
|
+
function ReadStream(path11, options) {
|
|
5385
5385
|
if (this instanceof ReadStream)
|
|
5386
5386
|
return fs$ReadStream.apply(this, arguments), this;
|
|
5387
5387
|
else
|
|
@@ -5401,7 +5401,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5401
5401
|
}
|
|
5402
5402
|
});
|
|
5403
5403
|
}
|
|
5404
|
-
function WriteStream(
|
|
5404
|
+
function WriteStream(path11, options) {
|
|
5405
5405
|
if (this instanceof WriteStream)
|
|
5406
5406
|
return fs$WriteStream.apply(this, arguments), this;
|
|
5407
5407
|
else
|
|
@@ -5419,22 +5419,22 @@ var require_graceful_fs = __commonJS({
|
|
|
5419
5419
|
}
|
|
5420
5420
|
});
|
|
5421
5421
|
}
|
|
5422
|
-
function createReadStream(
|
|
5423
|
-
return new
|
|
5422
|
+
function createReadStream(path11, options) {
|
|
5423
|
+
return new fs16.ReadStream(path11, options);
|
|
5424
5424
|
}
|
|
5425
|
-
function createWriteStream(
|
|
5426
|
-
return new
|
|
5425
|
+
function createWriteStream(path11, options) {
|
|
5426
|
+
return new fs16.WriteStream(path11, options);
|
|
5427
5427
|
}
|
|
5428
|
-
var fs$open =
|
|
5429
|
-
|
|
5430
|
-
function open(
|
|
5428
|
+
var fs$open = fs16.open;
|
|
5429
|
+
fs16.open = open;
|
|
5430
|
+
function open(path11, flags, mode, cb) {
|
|
5431
5431
|
if (typeof mode === "function")
|
|
5432
5432
|
cb = mode, mode = null;
|
|
5433
|
-
return go$open(
|
|
5434
|
-
function go$open(
|
|
5435
|
-
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) {
|
|
5436
5436
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5437
|
-
enqueue([go$open, [
|
|
5437
|
+
enqueue([go$open, [path12, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
5438
5438
|
else {
|
|
5439
5439
|
if (typeof cb2 === "function")
|
|
5440
5440
|
cb2.apply(this, arguments);
|
|
@@ -5442,20 +5442,20 @@ var require_graceful_fs = __commonJS({
|
|
|
5442
5442
|
});
|
|
5443
5443
|
}
|
|
5444
5444
|
}
|
|
5445
|
-
return
|
|
5445
|
+
return fs16;
|
|
5446
5446
|
}
|
|
5447
5447
|
function enqueue(elem) {
|
|
5448
5448
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
5449
|
-
|
|
5449
|
+
fs15[gracefulQueue].push(elem);
|
|
5450
5450
|
retry();
|
|
5451
5451
|
}
|
|
5452
5452
|
var retryTimer;
|
|
5453
5453
|
function resetQueue() {
|
|
5454
5454
|
var now = Date.now();
|
|
5455
|
-
for (var i = 0; i <
|
|
5456
|
-
if (
|
|
5457
|
-
|
|
5458
|
-
|
|
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;
|
|
5459
5459
|
}
|
|
5460
5460
|
}
|
|
5461
5461
|
retry();
|
|
@@ -5463,9 +5463,9 @@ var require_graceful_fs = __commonJS({
|
|
|
5463
5463
|
function retry() {
|
|
5464
5464
|
clearTimeout(retryTimer);
|
|
5465
5465
|
retryTimer = void 0;
|
|
5466
|
-
if (
|
|
5466
|
+
if (fs15[gracefulQueue].length === 0)
|
|
5467
5467
|
return;
|
|
5468
|
-
var elem =
|
|
5468
|
+
var elem = fs15[gracefulQueue].shift();
|
|
5469
5469
|
var fn = elem[0];
|
|
5470
5470
|
var args = elem[1];
|
|
5471
5471
|
var err = elem[2];
|
|
@@ -5487,7 +5487,7 @@ var require_graceful_fs = __commonJS({
|
|
|
5487
5487
|
debug("RETRY", fn.name, args);
|
|
5488
5488
|
fn.apply(null, args.concat([startTime]));
|
|
5489
5489
|
} else {
|
|
5490
|
-
|
|
5490
|
+
fs15[gracefulQueue].push(elem);
|
|
5491
5491
|
}
|
|
5492
5492
|
}
|
|
5493
5493
|
if (retryTimer === void 0) {
|
|
@@ -5502,7 +5502,7 @@ var require_fs = __commonJS({
|
|
|
5502
5502
|
"node_modules/fs-extra/lib/fs/index.js"(exports2) {
|
|
5503
5503
|
"use strict";
|
|
5504
5504
|
var u = require_universalify().fromCallback;
|
|
5505
|
-
var
|
|
5505
|
+
var fs15 = require_graceful_fs();
|
|
5506
5506
|
var api = [
|
|
5507
5507
|
"access",
|
|
5508
5508
|
"appendFile",
|
|
@@ -5543,26 +5543,26 @@ var require_fs = __commonJS({
|
|
|
5543
5543
|
"utimes",
|
|
5544
5544
|
"writeFile"
|
|
5545
5545
|
].filter((key) => {
|
|
5546
|
-
return typeof
|
|
5546
|
+
return typeof fs15[key] === "function";
|
|
5547
5547
|
});
|
|
5548
|
-
Object.assign(exports2,
|
|
5548
|
+
Object.assign(exports2, fs15);
|
|
5549
5549
|
api.forEach((method) => {
|
|
5550
|
-
exports2[method] = u(
|
|
5550
|
+
exports2[method] = u(fs15[method]);
|
|
5551
5551
|
});
|
|
5552
5552
|
exports2.exists = function(filename, callback) {
|
|
5553
5553
|
if (typeof callback === "function") {
|
|
5554
|
-
return
|
|
5554
|
+
return fs15.exists(filename, callback);
|
|
5555
5555
|
}
|
|
5556
5556
|
return new Promise((resolve) => {
|
|
5557
|
-
return
|
|
5557
|
+
return fs15.exists(filename, resolve);
|
|
5558
5558
|
});
|
|
5559
5559
|
};
|
|
5560
5560
|
exports2.read = function(fd, buffer, offset, length, position, callback) {
|
|
5561
5561
|
if (typeof callback === "function") {
|
|
5562
|
-
return
|
|
5562
|
+
return fs15.read(fd, buffer, offset, length, position, callback);
|
|
5563
5563
|
}
|
|
5564
5564
|
return new Promise((resolve, reject) => {
|
|
5565
|
-
|
|
5565
|
+
fs15.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
5566
5566
|
if (err) return reject(err);
|
|
5567
5567
|
resolve({ bytesRead, buffer: buffer2 });
|
|
5568
5568
|
});
|
|
@@ -5570,10 +5570,10 @@ var require_fs = __commonJS({
|
|
|
5570
5570
|
};
|
|
5571
5571
|
exports2.write = function(fd, buffer, ...args) {
|
|
5572
5572
|
if (typeof args[args.length - 1] === "function") {
|
|
5573
|
-
return
|
|
5573
|
+
return fs15.write(fd, buffer, ...args);
|
|
5574
5574
|
}
|
|
5575
5575
|
return new Promise((resolve, reject) => {
|
|
5576
|
-
|
|
5576
|
+
fs15.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
5577
5577
|
if (err) return reject(err);
|
|
5578
5578
|
resolve({ bytesWritten, buffer: buffer2 });
|
|
5579
5579
|
});
|
|
@@ -5581,10 +5581,10 @@ var require_fs = __commonJS({
|
|
|
5581
5581
|
};
|
|
5582
5582
|
exports2.readv = function(fd, buffers, ...args) {
|
|
5583
5583
|
if (typeof args[args.length - 1] === "function") {
|
|
5584
|
-
return
|
|
5584
|
+
return fs15.readv(fd, buffers, ...args);
|
|
5585
5585
|
}
|
|
5586
5586
|
return new Promise((resolve, reject) => {
|
|
5587
|
-
|
|
5587
|
+
fs15.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
5588
5588
|
if (err) return reject(err);
|
|
5589
5589
|
resolve({ bytesRead, buffers: buffers2 });
|
|
5590
5590
|
});
|
|
@@ -5592,17 +5592,17 @@ var require_fs = __commonJS({
|
|
|
5592
5592
|
};
|
|
5593
5593
|
exports2.writev = function(fd, buffers, ...args) {
|
|
5594
5594
|
if (typeof args[args.length - 1] === "function") {
|
|
5595
|
-
return
|
|
5595
|
+
return fs15.writev(fd, buffers, ...args);
|
|
5596
5596
|
}
|
|
5597
5597
|
return new Promise((resolve, reject) => {
|
|
5598
|
-
|
|
5598
|
+
fs15.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
5599
5599
|
if (err) return reject(err);
|
|
5600
5600
|
resolve({ bytesWritten, buffers: buffers2 });
|
|
5601
5601
|
});
|
|
5602
5602
|
});
|
|
5603
5603
|
};
|
|
5604
|
-
if (typeof
|
|
5605
|
-
exports2.realpath.native = u(
|
|
5604
|
+
if (typeof fs15.realpath.native === "function") {
|
|
5605
|
+
exports2.realpath.native = u(fs15.realpath.native);
|
|
5606
5606
|
} else {
|
|
5607
5607
|
process.emitWarning(
|
|
5608
5608
|
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
@@ -5617,10 +5617,10 @@ var require_fs = __commonJS({
|
|
|
5617
5617
|
var require_utils = __commonJS({
|
|
5618
5618
|
"node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
|
|
5619
5619
|
"use strict";
|
|
5620
|
-
var
|
|
5620
|
+
var path11 = require("path");
|
|
5621
5621
|
module2.exports.checkPath = function checkPath(pth) {
|
|
5622
5622
|
if (process.platform === "win32") {
|
|
5623
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(
|
|
5623
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path11.parse(pth).root, ""));
|
|
5624
5624
|
if (pathHasInvalidWinCharacters) {
|
|
5625
5625
|
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
5626
5626
|
error.code = "EINVAL";
|
|
@@ -5635,7 +5635,7 @@ var require_utils = __commonJS({
|
|
|
5635
5635
|
var require_make_dir = __commonJS({
|
|
5636
5636
|
"node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
|
|
5637
5637
|
"use strict";
|
|
5638
|
-
var
|
|
5638
|
+
var fs15 = require_fs();
|
|
5639
5639
|
var { checkPath } = require_utils();
|
|
5640
5640
|
var getMode = (options) => {
|
|
5641
5641
|
const defaults = { mode: 511 };
|
|
@@ -5644,14 +5644,14 @@ var require_make_dir = __commonJS({
|
|
|
5644
5644
|
};
|
|
5645
5645
|
module2.exports.makeDir = async (dir, options) => {
|
|
5646
5646
|
checkPath(dir);
|
|
5647
|
-
return
|
|
5647
|
+
return fs15.mkdir(dir, {
|
|
5648
5648
|
mode: getMode(options),
|
|
5649
5649
|
recursive: true
|
|
5650
5650
|
});
|
|
5651
5651
|
};
|
|
5652
5652
|
module2.exports.makeDirSync = (dir, options) => {
|
|
5653
5653
|
checkPath(dir);
|
|
5654
|
-
return
|
|
5654
|
+
return fs15.mkdirSync(dir, {
|
|
5655
5655
|
mode: getMode(options),
|
|
5656
5656
|
recursive: true
|
|
5657
5657
|
});
|
|
@@ -5683,13 +5683,13 @@ var require_path_exists = __commonJS({
|
|
|
5683
5683
|
"node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
|
|
5684
5684
|
"use strict";
|
|
5685
5685
|
var u = require_universalify().fromPromise;
|
|
5686
|
-
var
|
|
5687
|
-
function pathExists(
|
|
5688
|
-
return
|
|
5686
|
+
var fs15 = require_fs();
|
|
5687
|
+
function pathExists(path11) {
|
|
5688
|
+
return fs15.access(path11).then(() => true).catch(() => false);
|
|
5689
5689
|
}
|
|
5690
5690
|
module2.exports = {
|
|
5691
5691
|
pathExists: u(pathExists),
|
|
5692
|
-
pathExistsSync:
|
|
5692
|
+
pathExistsSync: fs15.existsSync
|
|
5693
5693
|
};
|
|
5694
5694
|
}
|
|
5695
5695
|
});
|
|
@@ -5698,18 +5698,18 @@ var require_path_exists = __commonJS({
|
|
|
5698
5698
|
var require_utimes = __commonJS({
|
|
5699
5699
|
"node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
|
|
5700
5700
|
"use strict";
|
|
5701
|
-
var
|
|
5701
|
+
var fs15 = require_fs();
|
|
5702
5702
|
var u = require_universalify().fromPromise;
|
|
5703
|
-
async function utimesMillis(
|
|
5704
|
-
const fd = await
|
|
5703
|
+
async function utimesMillis(path11, atime, mtime) {
|
|
5704
|
+
const fd = await fs15.open(path11, "r+");
|
|
5705
5705
|
let error = null;
|
|
5706
5706
|
try {
|
|
5707
|
-
await
|
|
5707
|
+
await fs15.futimes(fd, atime, mtime);
|
|
5708
5708
|
} catch (futimesErr) {
|
|
5709
5709
|
error = futimesErr;
|
|
5710
5710
|
} finally {
|
|
5711
5711
|
try {
|
|
5712
|
-
await
|
|
5712
|
+
await fs15.close(fd);
|
|
5713
5713
|
} catch (closeErr) {
|
|
5714
5714
|
if (!error) error = closeErr;
|
|
5715
5715
|
}
|
|
@@ -5718,16 +5718,16 @@ var require_utimes = __commonJS({
|
|
|
5718
5718
|
throw error;
|
|
5719
5719
|
}
|
|
5720
5720
|
}
|
|
5721
|
-
function utimesMillisSync(
|
|
5722
|
-
const fd =
|
|
5721
|
+
function utimesMillisSync(path11, atime, mtime) {
|
|
5722
|
+
const fd = fs15.openSync(path11, "r+");
|
|
5723
5723
|
let error = null;
|
|
5724
5724
|
try {
|
|
5725
|
-
|
|
5725
|
+
fs15.futimesSync(fd, atime, mtime);
|
|
5726
5726
|
} catch (futimesErr) {
|
|
5727
5727
|
error = futimesErr;
|
|
5728
5728
|
} finally {
|
|
5729
5729
|
try {
|
|
5730
|
-
|
|
5730
|
+
fs15.closeSync(fd);
|
|
5731
5731
|
} catch (closeErr) {
|
|
5732
5732
|
if (!error) error = closeErr;
|
|
5733
5733
|
}
|
|
@@ -5747,11 +5747,11 @@ var require_utimes = __commonJS({
|
|
|
5747
5747
|
var require_stat = __commonJS({
|
|
5748
5748
|
"node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
|
|
5749
5749
|
"use strict";
|
|
5750
|
-
var
|
|
5751
|
-
var
|
|
5750
|
+
var fs15 = require_fs();
|
|
5751
|
+
var path11 = require("path");
|
|
5752
5752
|
var u = require_universalify().fromPromise;
|
|
5753
5753
|
function getStats(src, dest, opts) {
|
|
5754
|
-
const statFunc = opts.dereference ? (file) =>
|
|
5754
|
+
const statFunc = opts.dereference ? (file) => fs15.stat(file, { bigint: true }) : (file) => fs15.lstat(file, { bigint: true });
|
|
5755
5755
|
return Promise.all([
|
|
5756
5756
|
statFunc(src),
|
|
5757
5757
|
statFunc(dest).catch((err) => {
|
|
@@ -5762,7 +5762,7 @@ var require_stat = __commonJS({
|
|
|
5762
5762
|
}
|
|
5763
5763
|
function getStatsSync(src, dest, opts) {
|
|
5764
5764
|
let destStat;
|
|
5765
|
-
const statFunc = opts.dereference ? (file) =>
|
|
5765
|
+
const statFunc = opts.dereference ? (file) => fs15.statSync(file, { bigint: true }) : (file) => fs15.lstatSync(file, { bigint: true });
|
|
5766
5766
|
const srcStat = statFunc(src);
|
|
5767
5767
|
try {
|
|
5768
5768
|
destStat = statFunc(dest);
|
|
@@ -5776,8 +5776,8 @@ var require_stat = __commonJS({
|
|
|
5776
5776
|
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
5777
5777
|
if (destStat) {
|
|
5778
5778
|
if (areIdentical(srcStat, destStat)) {
|
|
5779
|
-
const srcBaseName =
|
|
5780
|
-
const destBaseName =
|
|
5779
|
+
const srcBaseName = path11.basename(src);
|
|
5780
|
+
const destBaseName = path11.basename(dest);
|
|
5781
5781
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
5782
5782
|
return { srcStat, destStat, isChangingCase: true };
|
|
5783
5783
|
}
|
|
@@ -5799,8 +5799,8 @@ var require_stat = __commonJS({
|
|
|
5799
5799
|
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
5800
5800
|
if (destStat) {
|
|
5801
5801
|
if (areIdentical(srcStat, destStat)) {
|
|
5802
|
-
const srcBaseName =
|
|
5803
|
-
const destBaseName =
|
|
5802
|
+
const srcBaseName = path11.basename(src);
|
|
5803
|
+
const destBaseName = path11.basename(dest);
|
|
5804
5804
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
5805
5805
|
return { srcStat, destStat, isChangingCase: true };
|
|
5806
5806
|
}
|
|
@@ -5819,12 +5819,12 @@ var require_stat = __commonJS({
|
|
|
5819
5819
|
return { srcStat, destStat };
|
|
5820
5820
|
}
|
|
5821
5821
|
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
5822
|
-
const srcParent =
|
|
5823
|
-
const destParent =
|
|
5824
|
-
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;
|
|
5825
5825
|
let destStat;
|
|
5826
5826
|
try {
|
|
5827
|
-
destStat = await
|
|
5827
|
+
destStat = await fs15.stat(destParent, { bigint: true });
|
|
5828
5828
|
} catch (err) {
|
|
5829
5829
|
if (err.code === "ENOENT") return;
|
|
5830
5830
|
throw err;
|
|
@@ -5835,12 +5835,12 @@ var require_stat = __commonJS({
|
|
|
5835
5835
|
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
5836
5836
|
}
|
|
5837
5837
|
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
5838
|
-
const srcParent =
|
|
5839
|
-
const destParent =
|
|
5840
|
-
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;
|
|
5841
5841
|
let destStat;
|
|
5842
5842
|
try {
|
|
5843
|
-
destStat =
|
|
5843
|
+
destStat = fs15.statSync(destParent, { bigint: true });
|
|
5844
5844
|
} catch (err) {
|
|
5845
5845
|
if (err.code === "ENOENT") return;
|
|
5846
5846
|
throw err;
|
|
@@ -5854,8 +5854,8 @@ var require_stat = __commonJS({
|
|
|
5854
5854
|
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
5855
5855
|
}
|
|
5856
5856
|
function isSrcSubdir(src, dest) {
|
|
5857
|
-
const srcArr =
|
|
5858
|
-
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);
|
|
5859
5859
|
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
5860
5860
|
}
|
|
5861
5861
|
function errMsg(src, dest, funcName) {
|
|
@@ -5907,8 +5907,8 @@ var require_async = __commonJS({
|
|
|
5907
5907
|
var require_copy = __commonJS({
|
|
5908
5908
|
"node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
|
|
5909
5909
|
"use strict";
|
|
5910
|
-
var
|
|
5911
|
-
var
|
|
5910
|
+
var fs15 = require_fs();
|
|
5911
|
+
var path11 = require("path");
|
|
5912
5912
|
var { mkdirs } = require_mkdirs();
|
|
5913
5913
|
var { pathExists } = require_path_exists();
|
|
5914
5914
|
var { utimesMillis } = require_utimes();
|
|
@@ -5931,7 +5931,7 @@ var require_copy = __commonJS({
|
|
|
5931
5931
|
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
5932
5932
|
const include = await runFilter(src, dest, opts);
|
|
5933
5933
|
if (!include) return;
|
|
5934
|
-
const destParent =
|
|
5934
|
+
const destParent = path11.dirname(dest);
|
|
5935
5935
|
const dirExists = await pathExists(destParent);
|
|
5936
5936
|
if (!dirExists) {
|
|
5937
5937
|
await mkdirs(destParent);
|
|
@@ -5943,7 +5943,7 @@ var require_copy = __commonJS({
|
|
|
5943
5943
|
return opts.filter(src, dest);
|
|
5944
5944
|
}
|
|
5945
5945
|
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
5946
|
-
const statFn = opts.dereference ?
|
|
5946
|
+
const statFn = opts.dereference ? fs15.stat : fs15.lstat;
|
|
5947
5947
|
const srcStat = await statFn(src);
|
|
5948
5948
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
5949
5949
|
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -5955,7 +5955,7 @@ var require_copy = __commonJS({
|
|
|
5955
5955
|
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
5956
5956
|
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
5957
5957
|
if (opts.overwrite) {
|
|
5958
|
-
await
|
|
5958
|
+
await fs15.unlink(dest);
|
|
5959
5959
|
return copyFile(srcStat, src, dest, opts);
|
|
5960
5960
|
}
|
|
5961
5961
|
if (opts.errorOnExist) {
|
|
@@ -5963,29 +5963,29 @@ var require_copy = __commonJS({
|
|
|
5963
5963
|
}
|
|
5964
5964
|
}
|
|
5965
5965
|
async function copyFile(srcStat, src, dest, opts) {
|
|
5966
|
-
await
|
|
5966
|
+
await fs15.copyFile(src, dest);
|
|
5967
5967
|
if (opts.preserveTimestamps) {
|
|
5968
5968
|
if (fileIsNotWritable(srcStat.mode)) {
|
|
5969
5969
|
await makeFileWritable(dest, srcStat.mode);
|
|
5970
5970
|
}
|
|
5971
|
-
const updatedSrcStat = await
|
|
5971
|
+
const updatedSrcStat = await fs15.stat(src);
|
|
5972
5972
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
5973
5973
|
}
|
|
5974
|
-
return
|
|
5974
|
+
return fs15.chmod(dest, srcStat.mode);
|
|
5975
5975
|
}
|
|
5976
5976
|
function fileIsNotWritable(srcMode) {
|
|
5977
5977
|
return (srcMode & 128) === 0;
|
|
5978
5978
|
}
|
|
5979
5979
|
function makeFileWritable(dest, srcMode) {
|
|
5980
|
-
return
|
|
5980
|
+
return fs15.chmod(dest, srcMode | 128);
|
|
5981
5981
|
}
|
|
5982
5982
|
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
5983
5983
|
if (!destStat) {
|
|
5984
|
-
await
|
|
5984
|
+
await fs15.mkdir(dest);
|
|
5985
5985
|
}
|
|
5986
|
-
await asyncIteratorConcurrentProcess(await
|
|
5987
|
-
const srcItem =
|
|
5988
|
-
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);
|
|
5989
5989
|
const include = await runFilter(srcItem, destItem, opts);
|
|
5990
5990
|
if (include) {
|
|
5991
5991
|
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
@@ -5993,26 +5993,26 @@ var require_copy = __commonJS({
|
|
|
5993
5993
|
}
|
|
5994
5994
|
});
|
|
5995
5995
|
if (!destStat) {
|
|
5996
|
-
await
|
|
5996
|
+
await fs15.chmod(dest, srcStat.mode);
|
|
5997
5997
|
}
|
|
5998
5998
|
}
|
|
5999
5999
|
async function onLink(destStat, src, dest, opts) {
|
|
6000
|
-
let resolvedSrc = await
|
|
6000
|
+
let resolvedSrc = await fs15.readlink(src);
|
|
6001
6001
|
if (opts.dereference) {
|
|
6002
|
-
resolvedSrc =
|
|
6002
|
+
resolvedSrc = path11.resolve(process.cwd(), resolvedSrc);
|
|
6003
6003
|
}
|
|
6004
6004
|
if (!destStat) {
|
|
6005
|
-
return
|
|
6005
|
+
return fs15.symlink(resolvedSrc, dest);
|
|
6006
6006
|
}
|
|
6007
6007
|
let resolvedDest = null;
|
|
6008
6008
|
try {
|
|
6009
|
-
resolvedDest = await
|
|
6009
|
+
resolvedDest = await fs15.readlink(dest);
|
|
6010
6010
|
} catch (e) {
|
|
6011
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return
|
|
6011
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs15.symlink(resolvedSrc, dest);
|
|
6012
6012
|
throw e;
|
|
6013
6013
|
}
|
|
6014
6014
|
if (opts.dereference) {
|
|
6015
|
-
resolvedDest =
|
|
6015
|
+
resolvedDest = path11.resolve(process.cwd(), resolvedDest);
|
|
6016
6016
|
}
|
|
6017
6017
|
if (resolvedSrc !== resolvedDest) {
|
|
6018
6018
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
@@ -6022,8 +6022,8 @@ var require_copy = __commonJS({
|
|
|
6022
6022
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
6023
6023
|
}
|
|
6024
6024
|
}
|
|
6025
|
-
await
|
|
6026
|
-
return
|
|
6025
|
+
await fs15.unlink(dest);
|
|
6026
|
+
return fs15.symlink(resolvedSrc, dest);
|
|
6027
6027
|
}
|
|
6028
6028
|
module2.exports = copy;
|
|
6029
6029
|
}
|
|
@@ -6033,8 +6033,8 @@ var require_copy = __commonJS({
|
|
|
6033
6033
|
var require_copy_sync = __commonJS({
|
|
6034
6034
|
"node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
|
|
6035
6035
|
"use strict";
|
|
6036
|
-
var
|
|
6037
|
-
var
|
|
6036
|
+
var fs15 = require_graceful_fs();
|
|
6037
|
+
var path11 = require("path");
|
|
6038
6038
|
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
6039
6039
|
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
6040
6040
|
var stat = require_stat();
|
|
@@ -6055,12 +6055,12 @@ var require_copy_sync = __commonJS({
|
|
|
6055
6055
|
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
6056
6056
|
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
6057
6057
|
if (opts.filter && !opts.filter(src, dest)) return;
|
|
6058
|
-
const destParent =
|
|
6059
|
-
if (!
|
|
6058
|
+
const destParent = path11.dirname(dest);
|
|
6059
|
+
if (!fs15.existsSync(destParent)) mkdirsSync(destParent);
|
|
6060
6060
|
return getStats(destStat, src, dest, opts);
|
|
6061
6061
|
}
|
|
6062
6062
|
function getStats(destStat, src, dest, opts) {
|
|
6063
|
-
const statSync = opts.dereference ?
|
|
6063
|
+
const statSync = opts.dereference ? fs15.statSync : fs15.lstatSync;
|
|
6064
6064
|
const srcStat = statSync(src);
|
|
6065
6065
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
6066
6066
|
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -6075,14 +6075,14 @@ var require_copy_sync = __commonJS({
|
|
|
6075
6075
|
}
|
|
6076
6076
|
function mayCopyFile(srcStat, src, dest, opts) {
|
|
6077
6077
|
if (opts.overwrite) {
|
|
6078
|
-
|
|
6078
|
+
fs15.unlinkSync(dest);
|
|
6079
6079
|
return copyFile(srcStat, src, dest, opts);
|
|
6080
6080
|
} else if (opts.errorOnExist) {
|
|
6081
6081
|
throw new Error(`'${dest}' already exists`);
|
|
6082
6082
|
}
|
|
6083
6083
|
}
|
|
6084
6084
|
function copyFile(srcStat, src, dest, opts) {
|
|
6085
|
-
|
|
6085
|
+
fs15.copyFileSync(src, dest);
|
|
6086
6086
|
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
6087
6087
|
return setDestMode(dest, srcStat.mode);
|
|
6088
6088
|
}
|
|
@@ -6097,10 +6097,10 @@ var require_copy_sync = __commonJS({
|
|
|
6097
6097
|
return setDestMode(dest, srcMode | 128);
|
|
6098
6098
|
}
|
|
6099
6099
|
function setDestMode(dest, srcMode) {
|
|
6100
|
-
return
|
|
6100
|
+
return fs15.chmodSync(dest, srcMode);
|
|
6101
6101
|
}
|
|
6102
6102
|
function setDestTimestamps(src, dest) {
|
|
6103
|
-
const updatedSrcStat =
|
|
6103
|
+
const updatedSrcStat = fs15.statSync(src);
|
|
6104
6104
|
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
6105
6105
|
}
|
|
6106
6106
|
function onDir(srcStat, destStat, src, dest, opts) {
|
|
@@ -6108,12 +6108,12 @@ var require_copy_sync = __commonJS({
|
|
|
6108
6108
|
return copyDir(src, dest, opts);
|
|
6109
6109
|
}
|
|
6110
6110
|
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
6111
|
-
|
|
6111
|
+
fs15.mkdirSync(dest);
|
|
6112
6112
|
copyDir(src, dest, opts);
|
|
6113
6113
|
return setDestMode(dest, srcMode);
|
|
6114
6114
|
}
|
|
6115
6115
|
function copyDir(src, dest, opts) {
|
|
6116
|
-
const dir =
|
|
6116
|
+
const dir = fs15.opendirSync(src);
|
|
6117
6117
|
try {
|
|
6118
6118
|
let dirent;
|
|
6119
6119
|
while ((dirent = dir.readSync()) !== null) {
|
|
@@ -6124,29 +6124,29 @@ var require_copy_sync = __commonJS({
|
|
|
6124
6124
|
}
|
|
6125
6125
|
}
|
|
6126
6126
|
function copyDirItem(item, src, dest, opts) {
|
|
6127
|
-
const srcItem =
|
|
6128
|
-
const destItem =
|
|
6127
|
+
const srcItem = path11.join(src, item);
|
|
6128
|
+
const destItem = path11.join(dest, item);
|
|
6129
6129
|
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
6130
6130
|
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
6131
6131
|
return getStats(destStat, srcItem, destItem, opts);
|
|
6132
6132
|
}
|
|
6133
6133
|
function onLink(destStat, src, dest, opts) {
|
|
6134
|
-
let resolvedSrc =
|
|
6134
|
+
let resolvedSrc = fs15.readlinkSync(src);
|
|
6135
6135
|
if (opts.dereference) {
|
|
6136
|
-
resolvedSrc =
|
|
6136
|
+
resolvedSrc = path11.resolve(process.cwd(), resolvedSrc);
|
|
6137
6137
|
}
|
|
6138
6138
|
if (!destStat) {
|
|
6139
|
-
return
|
|
6139
|
+
return fs15.symlinkSync(resolvedSrc, dest);
|
|
6140
6140
|
} else {
|
|
6141
6141
|
let resolvedDest;
|
|
6142
6142
|
try {
|
|
6143
|
-
resolvedDest =
|
|
6143
|
+
resolvedDest = fs15.readlinkSync(dest);
|
|
6144
6144
|
} catch (err) {
|
|
6145
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return
|
|
6145
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs15.symlinkSync(resolvedSrc, dest);
|
|
6146
6146
|
throw err;
|
|
6147
6147
|
}
|
|
6148
6148
|
if (opts.dereference) {
|
|
6149
|
-
resolvedDest =
|
|
6149
|
+
resolvedDest = path11.resolve(process.cwd(), resolvedDest);
|
|
6150
6150
|
}
|
|
6151
6151
|
if (resolvedSrc !== resolvedDest) {
|
|
6152
6152
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
@@ -6160,8 +6160,8 @@ var require_copy_sync = __commonJS({
|
|
|
6160
6160
|
}
|
|
6161
6161
|
}
|
|
6162
6162
|
function copyLink(resolvedSrc, dest) {
|
|
6163
|
-
|
|
6164
|
-
return
|
|
6163
|
+
fs15.unlinkSync(dest);
|
|
6164
|
+
return fs15.symlinkSync(resolvedSrc, dest);
|
|
6165
6165
|
}
|
|
6166
6166
|
module2.exports = copySync;
|
|
6167
6167
|
}
|
|
@@ -6183,13 +6183,13 @@ var require_copy2 = __commonJS({
|
|
|
6183
6183
|
var require_remove = __commonJS({
|
|
6184
6184
|
"node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
|
|
6185
6185
|
"use strict";
|
|
6186
|
-
var
|
|
6186
|
+
var fs15 = require_graceful_fs();
|
|
6187
6187
|
var u = require_universalify().fromCallback;
|
|
6188
|
-
function remove(
|
|
6189
|
-
|
|
6188
|
+
function remove(path11, callback) {
|
|
6189
|
+
fs15.rm(path11, { recursive: true, force: true }, callback);
|
|
6190
6190
|
}
|
|
6191
|
-
function removeSync(
|
|
6192
|
-
|
|
6191
|
+
function removeSync(path11) {
|
|
6192
|
+
fs15.rmSync(path11, { recursive: true, force: true });
|
|
6193
6193
|
}
|
|
6194
6194
|
module2.exports = {
|
|
6195
6195
|
remove: u(remove),
|
|
@@ -6203,28 +6203,28 @@ var require_empty = __commonJS({
|
|
|
6203
6203
|
"node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
|
|
6204
6204
|
"use strict";
|
|
6205
6205
|
var u = require_universalify().fromPromise;
|
|
6206
|
-
var
|
|
6207
|
-
var
|
|
6206
|
+
var fs15 = require_fs();
|
|
6207
|
+
var path11 = require("path");
|
|
6208
6208
|
var mkdir = require_mkdirs();
|
|
6209
6209
|
var remove = require_remove();
|
|
6210
6210
|
var emptyDir = u(async function emptyDir2(dir) {
|
|
6211
6211
|
let items;
|
|
6212
6212
|
try {
|
|
6213
|
-
items = await
|
|
6213
|
+
items = await fs15.readdir(dir);
|
|
6214
6214
|
} catch {
|
|
6215
6215
|
return mkdir.mkdirs(dir);
|
|
6216
6216
|
}
|
|
6217
|
-
return Promise.all(items.map((item) => remove.remove(
|
|
6217
|
+
return Promise.all(items.map((item) => remove.remove(path11.join(dir, item))));
|
|
6218
6218
|
});
|
|
6219
6219
|
function emptyDirSync(dir) {
|
|
6220
6220
|
let items;
|
|
6221
6221
|
try {
|
|
6222
|
-
items =
|
|
6222
|
+
items = fs15.readdirSync(dir);
|
|
6223
6223
|
} catch {
|
|
6224
6224
|
return mkdir.mkdirsSync(dir);
|
|
6225
6225
|
}
|
|
6226
6226
|
items.forEach((item) => {
|
|
6227
|
-
item =
|
|
6227
|
+
item = path11.join(dir, item);
|
|
6228
6228
|
remove.removeSync(item);
|
|
6229
6229
|
});
|
|
6230
6230
|
}
|
|
@@ -6242,52 +6242,52 @@ var require_file = __commonJS({
|
|
|
6242
6242
|
"node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
|
|
6243
6243
|
"use strict";
|
|
6244
6244
|
var u = require_universalify().fromPromise;
|
|
6245
|
-
var
|
|
6246
|
-
var
|
|
6245
|
+
var path11 = require("path");
|
|
6246
|
+
var fs15 = require_fs();
|
|
6247
6247
|
var mkdir = require_mkdirs();
|
|
6248
6248
|
async function createFile(file) {
|
|
6249
6249
|
let stats;
|
|
6250
6250
|
try {
|
|
6251
|
-
stats = await
|
|
6251
|
+
stats = await fs15.stat(file);
|
|
6252
6252
|
} catch {
|
|
6253
6253
|
}
|
|
6254
6254
|
if (stats && stats.isFile()) return;
|
|
6255
|
-
const dir =
|
|
6255
|
+
const dir = path11.dirname(file);
|
|
6256
6256
|
let dirStats = null;
|
|
6257
6257
|
try {
|
|
6258
|
-
dirStats = await
|
|
6258
|
+
dirStats = await fs15.stat(dir);
|
|
6259
6259
|
} catch (err) {
|
|
6260
6260
|
if (err.code === "ENOENT") {
|
|
6261
6261
|
await mkdir.mkdirs(dir);
|
|
6262
|
-
await
|
|
6262
|
+
await fs15.writeFile(file, "");
|
|
6263
6263
|
return;
|
|
6264
6264
|
} else {
|
|
6265
6265
|
throw err;
|
|
6266
6266
|
}
|
|
6267
6267
|
}
|
|
6268
6268
|
if (dirStats.isDirectory()) {
|
|
6269
|
-
await
|
|
6269
|
+
await fs15.writeFile(file, "");
|
|
6270
6270
|
} else {
|
|
6271
|
-
await
|
|
6271
|
+
await fs15.readdir(dir);
|
|
6272
6272
|
}
|
|
6273
6273
|
}
|
|
6274
6274
|
function createFileSync(file) {
|
|
6275
6275
|
let stats;
|
|
6276
6276
|
try {
|
|
6277
|
-
stats =
|
|
6277
|
+
stats = fs15.statSync(file);
|
|
6278
6278
|
} catch {
|
|
6279
6279
|
}
|
|
6280
6280
|
if (stats && stats.isFile()) return;
|
|
6281
|
-
const dir =
|
|
6281
|
+
const dir = path11.dirname(file);
|
|
6282
6282
|
try {
|
|
6283
|
-
if (!
|
|
6284
|
-
|
|
6283
|
+
if (!fs15.statSync(dir).isDirectory()) {
|
|
6284
|
+
fs15.readdirSync(dir);
|
|
6285
6285
|
}
|
|
6286
6286
|
} catch (err) {
|
|
6287
6287
|
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
|
|
6288
6288
|
else throw err;
|
|
6289
6289
|
}
|
|
6290
|
-
|
|
6290
|
+
fs15.writeFileSync(file, "");
|
|
6291
6291
|
}
|
|
6292
6292
|
module2.exports = {
|
|
6293
6293
|
createFile: u(createFile),
|
|
@@ -6301,50 +6301,50 @@ var require_link = __commonJS({
|
|
|
6301
6301
|
"node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
|
|
6302
6302
|
"use strict";
|
|
6303
6303
|
var u = require_universalify().fromPromise;
|
|
6304
|
-
var
|
|
6305
|
-
var
|
|
6304
|
+
var path11 = require("path");
|
|
6305
|
+
var fs15 = require_fs();
|
|
6306
6306
|
var mkdir = require_mkdirs();
|
|
6307
6307
|
var { pathExists } = require_path_exists();
|
|
6308
6308
|
var { areIdentical } = require_stat();
|
|
6309
6309
|
async function createLink(srcpath, dstpath) {
|
|
6310
6310
|
let dstStat;
|
|
6311
6311
|
try {
|
|
6312
|
-
dstStat = await
|
|
6312
|
+
dstStat = await fs15.lstat(dstpath, { bigint: true });
|
|
6313
6313
|
} catch {
|
|
6314
6314
|
}
|
|
6315
6315
|
let srcStat;
|
|
6316
6316
|
try {
|
|
6317
|
-
srcStat = await
|
|
6317
|
+
srcStat = await fs15.lstat(srcpath, { bigint: true });
|
|
6318
6318
|
} catch (err) {
|
|
6319
6319
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
6320
6320
|
throw err;
|
|
6321
6321
|
}
|
|
6322
6322
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
6323
|
-
const dir =
|
|
6323
|
+
const dir = path11.dirname(dstpath);
|
|
6324
6324
|
const dirExists = await pathExists(dir);
|
|
6325
6325
|
if (!dirExists) {
|
|
6326
6326
|
await mkdir.mkdirs(dir);
|
|
6327
6327
|
}
|
|
6328
|
-
await
|
|
6328
|
+
await fs15.link(srcpath, dstpath);
|
|
6329
6329
|
}
|
|
6330
6330
|
function createLinkSync(srcpath, dstpath) {
|
|
6331
6331
|
let dstStat;
|
|
6332
6332
|
try {
|
|
6333
|
-
dstStat =
|
|
6333
|
+
dstStat = fs15.lstatSync(dstpath, { bigint: true });
|
|
6334
6334
|
} catch {
|
|
6335
6335
|
}
|
|
6336
6336
|
try {
|
|
6337
|
-
const srcStat =
|
|
6337
|
+
const srcStat = fs15.lstatSync(srcpath, { bigint: true });
|
|
6338
6338
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
6339
6339
|
} catch (err) {
|
|
6340
6340
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
6341
6341
|
throw err;
|
|
6342
6342
|
}
|
|
6343
|
-
const dir =
|
|
6344
|
-
const dirExists =
|
|
6345
|
-
if (dirExists) return
|
|
6343
|
+
const dir = path11.dirname(dstpath);
|
|
6344
|
+
const dirExists = fs15.existsSync(dir);
|
|
6345
|
+
if (dirExists) return fs15.linkSync(srcpath, dstpath);
|
|
6346
6346
|
mkdir.mkdirsSync(dir);
|
|
6347
|
-
return
|
|
6347
|
+
return fs15.linkSync(srcpath, dstpath);
|
|
6348
6348
|
}
|
|
6349
6349
|
module2.exports = {
|
|
6350
6350
|
createLink: u(createLink),
|
|
@@ -6357,14 +6357,14 @@ var require_link = __commonJS({
|
|
|
6357
6357
|
var require_symlink_paths = __commonJS({
|
|
6358
6358
|
"node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
|
|
6359
6359
|
"use strict";
|
|
6360
|
-
var
|
|
6361
|
-
var
|
|
6360
|
+
var path11 = require("path");
|
|
6361
|
+
var fs15 = require_fs();
|
|
6362
6362
|
var { pathExists } = require_path_exists();
|
|
6363
6363
|
var u = require_universalify().fromPromise;
|
|
6364
6364
|
async function symlinkPaths(srcpath, dstpath) {
|
|
6365
|
-
if (
|
|
6365
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6366
6366
|
try {
|
|
6367
|
-
await
|
|
6367
|
+
await fs15.lstat(srcpath);
|
|
6368
6368
|
} catch (err) {
|
|
6369
6369
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
6370
6370
|
throw err;
|
|
@@ -6374,8 +6374,8 @@ var require_symlink_paths = __commonJS({
|
|
|
6374
6374
|
toDst: srcpath
|
|
6375
6375
|
};
|
|
6376
6376
|
}
|
|
6377
|
-
const dstdir =
|
|
6378
|
-
const relativeToDst =
|
|
6377
|
+
const dstdir = path11.dirname(dstpath);
|
|
6378
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6379
6379
|
const exists = await pathExists(relativeToDst);
|
|
6380
6380
|
if (exists) {
|
|
6381
6381
|
return {
|
|
@@ -6384,39 +6384,39 @@ var require_symlink_paths = __commonJS({
|
|
|
6384
6384
|
};
|
|
6385
6385
|
}
|
|
6386
6386
|
try {
|
|
6387
|
-
await
|
|
6387
|
+
await fs15.lstat(srcpath);
|
|
6388
6388
|
} catch (err) {
|
|
6389
6389
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
6390
6390
|
throw err;
|
|
6391
6391
|
}
|
|
6392
6392
|
return {
|
|
6393
6393
|
toCwd: srcpath,
|
|
6394
|
-
toDst:
|
|
6394
|
+
toDst: path11.relative(dstdir, srcpath)
|
|
6395
6395
|
};
|
|
6396
6396
|
}
|
|
6397
6397
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
6398
|
-
if (
|
|
6399
|
-
const exists2 =
|
|
6398
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6399
|
+
const exists2 = fs15.existsSync(srcpath);
|
|
6400
6400
|
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
6401
6401
|
return {
|
|
6402
6402
|
toCwd: srcpath,
|
|
6403
6403
|
toDst: srcpath
|
|
6404
6404
|
};
|
|
6405
6405
|
}
|
|
6406
|
-
const dstdir =
|
|
6407
|
-
const relativeToDst =
|
|
6408
|
-
const exists =
|
|
6406
|
+
const dstdir = path11.dirname(dstpath);
|
|
6407
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6408
|
+
const exists = fs15.existsSync(relativeToDst);
|
|
6409
6409
|
if (exists) {
|
|
6410
6410
|
return {
|
|
6411
6411
|
toCwd: relativeToDst,
|
|
6412
6412
|
toDst: srcpath
|
|
6413
6413
|
};
|
|
6414
6414
|
}
|
|
6415
|
-
const srcExists =
|
|
6415
|
+
const srcExists = fs15.existsSync(srcpath);
|
|
6416
6416
|
if (!srcExists) throw new Error("relative srcpath does not exist");
|
|
6417
6417
|
return {
|
|
6418
6418
|
toCwd: srcpath,
|
|
6419
|
-
toDst:
|
|
6419
|
+
toDst: path11.relative(dstdir, srcpath)
|
|
6420
6420
|
};
|
|
6421
6421
|
}
|
|
6422
6422
|
module2.exports = {
|
|
@@ -6430,13 +6430,13 @@ var require_symlink_paths = __commonJS({
|
|
|
6430
6430
|
var require_symlink_type = __commonJS({
|
|
6431
6431
|
"node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
|
|
6432
6432
|
"use strict";
|
|
6433
|
-
var
|
|
6433
|
+
var fs15 = require_fs();
|
|
6434
6434
|
var u = require_universalify().fromPromise;
|
|
6435
6435
|
async function symlinkType(srcpath, type) {
|
|
6436
6436
|
if (type) return type;
|
|
6437
6437
|
let stats;
|
|
6438
6438
|
try {
|
|
6439
|
-
stats = await
|
|
6439
|
+
stats = await fs15.lstat(srcpath);
|
|
6440
6440
|
} catch {
|
|
6441
6441
|
return "file";
|
|
6442
6442
|
}
|
|
@@ -6446,7 +6446,7 @@ var require_symlink_type = __commonJS({
|
|
|
6446
6446
|
if (type) return type;
|
|
6447
6447
|
let stats;
|
|
6448
6448
|
try {
|
|
6449
|
-
stats =
|
|
6449
|
+
stats = fs15.lstatSync(srcpath);
|
|
6450
6450
|
} catch {
|
|
6451
6451
|
return "file";
|
|
6452
6452
|
}
|
|
@@ -6464,8 +6464,8 @@ var require_symlink = __commonJS({
|
|
|
6464
6464
|
"node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
|
|
6465
6465
|
"use strict";
|
|
6466
6466
|
var u = require_universalify().fromPromise;
|
|
6467
|
-
var
|
|
6468
|
-
var
|
|
6467
|
+
var path11 = require("path");
|
|
6468
|
+
var fs15 = require_fs();
|
|
6469
6469
|
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
6470
6470
|
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
6471
6471
|
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
@@ -6474,64 +6474,64 @@ var require_symlink = __commonJS({
|
|
|
6474
6474
|
async function createSymlink(srcpath, dstpath, type) {
|
|
6475
6475
|
let stats;
|
|
6476
6476
|
try {
|
|
6477
|
-
stats = await
|
|
6477
|
+
stats = await fs15.lstat(dstpath);
|
|
6478
6478
|
} catch {
|
|
6479
6479
|
}
|
|
6480
6480
|
if (stats && stats.isSymbolicLink()) {
|
|
6481
6481
|
let srcStat;
|
|
6482
|
-
if (
|
|
6483
|
-
srcStat = await
|
|
6482
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6483
|
+
srcStat = await fs15.stat(srcpath, { bigint: true });
|
|
6484
6484
|
} else {
|
|
6485
|
-
const dstdir =
|
|
6486
|
-
const relativeToDst =
|
|
6485
|
+
const dstdir = path11.dirname(dstpath);
|
|
6486
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6487
6487
|
try {
|
|
6488
|
-
srcStat = await
|
|
6488
|
+
srcStat = await fs15.stat(relativeToDst, { bigint: true });
|
|
6489
6489
|
} catch {
|
|
6490
|
-
srcStat = await
|
|
6490
|
+
srcStat = await fs15.stat(srcpath, { bigint: true });
|
|
6491
6491
|
}
|
|
6492
6492
|
}
|
|
6493
|
-
const dstStat = await
|
|
6493
|
+
const dstStat = await fs15.stat(dstpath, { bigint: true });
|
|
6494
6494
|
if (areIdentical(srcStat, dstStat)) return;
|
|
6495
6495
|
}
|
|
6496
6496
|
const relative = await symlinkPaths(srcpath, dstpath);
|
|
6497
6497
|
srcpath = relative.toDst;
|
|
6498
6498
|
const toType = await symlinkType(relative.toCwd, type);
|
|
6499
|
-
const dir =
|
|
6499
|
+
const dir = path11.dirname(dstpath);
|
|
6500
6500
|
if (!await pathExists(dir)) {
|
|
6501
6501
|
await mkdirs(dir);
|
|
6502
6502
|
}
|
|
6503
|
-
return
|
|
6503
|
+
return fs15.symlink(srcpath, dstpath, toType);
|
|
6504
6504
|
}
|
|
6505
6505
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
6506
6506
|
let stats;
|
|
6507
6507
|
try {
|
|
6508
|
-
stats =
|
|
6508
|
+
stats = fs15.lstatSync(dstpath);
|
|
6509
6509
|
} catch {
|
|
6510
6510
|
}
|
|
6511
6511
|
if (stats && stats.isSymbolicLink()) {
|
|
6512
6512
|
let srcStat;
|
|
6513
|
-
if (
|
|
6514
|
-
srcStat =
|
|
6513
|
+
if (path11.isAbsolute(srcpath)) {
|
|
6514
|
+
srcStat = fs15.statSync(srcpath, { bigint: true });
|
|
6515
6515
|
} else {
|
|
6516
|
-
const dstdir =
|
|
6517
|
-
const relativeToDst =
|
|
6516
|
+
const dstdir = path11.dirname(dstpath);
|
|
6517
|
+
const relativeToDst = path11.join(dstdir, srcpath);
|
|
6518
6518
|
try {
|
|
6519
|
-
srcStat =
|
|
6519
|
+
srcStat = fs15.statSync(relativeToDst, { bigint: true });
|
|
6520
6520
|
} catch {
|
|
6521
|
-
srcStat =
|
|
6521
|
+
srcStat = fs15.statSync(srcpath, { bigint: true });
|
|
6522
6522
|
}
|
|
6523
6523
|
}
|
|
6524
|
-
const dstStat =
|
|
6524
|
+
const dstStat = fs15.statSync(dstpath, { bigint: true });
|
|
6525
6525
|
if (areIdentical(srcStat, dstStat)) return;
|
|
6526
6526
|
}
|
|
6527
6527
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
6528
6528
|
srcpath = relative.toDst;
|
|
6529
6529
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
6530
|
-
const dir =
|
|
6531
|
-
const exists =
|
|
6532
|
-
if (exists) return
|
|
6530
|
+
const dir = path11.dirname(dstpath);
|
|
6531
|
+
const exists = fs15.existsSync(dir);
|
|
6532
|
+
if (exists) return fs15.symlinkSync(srcpath, dstpath, type);
|
|
6533
6533
|
mkdirsSync(dir);
|
|
6534
|
-
return
|
|
6534
|
+
return fs15.symlinkSync(srcpath, dstpath, type);
|
|
6535
6535
|
}
|
|
6536
6536
|
module2.exports = {
|
|
6537
6537
|
createSymlink: u(createSymlink),
|
|
@@ -6603,9 +6603,9 @@ var require_jsonfile = __commonJS({
|
|
|
6603
6603
|
if (typeof options === "string") {
|
|
6604
6604
|
options = { encoding: options };
|
|
6605
6605
|
}
|
|
6606
|
-
const
|
|
6606
|
+
const fs15 = options.fs || _fs;
|
|
6607
6607
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
6608
|
-
let data = await universalify.fromCallback(
|
|
6608
|
+
let data = await universalify.fromCallback(fs15.readFile)(file, options);
|
|
6609
6609
|
data = stripBom(data);
|
|
6610
6610
|
let obj;
|
|
6611
6611
|
try {
|
|
@@ -6625,10 +6625,10 @@ var require_jsonfile = __commonJS({
|
|
|
6625
6625
|
if (typeof options === "string") {
|
|
6626
6626
|
options = { encoding: options };
|
|
6627
6627
|
}
|
|
6628
|
-
const
|
|
6628
|
+
const fs15 = options.fs || _fs;
|
|
6629
6629
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
6630
6630
|
try {
|
|
6631
|
-
let content =
|
|
6631
|
+
let content = fs15.readFileSync(file, options);
|
|
6632
6632
|
content = stripBom(content);
|
|
6633
6633
|
return JSON.parse(content, options.reviver);
|
|
6634
6634
|
} catch (err) {
|
|
@@ -6641,15 +6641,15 @@ var require_jsonfile = __commonJS({
|
|
|
6641
6641
|
}
|
|
6642
6642
|
}
|
|
6643
6643
|
async function _writeFile(file, obj, options = {}) {
|
|
6644
|
-
const
|
|
6644
|
+
const fs15 = options.fs || _fs;
|
|
6645
6645
|
const str = stringify(obj, options);
|
|
6646
|
-
await universalify.fromCallback(
|
|
6646
|
+
await universalify.fromCallback(fs15.writeFile)(file, str, options);
|
|
6647
6647
|
}
|
|
6648
6648
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
6649
6649
|
function writeFileSync(file, obj, options = {}) {
|
|
6650
|
-
const
|
|
6650
|
+
const fs15 = options.fs || _fs;
|
|
6651
6651
|
const str = stringify(obj, options);
|
|
6652
|
-
return
|
|
6652
|
+
return fs15.writeFileSync(file, str, options);
|
|
6653
6653
|
}
|
|
6654
6654
|
module2.exports = {
|
|
6655
6655
|
readFile,
|
|
@@ -6680,23 +6680,23 @@ var require_output_file = __commonJS({
|
|
|
6680
6680
|
"node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
|
|
6681
6681
|
"use strict";
|
|
6682
6682
|
var u = require_universalify().fromPromise;
|
|
6683
|
-
var
|
|
6684
|
-
var
|
|
6683
|
+
var fs15 = require_fs();
|
|
6684
|
+
var path11 = require("path");
|
|
6685
6685
|
var mkdir = require_mkdirs();
|
|
6686
6686
|
var pathExists = require_path_exists().pathExists;
|
|
6687
6687
|
async function outputFile(file, data, encoding = "utf-8") {
|
|
6688
|
-
const dir =
|
|
6688
|
+
const dir = path11.dirname(file);
|
|
6689
6689
|
if (!await pathExists(dir)) {
|
|
6690
6690
|
await mkdir.mkdirs(dir);
|
|
6691
6691
|
}
|
|
6692
|
-
return
|
|
6692
|
+
return fs15.writeFile(file, data, encoding);
|
|
6693
6693
|
}
|
|
6694
6694
|
function outputFileSync(file, ...args) {
|
|
6695
|
-
const dir =
|
|
6696
|
-
if (!
|
|
6695
|
+
const dir = path11.dirname(file);
|
|
6696
|
+
if (!fs15.existsSync(dir)) {
|
|
6697
6697
|
mkdir.mkdirsSync(dir);
|
|
6698
6698
|
}
|
|
6699
|
-
|
|
6699
|
+
fs15.writeFileSync(file, ...args);
|
|
6700
6700
|
}
|
|
6701
6701
|
module2.exports = {
|
|
6702
6702
|
outputFile: u(outputFile),
|
|
@@ -6755,8 +6755,8 @@ var require_json = __commonJS({
|
|
|
6755
6755
|
var require_move = __commonJS({
|
|
6756
6756
|
"node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
|
|
6757
6757
|
"use strict";
|
|
6758
|
-
var
|
|
6759
|
-
var
|
|
6758
|
+
var fs15 = require_fs();
|
|
6759
|
+
var path11 = require("path");
|
|
6760
6760
|
var { copy } = require_copy2();
|
|
6761
6761
|
var { remove } = require_remove();
|
|
6762
6762
|
var { mkdirp } = require_mkdirs();
|
|
@@ -6766,8 +6766,8 @@ var require_move = __commonJS({
|
|
|
6766
6766
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
6767
6767
|
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
6768
6768
|
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
6769
|
-
const destParent =
|
|
6770
|
-
const parsedParentPath =
|
|
6769
|
+
const destParent = path11.dirname(dest);
|
|
6770
|
+
const parsedParentPath = path11.parse(destParent);
|
|
6771
6771
|
if (parsedParentPath.root !== destParent) {
|
|
6772
6772
|
await mkdirp(destParent);
|
|
6773
6773
|
}
|
|
@@ -6782,7 +6782,7 @@ var require_move = __commonJS({
|
|
|
6782
6782
|
}
|
|
6783
6783
|
}
|
|
6784
6784
|
try {
|
|
6785
|
-
await
|
|
6785
|
+
await fs15.rename(src, dest);
|
|
6786
6786
|
} catch (err) {
|
|
6787
6787
|
if (err.code !== "EXDEV") {
|
|
6788
6788
|
throw err;
|
|
@@ -6807,8 +6807,8 @@ var require_move = __commonJS({
|
|
|
6807
6807
|
var require_move_sync = __commonJS({
|
|
6808
6808
|
"node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
|
|
6809
6809
|
"use strict";
|
|
6810
|
-
var
|
|
6811
|
-
var
|
|
6810
|
+
var fs15 = require_graceful_fs();
|
|
6811
|
+
var path11 = require("path");
|
|
6812
6812
|
var copySync = require_copy2().copySync;
|
|
6813
6813
|
var removeSync = require_remove().removeSync;
|
|
6814
6814
|
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
@@ -6818,12 +6818,12 @@ var require_move_sync = __commonJS({
|
|
|
6818
6818
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
6819
6819
|
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
6820
6820
|
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
6821
|
-
if (!isParentRoot(dest)) mkdirpSync(
|
|
6821
|
+
if (!isParentRoot(dest)) mkdirpSync(path11.dirname(dest));
|
|
6822
6822
|
return doRename(src, dest, overwrite, isChangingCase);
|
|
6823
6823
|
}
|
|
6824
6824
|
function isParentRoot(dest) {
|
|
6825
|
-
const parent =
|
|
6826
|
-
const parsedPath =
|
|
6825
|
+
const parent = path11.dirname(dest);
|
|
6826
|
+
const parsedPath = path11.parse(parent);
|
|
6827
6827
|
return parsedPath.root === parent;
|
|
6828
6828
|
}
|
|
6829
6829
|
function doRename(src, dest, overwrite, isChangingCase) {
|
|
@@ -6832,12 +6832,12 @@ var require_move_sync = __commonJS({
|
|
|
6832
6832
|
removeSync(dest);
|
|
6833
6833
|
return rename(src, dest, overwrite);
|
|
6834
6834
|
}
|
|
6835
|
-
if (
|
|
6835
|
+
if (fs15.existsSync(dest)) throw new Error("dest already exists.");
|
|
6836
6836
|
return rename(src, dest, overwrite);
|
|
6837
6837
|
}
|
|
6838
6838
|
function rename(src, dest, overwrite) {
|
|
6839
6839
|
try {
|
|
6840
|
-
|
|
6840
|
+
fs15.renameSync(src, dest);
|
|
6841
6841
|
} catch (err) {
|
|
6842
6842
|
if (err.code !== "EXDEV") throw err;
|
|
6843
6843
|
return moveAcrossDevice(src, dest, overwrite);
|
|
@@ -8356,82 +8356,152 @@ function ora(options) {
|
|
|
8356
8356
|
|
|
8357
8357
|
// packages/cli/src/parsers/LaravelRouteParser.ts
|
|
8358
8358
|
var import_fs_extra = __toESM(require_lib());
|
|
8359
|
+
var import_child_process = require("child_process");
|
|
8360
|
+
var import_path = __toESM(require("path"));
|
|
8359
8361
|
var LaravelRouteParser = class {
|
|
8360
|
-
async parse(filePath) {
|
|
8361
|
-
const
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8362
|
+
async parse(filePath, options = {}) {
|
|
8363
|
+
const projectRoot = import_path.default.resolve(import_path.default.dirname(filePath), "..");
|
|
8364
|
+
const phpScript = `<?php
|
|
8365
|
+
require __DIR__.'/vendor/autoload.php';
|
|
8366
|
+
$app = require_once __DIR__.'/bootstrap/app.php';
|
|
8367
|
+
$kernel = $app->make(Illuminate\\Contracts\\Console\\Kernel::class);
|
|
8368
|
+
$kernel->bootstrap();
|
|
8369
|
+
|
|
8370
|
+
$result = [
|
|
8371
|
+
'routes' => [],
|
|
8372
|
+
'models' => []
|
|
8373
|
+
];
|
|
8374
|
+
|
|
8375
|
+
// Extract Routes
|
|
8376
|
+
$routes = app('router')->getRoutes();
|
|
8377
|
+
foreach ($routes as $route) {
|
|
8378
|
+
if (!str_starts_with($route->uri(), 'api/')) continue;
|
|
8379
|
+
|
|
8380
|
+
$methods = array_diff($route->methods(), ['HEAD']);
|
|
8381
|
+
$middlewares = $route->gatherMiddleware();
|
|
8382
|
+
|
|
8383
|
+
$auth = false;
|
|
8384
|
+
foreach ($middlewares as $mw) {
|
|
8385
|
+
if (is_string($mw) && (str_contains($mw, 'auth') || str_contains($mw, 'sanctum'))) {
|
|
8386
|
+
$auth = true;
|
|
8387
|
+
}
|
|
8388
|
+
}
|
|
8389
|
+
|
|
8390
|
+
$schema = [];
|
|
8391
|
+
$action = $route->getAction();
|
|
8392
|
+
if (isset($action['uses']) && is_string($action['uses']) && str_contains($action['uses'], '@')) {
|
|
8393
|
+
list($controller, $method) = explode('@', $action['uses']);
|
|
8394
|
+
if (class_exists($controller)) {
|
|
8395
|
+
try {
|
|
8396
|
+
$reflector = new ReflectionMethod($controller, $method);
|
|
8397
|
+
foreach ($reflector->getParameters() as $param) {
|
|
8398
|
+
$type = $param->getType();
|
|
8399
|
+
if ($type && !$type->isBuiltin()) {
|
|
8400
|
+
$className = $type->getName();
|
|
8401
|
+
if (is_subclass_of($className, 'Illuminate\\Foundation\\Http\\FormRequest')) {
|
|
8402
|
+
$request = new $className();
|
|
8403
|
+
if (method_exists($request, 'rules')) {
|
|
8404
|
+
$schema = $request->rules();
|
|
8405
|
+
}
|
|
8406
|
+
}
|
|
8407
|
+
}
|
|
8408
|
+
}
|
|
8409
|
+
} catch (\\Exception $e) {}
|
|
8410
|
+
}
|
|
8411
|
+
}
|
|
8412
|
+
|
|
8413
|
+
foreach ($methods as $method) {
|
|
8414
|
+
$nameParts = explode('/', preg_replace('/^api\\//', '', $route->uri()));
|
|
8415
|
+
$resource = preg_replace('/\\{.*\\}/', '', $nameParts[0]);
|
|
8416
|
+
if (empty($resource)) $resource = 'api';
|
|
8417
|
+
|
|
8418
|
+
$name = $resource . '.' . strtolower($method);
|
|
8419
|
+
|
|
8420
|
+
$result['routes'][] = [
|
|
8421
|
+
'name' => $route->getName() ?: $name,
|
|
8422
|
+
'method' => $method,
|
|
8423
|
+
'path' => '/' . preg_replace('/^api\\//', '', $route->uri()),
|
|
8424
|
+
'auth' => $auth,
|
|
8425
|
+
'middleware' => $middlewares,
|
|
8426
|
+
'schema' => empty($schema) ? null : ['rules' => $schema]
|
|
8427
|
+
];
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
|
|
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);
|
|
8471
|
+
`;
|
|
8472
|
+
const scriptPath = import_path.default.join(projectRoot, "routesync-extractor-temp.php");
|
|
8473
|
+
try {
|
|
8474
|
+
await import_fs_extra.default.writeFile(scriptPath, phpScript);
|
|
8475
|
+
const stdout = (0, import_child_process.execSync)(`php routesync-extractor-temp.php`, {
|
|
8476
|
+
cwd: projectRoot,
|
|
8477
|
+
encoding: "utf-8",
|
|
8478
|
+
maxBuffer: 1024 * 1024 * 10
|
|
8479
|
+
});
|
|
8480
|
+
await import_fs_extra.default.remove(scriptPath);
|
|
8481
|
+
const parsed = JSON.parse(stdout);
|
|
8482
|
+
return {
|
|
8483
|
+
routes: parsed.routes || [],
|
|
8484
|
+
models: parsed.models || []
|
|
8485
|
+
};
|
|
8486
|
+
} catch (err) {
|
|
8487
|
+
if (import_fs_extra.default.existsSync(scriptPath)) {
|
|
8488
|
+
await import_fs_extra.default.remove(scriptPath);
|
|
8408
8489
|
}
|
|
8490
|
+
console.error("Failed to parse Laravel routes via PHP script:", err);
|
|
8491
|
+
return { routes: [], models: [] };
|
|
8409
8492
|
}
|
|
8410
|
-
return routes;
|
|
8411
|
-
}
|
|
8412
|
-
inferName(method, path5) {
|
|
8413
|
-
const parts = path5.replace(/^\//, "").split("/");
|
|
8414
|
-
const resource = parts[0] ?? "resource";
|
|
8415
|
-
const hasId = parts.some((p) => p.startsWith("{"));
|
|
8416
|
-
const map = {
|
|
8417
|
-
GET: hasId ? `${resource}.show` : `${resource}.index`,
|
|
8418
|
-
POST: `${resource}.store`,
|
|
8419
|
-
PUT: `${resource}.update`,
|
|
8420
|
-
PATCH: `${resource}.update`,
|
|
8421
|
-
DELETE: `${resource}.destroy`
|
|
8422
|
-
};
|
|
8423
|
-
return map[method] ?? `${resource}.action`;
|
|
8424
8493
|
}
|
|
8425
8494
|
};
|
|
8426
8495
|
|
|
8427
8496
|
// packages/cli/src/generators/ManifestGenerator.ts
|
|
8428
8497
|
var import_fs_extra2 = __toESM(require_lib());
|
|
8429
8498
|
var ManifestGenerator = class {
|
|
8430
|
-
static generate(routes, baseURL) {
|
|
8499
|
+
static generate(routes, baseURL, channels) {
|
|
8431
8500
|
return {
|
|
8432
8501
|
version: "1.0.0",
|
|
8433
8502
|
baseURL,
|
|
8434
8503
|
routes,
|
|
8504
|
+
channels: channels || [],
|
|
8435
8505
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
8436
8506
|
};
|
|
8437
8507
|
}
|
|
@@ -8441,15 +8511,16 @@ var ManifestGenerator = class {
|
|
|
8441
8511
|
};
|
|
8442
8512
|
|
|
8443
8513
|
// packages/cli/src/commands/scan.ts
|
|
8444
|
-
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) => {
|
|
8445
8515
|
const spinner = ora("Scanning routes...").start();
|
|
8446
8516
|
try {
|
|
8447
8517
|
const parser = new LaravelRouteParser();
|
|
8448
|
-
const routes = await parser.parse(options.input);
|
|
8518
|
+
const { routes, models } = await parser.parse(options.input, { extractModels: options.models });
|
|
8449
8519
|
const manifest = ManifestGenerator.generate(routes, options.baseURL);
|
|
8520
|
+
if (options.models) manifest.models = models;
|
|
8450
8521
|
await ManifestGenerator.save(manifest, options.output);
|
|
8451
8522
|
spinner.succeed(
|
|
8452
|
-
source_default.green(`Found ${routes.length} routes \u2192 ${options.output}`)
|
|
8523
|
+
source_default.green(`Found ${routes.length} routes, ${models.length} models \u2192 ${options.output}`)
|
|
8453
8524
|
);
|
|
8454
8525
|
routes.forEach((r) => {
|
|
8455
8526
|
console.log(
|
|
@@ -8463,7 +8534,7 @@ var scanCommand = new Command("scan").description("Scan Laravel/PHP routes and o
|
|
|
8463
8534
|
});
|
|
8464
8535
|
|
|
8465
8536
|
// packages/cli/src/generators/SDKGenerator.ts
|
|
8466
|
-
var
|
|
8537
|
+
var import_path2 = __toESM(require("path"));
|
|
8467
8538
|
var import_fs_extra3 = __toESM(require_lib());
|
|
8468
8539
|
|
|
8469
8540
|
// packages/cli/src/generators/names.ts
|
|
@@ -8497,8 +8568,8 @@ function toIdentifier(value) {
|
|
|
8497
8568
|
].join("");
|
|
8498
8569
|
return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
|
|
8499
8570
|
}
|
|
8500
|
-
function toRuntimePath(
|
|
8501
|
-
return
|
|
8571
|
+
function toRuntimePath(path11) {
|
|
8572
|
+
return path11.replace(/{([^}/]+)}/g, ":$1");
|
|
8502
8573
|
}
|
|
8503
8574
|
function toActionName(route, restSegments) {
|
|
8504
8575
|
const method = route.method.toLowerCase();
|
|
@@ -8508,8 +8579,8 @@ function toActionName(route, restSegments) {
|
|
|
8508
8579
|
function normalizeSegment(segment) {
|
|
8509
8580
|
return segment.replace(/^{([^}/]+)}$/, "$1");
|
|
8510
8581
|
}
|
|
8511
|
-
function getPathSegments(
|
|
8512
|
-
return
|
|
8582
|
+
function getPathSegments(path11) {
|
|
8583
|
+
return path11.replace(/^\//, "").split("/").filter(Boolean);
|
|
8513
8584
|
}
|
|
8514
8585
|
function splitWords(value) {
|
|
8515
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());
|
|
@@ -8528,6 +8599,13 @@ function uniquify(baseName, used) {
|
|
|
8528
8599
|
used.add(name);
|
|
8529
8600
|
return name;
|
|
8530
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
|
+
}
|
|
8531
8609
|
|
|
8532
8610
|
// packages/cli/src/generators/SDKGenerator.ts
|
|
8533
8611
|
var SDKGenerator = class {
|
|
@@ -8554,18 +8632,23 @@ var SDKGenerator = class {
|
|
|
8554
8632
|
lines.push(`})`);
|
|
8555
8633
|
lines.push(``);
|
|
8556
8634
|
lines.push(`export default api`);
|
|
8557
|
-
await import_fs_extra3.default.writeFile(
|
|
8635
|
+
await import_fs_extra3.default.writeFile(import_path2.default.join(outputDir, "api.ts"), lines.join("\n"));
|
|
8558
8636
|
}
|
|
8559
8637
|
};
|
|
8560
8638
|
|
|
8561
8639
|
// packages/cli/src/generators/TypeGenerator.ts
|
|
8562
|
-
var
|
|
8640
|
+
var import_path3 = __toESM(require("path"));
|
|
8563
8641
|
var import_fs_extra4 = __toESM(require_lib());
|
|
8564
8642
|
var TypeGenerator = class {
|
|
8565
8643
|
static async generate(manifest, outputDir) {
|
|
8566
8644
|
const lines = [];
|
|
8645
|
+
const hasSchemas = manifest.routes.some((r) => r.schema && Object.keys(r.schema).length > 0);
|
|
8567
8646
|
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8568
8647
|
lines.push(``);
|
|
8648
|
+
if (hasSchemas) {
|
|
8649
|
+
lines.push(`import { z } from 'zod'`);
|
|
8650
|
+
lines.push(``);
|
|
8651
|
+
}
|
|
8569
8652
|
lines.push(`export interface ApiResponse<T = any> {`);
|
|
8570
8653
|
lines.push(` success: boolean`);
|
|
8571
8654
|
lines.push(` message?: string`);
|
|
@@ -8600,12 +8683,48 @@ var TypeGenerator = class {
|
|
|
8600
8683
|
lines.push(`}`);
|
|
8601
8684
|
lines.push(``);
|
|
8602
8685
|
}
|
|
8603
|
-
|
|
8686
|
+
if (hasSchemas) {
|
|
8687
|
+
for (const route of manifest.routes) {
|
|
8688
|
+
if (route.schema && Object.keys(route.schema).length > 0) {
|
|
8689
|
+
const actionName = toMethodName(route);
|
|
8690
|
+
const schemaName = actionName + "Schema";
|
|
8691
|
+
lines.push(`export const ${schemaName} = z.object({`);
|
|
8692
|
+
for (const [field, rules] of Object.entries(route.schema)) {
|
|
8693
|
+
const ruleStr = Array.isArray(rules) ? rules.join("|") : String(rules);
|
|
8694
|
+
let zodRule = "z.string()";
|
|
8695
|
+
if (ruleStr.includes("numeric") || ruleStr.includes("integer")) {
|
|
8696
|
+
zodRule = "z.number()";
|
|
8697
|
+
} else if (ruleStr.includes("boolean")) {
|
|
8698
|
+
zodRule = "z.boolean()";
|
|
8699
|
+
} else if (ruleStr.includes("array")) {
|
|
8700
|
+
zodRule = "z.array(z.any())";
|
|
8701
|
+
}
|
|
8702
|
+
if (ruleStr.includes("email")) zodRule += ".email()";
|
|
8703
|
+
if (ruleStr.includes("url")) zodRule += ".url()";
|
|
8704
|
+
const matchMin = ruleStr.match(/min:(\\d+)/);
|
|
8705
|
+
if (matchMin) zodRule += ".min(" + matchMin[1] + ")";
|
|
8706
|
+
const matchMax = ruleStr.match(/max:(\\d+)/);
|
|
8707
|
+
if (matchMax) zodRule += ".max(" + matchMax[1] + ")";
|
|
8708
|
+
if (!ruleStr.includes("required")) {
|
|
8709
|
+
zodRule += ".optional()";
|
|
8710
|
+
}
|
|
8711
|
+
if (ruleStr.includes("nullable")) {
|
|
8712
|
+
zodRule += ".nullable()";
|
|
8713
|
+
}
|
|
8714
|
+
lines.push(` ${field}: ${zodRule},`);
|
|
8715
|
+
}
|
|
8716
|
+
lines.push(`})`);
|
|
8717
|
+
lines.push(`export type ${toTypeName(actionName + "Payload")} = z.infer<typeof ${schemaName}>`);
|
|
8718
|
+
lines.push(``);
|
|
8719
|
+
}
|
|
8720
|
+
}
|
|
8721
|
+
}
|
|
8722
|
+
await import_fs_extra4.default.writeFile(import_path3.default.join(outputDir, "types.ts"), lines.join("\\n"));
|
|
8604
8723
|
}
|
|
8605
8724
|
};
|
|
8606
8725
|
|
|
8607
8726
|
// packages/cli/src/generators/HookGenerator.ts
|
|
8608
|
-
var
|
|
8727
|
+
var import_path4 = __toESM(require("path"));
|
|
8609
8728
|
var import_fs_extra5 = __toESM(require_lib());
|
|
8610
8729
|
var HookGenerator = class _HookGenerator {
|
|
8611
8730
|
static async generate(manifest, outputDir) {
|
|
@@ -8643,25 +8762,197 @@ var HookGenerator = class _HookGenerator {
|
|
|
8643
8762
|
}
|
|
8644
8763
|
}
|
|
8645
8764
|
}
|
|
8646
|
-
await import_fs_extra5.default.writeFile(
|
|
8765
|
+
await import_fs_extra5.default.writeFile(import_path4.default.join(outputDir, "hooks.ts"), lines.join("\n"));
|
|
8647
8766
|
}
|
|
8648
8767
|
static toHookName(group, actionName) {
|
|
8649
8768
|
return `use${toTypeName(group)}${toTypeName(actionName)}`;
|
|
8650
8769
|
}
|
|
8651
8770
|
};
|
|
8652
8771
|
|
|
8653
|
-
// packages/cli/src/
|
|
8772
|
+
// packages/cli/src/generators/NextActionGenerator.ts
|
|
8773
|
+
var import_path5 = __toESM(require("path"));
|
|
8654
8774
|
var import_fs_extra6 = __toESM(require_lib());
|
|
8655
|
-
var
|
|
8775
|
+
var NextActionGenerator = class {
|
|
8776
|
+
static async generate(manifest, outputDir) {
|
|
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(`}`);
|
|
8811
|
+
lines.push(``);
|
|
8812
|
+
}
|
|
8813
|
+
await import_fs_extra6.default.writeFile(import_path5.default.join(outputDir, "actions.ts"), lines.join("\n"));
|
|
8814
|
+
}
|
|
8815
|
+
};
|
|
8816
|
+
|
|
8817
|
+
// packages/cli/src/generators/MswGenerator.ts
|
|
8818
|
+
var import_path6 = __toESM(require("path"));
|
|
8819
|
+
var import_fs_extra7 = __toESM(require_lib());
|
|
8820
|
+
var MswGenerator = class {
|
|
8821
|
+
static async generate(manifest, outputDir) {
|
|
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"));
|
|
8842
|
+
}
|
|
8843
|
+
};
|
|
8844
|
+
|
|
8845
|
+
// packages/cli/src/generators/EchoGenerator.ts
|
|
8846
|
+
var import_fs_extra8 = __toESM(require_lib());
|
|
8847
|
+
var import_path7 = __toESM(require("path"));
|
|
8848
|
+
var EchoGenerator = class {
|
|
8849
|
+
static async generate(channels, outputDir) {
|
|
8850
|
+
if (channels.length === 0) return;
|
|
8851
|
+
const lines = [];
|
|
8852
|
+
lines.push(`// Auto-generated Laravel Echo Hooks. Do not edit manually.`);
|
|
8853
|
+
lines.push(`import { useEffect } from 'react'`);
|
|
8854
|
+
lines.push(`import Echo from 'laravel-echo'`);
|
|
8855
|
+
lines.push(``);
|
|
8856
|
+
lines.push(`// Ensure you have configured window.Echo somewhere in your app`);
|
|
8857
|
+
lines.push(``);
|
|
8858
|
+
for (const channel of channels) {
|
|
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(``);
|
|
8882
|
+
}
|
|
8883
|
+
await import_fs_extra8.default.writeFile(import_path7.default.join(outputDir, "echo.ts"), lines.join("\n"));
|
|
8884
|
+
}
|
|
8885
|
+
};
|
|
8886
|
+
|
|
8887
|
+
// packages/cli/src/generators/IndexGenerator.ts
|
|
8888
|
+
var import_path8 = __toESM(require("path"));
|
|
8889
|
+
var import_fs_extra9 = __toESM(require_lib());
|
|
8890
|
+
var IndexGenerator = class {
|
|
8891
|
+
static async generate(manifest, outputDir, options) {
|
|
8892
|
+
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
8893
|
+
const rootLines = [];
|
|
8894
|
+
rootLines.push(`// Auto-generated. Do not edit.`);
|
|
8895
|
+
rootLines.push(`export { api } from './api'`);
|
|
8896
|
+
rootLines.push(`export * from './types'`);
|
|
8897
|
+
if (options.hooks !== false) rootLines.push(`export * from './hooks'`);
|
|
8898
|
+
if (options.nextActions) rootLines.push(`export * from './actions'`);
|
|
8899
|
+
await import_fs_extra9.default.writeFile(import_path8.default.join(outputDir, "index.ts"), rootLines.join("\n"));
|
|
8900
|
+
}
|
|
8901
|
+
};
|
|
8902
|
+
|
|
8903
|
+
// packages/cli/src/commands/generate.ts
|
|
8904
|
+
var import_fs_extra11 = __toESM(require_lib());
|
|
8905
|
+
|
|
8906
|
+
// packages/cli/src/generators/ModelGenerator.ts
|
|
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
|
|
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) => {
|
|
8656
8947
|
const spinner = ora("Generating SDK...").start();
|
|
8657
8948
|
try {
|
|
8658
|
-
if (!
|
|
8949
|
+
if (!import_fs_extra11.default.existsSync(options.manifest)) {
|
|
8659
8950
|
throw new Error(
|
|
8660
8951
|
`Manifest not found: ${options.manifest}. Run 'routesync scan' first.`
|
|
8661
8952
|
);
|
|
8662
8953
|
}
|
|
8663
|
-
const manifest = await
|
|
8664
|
-
await
|
|
8954
|
+
const manifest = await import_fs_extra11.default.readJson(options.manifest);
|
|
8955
|
+
await import_fs_extra11.default.ensureDir(options.output);
|
|
8665
8956
|
spinner.text = "Generating types...";
|
|
8666
8957
|
await TypeGenerator.generate(manifest, options.output);
|
|
8667
8958
|
spinner.text = "Generating SDK...";
|
|
@@ -8670,35 +8961,93 @@ var generateCommand = new Command("generate").description("Generate typed SDK, t
|
|
|
8670
8961
|
spinner.text = "Generating hooks...";
|
|
8671
8962
|
await HookGenerator.generate(manifest, options.output);
|
|
8672
8963
|
}
|
|
8964
|
+
if (options.nextActions) {
|
|
8965
|
+
spinner.text = "Generating Server Actions...";
|
|
8966
|
+
await NextActionGenerator.generate(manifest, options.output);
|
|
8967
|
+
}
|
|
8968
|
+
if (options.msw) {
|
|
8969
|
+
spinner.text = "Generating MSW Mocks...";
|
|
8970
|
+
await MswGenerator.generate(manifest, options.output);
|
|
8971
|
+
}
|
|
8972
|
+
if (options.echo && manifest.channels) {
|
|
8973
|
+
spinner.text = "Generating Echo Hooks...";
|
|
8974
|
+
await EchoGenerator.generate(manifest.channels, options.output);
|
|
8975
|
+
}
|
|
8976
|
+
if (manifest.models) {
|
|
8977
|
+
spinner.text = "Generating DB Models...";
|
|
8978
|
+
await ModelGenerator.generate(manifest, options.output);
|
|
8979
|
+
}
|
|
8980
|
+
spinner.text = "Generating Index Files...";
|
|
8981
|
+
await IndexGenerator.generate(manifest, options.output, options);
|
|
8673
8982
|
spinner.succeed(source_default.green(`SDK generated \u2192 ${options.output}`));
|
|
8674
8983
|
console.log(` ${source_default.cyan("api.ts")} Typed API client`);
|
|
8675
8984
|
console.log(` ${source_default.cyan("types.ts")} Response/request types`);
|
|
8676
8985
|
if (options.hooks !== false) {
|
|
8677
8986
|
console.log(` ${source_default.cyan("hooks.ts")} React Query hooks`);
|
|
8678
8987
|
}
|
|
8988
|
+
if (options.nextActions) {
|
|
8989
|
+
console.log(` ${source_default.cyan("actions.ts")} Next.js Server Actions`);
|
|
8990
|
+
}
|
|
8991
|
+
if (options.msw) {
|
|
8992
|
+
console.log(` ${source_default.cyan("mocks.ts")} MSW Mock Handlers`);
|
|
8993
|
+
}
|
|
8994
|
+
if (options.echo && manifest.channels) {
|
|
8995
|
+
console.log(` ${source_default.cyan("echo.ts")} Laravel Echo Hooks`);
|
|
8996
|
+
}
|
|
8997
|
+
if (manifest.models && manifest.models.length > 0) {
|
|
8998
|
+
console.log(` ${source_default.cyan("models.ts")} Eloquent Database Models`);
|
|
8999
|
+
}
|
|
8679
9000
|
} catch (err) {
|
|
8680
9001
|
spinner.fail(source_default.red(`Generate failed: ${err.message}`));
|
|
8681
9002
|
process.exit(1);
|
|
8682
9003
|
}
|
|
8683
9004
|
});
|
|
8684
9005
|
|
|
9006
|
+
// packages/cli/src/parsers/LaravelChannelParser.ts
|
|
9007
|
+
var import_fs_extra12 = __toESM(require_lib());
|
|
9008
|
+
var LaravelChannelParser = class {
|
|
9009
|
+
async parse(channelFilePath = "routes/channels.php") {
|
|
9010
|
+
if (!import_fs_extra12.default.existsSync(channelFilePath)) {
|
|
9011
|
+
return [];
|
|
9012
|
+
}
|
|
9013
|
+
const content = await import_fs_extra12.default.readFile(channelFilePath, "utf-8");
|
|
9014
|
+
const channels = [];
|
|
9015
|
+
const regex2 = new RegExp(`Broadcast::channel\\(\\s*['"]([^'"]+)['"]`, "g");
|
|
9016
|
+
let match;
|
|
9017
|
+
while ((match = regex2.exec(content)) !== null) {
|
|
9018
|
+
const name = match[1];
|
|
9019
|
+
channels.push({
|
|
9020
|
+
name,
|
|
9021
|
+
isPrivate: true,
|
|
9022
|
+
// we default to private for now as most channels are authenticated
|
|
9023
|
+
isPresence: false
|
|
9024
|
+
});
|
|
9025
|
+
}
|
|
9026
|
+
return channels;
|
|
9027
|
+
}
|
|
9028
|
+
};
|
|
9029
|
+
|
|
8685
9030
|
// packages/cli/src/commands/sync.ts
|
|
8686
|
-
var
|
|
8687
|
-
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").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) => {
|
|
8688
9033
|
console.log(source_default.bold.blue("\n routesync sync\n"));
|
|
8689
9034
|
const steps = [
|
|
8690
9035
|
{ text: "Scanning Laravel routes" },
|
|
8691
9036
|
{ text: "Generating types" },
|
|
8692
9037
|
{ text: "Generating SDK" },
|
|
8693
|
-
{ text: "Generating hooks" }
|
|
9038
|
+
{ text: "Generating hooks" },
|
|
9039
|
+
{ text: "Generating Server Actions" }
|
|
8694
9040
|
];
|
|
8695
9041
|
const spinner = ora(steps[0].text).start();
|
|
8696
9042
|
try {
|
|
8697
9043
|
const parser = new LaravelRouteParser();
|
|
8698
|
-
const routes = await parser.parse(options.input);
|
|
8699
|
-
const
|
|
8700
|
-
|
|
8701
|
-
|
|
9044
|
+
const { routes, models } = await parser.parse(options.input, { extractModels: options.models });
|
|
9045
|
+
const channelParser = new LaravelChannelParser();
|
|
9046
|
+
const channels = options.echo ? await channelParser.parse("routes/channels.php") : [];
|
|
9047
|
+
const manifest = ManifestGenerator.generate(routes, options.baseURL, channels);
|
|
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);
|
|
8702
9051
|
spinner.start(steps[1].text);
|
|
8703
9052
|
await TypeGenerator.generate(manifest, options.output);
|
|
8704
9053
|
spinner.succeed(source_default.green(`\u2714 ${steps[1].text}`));
|
|
@@ -8710,6 +9059,29 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
8710
9059
|
await HookGenerator.generate(manifest, options.output);
|
|
8711
9060
|
spinner.succeed(source_default.green(`\u2714 ${steps[3].text}`));
|
|
8712
9061
|
}
|
|
9062
|
+
if (options.nextActions) {
|
|
9063
|
+
spinner.start(steps[4].text);
|
|
9064
|
+
await NextActionGenerator.generate(manifest, options.output);
|
|
9065
|
+
spinner.succeed(source_default.green(`\u2714 ${steps[4].text}`));
|
|
9066
|
+
}
|
|
9067
|
+
if (options.msw) {
|
|
9068
|
+
spinner.start("Generating MSW Mocks");
|
|
9069
|
+
await MswGenerator.generate(manifest, options.output);
|
|
9070
|
+
spinner.succeed(source_default.green(`\u2714 Generating MSW Mocks`));
|
|
9071
|
+
}
|
|
9072
|
+
if (options.echo && manifest.channels) {
|
|
9073
|
+
spinner.start("Generating Echo Hooks");
|
|
9074
|
+
await EchoGenerator.generate(manifest.channels, options.output);
|
|
9075
|
+
spinner.succeed(source_default.green(`\u2714 Generating Echo Hooks`));
|
|
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
|
+
}
|
|
9082
|
+
spinner.start("Generating Index Files");
|
|
9083
|
+
await IndexGenerator.generate(manifest, options.output, options);
|
|
9084
|
+
spinner.succeed(source_default.green(`\u2714 Generating Index Files`));
|
|
8713
9085
|
console.log(source_default.bold.green("\n Sync complete!\n"));
|
|
8714
9086
|
console.log(` Output: ${source_default.cyan(options.output)}`);
|
|
8715
9087
|
} catch (err) {
|
|
@@ -8719,8 +9091,8 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
8719
9091
|
});
|
|
8720
9092
|
|
|
8721
9093
|
// packages/cli/src/commands/watch.ts
|
|
8722
|
-
var
|
|
8723
|
-
var
|
|
9094
|
+
var import_fs_extra14 = __toESM(require_lib());
|
|
9095
|
+
var import_path10 = __toESM(require("path"));
|
|
8724
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) => {
|
|
8725
9097
|
console.log(source_default.bold.blue("\n routesync watch\n"));
|
|
8726
9098
|
console.log(` Watching: ${source_default.cyan(options.input)}`);
|
|
@@ -8731,8 +9103,8 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
|
|
|
8731
9103
|
debounceTimer = setTimeout(async () => {
|
|
8732
9104
|
console.log(source_default.yellow(` [${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] Routes changed, syncing...`));
|
|
8733
9105
|
try {
|
|
8734
|
-
const { execSync } = await import("child_process");
|
|
8735
|
-
|
|
9106
|
+
const { execSync: execSync2 } = await import("child_process");
|
|
9107
|
+
execSync2(
|
|
8736
9108
|
`routesync sync --input ${options.input} --output ${options.output} --baseURL ${options.baseURL}`,
|
|
8737
9109
|
{ stdio: "inherit" }
|
|
8738
9110
|
);
|
|
@@ -8741,11 +9113,11 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
|
|
|
8741
9113
|
}
|
|
8742
9114
|
}, 300);
|
|
8743
9115
|
};
|
|
8744
|
-
if (!
|
|
9116
|
+
if (!import_fs_extra14.default.existsSync(options.input)) {
|
|
8745
9117
|
console.error(source_default.red(` File not found: ${options.input}`));
|
|
8746
9118
|
process.exit(1);
|
|
8747
9119
|
}
|
|
8748
|
-
|
|
9120
|
+
import_fs_extra14.default.watch(import_path10.default.resolve(options.input), onChange);
|
|
8749
9121
|
});
|
|
8750
9122
|
|
|
8751
9123
|
// packages/cli/src/index.ts
|