@smicolon/fasla-ui 0.7.0 → 0.8.0
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/index.js +685 -440
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -990,8 +990,8 @@ var require_command = __commonJS({
|
|
|
990
990
|
init_esm_shims();
|
|
991
991
|
var EventEmitter = __require("events").EventEmitter;
|
|
992
992
|
var childProcess = __require("child_process");
|
|
993
|
-
var
|
|
994
|
-
var
|
|
993
|
+
var path13 = __require("path");
|
|
994
|
+
var fs11 = __require("fs");
|
|
995
995
|
var process10 = __require("process");
|
|
996
996
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
997
997
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1923,11 +1923,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1923
1923
|
let launchWithNode = false;
|
|
1924
1924
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1925
1925
|
function findFile(baseDir, baseName) {
|
|
1926
|
-
const localBin =
|
|
1927
|
-
if (
|
|
1928
|
-
if (sourceExt.includes(
|
|
1926
|
+
const localBin = path13.resolve(baseDir, baseName);
|
|
1927
|
+
if (fs11.existsSync(localBin)) return localBin;
|
|
1928
|
+
if (sourceExt.includes(path13.extname(baseName))) return void 0;
|
|
1929
1929
|
const foundExt = sourceExt.find(
|
|
1930
|
-
(ext) =>
|
|
1930
|
+
(ext) => fs11.existsSync(`${localBin}${ext}`)
|
|
1931
1931
|
);
|
|
1932
1932
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1933
1933
|
return void 0;
|
|
@@ -1939,21 +1939,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1939
1939
|
if (this._scriptPath) {
|
|
1940
1940
|
let resolvedScriptPath;
|
|
1941
1941
|
try {
|
|
1942
|
-
resolvedScriptPath =
|
|
1942
|
+
resolvedScriptPath = fs11.realpathSync(this._scriptPath);
|
|
1943
1943
|
} catch (err) {
|
|
1944
1944
|
resolvedScriptPath = this._scriptPath;
|
|
1945
1945
|
}
|
|
1946
|
-
executableDir =
|
|
1947
|
-
|
|
1946
|
+
executableDir = path13.resolve(
|
|
1947
|
+
path13.dirname(resolvedScriptPath),
|
|
1948
1948
|
executableDir
|
|
1949
1949
|
);
|
|
1950
1950
|
}
|
|
1951
1951
|
if (executableDir) {
|
|
1952
1952
|
let localFile = findFile(executableDir, executableFile);
|
|
1953
1953
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1954
|
-
const legacyName =
|
|
1954
|
+
const legacyName = path13.basename(
|
|
1955
1955
|
this._scriptPath,
|
|
1956
|
-
|
|
1956
|
+
path13.extname(this._scriptPath)
|
|
1957
1957
|
);
|
|
1958
1958
|
if (legacyName !== this._name) {
|
|
1959
1959
|
localFile = findFile(
|
|
@@ -1964,7 +1964,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1964
1964
|
}
|
|
1965
1965
|
executableFile = localFile || executableFile;
|
|
1966
1966
|
}
|
|
1967
|
-
launchWithNode = sourceExt.includes(
|
|
1967
|
+
launchWithNode = sourceExt.includes(path13.extname(executableFile));
|
|
1968
1968
|
let proc;
|
|
1969
1969
|
if (process10.platform !== "win32") {
|
|
1970
1970
|
if (launchWithNode) {
|
|
@@ -2804,7 +2804,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2804
2804
|
* @return {Command}
|
|
2805
2805
|
*/
|
|
2806
2806
|
nameFromFilename(filename) {
|
|
2807
|
-
this._name =
|
|
2807
|
+
this._name = path13.basename(filename, path13.extname(filename));
|
|
2808
2808
|
return this;
|
|
2809
2809
|
}
|
|
2810
2810
|
/**
|
|
@@ -2818,9 +2818,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2818
2818
|
* @param {string} [path]
|
|
2819
2819
|
* @return {(string|null|Command)}
|
|
2820
2820
|
*/
|
|
2821
|
-
executableDir(
|
|
2822
|
-
if (
|
|
2823
|
-
this._executableDir =
|
|
2821
|
+
executableDir(path14) {
|
|
2822
|
+
if (path14 === void 0) return this._executableDir;
|
|
2823
|
+
this._executableDir = path14;
|
|
2824
2824
|
return this;
|
|
2825
2825
|
}
|
|
2826
2826
|
/**
|
|
@@ -9677,54 +9677,54 @@ var require_polyfills = __commonJS({
|
|
|
9677
9677
|
}
|
|
9678
9678
|
var chdir;
|
|
9679
9679
|
module.exports = patch;
|
|
9680
|
-
function patch(
|
|
9680
|
+
function patch(fs11) {
|
|
9681
9681
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
9682
|
-
patchLchmod(
|
|
9683
|
-
}
|
|
9684
|
-
if (!
|
|
9685
|
-
patchLutimes(
|
|
9686
|
-
}
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
if (
|
|
9706
|
-
|
|
9682
|
+
patchLchmod(fs11);
|
|
9683
|
+
}
|
|
9684
|
+
if (!fs11.lutimes) {
|
|
9685
|
+
patchLutimes(fs11);
|
|
9686
|
+
}
|
|
9687
|
+
fs11.chown = chownFix(fs11.chown);
|
|
9688
|
+
fs11.fchown = chownFix(fs11.fchown);
|
|
9689
|
+
fs11.lchown = chownFix(fs11.lchown);
|
|
9690
|
+
fs11.chmod = chmodFix(fs11.chmod);
|
|
9691
|
+
fs11.fchmod = chmodFix(fs11.fchmod);
|
|
9692
|
+
fs11.lchmod = chmodFix(fs11.lchmod);
|
|
9693
|
+
fs11.chownSync = chownFixSync(fs11.chownSync);
|
|
9694
|
+
fs11.fchownSync = chownFixSync(fs11.fchownSync);
|
|
9695
|
+
fs11.lchownSync = chownFixSync(fs11.lchownSync);
|
|
9696
|
+
fs11.chmodSync = chmodFixSync(fs11.chmodSync);
|
|
9697
|
+
fs11.fchmodSync = chmodFixSync(fs11.fchmodSync);
|
|
9698
|
+
fs11.lchmodSync = chmodFixSync(fs11.lchmodSync);
|
|
9699
|
+
fs11.stat = statFix(fs11.stat);
|
|
9700
|
+
fs11.fstat = statFix(fs11.fstat);
|
|
9701
|
+
fs11.lstat = statFix(fs11.lstat);
|
|
9702
|
+
fs11.statSync = statFixSync(fs11.statSync);
|
|
9703
|
+
fs11.fstatSync = statFixSync(fs11.fstatSync);
|
|
9704
|
+
fs11.lstatSync = statFixSync(fs11.lstatSync);
|
|
9705
|
+
if (fs11.chmod && !fs11.lchmod) {
|
|
9706
|
+
fs11.lchmod = function(path13, mode, cb) {
|
|
9707
9707
|
if (cb) process.nextTick(cb);
|
|
9708
9708
|
};
|
|
9709
|
-
|
|
9709
|
+
fs11.lchmodSync = function() {
|
|
9710
9710
|
};
|
|
9711
9711
|
}
|
|
9712
|
-
if (
|
|
9713
|
-
|
|
9712
|
+
if (fs11.chown && !fs11.lchown) {
|
|
9713
|
+
fs11.lchown = function(path13, uid, gid, cb) {
|
|
9714
9714
|
if (cb) process.nextTick(cb);
|
|
9715
9715
|
};
|
|
9716
|
-
|
|
9716
|
+
fs11.lchownSync = function() {
|
|
9717
9717
|
};
|
|
9718
9718
|
}
|
|
9719
9719
|
if (platform === "win32") {
|
|
9720
|
-
|
|
9720
|
+
fs11.rename = typeof fs11.rename !== "function" ? fs11.rename : (function(fs$rename) {
|
|
9721
9721
|
function rename2(from, to, cb) {
|
|
9722
9722
|
var start = Date.now();
|
|
9723
9723
|
var backoff = 0;
|
|
9724
9724
|
fs$rename(from, to, function CB(er) {
|
|
9725
9725
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
9726
9726
|
setTimeout(function() {
|
|
9727
|
-
|
|
9727
|
+
fs11.stat(to, function(stater, st) {
|
|
9728
9728
|
if (stater && stater.code === "ENOENT")
|
|
9729
9729
|
fs$rename(from, to, CB);
|
|
9730
9730
|
else
|
|
@@ -9740,9 +9740,9 @@ var require_polyfills = __commonJS({
|
|
|
9740
9740
|
}
|
|
9741
9741
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename2, fs$rename);
|
|
9742
9742
|
return rename2;
|
|
9743
|
-
})(
|
|
9743
|
+
})(fs11.rename);
|
|
9744
9744
|
}
|
|
9745
|
-
|
|
9745
|
+
fs11.read = typeof fs11.read !== "function" ? fs11.read : (function(fs$read) {
|
|
9746
9746
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
9747
9747
|
var callback;
|
|
9748
9748
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -9750,22 +9750,22 @@ var require_polyfills = __commonJS({
|
|
|
9750
9750
|
callback = function(er, _, __) {
|
|
9751
9751
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
9752
9752
|
eagCounter++;
|
|
9753
|
-
return fs$read.call(
|
|
9753
|
+
return fs$read.call(fs11, fd, buffer, offset, length, position, callback);
|
|
9754
9754
|
}
|
|
9755
9755
|
callback_.apply(this, arguments);
|
|
9756
9756
|
};
|
|
9757
9757
|
}
|
|
9758
|
-
return fs$read.call(
|
|
9758
|
+
return fs$read.call(fs11, fd, buffer, offset, length, position, callback);
|
|
9759
9759
|
}
|
|
9760
9760
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
9761
9761
|
return read;
|
|
9762
|
-
})(
|
|
9763
|
-
|
|
9762
|
+
})(fs11.read);
|
|
9763
|
+
fs11.readSync = typeof fs11.readSync !== "function" ? fs11.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
9764
9764
|
return function(fd, buffer, offset, length, position) {
|
|
9765
9765
|
var eagCounter = 0;
|
|
9766
9766
|
while (true) {
|
|
9767
9767
|
try {
|
|
9768
|
-
return fs$readSync.call(
|
|
9768
|
+
return fs$readSync.call(fs11, fd, buffer, offset, length, position);
|
|
9769
9769
|
} catch (er) {
|
|
9770
9770
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
9771
9771
|
eagCounter++;
|
|
@@ -9775,11 +9775,11 @@ var require_polyfills = __commonJS({
|
|
|
9775
9775
|
}
|
|
9776
9776
|
}
|
|
9777
9777
|
};
|
|
9778
|
-
})(
|
|
9779
|
-
function patchLchmod(
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9778
|
+
})(fs11.readSync);
|
|
9779
|
+
function patchLchmod(fs12) {
|
|
9780
|
+
fs12.lchmod = function(path13, mode, callback) {
|
|
9781
|
+
fs12.open(
|
|
9782
|
+
path13,
|
|
9783
9783
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
9784
9784
|
mode,
|
|
9785
9785
|
function(err, fd) {
|
|
@@ -9787,80 +9787,80 @@ var require_polyfills = __commonJS({
|
|
|
9787
9787
|
if (callback) callback(err);
|
|
9788
9788
|
return;
|
|
9789
9789
|
}
|
|
9790
|
-
|
|
9791
|
-
|
|
9790
|
+
fs12.fchmod(fd, mode, function(err2) {
|
|
9791
|
+
fs12.close(fd, function(err22) {
|
|
9792
9792
|
if (callback) callback(err2 || err22);
|
|
9793
9793
|
});
|
|
9794
9794
|
});
|
|
9795
9795
|
}
|
|
9796
9796
|
);
|
|
9797
9797
|
};
|
|
9798
|
-
|
|
9799
|
-
var fd =
|
|
9798
|
+
fs12.lchmodSync = function(path13, mode) {
|
|
9799
|
+
var fd = fs12.openSync(path13, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
9800
9800
|
var threw = true;
|
|
9801
9801
|
var ret;
|
|
9802
9802
|
try {
|
|
9803
|
-
ret =
|
|
9803
|
+
ret = fs12.fchmodSync(fd, mode);
|
|
9804
9804
|
threw = false;
|
|
9805
9805
|
} finally {
|
|
9806
9806
|
if (threw) {
|
|
9807
9807
|
try {
|
|
9808
|
-
|
|
9808
|
+
fs12.closeSync(fd);
|
|
9809
9809
|
} catch (er) {
|
|
9810
9810
|
}
|
|
9811
9811
|
} else {
|
|
9812
|
-
|
|
9812
|
+
fs12.closeSync(fd);
|
|
9813
9813
|
}
|
|
9814
9814
|
}
|
|
9815
9815
|
return ret;
|
|
9816
9816
|
};
|
|
9817
9817
|
}
|
|
9818
|
-
function patchLutimes(
|
|
9819
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
9820
|
-
|
|
9821
|
-
|
|
9818
|
+
function patchLutimes(fs12) {
|
|
9819
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs12.futimes) {
|
|
9820
|
+
fs12.lutimes = function(path13, at, mt, cb) {
|
|
9821
|
+
fs12.open(path13, constants.O_SYMLINK, function(er, fd) {
|
|
9822
9822
|
if (er) {
|
|
9823
9823
|
if (cb) cb(er);
|
|
9824
9824
|
return;
|
|
9825
9825
|
}
|
|
9826
|
-
|
|
9827
|
-
|
|
9826
|
+
fs12.futimes(fd, at, mt, function(er2) {
|
|
9827
|
+
fs12.close(fd, function(er22) {
|
|
9828
9828
|
if (cb) cb(er2 || er22);
|
|
9829
9829
|
});
|
|
9830
9830
|
});
|
|
9831
9831
|
});
|
|
9832
9832
|
};
|
|
9833
|
-
|
|
9834
|
-
var fd =
|
|
9833
|
+
fs12.lutimesSync = function(path13, at, mt) {
|
|
9834
|
+
var fd = fs12.openSync(path13, constants.O_SYMLINK);
|
|
9835
9835
|
var ret;
|
|
9836
9836
|
var threw = true;
|
|
9837
9837
|
try {
|
|
9838
|
-
ret =
|
|
9838
|
+
ret = fs12.futimesSync(fd, at, mt);
|
|
9839
9839
|
threw = false;
|
|
9840
9840
|
} finally {
|
|
9841
9841
|
if (threw) {
|
|
9842
9842
|
try {
|
|
9843
|
-
|
|
9843
|
+
fs12.closeSync(fd);
|
|
9844
9844
|
} catch (er) {
|
|
9845
9845
|
}
|
|
9846
9846
|
} else {
|
|
9847
|
-
|
|
9847
|
+
fs12.closeSync(fd);
|
|
9848
9848
|
}
|
|
9849
9849
|
}
|
|
9850
9850
|
return ret;
|
|
9851
9851
|
};
|
|
9852
|
-
} else if (
|
|
9853
|
-
|
|
9852
|
+
} else if (fs12.futimes) {
|
|
9853
|
+
fs12.lutimes = function(_a, _b, _c, cb) {
|
|
9854
9854
|
if (cb) process.nextTick(cb);
|
|
9855
9855
|
};
|
|
9856
|
-
|
|
9856
|
+
fs12.lutimesSync = function() {
|
|
9857
9857
|
};
|
|
9858
9858
|
}
|
|
9859
9859
|
}
|
|
9860
9860
|
function chmodFix(orig) {
|
|
9861
9861
|
if (!orig) return orig;
|
|
9862
9862
|
return function(target, mode, cb) {
|
|
9863
|
-
return orig.call(
|
|
9863
|
+
return orig.call(fs11, target, mode, function(er) {
|
|
9864
9864
|
if (chownErOk(er)) er = null;
|
|
9865
9865
|
if (cb) cb.apply(this, arguments);
|
|
9866
9866
|
});
|
|
@@ -9870,7 +9870,7 @@ var require_polyfills = __commonJS({
|
|
|
9870
9870
|
if (!orig) return orig;
|
|
9871
9871
|
return function(target, mode) {
|
|
9872
9872
|
try {
|
|
9873
|
-
return orig.call(
|
|
9873
|
+
return orig.call(fs11, target, mode);
|
|
9874
9874
|
} catch (er) {
|
|
9875
9875
|
if (!chownErOk(er)) throw er;
|
|
9876
9876
|
}
|
|
@@ -9879,7 +9879,7 @@ var require_polyfills = __commonJS({
|
|
|
9879
9879
|
function chownFix(orig) {
|
|
9880
9880
|
if (!orig) return orig;
|
|
9881
9881
|
return function(target, uid, gid, cb) {
|
|
9882
|
-
return orig.call(
|
|
9882
|
+
return orig.call(fs11, target, uid, gid, function(er) {
|
|
9883
9883
|
if (chownErOk(er)) er = null;
|
|
9884
9884
|
if (cb) cb.apply(this, arguments);
|
|
9885
9885
|
});
|
|
@@ -9889,7 +9889,7 @@ var require_polyfills = __commonJS({
|
|
|
9889
9889
|
if (!orig) return orig;
|
|
9890
9890
|
return function(target, uid, gid) {
|
|
9891
9891
|
try {
|
|
9892
|
-
return orig.call(
|
|
9892
|
+
return orig.call(fs11, target, uid, gid);
|
|
9893
9893
|
} catch (er) {
|
|
9894
9894
|
if (!chownErOk(er)) throw er;
|
|
9895
9895
|
}
|
|
@@ -9909,13 +9909,13 @@ var require_polyfills = __commonJS({
|
|
|
9909
9909
|
}
|
|
9910
9910
|
if (cb) cb.apply(this, arguments);
|
|
9911
9911
|
}
|
|
9912
|
-
return options ? orig.call(
|
|
9912
|
+
return options ? orig.call(fs11, target, options, callback) : orig.call(fs11, target, callback);
|
|
9913
9913
|
};
|
|
9914
9914
|
}
|
|
9915
9915
|
function statFixSync(orig) {
|
|
9916
9916
|
if (!orig) return orig;
|
|
9917
9917
|
return function(target, options) {
|
|
9918
|
-
var stats = options ? orig.call(
|
|
9918
|
+
var stats = options ? orig.call(fs11, target, options) : orig.call(fs11, target);
|
|
9919
9919
|
if (stats) {
|
|
9920
9920
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
9921
9921
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -9946,16 +9946,16 @@ var require_legacy_streams = __commonJS({
|
|
|
9946
9946
|
init_esm_shims();
|
|
9947
9947
|
var Stream = __require("stream").Stream;
|
|
9948
9948
|
module.exports = legacy;
|
|
9949
|
-
function legacy(
|
|
9949
|
+
function legacy(fs11) {
|
|
9950
9950
|
return {
|
|
9951
9951
|
ReadStream,
|
|
9952
9952
|
WriteStream
|
|
9953
9953
|
};
|
|
9954
|
-
function ReadStream(
|
|
9955
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
9954
|
+
function ReadStream(path13, options) {
|
|
9955
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path13, options);
|
|
9956
9956
|
Stream.call(this);
|
|
9957
9957
|
var self = this;
|
|
9958
|
-
this.path =
|
|
9958
|
+
this.path = path13;
|
|
9959
9959
|
this.fd = null;
|
|
9960
9960
|
this.readable = true;
|
|
9961
9961
|
this.paused = false;
|
|
@@ -9989,7 +9989,7 @@ var require_legacy_streams = __commonJS({
|
|
|
9989
9989
|
});
|
|
9990
9990
|
return;
|
|
9991
9991
|
}
|
|
9992
|
-
|
|
9992
|
+
fs11.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
9993
9993
|
if (err) {
|
|
9994
9994
|
self.emit("error", err);
|
|
9995
9995
|
self.readable = false;
|
|
@@ -10000,10 +10000,10 @@ var require_legacy_streams = __commonJS({
|
|
|
10000
10000
|
self._read();
|
|
10001
10001
|
});
|
|
10002
10002
|
}
|
|
10003
|
-
function WriteStream(
|
|
10004
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
10003
|
+
function WriteStream(path13, options) {
|
|
10004
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path13, options);
|
|
10005
10005
|
Stream.call(this);
|
|
10006
|
-
this.path =
|
|
10006
|
+
this.path = path13;
|
|
10007
10007
|
this.fd = null;
|
|
10008
10008
|
this.writable = true;
|
|
10009
10009
|
this.flags = "w";
|
|
@@ -10028,7 +10028,7 @@ var require_legacy_streams = __commonJS({
|
|
|
10028
10028
|
this.busy = false;
|
|
10029
10029
|
this._queue = [];
|
|
10030
10030
|
if (this.fd === null) {
|
|
10031
|
-
this._open =
|
|
10031
|
+
this._open = fs11.open;
|
|
10032
10032
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
10033
10033
|
this.flush();
|
|
10034
10034
|
}
|
|
@@ -10066,7 +10066,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10066
10066
|
"../../node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
10067
10067
|
"use strict";
|
|
10068
10068
|
init_esm_shims();
|
|
10069
|
-
var
|
|
10069
|
+
var fs11 = __require("fs");
|
|
10070
10070
|
var polyfills = require_polyfills();
|
|
10071
10071
|
var legacy = require_legacy_streams();
|
|
10072
10072
|
var clone = require_clone();
|
|
@@ -10098,12 +10098,12 @@ var require_graceful_fs = __commonJS({
|
|
|
10098
10098
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
10099
10099
|
console.error(m);
|
|
10100
10100
|
};
|
|
10101
|
-
if (!
|
|
10101
|
+
if (!fs11[gracefulQueue]) {
|
|
10102
10102
|
queue = global[gracefulQueue] || [];
|
|
10103
|
-
publishQueue(
|
|
10104
|
-
|
|
10103
|
+
publishQueue(fs11, queue);
|
|
10104
|
+
fs11.close = (function(fs$close) {
|
|
10105
10105
|
function close(fd, cb) {
|
|
10106
|
-
return fs$close.call(
|
|
10106
|
+
return fs$close.call(fs11, fd, function(err) {
|
|
10107
10107
|
if (!err) {
|
|
10108
10108
|
resetQueue();
|
|
10109
10109
|
}
|
|
@@ -10115,48 +10115,48 @@ var require_graceful_fs = __commonJS({
|
|
|
10115
10115
|
value: fs$close
|
|
10116
10116
|
});
|
|
10117
10117
|
return close;
|
|
10118
|
-
})(
|
|
10119
|
-
|
|
10118
|
+
})(fs11.close);
|
|
10119
|
+
fs11.closeSync = (function(fs$closeSync) {
|
|
10120
10120
|
function closeSync(fd) {
|
|
10121
|
-
fs$closeSync.apply(
|
|
10121
|
+
fs$closeSync.apply(fs11, arguments);
|
|
10122
10122
|
resetQueue();
|
|
10123
10123
|
}
|
|
10124
10124
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
10125
10125
|
value: fs$closeSync
|
|
10126
10126
|
});
|
|
10127
10127
|
return closeSync;
|
|
10128
|
-
})(
|
|
10128
|
+
})(fs11.closeSync);
|
|
10129
10129
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
10130
10130
|
process.on("exit", function() {
|
|
10131
|
-
debug(
|
|
10132
|
-
__require("assert").equal(
|
|
10131
|
+
debug(fs11[gracefulQueue]);
|
|
10132
|
+
__require("assert").equal(fs11[gracefulQueue].length, 0);
|
|
10133
10133
|
});
|
|
10134
10134
|
}
|
|
10135
10135
|
}
|
|
10136
10136
|
var queue;
|
|
10137
10137
|
if (!global[gracefulQueue]) {
|
|
10138
|
-
publishQueue(global,
|
|
10139
|
-
}
|
|
10140
|
-
module.exports = patch(clone(
|
|
10141
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
10142
|
-
module.exports = patch(
|
|
10143
|
-
|
|
10144
|
-
}
|
|
10145
|
-
function patch(
|
|
10146
|
-
polyfills(
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
var fs$readFile =
|
|
10151
|
-
|
|
10152
|
-
function readFile(
|
|
10138
|
+
publishQueue(global, fs11[gracefulQueue]);
|
|
10139
|
+
}
|
|
10140
|
+
module.exports = patch(clone(fs11));
|
|
10141
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs11.__patched) {
|
|
10142
|
+
module.exports = patch(fs11);
|
|
10143
|
+
fs11.__patched = true;
|
|
10144
|
+
}
|
|
10145
|
+
function patch(fs12) {
|
|
10146
|
+
polyfills(fs12);
|
|
10147
|
+
fs12.gracefulify = patch;
|
|
10148
|
+
fs12.createReadStream = createReadStream;
|
|
10149
|
+
fs12.createWriteStream = createWriteStream;
|
|
10150
|
+
var fs$readFile = fs12.readFile;
|
|
10151
|
+
fs12.readFile = readFile;
|
|
10152
|
+
function readFile(path13, options, cb) {
|
|
10153
10153
|
if (typeof options === "function")
|
|
10154
10154
|
cb = options, options = null;
|
|
10155
|
-
return go$readFile(
|
|
10156
|
-
function go$readFile(
|
|
10157
|
-
return fs$readFile(
|
|
10155
|
+
return go$readFile(path13, options, cb);
|
|
10156
|
+
function go$readFile(path14, options2, cb2, startTime) {
|
|
10157
|
+
return fs$readFile(path14, options2, function(err) {
|
|
10158
10158
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
10159
|
-
enqueue([go$readFile, [
|
|
10159
|
+
enqueue([go$readFile, [path14, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
10160
10160
|
else {
|
|
10161
10161
|
if (typeof cb2 === "function")
|
|
10162
10162
|
cb2.apply(this, arguments);
|
|
@@ -10164,16 +10164,16 @@ var require_graceful_fs = __commonJS({
|
|
|
10164
10164
|
});
|
|
10165
10165
|
}
|
|
10166
10166
|
}
|
|
10167
|
-
var fs$writeFile =
|
|
10168
|
-
|
|
10169
|
-
function writeFile(
|
|
10167
|
+
var fs$writeFile = fs12.writeFile;
|
|
10168
|
+
fs12.writeFile = writeFile;
|
|
10169
|
+
function writeFile(path13, data, options, cb) {
|
|
10170
10170
|
if (typeof options === "function")
|
|
10171
10171
|
cb = options, options = null;
|
|
10172
|
-
return go$writeFile(
|
|
10173
|
-
function go$writeFile(
|
|
10174
|
-
return fs$writeFile(
|
|
10172
|
+
return go$writeFile(path13, data, options, cb);
|
|
10173
|
+
function go$writeFile(path14, data2, options2, cb2, startTime) {
|
|
10174
|
+
return fs$writeFile(path14, data2, options2, function(err) {
|
|
10175
10175
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
10176
|
-
enqueue([go$writeFile, [
|
|
10176
|
+
enqueue([go$writeFile, [path14, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
10177
10177
|
else {
|
|
10178
10178
|
if (typeof cb2 === "function")
|
|
10179
10179
|
cb2.apply(this, arguments);
|
|
@@ -10181,17 +10181,17 @@ var require_graceful_fs = __commonJS({
|
|
|
10181
10181
|
});
|
|
10182
10182
|
}
|
|
10183
10183
|
}
|
|
10184
|
-
var fs$appendFile =
|
|
10184
|
+
var fs$appendFile = fs12.appendFile;
|
|
10185
10185
|
if (fs$appendFile)
|
|
10186
|
-
|
|
10187
|
-
function appendFile(
|
|
10186
|
+
fs12.appendFile = appendFile;
|
|
10187
|
+
function appendFile(path13, data, options, cb) {
|
|
10188
10188
|
if (typeof options === "function")
|
|
10189
10189
|
cb = options, options = null;
|
|
10190
|
-
return go$appendFile(
|
|
10191
|
-
function go$appendFile(
|
|
10192
|
-
return fs$appendFile(
|
|
10190
|
+
return go$appendFile(path13, data, options, cb);
|
|
10191
|
+
function go$appendFile(path14, data2, options2, cb2, startTime) {
|
|
10192
|
+
return fs$appendFile(path14, data2, options2, function(err) {
|
|
10193
10193
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
10194
|
-
enqueue([go$appendFile, [
|
|
10194
|
+
enqueue([go$appendFile, [path14, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
10195
10195
|
else {
|
|
10196
10196
|
if (typeof cb2 === "function")
|
|
10197
10197
|
cb2.apply(this, arguments);
|
|
@@ -10199,9 +10199,9 @@ var require_graceful_fs = __commonJS({
|
|
|
10199
10199
|
});
|
|
10200
10200
|
}
|
|
10201
10201
|
}
|
|
10202
|
-
var fs$copyFile =
|
|
10202
|
+
var fs$copyFile = fs12.copyFile;
|
|
10203
10203
|
if (fs$copyFile)
|
|
10204
|
-
|
|
10204
|
+
fs12.copyFile = copyFile;
|
|
10205
10205
|
function copyFile(src, dest, flags, cb) {
|
|
10206
10206
|
if (typeof flags === "function") {
|
|
10207
10207
|
cb = flags;
|
|
@@ -10219,34 +10219,34 @@ var require_graceful_fs = __commonJS({
|
|
|
10219
10219
|
});
|
|
10220
10220
|
}
|
|
10221
10221
|
}
|
|
10222
|
-
var fs$readdir =
|
|
10223
|
-
|
|
10222
|
+
var fs$readdir = fs12.readdir;
|
|
10223
|
+
fs12.readdir = readdir;
|
|
10224
10224
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
10225
|
-
function readdir(
|
|
10225
|
+
function readdir(path13, options, cb) {
|
|
10226
10226
|
if (typeof options === "function")
|
|
10227
10227
|
cb = options, options = null;
|
|
10228
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
10229
|
-
return fs$readdir(
|
|
10230
|
-
|
|
10228
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path14, options2, cb2, startTime) {
|
|
10229
|
+
return fs$readdir(path14, fs$readdirCallback(
|
|
10230
|
+
path14,
|
|
10231
10231
|
options2,
|
|
10232
10232
|
cb2,
|
|
10233
10233
|
startTime
|
|
10234
10234
|
));
|
|
10235
|
-
} : function go$readdir2(
|
|
10236
|
-
return fs$readdir(
|
|
10237
|
-
|
|
10235
|
+
} : function go$readdir2(path14, options2, cb2, startTime) {
|
|
10236
|
+
return fs$readdir(path14, options2, fs$readdirCallback(
|
|
10237
|
+
path14,
|
|
10238
10238
|
options2,
|
|
10239
10239
|
cb2,
|
|
10240
10240
|
startTime
|
|
10241
10241
|
));
|
|
10242
10242
|
};
|
|
10243
|
-
return go$readdir(
|
|
10244
|
-
function fs$readdirCallback(
|
|
10243
|
+
return go$readdir(path13, options, cb);
|
|
10244
|
+
function fs$readdirCallback(path14, options2, cb2, startTime) {
|
|
10245
10245
|
return function(err, files) {
|
|
10246
10246
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
10247
10247
|
enqueue([
|
|
10248
10248
|
go$readdir,
|
|
10249
|
-
[
|
|
10249
|
+
[path14, options2, cb2],
|
|
10250
10250
|
err,
|
|
10251
10251
|
startTime || Date.now(),
|
|
10252
10252
|
Date.now()
|
|
@@ -10261,21 +10261,21 @@ var require_graceful_fs = __commonJS({
|
|
|
10261
10261
|
}
|
|
10262
10262
|
}
|
|
10263
10263
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
10264
|
-
var legStreams = legacy(
|
|
10264
|
+
var legStreams = legacy(fs12);
|
|
10265
10265
|
ReadStream = legStreams.ReadStream;
|
|
10266
10266
|
WriteStream = legStreams.WriteStream;
|
|
10267
10267
|
}
|
|
10268
|
-
var fs$ReadStream =
|
|
10268
|
+
var fs$ReadStream = fs12.ReadStream;
|
|
10269
10269
|
if (fs$ReadStream) {
|
|
10270
10270
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
10271
10271
|
ReadStream.prototype.open = ReadStream$open;
|
|
10272
10272
|
}
|
|
10273
|
-
var fs$WriteStream =
|
|
10273
|
+
var fs$WriteStream = fs12.WriteStream;
|
|
10274
10274
|
if (fs$WriteStream) {
|
|
10275
10275
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
10276
10276
|
WriteStream.prototype.open = WriteStream$open;
|
|
10277
10277
|
}
|
|
10278
|
-
Object.defineProperty(
|
|
10278
|
+
Object.defineProperty(fs12, "ReadStream", {
|
|
10279
10279
|
get: function() {
|
|
10280
10280
|
return ReadStream;
|
|
10281
10281
|
},
|
|
@@ -10285,7 +10285,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10285
10285
|
enumerable: true,
|
|
10286
10286
|
configurable: true
|
|
10287
10287
|
});
|
|
10288
|
-
Object.defineProperty(
|
|
10288
|
+
Object.defineProperty(fs12, "WriteStream", {
|
|
10289
10289
|
get: function() {
|
|
10290
10290
|
return WriteStream;
|
|
10291
10291
|
},
|
|
@@ -10296,7 +10296,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10296
10296
|
configurable: true
|
|
10297
10297
|
});
|
|
10298
10298
|
var FileReadStream = ReadStream;
|
|
10299
|
-
Object.defineProperty(
|
|
10299
|
+
Object.defineProperty(fs12, "FileReadStream", {
|
|
10300
10300
|
get: function() {
|
|
10301
10301
|
return FileReadStream;
|
|
10302
10302
|
},
|
|
@@ -10307,7 +10307,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10307
10307
|
configurable: true
|
|
10308
10308
|
});
|
|
10309
10309
|
var FileWriteStream = WriteStream;
|
|
10310
|
-
Object.defineProperty(
|
|
10310
|
+
Object.defineProperty(fs12, "FileWriteStream", {
|
|
10311
10311
|
get: function() {
|
|
10312
10312
|
return FileWriteStream;
|
|
10313
10313
|
},
|
|
@@ -10317,7 +10317,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10317
10317
|
enumerable: true,
|
|
10318
10318
|
configurable: true
|
|
10319
10319
|
});
|
|
10320
|
-
function ReadStream(
|
|
10320
|
+
function ReadStream(path13, options) {
|
|
10321
10321
|
if (this instanceof ReadStream)
|
|
10322
10322
|
return fs$ReadStream.apply(this, arguments), this;
|
|
10323
10323
|
else
|
|
@@ -10337,7 +10337,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10337
10337
|
}
|
|
10338
10338
|
});
|
|
10339
10339
|
}
|
|
10340
|
-
function WriteStream(
|
|
10340
|
+
function WriteStream(path13, options) {
|
|
10341
10341
|
if (this instanceof WriteStream)
|
|
10342
10342
|
return fs$WriteStream.apply(this, arguments), this;
|
|
10343
10343
|
else
|
|
@@ -10355,22 +10355,22 @@ var require_graceful_fs = __commonJS({
|
|
|
10355
10355
|
}
|
|
10356
10356
|
});
|
|
10357
10357
|
}
|
|
10358
|
-
function createReadStream(
|
|
10359
|
-
return new
|
|
10358
|
+
function createReadStream(path13, options) {
|
|
10359
|
+
return new fs12.ReadStream(path13, options);
|
|
10360
10360
|
}
|
|
10361
|
-
function createWriteStream(
|
|
10362
|
-
return new
|
|
10361
|
+
function createWriteStream(path13, options) {
|
|
10362
|
+
return new fs12.WriteStream(path13, options);
|
|
10363
10363
|
}
|
|
10364
|
-
var fs$open =
|
|
10365
|
-
|
|
10366
|
-
function open2(
|
|
10364
|
+
var fs$open = fs12.open;
|
|
10365
|
+
fs12.open = open2;
|
|
10366
|
+
function open2(path13, flags, mode, cb) {
|
|
10367
10367
|
if (typeof mode === "function")
|
|
10368
10368
|
cb = mode, mode = null;
|
|
10369
|
-
return go$open(
|
|
10370
|
-
function go$open(
|
|
10371
|
-
return fs$open(
|
|
10369
|
+
return go$open(path13, flags, mode, cb);
|
|
10370
|
+
function go$open(path14, flags2, mode2, cb2, startTime) {
|
|
10371
|
+
return fs$open(path14, flags2, mode2, function(err, fd) {
|
|
10372
10372
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
10373
|
-
enqueue([go$open, [
|
|
10373
|
+
enqueue([go$open, [path14, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
10374
10374
|
else {
|
|
10375
10375
|
if (typeof cb2 === "function")
|
|
10376
10376
|
cb2.apply(this, arguments);
|
|
@@ -10378,20 +10378,20 @@ var require_graceful_fs = __commonJS({
|
|
|
10378
10378
|
});
|
|
10379
10379
|
}
|
|
10380
10380
|
}
|
|
10381
|
-
return
|
|
10381
|
+
return fs12;
|
|
10382
10382
|
}
|
|
10383
10383
|
function enqueue(elem) {
|
|
10384
10384
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
10385
|
-
|
|
10385
|
+
fs11[gracefulQueue].push(elem);
|
|
10386
10386
|
retry();
|
|
10387
10387
|
}
|
|
10388
10388
|
var retryTimer;
|
|
10389
10389
|
function resetQueue() {
|
|
10390
10390
|
var now = Date.now();
|
|
10391
|
-
for (var i = 0; i <
|
|
10392
|
-
if (
|
|
10393
|
-
|
|
10394
|
-
|
|
10391
|
+
for (var i = 0; i < fs11[gracefulQueue].length; ++i) {
|
|
10392
|
+
if (fs11[gracefulQueue][i].length > 2) {
|
|
10393
|
+
fs11[gracefulQueue][i][3] = now;
|
|
10394
|
+
fs11[gracefulQueue][i][4] = now;
|
|
10395
10395
|
}
|
|
10396
10396
|
}
|
|
10397
10397
|
retry();
|
|
@@ -10399,9 +10399,9 @@ var require_graceful_fs = __commonJS({
|
|
|
10399
10399
|
function retry() {
|
|
10400
10400
|
clearTimeout(retryTimer);
|
|
10401
10401
|
retryTimer = void 0;
|
|
10402
|
-
if (
|
|
10402
|
+
if (fs11[gracefulQueue].length === 0)
|
|
10403
10403
|
return;
|
|
10404
|
-
var elem =
|
|
10404
|
+
var elem = fs11[gracefulQueue].shift();
|
|
10405
10405
|
var fn = elem[0];
|
|
10406
10406
|
var args = elem[1];
|
|
10407
10407
|
var err = elem[2];
|
|
@@ -10423,7 +10423,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10423
10423
|
debug("RETRY", fn.name, args);
|
|
10424
10424
|
fn.apply(null, args.concat([startTime]));
|
|
10425
10425
|
} else {
|
|
10426
|
-
|
|
10426
|
+
fs11[gracefulQueue].push(elem);
|
|
10427
10427
|
}
|
|
10428
10428
|
}
|
|
10429
10429
|
if (retryTimer === void 0) {
|
|
@@ -10439,7 +10439,7 @@ var require_fs = __commonJS({
|
|
|
10439
10439
|
"use strict";
|
|
10440
10440
|
init_esm_shims();
|
|
10441
10441
|
var u = require_universalify().fromCallback;
|
|
10442
|
-
var
|
|
10442
|
+
var fs11 = require_graceful_fs();
|
|
10443
10443
|
var api = [
|
|
10444
10444
|
"access",
|
|
10445
10445
|
"appendFile",
|
|
@@ -10480,26 +10480,26 @@ var require_fs = __commonJS({
|
|
|
10480
10480
|
"utimes",
|
|
10481
10481
|
"writeFile"
|
|
10482
10482
|
].filter((key) => {
|
|
10483
|
-
return typeof
|
|
10483
|
+
return typeof fs11[key] === "function";
|
|
10484
10484
|
});
|
|
10485
|
-
Object.assign(exports,
|
|
10485
|
+
Object.assign(exports, fs11);
|
|
10486
10486
|
api.forEach((method) => {
|
|
10487
|
-
exports[method] = u(
|
|
10487
|
+
exports[method] = u(fs11[method]);
|
|
10488
10488
|
});
|
|
10489
10489
|
exports.exists = function(filename, callback) {
|
|
10490
10490
|
if (typeof callback === "function") {
|
|
10491
|
-
return
|
|
10491
|
+
return fs11.exists(filename, callback);
|
|
10492
10492
|
}
|
|
10493
10493
|
return new Promise((resolve) => {
|
|
10494
|
-
return
|
|
10494
|
+
return fs11.exists(filename, resolve);
|
|
10495
10495
|
});
|
|
10496
10496
|
};
|
|
10497
10497
|
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
10498
10498
|
if (typeof callback === "function") {
|
|
10499
|
-
return
|
|
10499
|
+
return fs11.read(fd, buffer, offset, length, position, callback);
|
|
10500
10500
|
}
|
|
10501
10501
|
return new Promise((resolve, reject) => {
|
|
10502
|
-
|
|
10502
|
+
fs11.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
10503
10503
|
if (err) return reject(err);
|
|
10504
10504
|
resolve({ bytesRead, buffer: buffer2 });
|
|
10505
10505
|
});
|
|
@@ -10507,10 +10507,10 @@ var require_fs = __commonJS({
|
|
|
10507
10507
|
};
|
|
10508
10508
|
exports.write = function(fd, buffer, ...args) {
|
|
10509
10509
|
if (typeof args[args.length - 1] === "function") {
|
|
10510
|
-
return
|
|
10510
|
+
return fs11.write(fd, buffer, ...args);
|
|
10511
10511
|
}
|
|
10512
10512
|
return new Promise((resolve, reject) => {
|
|
10513
|
-
|
|
10513
|
+
fs11.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
10514
10514
|
if (err) return reject(err);
|
|
10515
10515
|
resolve({ bytesWritten, buffer: buffer2 });
|
|
10516
10516
|
});
|
|
@@ -10518,10 +10518,10 @@ var require_fs = __commonJS({
|
|
|
10518
10518
|
};
|
|
10519
10519
|
exports.readv = function(fd, buffers, ...args) {
|
|
10520
10520
|
if (typeof args[args.length - 1] === "function") {
|
|
10521
|
-
return
|
|
10521
|
+
return fs11.readv(fd, buffers, ...args);
|
|
10522
10522
|
}
|
|
10523
10523
|
return new Promise((resolve, reject) => {
|
|
10524
|
-
|
|
10524
|
+
fs11.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
10525
10525
|
if (err) return reject(err);
|
|
10526
10526
|
resolve({ bytesRead, buffers: buffers2 });
|
|
10527
10527
|
});
|
|
@@ -10529,17 +10529,17 @@ var require_fs = __commonJS({
|
|
|
10529
10529
|
};
|
|
10530
10530
|
exports.writev = function(fd, buffers, ...args) {
|
|
10531
10531
|
if (typeof args[args.length - 1] === "function") {
|
|
10532
|
-
return
|
|
10532
|
+
return fs11.writev(fd, buffers, ...args);
|
|
10533
10533
|
}
|
|
10534
10534
|
return new Promise((resolve, reject) => {
|
|
10535
|
-
|
|
10535
|
+
fs11.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
10536
10536
|
if (err) return reject(err);
|
|
10537
10537
|
resolve({ bytesWritten, buffers: buffers2 });
|
|
10538
10538
|
});
|
|
10539
10539
|
});
|
|
10540
10540
|
};
|
|
10541
|
-
if (typeof
|
|
10542
|
-
exports.realpath.native = u(
|
|
10541
|
+
if (typeof fs11.realpath.native === "function") {
|
|
10542
|
+
exports.realpath.native = u(fs11.realpath.native);
|
|
10543
10543
|
} else {
|
|
10544
10544
|
process.emitWarning(
|
|
10545
10545
|
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
@@ -10555,10 +10555,10 @@ var require_utils = __commonJS({
|
|
|
10555
10555
|
"../../node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
|
|
10556
10556
|
"use strict";
|
|
10557
10557
|
init_esm_shims();
|
|
10558
|
-
var
|
|
10558
|
+
var path13 = __require("path");
|
|
10559
10559
|
module.exports.checkPath = function checkPath(pth) {
|
|
10560
10560
|
if (process.platform === "win32") {
|
|
10561
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(
|
|
10561
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path13.parse(pth).root, ""));
|
|
10562
10562
|
if (pathHasInvalidWinCharacters) {
|
|
10563
10563
|
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
10564
10564
|
error.code = "EINVAL";
|
|
@@ -10574,7 +10574,7 @@ var require_make_dir = __commonJS({
|
|
|
10574
10574
|
"../../node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module) {
|
|
10575
10575
|
"use strict";
|
|
10576
10576
|
init_esm_shims();
|
|
10577
|
-
var
|
|
10577
|
+
var fs11 = require_fs();
|
|
10578
10578
|
var { checkPath } = require_utils();
|
|
10579
10579
|
var getMode = (options) => {
|
|
10580
10580
|
const defaults = { mode: 511 };
|
|
@@ -10583,14 +10583,14 @@ var require_make_dir = __commonJS({
|
|
|
10583
10583
|
};
|
|
10584
10584
|
module.exports.makeDir = async (dir, options) => {
|
|
10585
10585
|
checkPath(dir);
|
|
10586
|
-
return
|
|
10586
|
+
return fs11.mkdir(dir, {
|
|
10587
10587
|
mode: getMode(options),
|
|
10588
10588
|
recursive: true
|
|
10589
10589
|
});
|
|
10590
10590
|
};
|
|
10591
10591
|
module.exports.makeDirSync = (dir, options) => {
|
|
10592
10592
|
checkPath(dir);
|
|
10593
|
-
return
|
|
10593
|
+
return fs11.mkdirSync(dir, {
|
|
10594
10594
|
mode: getMode(options),
|
|
10595
10595
|
recursive: true
|
|
10596
10596
|
});
|
|
@@ -10624,13 +10624,13 @@ var require_path_exists = __commonJS({
|
|
|
10624
10624
|
"use strict";
|
|
10625
10625
|
init_esm_shims();
|
|
10626
10626
|
var u = require_universalify().fromPromise;
|
|
10627
|
-
var
|
|
10628
|
-
function pathExists(
|
|
10629
|
-
return
|
|
10627
|
+
var fs11 = require_fs();
|
|
10628
|
+
function pathExists(path13) {
|
|
10629
|
+
return fs11.access(path13).then(() => true).catch(() => false);
|
|
10630
10630
|
}
|
|
10631
10631
|
module.exports = {
|
|
10632
10632
|
pathExists: u(pathExists),
|
|
10633
|
-
pathExistsSync:
|
|
10633
|
+
pathExistsSync: fs11.existsSync
|
|
10634
10634
|
};
|
|
10635
10635
|
}
|
|
10636
10636
|
});
|
|
@@ -10640,16 +10640,16 @@ var require_utimes = __commonJS({
|
|
|
10640
10640
|
"../../node_modules/fs-extra/lib/util/utimes.js"(exports, module) {
|
|
10641
10641
|
"use strict";
|
|
10642
10642
|
init_esm_shims();
|
|
10643
|
-
var
|
|
10643
|
+
var fs11 = require_fs();
|
|
10644
10644
|
var u = require_universalify().fromPromise;
|
|
10645
|
-
async function utimesMillis(
|
|
10646
|
-
const fd = await
|
|
10645
|
+
async function utimesMillis(path13, atime, mtime) {
|
|
10646
|
+
const fd = await fs11.open(path13, "r+");
|
|
10647
10647
|
let closeErr = null;
|
|
10648
10648
|
try {
|
|
10649
|
-
await
|
|
10649
|
+
await fs11.futimes(fd, atime, mtime);
|
|
10650
10650
|
} finally {
|
|
10651
10651
|
try {
|
|
10652
|
-
await
|
|
10652
|
+
await fs11.close(fd);
|
|
10653
10653
|
} catch (e) {
|
|
10654
10654
|
closeErr = e;
|
|
10655
10655
|
}
|
|
@@ -10658,10 +10658,10 @@ var require_utimes = __commonJS({
|
|
|
10658
10658
|
throw closeErr;
|
|
10659
10659
|
}
|
|
10660
10660
|
}
|
|
10661
|
-
function utimesMillisSync(
|
|
10662
|
-
const fd =
|
|
10663
|
-
|
|
10664
|
-
return
|
|
10661
|
+
function utimesMillisSync(path13, atime, mtime) {
|
|
10662
|
+
const fd = fs11.openSync(path13, "r+");
|
|
10663
|
+
fs11.futimesSync(fd, atime, mtime);
|
|
10664
|
+
return fs11.closeSync(fd);
|
|
10665
10665
|
}
|
|
10666
10666
|
module.exports = {
|
|
10667
10667
|
utimesMillis: u(utimesMillis),
|
|
@@ -10675,11 +10675,11 @@ var require_stat = __commonJS({
|
|
|
10675
10675
|
"../../node_modules/fs-extra/lib/util/stat.js"(exports, module) {
|
|
10676
10676
|
"use strict";
|
|
10677
10677
|
init_esm_shims();
|
|
10678
|
-
var
|
|
10679
|
-
var
|
|
10678
|
+
var fs11 = require_fs();
|
|
10679
|
+
var path13 = __require("path");
|
|
10680
10680
|
var u = require_universalify().fromPromise;
|
|
10681
10681
|
function getStats(src, dest, opts) {
|
|
10682
|
-
const statFunc = opts.dereference ? (file) =>
|
|
10682
|
+
const statFunc = opts.dereference ? (file) => fs11.stat(file, { bigint: true }) : (file) => fs11.lstat(file, { bigint: true });
|
|
10683
10683
|
return Promise.all([
|
|
10684
10684
|
statFunc(src),
|
|
10685
10685
|
statFunc(dest).catch((err) => {
|
|
@@ -10690,7 +10690,7 @@ var require_stat = __commonJS({
|
|
|
10690
10690
|
}
|
|
10691
10691
|
function getStatsSync(src, dest, opts) {
|
|
10692
10692
|
let destStat;
|
|
10693
|
-
const statFunc = opts.dereference ? (file) =>
|
|
10693
|
+
const statFunc = opts.dereference ? (file) => fs11.statSync(file, { bigint: true }) : (file) => fs11.lstatSync(file, { bigint: true });
|
|
10694
10694
|
const srcStat = statFunc(src);
|
|
10695
10695
|
try {
|
|
10696
10696
|
destStat = statFunc(dest);
|
|
@@ -10704,8 +10704,8 @@ var require_stat = __commonJS({
|
|
|
10704
10704
|
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
10705
10705
|
if (destStat) {
|
|
10706
10706
|
if (areIdentical(srcStat, destStat)) {
|
|
10707
|
-
const srcBaseName =
|
|
10708
|
-
const destBaseName =
|
|
10707
|
+
const srcBaseName = path13.basename(src);
|
|
10708
|
+
const destBaseName = path13.basename(dest);
|
|
10709
10709
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
10710
10710
|
return { srcStat, destStat, isChangingCase: true };
|
|
10711
10711
|
}
|
|
@@ -10727,8 +10727,8 @@ var require_stat = __commonJS({
|
|
|
10727
10727
|
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
10728
10728
|
if (destStat) {
|
|
10729
10729
|
if (areIdentical(srcStat, destStat)) {
|
|
10730
|
-
const srcBaseName =
|
|
10731
|
-
const destBaseName =
|
|
10730
|
+
const srcBaseName = path13.basename(src);
|
|
10731
|
+
const destBaseName = path13.basename(dest);
|
|
10732
10732
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
10733
10733
|
return { srcStat, destStat, isChangingCase: true };
|
|
10734
10734
|
}
|
|
@@ -10747,12 +10747,12 @@ var require_stat = __commonJS({
|
|
|
10747
10747
|
return { srcStat, destStat };
|
|
10748
10748
|
}
|
|
10749
10749
|
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
10750
|
-
const srcParent =
|
|
10751
|
-
const destParent =
|
|
10752
|
-
if (destParent === srcParent || destParent ===
|
|
10750
|
+
const srcParent = path13.resolve(path13.dirname(src));
|
|
10751
|
+
const destParent = path13.resolve(path13.dirname(dest));
|
|
10752
|
+
if (destParent === srcParent || destParent === path13.parse(destParent).root) return;
|
|
10753
10753
|
let destStat;
|
|
10754
10754
|
try {
|
|
10755
|
-
destStat = await
|
|
10755
|
+
destStat = await fs11.stat(destParent, { bigint: true });
|
|
10756
10756
|
} catch (err) {
|
|
10757
10757
|
if (err.code === "ENOENT") return;
|
|
10758
10758
|
throw err;
|
|
@@ -10763,12 +10763,12 @@ var require_stat = __commonJS({
|
|
|
10763
10763
|
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
10764
10764
|
}
|
|
10765
10765
|
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
10766
|
-
const srcParent =
|
|
10767
|
-
const destParent =
|
|
10768
|
-
if (destParent === srcParent || destParent ===
|
|
10766
|
+
const srcParent = path13.resolve(path13.dirname(src));
|
|
10767
|
+
const destParent = path13.resolve(path13.dirname(dest));
|
|
10768
|
+
if (destParent === srcParent || destParent === path13.parse(destParent).root) return;
|
|
10769
10769
|
let destStat;
|
|
10770
10770
|
try {
|
|
10771
|
-
destStat =
|
|
10771
|
+
destStat = fs11.statSync(destParent, { bigint: true });
|
|
10772
10772
|
} catch (err) {
|
|
10773
10773
|
if (err.code === "ENOENT") return;
|
|
10774
10774
|
throw err;
|
|
@@ -10782,8 +10782,8 @@ var require_stat = __commonJS({
|
|
|
10782
10782
|
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
10783
10783
|
}
|
|
10784
10784
|
function isSrcSubdir(src, dest) {
|
|
10785
|
-
const srcArr =
|
|
10786
|
-
const destArr =
|
|
10785
|
+
const srcArr = path13.resolve(src).split(path13.sep).filter((i) => i);
|
|
10786
|
+
const destArr = path13.resolve(dest).split(path13.sep).filter((i) => i);
|
|
10787
10787
|
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
10788
10788
|
}
|
|
10789
10789
|
function errMsg(src, dest, funcName) {
|
|
@@ -10837,8 +10837,8 @@ var require_copy = __commonJS({
|
|
|
10837
10837
|
"../../node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
|
|
10838
10838
|
"use strict";
|
|
10839
10839
|
init_esm_shims();
|
|
10840
|
-
var
|
|
10841
|
-
var
|
|
10840
|
+
var fs11 = require_fs();
|
|
10841
|
+
var path13 = __require("path");
|
|
10842
10842
|
var { mkdirs } = require_mkdirs();
|
|
10843
10843
|
var { pathExists } = require_path_exists();
|
|
10844
10844
|
var { utimesMillis } = require_utimes();
|
|
@@ -10861,7 +10861,7 @@ var require_copy = __commonJS({
|
|
|
10861
10861
|
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
10862
10862
|
const include = await runFilter(src, dest, opts);
|
|
10863
10863
|
if (!include) return;
|
|
10864
|
-
const destParent =
|
|
10864
|
+
const destParent = path13.dirname(dest);
|
|
10865
10865
|
const dirExists = await pathExists(destParent);
|
|
10866
10866
|
if (!dirExists) {
|
|
10867
10867
|
await mkdirs(destParent);
|
|
@@ -10873,7 +10873,7 @@ var require_copy = __commonJS({
|
|
|
10873
10873
|
return opts.filter(src, dest);
|
|
10874
10874
|
}
|
|
10875
10875
|
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
10876
|
-
const statFn = opts.dereference ?
|
|
10876
|
+
const statFn = opts.dereference ? fs11.stat : fs11.lstat;
|
|
10877
10877
|
const srcStat = await statFn(src);
|
|
10878
10878
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
10879
10879
|
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -10885,7 +10885,7 @@ var require_copy = __commonJS({
|
|
|
10885
10885
|
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
10886
10886
|
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
10887
10887
|
if (opts.overwrite) {
|
|
10888
|
-
await
|
|
10888
|
+
await fs11.unlink(dest);
|
|
10889
10889
|
return copyFile(srcStat, src, dest, opts);
|
|
10890
10890
|
}
|
|
10891
10891
|
if (opts.errorOnExist) {
|
|
@@ -10893,29 +10893,29 @@ var require_copy = __commonJS({
|
|
|
10893
10893
|
}
|
|
10894
10894
|
}
|
|
10895
10895
|
async function copyFile(srcStat, src, dest, opts) {
|
|
10896
|
-
await
|
|
10896
|
+
await fs11.copyFile(src, dest);
|
|
10897
10897
|
if (opts.preserveTimestamps) {
|
|
10898
10898
|
if (fileIsNotWritable(srcStat.mode)) {
|
|
10899
10899
|
await makeFileWritable(dest, srcStat.mode);
|
|
10900
10900
|
}
|
|
10901
|
-
const updatedSrcStat = await
|
|
10901
|
+
const updatedSrcStat = await fs11.stat(src);
|
|
10902
10902
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
10903
10903
|
}
|
|
10904
|
-
return
|
|
10904
|
+
return fs11.chmod(dest, srcStat.mode);
|
|
10905
10905
|
}
|
|
10906
10906
|
function fileIsNotWritable(srcMode) {
|
|
10907
10907
|
return (srcMode & 128) === 0;
|
|
10908
10908
|
}
|
|
10909
10909
|
function makeFileWritable(dest, srcMode) {
|
|
10910
|
-
return
|
|
10910
|
+
return fs11.chmod(dest, srcMode | 128);
|
|
10911
10911
|
}
|
|
10912
10912
|
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
10913
10913
|
if (!destStat) {
|
|
10914
|
-
await
|
|
10914
|
+
await fs11.mkdir(dest);
|
|
10915
10915
|
}
|
|
10916
|
-
await asyncIteratorConcurrentProcess(await
|
|
10917
|
-
const srcItem =
|
|
10918
|
-
const destItem =
|
|
10916
|
+
await asyncIteratorConcurrentProcess(await fs11.opendir(src), async (item) => {
|
|
10917
|
+
const srcItem = path13.join(src, item.name);
|
|
10918
|
+
const destItem = path13.join(dest, item.name);
|
|
10919
10919
|
const include = await runFilter(srcItem, destItem, opts);
|
|
10920
10920
|
if (include) {
|
|
10921
10921
|
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
@@ -10923,26 +10923,26 @@ var require_copy = __commonJS({
|
|
|
10923
10923
|
}
|
|
10924
10924
|
});
|
|
10925
10925
|
if (!destStat) {
|
|
10926
|
-
await
|
|
10926
|
+
await fs11.chmod(dest, srcStat.mode);
|
|
10927
10927
|
}
|
|
10928
10928
|
}
|
|
10929
10929
|
async function onLink(destStat, src, dest, opts) {
|
|
10930
|
-
let resolvedSrc = await
|
|
10930
|
+
let resolvedSrc = await fs11.readlink(src);
|
|
10931
10931
|
if (opts.dereference) {
|
|
10932
|
-
resolvedSrc =
|
|
10932
|
+
resolvedSrc = path13.resolve(process.cwd(), resolvedSrc);
|
|
10933
10933
|
}
|
|
10934
10934
|
if (!destStat) {
|
|
10935
|
-
return
|
|
10935
|
+
return fs11.symlink(resolvedSrc, dest);
|
|
10936
10936
|
}
|
|
10937
10937
|
let resolvedDest = null;
|
|
10938
10938
|
try {
|
|
10939
|
-
resolvedDest = await
|
|
10939
|
+
resolvedDest = await fs11.readlink(dest);
|
|
10940
10940
|
} catch (e) {
|
|
10941
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return
|
|
10941
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs11.symlink(resolvedSrc, dest);
|
|
10942
10942
|
throw e;
|
|
10943
10943
|
}
|
|
10944
10944
|
if (opts.dereference) {
|
|
10945
|
-
resolvedDest =
|
|
10945
|
+
resolvedDest = path13.resolve(process.cwd(), resolvedDest);
|
|
10946
10946
|
}
|
|
10947
10947
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
10948
10948
|
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
@@ -10950,8 +10950,8 @@ var require_copy = __commonJS({
|
|
|
10950
10950
|
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
10951
10951
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
10952
10952
|
}
|
|
10953
|
-
await
|
|
10954
|
-
return
|
|
10953
|
+
await fs11.unlink(dest);
|
|
10954
|
+
return fs11.symlink(resolvedSrc, dest);
|
|
10955
10955
|
}
|
|
10956
10956
|
module.exports = copy;
|
|
10957
10957
|
}
|
|
@@ -10962,8 +10962,8 @@ var require_copy_sync = __commonJS({
|
|
|
10962
10962
|
"../../node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
|
|
10963
10963
|
"use strict";
|
|
10964
10964
|
init_esm_shims();
|
|
10965
|
-
var
|
|
10966
|
-
var
|
|
10965
|
+
var fs11 = require_graceful_fs();
|
|
10966
|
+
var path13 = __require("path");
|
|
10967
10967
|
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
10968
10968
|
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
10969
10969
|
var stat = require_stat();
|
|
@@ -10984,12 +10984,12 @@ var require_copy_sync = __commonJS({
|
|
|
10984
10984
|
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
10985
10985
|
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
10986
10986
|
if (opts.filter && !opts.filter(src, dest)) return;
|
|
10987
|
-
const destParent =
|
|
10988
|
-
if (!
|
|
10987
|
+
const destParent = path13.dirname(dest);
|
|
10988
|
+
if (!fs11.existsSync(destParent)) mkdirsSync(destParent);
|
|
10989
10989
|
return getStats(destStat, src, dest, opts);
|
|
10990
10990
|
}
|
|
10991
10991
|
function getStats(destStat, src, dest, opts) {
|
|
10992
|
-
const statSync = opts.dereference ?
|
|
10992
|
+
const statSync = opts.dereference ? fs11.statSync : fs11.lstatSync;
|
|
10993
10993
|
const srcStat = statSync(src);
|
|
10994
10994
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
10995
10995
|
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -11004,14 +11004,14 @@ var require_copy_sync = __commonJS({
|
|
|
11004
11004
|
}
|
|
11005
11005
|
function mayCopyFile(srcStat, src, dest, opts) {
|
|
11006
11006
|
if (opts.overwrite) {
|
|
11007
|
-
|
|
11007
|
+
fs11.unlinkSync(dest);
|
|
11008
11008
|
return copyFile(srcStat, src, dest, opts);
|
|
11009
11009
|
} else if (opts.errorOnExist) {
|
|
11010
11010
|
throw new Error(`'${dest}' already exists`);
|
|
11011
11011
|
}
|
|
11012
11012
|
}
|
|
11013
11013
|
function copyFile(srcStat, src, dest, opts) {
|
|
11014
|
-
|
|
11014
|
+
fs11.copyFileSync(src, dest);
|
|
11015
11015
|
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
11016
11016
|
return setDestMode(dest, srcStat.mode);
|
|
11017
11017
|
}
|
|
@@ -11026,10 +11026,10 @@ var require_copy_sync = __commonJS({
|
|
|
11026
11026
|
return setDestMode(dest, srcMode | 128);
|
|
11027
11027
|
}
|
|
11028
11028
|
function setDestMode(dest, srcMode) {
|
|
11029
|
-
return
|
|
11029
|
+
return fs11.chmodSync(dest, srcMode);
|
|
11030
11030
|
}
|
|
11031
11031
|
function setDestTimestamps(src, dest) {
|
|
11032
|
-
const updatedSrcStat =
|
|
11032
|
+
const updatedSrcStat = fs11.statSync(src);
|
|
11033
11033
|
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
11034
11034
|
}
|
|
11035
11035
|
function onDir(srcStat, destStat, src, dest, opts) {
|
|
@@ -11037,12 +11037,12 @@ var require_copy_sync = __commonJS({
|
|
|
11037
11037
|
return copyDir(src, dest, opts);
|
|
11038
11038
|
}
|
|
11039
11039
|
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
11040
|
-
|
|
11040
|
+
fs11.mkdirSync(dest);
|
|
11041
11041
|
copyDir(src, dest, opts);
|
|
11042
11042
|
return setDestMode(dest, srcMode);
|
|
11043
11043
|
}
|
|
11044
11044
|
function copyDir(src, dest, opts) {
|
|
11045
|
-
const dir =
|
|
11045
|
+
const dir = fs11.opendirSync(src);
|
|
11046
11046
|
try {
|
|
11047
11047
|
let dirent;
|
|
11048
11048
|
while ((dirent = dir.readSync()) !== null) {
|
|
@@ -11053,29 +11053,29 @@ var require_copy_sync = __commonJS({
|
|
|
11053
11053
|
}
|
|
11054
11054
|
}
|
|
11055
11055
|
function copyDirItem(item, src, dest, opts) {
|
|
11056
|
-
const srcItem =
|
|
11057
|
-
const destItem =
|
|
11056
|
+
const srcItem = path13.join(src, item);
|
|
11057
|
+
const destItem = path13.join(dest, item);
|
|
11058
11058
|
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
11059
11059
|
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
11060
11060
|
return getStats(destStat, srcItem, destItem, opts);
|
|
11061
11061
|
}
|
|
11062
11062
|
function onLink(destStat, src, dest, opts) {
|
|
11063
|
-
let resolvedSrc =
|
|
11063
|
+
let resolvedSrc = fs11.readlinkSync(src);
|
|
11064
11064
|
if (opts.dereference) {
|
|
11065
|
-
resolvedSrc =
|
|
11065
|
+
resolvedSrc = path13.resolve(process.cwd(), resolvedSrc);
|
|
11066
11066
|
}
|
|
11067
11067
|
if (!destStat) {
|
|
11068
|
-
return
|
|
11068
|
+
return fs11.symlinkSync(resolvedSrc, dest);
|
|
11069
11069
|
} else {
|
|
11070
11070
|
let resolvedDest;
|
|
11071
11071
|
try {
|
|
11072
|
-
resolvedDest =
|
|
11072
|
+
resolvedDest = fs11.readlinkSync(dest);
|
|
11073
11073
|
} catch (err) {
|
|
11074
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return
|
|
11074
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs11.symlinkSync(resolvedSrc, dest);
|
|
11075
11075
|
throw err;
|
|
11076
11076
|
}
|
|
11077
11077
|
if (opts.dereference) {
|
|
11078
|
-
resolvedDest =
|
|
11078
|
+
resolvedDest = path13.resolve(process.cwd(), resolvedDest);
|
|
11079
11079
|
}
|
|
11080
11080
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
11081
11081
|
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
@@ -11087,8 +11087,8 @@ var require_copy_sync = __commonJS({
|
|
|
11087
11087
|
}
|
|
11088
11088
|
}
|
|
11089
11089
|
function copyLink(resolvedSrc, dest) {
|
|
11090
|
-
|
|
11091
|
-
return
|
|
11090
|
+
fs11.unlinkSync(dest);
|
|
11091
|
+
return fs11.symlinkSync(resolvedSrc, dest);
|
|
11092
11092
|
}
|
|
11093
11093
|
module.exports = copySync;
|
|
11094
11094
|
}
|
|
@@ -11112,13 +11112,13 @@ var require_remove = __commonJS({
|
|
|
11112
11112
|
"../../node_modules/fs-extra/lib/remove/index.js"(exports, module) {
|
|
11113
11113
|
"use strict";
|
|
11114
11114
|
init_esm_shims();
|
|
11115
|
-
var
|
|
11115
|
+
var fs11 = require_graceful_fs();
|
|
11116
11116
|
var u = require_universalify().fromCallback;
|
|
11117
|
-
function remove(
|
|
11118
|
-
|
|
11117
|
+
function remove(path13, callback) {
|
|
11118
|
+
fs11.rm(path13, { recursive: true, force: true }, callback);
|
|
11119
11119
|
}
|
|
11120
|
-
function removeSync(
|
|
11121
|
-
|
|
11120
|
+
function removeSync(path13) {
|
|
11121
|
+
fs11.rmSync(path13, { recursive: true, force: true });
|
|
11122
11122
|
}
|
|
11123
11123
|
module.exports = {
|
|
11124
11124
|
remove: u(remove),
|
|
@@ -11133,28 +11133,28 @@ var require_empty = __commonJS({
|
|
|
11133
11133
|
"use strict";
|
|
11134
11134
|
init_esm_shims();
|
|
11135
11135
|
var u = require_universalify().fromPromise;
|
|
11136
|
-
var
|
|
11137
|
-
var
|
|
11136
|
+
var fs11 = require_fs();
|
|
11137
|
+
var path13 = __require("path");
|
|
11138
11138
|
var mkdir = require_mkdirs();
|
|
11139
11139
|
var remove = require_remove();
|
|
11140
11140
|
var emptyDir = u(async function emptyDir2(dir) {
|
|
11141
11141
|
let items;
|
|
11142
11142
|
try {
|
|
11143
|
-
items = await
|
|
11143
|
+
items = await fs11.readdir(dir);
|
|
11144
11144
|
} catch {
|
|
11145
11145
|
return mkdir.mkdirs(dir);
|
|
11146
11146
|
}
|
|
11147
|
-
return Promise.all(items.map((item) => remove.remove(
|
|
11147
|
+
return Promise.all(items.map((item) => remove.remove(path13.join(dir, item))));
|
|
11148
11148
|
});
|
|
11149
11149
|
function emptyDirSync(dir) {
|
|
11150
11150
|
let items;
|
|
11151
11151
|
try {
|
|
11152
|
-
items =
|
|
11152
|
+
items = fs11.readdirSync(dir);
|
|
11153
11153
|
} catch {
|
|
11154
11154
|
return mkdir.mkdirsSync(dir);
|
|
11155
11155
|
}
|
|
11156
11156
|
items.forEach((item) => {
|
|
11157
|
-
item =
|
|
11157
|
+
item = path13.join(dir, item);
|
|
11158
11158
|
remove.removeSync(item);
|
|
11159
11159
|
});
|
|
11160
11160
|
}
|
|
@@ -11173,52 +11173,52 @@ var require_file = __commonJS({
|
|
|
11173
11173
|
"use strict";
|
|
11174
11174
|
init_esm_shims();
|
|
11175
11175
|
var u = require_universalify().fromPromise;
|
|
11176
|
-
var
|
|
11177
|
-
var
|
|
11176
|
+
var path13 = __require("path");
|
|
11177
|
+
var fs11 = require_fs();
|
|
11178
11178
|
var mkdir = require_mkdirs();
|
|
11179
11179
|
async function createFile(file) {
|
|
11180
11180
|
let stats;
|
|
11181
11181
|
try {
|
|
11182
|
-
stats = await
|
|
11182
|
+
stats = await fs11.stat(file);
|
|
11183
11183
|
} catch {
|
|
11184
11184
|
}
|
|
11185
11185
|
if (stats && stats.isFile()) return;
|
|
11186
|
-
const dir =
|
|
11186
|
+
const dir = path13.dirname(file);
|
|
11187
11187
|
let dirStats = null;
|
|
11188
11188
|
try {
|
|
11189
|
-
dirStats = await
|
|
11189
|
+
dirStats = await fs11.stat(dir);
|
|
11190
11190
|
} catch (err) {
|
|
11191
11191
|
if (err.code === "ENOENT") {
|
|
11192
11192
|
await mkdir.mkdirs(dir);
|
|
11193
|
-
await
|
|
11193
|
+
await fs11.writeFile(file, "");
|
|
11194
11194
|
return;
|
|
11195
11195
|
} else {
|
|
11196
11196
|
throw err;
|
|
11197
11197
|
}
|
|
11198
11198
|
}
|
|
11199
11199
|
if (dirStats.isDirectory()) {
|
|
11200
|
-
await
|
|
11200
|
+
await fs11.writeFile(file, "");
|
|
11201
11201
|
} else {
|
|
11202
|
-
await
|
|
11202
|
+
await fs11.readdir(dir);
|
|
11203
11203
|
}
|
|
11204
11204
|
}
|
|
11205
11205
|
function createFileSync(file) {
|
|
11206
11206
|
let stats;
|
|
11207
11207
|
try {
|
|
11208
|
-
stats =
|
|
11208
|
+
stats = fs11.statSync(file);
|
|
11209
11209
|
} catch {
|
|
11210
11210
|
}
|
|
11211
11211
|
if (stats && stats.isFile()) return;
|
|
11212
|
-
const dir =
|
|
11212
|
+
const dir = path13.dirname(file);
|
|
11213
11213
|
try {
|
|
11214
|
-
if (!
|
|
11215
|
-
|
|
11214
|
+
if (!fs11.statSync(dir).isDirectory()) {
|
|
11215
|
+
fs11.readdirSync(dir);
|
|
11216
11216
|
}
|
|
11217
11217
|
} catch (err) {
|
|
11218
11218
|
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
|
|
11219
11219
|
else throw err;
|
|
11220
11220
|
}
|
|
11221
|
-
|
|
11221
|
+
fs11.writeFileSync(file, "");
|
|
11222
11222
|
}
|
|
11223
11223
|
module.exports = {
|
|
11224
11224
|
createFile: u(createFile),
|
|
@@ -11233,50 +11233,50 @@ var require_link = __commonJS({
|
|
|
11233
11233
|
"use strict";
|
|
11234
11234
|
init_esm_shims();
|
|
11235
11235
|
var u = require_universalify().fromPromise;
|
|
11236
|
-
var
|
|
11237
|
-
var
|
|
11236
|
+
var path13 = __require("path");
|
|
11237
|
+
var fs11 = require_fs();
|
|
11238
11238
|
var mkdir = require_mkdirs();
|
|
11239
11239
|
var { pathExists } = require_path_exists();
|
|
11240
11240
|
var { areIdentical } = require_stat();
|
|
11241
11241
|
async function createLink(srcpath, dstpath) {
|
|
11242
11242
|
let dstStat;
|
|
11243
11243
|
try {
|
|
11244
|
-
dstStat = await
|
|
11244
|
+
dstStat = await fs11.lstat(dstpath);
|
|
11245
11245
|
} catch {
|
|
11246
11246
|
}
|
|
11247
11247
|
let srcStat;
|
|
11248
11248
|
try {
|
|
11249
|
-
srcStat = await
|
|
11249
|
+
srcStat = await fs11.lstat(srcpath);
|
|
11250
11250
|
} catch (err) {
|
|
11251
11251
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
11252
11252
|
throw err;
|
|
11253
11253
|
}
|
|
11254
11254
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
11255
|
-
const dir =
|
|
11255
|
+
const dir = path13.dirname(dstpath);
|
|
11256
11256
|
const dirExists = await pathExists(dir);
|
|
11257
11257
|
if (!dirExists) {
|
|
11258
11258
|
await mkdir.mkdirs(dir);
|
|
11259
11259
|
}
|
|
11260
|
-
await
|
|
11260
|
+
await fs11.link(srcpath, dstpath);
|
|
11261
11261
|
}
|
|
11262
11262
|
function createLinkSync(srcpath, dstpath) {
|
|
11263
11263
|
let dstStat;
|
|
11264
11264
|
try {
|
|
11265
|
-
dstStat =
|
|
11265
|
+
dstStat = fs11.lstatSync(dstpath);
|
|
11266
11266
|
} catch {
|
|
11267
11267
|
}
|
|
11268
11268
|
try {
|
|
11269
|
-
const srcStat =
|
|
11269
|
+
const srcStat = fs11.lstatSync(srcpath);
|
|
11270
11270
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
11271
11271
|
} catch (err) {
|
|
11272
11272
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
11273
11273
|
throw err;
|
|
11274
11274
|
}
|
|
11275
|
-
const dir =
|
|
11276
|
-
const dirExists =
|
|
11277
|
-
if (dirExists) return
|
|
11275
|
+
const dir = path13.dirname(dstpath);
|
|
11276
|
+
const dirExists = fs11.existsSync(dir);
|
|
11277
|
+
if (dirExists) return fs11.linkSync(srcpath, dstpath);
|
|
11278
11278
|
mkdir.mkdirsSync(dir);
|
|
11279
|
-
return
|
|
11279
|
+
return fs11.linkSync(srcpath, dstpath);
|
|
11280
11280
|
}
|
|
11281
11281
|
module.exports = {
|
|
11282
11282
|
createLink: u(createLink),
|
|
@@ -11290,14 +11290,14 @@ var require_symlink_paths = __commonJS({
|
|
|
11290
11290
|
"../../node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
|
|
11291
11291
|
"use strict";
|
|
11292
11292
|
init_esm_shims();
|
|
11293
|
-
var
|
|
11294
|
-
var
|
|
11293
|
+
var path13 = __require("path");
|
|
11294
|
+
var fs11 = require_fs();
|
|
11295
11295
|
var { pathExists } = require_path_exists();
|
|
11296
11296
|
var u = require_universalify().fromPromise;
|
|
11297
11297
|
async function symlinkPaths(srcpath, dstpath) {
|
|
11298
|
-
if (
|
|
11298
|
+
if (path13.isAbsolute(srcpath)) {
|
|
11299
11299
|
try {
|
|
11300
|
-
await
|
|
11300
|
+
await fs11.lstat(srcpath);
|
|
11301
11301
|
} catch (err) {
|
|
11302
11302
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
11303
11303
|
throw err;
|
|
@@ -11307,8 +11307,8 @@ var require_symlink_paths = __commonJS({
|
|
|
11307
11307
|
toDst: srcpath
|
|
11308
11308
|
};
|
|
11309
11309
|
}
|
|
11310
|
-
const dstdir =
|
|
11311
|
-
const relativeToDst =
|
|
11310
|
+
const dstdir = path13.dirname(dstpath);
|
|
11311
|
+
const relativeToDst = path13.join(dstdir, srcpath);
|
|
11312
11312
|
const exists = await pathExists(relativeToDst);
|
|
11313
11313
|
if (exists) {
|
|
11314
11314
|
return {
|
|
@@ -11317,39 +11317,39 @@ var require_symlink_paths = __commonJS({
|
|
|
11317
11317
|
};
|
|
11318
11318
|
}
|
|
11319
11319
|
try {
|
|
11320
|
-
await
|
|
11320
|
+
await fs11.lstat(srcpath);
|
|
11321
11321
|
} catch (err) {
|
|
11322
11322
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
11323
11323
|
throw err;
|
|
11324
11324
|
}
|
|
11325
11325
|
return {
|
|
11326
11326
|
toCwd: srcpath,
|
|
11327
|
-
toDst:
|
|
11327
|
+
toDst: path13.relative(dstdir, srcpath)
|
|
11328
11328
|
};
|
|
11329
11329
|
}
|
|
11330
11330
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
11331
|
-
if (
|
|
11332
|
-
const exists2 =
|
|
11331
|
+
if (path13.isAbsolute(srcpath)) {
|
|
11332
|
+
const exists2 = fs11.existsSync(srcpath);
|
|
11333
11333
|
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
11334
11334
|
return {
|
|
11335
11335
|
toCwd: srcpath,
|
|
11336
11336
|
toDst: srcpath
|
|
11337
11337
|
};
|
|
11338
11338
|
}
|
|
11339
|
-
const dstdir =
|
|
11340
|
-
const relativeToDst =
|
|
11341
|
-
const exists =
|
|
11339
|
+
const dstdir = path13.dirname(dstpath);
|
|
11340
|
+
const relativeToDst = path13.join(dstdir, srcpath);
|
|
11341
|
+
const exists = fs11.existsSync(relativeToDst);
|
|
11342
11342
|
if (exists) {
|
|
11343
11343
|
return {
|
|
11344
11344
|
toCwd: relativeToDst,
|
|
11345
11345
|
toDst: srcpath
|
|
11346
11346
|
};
|
|
11347
11347
|
}
|
|
11348
|
-
const srcExists =
|
|
11348
|
+
const srcExists = fs11.existsSync(srcpath);
|
|
11349
11349
|
if (!srcExists) throw new Error("relative srcpath does not exist");
|
|
11350
11350
|
return {
|
|
11351
11351
|
toCwd: srcpath,
|
|
11352
|
-
toDst:
|
|
11352
|
+
toDst: path13.relative(dstdir, srcpath)
|
|
11353
11353
|
};
|
|
11354
11354
|
}
|
|
11355
11355
|
module.exports = {
|
|
@@ -11364,13 +11364,13 @@ var require_symlink_type = __commonJS({
|
|
|
11364
11364
|
"../../node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module) {
|
|
11365
11365
|
"use strict";
|
|
11366
11366
|
init_esm_shims();
|
|
11367
|
-
var
|
|
11367
|
+
var fs11 = require_fs();
|
|
11368
11368
|
var u = require_universalify().fromPromise;
|
|
11369
11369
|
async function symlinkType(srcpath, type) {
|
|
11370
11370
|
if (type) return type;
|
|
11371
11371
|
let stats;
|
|
11372
11372
|
try {
|
|
11373
|
-
stats = await
|
|
11373
|
+
stats = await fs11.lstat(srcpath);
|
|
11374
11374
|
} catch {
|
|
11375
11375
|
return "file";
|
|
11376
11376
|
}
|
|
@@ -11380,7 +11380,7 @@ var require_symlink_type = __commonJS({
|
|
|
11380
11380
|
if (type) return type;
|
|
11381
11381
|
let stats;
|
|
11382
11382
|
try {
|
|
11383
|
-
stats =
|
|
11383
|
+
stats = fs11.lstatSync(srcpath);
|
|
11384
11384
|
} catch {
|
|
11385
11385
|
return "file";
|
|
11386
11386
|
}
|
|
@@ -11399,8 +11399,8 @@ var require_symlink = __commonJS({
|
|
|
11399
11399
|
"use strict";
|
|
11400
11400
|
init_esm_shims();
|
|
11401
11401
|
var u = require_universalify().fromPromise;
|
|
11402
|
-
var
|
|
11403
|
-
var
|
|
11402
|
+
var path13 = __require("path");
|
|
11403
|
+
var fs11 = require_fs();
|
|
11404
11404
|
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
11405
11405
|
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
11406
11406
|
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
@@ -11409,44 +11409,44 @@ var require_symlink = __commonJS({
|
|
|
11409
11409
|
async function createSymlink(srcpath, dstpath, type) {
|
|
11410
11410
|
let stats;
|
|
11411
11411
|
try {
|
|
11412
|
-
stats = await
|
|
11412
|
+
stats = await fs11.lstat(dstpath);
|
|
11413
11413
|
} catch {
|
|
11414
11414
|
}
|
|
11415
11415
|
if (stats && stats.isSymbolicLink()) {
|
|
11416
11416
|
const [srcStat, dstStat] = await Promise.all([
|
|
11417
|
-
|
|
11418
|
-
|
|
11417
|
+
fs11.stat(srcpath),
|
|
11418
|
+
fs11.stat(dstpath)
|
|
11419
11419
|
]);
|
|
11420
11420
|
if (areIdentical(srcStat, dstStat)) return;
|
|
11421
11421
|
}
|
|
11422
11422
|
const relative = await symlinkPaths(srcpath, dstpath);
|
|
11423
11423
|
srcpath = relative.toDst;
|
|
11424
11424
|
const toType = await symlinkType(relative.toCwd, type);
|
|
11425
|
-
const dir =
|
|
11425
|
+
const dir = path13.dirname(dstpath);
|
|
11426
11426
|
if (!await pathExists(dir)) {
|
|
11427
11427
|
await mkdirs(dir);
|
|
11428
11428
|
}
|
|
11429
|
-
return
|
|
11429
|
+
return fs11.symlink(srcpath, dstpath, toType);
|
|
11430
11430
|
}
|
|
11431
11431
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
11432
11432
|
let stats;
|
|
11433
11433
|
try {
|
|
11434
|
-
stats =
|
|
11434
|
+
stats = fs11.lstatSync(dstpath);
|
|
11435
11435
|
} catch {
|
|
11436
11436
|
}
|
|
11437
11437
|
if (stats && stats.isSymbolicLink()) {
|
|
11438
|
-
const srcStat =
|
|
11439
|
-
const dstStat =
|
|
11438
|
+
const srcStat = fs11.statSync(srcpath);
|
|
11439
|
+
const dstStat = fs11.statSync(dstpath);
|
|
11440
11440
|
if (areIdentical(srcStat, dstStat)) return;
|
|
11441
11441
|
}
|
|
11442
11442
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
11443
11443
|
srcpath = relative.toDst;
|
|
11444
11444
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
11445
|
-
const dir =
|
|
11446
|
-
const exists =
|
|
11447
|
-
if (exists) return
|
|
11445
|
+
const dir = path13.dirname(dstpath);
|
|
11446
|
+
const exists = fs11.existsSync(dir);
|
|
11447
|
+
if (exists) return fs11.symlinkSync(srcpath, dstpath, type);
|
|
11448
11448
|
mkdirsSync(dir);
|
|
11449
|
-
return
|
|
11449
|
+
return fs11.symlinkSync(srcpath, dstpath, type);
|
|
11450
11450
|
}
|
|
11451
11451
|
module.exports = {
|
|
11452
11452
|
createSymlink: u(createSymlink),
|
|
@@ -11518,9 +11518,9 @@ var require_jsonfile = __commonJS({
|
|
|
11518
11518
|
if (typeof options === "string") {
|
|
11519
11519
|
options = { encoding: options };
|
|
11520
11520
|
}
|
|
11521
|
-
const
|
|
11521
|
+
const fs11 = options.fs || _fs;
|
|
11522
11522
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
11523
|
-
let data = await universalify.fromCallback(
|
|
11523
|
+
let data = await universalify.fromCallback(fs11.readFile)(file, options);
|
|
11524
11524
|
data = stripBom(data);
|
|
11525
11525
|
let obj;
|
|
11526
11526
|
try {
|
|
@@ -11540,10 +11540,10 @@ var require_jsonfile = __commonJS({
|
|
|
11540
11540
|
if (typeof options === "string") {
|
|
11541
11541
|
options = { encoding: options };
|
|
11542
11542
|
}
|
|
11543
|
-
const
|
|
11543
|
+
const fs11 = options.fs || _fs;
|
|
11544
11544
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
11545
11545
|
try {
|
|
11546
|
-
let content =
|
|
11546
|
+
let content = fs11.readFileSync(file, options);
|
|
11547
11547
|
content = stripBom(content);
|
|
11548
11548
|
return JSON.parse(content, options.reviver);
|
|
11549
11549
|
} catch (err) {
|
|
@@ -11556,15 +11556,15 @@ var require_jsonfile = __commonJS({
|
|
|
11556
11556
|
}
|
|
11557
11557
|
}
|
|
11558
11558
|
async function _writeFile(file, obj, options = {}) {
|
|
11559
|
-
const
|
|
11559
|
+
const fs11 = options.fs || _fs;
|
|
11560
11560
|
const str = stringify(obj, options);
|
|
11561
|
-
await universalify.fromCallback(
|
|
11561
|
+
await universalify.fromCallback(fs11.writeFile)(file, str, options);
|
|
11562
11562
|
}
|
|
11563
11563
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
11564
11564
|
function writeFileSync(file, obj, options = {}) {
|
|
11565
|
-
const
|
|
11565
|
+
const fs11 = options.fs || _fs;
|
|
11566
11566
|
const str = stringify(obj, options);
|
|
11567
|
-
return
|
|
11567
|
+
return fs11.writeFileSync(file, str, options);
|
|
11568
11568
|
}
|
|
11569
11569
|
module.exports = {
|
|
11570
11570
|
readFile,
|
|
@@ -11597,23 +11597,23 @@ var require_output_file = __commonJS({
|
|
|
11597
11597
|
"use strict";
|
|
11598
11598
|
init_esm_shims();
|
|
11599
11599
|
var u = require_universalify().fromPromise;
|
|
11600
|
-
var
|
|
11601
|
-
var
|
|
11600
|
+
var fs11 = require_fs();
|
|
11601
|
+
var path13 = __require("path");
|
|
11602
11602
|
var mkdir = require_mkdirs();
|
|
11603
11603
|
var pathExists = require_path_exists().pathExists;
|
|
11604
11604
|
async function outputFile(file, data, encoding = "utf-8") {
|
|
11605
|
-
const dir =
|
|
11605
|
+
const dir = path13.dirname(file);
|
|
11606
11606
|
if (!await pathExists(dir)) {
|
|
11607
11607
|
await mkdir.mkdirs(dir);
|
|
11608
11608
|
}
|
|
11609
|
-
return
|
|
11609
|
+
return fs11.writeFile(file, data, encoding);
|
|
11610
11610
|
}
|
|
11611
11611
|
function outputFileSync(file, ...args) {
|
|
11612
|
-
const dir =
|
|
11613
|
-
if (!
|
|
11612
|
+
const dir = path13.dirname(file);
|
|
11613
|
+
if (!fs11.existsSync(dir)) {
|
|
11614
11614
|
mkdir.mkdirsSync(dir);
|
|
11615
11615
|
}
|
|
11616
|
-
|
|
11616
|
+
fs11.writeFileSync(file, ...args);
|
|
11617
11617
|
}
|
|
11618
11618
|
module.exports = {
|
|
11619
11619
|
outputFile: u(outputFile),
|
|
@@ -11676,8 +11676,8 @@ var require_move = __commonJS({
|
|
|
11676
11676
|
"../../node_modules/fs-extra/lib/move/move.js"(exports, module) {
|
|
11677
11677
|
"use strict";
|
|
11678
11678
|
init_esm_shims();
|
|
11679
|
-
var
|
|
11680
|
-
var
|
|
11679
|
+
var fs11 = require_fs();
|
|
11680
|
+
var path13 = __require("path");
|
|
11681
11681
|
var { copy } = require_copy2();
|
|
11682
11682
|
var { remove } = require_remove();
|
|
11683
11683
|
var { mkdirp } = require_mkdirs();
|
|
@@ -11687,8 +11687,8 @@ var require_move = __commonJS({
|
|
|
11687
11687
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
11688
11688
|
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
11689
11689
|
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
11690
|
-
const destParent =
|
|
11691
|
-
const parsedParentPath =
|
|
11690
|
+
const destParent = path13.dirname(dest);
|
|
11691
|
+
const parsedParentPath = path13.parse(destParent);
|
|
11692
11692
|
if (parsedParentPath.root !== destParent) {
|
|
11693
11693
|
await mkdirp(destParent);
|
|
11694
11694
|
}
|
|
@@ -11703,7 +11703,7 @@ var require_move = __commonJS({
|
|
|
11703
11703
|
}
|
|
11704
11704
|
}
|
|
11705
11705
|
try {
|
|
11706
|
-
await
|
|
11706
|
+
await fs11.rename(src, dest);
|
|
11707
11707
|
} catch (err) {
|
|
11708
11708
|
if (err.code !== "EXDEV") {
|
|
11709
11709
|
throw err;
|
|
@@ -11729,8 +11729,8 @@ var require_move_sync = __commonJS({
|
|
|
11729
11729
|
"../../node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
|
|
11730
11730
|
"use strict";
|
|
11731
11731
|
init_esm_shims();
|
|
11732
|
-
var
|
|
11733
|
-
var
|
|
11732
|
+
var fs11 = require_graceful_fs();
|
|
11733
|
+
var path13 = __require("path");
|
|
11734
11734
|
var copySync = require_copy2().copySync;
|
|
11735
11735
|
var removeSync = require_remove().removeSync;
|
|
11736
11736
|
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
@@ -11740,12 +11740,12 @@ var require_move_sync = __commonJS({
|
|
|
11740
11740
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
11741
11741
|
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
11742
11742
|
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
11743
|
-
if (!isParentRoot(dest)) mkdirpSync(
|
|
11743
|
+
if (!isParentRoot(dest)) mkdirpSync(path13.dirname(dest));
|
|
11744
11744
|
return doRename(src, dest, overwrite, isChangingCase);
|
|
11745
11745
|
}
|
|
11746
11746
|
function isParentRoot(dest) {
|
|
11747
|
-
const parent =
|
|
11748
|
-
const parsedPath =
|
|
11747
|
+
const parent = path13.dirname(dest);
|
|
11748
|
+
const parsedPath = path13.parse(parent);
|
|
11749
11749
|
return parsedPath.root === parent;
|
|
11750
11750
|
}
|
|
11751
11751
|
function doRename(src, dest, overwrite, isChangingCase) {
|
|
@@ -11754,12 +11754,12 @@ var require_move_sync = __commonJS({
|
|
|
11754
11754
|
removeSync(dest);
|
|
11755
11755
|
return rename2(src, dest, overwrite);
|
|
11756
11756
|
}
|
|
11757
|
-
if (
|
|
11757
|
+
if (fs11.existsSync(dest)) throw new Error("dest already exists.");
|
|
11758
11758
|
return rename2(src, dest, overwrite);
|
|
11759
11759
|
}
|
|
11760
11760
|
function rename2(src, dest, overwrite) {
|
|
11761
11761
|
try {
|
|
11762
|
-
|
|
11762
|
+
fs11.renameSync(src, dest);
|
|
11763
11763
|
} catch (err) {
|
|
11764
11764
|
if (err.code !== "EXDEV") throw err;
|
|
11765
11765
|
return moveAcrossDevice(src, dest, overwrite);
|
|
@@ -15226,8 +15226,8 @@ function ora(options) {
|
|
|
15226
15226
|
|
|
15227
15227
|
// src/cli/commands/add.ts
|
|
15228
15228
|
var import_prompts3 = __toESM(require_prompts3(), 1);
|
|
15229
|
-
var
|
|
15230
|
-
import
|
|
15229
|
+
var import_fs_extra10 = __toESM(require_lib2(), 1);
|
|
15230
|
+
import path12 from "path";
|
|
15231
15231
|
|
|
15232
15232
|
// src/cli/registry.ts
|
|
15233
15233
|
init_esm_shims();
|
|
@@ -16358,6 +16358,17 @@ function pathToAlias(input, root) {
|
|
|
16358
16358
|
if (rel.startsWith(`${root}/`)) return `@/${rel.slice(root.length + 1)}`;
|
|
16359
16359
|
return void 0;
|
|
16360
16360
|
}
|
|
16361
|
+
function componentsAliasFromPath(input, root) {
|
|
16362
|
+
const alias = pathToAlias(input, root);
|
|
16363
|
+
if (alias === void 0) return void 0;
|
|
16364
|
+
const parent = alias.replace(/\/ui$/, "");
|
|
16365
|
+
return parent !== alias && parent !== "@" ? parent : alias;
|
|
16366
|
+
}
|
|
16367
|
+
function effectiveComponentsAlias(aliases) {
|
|
16368
|
+
const components = aliases?.components || "@/components";
|
|
16369
|
+
const parent = components.replace(/\/ui$/, "");
|
|
16370
|
+
return aliases?.ui === `${components}/ui` && parent !== components && parent !== "@" ? parent : components;
|
|
16371
|
+
}
|
|
16361
16372
|
function outsideAliasMessage(input, root) {
|
|
16362
16373
|
return `${normalise(input.trim()) || "."} is not inside ${root}/, the folder "@/" points to, so files there can't be imported through "@/". Enter a folder inside ${root}/, such as ${root}/components.`;
|
|
16363
16374
|
}
|
|
@@ -16443,6 +16454,45 @@ function normalise(p) {
|
|
|
16443
16454
|
return clean === "." ? "" : clean.replace(/^\.\//, "");
|
|
16444
16455
|
}
|
|
16445
16456
|
|
|
16457
|
+
// src/cli/tty.ts
|
|
16458
|
+
init_esm_shims();
|
|
16459
|
+
function isInteractive2() {
|
|
16460
|
+
return Boolean(process.stdin.isTTY);
|
|
16461
|
+
}
|
|
16462
|
+
|
|
16463
|
+
// src/cli/init-options.ts
|
|
16464
|
+
init_esm_shims();
|
|
16465
|
+
var STYLE_CHOICES = ["default", "new-york"];
|
|
16466
|
+
function isStyleChoice(value) {
|
|
16467
|
+
return STYLE_CHOICES.includes(value);
|
|
16468
|
+
}
|
|
16469
|
+
function missingInitFlags({ yes, interactive, path: path13, style, theme, needsOverwriteAnswer }) {
|
|
16470
|
+
if (yes || interactive) return [];
|
|
16471
|
+
const missing = [];
|
|
16472
|
+
if (path13 === void 0) missing.push("--path <dir>");
|
|
16473
|
+
if (style === void 0) missing.push("--style <default|new-york>");
|
|
16474
|
+
if (theme === void 0) missing.push("--theme <fasla|brand>");
|
|
16475
|
+
if (needsOverwriteAnswer) missing.push("--yes");
|
|
16476
|
+
return missing;
|
|
16477
|
+
}
|
|
16478
|
+
function nonInteractiveInitMessage(missing) {
|
|
16479
|
+
const flags = missing.includes("--yes") ? missing : [...missing, "or --yes to accept all defaults"];
|
|
16480
|
+
return [
|
|
16481
|
+
"Error: init asks questions, and stdin is not a terminal, so there is nobody to answer.",
|
|
16482
|
+
`Pass ${flags.length === 1 ? "this flag" : "these flags"}: ${flags.join(", ")}.`,
|
|
16483
|
+
"Example: npx @smicolon/fasla-ui@latest init --yes",
|
|
16484
|
+
"Example: npx @smicolon/fasla-ui@latest init --path src/components --style default --theme fasla",
|
|
16485
|
+
"Nothing was written."
|
|
16486
|
+
].join("\n");
|
|
16487
|
+
}
|
|
16488
|
+
function nonInteractiveAddMessage() {
|
|
16489
|
+
return [
|
|
16490
|
+
"Error: add asks for confirmation, and stdin is not a terminal, so there is nobody to answer.",
|
|
16491
|
+
"Pass --yes to confirm: npx @smicolon/fasla-ui@latest add <component> --yes",
|
|
16492
|
+
"Nothing was written."
|
|
16493
|
+
].join("\n");
|
|
16494
|
+
}
|
|
16495
|
+
|
|
16446
16496
|
// src/cli/pm.ts
|
|
16447
16497
|
init_esm_shims();
|
|
16448
16498
|
var import_fs_extra2 = __toESM(require_lib2(), 1);
|
|
@@ -16620,14 +16670,8 @@ function applyThemeItems(cwd, urls, run = spawnRunner) {
|
|
|
16620
16670
|
// src/cli/commands/init.ts
|
|
16621
16671
|
init_esm_shims();
|
|
16622
16672
|
var import_prompts2 = __toESM(require_prompts3(), 1);
|
|
16623
|
-
var
|
|
16624
|
-
import
|
|
16625
|
-
|
|
16626
|
-
// src/cli/commands/shared.ts
|
|
16627
|
-
init_esm_shims();
|
|
16628
|
-
var import_prompts = __toESM(require_prompts3(), 1);
|
|
16629
|
-
var import_fs_extra6 = __toESM(require_lib2(), 1);
|
|
16630
|
-
import path8 from "path";
|
|
16673
|
+
var import_fs_extra9 = __toESM(require_lib2(), 1);
|
|
16674
|
+
import path11 from "path";
|
|
16631
16675
|
|
|
16632
16676
|
// src/cli/legacy.ts
|
|
16633
16677
|
init_esm_shims();
|
|
@@ -17151,14 +17195,139 @@ async function sourceFiles(cwd, rel = "") {
|
|
|
17151
17195
|
return out;
|
|
17152
17196
|
}
|
|
17153
17197
|
|
|
17154
|
-
// src/cli/
|
|
17198
|
+
// src/cli/fonts.ts
|
|
17155
17199
|
init_esm_shims();
|
|
17156
17200
|
var import_fs_extra5 = __toESM(require_lib2(), 1);
|
|
17157
17201
|
import path7 from "path";
|
|
17202
|
+
var SYSTEM_FONT_STACKS = {
|
|
17203
|
+
sans: "ui-sans-serif, system-ui, sans-serif",
|
|
17204
|
+
mono: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
17205
|
+
arabic: "system-ui, sans-serif"
|
|
17206
|
+
};
|
|
17207
|
+
function layoutFontVariables(layout) {
|
|
17208
|
+
return [...layout.matchAll(/\bvariable\s*:\s*["'`](--[\w-]+)["'`]/g)].map((m) => m[1]);
|
|
17209
|
+
}
|
|
17210
|
+
function kindOf(name) {
|
|
17211
|
+
const kind = name.replace(/^--font-/, "");
|
|
17212
|
+
return kind === "sans" || kind === "mono" || kind === "arabic" ? kind : void 0;
|
|
17213
|
+
}
|
|
17214
|
+
function projectFontVariable(kind, variables) {
|
|
17215
|
+
const named = variables.filter((v) => v.includes(kind));
|
|
17216
|
+
if (named.length > 0) return named[0];
|
|
17217
|
+
if (kind === "sans") {
|
|
17218
|
+
const rest = variables.filter((v) => !/mono|arabic|cairo|serif|display|heading/.test(v) && v !== "--font-sans");
|
|
17219
|
+
return rest.length === 1 ? rest[0] : void 0;
|
|
17220
|
+
}
|
|
17221
|
+
return void 0;
|
|
17222
|
+
}
|
|
17223
|
+
function fixSelfReferencingFonts(css, layoutVariables) {
|
|
17224
|
+
const fixed = [];
|
|
17225
|
+
const out = css.replace(/(^[ \t]*)(--font-[\w-]+)(\s*:\s*)var\(\s*\2\s*\)(\s*;)/gm, (whole, indent, name, colon, end) => {
|
|
17226
|
+
if (layoutVariables.includes(name)) return whole;
|
|
17227
|
+
const declared = new RegExp(`(?<![\\w-])${name}\\s*:(?!\\s*var\\(\\s*${name}\\s*\\))`);
|
|
17228
|
+
if (declared.test(css)) return whole;
|
|
17229
|
+
const kind = kindOf(name);
|
|
17230
|
+
const own = kind && projectFontVariable(kind, layoutVariables);
|
|
17231
|
+
const to = own ? `var(${own})` : SYSTEM_FONT_STACKS[kind ?? "sans"];
|
|
17232
|
+
fixed.push({ name, to });
|
|
17233
|
+
return `${indent}${name}${colon}${to}${end}`;
|
|
17234
|
+
});
|
|
17235
|
+
return { css: out, fixed };
|
|
17236
|
+
}
|
|
17237
|
+
var LAYOUT_CANDIDATES = [
|
|
17238
|
+
"src/app/layout.tsx",
|
|
17239
|
+
"app/layout.tsx",
|
|
17240
|
+
"src/app/layout.jsx",
|
|
17241
|
+
"app/layout.jsx",
|
|
17242
|
+
"src/app/layout.js",
|
|
17243
|
+
"app/layout.js"
|
|
17244
|
+
];
|
|
17245
|
+
async function findLayout(cwd) {
|
|
17246
|
+
for (const file of LAYOUT_CANDIDATES) {
|
|
17247
|
+
if (await import_fs_extra5.default.pathExists(path7.join(cwd, file))) return file;
|
|
17248
|
+
}
|
|
17249
|
+
return void 0;
|
|
17250
|
+
}
|
|
17251
|
+
async function repairFontVariables(cwd, css) {
|
|
17252
|
+
const cssPath = path7.join(cwd, css);
|
|
17253
|
+
const text = await import_fs_extra5.default.readFile(cssPath, "utf8").catch(() => void 0);
|
|
17254
|
+
if (text === void 0) return [];
|
|
17255
|
+
const layoutFile = await findLayout(cwd);
|
|
17256
|
+
const layout = layoutFile ? await import_fs_extra5.default.readFile(path7.join(cwd, layoutFile), "utf8").catch(() => "") : "";
|
|
17257
|
+
const { css: next, fixed } = fixSelfReferencingFonts(text, layoutFontVariables(layout));
|
|
17258
|
+
if (fixed.length > 0) await import_fs_extra5.default.writeFile(cssPath, next);
|
|
17259
|
+
return fixed;
|
|
17260
|
+
}
|
|
17261
|
+
|
|
17262
|
+
// src/cli/init-summary.ts
|
|
17263
|
+
init_esm_shims();
|
|
17264
|
+
var import_fs_extra6 = __toESM(require_lib2(), 1);
|
|
17265
|
+
import path8 from "path";
|
|
17266
|
+
async function snapshotFiles(cwd, files) {
|
|
17267
|
+
const out = {};
|
|
17268
|
+
for (const file of files) out[file] = await import_fs_extra6.default.readFile(path8.join(cwd, file), "utf8").catch(() => void 0);
|
|
17269
|
+
return out;
|
|
17270
|
+
}
|
|
17271
|
+
function cssValue(css, name) {
|
|
17272
|
+
return new RegExp(`${name}\\s*:\\s*([^;]+);`).exec(css)?.[1]?.trim();
|
|
17273
|
+
}
|
|
17274
|
+
function packageDelta(before, after) {
|
|
17275
|
+
const names = (text) => {
|
|
17276
|
+
try {
|
|
17277
|
+
const pkg = JSON.parse(text ?? "{}");
|
|
17278
|
+
return Object.keys({ ...pkg.dependencies, ...pkg.devDependencies });
|
|
17279
|
+
} catch {
|
|
17280
|
+
return [];
|
|
17281
|
+
}
|
|
17282
|
+
};
|
|
17283
|
+
const had = new Set(names(before));
|
|
17284
|
+
return names(after).filter((name) => !had.has(name));
|
|
17285
|
+
}
|
|
17286
|
+
function describeChanges({ before, after, components, utilsAlias, utils, css, layout, fontFixes, themeCommand: themeCommand2 }) {
|
|
17287
|
+
const lines = [];
|
|
17288
|
+
const status = (file) => before[file] === void 0 ? "created" : before[file] !== after[file] ? "changed" : "unchanged";
|
|
17289
|
+
const row = (kind, file, note) => lines.push(`${kind.padEnd(9)} ${file}${note ? ` \u2014 ${note}` : ""}`);
|
|
17290
|
+
row(status("components.json"), "components.json", `components alias ${components}, utils alias ${utilsAlias}`);
|
|
17291
|
+
const utilsStatus = status(utils);
|
|
17292
|
+
row(utilsStatus, utils, utilsStatus === "unchanged" ? "yours was already there, kept" : "the cn() helper every component imports");
|
|
17293
|
+
const cssBefore = before[css] ?? "";
|
|
17294
|
+
const cssAfter = after[css] ?? "";
|
|
17295
|
+
if (cssBefore !== cssAfter) {
|
|
17296
|
+
const notes = [];
|
|
17297
|
+
const moved = ["--background", "--foreground"].filter((token) => cssValue(cssBefore, token) !== cssValue(cssAfter, token));
|
|
17298
|
+
if (moved.length > 0) notes.push(`${moved.join(" and ")} changed to Fasla's ${moved.length > 1 ? "values" : "value"}`);
|
|
17299
|
+
notes.push("adds Fasla's theme tokens and the Arabic font rule");
|
|
17300
|
+
for (const fix of fontFixes) notes.push(`${fix.name} set to ${fix.to}`);
|
|
17301
|
+
row("changed", css, notes.join("; "));
|
|
17302
|
+
} else if (themeCommand2) {
|
|
17303
|
+
row("unchanged", css, "the theme is not installed yet");
|
|
17304
|
+
}
|
|
17305
|
+
if (layout && (before[layout] ?? "") !== (after[layout] ?? "")) {
|
|
17306
|
+
const text = after[layout] ?? "";
|
|
17307
|
+
const notes = [];
|
|
17308
|
+
if (/\bCairo\b/.test(text) && !/\bCairo\b/.test(before[layout] ?? "")) notes.push("adds the Cairo font");
|
|
17309
|
+
if (/className=\{cn\(/.test(text) && !/className=\{cn\(/.test(before[layout] ?? "")) notes.push("the html className now goes through cn()");
|
|
17310
|
+
row("changed", layout, notes.join("; ") || "font setup");
|
|
17311
|
+
}
|
|
17312
|
+
const added = packageDelta(before["package.json"], after["package.json"]);
|
|
17313
|
+
if (added.length > 0) row("changed", "package.json", `adds ${added.join(", ")}`);
|
|
17314
|
+
return lines;
|
|
17315
|
+
}
|
|
17316
|
+
|
|
17317
|
+
// src/cli/commands/shared.ts
|
|
17318
|
+
init_esm_shims();
|
|
17319
|
+
var import_prompts = __toESM(require_prompts3(), 1);
|
|
17320
|
+
var import_fs_extra8 = __toESM(require_lib2(), 1);
|
|
17321
|
+
import path10 from "path";
|
|
17322
|
+
|
|
17323
|
+
// src/cli/vite.ts
|
|
17324
|
+
init_esm_shims();
|
|
17325
|
+
var import_fs_extra7 = __toESM(require_lib2(), 1);
|
|
17326
|
+
import path9 from "path";
|
|
17158
17327
|
var VITE_CONFIGS = ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs", "vite.config.cts", "vite.config.cjs"];
|
|
17159
17328
|
async function findViteConfig(cwd) {
|
|
17160
17329
|
for (const name of VITE_CONFIGS) {
|
|
17161
|
-
if (await
|
|
17330
|
+
if (await import_fs_extra7.default.pathExists(path9.join(cwd, name))) return name;
|
|
17162
17331
|
}
|
|
17163
17332
|
return void 0;
|
|
17164
17333
|
}
|
|
@@ -17171,14 +17340,14 @@ function usesTsconfigPaths(source) {
|
|
|
17171
17340
|
async function tsconfigFiles(cwd) {
|
|
17172
17341
|
const files = [];
|
|
17173
17342
|
for (const name of ["tsconfig.json", "tsconfig.app.json"]) {
|
|
17174
|
-
if (await
|
|
17343
|
+
if (await import_fs_extra7.default.pathExists(path9.join(cwd, name))) files.push(name);
|
|
17175
17344
|
}
|
|
17176
17345
|
if (files.length > 0) return files;
|
|
17177
|
-
return await
|
|
17346
|
+
return await import_fs_extra7.default.pathExists(path9.join(cwd, "jsconfig.json")) ? ["jsconfig.json"] : ["tsconfig.json"];
|
|
17178
17347
|
}
|
|
17179
17348
|
async function aliasAdvice(cwd, { root, mapped, pm }) {
|
|
17180
17349
|
const viteConfig = await findViteConfig(cwd);
|
|
17181
|
-
const source = viteConfig ? await
|
|
17350
|
+
const source = viteConfig ? await import_fs_extra7.default.readFile(path9.join(cwd, viteConfig), "utf8").catch(() => "") : "";
|
|
17182
17351
|
const aliased = !viteConfig || viteConfigHasAlias(source);
|
|
17183
17352
|
if (mapped && aliased) return void 0;
|
|
17184
17353
|
const target = root ? `./${root}` : ".";
|
|
@@ -17271,11 +17440,11 @@ async function safeOrExit(check) {
|
|
|
17271
17440
|
}
|
|
17272
17441
|
}
|
|
17273
17442
|
async function repairIfNeededOrExit(cwd, aliasRoot, yes) {
|
|
17274
|
-
const configPath =
|
|
17275
|
-
const readConfig = () =>
|
|
17443
|
+
const configPath = path10.join(cwd, "components.json");
|
|
17444
|
+
const readConfig = () => import_fs_extra8.default.readJson(configPath).catch(() => void 0);
|
|
17276
17445
|
const pending = async () => {
|
|
17277
17446
|
const config = await readConfig();
|
|
17278
|
-
return await
|
|
17447
|
+
return await import_fs_extra8.default.pathExists(path10.join(cwd, REPAIR_FILE)) || config !== void 0 && await isLegacyConfig(cwd, config);
|
|
17279
17448
|
};
|
|
17280
17449
|
if (!await pending()) return void 0;
|
|
17281
17450
|
return repairOrExit(
|
|
@@ -17363,7 +17532,7 @@ ${printed}
|
|
|
17363
17532
|
${source_default.cyan(command)}`);
|
|
17364
17533
|
return true;
|
|
17365
17534
|
}
|
|
17366
|
-
if (!await
|
|
17535
|
+
if (!await import_fs_extra8.default.pathExists(path10.join(cwd, "package.json"))) {
|
|
17367
17536
|
console.log(source_default.yellow(`
|
|
17368
17537
|
No package.json here, so nothing was installed. In your project, run:`));
|
|
17369
17538
|
console.log(` ${source_default.cyan(command)}`);
|
|
@@ -17412,7 +17581,7 @@ function rangeStaysBelow3(range) {
|
|
|
17412
17581
|
return /^\s*(?:[\^~]|=|v)?\s*[0-2](?:\.(?:\d+|x|\*)){0,2}(?:-[0-9A-Za-z.-]+)?\s*$/.test(range);
|
|
17413
17582
|
}
|
|
17414
17583
|
async function tailwindMergeTooNew(cwd) {
|
|
17415
|
-
const pkg = await
|
|
17584
|
+
const pkg = await import_fs_extra9.default.readJson(path11.join(cwd, "package.json")).catch(() => ({}));
|
|
17416
17585
|
const listed = pkg.dependencies?.["tailwind-merge"] ?? pkg.devDependencies?.["tailwind-merge"];
|
|
17417
17586
|
if (listed === void 0) return void 0;
|
|
17418
17587
|
const installed = await installedVersion(cwd, "tailwind-merge");
|
|
@@ -17429,7 +17598,7 @@ async function cnPackagesToInstall(cwd, tailwindMajor = 4) {
|
|
|
17429
17598
|
async function writeCnHelper(cwd, utilsAlias, aliasRoot) {
|
|
17430
17599
|
const utilsRelative = aliasToPath(utilsAlias, aliasRoot);
|
|
17431
17600
|
const utilsPath = await resolveInsideProject(cwd, `${utilsRelative}.ts`);
|
|
17432
|
-
await
|
|
17601
|
+
await import_fs_extra9.default.ensureDir(path11.dirname(utilsPath));
|
|
17433
17602
|
return await writeFileIfAbsent(utilsPath, UTILS_SOURCE) ? `${utilsRelative}.ts` : void 0;
|
|
17434
17603
|
}
|
|
17435
17604
|
async function installCnPackages(cwd, pm, { enabled = true, run, tailwindMajor = 4 } = {}) {
|
|
@@ -17463,19 +17632,46 @@ ${tooNew}. tailwind-merge 3 supports only Tailwind 4; this project is on Tailwin
|
|
|
17463
17632
|
);
|
|
17464
17633
|
}
|
|
17465
17634
|
function initCommand() {
|
|
17466
|
-
return new Command().name("init").description("Initialize fasla-ui in your project").option("-y, --yes", "
|
|
17467
|
-
|
|
17635
|
+
return new Command().name("init").description("Initialize fasla-ui in your project").option("-y, --yes", "Accept every default and ask nothing").option("--path <dir>", "Where components go, e.g. src/components; the ui folder is added for you (src/components/ui works too)").option("--style <default|new-york>", "The shadcn style").option("--no-install", "Don't install clsx, tailwind-merge or the theme; print the commands instead").option("--theme <fasla|brand>", `The theme: "fasla" for Fasla's colours, "brand" to keep yours`).option("-c, --cwd <path>", "Working directory", process.cwd()).addHelpText(
|
|
17636
|
+
"after",
|
|
17637
|
+
`
|
|
17638
|
+
Without a terminal (an agent, a CI job) init asks nothing: pass --yes, or all
|
|
17639
|
+
of --path, --style and --theme. Missing ones are listed and nothing is written.
|
|
17640
|
+
|
|
17641
|
+
Examples:
|
|
17642
|
+
npx @smicolon/fasla-ui@latest init --yes
|
|
17643
|
+
npx @smicolon/fasla-ui@latest init --path src/components --style default --theme fasla`
|
|
17644
|
+
).action(async (options) => {
|
|
17645
|
+
const cwd = path11.resolve(options.cwd);
|
|
17468
17646
|
const yes = Boolean(options.yes);
|
|
17647
|
+
const interactive = isInteractive2();
|
|
17648
|
+
const unattended = yes || !interactive;
|
|
17649
|
+
if (options.style !== void 0 && !isStyleChoice(options.style)) {
|
|
17650
|
+
console.log(source_default.red(`Error: --style is ${STYLE_CHOICES.map((c) => `"${c}"`).join(" or ")}, not "${options.style}". Nothing was written.`));
|
|
17651
|
+
process.exit(1);
|
|
17652
|
+
}
|
|
17469
17653
|
if (options.theme !== void 0 && !THEME_CHOICES.some((c) => c.value === options.theme)) {
|
|
17470
17654
|
console.log(source_default.red(`Error: --theme is "fasla" or "brand", not "${options.theme}". Nothing was written.`));
|
|
17471
17655
|
process.exit(1);
|
|
17472
17656
|
}
|
|
17657
|
+
const configPath = path11.join(cwd, "components.json");
|
|
17658
|
+
const missing = missingInitFlags({
|
|
17659
|
+
yes,
|
|
17660
|
+
interactive,
|
|
17661
|
+
path: options.path,
|
|
17662
|
+
style: options.style,
|
|
17663
|
+
theme: options.theme,
|
|
17664
|
+
needsOverwriteAnswer: await keepsAskingAboutOverwrite(cwd, configPath)
|
|
17665
|
+
});
|
|
17666
|
+
if (missing.length > 0) {
|
|
17667
|
+
console.log(source_default.red(nonInteractiveInitMessage(missing)));
|
|
17668
|
+
process.exit(1);
|
|
17669
|
+
}
|
|
17473
17670
|
console.log(source_default.bold("\nInitializing fasla-ui...\n"));
|
|
17474
|
-
const configPath = path9.join(cwd, "components.json");
|
|
17475
17671
|
const pm = await detectPackageManager(cwd);
|
|
17476
|
-
const aliasRoot = await aliasRootOrExit(cwd,
|
|
17477
|
-
let config = await repairIfNeededOrExit(cwd, aliasRoot.root,
|
|
17478
|
-
if (!config && await
|
|
17672
|
+
const aliasRoot = await aliasRootOrExit(cwd, unattended, pm);
|
|
17673
|
+
let config = await repairIfNeededOrExit(cwd, aliasRoot.root, unattended);
|
|
17674
|
+
if (!config && await import_fs_extra9.default.pathExists(configPath)) {
|
|
17479
17675
|
if (!yes) {
|
|
17480
17676
|
const { overwrite } = await (0, import_prompts2.default)({
|
|
17481
17677
|
type: "confirm",
|
|
@@ -17490,9 +17686,14 @@ function initCommand() {
|
|
|
17490
17686
|
}
|
|
17491
17687
|
}
|
|
17492
17688
|
const style = await detectProjectStyle(cwd, aliasRoot.root);
|
|
17493
|
-
if (!config) config = await askForConfig(cwd, aliasRoot.root,
|
|
17689
|
+
if (!config) config = await askForConfig(cwd, aliasRoot.root, unattended, style, { path: options.path, style: options.style });
|
|
17494
17690
|
const aliases = config.aliases ?? {};
|
|
17495
17691
|
const utilsAlias = aliases.utils ?? "@/lib/utils";
|
|
17692
|
+
const css = typeof config.tailwind?.css === "string" ? config.tailwind.css : style.css;
|
|
17693
|
+
const layout = style.rsc ? await findLayout(cwd) : void 0;
|
|
17694
|
+
const utilsFile = `${aliasToPath(utilsAlias, aliasRoot.root)}.ts`;
|
|
17695
|
+
const tracked = ["components.json", utilsFile, css, "package.json", ...layout ? [layout] : []];
|
|
17696
|
+
const before = await snapshotFiles(cwd, tracked);
|
|
17496
17697
|
await safeOrExit(async () => {
|
|
17497
17698
|
await resolveWritableFile(cwd, "components.json");
|
|
17498
17699
|
await resolveInsideProject(cwd, aliasToPath(aliases.components ?? "@/components", aliasRoot.root));
|
|
@@ -17512,17 +17713,33 @@ function initCommand() {
|
|
|
17512
17713
|
process.exit(1);
|
|
17513
17714
|
}
|
|
17514
17715
|
if (!await installCnPackages(cwd, pm, { enabled: options.install !== false, tailwindMajor: style.tailwindMajor })) process.exit(1);
|
|
17515
|
-
const css = typeof config.tailwind?.css === "string" ? config.tailwind.css : style.css;
|
|
17516
17716
|
const theme = { flag: options.theme, yes, install: options.install !== false, nextMajor: style.nextMajor };
|
|
17517
|
-
|
|
17717
|
+
const themeOk = await installTheme(cwd, css, theme);
|
|
17718
|
+
const fontFixes = options.install !== false && themeOk ? await repairFontVariables(cwd, css) : [];
|
|
17719
|
+
if (!themeOk) process.exit(1);
|
|
17720
|
+
const after = await snapshotFiles(cwd, tracked);
|
|
17721
|
+
const lines = describeChanges({
|
|
17722
|
+
before,
|
|
17723
|
+
after,
|
|
17724
|
+
components: aliases.components ?? "@/components",
|
|
17725
|
+
utilsAlias,
|
|
17726
|
+
utils: utilsFile,
|
|
17727
|
+
css,
|
|
17728
|
+
layout,
|
|
17729
|
+
fontFixes,
|
|
17730
|
+
themeCommand: options.install === false ? "pending" : void 0
|
|
17731
|
+
});
|
|
17518
17732
|
console.log(source_default.green("\nSuccess! fasla-ui has been initialized."));
|
|
17519
|
-
console.log("\
|
|
17520
|
-
console.log(
|
|
17521
|
-
console.log(
|
|
17733
|
+
console.log("\nWhat init did:");
|
|
17734
|
+
for (const line of lines) console.log(` ${line}`);
|
|
17735
|
+
console.log(`
|
|
17736
|
+
Components will be written to ${aliasToPath(aliases.ui ?? `${aliases.components}/ui`, aliasRoot.root)}, imported as ${aliases.ui}/<name>.`);
|
|
17737
|
+
console.log("\nNext, add a component:");
|
|
17738
|
+
console.log(source_default.cyan(" npx @smicolon/fasla-ui@latest add button --yes"));
|
|
17522
17739
|
});
|
|
17523
17740
|
}
|
|
17524
17741
|
async function installTheme(cwd, css, { flag, yes, install: install2, nextMajor }) {
|
|
17525
|
-
const hasColours = hasColourTokens(await
|
|
17742
|
+
const hasColours = hasColourTokens(await import_fs_extra9.default.readFile(path11.join(cwd, css), "utf8").catch(() => ""));
|
|
17526
17743
|
let choice = themeWithoutAsking({ flag, yes, hasColours });
|
|
17527
17744
|
if (!choice) {
|
|
17528
17745
|
const { theme } = await (0, import_prompts2.default)({
|
|
@@ -17571,29 +17788,45 @@ Run this to finish:
|
|
|
17571
17788
|
${source_default.cyan(command)}`);
|
|
17572
17789
|
return false;
|
|
17573
17790
|
}
|
|
17574
|
-
async function
|
|
17791
|
+
async function keepsAskingAboutOverwrite(cwd, configPath) {
|
|
17792
|
+
const config = await import_fs_extra9.default.readJson(configPath).catch(() => void 0);
|
|
17793
|
+
if (config === void 0) return false;
|
|
17794
|
+
return !await isLegacyConfig(cwd, config);
|
|
17795
|
+
}
|
|
17796
|
+
async function askForConfig(cwd, aliasRoot, yes, project, flags = {}) {
|
|
17575
17797
|
const under = (p) => aliasRoot ? `${aliasRoot}/${p}` : p;
|
|
17576
17798
|
let componentsAlias = "@/components";
|
|
17577
17799
|
let utilsAlias = "@/lib/utils";
|
|
17578
|
-
let style = "default";
|
|
17800
|
+
let style = flags.style ?? "default";
|
|
17801
|
+
if (flags.path !== void 0) {
|
|
17802
|
+
const alias = componentsAliasFromPath(flags.path, aliasRoot);
|
|
17803
|
+
if (alias === void 0) {
|
|
17804
|
+
console.log(source_default.red(`Error: --path ${outsideAliasMessage(flags.path, aliasRoot)} Nothing was written.`));
|
|
17805
|
+
process.exit(1);
|
|
17806
|
+
}
|
|
17807
|
+
componentsAlias = alias;
|
|
17808
|
+
}
|
|
17579
17809
|
if (!yes) {
|
|
17580
17810
|
const insideAlias = (answer) => pathToAlias(answer, aliasRoot) === void 0 ? outsideAliasMessage(answer, aliasRoot) : true;
|
|
17581
|
-
const
|
|
17582
|
-
|
|
17811
|
+
const questions = [];
|
|
17812
|
+
if (flags.path === void 0) {
|
|
17813
|
+
questions.push({
|
|
17583
17814
|
type: "text",
|
|
17584
17815
|
name: "componentsDir",
|
|
17585
17816
|
message: "Where should components be installed?",
|
|
17586
17817
|
initial: under("components"),
|
|
17587
17818
|
validate: insideAlias
|
|
17588
|
-
}
|
|
17589
|
-
|
|
17590
|
-
|
|
17591
|
-
|
|
17592
|
-
|
|
17593
|
-
|
|
17594
|
-
|
|
17595
|
-
|
|
17596
|
-
|
|
17819
|
+
});
|
|
17820
|
+
}
|
|
17821
|
+
questions.push({
|
|
17822
|
+
type: "text",
|
|
17823
|
+
name: "utilsPath",
|
|
17824
|
+
message: "Where is your utils file (cn)?",
|
|
17825
|
+
initial: under("lib/utils"),
|
|
17826
|
+
validate: insideAlias
|
|
17827
|
+
});
|
|
17828
|
+
if (flags.style === void 0) {
|
|
17829
|
+
questions.push({
|
|
17597
17830
|
type: "select",
|
|
17598
17831
|
name: "style",
|
|
17599
17832
|
message: "Which style would you like to use?",
|
|
@@ -17602,17 +17835,18 @@ async function askForConfig(cwd, aliasRoot, yes, project) {
|
|
|
17602
17835
|
{ title: "New York", value: "new-york" }
|
|
17603
17836
|
],
|
|
17604
17837
|
initial: 0
|
|
17605
|
-
}
|
|
17606
|
-
|
|
17607
|
-
const
|
|
17838
|
+
});
|
|
17839
|
+
}
|
|
17840
|
+
const response = await (0, import_prompts2.default)(questions);
|
|
17841
|
+
const components = flags.path === void 0 ? componentsAliasFromPath(response.componentsDir ?? "", aliasRoot) : componentsAlias;
|
|
17608
17842
|
const utils = pathToAlias(response.utilsPath ?? "", aliasRoot);
|
|
17609
|
-
if (components === void 0 || utils === void 0 || response.style === void 0) {
|
|
17843
|
+
if (components === void 0 || utils === void 0 || flags.style === void 0 && response.style === void 0) {
|
|
17610
17844
|
console.log(source_default.yellow("Cancelled."));
|
|
17611
17845
|
process.exit(0);
|
|
17612
17846
|
}
|
|
17613
17847
|
componentsAlias = components;
|
|
17614
17848
|
utilsAlias = utils;
|
|
17615
|
-
style = response.style;
|
|
17849
|
+
style = flags.style ?? response.style;
|
|
17616
17850
|
}
|
|
17617
17851
|
return {
|
|
17618
17852
|
$schema: "https://ui.shadcn.com/schema.json",
|
|
@@ -17654,15 +17888,15 @@ function isFaslaFile(existing, incoming) {
|
|
|
17654
17888
|
// src/cli/commands/add.ts
|
|
17655
17889
|
function addCommand() {
|
|
17656
17890
|
return new Command().name("add").description("Add components to your project").argument("[components...]", "Components to add").option("-y, --yes", "Skip confirmation").option("-o, --overwrite", "Overwrite existing files").option("-a, --all", "Add all available components").option("--no-install", "Don't install the packages the components import; print the command instead").option("-c, --cwd <path>", "Working directory", process.cwd()).action(async (components, options) => {
|
|
17657
|
-
const cwd =
|
|
17658
|
-
const configPath =
|
|
17659
|
-
const hasConfig = await
|
|
17891
|
+
const cwd = path12.resolve(options.cwd);
|
|
17892
|
+
const configPath = path12.join(cwd, "components.json");
|
|
17893
|
+
const hasConfig = await import_fs_extra10.default.pathExists(configPath);
|
|
17660
17894
|
if (!hasConfig) {
|
|
17661
17895
|
console.log(source_default.red("Error: components.json not found."));
|
|
17662
17896
|
console.log("Run", source_default.cyan("npx @smicolon/fasla-ui@latest init"), "first.");
|
|
17663
17897
|
process.exit(1);
|
|
17664
17898
|
}
|
|
17665
|
-
let config = await
|
|
17899
|
+
let config = await import_fs_extra10.default.readJson(configPath);
|
|
17666
17900
|
const yes = Boolean(options.yes);
|
|
17667
17901
|
const pm = await detectPackageManager(cwd);
|
|
17668
17902
|
const aliasRoot = await aliasRootOrExit(cwd, yes, pm);
|
|
@@ -17713,6 +17947,10 @@ function addCommand() {
|
|
|
17713
17947
|
process.exit(1);
|
|
17714
17948
|
}
|
|
17715
17949
|
if (!options.yes) {
|
|
17950
|
+
if (!isInteractive2()) {
|
|
17951
|
+
console.log(source_default.red(nonInteractiveAddMessage()));
|
|
17952
|
+
process.exit(1);
|
|
17953
|
+
}
|
|
17716
17954
|
const { confirm } = await (0, import_prompts3.default)({
|
|
17717
17955
|
type: "confirm",
|
|
17718
17956
|
name: "confirm",
|
|
@@ -17729,12 +17967,19 @@ function addCommand() {
|
|
|
17729
17967
|
config = repaired;
|
|
17730
17968
|
await safeOrExit(() => writeCnHelper(cwd, config.aliases?.utils ?? "@/lib/utils", aliasRoot.root));
|
|
17731
17969
|
}
|
|
17732
|
-
const componentsAlias = config.aliases
|
|
17970
|
+
const componentsAlias = effectiveComponentsAlias(config.aliases);
|
|
17971
|
+
if (componentsAlias !== (config.aliases?.components || "@/components")) {
|
|
17972
|
+
console.log(
|
|
17973
|
+
source_default.yellow(
|
|
17974
|
+
`components.json has components: "${config.aliases?.components}" and ui: "${config.aliases?.ui}", which puts files in a ui folder inside a ui folder. Writing to ${componentsAlias}/ui instead; set "components" to "${componentsAlias}" in components.json to match.`
|
|
17975
|
+
)
|
|
17976
|
+
);
|
|
17977
|
+
}
|
|
17733
17978
|
const componentsDir = aliasToPath(componentsAlias, aliasRoot.root);
|
|
17734
17979
|
await safeOrExit(() => resolveInsideProject(cwd, componentsDir));
|
|
17735
17980
|
const addSpinner = ora("Resolving dependencies...").start();
|
|
17736
17981
|
const allDependencies = /* @__PURE__ */ new Set();
|
|
17737
|
-
const baseDir =
|
|
17982
|
+
const baseDir = path12.join(cwd, componentsDir);
|
|
17738
17983
|
const known = new Set(registry.items.map((item) => item.name));
|
|
17739
17984
|
const bases = [REGISTRY_URL, DEFAULT_REGISTRY_URL, LEGACY_REGISTRY_URL];
|
|
17740
17985
|
const nameOf = (dep) => registryItemName(dep, known, bases);
|
|
@@ -17762,7 +18007,7 @@ function addCommand() {
|
|
|
17762
18007
|
const item = registry.items.find((i) => i.name === name);
|
|
17763
18008
|
return item ? getTargetDirectory(item.type, baseDir) : void 0;
|
|
17764
18009
|
};
|
|
17765
|
-
const targetPathOf = (file, component) =>
|
|
18010
|
+
const targetPathOf = (file, component) => path12.join(getTargetDirectory(file.type || component.type, baseDir), path12.basename(file.target || file.path));
|
|
17766
18011
|
addSpinner.stop();
|
|
17767
18012
|
const replace = /* @__PURE__ */ new Set();
|
|
17768
18013
|
const kept = [];
|
|
@@ -17770,12 +18015,12 @@ function addCommand() {
|
|
|
17770
18015
|
for (const component of resolved.items) {
|
|
17771
18016
|
for (const file of component.files ?? []) {
|
|
17772
18017
|
const target = targetPathOf(file, component);
|
|
17773
|
-
await safeOrExit(() => resolveInsideProject(cwd,
|
|
17774
|
-
const stat = await
|
|
18018
|
+
await safeOrExit(() => resolveInsideProject(cwd, path12.dirname(target)));
|
|
18019
|
+
const stat = await import_fs_extra10.default.lstat(target).catch(() => void 0);
|
|
17775
18020
|
if (!stat?.isFile()) continue;
|
|
17776
|
-
const existing = await
|
|
18021
|
+
const existing = await import_fs_extra10.default.readFile(target, "utf8");
|
|
17777
18022
|
if (isFaslaFile(existing, file.content ?? "")) continue;
|
|
17778
|
-
const name =
|
|
18023
|
+
const name = path12.relative(cwd, target);
|
|
17779
18024
|
if (yes) {
|
|
17780
18025
|
kept.push({ component: component.name, file: name });
|
|
17781
18026
|
continue;
|
|
@@ -17783,7 +18028,7 @@ function addCommand() {
|
|
|
17783
18028
|
const { replaceIt } = await (0, import_prompts3.default)({
|
|
17784
18029
|
type: "confirm",
|
|
17785
18030
|
name: "replaceIt",
|
|
17786
|
-
message: `${
|
|
18031
|
+
message: `${path12.basename(target)} exists and isn't Fasla's. Replace it?`,
|
|
17787
18032
|
initial: true
|
|
17788
18033
|
});
|
|
17789
18034
|
if (replaceIt) replace.add(target);
|
|
@@ -17822,9 +18067,9 @@ function addCommand() {
|
|
|
17822
18067
|
continue;
|
|
17823
18068
|
}
|
|
17824
18069
|
const targetPath = targetPathOf(file, component);
|
|
17825
|
-
const targetDir =
|
|
17826
|
-
const filename =
|
|
17827
|
-
await
|
|
18070
|
+
const targetDir = path12.dirname(targetPath);
|
|
18071
|
+
const filename = path12.basename(targetPath);
|
|
18072
|
+
await import_fs_extra10.default.ensureDir(targetDir);
|
|
17828
18073
|
let content = file.content;
|
|
17829
18074
|
const utilsPath = config.aliases?.utils || "@/lib/utils";
|
|
17830
18075
|
content = content.replace(
|