routesync 1.0.19 → 1.0.20
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 +698 -580
- package/dist/core.d.mts +23 -3
- package/dist/core.d.ts +23 -3
- package/dist/core.js +1 -0
- package/dist/core.mjs +1 -0
- package/dist/react.d.mts +31 -11
- package/dist/react.d.ts +31 -11
- package/dist/react.js +4 -2
- package/dist/react.mjs +4 -2
- package/dist/sdk.d.mts +44 -12
- package/dist/sdk.d.ts +44 -12
- package/dist/sdk.js +23 -1
- package/dist/sdk.mjs +23 -1
- package/dist/vue.d.mts +9 -0
- package/dist/vue.d.ts +9 -0
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -44,9 +44,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
//
|
|
47
|
+
// node_modules/commander/lib/error.js
|
|
48
48
|
var require_error = __commonJS({
|
|
49
|
-
"
|
|
49
|
+
"node_modules/commander/lib/error.js"(exports2) {
|
|
50
50
|
"use strict";
|
|
51
51
|
var CommanderError2 = class extends Error {
|
|
52
52
|
/**
|
|
@@ -80,9 +80,9 @@ var require_error = __commonJS({
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
//
|
|
83
|
+
// node_modules/commander/lib/argument.js
|
|
84
84
|
var require_argument = __commonJS({
|
|
85
|
-
"
|
|
85
|
+
"node_modules/commander/lib/argument.js"(exports2) {
|
|
86
86
|
"use strict";
|
|
87
87
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
88
88
|
var Argument2 = class {
|
|
@@ -208,9 +208,9 @@ var require_argument = __commonJS({
|
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
//
|
|
211
|
+
// node_modules/commander/lib/help.js
|
|
212
212
|
var require_help = __commonJS({
|
|
213
|
-
"
|
|
213
|
+
"node_modules/commander/lib/help.js"(exports2) {
|
|
214
214
|
"use strict";
|
|
215
215
|
var { humanReadableArgName } = require_argument();
|
|
216
216
|
var Help2 = class {
|
|
@@ -623,9 +623,9 @@ var require_help = __commonJS({
|
|
|
623
623
|
}
|
|
624
624
|
});
|
|
625
625
|
|
|
626
|
-
//
|
|
626
|
+
// node_modules/commander/lib/option.js
|
|
627
627
|
var require_option = __commonJS({
|
|
628
|
-
"
|
|
628
|
+
"node_modules/commander/lib/option.js"(exports2) {
|
|
629
629
|
"use strict";
|
|
630
630
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
631
631
|
var Option2 = class {
|
|
@@ -896,9 +896,9 @@ var require_option = __commonJS({
|
|
|
896
896
|
}
|
|
897
897
|
});
|
|
898
898
|
|
|
899
|
-
//
|
|
899
|
+
// node_modules/commander/lib/suggestSimilar.js
|
|
900
900
|
var require_suggestSimilar = __commonJS({
|
|
901
|
-
"
|
|
901
|
+
"node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
902
902
|
"use strict";
|
|
903
903
|
var maxDistance = 3;
|
|
904
904
|
function editDistance(a, b) {
|
|
@@ -977,14 +977,14 @@ var require_suggestSimilar = __commonJS({
|
|
|
977
977
|
}
|
|
978
978
|
});
|
|
979
979
|
|
|
980
|
-
//
|
|
980
|
+
// node_modules/commander/lib/command.js
|
|
981
981
|
var require_command = __commonJS({
|
|
982
|
-
"
|
|
982
|
+
"node_modules/commander/lib/command.js"(exports2) {
|
|
983
983
|
"use strict";
|
|
984
984
|
var EventEmitter = require("events").EventEmitter;
|
|
985
985
|
var childProcess = require("child_process");
|
|
986
|
-
var
|
|
987
|
-
var
|
|
986
|
+
var path12 = require("path");
|
|
987
|
+
var fs16 = 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 = path12.resolve(baseDir, baseName);
|
|
1920
|
+
if (fs16.existsSync(localBin)) return localBin;
|
|
1921
|
+
if (sourceExt.includes(path12.extname(baseName))) return void 0;
|
|
1922
1922
|
const foundExt = sourceExt.find(
|
|
1923
|
-
(ext) =>
|
|
1923
|
+
(ext) => fs16.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 = fs16.realpathSync(this._scriptPath);
|
|
1936
1936
|
} catch (err) {
|
|
1937
1937
|
resolvedScriptPath = this._scriptPath;
|
|
1938
1938
|
}
|
|
1939
|
-
executableDir =
|
|
1940
|
-
|
|
1939
|
+
executableDir = path12.resolve(
|
|
1940
|
+
path12.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 = path12.basename(
|
|
1948
1948
|
this._scriptPath,
|
|
1949
|
-
|
|
1949
|
+
path12.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(path12.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 = path12.basename(filename, path12.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(path13) {
|
|
2815
|
+
if (path13 === void 0) return this._executableDir;
|
|
2816
|
+
this._executableDir = path13;
|
|
2817
2817
|
return this;
|
|
2818
2818
|
}
|
|
2819
2819
|
/**
|
|
@@ -3021,9 +3021,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3021
3021
|
}
|
|
3022
3022
|
});
|
|
3023
3023
|
|
|
3024
|
-
//
|
|
3024
|
+
// node_modules/commander/index.js
|
|
3025
3025
|
var require_commander = __commonJS({
|
|
3026
|
-
"
|
|
3026
|
+
"node_modules/commander/index.js"(exports2) {
|
|
3027
3027
|
"use strict";
|
|
3028
3028
|
var { Argument: Argument2 } = require_argument();
|
|
3029
3029
|
var { Command: Command2 } = require_command();
|
|
@@ -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(fs16) {
|
|
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(fs16);
|
|
4750
|
+
}
|
|
4751
|
+
if (!fs16.lutimes) {
|
|
4752
|
+
patchLutimes(fs16);
|
|
4753
|
+
}
|
|
4754
|
+
fs16.chown = chownFix(fs16.chown);
|
|
4755
|
+
fs16.fchown = chownFix(fs16.fchown);
|
|
4756
|
+
fs16.lchown = chownFix(fs16.lchown);
|
|
4757
|
+
fs16.chmod = chmodFix(fs16.chmod);
|
|
4758
|
+
fs16.fchmod = chmodFix(fs16.fchmod);
|
|
4759
|
+
fs16.lchmod = chmodFix(fs16.lchmod);
|
|
4760
|
+
fs16.chownSync = chownFixSync(fs16.chownSync);
|
|
4761
|
+
fs16.fchownSync = chownFixSync(fs16.fchownSync);
|
|
4762
|
+
fs16.lchownSync = chownFixSync(fs16.lchownSync);
|
|
4763
|
+
fs16.chmodSync = chmodFixSync(fs16.chmodSync);
|
|
4764
|
+
fs16.fchmodSync = chmodFixSync(fs16.fchmodSync);
|
|
4765
|
+
fs16.lchmodSync = chmodFixSync(fs16.lchmodSync);
|
|
4766
|
+
fs16.stat = statFix(fs16.stat);
|
|
4767
|
+
fs16.fstat = statFix(fs16.fstat);
|
|
4768
|
+
fs16.lstat = statFix(fs16.lstat);
|
|
4769
|
+
fs16.statSync = statFixSync(fs16.statSync);
|
|
4770
|
+
fs16.fstatSync = statFixSync(fs16.fstatSync);
|
|
4771
|
+
fs16.lstatSync = statFixSync(fs16.lstatSync);
|
|
4772
|
+
if (fs16.chmod && !fs16.lchmod) {
|
|
4773
|
+
fs16.lchmod = function(path12, mode, cb) {
|
|
4774
4774
|
if (cb) process.nextTick(cb);
|
|
4775
4775
|
};
|
|
4776
|
-
|
|
4776
|
+
fs16.lchmodSync = function() {
|
|
4777
4777
|
};
|
|
4778
4778
|
}
|
|
4779
|
-
if (
|
|
4780
|
-
|
|
4779
|
+
if (fs16.chown && !fs16.lchown) {
|
|
4780
|
+
fs16.lchown = function(path12, uid, gid, cb) {
|
|
4781
4781
|
if (cb) process.nextTick(cb);
|
|
4782
4782
|
};
|
|
4783
|
-
|
|
4783
|
+
fs16.lchownSync = function() {
|
|
4784
4784
|
};
|
|
4785
4785
|
}
|
|
4786
4786
|
if (platform === "win32") {
|
|
4787
|
-
|
|
4787
|
+
fs16.rename = typeof fs16.rename !== "function" ? fs16.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
|
+
fs16.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
|
+
})(fs16.rename);
|
|
4811
4811
|
}
|
|
4812
|
-
|
|
4812
|
+
fs16.read = typeof fs16.read !== "function" ? fs16.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(fs16, 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(fs16, 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
|
+
})(fs16.read);
|
|
4830
|
+
fs16.readSync = typeof fs16.readSync !== "function" ? fs16.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(fs16, 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
|
+
})(fs16.readSync);
|
|
4846
|
+
function patchLchmod(fs17) {
|
|
4847
|
+
fs17.lchmod = function(path12, mode, callback) {
|
|
4848
|
+
fs17.open(
|
|
4849
|
+
path12,
|
|
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
|
+
fs17.fchmod(fd, mode, function(err2) {
|
|
4858
|
+
fs17.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
|
+
fs17.lchmodSync = function(path12, mode) {
|
|
4866
|
+
var fd = fs17.openSync(path12, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
4867
4867
|
var threw = true;
|
|
4868
4868
|
var ret;
|
|
4869
4869
|
try {
|
|
4870
|
-
ret =
|
|
4870
|
+
ret = fs17.fchmodSync(fd, mode);
|
|
4871
4871
|
threw = false;
|
|
4872
4872
|
} finally {
|
|
4873
4873
|
if (threw) {
|
|
4874
4874
|
try {
|
|
4875
|
-
|
|
4875
|
+
fs17.closeSync(fd);
|
|
4876
4876
|
} catch (er) {
|
|
4877
4877
|
}
|
|
4878
4878
|
} else {
|
|
4879
|
-
|
|
4879
|
+
fs17.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(fs17) {
|
|
4886
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs17.futimes) {
|
|
4887
|
+
fs17.lutimes = function(path12, at, mt, cb) {
|
|
4888
|
+
fs17.open(path12, constants.O_SYMLINK, function(er, fd) {
|
|
4889
4889
|
if (er) {
|
|
4890
4890
|
if (cb) cb(er);
|
|
4891
4891
|
return;
|
|
4892
4892
|
}
|
|
4893
|
-
|
|
4894
|
-
|
|
4893
|
+
fs17.futimes(fd, at, mt, function(er2) {
|
|
4894
|
+
fs17.close(fd, function(er22) {
|
|
4895
4895
|
if (cb) cb(er2 || er22);
|
|
4896
4896
|
});
|
|
4897
4897
|
});
|
|
4898
4898
|
});
|
|
4899
4899
|
};
|
|
4900
|
-
|
|
4901
|
-
var fd =
|
|
4900
|
+
fs17.lutimesSync = function(path12, at, mt) {
|
|
4901
|
+
var fd = fs17.openSync(path12, constants.O_SYMLINK);
|
|
4902
4902
|
var ret;
|
|
4903
4903
|
var threw = true;
|
|
4904
4904
|
try {
|
|
4905
|
-
ret =
|
|
4905
|
+
ret = fs17.futimesSync(fd, at, mt);
|
|
4906
4906
|
threw = false;
|
|
4907
4907
|
} finally {
|
|
4908
4908
|
if (threw) {
|
|
4909
4909
|
try {
|
|
4910
|
-
|
|
4910
|
+
fs17.closeSync(fd);
|
|
4911
4911
|
} catch (er) {
|
|
4912
4912
|
}
|
|
4913
4913
|
} else {
|
|
4914
|
-
|
|
4914
|
+
fs17.closeSync(fd);
|
|
4915
4915
|
}
|
|
4916
4916
|
}
|
|
4917
4917
|
return ret;
|
|
4918
4918
|
};
|
|
4919
|
-
} else if (
|
|
4920
|
-
|
|
4919
|
+
} else if (fs17.futimes) {
|
|
4920
|
+
fs17.lutimes = function(_a, _b, _c, cb) {
|
|
4921
4921
|
if (cb) process.nextTick(cb);
|
|
4922
4922
|
};
|
|
4923
|
-
|
|
4923
|
+
fs17.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(fs16, 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(fs16, 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(fs16, 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(fs16, 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(fs16, target, options, callback) : orig.call(fs16, 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(fs16, target, options) : orig.call(fs16, 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(fs16) {
|
|
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(path12, options) {
|
|
5021
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path12, options);
|
|
5022
5022
|
Stream.call(this);
|
|
5023
5023
|
var self = this;
|
|
5024
|
-
this.path =
|
|
5024
|
+
this.path = path12;
|
|
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
|
+
fs16.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(path12, options) {
|
|
5070
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path12, options);
|
|
5071
5071
|
Stream.call(this);
|
|
5072
|
-
this.path =
|
|
5072
|
+
this.path = path12;
|
|
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 = fs16.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 fs16 = 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 (!fs16[gracefulQueue]) {
|
|
5166
5166
|
queue = global[gracefulQueue] || [];
|
|
5167
|
-
publishQueue(
|
|
5168
|
-
|
|
5167
|
+
publishQueue(fs16, queue);
|
|
5168
|
+
fs16.close = (function(fs$close) {
|
|
5169
5169
|
function close(fd, cb) {
|
|
5170
|
-
return fs$close.call(
|
|
5170
|
+
return fs$close.call(fs16, 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
|
+
})(fs16.close);
|
|
5183
|
+
fs16.closeSync = (function(fs$closeSync) {
|
|
5184
5184
|
function closeSync(fd) {
|
|
5185
|
-
fs$closeSync.apply(
|
|
5185
|
+
fs$closeSync.apply(fs16, 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
|
+
})(fs16.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(fs16[gracefulQueue]);
|
|
5196
|
+
require("assert").equal(fs16[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, fs16[gracefulQueue]);
|
|
5203
|
+
}
|
|
5204
|
+
module2.exports = patch(clone(fs16));
|
|
5205
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs16.__patched) {
|
|
5206
|
+
module2.exports = patch(fs16);
|
|
5207
|
+
fs16.__patched = true;
|
|
5208
|
+
}
|
|
5209
|
+
function patch(fs17) {
|
|
5210
|
+
polyfills(fs17);
|
|
5211
|
+
fs17.gracefulify = patch;
|
|
5212
|
+
fs17.createReadStream = createReadStream;
|
|
5213
|
+
fs17.createWriteStream = createWriteStream;
|
|
5214
|
+
var fs$readFile = fs17.readFile;
|
|
5215
|
+
fs17.readFile = readFile;
|
|
5216
|
+
function readFile(path12, 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(path12, options, cb);
|
|
5220
|
+
function go$readFile(path13, options2, cb2, startTime) {
|
|
5221
|
+
return fs$readFile(path13, options2, function(err) {
|
|
5222
5222
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5223
|
-
enqueue([go$readFile, [
|
|
5223
|
+
enqueue([go$readFile, [path13, 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 = fs17.writeFile;
|
|
5232
|
+
fs17.writeFile = writeFile;
|
|
5233
|
+
function writeFile(path12, 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(path12, data, options, cb);
|
|
5237
|
+
function go$writeFile(path13, data2, options2, cb2, startTime) {
|
|
5238
|
+
return fs$writeFile(path13, data2, options2, function(err) {
|
|
5239
5239
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5240
|
-
enqueue([go$writeFile, [
|
|
5240
|
+
enqueue([go$writeFile, [path13, 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 = fs17.appendFile;
|
|
5249
5249
|
if (fs$appendFile)
|
|
5250
|
-
|
|
5251
|
-
function appendFile(
|
|
5250
|
+
fs17.appendFile = appendFile;
|
|
5251
|
+
function appendFile(path12, 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(path12, data, options, cb);
|
|
5255
|
+
function go$appendFile(path13, data2, options2, cb2, startTime) {
|
|
5256
|
+
return fs$appendFile(path13, data2, options2, function(err) {
|
|
5257
5257
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5258
|
-
enqueue([go$appendFile, [
|
|
5258
|
+
enqueue([go$appendFile, [path13, 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 = fs17.copyFile;
|
|
5267
5267
|
if (fs$copyFile)
|
|
5268
|
-
|
|
5268
|
+
fs17.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 = fs17.readdir;
|
|
5287
|
+
fs17.readdir = readdir;
|
|
5288
5288
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
5289
|
-
function readdir(
|
|
5289
|
+
function readdir(path12, 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(path13, options2, cb2, startTime) {
|
|
5293
|
+
return fs$readdir(path13, fs$readdirCallback(
|
|
5294
|
+
path13,
|
|
5295
5295
|
options2,
|
|
5296
5296
|
cb2,
|
|
5297
5297
|
startTime
|
|
5298
5298
|
));
|
|
5299
|
-
} : function go$readdir2(
|
|
5300
|
-
return fs$readdir(
|
|
5301
|
-
|
|
5299
|
+
} : function go$readdir2(path13, options2, cb2, startTime) {
|
|
5300
|
+
return fs$readdir(path13, options2, fs$readdirCallback(
|
|
5301
|
+
path13,
|
|
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(path12, options, cb);
|
|
5308
|
+
function fs$readdirCallback(path13, 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
|
+
[path13, 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(fs17);
|
|
5329
5329
|
ReadStream = legStreams.ReadStream;
|
|
5330
5330
|
WriteStream = legStreams.WriteStream;
|
|
5331
5331
|
}
|
|
5332
|
-
var fs$ReadStream =
|
|
5332
|
+
var fs$ReadStream = fs17.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 = fs17.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(fs17, "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(fs17, "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(fs17, "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(fs17, "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(path12, 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(path12, 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(path12, options) {
|
|
5423
|
+
return new fs17.ReadStream(path12, options);
|
|
5424
5424
|
}
|
|
5425
|
-
function createWriteStream(
|
|
5426
|
-
return new
|
|
5425
|
+
function createWriteStream(path12, options) {
|
|
5426
|
+
return new fs17.WriteStream(path12, options);
|
|
5427
5427
|
}
|
|
5428
|
-
var fs$open =
|
|
5429
|
-
|
|
5430
|
-
function open(
|
|
5428
|
+
var fs$open = fs17.open;
|
|
5429
|
+
fs17.open = open;
|
|
5430
|
+
function open(path12, 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(path12, flags, mode, cb);
|
|
5434
|
+
function go$open(path13, flags2, mode2, cb2, startTime) {
|
|
5435
|
+
return fs$open(path13, flags2, mode2, function(err, fd) {
|
|
5436
5436
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5437
|
-
enqueue([go$open, [
|
|
5437
|
+
enqueue([go$open, [path13, 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 fs17;
|
|
5446
5446
|
}
|
|
5447
5447
|
function enqueue(elem) {
|
|
5448
5448
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
5449
|
-
|
|
5449
|
+
fs16[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 < fs16[gracefulQueue].length; ++i) {
|
|
5456
|
+
if (fs16[gracefulQueue][i].length > 2) {
|
|
5457
|
+
fs16[gracefulQueue][i][3] = now;
|
|
5458
|
+
fs16[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 (fs16[gracefulQueue].length === 0)
|
|
5467
5467
|
return;
|
|
5468
|
-
var elem =
|
|
5468
|
+
var elem = fs16[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
|
+
fs16[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 fs16 = 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 fs16[key] === "function";
|
|
5547
5547
|
});
|
|
5548
|
-
Object.assign(exports2,
|
|
5548
|
+
Object.assign(exports2, fs16);
|
|
5549
5549
|
api.forEach((method) => {
|
|
5550
|
-
exports2[method] = u(
|
|
5550
|
+
exports2[method] = u(fs16[method]);
|
|
5551
5551
|
});
|
|
5552
5552
|
exports2.exists = function(filename, callback) {
|
|
5553
5553
|
if (typeof callback === "function") {
|
|
5554
|
-
return
|
|
5554
|
+
return fs16.exists(filename, callback);
|
|
5555
5555
|
}
|
|
5556
5556
|
return new Promise((resolve) => {
|
|
5557
|
-
return
|
|
5557
|
+
return fs16.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 fs16.read(fd, buffer, offset, length, position, callback);
|
|
5563
5563
|
}
|
|
5564
5564
|
return new Promise((resolve, reject) => {
|
|
5565
|
-
|
|
5565
|
+
fs16.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 fs16.write(fd, buffer, ...args);
|
|
5574
5574
|
}
|
|
5575
5575
|
return new Promise((resolve, reject) => {
|
|
5576
|
-
|
|
5576
|
+
fs16.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 fs16.readv(fd, buffers, ...args);
|
|
5585
5585
|
}
|
|
5586
5586
|
return new Promise((resolve, reject) => {
|
|
5587
|
-
|
|
5587
|
+
fs16.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 fs16.writev(fd, buffers, ...args);
|
|
5596
5596
|
}
|
|
5597
5597
|
return new Promise((resolve, reject) => {
|
|
5598
|
-
|
|
5598
|
+
fs16.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 fs16.realpath.native === "function") {
|
|
5605
|
+
exports2.realpath.native = u(fs16.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 path12 = 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(path12.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 fs16 = 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 fs16.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 fs16.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 fs16 = require_fs();
|
|
5687
|
+
function pathExists(path12) {
|
|
5688
|
+
return fs16.access(path12).then(() => true).catch(() => false);
|
|
5689
5689
|
}
|
|
5690
5690
|
module2.exports = {
|
|
5691
5691
|
pathExists: u(pathExists),
|
|
5692
|
-
pathExistsSync:
|
|
5692
|
+
pathExistsSync: fs16.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 fs16 = require_fs();
|
|
5702
5702
|
var u = require_universalify().fromPromise;
|
|
5703
|
-
async function utimesMillis(
|
|
5704
|
-
const fd = await
|
|
5703
|
+
async function utimesMillis(path12, atime, mtime) {
|
|
5704
|
+
const fd = await fs16.open(path12, "r+");
|
|
5705
5705
|
let error = null;
|
|
5706
5706
|
try {
|
|
5707
|
-
await
|
|
5707
|
+
await fs16.futimes(fd, atime, mtime);
|
|
5708
5708
|
} catch (futimesErr) {
|
|
5709
5709
|
error = futimesErr;
|
|
5710
5710
|
} finally {
|
|
5711
5711
|
try {
|
|
5712
|
-
await
|
|
5712
|
+
await fs16.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(path12, atime, mtime) {
|
|
5722
|
+
const fd = fs16.openSync(path12, "r+");
|
|
5723
5723
|
let error = null;
|
|
5724
5724
|
try {
|
|
5725
|
-
|
|
5725
|
+
fs16.futimesSync(fd, atime, mtime);
|
|
5726
5726
|
} catch (futimesErr) {
|
|
5727
5727
|
error = futimesErr;
|
|
5728
5728
|
} finally {
|
|
5729
5729
|
try {
|
|
5730
|
-
|
|
5730
|
+
fs16.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 fs16 = require_fs();
|
|
5751
|
+
var path12 = 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) => fs16.stat(file, { bigint: true }) : (file) => fs16.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) => fs16.statSync(file, { bigint: true }) : (file) => fs16.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 = path12.basename(src);
|
|
5780
|
+
const destBaseName = path12.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 = path12.basename(src);
|
|
5803
|
+
const destBaseName = path12.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 = path12.resolve(path12.dirname(src));
|
|
5823
|
+
const destParent = path12.resolve(path12.dirname(dest));
|
|
5824
|
+
if (destParent === srcParent || destParent === path12.parse(destParent).root) return;
|
|
5825
5825
|
let destStat;
|
|
5826
5826
|
try {
|
|
5827
|
-
destStat = await
|
|
5827
|
+
destStat = await fs16.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 = path12.resolve(path12.dirname(src));
|
|
5839
|
+
const destParent = path12.resolve(path12.dirname(dest));
|
|
5840
|
+
if (destParent === srcParent || destParent === path12.parse(destParent).root) return;
|
|
5841
5841
|
let destStat;
|
|
5842
5842
|
try {
|
|
5843
|
-
destStat =
|
|
5843
|
+
destStat = fs16.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 = path12.resolve(src).split(path12.sep).filter((i) => i);
|
|
5858
|
+
const destArr = path12.resolve(dest).split(path12.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 fs16 = require_fs();
|
|
5911
|
+
var path12 = 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 = path12.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 ? fs16.stat : fs16.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 fs16.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 fs16.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 fs16.stat(src);
|
|
5972
5972
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
5973
5973
|
}
|
|
5974
|
-
return
|
|
5974
|
+
return fs16.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 fs16.chmod(dest, srcMode | 128);
|
|
5981
5981
|
}
|
|
5982
5982
|
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
5983
5983
|
if (!destStat) {
|
|
5984
|
-
await
|
|
5984
|
+
await fs16.mkdir(dest);
|
|
5985
5985
|
}
|
|
5986
|
-
await asyncIteratorConcurrentProcess(await
|
|
5987
|
-
const srcItem =
|
|
5988
|
-
const destItem =
|
|
5986
|
+
await asyncIteratorConcurrentProcess(await fs16.opendir(src), async (item) => {
|
|
5987
|
+
const srcItem = path12.join(src, item.name);
|
|
5988
|
+
const destItem = path12.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 fs16.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 fs16.readlink(src);
|
|
6001
6001
|
if (opts.dereference) {
|
|
6002
|
-
resolvedSrc =
|
|
6002
|
+
resolvedSrc = path12.resolve(process.cwd(), resolvedSrc);
|
|
6003
6003
|
}
|
|
6004
6004
|
if (!destStat) {
|
|
6005
|
-
return
|
|
6005
|
+
return fs16.symlink(resolvedSrc, dest);
|
|
6006
6006
|
}
|
|
6007
6007
|
let resolvedDest = null;
|
|
6008
6008
|
try {
|
|
6009
|
-
resolvedDest = await
|
|
6009
|
+
resolvedDest = await fs16.readlink(dest);
|
|
6010
6010
|
} catch (e) {
|
|
6011
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return
|
|
6011
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs16.symlink(resolvedSrc, dest);
|
|
6012
6012
|
throw e;
|
|
6013
6013
|
}
|
|
6014
6014
|
if (opts.dereference) {
|
|
6015
|
-
resolvedDest =
|
|
6015
|
+
resolvedDest = path12.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 fs16.unlink(dest);
|
|
6026
|
+
return fs16.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 fs16 = require_graceful_fs();
|
|
6037
|
+
var path12 = 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 = path12.dirname(dest);
|
|
6059
|
+
if (!fs16.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 ? fs16.statSync : fs16.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
|
+
fs16.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
|
+
fs16.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 fs16.chmodSync(dest, srcMode);
|
|
6101
6101
|
}
|
|
6102
6102
|
function setDestTimestamps(src, dest) {
|
|
6103
|
-
const updatedSrcStat =
|
|
6103
|
+
const updatedSrcStat = fs16.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
|
+
fs16.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 = fs16.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 = path12.join(src, item);
|
|
6128
|
+
const destItem = path12.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 = fs16.readlinkSync(src);
|
|
6135
6135
|
if (opts.dereference) {
|
|
6136
|
-
resolvedSrc =
|
|
6136
|
+
resolvedSrc = path12.resolve(process.cwd(), resolvedSrc);
|
|
6137
6137
|
}
|
|
6138
6138
|
if (!destStat) {
|
|
6139
|
-
return
|
|
6139
|
+
return fs16.symlinkSync(resolvedSrc, dest);
|
|
6140
6140
|
} else {
|
|
6141
6141
|
let resolvedDest;
|
|
6142
6142
|
try {
|
|
6143
|
-
resolvedDest =
|
|
6143
|
+
resolvedDest = fs16.readlinkSync(dest);
|
|
6144
6144
|
} catch (err) {
|
|
6145
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return
|
|
6145
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs16.symlinkSync(resolvedSrc, dest);
|
|
6146
6146
|
throw err;
|
|
6147
6147
|
}
|
|
6148
6148
|
if (opts.dereference) {
|
|
6149
|
-
resolvedDest =
|
|
6149
|
+
resolvedDest = path12.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
|
+
fs16.unlinkSync(dest);
|
|
6164
|
+
return fs16.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 fs16 = require_graceful_fs();
|
|
6187
6187
|
var u = require_universalify().fromCallback;
|
|
6188
|
-
function remove(
|
|
6189
|
-
|
|
6188
|
+
function remove(path12, callback) {
|
|
6189
|
+
fs16.rm(path12, { recursive: true, force: true }, callback);
|
|
6190
6190
|
}
|
|
6191
|
-
function removeSync(
|
|
6192
|
-
|
|
6191
|
+
function removeSync(path12) {
|
|
6192
|
+
fs16.rmSync(path12, { 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 fs16 = require_fs();
|
|
6207
|
+
var path12 = 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 fs16.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(path12.join(dir, item))));
|
|
6218
6218
|
});
|
|
6219
6219
|
function emptyDirSync(dir) {
|
|
6220
6220
|
let items;
|
|
6221
6221
|
try {
|
|
6222
|
-
items =
|
|
6222
|
+
items = fs16.readdirSync(dir);
|
|
6223
6223
|
} catch {
|
|
6224
6224
|
return mkdir.mkdirsSync(dir);
|
|
6225
6225
|
}
|
|
6226
6226
|
items.forEach((item) => {
|
|
6227
|
-
item =
|
|
6227
|
+
item = path12.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 path12 = require("path");
|
|
6246
|
+
var fs16 = 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 fs16.stat(file);
|
|
6252
6252
|
} catch {
|
|
6253
6253
|
}
|
|
6254
6254
|
if (stats && stats.isFile()) return;
|
|
6255
|
-
const dir =
|
|
6255
|
+
const dir = path12.dirname(file);
|
|
6256
6256
|
let dirStats = null;
|
|
6257
6257
|
try {
|
|
6258
|
-
dirStats = await
|
|
6258
|
+
dirStats = await fs16.stat(dir);
|
|
6259
6259
|
} catch (err) {
|
|
6260
6260
|
if (err.code === "ENOENT") {
|
|
6261
6261
|
await mkdir.mkdirs(dir);
|
|
6262
|
-
await
|
|
6262
|
+
await fs16.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 fs16.writeFile(file, "");
|
|
6270
6270
|
} else {
|
|
6271
|
-
await
|
|
6271
|
+
await fs16.readdir(dir);
|
|
6272
6272
|
}
|
|
6273
6273
|
}
|
|
6274
6274
|
function createFileSync(file) {
|
|
6275
6275
|
let stats;
|
|
6276
6276
|
try {
|
|
6277
|
-
stats =
|
|
6277
|
+
stats = fs16.statSync(file);
|
|
6278
6278
|
} catch {
|
|
6279
6279
|
}
|
|
6280
6280
|
if (stats && stats.isFile()) return;
|
|
6281
|
-
const dir =
|
|
6281
|
+
const dir = path12.dirname(file);
|
|
6282
6282
|
try {
|
|
6283
|
-
if (!
|
|
6284
|
-
|
|
6283
|
+
if (!fs16.statSync(dir).isDirectory()) {
|
|
6284
|
+
fs16.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
|
+
fs16.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 path12 = require("path");
|
|
6305
|
+
var fs16 = 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 fs16.lstat(dstpath, { bigint: true });
|
|
6313
6313
|
} catch {
|
|
6314
6314
|
}
|
|
6315
6315
|
let srcStat;
|
|
6316
6316
|
try {
|
|
6317
|
-
srcStat = await
|
|
6317
|
+
srcStat = await fs16.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 = path12.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 fs16.link(srcpath, dstpath);
|
|
6329
6329
|
}
|
|
6330
6330
|
function createLinkSync(srcpath, dstpath) {
|
|
6331
6331
|
let dstStat;
|
|
6332
6332
|
try {
|
|
6333
|
-
dstStat =
|
|
6333
|
+
dstStat = fs16.lstatSync(dstpath, { bigint: true });
|
|
6334
6334
|
} catch {
|
|
6335
6335
|
}
|
|
6336
6336
|
try {
|
|
6337
|
-
const srcStat =
|
|
6337
|
+
const srcStat = fs16.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 = path12.dirname(dstpath);
|
|
6344
|
+
const dirExists = fs16.existsSync(dir);
|
|
6345
|
+
if (dirExists) return fs16.linkSync(srcpath, dstpath);
|
|
6346
6346
|
mkdir.mkdirsSync(dir);
|
|
6347
|
-
return
|
|
6347
|
+
return fs16.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 path12 = require("path");
|
|
6361
|
+
var fs16 = 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 (path12.isAbsolute(srcpath)) {
|
|
6366
6366
|
try {
|
|
6367
|
-
await
|
|
6367
|
+
await fs16.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 = path12.dirname(dstpath);
|
|
6378
|
+
const relativeToDst = path12.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 fs16.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: path12.relative(dstdir, srcpath)
|
|
6395
6395
|
};
|
|
6396
6396
|
}
|
|
6397
6397
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
6398
|
-
if (
|
|
6399
|
-
const exists2 =
|
|
6398
|
+
if (path12.isAbsolute(srcpath)) {
|
|
6399
|
+
const exists2 = fs16.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 = path12.dirname(dstpath);
|
|
6407
|
+
const relativeToDst = path12.join(dstdir, srcpath);
|
|
6408
|
+
const exists = fs16.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 = fs16.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: path12.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 fs16 = 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 fs16.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 = fs16.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 path12 = require("path");
|
|
6468
|
+
var fs16 = 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 fs16.lstat(dstpath);
|
|
6478
6478
|
} catch {
|
|
6479
6479
|
}
|
|
6480
6480
|
if (stats && stats.isSymbolicLink()) {
|
|
6481
6481
|
let srcStat;
|
|
6482
|
-
if (
|
|
6483
|
-
srcStat = await
|
|
6482
|
+
if (path12.isAbsolute(srcpath)) {
|
|
6483
|
+
srcStat = await fs16.stat(srcpath, { bigint: true });
|
|
6484
6484
|
} else {
|
|
6485
|
-
const dstdir =
|
|
6486
|
-
const relativeToDst =
|
|
6485
|
+
const dstdir = path12.dirname(dstpath);
|
|
6486
|
+
const relativeToDst = path12.join(dstdir, srcpath);
|
|
6487
6487
|
try {
|
|
6488
|
-
srcStat = await
|
|
6488
|
+
srcStat = await fs16.stat(relativeToDst, { bigint: true });
|
|
6489
6489
|
} catch {
|
|
6490
|
-
srcStat = await
|
|
6490
|
+
srcStat = await fs16.stat(srcpath, { bigint: true });
|
|
6491
6491
|
}
|
|
6492
6492
|
}
|
|
6493
|
-
const dstStat = await
|
|
6493
|
+
const dstStat = await fs16.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 = path12.dirname(dstpath);
|
|
6500
6500
|
if (!await pathExists(dir)) {
|
|
6501
6501
|
await mkdirs(dir);
|
|
6502
6502
|
}
|
|
6503
|
-
return
|
|
6503
|
+
return fs16.symlink(srcpath, dstpath, toType);
|
|
6504
6504
|
}
|
|
6505
6505
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
6506
6506
|
let stats;
|
|
6507
6507
|
try {
|
|
6508
|
-
stats =
|
|
6508
|
+
stats = fs16.lstatSync(dstpath);
|
|
6509
6509
|
} catch {
|
|
6510
6510
|
}
|
|
6511
6511
|
if (stats && stats.isSymbolicLink()) {
|
|
6512
6512
|
let srcStat;
|
|
6513
|
-
if (
|
|
6514
|
-
srcStat =
|
|
6513
|
+
if (path12.isAbsolute(srcpath)) {
|
|
6514
|
+
srcStat = fs16.statSync(srcpath, { bigint: true });
|
|
6515
6515
|
} else {
|
|
6516
|
-
const dstdir =
|
|
6517
|
-
const relativeToDst =
|
|
6516
|
+
const dstdir = path12.dirname(dstpath);
|
|
6517
|
+
const relativeToDst = path12.join(dstdir, srcpath);
|
|
6518
6518
|
try {
|
|
6519
|
-
srcStat =
|
|
6519
|
+
srcStat = fs16.statSync(relativeToDst, { bigint: true });
|
|
6520
6520
|
} catch {
|
|
6521
|
-
srcStat =
|
|
6521
|
+
srcStat = fs16.statSync(srcpath, { bigint: true });
|
|
6522
6522
|
}
|
|
6523
6523
|
}
|
|
6524
|
-
const dstStat =
|
|
6524
|
+
const dstStat = fs16.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 = path12.dirname(dstpath);
|
|
6531
|
+
const exists = fs16.existsSync(dir);
|
|
6532
|
+
if (exists) return fs16.symlinkSync(srcpath, dstpath, type);
|
|
6533
6533
|
mkdirsSync(dir);
|
|
6534
|
-
return
|
|
6534
|
+
return fs16.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 fs16 = 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(fs16.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 fs16 = options.fs || _fs;
|
|
6629
6629
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
6630
6630
|
try {
|
|
6631
|
-
let content =
|
|
6631
|
+
let content = fs16.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 fs16 = options.fs || _fs;
|
|
6645
6645
|
const str = stringify(obj, options);
|
|
6646
|
-
await universalify.fromCallback(
|
|
6646
|
+
await universalify.fromCallback(fs16.writeFile)(file, str, options);
|
|
6647
6647
|
}
|
|
6648
6648
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
6649
6649
|
function writeFileSync(file, obj, options = {}) {
|
|
6650
|
-
const
|
|
6650
|
+
const fs16 = options.fs || _fs;
|
|
6651
6651
|
const str = stringify(obj, options);
|
|
6652
|
-
return
|
|
6652
|
+
return fs16.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 fs16 = require_fs();
|
|
6684
|
+
var path12 = 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 = path12.dirname(file);
|
|
6689
6689
|
if (!await pathExists(dir)) {
|
|
6690
6690
|
await mkdir.mkdirs(dir);
|
|
6691
6691
|
}
|
|
6692
|
-
return
|
|
6692
|
+
return fs16.writeFile(file, data, encoding);
|
|
6693
6693
|
}
|
|
6694
6694
|
function outputFileSync(file, ...args) {
|
|
6695
|
-
const dir =
|
|
6696
|
-
if (!
|
|
6695
|
+
const dir = path12.dirname(file);
|
|
6696
|
+
if (!fs16.existsSync(dir)) {
|
|
6697
6697
|
mkdir.mkdirsSync(dir);
|
|
6698
6698
|
}
|
|
6699
|
-
|
|
6699
|
+
fs16.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 fs16 = require_fs();
|
|
6759
|
+
var path12 = 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 = path12.dirname(dest);
|
|
6770
|
+
const parsedParentPath = path12.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 fs16.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 fs16 = require_graceful_fs();
|
|
6811
|
+
var path12 = 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(path12.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 = path12.dirname(dest);
|
|
6826
|
+
const parsedPath = path12.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 (fs16.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
|
+
fs16.renameSync(src, dest);
|
|
6841
6841
|
} catch (err) {
|
|
6842
6842
|
if (err.code !== "EXDEV") throw err;
|
|
6843
6843
|
return moveAcrossDevice(src, dest, overwrite);
|
|
@@ -6889,7 +6889,7 @@ var require_lib = __commonJS({
|
|
|
6889
6889
|
}
|
|
6890
6890
|
});
|
|
6891
6891
|
|
|
6892
|
-
//
|
|
6892
|
+
// node_modules/commander/esm.mjs
|
|
6893
6893
|
var import_index = __toESM(require_commander(), 1);
|
|
6894
6894
|
var {
|
|
6895
6895
|
program,
|
|
@@ -8407,30 +8407,113 @@ foreach ($routes as $route) {
|
|
|
8407
8407
|
}
|
|
8408
8408
|
}
|
|
8409
8409
|
|
|
8410
|
-
//
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
$
|
|
8410
|
+
// Parse PHP 8 Attributes for Response Metadata
|
|
8411
|
+
$responseMetadata = null;
|
|
8412
|
+
$attributes = $reflector->getAttributes();
|
|
8413
|
+
foreach ($attributes as $attr) {
|
|
8414
|
+
$attrName = $attr->getName();
|
|
8415
|
+
$shortName = class_basename($attrName);
|
|
8415
8416
|
|
|
8416
|
-
if ($
|
|
8417
|
-
$
|
|
8418
|
-
|
|
8419
|
-
$
|
|
8417
|
+
if (in_array($shortName, ['Response', 'RouteSyncResponse'])) {
|
|
8418
|
+
$args = $attr->getArguments();
|
|
8419
|
+
|
|
8420
|
+
$type = null;
|
|
8421
|
+
if (isset($args[0])) {
|
|
8422
|
+
$type = $args[0];
|
|
8423
|
+
} elseif (isset($args['type'])) {
|
|
8424
|
+
$type = $args['type'];
|
|
8425
|
+
} elseif (isset($args['model'])) {
|
|
8426
|
+
$type = $args['model'];
|
|
8427
|
+
} elseif (isset($args['response'])) {
|
|
8428
|
+
$type = $args['response'];
|
|
8429
|
+
}
|
|
8420
8430
|
|
|
8421
|
-
|
|
8422
|
-
if (
|
|
8423
|
-
$
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8431
|
+
$collection = false;
|
|
8432
|
+
if (isset($args[1])) {
|
|
8433
|
+
$collection = (bool) $args[1];
|
|
8434
|
+
} elseif (isset($args['collection'])) {
|
|
8435
|
+
$collection = (bool) $args['collection'];
|
|
8436
|
+
}
|
|
8437
|
+
|
|
8438
|
+
if ($type) {
|
|
8439
|
+
$responseMetadata = [
|
|
8440
|
+
'type' => class_basename($type),
|
|
8441
|
+
'collection' => $collection
|
|
8442
|
+
];
|
|
8443
|
+
break;
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
}
|
|
8447
|
+
|
|
8448
|
+
|
|
8449
|
+
$fileName = $reflector->getFileName();
|
|
8450
|
+
$startLine = $reflector->getStartLine();
|
|
8451
|
+
$endLine = $reflector->getEndLine();
|
|
8452
|
+
$methodSource = null;
|
|
8453
|
+
|
|
8454
|
+
if ($fileName && $startLine !== false && $endLine !== false) {
|
|
8455
|
+
$lines = file($fileName);
|
|
8456
|
+
$methodSource = implode("", array_slice($lines, $startLine - 1, $endLine - $startLine + 1));
|
|
8457
|
+
}
|
|
8458
|
+
|
|
8459
|
+
// Resource Discovery
|
|
8460
|
+
if (!$responseMetadata && $methodSource) {
|
|
8461
|
+
$resourceName = null;
|
|
8462
|
+
$collection = false;
|
|
8463
|
+
|
|
8464
|
+
if (preg_match('/returns+news+([a-zA-Z0-9_]+Resource)/', $methodSource, $matches)) {
|
|
8465
|
+
$resourceName = $matches[1];
|
|
8466
|
+
} elseif (preg_match('/returns+([a-zA-Z0-9_]+Resource)::collection/', $methodSource, $matches)) {
|
|
8467
|
+
$resourceName = $matches[1];
|
|
8468
|
+
$collection = true;
|
|
8469
|
+
}
|
|
8470
|
+
|
|
8471
|
+
if ($resourceName) {
|
|
8472
|
+
$resourceClass = 'App\\\\Http\\\\Resources\\\\' . $resourceName;
|
|
8473
|
+
if (class_exists($resourceClass)) {
|
|
8474
|
+
$resReflector = new ReflectionClass($resourceClass);
|
|
8475
|
+
$resAttrs = $resReflector->getAttributes();
|
|
8476
|
+
foreach ($resAttrs as $attr) {
|
|
8477
|
+
$shortName = class_basename($attr->getName());
|
|
8478
|
+
if (in_array($shortName, ['Response', 'RouteSyncResponse'])) {
|
|
8479
|
+
$args = $attr->getArguments();
|
|
8480
|
+
$type = $args[0] ?? $args['type'] ?? $args['model'] ?? $args['response'] ?? null;
|
|
8481
|
+
if ($type) {
|
|
8482
|
+
$responseMetadata = [
|
|
8483
|
+
'type' => class_basename($type),
|
|
8484
|
+
'collection' => $collection
|
|
8485
|
+
];
|
|
8486
|
+
}
|
|
8487
|
+
}
|
|
8488
|
+
}
|
|
8489
|
+
|
|
8490
|
+
if (!$responseMetadata) {
|
|
8491
|
+
$docComment = $resReflector->getDocComment();
|
|
8492
|
+
if ($docComment && preg_match('/@mixins+([\\\\a-zA-Z0-9_]+)/', $docComment, $mixinMatches)) {
|
|
8493
|
+
$responseMetadata = [
|
|
8494
|
+
'type' => class_basename($mixinMatches[1]),
|
|
8495
|
+
'collection' => $collection
|
|
8496
|
+
];
|
|
8429
8497
|
}
|
|
8430
8498
|
}
|
|
8431
8499
|
}
|
|
8432
8500
|
}
|
|
8433
8501
|
}
|
|
8502
|
+
|
|
8503
|
+
// Fallback: Try to parse $request->validate([...]) from source code
|
|
8504
|
+
if (empty($schema) && $methodSource) {
|
|
8505
|
+
// Look for $request->validate([ ... ])
|
|
8506
|
+
if (preg_match('/\\\\$request->validate\\\\s*\\\\(\\\\s*\\\\[(.*?)\\\\]\\\\s*\\\\)/s', $methodSource, $matches)) {
|
|
8507
|
+
$rulesString = $matches[1];
|
|
8508
|
+
// Match 'field' => 'rules'
|
|
8509
|
+
preg_match_all('~[\\'"]([a-zA-Z0-9_.*]+)[\\'"]\\\\s*=>\\\\s*[\\'"](.*?)[\\'"]~', $rulesString, $ruleMatches);
|
|
8510
|
+
if (!empty($ruleMatches[1])) {
|
|
8511
|
+
foreach ($ruleMatches[1] as $index => $field) {
|
|
8512
|
+
$schema[$field] = $ruleMatches[2][$index];
|
|
8513
|
+
}
|
|
8514
|
+
}
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8434
8517
|
} catch (\\Exception $e) {}
|
|
8435
8518
|
}
|
|
8436
8519
|
}
|
|
@@ -8448,7 +8531,8 @@ foreach ($routes as $route) {
|
|
|
8448
8531
|
'path' => '/' . preg_replace('/^api\\//', '', $route->uri()),
|
|
8449
8532
|
'auth' => $auth,
|
|
8450
8533
|
'middleware' => $middlewares,
|
|
8451
|
-
'schema' => empty($schema) ? null : ['rules' => $schema]
|
|
8534
|
+
'schema' => empty($schema) ? null : ['rules' => $schema],
|
|
8535
|
+
'response' => $responseMetadata
|
|
8452
8536
|
];
|
|
8453
8537
|
}
|
|
8454
8538
|
}
|
|
@@ -8596,8 +8680,8 @@ function toIdentifier(value) {
|
|
|
8596
8680
|
].join("");
|
|
8597
8681
|
return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
|
|
8598
8682
|
}
|
|
8599
|
-
function toRuntimePath(
|
|
8600
|
-
return
|
|
8683
|
+
function toRuntimePath(path12) {
|
|
8684
|
+
return path12.replace(/{([^}/]+)}/g, ":$1");
|
|
8601
8685
|
}
|
|
8602
8686
|
function toActionName(route, restSegments) {
|
|
8603
8687
|
const method = route.method.toLowerCase();
|
|
@@ -8607,8 +8691,8 @@ function toActionName(route, restSegments) {
|
|
|
8607
8691
|
function normalizeSegment(segment) {
|
|
8608
8692
|
return segment.replace(/^{([^}/]+)}$/, "$1");
|
|
8609
8693
|
}
|
|
8610
|
-
function getPathSegments(
|
|
8611
|
-
return
|
|
8694
|
+
function getPathSegments(path12) {
|
|
8695
|
+
return path12.replace(/^\//, "").split("/").filter(Boolean);
|
|
8612
8696
|
}
|
|
8613
8697
|
function splitWords(value) {
|
|
8614
8698
|
return value.replace(/^{([^}/]+)}$/, "$1").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word.toLowerCase());
|
|
@@ -8636,11 +8720,12 @@ function toMethodName(route) {
|
|
|
8636
8720
|
}
|
|
8637
8721
|
|
|
8638
8722
|
// packages/cli/src/generators/SDKGenerator.ts
|
|
8639
|
-
var SDKGenerator = class
|
|
8723
|
+
var SDKGenerator = class {
|
|
8640
8724
|
static async generate(manifest, outputDir, options = {}) {
|
|
8641
8725
|
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
8642
8726
|
const lines = [];
|
|
8643
8727
|
let usesZod = false;
|
|
8728
|
+
let usesTypes = false;
|
|
8644
8729
|
const zodRoutes = /* @__PURE__ */ new Set();
|
|
8645
8730
|
if (options.zod) {
|
|
8646
8731
|
for (const [group, routes] of Object.entries(grouped)) {
|
|
@@ -8649,32 +8734,73 @@ var SDKGenerator = class _SDKGenerator {
|
|
|
8649
8734
|
usesZod = true;
|
|
8650
8735
|
zodRoutes.add(`${group}.${route.actionName}`);
|
|
8651
8736
|
}
|
|
8737
|
+
if (route.response) {
|
|
8738
|
+
usesTypes = true;
|
|
8739
|
+
}
|
|
8740
|
+
}
|
|
8741
|
+
}
|
|
8742
|
+
} else {
|
|
8743
|
+
for (const [group, routes] of Object.entries(grouped)) {
|
|
8744
|
+
for (const route of routes) {
|
|
8745
|
+
if (route.response) {
|
|
8746
|
+
usesTypes = true;
|
|
8747
|
+
}
|
|
8652
8748
|
}
|
|
8653
8749
|
}
|
|
8654
8750
|
}
|
|
8655
8751
|
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8656
8752
|
lines.push(`// Generated at: ${manifest.generatedAt}`);
|
|
8657
8753
|
lines.push(``);
|
|
8658
|
-
lines.push(`import { defineApi } from 'routesync'`);
|
|
8754
|
+
lines.push(`import { defineApi${usesTypes ? ", endpoint" : ""} } from 'routesync'`);
|
|
8659
8755
|
if (usesZod) {
|
|
8660
8756
|
lines.push(`import { z } from 'zod'`);
|
|
8757
|
+
lines.push(`import * as Schemas from './schemas'`);
|
|
8758
|
+
}
|
|
8759
|
+
if (usesTypes) {
|
|
8760
|
+
lines.push(`import * as Types from './types'`);
|
|
8761
|
+
}
|
|
8762
|
+
lines.push(``);
|
|
8763
|
+
for (const [group, routes] of Object.entries(grouped)) {
|
|
8764
|
+
for (const route of routes) {
|
|
8765
|
+
const TitleCaseGroup = group.charAt(0).toUpperCase() + group.slice(1);
|
|
8766
|
+
const TitleCaseAction = route.actionName.charAt(0).toUpperCase() + route.actionName.slice(1);
|
|
8767
|
+
const ContractName = `${TitleCaseGroup}${TitleCaseAction}Contract`;
|
|
8768
|
+
const pathParams = Array.from(route.runtimePath.matchAll(/:([a-zA-Z0-9_]+)/g)).map((m) => m[1]);
|
|
8769
|
+
const paramsType = pathParams.length > 0 ? `{ ${pathParams.map((p) => `${p}: string`).join(", ")} }` : `Record<string, never>`;
|
|
8770
|
+
const methodActionName = TitleCaseGroup + TitleCaseAction;
|
|
8771
|
+
const bodyType = route.schema?.rules && usesZod ? `z.infer<typeof Schemas.${methodActionName}Schema>` : `unknown`;
|
|
8772
|
+
const responseType = route.response ? `Types.${route.response.type}${route.response.collection ? "[]" : ""}` : `unknown`;
|
|
8773
|
+
lines.push(`export type ${ContractName} = {`);
|
|
8774
|
+
lines.push(` request: {`);
|
|
8775
|
+
lines.push(` params: ${paramsType}`);
|
|
8776
|
+
lines.push(` query?: Record<string, unknown>`);
|
|
8777
|
+
lines.push(` body: ${bodyType}`);
|
|
8778
|
+
lines.push(` }`);
|
|
8779
|
+
lines.push(` response: ${responseType}`);
|
|
8780
|
+
lines.push(`}`);
|
|
8781
|
+
}
|
|
8661
8782
|
}
|
|
8662
8783
|
lines.push(``);
|
|
8663
8784
|
lines.push(`export const api = defineApi({`);
|
|
8664
8785
|
for (const [group, routes] of Object.entries(grouped)) {
|
|
8665
8786
|
lines.push(` ${group}: {`);
|
|
8666
8787
|
for (const route of routes) {
|
|
8667
|
-
|
|
8788
|
+
const TitleCaseGroup = group.charAt(0).toUpperCase() + group.slice(1);
|
|
8789
|
+
const TitleCaseAction = route.actionName.charAt(0).toUpperCase() + route.actionName.slice(1);
|
|
8790
|
+
const ContractName = `${TitleCaseGroup}${TitleCaseAction}Contract`;
|
|
8791
|
+
lines.push(` ${route.actionName}: endpoint<${ContractName}['response'], ${ContractName}['request']['params'], ${ContractName}['request']['body']>({`);
|
|
8668
8792
|
lines.push(` method: '${route.method}',`);
|
|
8669
8793
|
lines.push(` path: '${route.runtimePath}',`);
|
|
8670
8794
|
if (route.auth) lines.push(` auth: true,`);
|
|
8671
8795
|
if (options.zod && route.schema?.rules) {
|
|
8672
|
-
const zodSchema = _SDKGenerator.translateRulesToZod(route.schema.rules);
|
|
8673
8796
|
lines.push(` schema: {`);
|
|
8674
|
-
lines.push(` body:
|
|
8797
|
+
lines.push(` body: Schemas.${ContractName.replace("Contract", "Schema")}`);
|
|
8675
8798
|
lines.push(` },`);
|
|
8676
8799
|
}
|
|
8677
|
-
|
|
8800
|
+
if (options.zod && route.response) {
|
|
8801
|
+
lines.push(` responseSchema: Schemas.${route.response.type}Schema${route.response.collection ? ".array()" : ""},`);
|
|
8802
|
+
}
|
|
8803
|
+
lines.push(` }),`);
|
|
8678
8804
|
}
|
|
8679
8805
|
lines.push(` },`);
|
|
8680
8806
|
}
|
|
@@ -8683,54 +8809,6 @@ var SDKGenerator = class _SDKGenerator {
|
|
|
8683
8809
|
lines.push(`export default api`);
|
|
8684
8810
|
await import_fs_extra3.default.writeFile(import_path2.default.join(outputDir, "api.ts"), lines.join("\n"));
|
|
8685
8811
|
}
|
|
8686
|
-
static translateRulesToZod(rules) {
|
|
8687
|
-
const fields = [];
|
|
8688
|
-
for (const [field, rawRules] of Object.entries(rules)) {
|
|
8689
|
-
let ruleArray = [];
|
|
8690
|
-
if (typeof rawRules === "string") {
|
|
8691
|
-
ruleArray = rawRules.split("|");
|
|
8692
|
-
} else if (Array.isArray(rawRules)) {
|
|
8693
|
-
ruleArray = rawRules;
|
|
8694
|
-
}
|
|
8695
|
-
let isRequired = false;
|
|
8696
|
-
let isNullable = false;
|
|
8697
|
-
let isString = false;
|
|
8698
|
-
let isNumeric = false;
|
|
8699
|
-
let isArray = false;
|
|
8700
|
-
let isBoolean = false;
|
|
8701
|
-
let isEmail = false;
|
|
8702
|
-
let min = null;
|
|
8703
|
-
let max = null;
|
|
8704
|
-
for (const rule of ruleArray) {
|
|
8705
|
-
if (typeof rule !== "string") continue;
|
|
8706
|
-
const r = rule.toLowerCase();
|
|
8707
|
-
if (r === "required") isRequired = true;
|
|
8708
|
-
if (r === "nullable") isNullable = true;
|
|
8709
|
-
if (r === "string") isString = true;
|
|
8710
|
-
if (r === "numeric" || r === "integer" || r === "int") isNumeric = true;
|
|
8711
|
-
if (r === "array") isArray = true;
|
|
8712
|
-
if (r === "boolean" || r === "bool") isBoolean = true;
|
|
8713
|
-
if (r === "email") isEmail = true;
|
|
8714
|
-
if (r.startsWith("min:")) min = r.split(":")[1];
|
|
8715
|
-
if (r.startsWith("max:")) max = r.split(":")[1];
|
|
8716
|
-
}
|
|
8717
|
-
let zType = "z.unknown()";
|
|
8718
|
-
if (isString) zType = "z.string()";
|
|
8719
|
-
else if (isNumeric) zType = "z.number()";
|
|
8720
|
-
else if (isBoolean) zType = "z.boolean()";
|
|
8721
|
-
else if (isArray) zType = "z.array(z.unknown())";
|
|
8722
|
-
else if (isEmail) zType = "z.string()";
|
|
8723
|
-
if (isEmail && zType === "z.string()") zType += ".email()";
|
|
8724
|
-
if (min && !isNaN(Number(min))) zType += `.min(${min})`;
|
|
8725
|
-
if (max && !isNaN(Number(max))) zType += `.max(${max})`;
|
|
8726
|
-
if (!isRequired) zType += ".optional()";
|
|
8727
|
-
if (isNullable) zType += ".nullable()";
|
|
8728
|
-
fields.push(` "${field}": ${zType}`);
|
|
8729
|
-
}
|
|
8730
|
-
return `z.object({
|
|
8731
|
-
${fields.join(",\n")}
|
|
8732
|
-
})`;
|
|
8733
|
-
}
|
|
8734
8812
|
};
|
|
8735
8813
|
|
|
8736
8814
|
// packages/core/src/utils.ts
|
|
@@ -8781,10 +8859,6 @@ var TypeGenerator = class {
|
|
|
8781
8859
|
const hasSchemas = manifest.routes.some((r) => r.schema && Object.keys(r.schema).length > 0);
|
|
8782
8860
|
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8783
8861
|
lines.push(``);
|
|
8784
|
-
if (hasSchemas) {
|
|
8785
|
-
lines.push(`import { z } from 'zod'`);
|
|
8786
|
-
lines.push(``);
|
|
8787
|
-
}
|
|
8788
8862
|
lines.push(`export interface ApiResponse<T = unknown> {`);
|
|
8789
8863
|
lines.push(` success: boolean`);
|
|
8790
8864
|
lines.push(` message?: string`);
|
|
@@ -8840,37 +8914,72 @@ var TypeGenerator = class {
|
|
|
8840
8914
|
lines.push(``);
|
|
8841
8915
|
}
|
|
8842
8916
|
}
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8917
|
+
await import_fs_extra4.default.writeFile(import_path3.default.join(outputDir, "types.ts"), lines.join("\n"));
|
|
8918
|
+
}
|
|
8919
|
+
static mapSqlTypeToTs(sqlType) {
|
|
8920
|
+
const type = sqlType.toLowerCase();
|
|
8921
|
+
if (type.includes("int") || type.includes("decimal") || type.includes("float") || type.includes("double")) return "number";
|
|
8922
|
+
if (type.includes("bool") || type.includes("tinyint(1)")) return "boolean";
|
|
8923
|
+
if (type.includes("json")) return "unknown";
|
|
8924
|
+
return "string";
|
|
8925
|
+
}
|
|
8926
|
+
};
|
|
8927
|
+
|
|
8928
|
+
// packages/cli/src/generators/SchemaGenerator.ts
|
|
8929
|
+
var import_path4 = __toESM(require("path"));
|
|
8930
|
+
var import_fs_extra5 = __toESM(require_lib());
|
|
8931
|
+
var SchemaGenerator = class {
|
|
8932
|
+
static async generate(manifest, outputDir) {
|
|
8933
|
+
const lines = [];
|
|
8934
|
+
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8935
|
+
lines.push(``);
|
|
8936
|
+
lines.push(`import { z } from 'zod'`);
|
|
8937
|
+
lines.push(``);
|
|
8938
|
+
if (manifest.models && manifest.models.length > 0) {
|
|
8939
|
+
for (const model of manifest.models) {
|
|
8940
|
+
lines.push(`export const ${model.name}Schema = z.object({`);
|
|
8941
|
+
const hidden = Array.isArray(model.hidden) ? model.hidden : [];
|
|
8942
|
+
const casts = model.casts || {};
|
|
8943
|
+
for (const col of model.columns) {
|
|
8944
|
+
const isHidden2 = hidden.includes(col.name);
|
|
8945
|
+
const castType = casts[col.name];
|
|
8946
|
+
let zType = this.mapSqlTypeToZod(col.type);
|
|
8947
|
+
if (castType) {
|
|
8948
|
+
zType = this.mapCastToZod(castType, zType);
|
|
8949
|
+
}
|
|
8950
|
+
if (col.nullable) {
|
|
8951
|
+
zType += ".nullable()";
|
|
8856
8952
|
}
|
|
8953
|
+
if (isHidden2) {
|
|
8954
|
+
zType += ".optional()";
|
|
8955
|
+
}
|
|
8956
|
+
const safeName = camelCase(col.name).match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/) ? camelCase(col.name) : `"${camelCase(col.name)}"`;
|
|
8957
|
+
lines.push(` ${safeName}: ${zType},`);
|
|
8958
|
+
}
|
|
8959
|
+
const appends = Array.isArray(model.appends) ? model.appends : [];
|
|
8960
|
+
for (const append of appends) {
|
|
8961
|
+
const safeAppend = camelCase(append).match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/) ? camelCase(append) : `"${camelCase(append)}"`;
|
|
8962
|
+
lines.push(` ${safeAppend}: z.unknown().optional(), // appended attribute`);
|
|
8963
|
+
}
|
|
8964
|
+
lines.push(`})`);
|
|
8965
|
+
lines.push(``);
|
|
8966
|
+
}
|
|
8967
|
+
}
|
|
8968
|
+
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
8969
|
+
for (const [group, routes] of Object.entries(grouped)) {
|
|
8970
|
+
for (const route of routes) {
|
|
8971
|
+
if (route.schema && route.schema.rules && Object.keys(route.schema.rules).length > 0) {
|
|
8972
|
+
const TitleCaseGroup = group.charAt(0).toUpperCase() + group.slice(1);
|
|
8973
|
+
const TitleCaseAction = route.actionName.charAt(0).toUpperCase() + route.actionName.slice(1);
|
|
8974
|
+
const schemaName = TitleCaseGroup + TitleCaseAction + "Schema";
|
|
8857
8975
|
lines.push(`export const ${schemaName} = z.object({`);
|
|
8858
8976
|
for (const [field, rules] of Object.entries(route.schema.rules)) {
|
|
8859
8977
|
const ruleStr = Array.isArray(rules) ? rules.join("|") : String(rules);
|
|
8860
|
-
let zodRule = "z.
|
|
8861
|
-
if (ruleStr.includes("
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
} else if (ruleStr.includes("array")) {
|
|
8866
|
-
zodRule = "z.array(z.unknown())";
|
|
8867
|
-
}
|
|
8868
|
-
if (ruleStr.includes("email")) zodRule += ".email()";
|
|
8869
|
-
if (ruleStr.includes("url")) zodRule += ".url()";
|
|
8870
|
-
const matchMin = ruleStr.match(/min:(\d+)/);
|
|
8871
|
-
if (matchMin) zodRule += ".min(" + matchMin[1] + ")";
|
|
8872
|
-
const matchMax = ruleStr.match(/max:(\d+)/);
|
|
8873
|
-
if (matchMax) zodRule += ".max(" + matchMax[1] + ")";
|
|
8978
|
+
let zodRule = "z.unknown()";
|
|
8979
|
+
if (ruleStr.includes("string")) zodRule = "z.string()";
|
|
8980
|
+
if (ruleStr.includes("numeric") || ruleStr.includes("integer") || ruleStr.includes("int")) zodRule = "z.number()";
|
|
8981
|
+
if (ruleStr.includes("boolean") || ruleStr.includes("bool")) zodRule = "z.boolean()";
|
|
8982
|
+
if (ruleStr.includes("array")) zodRule = "z.array(z.unknown())";
|
|
8874
8983
|
if (!ruleStr.includes("required")) {
|
|
8875
8984
|
zodRule += ".optional()";
|
|
8876
8985
|
}
|
|
@@ -8882,33 +8991,58 @@ var TypeGenerator = class {
|
|
|
8882
8991
|
lines.push(` ${safeField}: ${zodRule},`);
|
|
8883
8992
|
}
|
|
8884
8993
|
lines.push(`})`);
|
|
8885
|
-
lines.push(`export type ${toTypeName(actionName + "Payload")} = z.infer<typeof ${schemaName}>`);
|
|
8886
8994
|
lines.push(``);
|
|
8887
8995
|
}
|
|
8888
8996
|
}
|
|
8889
8997
|
}
|
|
8890
|
-
await
|
|
8998
|
+
await import_fs_extra5.default.writeFile(import_path4.default.join(outputDir, "schemas.ts"), lines.join("\n"));
|
|
8891
8999
|
}
|
|
8892
|
-
static
|
|
9000
|
+
static mapSqlTypeToZod(sqlType) {
|
|
8893
9001
|
const type = sqlType.toLowerCase();
|
|
8894
|
-
if (type.includes("int") || type.includes("
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
9002
|
+
if (type.includes("int") || type.includes("float") || type.includes("double") || type.includes("decimal") || type.includes("numeric")) {
|
|
9003
|
+
return "z.number()";
|
|
9004
|
+
}
|
|
9005
|
+
if (type.includes("bool") || type.includes("tinyint(1)")) {
|
|
9006
|
+
return "z.boolean()";
|
|
9007
|
+
}
|
|
9008
|
+
if (type.includes("json")) {
|
|
9009
|
+
return "z.record(z.unknown())";
|
|
9010
|
+
}
|
|
9011
|
+
const enumMatch = type.match(/^enum\((.*)\)$/);
|
|
9012
|
+
if (enumMatch && enumMatch[1]) {
|
|
9013
|
+
const values = enumMatch[1].split(",").map((v) => v.trim().replace(/^'|'$/g, ""));
|
|
9014
|
+
return `z.union([${values.map((v) => `z.literal('${v}')`).join(", ")}])`;
|
|
9015
|
+
}
|
|
9016
|
+
return "z.string()";
|
|
9017
|
+
}
|
|
9018
|
+
static mapCastToZod(castType, defaultType) {
|
|
9019
|
+
const type = castType.toLowerCase();
|
|
9020
|
+
if (type.includes("int") || type.includes("float") || type.includes("decimal") || type.includes("double")) {
|
|
9021
|
+
return "z.number()";
|
|
9022
|
+
}
|
|
9023
|
+
if (type.includes("bool")) {
|
|
9024
|
+
return "z.boolean()";
|
|
9025
|
+
}
|
|
9026
|
+
if (type.includes("array") || type.includes("json") || type.includes("collection") || type.includes("object")) {
|
|
9027
|
+
return "z.record(z.unknown())";
|
|
9028
|
+
}
|
|
9029
|
+
if (type.includes("date") || type.includes("datetime") || type.includes("string")) {
|
|
9030
|
+
return "z.string()";
|
|
9031
|
+
}
|
|
9032
|
+
return defaultType;
|
|
8898
9033
|
}
|
|
8899
9034
|
};
|
|
8900
9035
|
|
|
8901
9036
|
// packages/cli/src/generators/HookGenerator.ts
|
|
8902
|
-
var
|
|
8903
|
-
var
|
|
9037
|
+
var import_path5 = __toESM(require("path"));
|
|
9038
|
+
var import_fs_extra6 = __toESM(require_lib());
|
|
8904
9039
|
var HookGenerator = class _HookGenerator {
|
|
8905
9040
|
static async generate(manifest, outputDir) {
|
|
8906
9041
|
const lines = [];
|
|
8907
9042
|
lines.push(`// Auto-generated by routesync. Do not edit manually.`);
|
|
8908
9043
|
lines.push(``);
|
|
8909
|
-
lines.push(`import {
|
|
9044
|
+
lines.push(`import { useApiQuery, useApiMutation } from '@routesync/react'`);
|
|
8910
9045
|
lines.push(`import { api } from './api'`);
|
|
8911
|
-
lines.push(`import * as Types from './types'`);
|
|
8912
9046
|
lines.push(``);
|
|
8913
9047
|
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
8914
9048
|
const modelNames = (manifest.models || []).map((m) => m.name);
|
|
@@ -8917,58 +9051,35 @@ var HookGenerator = class _HookGenerator {
|
|
|
8917
9051
|
const method = route.method.toUpperCase();
|
|
8918
9052
|
const hookName = _HookGenerator.toHookName(group, route.actionName);
|
|
8919
9053
|
const queryKey = `['${group}', '${route.actionName}']`;
|
|
8920
|
-
const possibleModel = _HookGenerator.findMatchingModel(group, modelNames);
|
|
8921
|
-
let responseType = "unknown";
|
|
8922
|
-
if (possibleModel) {
|
|
8923
|
-
if (route.actionName === "get" || route.actionName === "index" || !route.runtimePath.includes(":") && method === "GET") {
|
|
8924
|
-
responseType = `Types.${possibleModel}[]`;
|
|
8925
|
-
} else {
|
|
8926
|
-
responseType = `Types.${possibleModel}`;
|
|
8927
|
-
}
|
|
8928
|
-
}
|
|
8929
|
-
const returnType = possibleModel ? `Types.ApiResponse<${responseType}>` : `unknown`;
|
|
8930
9054
|
if (method === "GET") {
|
|
8931
|
-
lines.push(
|
|
8932
|
-
lines.push(`
|
|
8933
|
-
lines.push(`
|
|
8934
|
-
lines.push(`
|
|
8935
|
-
lines.push(` })`);
|
|
9055
|
+
lines.push(`/**`);
|
|
9056
|
+
lines.push(` * @deprecated Use \`useApiQuery(api.${group}.${route.actionName}, ...args)\` instead.`);
|
|
9057
|
+
lines.push(` */`);
|
|
9058
|
+
lines.push(`export function ${hookName}(...args: Parameters<typeof api.${group}.${route.actionName}>) {`);
|
|
9059
|
+
lines.push(` return useApiQuery(api.${group}.${route.actionName}, ...args as any)`);
|
|
8936
9060
|
lines.push(`}`);
|
|
8937
9061
|
lines.push(``);
|
|
8938
9062
|
} else {
|
|
8939
|
-
lines.push(
|
|
8940
|
-
lines.push(`
|
|
8941
|
-
lines.push(`
|
|
8942
|
-
lines.push(`
|
|
8943
|
-
lines.push(`
|
|
8944
|
-
lines.push(` queryClient.invalidateQueries({ queryKey: ['${group}'] })`);
|
|
8945
|
-
lines.push(` }`);
|
|
8946
|
-
lines.push(` })`);
|
|
9063
|
+
lines.push(`/**`);
|
|
9064
|
+
lines.push(` * @deprecated Use \`useApiMutation(api.${group}.${route.actionName}, options)\` instead.`);
|
|
9065
|
+
lines.push(` */`);
|
|
9066
|
+
lines.push(`export function ${hookName}() {`);
|
|
9067
|
+
lines.push(` return useApiMutation(api.${group}.${route.actionName})`);
|
|
8947
9068
|
lines.push(`}`);
|
|
8948
9069
|
lines.push(``);
|
|
8949
9070
|
}
|
|
8950
9071
|
}
|
|
8951
9072
|
}
|
|
8952
|
-
await
|
|
9073
|
+
await import_fs_extra6.default.writeFile(import_path5.default.join(outputDir, "hooks.ts"), lines.join("\n"));
|
|
8953
9074
|
}
|
|
8954
9075
|
static toHookName(group, actionName) {
|
|
8955
9076
|
return `use${toTypeName(group)}${toTypeName(actionName)}`;
|
|
8956
9077
|
}
|
|
8957
|
-
static findMatchingModel(group, modelNames) {
|
|
8958
|
-
const exact = modelNames.find((m) => m.toLowerCase() === group.toLowerCase());
|
|
8959
|
-
if (exact) return exact;
|
|
8960
|
-
const singularGroup = group.toLowerCase().replace(/ies$/, "y").replace(/s$/, "");
|
|
8961
|
-
const singularMatch = modelNames.find((m) => m.toLowerCase() === singularGroup);
|
|
8962
|
-
if (singularMatch) return singularMatch;
|
|
8963
|
-
const prefixMatch = modelNames.find((m) => m.toLowerCase().startsWith(group.toLowerCase()) || m.toLowerCase().startsWith(singularGroup));
|
|
8964
|
-
if (prefixMatch) return prefixMatch;
|
|
8965
|
-
return void 0;
|
|
8966
|
-
}
|
|
8967
9078
|
};
|
|
8968
9079
|
|
|
8969
9080
|
// packages/cli/src/generators/NextActionGenerator.ts
|
|
8970
|
-
var
|
|
8971
|
-
var
|
|
9081
|
+
var import_path6 = __toESM(require("path"));
|
|
9082
|
+
var import_fs_extra7 = __toESM(require_lib());
|
|
8972
9083
|
var NextActionGenerator = class {
|
|
8973
9084
|
static async generate(manifest, outputDir) {
|
|
8974
9085
|
const lines = [];
|
|
@@ -9013,13 +9124,13 @@ var NextActionGenerator = class {
|
|
|
9013
9124
|
lines.push(``);
|
|
9014
9125
|
}
|
|
9015
9126
|
}
|
|
9016
|
-
await
|
|
9127
|
+
await import_fs_extra7.default.writeFile(import_path6.default.join(outputDir, "actions.ts"), lines.join("\n"));
|
|
9017
9128
|
}
|
|
9018
9129
|
};
|
|
9019
9130
|
|
|
9020
9131
|
// packages/cli/src/generators/MswGenerator.ts
|
|
9021
|
-
var
|
|
9022
|
-
var
|
|
9132
|
+
var import_path7 = __toESM(require("path"));
|
|
9133
|
+
var import_fs_extra8 = __toESM(require_lib());
|
|
9023
9134
|
var MswGenerator = class {
|
|
9024
9135
|
static async generate(manifest, outputDir) {
|
|
9025
9136
|
const lines = [];
|
|
@@ -9045,13 +9156,13 @@ var MswGenerator = class {
|
|
|
9045
9156
|
lines.push(` }),`);
|
|
9046
9157
|
}
|
|
9047
9158
|
lines.push(`]`);
|
|
9048
|
-
await
|
|
9159
|
+
await import_fs_extra8.default.writeFile(import_path7.default.join(outputDir, "mocks.ts"), lines.join("\n"));
|
|
9049
9160
|
}
|
|
9050
9161
|
};
|
|
9051
9162
|
|
|
9052
9163
|
// packages/cli/src/generators/EchoGenerator.ts
|
|
9053
|
-
var
|
|
9054
|
-
var
|
|
9164
|
+
var import_fs_extra9 = __toESM(require_lib());
|
|
9165
|
+
var import_path8 = __toESM(require("path"));
|
|
9055
9166
|
var EchoGenerator = class {
|
|
9056
9167
|
static async generate(channels, outputDir) {
|
|
9057
9168
|
if (channels.length === 0) return;
|
|
@@ -9087,13 +9198,13 @@ var EchoGenerator = class {
|
|
|
9087
9198
|
lines.push(`}`);
|
|
9088
9199
|
lines.push(``);
|
|
9089
9200
|
}
|
|
9090
|
-
await
|
|
9201
|
+
await import_fs_extra9.default.writeFile(import_path8.default.join(outputDir, "echo.ts"), lines.join("\n"));
|
|
9091
9202
|
}
|
|
9092
9203
|
};
|
|
9093
9204
|
|
|
9094
9205
|
// packages/cli/src/generators/IndexGenerator.ts
|
|
9095
|
-
var
|
|
9096
|
-
var
|
|
9206
|
+
var import_path9 = __toESM(require("path"));
|
|
9207
|
+
var import_fs_extra10 = __toESM(require_lib());
|
|
9097
9208
|
var IndexGenerator = class {
|
|
9098
9209
|
static async generate(manifest, outputDir, options) {
|
|
9099
9210
|
const grouped = buildGeneratedRoutes(manifest.routes);
|
|
@@ -9103,21 +9214,21 @@ var IndexGenerator = class {
|
|
|
9103
9214
|
rootLines.push(`export * from './types'`);
|
|
9104
9215
|
if (options.hooks !== false) rootLines.push(`export * from './hooks'`);
|
|
9105
9216
|
if (options.nextActions) rootLines.push(`export * from './actions'`);
|
|
9106
|
-
await
|
|
9217
|
+
await import_fs_extra10.default.writeFile(import_path9.default.join(outputDir, "index.ts"), rootLines.join("\n"));
|
|
9107
9218
|
}
|
|
9108
9219
|
};
|
|
9109
9220
|
|
|
9110
9221
|
// packages/cli/src/commands/generate.ts
|
|
9111
|
-
var
|
|
9222
|
+
var import_fs_extra12 = __toESM(require_lib());
|
|
9112
9223
|
|
|
9113
9224
|
// packages/cli/src/generators/ModelGenerator.ts
|
|
9114
|
-
var
|
|
9115
|
-
var
|
|
9225
|
+
var import_fs_extra11 = __toESM(require_lib());
|
|
9226
|
+
var import_path10 = __toESM(require("path"));
|
|
9116
9227
|
var ModelGenerator = class {
|
|
9117
9228
|
static async generate(manifest, outputDir) {
|
|
9118
9229
|
if (!manifest.models || manifest.models.length === 0) return;
|
|
9119
|
-
const coreDir =
|
|
9120
|
-
await
|
|
9230
|
+
const coreDir = import_path10.default.join(outputDir, "core");
|
|
9231
|
+
await import_fs_extra11.default.ensureDir(coreDir);
|
|
9121
9232
|
const lines = [];
|
|
9122
9233
|
lines.push(`// Auto-generated. Do not edit.`);
|
|
9123
9234
|
lines.push(``);
|
|
@@ -9143,7 +9254,7 @@ var ModelGenerator = class {
|
|
|
9143
9254
|
lines.push(`}`);
|
|
9144
9255
|
lines.push(``);
|
|
9145
9256
|
}
|
|
9146
|
-
await
|
|
9257
|
+
await import_fs_extra11.default.writeFile(import_path10.default.join(coreDir, "models.ts"), lines.join("\n"));
|
|
9147
9258
|
}
|
|
9148
9259
|
static mapSqlTypeToTs(sqlType) {
|
|
9149
9260
|
const type = sqlType.toLowerCase();
|
|
@@ -9185,15 +9296,18 @@ var ModelGenerator = class {
|
|
|
9185
9296
|
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").option("--zod", "Generate Zod schemas for validation").action(async (options) => {
|
|
9186
9297
|
const spinner = ora("Generating SDK...").start();
|
|
9187
9298
|
try {
|
|
9188
|
-
if (!
|
|
9299
|
+
if (!import_fs_extra12.default.existsSync(options.manifest)) {
|
|
9189
9300
|
throw new Error(
|
|
9190
9301
|
`Manifest not found: ${options.manifest}. Run 'routesync scan' first.`
|
|
9191
9302
|
);
|
|
9192
9303
|
}
|
|
9193
|
-
const manifest = await
|
|
9194
|
-
await
|
|
9304
|
+
const manifest = await import_fs_extra12.default.readJson(options.manifest);
|
|
9305
|
+
await import_fs_extra12.default.ensureDir(options.output);
|
|
9195
9306
|
spinner.text = "Generating types...";
|
|
9196
9307
|
await TypeGenerator.generate(manifest, options.output);
|
|
9308
|
+
if (options.zod) {
|
|
9309
|
+
await SchemaGenerator.generate(manifest, options.output);
|
|
9310
|
+
}
|
|
9197
9311
|
spinner.text = "Generating SDK...";
|
|
9198
9312
|
await SDKGenerator.generate(manifest, options.output, options);
|
|
9199
9313
|
if (options.hooks !== false) {
|
|
@@ -9243,13 +9357,13 @@ var generateCommand = new Command("generate").description("Generate typed SDK, t
|
|
|
9243
9357
|
});
|
|
9244
9358
|
|
|
9245
9359
|
// packages/cli/src/parsers/LaravelChannelParser.ts
|
|
9246
|
-
var
|
|
9360
|
+
var import_fs_extra13 = __toESM(require_lib());
|
|
9247
9361
|
var LaravelChannelParser = class {
|
|
9248
9362
|
async parse(channelFilePath = "routes/channels.php") {
|
|
9249
|
-
if (!
|
|
9363
|
+
if (!import_fs_extra13.default.existsSync(channelFilePath)) {
|
|
9250
9364
|
return [];
|
|
9251
9365
|
}
|
|
9252
|
-
const content = await
|
|
9366
|
+
const content = await import_fs_extra13.default.readFile(channelFilePath, "utf-8");
|
|
9253
9367
|
const channels = [];
|
|
9254
9368
|
const regex2 = new RegExp(`Broadcast::channel\\(\\s*['"]([^'"]+)['"]`, "g");
|
|
9255
9369
|
let match;
|
|
@@ -9267,7 +9381,7 @@ var LaravelChannelParser = class {
|
|
|
9267
9381
|
};
|
|
9268
9382
|
|
|
9269
9383
|
// packages/cli/src/commands/sync.ts
|
|
9270
|
-
var
|
|
9384
|
+
var import_fs_extra14 = __toESM(require_lib());
|
|
9271
9385
|
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").option("--zod", "Generate Zod Schemas for request validation").action(async (options) => {
|
|
9272
9386
|
console.log(source_default.bold.blue("\n routesync sync\n"));
|
|
9273
9387
|
const steps = [
|
|
@@ -9286,9 +9400,12 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
9286
9400
|
const manifest = ManifestGenerator.generate(routes, options.baseURL, channels);
|
|
9287
9401
|
if (options.models) manifest.models = models;
|
|
9288
9402
|
spinner.succeed(source_default.green(`\u2714 ${steps[0].text} (${routes.length} routes, ${channels.length} channels, ${models.length} models)`));
|
|
9289
|
-
await
|
|
9403
|
+
await import_fs_extra14.default.ensureDir(options.output);
|
|
9290
9404
|
spinner.start(steps[1].text);
|
|
9291
9405
|
await TypeGenerator.generate(manifest, options.output);
|
|
9406
|
+
if (options.zod) {
|
|
9407
|
+
await SchemaGenerator.generate(manifest, options.output);
|
|
9408
|
+
}
|
|
9292
9409
|
spinner.succeed(source_default.green(`\u2714 ${steps[1].text}`));
|
|
9293
9410
|
spinner.start(steps[2].text);
|
|
9294
9411
|
await SDKGenerator.generate(manifest, options.output, options);
|
|
@@ -9297,6 +9414,7 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
9297
9414
|
spinner.start(steps[3].text);
|
|
9298
9415
|
await HookGenerator.generate(manifest, options.output);
|
|
9299
9416
|
spinner.succeed(source_default.green(`\u2714 ${steps[3].text}`));
|
|
9417
|
+
console.warn(source_default.yellow("\n [DEPRECATED] Hook generation will be disabled by default in v2. Please migrate to useApiQuery().\n"));
|
|
9300
9418
|
}
|
|
9301
9419
|
if (options.nextActions) {
|
|
9302
9420
|
spinner.start(steps[4].text);
|
|
@@ -9330,8 +9448,8 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
|
|
|
9330
9448
|
});
|
|
9331
9449
|
|
|
9332
9450
|
// packages/cli/src/commands/watch.ts
|
|
9333
|
-
var
|
|
9334
|
-
var
|
|
9451
|
+
var import_fs_extra15 = __toESM(require_lib());
|
|
9452
|
+
var import_path11 = __toESM(require("path"));
|
|
9335
9453
|
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) => {
|
|
9336
9454
|
console.log(source_default.bold.blue("\n routesync watch\n"));
|
|
9337
9455
|
console.log(` Watching: ${source_default.cyan(options.input)}`);
|
|
@@ -9352,11 +9470,11 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
|
|
|
9352
9470
|
}
|
|
9353
9471
|
}, 300);
|
|
9354
9472
|
};
|
|
9355
|
-
if (!
|
|
9473
|
+
if (!import_fs_extra15.default.existsSync(options.input)) {
|
|
9356
9474
|
console.error(source_default.red(` File not found: ${options.input}`));
|
|
9357
9475
|
process.exit(1);
|
|
9358
9476
|
}
|
|
9359
|
-
|
|
9477
|
+
import_fs_extra15.default.watch(import_path11.default.resolve(options.input), onChange);
|
|
9360
9478
|
});
|
|
9361
9479
|
|
|
9362
9480
|
// packages/cli/src/index.ts
|