ghost-bridge 0.7.1 → 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/README.md +17 -0
- package/dist/cli.js +266 -140
- package/dist/server.js +132 -33
- package/extension/background.js +236 -81
- package/extension/manifest.json +1 -1
- package/extension/offscreen.js +64 -21
- package/extension/popup.html +72 -54
- package/extension/popup.js +72 -42
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -934,7 +934,7 @@ var require_command = __commonJS({
|
|
|
934
934
|
"node_modules/commander/lib/command.js"(exports) {
|
|
935
935
|
var EventEmitter = __require("events").EventEmitter;
|
|
936
936
|
var childProcess = __require("child_process");
|
|
937
|
-
var
|
|
937
|
+
var path6 = __require("path");
|
|
938
938
|
var fs6 = __require("fs");
|
|
939
939
|
var process3 = __require("process");
|
|
940
940
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -1758,9 +1758,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1758
1758
|
let launchWithNode = false;
|
|
1759
1759
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1760
1760
|
function findFile(baseDir, baseName) {
|
|
1761
|
-
const localBin =
|
|
1761
|
+
const localBin = path6.resolve(baseDir, baseName);
|
|
1762
1762
|
if (fs6.existsSync(localBin)) return localBin;
|
|
1763
|
-
if (sourceExt.includes(
|
|
1763
|
+
if (sourceExt.includes(path6.extname(baseName))) return void 0;
|
|
1764
1764
|
const foundExt = sourceExt.find((ext) => fs6.existsSync(`${localBin}${ext}`));
|
|
1765
1765
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1766
1766
|
return void 0;
|
|
@@ -1776,19 +1776,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1776
1776
|
} catch (err) {
|
|
1777
1777
|
resolvedScriptPath = this._scriptPath;
|
|
1778
1778
|
}
|
|
1779
|
-
executableDir =
|
|
1779
|
+
executableDir = path6.resolve(path6.dirname(resolvedScriptPath), executableDir);
|
|
1780
1780
|
}
|
|
1781
1781
|
if (executableDir) {
|
|
1782
1782
|
let localFile = findFile(executableDir, executableFile);
|
|
1783
1783
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1784
|
-
const legacyName =
|
|
1784
|
+
const legacyName = path6.basename(this._scriptPath, path6.extname(this._scriptPath));
|
|
1785
1785
|
if (legacyName !== this._name) {
|
|
1786
1786
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
1789
|
executableFile = localFile || executableFile;
|
|
1790
1790
|
}
|
|
1791
|
-
launchWithNode = sourceExt.includes(
|
|
1791
|
+
launchWithNode = sourceExt.includes(path6.extname(executableFile));
|
|
1792
1792
|
let proc;
|
|
1793
1793
|
if (process3.platform !== "win32") {
|
|
1794
1794
|
if (launchWithNode) {
|
|
@@ -2571,7 +2571,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2571
2571
|
* @return {Command}
|
|
2572
2572
|
*/
|
|
2573
2573
|
nameFromFilename(filename) {
|
|
2574
|
-
this._name =
|
|
2574
|
+
this._name = path6.basename(filename, path6.extname(filename));
|
|
2575
2575
|
return this;
|
|
2576
2576
|
}
|
|
2577
2577
|
/**
|
|
@@ -2585,9 +2585,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2585
2585
|
* @param {string} [path]
|
|
2586
2586
|
* @return {string|null|Command}
|
|
2587
2587
|
*/
|
|
2588
|
-
executableDir(
|
|
2589
|
-
if (
|
|
2590
|
-
this._executableDir =
|
|
2588
|
+
executableDir(path7) {
|
|
2589
|
+
if (path7 === void 0) return this._executableDir;
|
|
2590
|
+
this._executableDir = path7;
|
|
2591
2591
|
return this;
|
|
2592
2592
|
}
|
|
2593
2593
|
/**
|
|
@@ -3373,14 +3373,14 @@ var require_polyfills = __commonJS({
|
|
|
3373
3373
|
fs6.fstatSync = statFixSync(fs6.fstatSync);
|
|
3374
3374
|
fs6.lstatSync = statFixSync(fs6.lstatSync);
|
|
3375
3375
|
if (fs6.chmod && !fs6.lchmod) {
|
|
3376
|
-
fs6.lchmod = function(
|
|
3376
|
+
fs6.lchmod = function(path6, mode, cb) {
|
|
3377
3377
|
if (cb) process.nextTick(cb);
|
|
3378
3378
|
};
|
|
3379
3379
|
fs6.lchmodSync = function() {
|
|
3380
3380
|
};
|
|
3381
3381
|
}
|
|
3382
3382
|
if (fs6.chown && !fs6.lchown) {
|
|
3383
|
-
fs6.lchown = function(
|
|
3383
|
+
fs6.lchown = function(path6, uid, gid, cb) {
|
|
3384
3384
|
if (cb) process.nextTick(cb);
|
|
3385
3385
|
};
|
|
3386
3386
|
fs6.lchownSync = function() {
|
|
@@ -3447,9 +3447,9 @@ var require_polyfills = __commonJS({
|
|
|
3447
3447
|
};
|
|
3448
3448
|
})(fs6.readSync);
|
|
3449
3449
|
function patchLchmod(fs7) {
|
|
3450
|
-
fs7.lchmod = function(
|
|
3450
|
+
fs7.lchmod = function(path6, mode, callback) {
|
|
3451
3451
|
fs7.open(
|
|
3452
|
-
|
|
3452
|
+
path6,
|
|
3453
3453
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
3454
3454
|
mode,
|
|
3455
3455
|
function(err, fd) {
|
|
@@ -3465,8 +3465,8 @@ var require_polyfills = __commonJS({
|
|
|
3465
3465
|
}
|
|
3466
3466
|
);
|
|
3467
3467
|
};
|
|
3468
|
-
fs7.lchmodSync = function(
|
|
3469
|
-
var fd = fs7.openSync(
|
|
3468
|
+
fs7.lchmodSync = function(path6, mode) {
|
|
3469
|
+
var fd = fs7.openSync(path6, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
3470
3470
|
var threw = true;
|
|
3471
3471
|
var ret;
|
|
3472
3472
|
try {
|
|
@@ -3487,8 +3487,8 @@ var require_polyfills = __commonJS({
|
|
|
3487
3487
|
}
|
|
3488
3488
|
function patchLutimes(fs7) {
|
|
3489
3489
|
if (constants.hasOwnProperty("O_SYMLINK") && fs7.futimes) {
|
|
3490
|
-
fs7.lutimes = function(
|
|
3491
|
-
fs7.open(
|
|
3490
|
+
fs7.lutimes = function(path6, at, mt, cb) {
|
|
3491
|
+
fs7.open(path6, constants.O_SYMLINK, function(er, fd) {
|
|
3492
3492
|
if (er) {
|
|
3493
3493
|
if (cb) cb(er);
|
|
3494
3494
|
return;
|
|
@@ -3500,8 +3500,8 @@ var require_polyfills = __commonJS({
|
|
|
3500
3500
|
});
|
|
3501
3501
|
});
|
|
3502
3502
|
};
|
|
3503
|
-
fs7.lutimesSync = function(
|
|
3504
|
-
var fd = fs7.openSync(
|
|
3503
|
+
fs7.lutimesSync = function(path6, at, mt) {
|
|
3504
|
+
var fd = fs7.openSync(path6, constants.O_SYMLINK);
|
|
3505
3505
|
var ret;
|
|
3506
3506
|
var threw = true;
|
|
3507
3507
|
try {
|
|
@@ -3619,11 +3619,11 @@ var require_legacy_streams = __commonJS({
|
|
|
3619
3619
|
ReadStream,
|
|
3620
3620
|
WriteStream
|
|
3621
3621
|
};
|
|
3622
|
-
function ReadStream(
|
|
3623
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
3622
|
+
function ReadStream(path6, options) {
|
|
3623
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
|
|
3624
3624
|
Stream.call(this);
|
|
3625
3625
|
var self = this;
|
|
3626
|
-
this.path =
|
|
3626
|
+
this.path = path6;
|
|
3627
3627
|
this.fd = null;
|
|
3628
3628
|
this.readable = true;
|
|
3629
3629
|
this.paused = false;
|
|
@@ -3668,10 +3668,10 @@ var require_legacy_streams = __commonJS({
|
|
|
3668
3668
|
self._read();
|
|
3669
3669
|
});
|
|
3670
3670
|
}
|
|
3671
|
-
function WriteStream(
|
|
3672
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
3671
|
+
function WriteStream(path6, options) {
|
|
3672
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
|
|
3673
3673
|
Stream.call(this);
|
|
3674
|
-
this.path =
|
|
3674
|
+
this.path = path6;
|
|
3675
3675
|
this.fd = null;
|
|
3676
3676
|
this.writable = true;
|
|
3677
3677
|
this.flags = "w";
|
|
@@ -3814,14 +3814,14 @@ var require_graceful_fs = __commonJS({
|
|
|
3814
3814
|
fs7.createWriteStream = createWriteStream;
|
|
3815
3815
|
var fs$readFile = fs7.readFile;
|
|
3816
3816
|
fs7.readFile = readFile;
|
|
3817
|
-
function readFile(
|
|
3817
|
+
function readFile(path6, options, cb) {
|
|
3818
3818
|
if (typeof options === "function")
|
|
3819
3819
|
cb = options, options = null;
|
|
3820
|
-
return go$readFile(
|
|
3821
|
-
function go$readFile(
|
|
3822
|
-
return fs$readFile(
|
|
3820
|
+
return go$readFile(path6, options, cb);
|
|
3821
|
+
function go$readFile(path7, options2, cb2, startTime) {
|
|
3822
|
+
return fs$readFile(path7, options2, function(err) {
|
|
3823
3823
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
3824
|
-
enqueue([go$readFile, [
|
|
3824
|
+
enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
3825
3825
|
else {
|
|
3826
3826
|
if (typeof cb2 === "function")
|
|
3827
3827
|
cb2.apply(this, arguments);
|
|
@@ -3831,14 +3831,14 @@ var require_graceful_fs = __commonJS({
|
|
|
3831
3831
|
}
|
|
3832
3832
|
var fs$writeFile = fs7.writeFile;
|
|
3833
3833
|
fs7.writeFile = writeFile;
|
|
3834
|
-
function writeFile(
|
|
3834
|
+
function writeFile(path6, data, options, cb) {
|
|
3835
3835
|
if (typeof options === "function")
|
|
3836
3836
|
cb = options, options = null;
|
|
3837
|
-
return go$writeFile(
|
|
3838
|
-
function go$writeFile(
|
|
3839
|
-
return fs$writeFile(
|
|
3837
|
+
return go$writeFile(path6, data, options, cb);
|
|
3838
|
+
function go$writeFile(path7, data2, options2, cb2, startTime) {
|
|
3839
|
+
return fs$writeFile(path7, data2, options2, function(err) {
|
|
3840
3840
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
3841
|
-
enqueue([go$writeFile, [
|
|
3841
|
+
enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
3842
3842
|
else {
|
|
3843
3843
|
if (typeof cb2 === "function")
|
|
3844
3844
|
cb2.apply(this, arguments);
|
|
@@ -3849,14 +3849,14 @@ var require_graceful_fs = __commonJS({
|
|
|
3849
3849
|
var fs$appendFile = fs7.appendFile;
|
|
3850
3850
|
if (fs$appendFile)
|
|
3851
3851
|
fs7.appendFile = appendFile;
|
|
3852
|
-
function appendFile(
|
|
3852
|
+
function appendFile(path6, data, options, cb) {
|
|
3853
3853
|
if (typeof options === "function")
|
|
3854
3854
|
cb = options, options = null;
|
|
3855
|
-
return go$appendFile(
|
|
3856
|
-
function go$appendFile(
|
|
3857
|
-
return fs$appendFile(
|
|
3855
|
+
return go$appendFile(path6, data, options, cb);
|
|
3856
|
+
function go$appendFile(path7, data2, options2, cb2, startTime) {
|
|
3857
|
+
return fs$appendFile(path7, data2, options2, function(err) {
|
|
3858
3858
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
3859
|
-
enqueue([go$appendFile, [
|
|
3859
|
+
enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
3860
3860
|
else {
|
|
3861
3861
|
if (typeof cb2 === "function")
|
|
3862
3862
|
cb2.apply(this, arguments);
|
|
@@ -3887,31 +3887,31 @@ var require_graceful_fs = __commonJS({
|
|
|
3887
3887
|
var fs$readdir = fs7.readdir;
|
|
3888
3888
|
fs7.readdir = readdir;
|
|
3889
3889
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
3890
|
-
function readdir(
|
|
3890
|
+
function readdir(path6, options, cb) {
|
|
3891
3891
|
if (typeof options === "function")
|
|
3892
3892
|
cb = options, options = null;
|
|
3893
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
3894
|
-
return fs$readdir(
|
|
3895
|
-
|
|
3893
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
|
|
3894
|
+
return fs$readdir(path7, fs$readdirCallback(
|
|
3895
|
+
path7,
|
|
3896
3896
|
options2,
|
|
3897
3897
|
cb2,
|
|
3898
3898
|
startTime
|
|
3899
3899
|
));
|
|
3900
|
-
} : function go$readdir2(
|
|
3901
|
-
return fs$readdir(
|
|
3902
|
-
|
|
3900
|
+
} : function go$readdir2(path7, options2, cb2, startTime) {
|
|
3901
|
+
return fs$readdir(path7, options2, fs$readdirCallback(
|
|
3902
|
+
path7,
|
|
3903
3903
|
options2,
|
|
3904
3904
|
cb2,
|
|
3905
3905
|
startTime
|
|
3906
3906
|
));
|
|
3907
3907
|
};
|
|
3908
|
-
return go$readdir(
|
|
3909
|
-
function fs$readdirCallback(
|
|
3908
|
+
return go$readdir(path6, options, cb);
|
|
3909
|
+
function fs$readdirCallback(path7, options2, cb2, startTime) {
|
|
3910
3910
|
return function(err, files) {
|
|
3911
3911
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
3912
3912
|
enqueue([
|
|
3913
3913
|
go$readdir,
|
|
3914
|
-
[
|
|
3914
|
+
[path7, options2, cb2],
|
|
3915
3915
|
err,
|
|
3916
3916
|
startTime || Date.now(),
|
|
3917
3917
|
Date.now()
|
|
@@ -3982,7 +3982,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3982
3982
|
enumerable: true,
|
|
3983
3983
|
configurable: true
|
|
3984
3984
|
});
|
|
3985
|
-
function ReadStream(
|
|
3985
|
+
function ReadStream(path6, options) {
|
|
3986
3986
|
if (this instanceof ReadStream)
|
|
3987
3987
|
return fs$ReadStream.apply(this, arguments), this;
|
|
3988
3988
|
else
|
|
@@ -4002,7 +4002,7 @@ var require_graceful_fs = __commonJS({
|
|
|
4002
4002
|
}
|
|
4003
4003
|
});
|
|
4004
4004
|
}
|
|
4005
|
-
function WriteStream(
|
|
4005
|
+
function WriteStream(path6, options) {
|
|
4006
4006
|
if (this instanceof WriteStream)
|
|
4007
4007
|
return fs$WriteStream.apply(this, arguments), this;
|
|
4008
4008
|
else
|
|
@@ -4020,22 +4020,22 @@ var require_graceful_fs = __commonJS({
|
|
|
4020
4020
|
}
|
|
4021
4021
|
});
|
|
4022
4022
|
}
|
|
4023
|
-
function createReadStream(
|
|
4024
|
-
return new fs7.ReadStream(
|
|
4023
|
+
function createReadStream(path6, options) {
|
|
4024
|
+
return new fs7.ReadStream(path6, options);
|
|
4025
4025
|
}
|
|
4026
|
-
function createWriteStream(
|
|
4027
|
-
return new fs7.WriteStream(
|
|
4026
|
+
function createWriteStream(path6, options) {
|
|
4027
|
+
return new fs7.WriteStream(path6, options);
|
|
4028
4028
|
}
|
|
4029
4029
|
var fs$open = fs7.open;
|
|
4030
4030
|
fs7.open = open;
|
|
4031
|
-
function open(
|
|
4031
|
+
function open(path6, flags, mode, cb) {
|
|
4032
4032
|
if (typeof mode === "function")
|
|
4033
4033
|
cb = mode, mode = null;
|
|
4034
|
-
return go$open(
|
|
4035
|
-
function go$open(
|
|
4036
|
-
return fs$open(
|
|
4034
|
+
return go$open(path6, flags, mode, cb);
|
|
4035
|
+
function go$open(path7, flags2, mode2, cb2, startTime) {
|
|
4036
|
+
return fs$open(path7, flags2, mode2, function(err, fd) {
|
|
4037
4037
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
4038
|
-
enqueue([go$open, [
|
|
4038
|
+
enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
4039
4039
|
else {
|
|
4040
4040
|
if (typeof cb2 === "function")
|
|
4041
4041
|
cb2.apply(this, arguments);
|
|
@@ -4218,10 +4218,10 @@ var require_fs = __commonJS({
|
|
|
4218
4218
|
var require_utils = __commonJS({
|
|
4219
4219
|
"node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
|
|
4220
4220
|
"use strict";
|
|
4221
|
-
var
|
|
4221
|
+
var path6 = __require("path");
|
|
4222
4222
|
module.exports.checkPath = function checkPath(pth) {
|
|
4223
4223
|
if (process.platform === "win32") {
|
|
4224
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(
|
|
4224
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path6.parse(pth).root, ""));
|
|
4225
4225
|
if (pathHasInvalidWinCharacters) {
|
|
4226
4226
|
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
4227
4227
|
error.code = "EINVAL";
|
|
@@ -4285,8 +4285,8 @@ var require_path_exists = __commonJS({
|
|
|
4285
4285
|
"use strict";
|
|
4286
4286
|
var u = require_universalify().fromPromise;
|
|
4287
4287
|
var fs6 = require_fs();
|
|
4288
|
-
function pathExists(
|
|
4289
|
-
return fs6.access(
|
|
4288
|
+
function pathExists(path6) {
|
|
4289
|
+
return fs6.access(path6).then(() => true).catch(() => false);
|
|
4290
4290
|
}
|
|
4291
4291
|
module.exports = {
|
|
4292
4292
|
pathExists: u(pathExists),
|
|
@@ -4301,8 +4301,8 @@ var require_utimes = __commonJS({
|
|
|
4301
4301
|
"use strict";
|
|
4302
4302
|
var fs6 = require_fs();
|
|
4303
4303
|
var u = require_universalify().fromPromise;
|
|
4304
|
-
async function utimesMillis(
|
|
4305
|
-
const fd = await fs6.open(
|
|
4304
|
+
async function utimesMillis(path6, atime, mtime) {
|
|
4305
|
+
const fd = await fs6.open(path6, "r+");
|
|
4306
4306
|
let closeErr = null;
|
|
4307
4307
|
try {
|
|
4308
4308
|
await fs6.futimes(fd, atime, mtime);
|
|
@@ -4317,8 +4317,8 @@ var require_utimes = __commonJS({
|
|
|
4317
4317
|
throw closeErr;
|
|
4318
4318
|
}
|
|
4319
4319
|
}
|
|
4320
|
-
function utimesMillisSync(
|
|
4321
|
-
const fd = fs6.openSync(
|
|
4320
|
+
function utimesMillisSync(path6, atime, mtime) {
|
|
4321
|
+
const fd = fs6.openSync(path6, "r+");
|
|
4322
4322
|
fs6.futimesSync(fd, atime, mtime);
|
|
4323
4323
|
return fs6.closeSync(fd);
|
|
4324
4324
|
}
|
|
@@ -4334,7 +4334,7 @@ var require_stat = __commonJS({
|
|
|
4334
4334
|
"node_modules/fs-extra/lib/util/stat.js"(exports, module) {
|
|
4335
4335
|
"use strict";
|
|
4336
4336
|
var fs6 = require_fs();
|
|
4337
|
-
var
|
|
4337
|
+
var path6 = __require("path");
|
|
4338
4338
|
var u = require_universalify().fromPromise;
|
|
4339
4339
|
function getStats(src, dest, opts) {
|
|
4340
4340
|
const statFunc = opts.dereference ? (file) => fs6.stat(file, { bigint: true }) : (file) => fs6.lstat(file, { bigint: true });
|
|
@@ -4362,8 +4362,8 @@ var require_stat = __commonJS({
|
|
|
4362
4362
|
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
4363
4363
|
if (destStat) {
|
|
4364
4364
|
if (areIdentical(srcStat, destStat)) {
|
|
4365
|
-
const srcBaseName =
|
|
4366
|
-
const destBaseName =
|
|
4365
|
+
const srcBaseName = path6.basename(src);
|
|
4366
|
+
const destBaseName = path6.basename(dest);
|
|
4367
4367
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
4368
4368
|
return { srcStat, destStat, isChangingCase: true };
|
|
4369
4369
|
}
|
|
@@ -4385,8 +4385,8 @@ var require_stat = __commonJS({
|
|
|
4385
4385
|
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
4386
4386
|
if (destStat) {
|
|
4387
4387
|
if (areIdentical(srcStat, destStat)) {
|
|
4388
|
-
const srcBaseName =
|
|
4389
|
-
const destBaseName =
|
|
4388
|
+
const srcBaseName = path6.basename(src);
|
|
4389
|
+
const destBaseName = path6.basename(dest);
|
|
4390
4390
|
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
4391
4391
|
return { srcStat, destStat, isChangingCase: true };
|
|
4392
4392
|
}
|
|
@@ -4405,9 +4405,9 @@ var require_stat = __commonJS({
|
|
|
4405
4405
|
return { srcStat, destStat };
|
|
4406
4406
|
}
|
|
4407
4407
|
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
4408
|
-
const srcParent =
|
|
4409
|
-
const destParent =
|
|
4410
|
-
if (destParent === srcParent || destParent ===
|
|
4408
|
+
const srcParent = path6.resolve(path6.dirname(src));
|
|
4409
|
+
const destParent = path6.resolve(path6.dirname(dest));
|
|
4410
|
+
if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
|
|
4411
4411
|
let destStat;
|
|
4412
4412
|
try {
|
|
4413
4413
|
destStat = await fs6.stat(destParent, { bigint: true });
|
|
@@ -4421,9 +4421,9 @@ var require_stat = __commonJS({
|
|
|
4421
4421
|
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
4422
4422
|
}
|
|
4423
4423
|
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
4424
|
-
const srcParent =
|
|
4425
|
-
const destParent =
|
|
4426
|
-
if (destParent === srcParent || destParent ===
|
|
4424
|
+
const srcParent = path6.resolve(path6.dirname(src));
|
|
4425
|
+
const destParent = path6.resolve(path6.dirname(dest));
|
|
4426
|
+
if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
|
|
4427
4427
|
let destStat;
|
|
4428
4428
|
try {
|
|
4429
4429
|
destStat = fs6.statSync(destParent, { bigint: true });
|
|
@@ -4440,8 +4440,8 @@ var require_stat = __commonJS({
|
|
|
4440
4440
|
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
4441
4441
|
}
|
|
4442
4442
|
function isSrcSubdir(src, dest) {
|
|
4443
|
-
const srcArr =
|
|
4444
|
-
const destArr =
|
|
4443
|
+
const srcArr = path6.resolve(src).split(path6.sep).filter((i) => i);
|
|
4444
|
+
const destArr = path6.resolve(dest).split(path6.sep).filter((i) => i);
|
|
4445
4445
|
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
4446
4446
|
}
|
|
4447
4447
|
function errMsg(src, dest, funcName) {
|
|
@@ -4494,7 +4494,7 @@ var require_copy = __commonJS({
|
|
|
4494
4494
|
"node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
|
|
4495
4495
|
"use strict";
|
|
4496
4496
|
var fs6 = require_fs();
|
|
4497
|
-
var
|
|
4497
|
+
var path6 = __require("path");
|
|
4498
4498
|
var { mkdirs } = require_mkdirs();
|
|
4499
4499
|
var { pathExists } = require_path_exists();
|
|
4500
4500
|
var { utimesMillis } = require_utimes();
|
|
@@ -4517,7 +4517,7 @@ var require_copy = __commonJS({
|
|
|
4517
4517
|
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
4518
4518
|
const include = await runFilter(src, dest, opts);
|
|
4519
4519
|
if (!include) return;
|
|
4520
|
-
const destParent =
|
|
4520
|
+
const destParent = path6.dirname(dest);
|
|
4521
4521
|
const dirExists = await pathExists(destParent);
|
|
4522
4522
|
if (!dirExists) {
|
|
4523
4523
|
await mkdirs(destParent);
|
|
@@ -4570,8 +4570,8 @@ var require_copy = __commonJS({
|
|
|
4570
4570
|
await fs6.mkdir(dest);
|
|
4571
4571
|
}
|
|
4572
4572
|
await asyncIteratorConcurrentProcess(await fs6.opendir(src), async (item) => {
|
|
4573
|
-
const srcItem =
|
|
4574
|
-
const destItem =
|
|
4573
|
+
const srcItem = path6.join(src, item.name);
|
|
4574
|
+
const destItem = path6.join(dest, item.name);
|
|
4575
4575
|
const include = await runFilter(srcItem, destItem, opts);
|
|
4576
4576
|
if (include) {
|
|
4577
4577
|
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
@@ -4585,7 +4585,7 @@ var require_copy = __commonJS({
|
|
|
4585
4585
|
async function onLink(destStat, src, dest, opts) {
|
|
4586
4586
|
let resolvedSrc = await fs6.readlink(src);
|
|
4587
4587
|
if (opts.dereference) {
|
|
4588
|
-
resolvedSrc =
|
|
4588
|
+
resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
|
|
4589
4589
|
}
|
|
4590
4590
|
if (!destStat) {
|
|
4591
4591
|
return fs6.symlink(resolvedSrc, dest);
|
|
@@ -4598,7 +4598,7 @@ var require_copy = __commonJS({
|
|
|
4598
4598
|
throw e;
|
|
4599
4599
|
}
|
|
4600
4600
|
if (opts.dereference) {
|
|
4601
|
-
resolvedDest =
|
|
4601
|
+
resolvedDest = path6.resolve(process.cwd(), resolvedDest);
|
|
4602
4602
|
}
|
|
4603
4603
|
if (resolvedSrc !== resolvedDest) {
|
|
4604
4604
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
@@ -4620,7 +4620,7 @@ var require_copy_sync = __commonJS({
|
|
|
4620
4620
|
"node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
|
|
4621
4621
|
"use strict";
|
|
4622
4622
|
var fs6 = require_graceful_fs();
|
|
4623
|
-
var
|
|
4623
|
+
var path6 = __require("path");
|
|
4624
4624
|
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
4625
4625
|
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
4626
4626
|
var stat = require_stat();
|
|
@@ -4641,7 +4641,7 @@ var require_copy_sync = __commonJS({
|
|
|
4641
4641
|
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
4642
4642
|
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
4643
4643
|
if (opts.filter && !opts.filter(src, dest)) return;
|
|
4644
|
-
const destParent =
|
|
4644
|
+
const destParent = path6.dirname(dest);
|
|
4645
4645
|
if (!fs6.existsSync(destParent)) mkdirsSync(destParent);
|
|
4646
4646
|
return getStats(destStat, src, dest, opts);
|
|
4647
4647
|
}
|
|
@@ -4710,8 +4710,8 @@ var require_copy_sync = __commonJS({
|
|
|
4710
4710
|
}
|
|
4711
4711
|
}
|
|
4712
4712
|
function copyDirItem(item, src, dest, opts) {
|
|
4713
|
-
const srcItem =
|
|
4714
|
-
const destItem =
|
|
4713
|
+
const srcItem = path6.join(src, item);
|
|
4714
|
+
const destItem = path6.join(dest, item);
|
|
4715
4715
|
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
4716
4716
|
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
4717
4717
|
return getStats(destStat, srcItem, destItem, opts);
|
|
@@ -4719,7 +4719,7 @@ var require_copy_sync = __commonJS({
|
|
|
4719
4719
|
function onLink(destStat, src, dest, opts) {
|
|
4720
4720
|
let resolvedSrc = fs6.readlinkSync(src);
|
|
4721
4721
|
if (opts.dereference) {
|
|
4722
|
-
resolvedSrc =
|
|
4722
|
+
resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
|
|
4723
4723
|
}
|
|
4724
4724
|
if (!destStat) {
|
|
4725
4725
|
return fs6.symlinkSync(resolvedSrc, dest);
|
|
@@ -4732,7 +4732,7 @@ var require_copy_sync = __commonJS({
|
|
|
4732
4732
|
throw err;
|
|
4733
4733
|
}
|
|
4734
4734
|
if (opts.dereference) {
|
|
4735
|
-
resolvedDest =
|
|
4735
|
+
resolvedDest = path6.resolve(process.cwd(), resolvedDest);
|
|
4736
4736
|
}
|
|
4737
4737
|
if (resolvedSrc !== resolvedDest) {
|
|
4738
4738
|
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
@@ -4771,11 +4771,11 @@ var require_remove = __commonJS({
|
|
|
4771
4771
|
"use strict";
|
|
4772
4772
|
var fs6 = require_graceful_fs();
|
|
4773
4773
|
var u = require_universalify().fromCallback;
|
|
4774
|
-
function remove(
|
|
4775
|
-
fs6.rm(
|
|
4774
|
+
function remove(path6, callback) {
|
|
4775
|
+
fs6.rm(path6, { recursive: true, force: true }, callback);
|
|
4776
4776
|
}
|
|
4777
|
-
function removeSync(
|
|
4778
|
-
fs6.rmSync(
|
|
4777
|
+
function removeSync(path6) {
|
|
4778
|
+
fs6.rmSync(path6, { recursive: true, force: true });
|
|
4779
4779
|
}
|
|
4780
4780
|
module.exports = {
|
|
4781
4781
|
remove: u(remove),
|
|
@@ -4790,7 +4790,7 @@ var require_empty = __commonJS({
|
|
|
4790
4790
|
"use strict";
|
|
4791
4791
|
var u = require_universalify().fromPromise;
|
|
4792
4792
|
var fs6 = require_fs();
|
|
4793
|
-
var
|
|
4793
|
+
var path6 = __require("path");
|
|
4794
4794
|
var mkdir = require_mkdirs();
|
|
4795
4795
|
var remove = require_remove();
|
|
4796
4796
|
var emptyDir = u(async function emptyDir2(dir) {
|
|
@@ -4800,7 +4800,7 @@ var require_empty = __commonJS({
|
|
|
4800
4800
|
} catch {
|
|
4801
4801
|
return mkdir.mkdirs(dir);
|
|
4802
4802
|
}
|
|
4803
|
-
return Promise.all(items.map((item) => remove.remove(
|
|
4803
|
+
return Promise.all(items.map((item) => remove.remove(path6.join(dir, item))));
|
|
4804
4804
|
});
|
|
4805
4805
|
function emptyDirSync(dir) {
|
|
4806
4806
|
let items;
|
|
@@ -4810,7 +4810,7 @@ var require_empty = __commonJS({
|
|
|
4810
4810
|
return mkdir.mkdirsSync(dir);
|
|
4811
4811
|
}
|
|
4812
4812
|
items.forEach((item) => {
|
|
4813
|
-
item =
|
|
4813
|
+
item = path6.join(dir, item);
|
|
4814
4814
|
remove.removeSync(item);
|
|
4815
4815
|
});
|
|
4816
4816
|
}
|
|
@@ -4828,7 +4828,7 @@ var require_file = __commonJS({
|
|
|
4828
4828
|
"node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
|
|
4829
4829
|
"use strict";
|
|
4830
4830
|
var u = require_universalify().fromPromise;
|
|
4831
|
-
var
|
|
4831
|
+
var path6 = __require("path");
|
|
4832
4832
|
var fs6 = require_fs();
|
|
4833
4833
|
var mkdir = require_mkdirs();
|
|
4834
4834
|
async function createFile(file) {
|
|
@@ -4838,7 +4838,7 @@ var require_file = __commonJS({
|
|
|
4838
4838
|
} catch {
|
|
4839
4839
|
}
|
|
4840
4840
|
if (stats && stats.isFile()) return;
|
|
4841
|
-
const dir =
|
|
4841
|
+
const dir = path6.dirname(file);
|
|
4842
4842
|
let dirStats = null;
|
|
4843
4843
|
try {
|
|
4844
4844
|
dirStats = await fs6.stat(dir);
|
|
@@ -4864,7 +4864,7 @@ var require_file = __commonJS({
|
|
|
4864
4864
|
} catch {
|
|
4865
4865
|
}
|
|
4866
4866
|
if (stats && stats.isFile()) return;
|
|
4867
|
-
const dir =
|
|
4867
|
+
const dir = path6.dirname(file);
|
|
4868
4868
|
try {
|
|
4869
4869
|
if (!fs6.statSync(dir).isDirectory()) {
|
|
4870
4870
|
fs6.readdirSync(dir);
|
|
@@ -4887,7 +4887,7 @@ var require_link = __commonJS({
|
|
|
4887
4887
|
"node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
|
|
4888
4888
|
"use strict";
|
|
4889
4889
|
var u = require_universalify().fromPromise;
|
|
4890
|
-
var
|
|
4890
|
+
var path6 = __require("path");
|
|
4891
4891
|
var fs6 = require_fs();
|
|
4892
4892
|
var mkdir = require_mkdirs();
|
|
4893
4893
|
var { pathExists } = require_path_exists();
|
|
@@ -4906,7 +4906,7 @@ var require_link = __commonJS({
|
|
|
4906
4906
|
throw err;
|
|
4907
4907
|
}
|
|
4908
4908
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
4909
|
-
const dir =
|
|
4909
|
+
const dir = path6.dirname(dstpath);
|
|
4910
4910
|
const dirExists = await pathExists(dir);
|
|
4911
4911
|
if (!dirExists) {
|
|
4912
4912
|
await mkdir.mkdirs(dir);
|
|
@@ -4926,7 +4926,7 @@ var require_link = __commonJS({
|
|
|
4926
4926
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
4927
4927
|
throw err;
|
|
4928
4928
|
}
|
|
4929
|
-
const dir =
|
|
4929
|
+
const dir = path6.dirname(dstpath);
|
|
4930
4930
|
const dirExists = fs6.existsSync(dir);
|
|
4931
4931
|
if (dirExists) return fs6.linkSync(srcpath, dstpath);
|
|
4932
4932
|
mkdir.mkdirsSync(dir);
|
|
@@ -4943,12 +4943,12 @@ var require_link = __commonJS({
|
|
|
4943
4943
|
var require_symlink_paths = __commonJS({
|
|
4944
4944
|
"node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
|
|
4945
4945
|
"use strict";
|
|
4946
|
-
var
|
|
4946
|
+
var path6 = __require("path");
|
|
4947
4947
|
var fs6 = require_fs();
|
|
4948
4948
|
var { pathExists } = require_path_exists();
|
|
4949
4949
|
var u = require_universalify().fromPromise;
|
|
4950
4950
|
async function symlinkPaths(srcpath, dstpath) {
|
|
4951
|
-
if (
|
|
4951
|
+
if (path6.isAbsolute(srcpath)) {
|
|
4952
4952
|
try {
|
|
4953
4953
|
await fs6.lstat(srcpath);
|
|
4954
4954
|
} catch (err) {
|
|
@@ -4960,8 +4960,8 @@ var require_symlink_paths = __commonJS({
|
|
|
4960
4960
|
toDst: srcpath
|
|
4961
4961
|
};
|
|
4962
4962
|
}
|
|
4963
|
-
const dstdir =
|
|
4964
|
-
const relativeToDst =
|
|
4963
|
+
const dstdir = path6.dirname(dstpath);
|
|
4964
|
+
const relativeToDst = path6.join(dstdir, srcpath);
|
|
4965
4965
|
const exists = await pathExists(relativeToDst);
|
|
4966
4966
|
if (exists) {
|
|
4967
4967
|
return {
|
|
@@ -4977,11 +4977,11 @@ var require_symlink_paths = __commonJS({
|
|
|
4977
4977
|
}
|
|
4978
4978
|
return {
|
|
4979
4979
|
toCwd: srcpath,
|
|
4980
|
-
toDst:
|
|
4980
|
+
toDst: path6.relative(dstdir, srcpath)
|
|
4981
4981
|
};
|
|
4982
4982
|
}
|
|
4983
4983
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
4984
|
-
if (
|
|
4984
|
+
if (path6.isAbsolute(srcpath)) {
|
|
4985
4985
|
const exists2 = fs6.existsSync(srcpath);
|
|
4986
4986
|
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
4987
4987
|
return {
|
|
@@ -4989,8 +4989,8 @@ var require_symlink_paths = __commonJS({
|
|
|
4989
4989
|
toDst: srcpath
|
|
4990
4990
|
};
|
|
4991
4991
|
}
|
|
4992
|
-
const dstdir =
|
|
4993
|
-
const relativeToDst =
|
|
4992
|
+
const dstdir = path6.dirname(dstpath);
|
|
4993
|
+
const relativeToDst = path6.join(dstdir, srcpath);
|
|
4994
4994
|
const exists = fs6.existsSync(relativeToDst);
|
|
4995
4995
|
if (exists) {
|
|
4996
4996
|
return {
|
|
@@ -5002,7 +5002,7 @@ var require_symlink_paths = __commonJS({
|
|
|
5002
5002
|
if (!srcExists) throw new Error("relative srcpath does not exist");
|
|
5003
5003
|
return {
|
|
5004
5004
|
toCwd: srcpath,
|
|
5005
|
-
toDst:
|
|
5005
|
+
toDst: path6.relative(dstdir, srcpath)
|
|
5006
5006
|
};
|
|
5007
5007
|
}
|
|
5008
5008
|
module.exports = {
|
|
@@ -5050,7 +5050,7 @@ var require_symlink = __commonJS({
|
|
|
5050
5050
|
"node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
|
|
5051
5051
|
"use strict";
|
|
5052
5052
|
var u = require_universalify().fromPromise;
|
|
5053
|
-
var
|
|
5053
|
+
var path6 = __require("path");
|
|
5054
5054
|
var fs6 = require_fs();
|
|
5055
5055
|
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
5056
5056
|
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
@@ -5073,7 +5073,7 @@ var require_symlink = __commonJS({
|
|
|
5073
5073
|
const relative = await symlinkPaths(srcpath, dstpath);
|
|
5074
5074
|
srcpath = relative.toDst;
|
|
5075
5075
|
const toType = await symlinkType(relative.toCwd, type);
|
|
5076
|
-
const dir =
|
|
5076
|
+
const dir = path6.dirname(dstpath);
|
|
5077
5077
|
if (!await pathExists(dir)) {
|
|
5078
5078
|
await mkdirs(dir);
|
|
5079
5079
|
}
|
|
@@ -5093,7 +5093,7 @@ var require_symlink = __commonJS({
|
|
|
5093
5093
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
5094
5094
|
srcpath = relative.toDst;
|
|
5095
5095
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
5096
|
-
const dir =
|
|
5096
|
+
const dir = path6.dirname(dstpath);
|
|
5097
5097
|
const exists = fs6.existsSync(dir);
|
|
5098
5098
|
if (exists) return fs6.symlinkSync(srcpath, dstpath, type);
|
|
5099
5099
|
mkdirsSync(dir);
|
|
@@ -5242,18 +5242,18 @@ var require_output_file = __commonJS({
|
|
|
5242
5242
|
"use strict";
|
|
5243
5243
|
var u = require_universalify().fromPromise;
|
|
5244
5244
|
var fs6 = require_fs();
|
|
5245
|
-
var
|
|
5245
|
+
var path6 = __require("path");
|
|
5246
5246
|
var mkdir = require_mkdirs();
|
|
5247
5247
|
var pathExists = require_path_exists().pathExists;
|
|
5248
5248
|
async function outputFile(file, data, encoding = "utf-8") {
|
|
5249
|
-
const dir =
|
|
5249
|
+
const dir = path6.dirname(file);
|
|
5250
5250
|
if (!await pathExists(dir)) {
|
|
5251
5251
|
await mkdir.mkdirs(dir);
|
|
5252
5252
|
}
|
|
5253
5253
|
return fs6.writeFile(file, data, encoding);
|
|
5254
5254
|
}
|
|
5255
5255
|
function outputFileSync(file, ...args) {
|
|
5256
|
-
const dir =
|
|
5256
|
+
const dir = path6.dirname(file);
|
|
5257
5257
|
if (!fs6.existsSync(dir)) {
|
|
5258
5258
|
mkdir.mkdirsSync(dir);
|
|
5259
5259
|
}
|
|
@@ -5317,7 +5317,7 @@ var require_move = __commonJS({
|
|
|
5317
5317
|
"node_modules/fs-extra/lib/move/move.js"(exports, module) {
|
|
5318
5318
|
"use strict";
|
|
5319
5319
|
var fs6 = require_fs();
|
|
5320
|
-
var
|
|
5320
|
+
var path6 = __require("path");
|
|
5321
5321
|
var { copy } = require_copy2();
|
|
5322
5322
|
var { remove } = require_remove();
|
|
5323
5323
|
var { mkdirp } = require_mkdirs();
|
|
@@ -5327,8 +5327,8 @@ var require_move = __commonJS({
|
|
|
5327
5327
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
5328
5328
|
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
5329
5329
|
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
5330
|
-
const destParent =
|
|
5331
|
-
const parsedParentPath =
|
|
5330
|
+
const destParent = path6.dirname(dest);
|
|
5331
|
+
const parsedParentPath = path6.parse(destParent);
|
|
5332
5332
|
if (parsedParentPath.root !== destParent) {
|
|
5333
5333
|
await mkdirp(destParent);
|
|
5334
5334
|
}
|
|
@@ -5369,7 +5369,7 @@ var require_move_sync = __commonJS({
|
|
|
5369
5369
|
"node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
|
|
5370
5370
|
"use strict";
|
|
5371
5371
|
var fs6 = require_graceful_fs();
|
|
5372
|
-
var
|
|
5372
|
+
var path6 = __require("path");
|
|
5373
5373
|
var copySync = require_copy2().copySync;
|
|
5374
5374
|
var removeSync = require_remove().removeSync;
|
|
5375
5375
|
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
@@ -5379,12 +5379,12 @@ var require_move_sync = __commonJS({
|
|
|
5379
5379
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
5380
5380
|
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
5381
5381
|
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
5382
|
-
if (!isParentRoot(dest)) mkdirpSync(
|
|
5382
|
+
if (!isParentRoot(dest)) mkdirpSync(path6.dirname(dest));
|
|
5383
5383
|
return doRename(src, dest, overwrite, isChangingCase);
|
|
5384
5384
|
}
|
|
5385
5385
|
function isParentRoot(dest) {
|
|
5386
|
-
const parent =
|
|
5387
|
-
const parsedPath =
|
|
5386
|
+
const parent = path6.dirname(dest);
|
|
5387
|
+
const parsedPath = path6.parse(parent);
|
|
5388
5388
|
return parsedPath.root === parent;
|
|
5389
5389
|
}
|
|
5390
5390
|
function doRename(src, dest, overwrite, isChangingCase) {
|
|
@@ -5757,12 +5757,12 @@ __export(extension_exports, {
|
|
|
5757
5757
|
});
|
|
5758
5758
|
import { exec as exec2 } from "child_process";
|
|
5759
5759
|
import os5 from "os";
|
|
5760
|
-
function openFolder2(
|
|
5760
|
+
function openFolder2(path6) {
|
|
5761
5761
|
const platform = os5.platform();
|
|
5762
5762
|
let command = "";
|
|
5763
|
-
if (platform === "darwin") command = `open "${
|
|
5764
|
-
else if (platform === "win32") command = `start "" "${
|
|
5765
|
-
else command = `xdg-open "${
|
|
5763
|
+
if (platform === "darwin") command = `open "${path6}"`;
|
|
5764
|
+
else if (platform === "win32") command = `start "" "${path6}"`;
|
|
5765
|
+
else command = `xdg-open "${path6}"`;
|
|
5766
5766
|
exec2(command, (err) => {
|
|
5767
5767
|
if (err) console.error("Failed to open folder:", err);
|
|
5768
5768
|
});
|
|
@@ -5800,10 +5800,87 @@ var status_exports = {};
|
|
|
5800
5800
|
__export(status_exports, {
|
|
5801
5801
|
status: () => status
|
|
5802
5802
|
});
|
|
5803
|
+
import path4 from "path";
|
|
5804
|
+
import os6 from "os";
|
|
5805
|
+
import crypto from "crypto";
|
|
5806
|
+
import { execFile } from "child_process";
|
|
5807
|
+
import { promisify } from "util";
|
|
5808
|
+
function isProcessRunning(pid) {
|
|
5809
|
+
try {
|
|
5810
|
+
process.kill(pid, 0);
|
|
5811
|
+
return true;
|
|
5812
|
+
} catch (e) {
|
|
5813
|
+
return e.code === "EPERM";
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
async function getProcessCommand(pid) {
|
|
5817
|
+
try {
|
|
5818
|
+
const { stdout } = await execFileAsync("ps", ["-p", String(pid), "-o", "command="]);
|
|
5819
|
+
return stdout.trim();
|
|
5820
|
+
} catch {
|
|
5821
|
+
return "";
|
|
5822
|
+
}
|
|
5823
|
+
}
|
|
5824
|
+
async function readActiveServiceInfo() {
|
|
5825
|
+
if (!import_fs_extra4.default.existsSync(PORT_INFO_FILE)) {
|
|
5826
|
+
return null;
|
|
5827
|
+
}
|
|
5828
|
+
try {
|
|
5829
|
+
return await import_fs_extra4.default.readJson(PORT_INFO_FILE);
|
|
5830
|
+
} catch {
|
|
5831
|
+
return null;
|
|
5832
|
+
}
|
|
5833
|
+
}
|
|
5834
|
+
async function hashFile(filePath) {
|
|
5835
|
+
const content = await import_fs_extra4.default.readFile(filePath);
|
|
5836
|
+
return crypto.createHash("sha256").update(content).digest("hex");
|
|
5837
|
+
}
|
|
5838
|
+
async function collectExtensionFiles(rootDir, currentDir = rootDir) {
|
|
5839
|
+
const entries = await import_fs_extra4.default.readdir(currentDir, { withFileTypes: true });
|
|
5840
|
+
const files = [];
|
|
5841
|
+
for (const entry of entries) {
|
|
5842
|
+
if (entry.name === ".DS_Store" || entry.name === ".ghost-bridge-managed") {
|
|
5843
|
+
continue;
|
|
5844
|
+
}
|
|
5845
|
+
const fullPath = path4.join(currentDir, entry.name);
|
|
5846
|
+
if (entry.isDirectory()) {
|
|
5847
|
+
files.push(...await collectExtensionFiles(rootDir, fullPath));
|
|
5848
|
+
} else if (entry.isFile()) {
|
|
5849
|
+
files.push(path4.relative(rootDir, fullPath));
|
|
5850
|
+
}
|
|
5851
|
+
}
|
|
5852
|
+
return files.sort();
|
|
5853
|
+
}
|
|
5854
|
+
async function getExtensionSyncStatus(sourceDir, targetDir) {
|
|
5855
|
+
if (!import_fs_extra4.default.existsSync(sourceDir)) {
|
|
5856
|
+
return { ok: false, reason: `Source extension directory not found: ${sourceDir}` };
|
|
5857
|
+
}
|
|
5858
|
+
if (!import_fs_extra4.default.existsSync(targetDir)) {
|
|
5859
|
+
return { ok: false, reason: "Extension directory is not installed" };
|
|
5860
|
+
}
|
|
5861
|
+
const sourceFiles = await collectExtensionFiles(sourceDir);
|
|
5862
|
+
const targetFiles = await collectExtensionFiles(targetDir);
|
|
5863
|
+
const sourceSet = new Set(sourceFiles);
|
|
5864
|
+
const targetSet = new Set(targetFiles);
|
|
5865
|
+
const missing = sourceFiles.filter((file) => !targetSet.has(file));
|
|
5866
|
+
if (missing.length > 0) {
|
|
5867
|
+
return { ok: false, reason: `Installed extension is missing ${missing[0]}` };
|
|
5868
|
+
}
|
|
5869
|
+
const extra = targetFiles.filter((file) => !sourceSet.has(file));
|
|
5870
|
+
for (const file of sourceFiles) {
|
|
5871
|
+
const sourceHash = await hashFile(path4.join(sourceDir, file));
|
|
5872
|
+
const targetHash = await hashFile(path4.join(targetDir, file));
|
|
5873
|
+
if (sourceHash !== targetHash) {
|
|
5874
|
+
return { ok: false, reason: `Installed extension differs at ${file}` };
|
|
5875
|
+
}
|
|
5876
|
+
}
|
|
5877
|
+
return { ok: true, extraFile: extra[0] };
|
|
5878
|
+
}
|
|
5803
5879
|
async function status() {
|
|
5804
5880
|
console.log(source_default.bold("\u{1F47B} Ghost Bridge Status"));
|
|
5805
5881
|
const clients = getClientDefinitions();
|
|
5806
5882
|
const extDir = getUserExtensionDir();
|
|
5883
|
+
const sourceExtDir = getExtensionPath();
|
|
5807
5884
|
const serverConfig = getServerCommandConfig();
|
|
5808
5885
|
console.log(source_default.bold.blue("\nMCP Client Configurations:"));
|
|
5809
5886
|
let configuredCount = 0;
|
|
@@ -5845,20 +5922,69 @@ async function status() {
|
|
|
5845
5922
|
if (configuredCount === 0) {
|
|
5846
5923
|
console.log(source_default.yellow("\n No MCP clients currently have ghost-bridge configured. Run `ghost-bridge init`."));
|
|
5847
5924
|
}
|
|
5925
|
+
console.log(source_default.bold.blue("\nActive WebSocket Service:"));
|
|
5926
|
+
const activeService = await readActiveServiceInfo();
|
|
5927
|
+
if (!activeService || !activeService.pid || !activeService.port) {
|
|
5928
|
+
console.log(` ${source_default.yellow("Not Running")}`);
|
|
5929
|
+
console.log(` Port Info: ${source_default.dim(PORT_INFO_FILE)}`);
|
|
5930
|
+
} else {
|
|
5931
|
+
const running = isProcessRunning(activeService.pid);
|
|
5932
|
+
const activeCommand = running ? await getProcessCommand(activeService.pid) : "";
|
|
5933
|
+
const currentServerPath = path4.resolve(serverConfig.args[0]);
|
|
5934
|
+
const activeServerPath = activeService.serverPath ? path4.resolve(activeService.serverPath) : "";
|
|
5935
|
+
const statusText = running ? source_default.green("Running") : source_default.red("Stale port file");
|
|
5936
|
+
console.log(` Status: ${statusText}`);
|
|
5937
|
+
console.log(` Port: ${source_default.cyan(activeService.port)}`);
|
|
5938
|
+
console.log(` PID: ${source_default.cyan(activeService.pid)}`);
|
|
5939
|
+
if (activeService.version) {
|
|
5940
|
+
console.log(` Version: ${source_default.cyan(activeService.version)}`);
|
|
5941
|
+
} else {
|
|
5942
|
+
console.log(source_default.yellow(" \u26A0 Active service does not expose version metadata; restart it after updating Ghost Bridge."));
|
|
5943
|
+
}
|
|
5944
|
+
if (activeServerPath) {
|
|
5945
|
+
console.log(` Server Path: ${source_default.dim(activeServerPath)}`);
|
|
5946
|
+
if (activeServerPath !== currentServerPath) {
|
|
5947
|
+
console.log(source_default.yellow(` \u26A0 Active service path differs from this CLI: ${currentServerPath}`));
|
|
5948
|
+
}
|
|
5949
|
+
} else if (activeCommand && !activeCommand.includes(currentServerPath)) {
|
|
5950
|
+
console.log(source_default.yellow(` \u26A0 Active service command may differ from this CLI:`));
|
|
5951
|
+
console.log(source_default.dim(` ${activeCommand}`));
|
|
5952
|
+
console.log(source_default.dim(` Current: ${serverConfig.command} ${currentServerPath}`));
|
|
5953
|
+
} else {
|
|
5954
|
+
console.log(source_default.yellow(" \u26A0 Active service does not expose server path metadata; restart it after updating Ghost Bridge."));
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5848
5957
|
let extStatus = source_default.red("Not Installed (Run init)");
|
|
5849
5958
|
if (import_fs_extra4.default.existsSync(extDir)) {
|
|
5850
5959
|
extStatus = source_default.green("Installed");
|
|
5851
5960
|
}
|
|
5961
|
+
console.log(source_default.bold.blue("\nChrome Extension:"));
|
|
5852
5962
|
console.log(`Extension: ${extStatus}`);
|
|
5853
5963
|
console.log(` Path: ${extDir}`);
|
|
5964
|
+
console.log(` Source: ${sourceExtDir}`);
|
|
5965
|
+
if (import_fs_extra4.default.existsSync(extDir)) {
|
|
5966
|
+
const syncStatus = await getExtensionSyncStatus(sourceExtDir, extDir);
|
|
5967
|
+
if (syncStatus.ok) {
|
|
5968
|
+
console.log(` Sync: ${source_default.green("Matches current package")}`);
|
|
5969
|
+
if (syncStatus.extraFile) {
|
|
5970
|
+
console.log(source_default.dim(` Ignoring extra installed file: ${syncStatus.extraFile}`));
|
|
5971
|
+
}
|
|
5972
|
+
} else {
|
|
5973
|
+
console.log(` Sync: ${source_default.yellow("Out of sync")}`);
|
|
5974
|
+
console.log(source_default.dim(` ${syncStatus.reason}`));
|
|
5975
|
+
console.log(source_default.dim(" Run `ghost-bridge init` and reload the Chrome extension."));
|
|
5976
|
+
}
|
|
5977
|
+
}
|
|
5854
5978
|
}
|
|
5855
|
-
var import_fs_extra4;
|
|
5979
|
+
var import_fs_extra4, execFileAsync, PORT_INFO_FILE;
|
|
5856
5980
|
var init_status = __esm({
|
|
5857
5981
|
"lib/status.js"() {
|
|
5858
5982
|
init_source();
|
|
5859
5983
|
import_fs_extra4 = __toESM(require_lib(), 1);
|
|
5860
5984
|
init_utils();
|
|
5861
5985
|
init_clients();
|
|
5986
|
+
execFileAsync = promisify(execFile);
|
|
5987
|
+
PORT_INFO_FILE = path4.join(os6.tmpdir(), "ghost-bridge-port.json");
|
|
5862
5988
|
}
|
|
5863
5989
|
});
|
|
5864
5990
|
|
|
@@ -5882,12 +6008,12 @@ var {
|
|
|
5882
6008
|
// bin/ghost-bridge.js
|
|
5883
6009
|
init_source();
|
|
5884
6010
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5885
|
-
import
|
|
6011
|
+
import path5 from "path";
|
|
5886
6012
|
import fs5 from "fs";
|
|
5887
6013
|
var __filename = fileURLToPath2(import.meta.url);
|
|
5888
|
-
var __dirname =
|
|
6014
|
+
var __dirname = path5.dirname(__filename);
|
|
5889
6015
|
var packageJsonParams = JSON.parse(
|
|
5890
|
-
fs5.readFileSync(
|
|
6016
|
+
fs5.readFileSync(path5.join(__dirname, "../package.json"), "utf-8")
|
|
5891
6017
|
);
|
|
5892
6018
|
var program2 = new Command();
|
|
5893
6019
|
program2.name("ghost-bridge").description(packageJsonParams.description).version(packageJsonParams.version);
|
|
@@ -5912,11 +6038,11 @@ program2.command("extension").description("Show the path to the Chrome extension
|
|
|
5912
6038
|
program2.command("start").description("Start the Ghost Bridge MCP server directly").action(async () => {
|
|
5913
6039
|
try {
|
|
5914
6040
|
console.log(source_default.blue("Starting Ghost Bridge Server..."));
|
|
5915
|
-
const serverPath =
|
|
6041
|
+
const serverPath = path5.join(__dirname, "../src/server.js");
|
|
5916
6042
|
if (fs5.existsSync(serverPath)) {
|
|
5917
6043
|
await import(serverPath);
|
|
5918
6044
|
} else {
|
|
5919
|
-
const rootServerPath =
|
|
6045
|
+
const rootServerPath = path5.join(__dirname, "../server.js");
|
|
5920
6046
|
if (fs5.existsSync(rootServerPath)) {
|
|
5921
6047
|
await import(rootServerPath);
|
|
5922
6048
|
} else {
|