routesync 1.0.36 → 1.0.39
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/README.md +90 -43
- package/dist/cli.js +618 -389
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -983,8 +983,8 @@ var require_command = __commonJS({
|
|
|
983
983
|
"use strict";
|
|
984
984
|
var EventEmitter = require("events").EventEmitter;
|
|
985
985
|
var childProcess = require("child_process");
|
|
986
|
-
var
|
|
987
|
-
var
|
|
986
|
+
var path13 = require("path");
|
|
987
|
+
var fs17 = 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 = path13.resolve(baseDir, baseName);
|
|
1920
|
+
if (fs17.existsSync(localBin)) return localBin;
|
|
1921
|
+
if (sourceExt.includes(path13.extname(baseName))) return void 0;
|
|
1922
1922
|
const foundExt = sourceExt.find(
|
|
1923
|
-
(ext) =>
|
|
1923
|
+
(ext) => fs17.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 = fs17.realpathSync(this._scriptPath);
|
|
1936
1936
|
} catch (err) {
|
|
1937
1937
|
resolvedScriptPath = this._scriptPath;
|
|
1938
1938
|
}
|
|
1939
|
-
executableDir =
|
|
1940
|
-
|
|
1939
|
+
executableDir = path13.resolve(
|
|
1940
|
+
path13.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 = path13.basename(
|
|
1948
1948
|
this._scriptPath,
|
|
1949
|
-
|
|
1949
|
+
path13.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(path13.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 = path13.basename(filename, path13.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(path14) {
|
|
2815
|
+
if (path14 === void 0) return this._executableDir;
|
|
2816
|
+
this._executableDir = path14;
|
|
2817
2817
|
return this;
|
|
2818
2818
|
}
|
|
2819
2819
|
/**
|
|
@@ -4744,54 +4744,54 @@ var require_polyfills = __commonJS({
|
|
|
4744
4744
|
}
|
|
4745
4745
|
var chdir;
|
|
4746
4746
|
module2.exports = patch;
|
|
4747
|
-
function patch(
|
|
4747
|
+
function patch(fs17) {
|
|
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(fs17);
|
|
4750
|
+
}
|
|
4751
|
+
if (!fs17.lutimes) {
|
|
4752
|
+
patchLutimes(fs17);
|
|
4753
|
+
}
|
|
4754
|
+
fs17.chown = chownFix(fs17.chown);
|
|
4755
|
+
fs17.fchown = chownFix(fs17.fchown);
|
|
4756
|
+
fs17.lchown = chownFix(fs17.lchown);
|
|
4757
|
+
fs17.chmod = chmodFix(fs17.chmod);
|
|
4758
|
+
fs17.fchmod = chmodFix(fs17.fchmod);
|
|
4759
|
+
fs17.lchmod = chmodFix(fs17.lchmod);
|
|
4760
|
+
fs17.chownSync = chownFixSync(fs17.chownSync);
|
|
4761
|
+
fs17.fchownSync = chownFixSync(fs17.fchownSync);
|
|
4762
|
+
fs17.lchownSync = chownFixSync(fs17.lchownSync);
|
|
4763
|
+
fs17.chmodSync = chmodFixSync(fs17.chmodSync);
|
|
4764
|
+
fs17.fchmodSync = chmodFixSync(fs17.fchmodSync);
|
|
4765
|
+
fs17.lchmodSync = chmodFixSync(fs17.lchmodSync);
|
|
4766
|
+
fs17.stat = statFix(fs17.stat);
|
|
4767
|
+
fs17.fstat = statFix(fs17.fstat);
|
|
4768
|
+
fs17.lstat = statFix(fs17.lstat);
|
|
4769
|
+
fs17.statSync = statFixSync(fs17.statSync);
|
|
4770
|
+
fs17.fstatSync = statFixSync(fs17.fstatSync);
|
|
4771
|
+
fs17.lstatSync = statFixSync(fs17.lstatSync);
|
|
4772
|
+
if (fs17.chmod && !fs17.lchmod) {
|
|
4773
|
+
fs17.lchmod = function(path13, mode, cb) {
|
|
4774
4774
|
if (cb) process.nextTick(cb);
|
|
4775
4775
|
};
|
|
4776
|
-
|
|
4776
|
+
fs17.lchmodSync = function() {
|
|
4777
4777
|
};
|
|
4778
4778
|
}
|
|
4779
|
-
if (
|
|
4780
|
-
|
|
4779
|
+
if (fs17.chown && !fs17.lchown) {
|
|
4780
|
+
fs17.lchown = function(path13, uid, gid, cb) {
|
|
4781
4781
|
if (cb) process.nextTick(cb);
|
|
4782
4782
|
};
|
|
4783
|
-
|
|
4783
|
+
fs17.lchownSync = function() {
|
|
4784
4784
|
};
|
|
4785
4785
|
}
|
|
4786
4786
|
if (platform === "win32") {
|
|
4787
|
-
|
|
4787
|
+
fs17.rename = typeof fs17.rename !== "function" ? fs17.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
|
+
fs17.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
|
+
})(fs17.rename);
|
|
4811
4811
|
}
|
|
4812
|
-
|
|
4812
|
+
fs17.read = typeof fs17.read !== "function" ? fs17.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(fs17, 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(fs17, 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
|
+
})(fs17.read);
|
|
4830
|
+
fs17.readSync = typeof fs17.readSync !== "function" ? fs17.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(fs17, 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
|
+
})(fs17.readSync);
|
|
4846
|
+
function patchLchmod(fs18) {
|
|
4847
|
+
fs18.lchmod = function(path13, mode, callback) {
|
|
4848
|
+
fs18.open(
|
|
4849
|
+
path13,
|
|
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
|
+
fs18.fchmod(fd, mode, function(err2) {
|
|
4858
|
+
fs18.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
|
+
fs18.lchmodSync = function(path13, mode) {
|
|
4866
|
+
var fd = fs18.openSync(path13, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
4867
4867
|
var threw = true;
|
|
4868
4868
|
var ret;
|
|
4869
4869
|
try {
|
|
4870
|
-
ret =
|
|
4870
|
+
ret = fs18.fchmodSync(fd, mode);
|
|
4871
4871
|
threw = false;
|
|
4872
4872
|
} finally {
|
|
4873
4873
|
if (threw) {
|
|
4874
4874
|
try {
|
|
4875
|
-
|
|
4875
|
+
fs18.closeSync(fd);
|
|
4876
4876
|
} catch (er) {
|
|
4877
4877
|
}
|
|
4878
4878
|
} else {
|
|
4879
|
-
|
|
4879
|
+
fs18.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(fs18) {
|
|
4886
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs18.futimes) {
|
|
4887
|
+
fs18.lutimes = function(path13, at, mt, cb) {
|
|
4888
|
+
fs18.open(path13, constants.O_SYMLINK, function(er, fd) {
|
|
4889
4889
|
if (er) {
|
|
4890
4890
|
if (cb) cb(er);
|
|
4891
4891
|
return;
|
|
4892
4892
|
}
|
|
4893
|
-
|
|
4894
|
-
|
|
4893
|
+
fs18.futimes(fd, at, mt, function(er2) {
|
|
4894
|
+
fs18.close(fd, function(er22) {
|
|
4895
4895
|
if (cb) cb(er2 || er22);
|
|
4896
4896
|
});
|
|
4897
4897
|
});
|
|
4898
4898
|
});
|
|
4899
4899
|
};
|
|
4900
|
-
|
|
4901
|
-
var fd =
|
|
4900
|
+
fs18.lutimesSync = function(path13, at, mt) {
|
|
4901
|
+
var fd = fs18.openSync(path13, constants.O_SYMLINK);
|
|
4902
4902
|
var ret;
|
|
4903
4903
|
var threw = true;
|
|
4904
4904
|
try {
|
|
4905
|
-
ret =
|
|
4905
|
+
ret = fs18.futimesSync(fd, at, mt);
|
|
4906
4906
|
threw = false;
|
|
4907
4907
|
} finally {
|
|
4908
4908
|
if (threw) {
|
|
4909
4909
|
try {
|
|
4910
|
-
|
|
4910
|
+
fs18.closeSync(fd);
|
|
4911
4911
|
} catch (er) {
|
|
4912
4912
|
}
|
|
4913
4913
|
} else {
|
|
4914
|
-
|
|
4914
|
+
fs18.closeSync(fd);
|
|
4915
4915
|
}
|
|
4916
4916
|
}
|
|
4917
4917
|
return ret;
|
|
4918
4918
|
};
|
|
4919
|
-
} else if (
|
|
4920
|
-
|
|
4919
|
+
} else if (fs18.futimes) {
|
|
4920
|
+
fs18.lutimes = function(_a, _b, _c, cb) {
|
|
4921
4921
|
if (cb) process.nextTick(cb);
|
|
4922
4922
|
};
|
|
4923
|
-
|
|
4923
|
+
fs18.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(fs17, 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(fs17, 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(fs17, 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(fs17, 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(fs17, target, options, callback) : orig.call(fs17, 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(fs17, target, options) : orig.call(fs17, 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(fs17) {
|
|
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(path13, options) {
|
|
5021
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path13, options);
|
|
5022
5022
|
Stream.call(this);
|
|
5023
5023
|
var self = this;
|
|
5024
|
-
this.path =
|
|
5024
|
+
this.path = path13;
|
|
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
|
+
fs17.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(path13, options) {
|
|
5070
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path13, options);
|
|
5071
5071
|
Stream.call(this);
|
|
5072
|
-
this.path =
|
|
5072
|
+
this.path = path13;
|
|
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 = fs17.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 fs17 = 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 (!fs17[gracefulQueue]) {
|
|
5166
5166
|
queue = global[gracefulQueue] || [];
|
|
5167
|
-
publishQueue(
|
|
5168
|
-
|
|
5167
|
+
publishQueue(fs17, queue);
|
|
5168
|
+
fs17.close = (function(fs$close) {
|
|
5169
5169
|
function close(fd, cb) {
|
|
5170
|
-
return fs$close.call(
|
|
5170
|
+
return fs$close.call(fs17, 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
|
+
})(fs17.close);
|
|
5183
|
+
fs17.closeSync = (function(fs$closeSync) {
|
|
5184
5184
|
function closeSync(fd) {
|
|
5185
|
-
fs$closeSync.apply(
|
|
5185
|
+
fs$closeSync.apply(fs17, 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
|
+
})(fs17.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(fs17[gracefulQueue]);
|
|
5196
|
+
require("assert").equal(fs17[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, fs17[gracefulQueue]);
|
|
5203
|
+
}
|
|
5204
|
+
module2.exports = patch(clone(fs17));
|
|
5205
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs17.__patched) {
|
|
5206
|
+
module2.exports = patch(fs17);
|
|
5207
|
+
fs17.__patched = true;
|
|
5208
|
+
}
|
|
5209
|
+
function patch(fs18) {
|
|
5210
|
+
polyfills(fs18);
|
|
5211
|
+
fs18.gracefulify = patch;
|
|
5212
|
+
fs18.createReadStream = createReadStream;
|
|
5213
|
+
fs18.createWriteStream = createWriteStream;
|
|
5214
|
+
var fs$readFile = fs18.readFile;
|
|
5215
|
+
fs18.readFile = readFile;
|
|
5216
|
+
function readFile(path13, 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(path13, options, cb);
|
|
5220
|
+
function go$readFile(path14, options2, cb2, startTime) {
|
|
5221
|
+
return fs$readFile(path14, options2, function(err) {
|
|
5222
5222
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5223
|
-
enqueue([go$readFile, [
|
|
5223
|
+
enqueue([go$readFile, [path14, 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 = fs18.writeFile;
|
|
5232
|
+
fs18.writeFile = writeFile;
|
|
5233
|
+
function writeFile(path13, 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(path13, data, options, cb);
|
|
5237
|
+
function go$writeFile(path14, data2, options2, cb2, startTime) {
|
|
5238
|
+
return fs$writeFile(path14, data2, options2, function(err) {
|
|
5239
5239
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5240
|
-
enqueue([go$writeFile, [
|
|
5240
|
+
enqueue([go$writeFile, [path14, 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 = fs18.appendFile;
|
|
5249
5249
|
if (fs$appendFile)
|
|
5250
|
-
|
|
5251
|
-
function appendFile(
|
|
5250
|
+
fs18.appendFile = appendFile;
|
|
5251
|
+
function appendFile(path13, 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(path13, data, options, cb);
|
|
5255
|
+
function go$appendFile(path14, data2, options2, cb2, startTime) {
|
|
5256
|
+
return fs$appendFile(path14, data2, options2, function(err) {
|
|
5257
5257
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5258
|
-
enqueue([go$appendFile, [
|
|
5258
|
+
enqueue([go$appendFile, [path14, 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 = fs18.copyFile;
|
|
5267
5267
|
if (fs$copyFile)
|
|
5268
|
-
|
|
5268
|
+
fs18.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 = fs18.readdir;
|
|
5287
|
+
fs18.readdir = readdir;
|
|
5288
5288
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
5289
|
-
function readdir(
|
|
5289
|
+
function readdir(path13, 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(path14, options2, cb2, startTime) {
|
|
5293
|
+
return fs$readdir(path14, fs$readdirCallback(
|
|
5294
|
+
path14,
|
|
5295
5295
|
options2,
|
|
5296
5296
|
cb2,
|
|
5297
5297
|
startTime
|
|
5298
5298
|
));
|
|
5299
|
-
} : function go$readdir2(
|
|
5300
|
-
return fs$readdir(
|
|
5301
|
-
|
|
5299
|
+
} : function go$readdir2(path14, options2, cb2, startTime) {
|
|
5300
|
+
return fs$readdir(path14, options2, fs$readdirCallback(
|
|
5301
|
+
path14,
|
|
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(path13, options, cb);
|
|
5308
|
+
function fs$readdirCallback(path14, 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
|
+
[path14, 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(fs18);
|
|
5329
5329
|
ReadStream = legStreams.ReadStream;
|
|
5330
5330
|
WriteStream = legStreams.WriteStream;
|
|
5331
5331
|
}
|
|
5332
|
-
var fs$ReadStream =
|
|
5332
|
+
var fs$ReadStream = fs18.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 = fs18.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(fs18, "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(fs18, "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(fs18, "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(fs18, "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(path13, 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(path13, 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(path13, options) {
|
|
5423
|
+
return new fs18.ReadStream(path13, options);
|
|
5424
5424
|
}
|
|
5425
|
-
function createWriteStream(
|
|
5426
|
-
return new
|
|
5425
|
+
function createWriteStream(path13, options) {
|
|
5426
|
+
return new fs18.WriteStream(path13, options);
|
|
5427
5427
|
}
|
|
5428
|
-
var fs$open =
|
|
5429
|
-
|
|
5430
|
-
function open(
|
|
5428
|
+
var fs$open = fs18.open;
|
|
5429
|
+
fs18.open = open;
|
|
5430
|
+
function open(path13, 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(path13, flags, mode, cb);
|
|
5434
|
+
function go$open(path14, flags2, mode2, cb2, startTime) {
|
|
5435
|
+
return fs$open(path14, flags2, mode2, function(err, fd) {
|
|
5436
5436
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
5437
|
-
enqueue([go$open, [
|
|
5437
|
+
enqueue([go$open, [path14, 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 fs18;
|
|
5446
5446
|
}
|
|
5447
5447
|
function enqueue(elem) {
|
|
5448
5448
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
5449
|
-
|
|
5449
|
+
fs17[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 < fs17[gracefulQueue].length; ++i) {
|
|
5456
|
+
if (fs17[gracefulQueue][i].length > 2) {
|
|
5457
|
+
fs17[gracefulQueue][i][3] = now;
|
|
5458
|
+
fs17[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 (fs17[gracefulQueue].length === 0)
|
|
5467
5467
|
return;
|
|
5468
|
-
var elem =
|
|
5468
|
+
var elem = fs17[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
|
+
fs17[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 fs17 = 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 fs17[key] === "function";
|
|
5547
5547
|
});
|
|
5548
|
-
Object.assign(exports2,
|
|
5548
|
+
Object.assign(exports2, fs17);
|
|
5549
5549
|
api.forEach((method) => {
|
|
5550
|
-
exports2[method] = u(
|
|
5550
|
+
exports2[method] = u(fs17[method]);
|
|
5551
5551
|
});
|
|
5552
5552
|
exports2.exists = function(filename, callback) {
|
|
5553
5553
|
if (typeof callback === "function") {
|
|
5554
|
-
return
|
|
5554
|
+
return fs17.exists(filename, callback);
|
|
5555
5555
|
}
|
|
5556
5556
|
return new Promise((resolve) => {
|
|
5557
|
-
return
|
|
5557
|
+
return fs17.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 fs17.read(fd, buffer, offset, length, position, callback);
|
|
5563
5563
|
}
|
|
5564
5564
|
return new Promise((resolve, reject) => {
|
|
5565
|
-
|
|
5565
|
+
fs17.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 fs17.write(fd, buffer, ...args);
|
|
5574
5574
|
}
|
|
5575
5575
|
return new Promise((resolve, reject) => {
|
|
5576
|
-
|
|
5576
|
+
fs17.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 fs17.readv(fd, buffers, ...args);
|
|
5585
5585
|
}
|
|
5586
5586
|
return new Promise((resolve, reject) => {
|
|
5587
|
-
|
|
5587
|
+
fs17.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 fs17.writev(fd, buffers, ...args);
|
|
5596
5596
|
}
|
|
5597
5597
|
return new Promise((resolve, reject) => {
|
|
5598
|
-
|
|
5598
|
+
fs17.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 fs17.realpath.native === "function") {
|
|
5605
|
+
exports2.realpath.native = u(fs17.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 path13 = 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(path13.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 fs17 = 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 fs17.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 fs17.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 fs17 = require_fs();
|
|
5687
|
+
function pathExists(path13) {
|
|
5688
|
+
return fs17.access(path13).then(() => true).catch(() => false);
|
|
5689
5689
|
}
|
|
5690
5690
|
module2.exports = {
|
|
5691
5691
|
pathExists: u(pathExists),
|
|
5692
|
-
pathExistsSync:
|
|
5692
|
+
pathExistsSync: fs17.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 fs17 = require_fs();
|
|
5702
5702
|
var u = require_universalify().fromPromise;
|
|
5703
|
-
async function utimesMillis(
|
|
5704
|
-
const fd = await
|
|
5703
|
+
async function utimesMillis(path13, atime, mtime) {
|
|
5704
|
+
const fd = await fs17.open(path13, "r+");
|
|
5705
5705
|
let error = null;
|
|
5706
5706
|
try {
|
|
5707
|
-
await
|
|
5707
|
+
await fs17.futimes(fd, atime, mtime);
|
|
5708
5708
|
} catch (futimesErr) {
|
|
5709
5709
|
error = futimesErr;
|
|
5710
5710
|
} finally {
|
|
5711
5711
|
try {
|
|
5712
|
-
await
|
|
5712
|
+
await fs17.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(path13, atime, mtime) {
|
|
5722
|
+
const fd = fs17.openSync(path13, "r+");
|
|
5723
5723
|
let error = null;
|
|
5724
5724
|
try {
|
|
5725
|
-
|
|
5725
|
+
fs17.futimesSync(fd, atime, mtime);
|
|
5726
5726
|
} catch (futimesErr) {
|
|
5727
5727
|
error = futimesErr;
|
|
5728
5728
|
} finally {
|
|
5729
5729
|
try {
|
|
5730
|
-
|
|
5730
|
+
fs17.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 fs17 = require_fs();
|
|
5751
|
+
var path13 = 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) => fs17.stat(file, { bigint: true }) : (file) => fs17.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) => fs17.statSync(file, { bigint: true }) : (file) => fs17.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 = path13.basename(src);
|
|
5780
|
+
const destBaseName = path13.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 = path13.basename(src);
|
|
5803
|
+
const destBaseName = path13.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 = path13.resolve(path13.dirname(src));
|
|
5823
|
+
const destParent = path13.resolve(path13.dirname(dest));
|
|
5824
|
+
if (destParent === srcParent || destParent === path13.parse(destParent).root) return;
|
|
5825
5825
|
let destStat;
|
|
5826
5826
|
try {
|
|
5827
|
-
destStat = await
|
|
5827
|
+
destStat = await fs17.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 = path13.resolve(path13.dirname(src));
|
|
5839
|
+
const destParent = path13.resolve(path13.dirname(dest));
|
|
5840
|
+
if (destParent === srcParent || destParent === path13.parse(destParent).root) return;
|
|
5841
5841
|
let destStat;
|
|
5842
5842
|
try {
|
|
5843
|
-
destStat =
|
|
5843
|
+
destStat = fs17.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 = path13.resolve(src).split(path13.sep).filter((i) => i);
|
|
5858
|
+
const destArr = path13.resolve(dest).split(path13.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 fs17 = require_fs();
|
|
5911
|
+
var path13 = 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 = path13.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 ? fs17.stat : fs17.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 fs17.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 fs17.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 fs17.stat(src);
|
|
5972
5972
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
5973
5973
|
}
|
|
5974
|
-
return
|
|
5974
|
+
return fs17.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 fs17.chmod(dest, srcMode | 128);
|
|
5981
5981
|
}
|
|
5982
5982
|
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
5983
5983
|
if (!destStat) {
|
|
5984
|
-
await
|
|
5984
|
+
await fs17.mkdir(dest);
|
|
5985
5985
|
}
|
|
5986
|
-
await asyncIteratorConcurrentProcess(await
|
|
5987
|
-
const srcItem =
|
|
5988
|
-
const destItem =
|
|
5986
|
+
await asyncIteratorConcurrentProcess(await fs17.opendir(src), async (item) => {
|
|
5987
|
+
const srcItem = path13.join(src, item.name);
|
|
5988
|
+
const destItem = path13.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 fs17.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 fs17.readlink(src);
|
|
6001
6001
|
if (opts.dereference) {
|
|
6002
|
-
resolvedSrc =
|
|
6002
|
+
resolvedSrc = path13.resolve(process.cwd(), resolvedSrc);
|
|
6003
6003
|
}
|
|
6004
6004
|
if (!destStat) {
|
|
6005
|
-
return
|
|
6005
|
+
return fs17.symlink(resolvedSrc, dest);
|
|
6006
6006
|
}
|
|
6007
6007
|
let resolvedDest = null;
|
|
6008
6008
|
try {
|
|
6009
|
-
resolvedDest = await
|
|
6009
|
+
resolvedDest = await fs17.readlink(dest);
|
|
6010
6010
|
} catch (e) {
|
|
6011
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return
|
|
6011
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs17.symlink(resolvedSrc, dest);
|
|
6012
6012
|
throw e;
|
|
6013
6013
|
}
|
|
6014
6014
|
if (opts.dereference) {
|
|
6015
|
-
resolvedDest =
|
|
6015
|
+
resolvedDest = path13.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 fs17.unlink(dest);
|
|
6026
|
+
return fs17.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 fs17 = require_graceful_fs();
|
|
6037
|
+
var path13 = 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 = path13.dirname(dest);
|
|
6059
|
+
if (!fs17.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 ? fs17.statSync : fs17.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
|
+
fs17.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
|
+
fs17.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 fs17.chmodSync(dest, srcMode);
|
|
6101
6101
|
}
|
|
6102
6102
|
function setDestTimestamps(src, dest) {
|
|
6103
|
-
const updatedSrcStat =
|
|
6103
|
+
const updatedSrcStat = fs17.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
|
+
fs17.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 = fs17.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 = path13.join(src, item);
|
|
6128
|
+
const destItem = path13.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 = fs17.readlinkSync(src);
|
|
6135
6135
|
if (opts.dereference) {
|
|
6136
|
-
resolvedSrc =
|
|
6136
|
+
resolvedSrc = path13.resolve(process.cwd(), resolvedSrc);
|
|
6137
6137
|
}
|
|
6138
6138
|
if (!destStat) {
|
|
6139
|
-
return
|
|
6139
|
+
return fs17.symlinkSync(resolvedSrc, dest);
|
|
6140
6140
|
} else {
|
|
6141
6141
|
let resolvedDest;
|
|
6142
6142
|
try {
|
|
6143
|
-
resolvedDest =
|
|
6143
|
+
resolvedDest = fs17.readlinkSync(dest);
|
|
6144
6144
|
} catch (err) {
|
|
6145
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return
|
|
6145
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs17.symlinkSync(resolvedSrc, dest);
|
|
6146
6146
|
throw err;
|
|
6147
6147
|
}
|
|
6148
6148
|
if (opts.dereference) {
|
|
6149
|
-
resolvedDest =
|
|
6149
|
+
resolvedDest = path13.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
|
+
fs17.unlinkSync(dest);
|
|
6164
|
+
return fs17.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 fs17 = require_graceful_fs();
|
|
6187
6187
|
var u = require_universalify().fromCallback;
|
|
6188
|
-
function remove(
|
|
6189
|
-
|
|
6188
|
+
function remove(path13, callback) {
|
|
6189
|
+
fs17.rm(path13, { recursive: true, force: true }, callback);
|
|
6190
6190
|
}
|
|
6191
|
-
function removeSync(
|
|
6192
|
-
|
|
6191
|
+
function removeSync(path13) {
|
|
6192
|
+
fs17.rmSync(path13, { 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 fs17 = require_fs();
|
|
6207
|
+
var path13 = 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 fs17.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(path13.join(dir, item))));
|
|
6218
6218
|
});
|
|
6219
6219
|
function emptyDirSync(dir) {
|
|
6220
6220
|
let items;
|
|
6221
6221
|
try {
|
|
6222
|
-
items =
|
|
6222
|
+
items = fs17.readdirSync(dir);
|
|
6223
6223
|
} catch {
|
|
6224
6224
|
return mkdir.mkdirsSync(dir);
|
|
6225
6225
|
}
|
|
6226
6226
|
items.forEach((item) => {
|
|
6227
|
-
item =
|
|
6227
|
+
item = path13.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 path13 = require("path");
|
|
6246
|
+
var fs17 = 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 fs17.stat(file);
|
|
6252
6252
|
} catch {
|
|
6253
6253
|
}
|
|
6254
6254
|
if (stats && stats.isFile()) return;
|
|
6255
|
-
const dir =
|
|
6255
|
+
const dir = path13.dirname(file);
|
|
6256
6256
|
let dirStats = null;
|
|
6257
6257
|
try {
|
|
6258
|
-
dirStats = await
|
|
6258
|
+
dirStats = await fs17.stat(dir);
|
|
6259
6259
|
} catch (err) {
|
|
6260
6260
|
if (err.code === "ENOENT") {
|
|
6261
6261
|
await mkdir.mkdirs(dir);
|
|
6262
|
-
await
|
|
6262
|
+
await fs17.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 fs17.writeFile(file, "");
|
|
6270
6270
|
} else {
|
|
6271
|
-
await
|
|
6271
|
+
await fs17.readdir(dir);
|
|
6272
6272
|
}
|
|
6273
6273
|
}
|
|
6274
6274
|
function createFileSync(file) {
|
|
6275
6275
|
let stats;
|
|
6276
6276
|
try {
|
|
6277
|
-
stats =
|
|
6277
|
+
stats = fs17.statSync(file);
|
|
6278
6278
|
} catch {
|
|
6279
6279
|
}
|
|
6280
6280
|
if (stats && stats.isFile()) return;
|
|
6281
|
-
const dir =
|
|
6281
|
+
const dir = path13.dirname(file);
|
|
6282
6282
|
try {
|
|
6283
|
-
if (!
|
|
6284
|
-
|
|
6283
|
+
if (!fs17.statSync(dir).isDirectory()) {
|
|
6284
|
+
fs17.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
|
+
fs17.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 path13 = require("path");
|
|
6305
|
+
var fs17 = 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 fs17.lstat(dstpath, { bigint: true });
|
|
6313
6313
|
} catch {
|
|
6314
6314
|
}
|
|
6315
6315
|
let srcStat;
|
|
6316
6316
|
try {
|
|
6317
|
-
srcStat = await
|
|
6317
|
+
srcStat = await fs17.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 = path13.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 fs17.link(srcpath, dstpath);
|
|
6329
6329
|
}
|
|
6330
6330
|
function createLinkSync(srcpath, dstpath) {
|
|
6331
6331
|
let dstStat;
|
|
6332
6332
|
try {
|
|
6333
|
-
dstStat =
|
|
6333
|
+
dstStat = fs17.lstatSync(dstpath, { bigint: true });
|
|
6334
6334
|
} catch {
|
|
6335
6335
|
}
|
|
6336
6336
|
try {
|
|
6337
|
-
const srcStat =
|
|
6337
|
+
const srcStat = fs17.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 = path13.dirname(dstpath);
|
|
6344
|
+
const dirExists = fs17.existsSync(dir);
|
|
6345
|
+
if (dirExists) return fs17.linkSync(srcpath, dstpath);
|
|
6346
6346
|
mkdir.mkdirsSync(dir);
|
|
6347
|
-
return
|
|
6347
|
+
return fs17.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 path13 = require("path");
|
|
6361
|
+
var fs17 = 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 (path13.isAbsolute(srcpath)) {
|
|
6366
6366
|
try {
|
|
6367
|
-
await
|
|
6367
|
+
await fs17.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 = path13.dirname(dstpath);
|
|
6378
|
+
const relativeToDst = path13.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 fs17.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: path13.relative(dstdir, srcpath)
|
|
6395
6395
|
};
|
|
6396
6396
|
}
|
|
6397
6397
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
6398
|
-
if (
|
|
6399
|
-
const exists2 =
|
|
6398
|
+
if (path13.isAbsolute(srcpath)) {
|
|
6399
|
+
const exists2 = fs17.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 = path13.dirname(dstpath);
|
|
6407
|
+
const relativeToDst = path13.join(dstdir, srcpath);
|
|
6408
|
+
const exists = fs17.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 = fs17.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: path13.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 fs17 = 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 fs17.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 = fs17.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 path13 = require("path");
|
|
6468
|
+
var fs17 = 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 fs17.lstat(dstpath);
|
|
6478
6478
|
} catch {
|
|
6479
6479
|
}
|
|
6480
6480
|
if (stats && stats.isSymbolicLink()) {
|
|
6481
6481
|
let srcStat;
|
|
6482
|
-
if (
|
|
6483
|
-
srcStat = await
|
|
6482
|
+
if (path13.isAbsolute(srcpath)) {
|
|
6483
|
+
srcStat = await fs17.stat(srcpath, { bigint: true });
|
|
6484
6484
|
} else {
|
|
6485
|
-
const dstdir =
|
|
6486
|
-
const relativeToDst =
|
|
6485
|
+
const dstdir = path13.dirname(dstpath);
|
|
6486
|
+
const relativeToDst = path13.join(dstdir, srcpath);
|
|
6487
6487
|
try {
|
|
6488
|
-
srcStat = await
|
|
6488
|
+
srcStat = await fs17.stat(relativeToDst, { bigint: true });
|
|
6489
6489
|
} catch {
|
|
6490
|
-
srcStat = await
|
|
6490
|
+
srcStat = await fs17.stat(srcpath, { bigint: true });
|
|
6491
6491
|
}
|
|
6492
6492
|
}
|
|
6493
|
-
const dstStat = await
|
|
6493
|
+
const dstStat = await fs17.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 = path13.dirname(dstpath);
|
|
6500
6500
|
if (!await pathExists(dir)) {
|
|
6501
6501
|
await mkdirs(dir);
|
|
6502
6502
|
}
|
|
6503
|
-
return
|
|
6503
|
+
return fs17.symlink(srcpath, dstpath, toType);
|
|
6504
6504
|
}
|
|
6505
6505
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
6506
6506
|
let stats;
|
|
6507
6507
|
try {
|
|
6508
|
-
stats =
|
|
6508
|
+
stats = fs17.lstatSync(dstpath);
|
|
6509
6509
|
} catch {
|
|
6510
6510
|
}
|
|
6511
6511
|
if (stats && stats.isSymbolicLink()) {
|
|
6512
6512
|
let srcStat;
|
|
6513
|
-
if (
|
|
6514
|
-
srcStat =
|
|
6513
|
+
if (path13.isAbsolute(srcpath)) {
|
|
6514
|
+
srcStat = fs17.statSync(srcpath, { bigint: true });
|
|
6515
6515
|
} else {
|
|
6516
|
-
const dstdir =
|
|
6517
|
-
const relativeToDst =
|
|
6516
|
+
const dstdir = path13.dirname(dstpath);
|
|
6517
|
+
const relativeToDst = path13.join(dstdir, srcpath);
|
|
6518
6518
|
try {
|
|
6519
|
-
srcStat =
|
|
6519
|
+
srcStat = fs17.statSync(relativeToDst, { bigint: true });
|
|
6520
6520
|
} catch {
|
|
6521
|
-
srcStat =
|
|
6521
|
+
srcStat = fs17.statSync(srcpath, { bigint: true });
|
|
6522
6522
|
}
|
|
6523
6523
|
}
|
|
6524
|
-
const dstStat =
|
|
6524
|
+
const dstStat = fs17.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 = path13.dirname(dstpath);
|
|
6531
|
+
const exists = fs17.existsSync(dir);
|
|
6532
|
+
if (exists) return fs17.symlinkSync(srcpath, dstpath, type);
|
|
6533
6533
|
mkdirsSync(dir);
|
|
6534
|
-
return
|
|
6534
|
+
return fs17.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 fs17 = 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(fs17.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 fs17 = options.fs || _fs;
|
|
6629
6629
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
6630
6630
|
try {
|
|
6631
|
-
let content =
|
|
6631
|
+
let content = fs17.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 fs17 = options.fs || _fs;
|
|
6645
6645
|
const str = stringify(obj, options);
|
|
6646
|
-
await universalify.fromCallback(
|
|
6646
|
+
await universalify.fromCallback(fs17.writeFile)(file, str, options);
|
|
6647
6647
|
}
|
|
6648
6648
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
6649
6649
|
function writeFileSync(file, obj, options = {}) {
|
|
6650
|
-
const
|
|
6650
|
+
const fs17 = options.fs || _fs;
|
|
6651
6651
|
const str = stringify(obj, options);
|
|
6652
|
-
return
|
|
6652
|
+
return fs17.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 fs17 = require_fs();
|
|
6684
|
+
var path13 = 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 = path13.dirname(file);
|
|
6689
6689
|
if (!await pathExists(dir)) {
|
|
6690
6690
|
await mkdir.mkdirs(dir);
|
|
6691
6691
|
}
|
|
6692
|
-
return
|
|
6692
|
+
return fs17.writeFile(file, data, encoding);
|
|
6693
6693
|
}
|
|
6694
6694
|
function outputFileSync(file, ...args) {
|
|
6695
|
-
const dir =
|
|
6696
|
-
if (!
|
|
6695
|
+
const dir = path13.dirname(file);
|
|
6696
|
+
if (!fs17.existsSync(dir)) {
|
|
6697
6697
|
mkdir.mkdirsSync(dir);
|
|
6698
6698
|
}
|
|
6699
|
-
|
|
6699
|
+
fs17.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 fs17 = require_fs();
|
|
6759
|
+
var path13 = 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 = path13.dirname(dest);
|
|
6770
|
+
const parsedParentPath = path13.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 fs17.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 fs17 = require_graceful_fs();
|
|
6811
|
+
var path13 = 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(path13.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 = path13.dirname(dest);
|
|
6826
|
+
const parsedPath = path13.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 (fs17.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
|
+
fs17.renameSync(src, dest);
|
|
6841
6841
|
} catch (err) {
|
|
6842
6842
|
if (err.code !== "EXDEV") throw err;
|
|
6843
6843
|
return moveAcrossDevice(src, dest, overwrite);
|
|
@@ -8771,8 +8771,8 @@ function toIdentifier(value) {
|
|
|
8771
8771
|
].join("");
|
|
8772
8772
|
return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
|
|
8773
8773
|
}
|
|
8774
|
-
function toRuntimePath(
|
|
8775
|
-
return
|
|
8774
|
+
function toRuntimePath(path13) {
|
|
8775
|
+
return path13.replace(/{([^}/]+)}/g, ":$1");
|
|
8776
8776
|
}
|
|
8777
8777
|
function toActionName(route, restSegments) {
|
|
8778
8778
|
const method = route.method.toLowerCase();
|
|
@@ -8782,8 +8782,8 @@ function toActionName(route, restSegments) {
|
|
|
8782
8782
|
function normalizeSegment(segment) {
|
|
8783
8783
|
return segment.replace(/^{([^}/]+)}$/, "$1");
|
|
8784
8784
|
}
|
|
8785
|
-
function getPathSegments(
|
|
8786
|
-
return
|
|
8785
|
+
function getPathSegments(path13) {
|
|
8786
|
+
return path13.replace(/^\//, "").split("/").filter(Boolean);
|
|
8787
8787
|
}
|
|
8788
8788
|
function splitWords(value) {
|
|
8789
8789
|
return value.replace(/^{([^}/]+)}$/, "$1").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word.toLowerCase());
|
|
@@ -9561,8 +9561,8 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
|
|
|
9561
9561
|
debounceTimer = setTimeout(async () => {
|
|
9562
9562
|
console.log(source_default.yellow(` [${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] Routes changed, syncing...`));
|
|
9563
9563
|
try {
|
|
9564
|
-
const { execSync:
|
|
9565
|
-
|
|
9564
|
+
const { execSync: execSync3 } = await import("child_process");
|
|
9565
|
+
execSync3(
|
|
9566
9566
|
`routesync sync --input ${options.input} --output ${options.output} --baseURL ${options.baseURL}`,
|
|
9567
9567
|
{ stdio: "inherit" }
|
|
9568
9568
|
);
|
|
@@ -9578,6 +9578,234 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
|
|
|
9578
9578
|
import_fs_extra15.default.watch(import_path11.default.resolve(options.input), onChange);
|
|
9579
9579
|
});
|
|
9580
9580
|
|
|
9581
|
+
// packages/cli/src/commands/annotate.ts
|
|
9582
|
+
var import_child_process2 = require("child_process");
|
|
9583
|
+
var import_fs_extra16 = __toESM(require_lib());
|
|
9584
|
+
var import_path12 = __toESM(require("path"));
|
|
9585
|
+
var import_os = __toESM(require("os"));
|
|
9586
|
+
var annotateCommand = new Command("annotate").description("Auto-inject #[Response] PHP 8 attributes into controller methods based on Resource discovery").option("--input <file>", "Path to routes/api.php", "routes/api.php").option("--dry-run", "Preview changes without writing files").option("--force", "Re-annotate methods that already have #[Response]").action(async (options) => {
|
|
9587
|
+
const filePath = import_path12.default.resolve(options.input);
|
|
9588
|
+
if (!import_fs_extra16.default.existsSync(filePath)) {
|
|
9589
|
+
console.error(`\u274C Routes file not found: ${filePath}`);
|
|
9590
|
+
process.exit(1);
|
|
9591
|
+
}
|
|
9592
|
+
const projectRoot = import_path12.default.resolve(import_path12.default.dirname(filePath), "..");
|
|
9593
|
+
const forceFlag = options.force ? "true" : "false";
|
|
9594
|
+
const phpScript = `<?php
|
|
9595
|
+
require __DIR__.'/vendor/autoload.php';
|
|
9596
|
+
$app = require_once __DIR__.'/bootstrap/app.php';
|
|
9597
|
+
$kernel = $app->make(Illuminate\\Contracts\\Console\\Kernel::class);
|
|
9598
|
+
$kernel->bootstrap();
|
|
9599
|
+
|
|
9600
|
+
$result = [];
|
|
9601
|
+
$seen = []; // deduplicate by controllerClass + methodName
|
|
9602
|
+
|
|
9603
|
+
$routes = app('router')->getRoutes();
|
|
9604
|
+
foreach ($routes as $route) {
|
|
9605
|
+
if (!str_starts_with($route->uri(), 'api/')) continue;
|
|
9606
|
+
|
|
9607
|
+
$methods = array_diff($route->methods(), ['HEAD']);
|
|
9608
|
+
$action = $route->getAction();
|
|
9609
|
+
if (!isset($action['controller'])) continue;
|
|
9610
|
+
|
|
9611
|
+
[$controllerClass, $methodName] = array_pad(explode('@', $action['controller']), 2, null);
|
|
9612
|
+
if (!$methodName) continue;
|
|
9613
|
+
|
|
9614
|
+
$dedupKey = $controllerClass . '@' . $methodName;
|
|
9615
|
+
if (isset($seen[$dedupKey])) continue;
|
|
9616
|
+
$seen[$dedupKey] = true;
|
|
9617
|
+
|
|
9618
|
+
try {
|
|
9619
|
+
$reflector = new ReflectionMethod($controllerClass, $methodName);
|
|
9620
|
+
|
|
9621
|
+
// Check if already has #[Response] attribute
|
|
9622
|
+
$hasResponse = false;
|
|
9623
|
+
foreach ($reflector->getAttributes() as $attr) {
|
|
9624
|
+
if (str_contains($attr->getName(), 'Response')) {
|
|
9625
|
+
$hasResponse = true;
|
|
9626
|
+
break;
|
|
9627
|
+
}
|
|
9628
|
+
}
|
|
9629
|
+
if ($hasResponse && !${forceFlag}) continue;
|
|
9630
|
+
|
|
9631
|
+
// Get method source
|
|
9632
|
+
$fileName = $reflector->getFileName();
|
|
9633
|
+
$startLine = $reflector->getStartLine();
|
|
9634
|
+
$endLine = $reflector->getEndLine();
|
|
9635
|
+
if (!$fileName || $startLine === false) continue;
|
|
9636
|
+
|
|
9637
|
+
$fileLines = file($fileName);
|
|
9638
|
+
$methodSource = implode('', array_slice($fileLines, $startLine - 1, $endLine - $startLine + 1));
|
|
9639
|
+
|
|
9640
|
+
// Find the actual "public function" line (for correct injection point)
|
|
9641
|
+
// Walk backwards from startLine to find the real function declaration line
|
|
9642
|
+
$funcLine = $startLine;
|
|
9643
|
+
for ($i = $startLine - 1; $i >= max(0, $startLine - 10); $i--) {
|
|
9644
|
+
if (preg_match('/^\\s*(public|protected|private)?\\s*function\\s+' . preg_quote($methodName) . '\\s*\\(/', $fileLines[$i])) {
|
|
9645
|
+
$funcLine = $i + 1; // convert to 1-indexed
|
|
9646
|
+
break;
|
|
9647
|
+
}
|
|
9648
|
+
}
|
|
9649
|
+
|
|
9650
|
+
// Resource Discovery \u2014 support multiple return patterns
|
|
9651
|
+
$resourceName = null;
|
|
9652
|
+
$collection = false;
|
|
9653
|
+
|
|
9654
|
+
$patterns = [
|
|
9655
|
+
// XxxResource::collection(...)
|
|
9656
|
+
'/([a-zA-Z0-9_]+Resource)::collection/' => ['collection' => true],
|
|
9657
|
+
// new XxxResource(...)
|
|
9658
|
+
'/new\\s+([a-zA-Z0-9_]+Resource)\\s*\\(/' => ['collection' => false],
|
|
9659
|
+
// response()->json(new XxxResource(...))
|
|
9660
|
+
'/response\\(\\)->json\\(\\s*new\\s+([a-zA-Z0-9_]+Resource)/' => ['collection' => false],
|
|
9661
|
+
// response()->json(XxxResource::collection(...))
|
|
9662
|
+
'/response\\(\\)->json\\(\\s*([a-zA-Z0-9_]+Resource)::collection/' => ['collection' => true],
|
|
9663
|
+
// JsonResponse: return new JsonResponse(new XxxResource(...))
|
|
9664
|
+
'/JsonResponse\\(\\s*new\\s+([a-zA-Z0-9_]+Resource)/' => ['collection' => false],
|
|
9665
|
+
];
|
|
9666
|
+
|
|
9667
|
+
foreach ($patterns as $pattern => $meta) {
|
|
9668
|
+
if (preg_match($pattern, $methodSource, $m)) {
|
|
9669
|
+
$resourceName = $m[1];
|
|
9670
|
+
$collection = $meta['collection'];
|
|
9671
|
+
break;
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
|
|
9675
|
+
if (!$resourceName) continue;
|
|
9676
|
+
|
|
9677
|
+
// Resolve model from Resource @mixin docblock
|
|
9678
|
+
$resourceClass = 'App\\\\Http\\\\Resources\\\\' . $resourceName;
|
|
9679
|
+
if (!class_exists($resourceClass)) continue;
|
|
9680
|
+
|
|
9681
|
+
$resReflector = new ReflectionClass($resourceClass);
|
|
9682
|
+
$docComment = $resReflector->getDocComment();
|
|
9683
|
+
$modelClass = null;
|
|
9684
|
+
|
|
9685
|
+
if ($docComment && preg_match('/@mixin\\s+([\\\\a-zA-Z0-9_]+)/', $docComment, $mixinMatch)) {
|
|
9686
|
+
$modelClass = class_basename(trim($mixinMatch[1], '\\\\'));
|
|
9687
|
+
}
|
|
9688
|
+
|
|
9689
|
+
// Fallback: strip Resource suffix
|
|
9690
|
+
if (!$modelClass) {
|
|
9691
|
+
$modelClass = preg_replace('/Resource$/', '', $resourceName);
|
|
9692
|
+
}
|
|
9693
|
+
|
|
9694
|
+
$ctrlReflector = new ReflectionClass($controllerClass);
|
|
9695
|
+
$modelFull = 'App\\\\Models\\\\' . $modelClass;
|
|
9696
|
+
|
|
9697
|
+
$result[] = [
|
|
9698
|
+
'method' => implode('|', $methods),
|
|
9699
|
+
'uri' => '/' . preg_replace('/^api\\//', '', $route->uri()),
|
|
9700
|
+
'controllerFile' => $fileName,
|
|
9701
|
+
'controllerClass' => $controllerClass,
|
|
9702
|
+
'controllerNamespace' => $ctrlReflector->getNamespaceName(),
|
|
9703
|
+
'methodName' => $methodName,
|
|
9704
|
+
'methodLine' => $funcLine,
|
|
9705
|
+
'modelClass' => $modelClass,
|
|
9706
|
+
'modelFull' => $modelFull,
|
|
9707
|
+
'modelExists' => class_exists($modelFull),
|
|
9708
|
+
'collection' => $collection,
|
|
9709
|
+
'attrExists' => class_exists('App\\\\Attributes\\\\Response'),
|
|
9710
|
+
'alreadyAnnotated' => $hasResponse,
|
|
9711
|
+
];
|
|
9712
|
+
|
|
9713
|
+
} catch (\\Exception $e) {
|
|
9714
|
+
// skip unresolvable routes
|
|
9715
|
+
}
|
|
9716
|
+
}
|
|
9717
|
+
|
|
9718
|
+
echo json_encode($result);
|
|
9719
|
+
`;
|
|
9720
|
+
const tmpFile = import_path12.default.join(import_os.default.tmpdir(), `routesync-annotate-${Date.now()}.php`);
|
|
9721
|
+
import_fs_extra16.default.writeFileSync(tmpFile, phpScript);
|
|
9722
|
+
let annotations;
|
|
9723
|
+
try {
|
|
9724
|
+
const output = (0, import_child_process2.execSync)(`php ${tmpFile}`, { cwd: projectRoot, encoding: "utf-8" });
|
|
9725
|
+
annotations = JSON.parse(output);
|
|
9726
|
+
} catch (e) {
|
|
9727
|
+
console.error("\u274C PHP execution failed. Make sure PHP is available and database is accessible.");
|
|
9728
|
+
console.error(e instanceof Error ? e.message : String(e));
|
|
9729
|
+
import_fs_extra16.default.removeSync(tmpFile);
|
|
9730
|
+
process.exit(1);
|
|
9731
|
+
}
|
|
9732
|
+
import_fs_extra16.default.removeSync(tmpFile);
|
|
9733
|
+
if (annotations.length === 0) {
|
|
9734
|
+
console.log("\u2714 No methods to annotate \u2014 all routes already annotated or no Resources detected.");
|
|
9735
|
+
return;
|
|
9736
|
+
}
|
|
9737
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
9738
|
+
for (const ann of annotations) {
|
|
9739
|
+
const existing = byFile.get(ann.controllerFile) ?? [];
|
|
9740
|
+
if (!existing.find((e) => e.methodName === ann.methodName)) {
|
|
9741
|
+
existing.push(ann);
|
|
9742
|
+
}
|
|
9743
|
+
byFile.set(ann.controllerFile, existing);
|
|
9744
|
+
}
|
|
9745
|
+
const attrPath = import_path12.default.join(projectRoot, "app", "Attributes", "Response.php");
|
|
9746
|
+
const attrExists = import_fs_extra16.default.existsSync(attrPath);
|
|
9747
|
+
if (!attrExists) {
|
|
9748
|
+
if (options.dryRun) {
|
|
9749
|
+
console.log(" [dry-run] Would create app/Attributes/Response.php");
|
|
9750
|
+
} else {
|
|
9751
|
+
import_fs_extra16.default.ensureDirSync(import_path12.default.dirname(attrPath));
|
|
9752
|
+
import_fs_extra16.default.writeFileSync(attrPath, `<?php
|
|
9753
|
+
|
|
9754
|
+
namespace App\\Attributes;
|
|
9755
|
+
|
|
9756
|
+
use Attribute;
|
|
9757
|
+
|
|
9758
|
+
#[Attribute(Attribute::TARGET_METHOD)]
|
|
9759
|
+
class Response
|
|
9760
|
+
{
|
|
9761
|
+
public function __construct(
|
|
9762
|
+
public string $type,
|
|
9763
|
+
public bool $collection = false,
|
|
9764
|
+
) {}
|
|
9765
|
+
}
|
|
9766
|
+
`);
|
|
9767
|
+
console.log(" \u2714 Created app/Attributes/Response.php");
|
|
9768
|
+
}
|
|
9769
|
+
}
|
|
9770
|
+
let totalAnnotated = 0;
|
|
9771
|
+
for (const [ctrlFile, anns] of byFile) {
|
|
9772
|
+
const lines = import_fs_extra16.default.readFileSync(ctrlFile, "utf-8").split("\n");
|
|
9773
|
+
const needsImport = !lines.some((l) => l.includes("App\\Attributes\\Response"));
|
|
9774
|
+
const sorted = [...anns].sort((a, b) => b.methodLine - a.methodLine);
|
|
9775
|
+
for (const ann of sorted) {
|
|
9776
|
+
const collectionStr = ann.collection ? ", collection: true" : "";
|
|
9777
|
+
const attrLine = ` #[Response(${ann.modelClass}::class${collectionStr})]`;
|
|
9778
|
+
const insertAt = ann.methodLine - 1;
|
|
9779
|
+
lines.splice(insertAt, 0, attrLine);
|
|
9780
|
+
totalAnnotated++;
|
|
9781
|
+
if (options.dryRun) {
|
|
9782
|
+
const collDisplay = ann.collection ? "[]" : "";
|
|
9783
|
+
console.log(` [dry-run] ${ann.controllerClass}::${ann.methodName}`);
|
|
9784
|
+
console.log(` \u2192 #[Response(${ann.modelClass}::class${collectionStr})] (${ann.uri}${collDisplay})`);
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
if (needsImport) {
|
|
9788
|
+
const lastUseIndex = lines.reduce((last, line, i) => line.trimStart().startsWith("use ") ? i : last, -1);
|
|
9789
|
+
const insertUseAt = lastUseIndex !== -1 ? lastUseIndex + 1 : 2;
|
|
9790
|
+
lines.splice(insertUseAt, 0, "use App\\Attributes\\Response;");
|
|
9791
|
+
}
|
|
9792
|
+
if (!options.dryRun) {
|
|
9793
|
+
import_fs_extra16.default.writeFileSync(ctrlFile, lines.join("\n"), "utf-8");
|
|
9794
|
+
}
|
|
9795
|
+
}
|
|
9796
|
+
if (options.dryRun) {
|
|
9797
|
+
console.log(`
|
|
9798
|
+
\u2714 [dry-run] Would annotate ${totalAnnotated} method(s) across ${byFile.size} controller file(s)`);
|
|
9799
|
+
console.log(" Run without --dry-run to apply.");
|
|
9800
|
+
} else {
|
|
9801
|
+
console.log(`\u2714 Annotated ${totalAnnotated} method(s) across ${byFile.size} controller file(s)`);
|
|
9802
|
+
console.log("\n Next steps:");
|
|
9803
|
+
console.log(" 1. npx routesync scan --input routes/api.php --models");
|
|
9804
|
+
console.log(" 2. Copy routesync.manifest.json to your frontend folder");
|
|
9805
|
+
console.log(" 3. npx routesync generate --manifest routesync.manifest.json --output src/api --next-actions --zod");
|
|
9806
|
+
}
|
|
9807
|
+
});
|
|
9808
|
+
|
|
9581
9809
|
// packages/cli/src/index.ts
|
|
9582
9810
|
var program2 = new Command();
|
|
9583
9811
|
program2.name("routesync").description("Laravel routes to typed frontend SDKs").version("1.0.0");
|
|
@@ -9585,4 +9813,5 @@ program2.addCommand(scanCommand);
|
|
|
9585
9813
|
program2.addCommand(generateCommand);
|
|
9586
9814
|
program2.addCommand(syncCommand);
|
|
9587
9815
|
program2.addCommand(watchCommand);
|
|
9816
|
+
program2.addCommand(annotateCommand);
|
|
9588
9817
|
program2.parse(process.argv);
|