@telepath-computer/television 0.1.14 → 0.1.16
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.cjs +564 -396
- package/dist/electron.cjs +530 -362
- package/package.json +4 -3
package/dist/cli.cjs
CHANGED
|
@@ -1194,7 +1194,7 @@ var require_command = __commonJS({
|
|
|
1194
1194
|
"node_modules/commander/lib/command.js"(exports2) {
|
|
1195
1195
|
var EventEmitter = require("node:events").EventEmitter;
|
|
1196
1196
|
var childProcess = require("node:child_process");
|
|
1197
|
-
var
|
|
1197
|
+
var path6 = require("node:path");
|
|
1198
1198
|
var fs = require("node:fs");
|
|
1199
1199
|
var process3 = require("node:process");
|
|
1200
1200
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -2207,9 +2207,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2207
2207
|
let launchWithNode = false;
|
|
2208
2208
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2209
2209
|
function findFile(baseDir, baseName) {
|
|
2210
|
-
const localBin =
|
|
2210
|
+
const localBin = path6.resolve(baseDir, baseName);
|
|
2211
2211
|
if (fs.existsSync(localBin)) return localBin;
|
|
2212
|
-
if (sourceExt.includes(
|
|
2212
|
+
if (sourceExt.includes(path6.extname(baseName))) return void 0;
|
|
2213
2213
|
const foundExt = sourceExt.find(
|
|
2214
2214
|
(ext) => fs.existsSync(`${localBin}${ext}`)
|
|
2215
2215
|
);
|
|
@@ -2227,17 +2227,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2227
2227
|
} catch {
|
|
2228
2228
|
resolvedScriptPath = this._scriptPath;
|
|
2229
2229
|
}
|
|
2230
|
-
executableDir =
|
|
2231
|
-
|
|
2230
|
+
executableDir = path6.resolve(
|
|
2231
|
+
path6.dirname(resolvedScriptPath),
|
|
2232
2232
|
executableDir
|
|
2233
2233
|
);
|
|
2234
2234
|
}
|
|
2235
2235
|
if (executableDir) {
|
|
2236
2236
|
let localFile = findFile(executableDir, executableFile);
|
|
2237
2237
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2238
|
-
const legacyName =
|
|
2238
|
+
const legacyName = path6.basename(
|
|
2239
2239
|
this._scriptPath,
|
|
2240
|
-
|
|
2240
|
+
path6.extname(this._scriptPath)
|
|
2241
2241
|
);
|
|
2242
2242
|
if (legacyName !== this._name) {
|
|
2243
2243
|
localFile = findFile(
|
|
@@ -2248,7 +2248,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2248
2248
|
}
|
|
2249
2249
|
executableFile = localFile || executableFile;
|
|
2250
2250
|
}
|
|
2251
|
-
launchWithNode = sourceExt.includes(
|
|
2251
|
+
launchWithNode = sourceExt.includes(path6.extname(executableFile));
|
|
2252
2252
|
let proc;
|
|
2253
2253
|
if (process3.platform !== "win32") {
|
|
2254
2254
|
if (launchWithNode) {
|
|
@@ -3163,7 +3163,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3163
3163
|
* @return {Command}
|
|
3164
3164
|
*/
|
|
3165
3165
|
nameFromFilename(filename) {
|
|
3166
|
-
this._name =
|
|
3166
|
+
this._name = path6.basename(filename, path6.extname(filename));
|
|
3167
3167
|
return this;
|
|
3168
3168
|
}
|
|
3169
3169
|
/**
|
|
@@ -3177,9 +3177,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3177
3177
|
* @param {string} [path]
|
|
3178
3178
|
* @return {(string|null|Command)}
|
|
3179
3179
|
*/
|
|
3180
|
-
executableDir(
|
|
3181
|
-
if (
|
|
3182
|
-
this._executableDir =
|
|
3180
|
+
executableDir(path7) {
|
|
3181
|
+
if (path7 === void 0) return this._executableDir;
|
|
3182
|
+
this._executableDir = path7;
|
|
3183
3183
|
return this;
|
|
3184
3184
|
}
|
|
3185
3185
|
/**
|
|
@@ -17505,11 +17505,11 @@ var require_mime_types = __commonJS({
|
|
|
17505
17505
|
}
|
|
17506
17506
|
return exts[0];
|
|
17507
17507
|
}
|
|
17508
|
-
function lookup(
|
|
17509
|
-
if (!
|
|
17508
|
+
function lookup(path6) {
|
|
17509
|
+
if (!path6 || typeof path6 !== "string") {
|
|
17510
17510
|
return false;
|
|
17511
17511
|
}
|
|
17512
|
-
var extension3 = extname("x." +
|
|
17512
|
+
var extension3 = extname("x." + path6).toLowerCase().substr(1);
|
|
17513
17513
|
if (!extension3) {
|
|
17514
17514
|
return false;
|
|
17515
17515
|
}
|
|
@@ -21872,7 +21872,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
21872
21872
|
"node_modules/path-to-regexp/index.js"(exports2, module2) {
|
|
21873
21873
|
module2.exports = pathToRegexp;
|
|
21874
21874
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
21875
|
-
function pathToRegexp(
|
|
21875
|
+
function pathToRegexp(path6, keys, options) {
|
|
21876
21876
|
options = options || {};
|
|
21877
21877
|
keys = keys || [];
|
|
21878
21878
|
var strict = options.strict;
|
|
@@ -21886,8 +21886,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
21886
21886
|
var pos = 0;
|
|
21887
21887
|
var backtrack = "";
|
|
21888
21888
|
var m2;
|
|
21889
|
-
if (
|
|
21890
|
-
while (m2 = MATCHING_GROUP_REGEXP.exec(
|
|
21889
|
+
if (path6 instanceof RegExp) {
|
|
21890
|
+
while (m2 = MATCHING_GROUP_REGEXP.exec(path6.source)) {
|
|
21891
21891
|
if (m2[0][0] === "\\") continue;
|
|
21892
21892
|
keys.push({
|
|
21893
21893
|
name: m2[1] || name++,
|
|
@@ -21895,18 +21895,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
21895
21895
|
offset: m2.index
|
|
21896
21896
|
});
|
|
21897
21897
|
}
|
|
21898
|
-
return
|
|
21898
|
+
return path6;
|
|
21899
21899
|
}
|
|
21900
|
-
if (Array.isArray(
|
|
21901
|
-
|
|
21900
|
+
if (Array.isArray(path6)) {
|
|
21901
|
+
path6 = path6.map(function(value) {
|
|
21902
21902
|
return pathToRegexp(value, keys, options).source;
|
|
21903
21903
|
});
|
|
21904
|
-
return new RegExp(
|
|
21904
|
+
return new RegExp(path6.join("|"), flags);
|
|
21905
21905
|
}
|
|
21906
|
-
if (typeof
|
|
21906
|
+
if (typeof path6 !== "string") {
|
|
21907
21907
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
21908
21908
|
}
|
|
21909
|
-
|
|
21909
|
+
path6 = path6.replace(
|
|
21910
21910
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
21911
21911
|
function(match, slash, format, key, capture, star, optional2, offset) {
|
|
21912
21912
|
if (match[0] === "\\") {
|
|
@@ -21923,7 +21923,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
21923
21923
|
if (slash || format) {
|
|
21924
21924
|
backtrack = "";
|
|
21925
21925
|
} else {
|
|
21926
|
-
backtrack +=
|
|
21926
|
+
backtrack += path6.slice(pos, offset);
|
|
21927
21927
|
}
|
|
21928
21928
|
pos = offset + match.length;
|
|
21929
21929
|
if (match === "*") {
|
|
@@ -21953,7 +21953,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
21953
21953
|
return result;
|
|
21954
21954
|
}
|
|
21955
21955
|
);
|
|
21956
|
-
while (m2 = MATCHING_GROUP_REGEXP.exec(
|
|
21956
|
+
while (m2 = MATCHING_GROUP_REGEXP.exec(path6)) {
|
|
21957
21957
|
if (m2[0][0] === "\\") continue;
|
|
21958
21958
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m2.index) {
|
|
21959
21959
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -21965,13 +21965,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
21965
21965
|
}
|
|
21966
21966
|
i++;
|
|
21967
21967
|
}
|
|
21968
|
-
|
|
21968
|
+
path6 += strict ? "" : path6[path6.length - 1] === "/" ? "?" : "/?";
|
|
21969
21969
|
if (end) {
|
|
21970
|
-
|
|
21971
|
-
} else if (
|
|
21972
|
-
|
|
21970
|
+
path6 += "$";
|
|
21971
|
+
} else if (path6[path6.length - 1] !== "/") {
|
|
21972
|
+
path6 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
21973
21973
|
}
|
|
21974
|
-
return new RegExp("^" +
|
|
21974
|
+
return new RegExp("^" + path6, flags);
|
|
21975
21975
|
}
|
|
21976
21976
|
}
|
|
21977
21977
|
});
|
|
@@ -21984,19 +21984,19 @@ var require_layer = __commonJS({
|
|
|
21984
21984
|
var debug = require_src3()("express:router:layer");
|
|
21985
21985
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
21986
21986
|
module2.exports = Layer;
|
|
21987
|
-
function Layer(
|
|
21987
|
+
function Layer(path6, options, fn) {
|
|
21988
21988
|
if (!(this instanceof Layer)) {
|
|
21989
|
-
return new Layer(
|
|
21989
|
+
return new Layer(path6, options, fn);
|
|
21990
21990
|
}
|
|
21991
|
-
debug("new %o",
|
|
21991
|
+
debug("new %o", path6);
|
|
21992
21992
|
var opts = options || {};
|
|
21993
21993
|
this.handle = fn;
|
|
21994
21994
|
this.name = fn.name || "<anonymous>";
|
|
21995
21995
|
this.params = void 0;
|
|
21996
21996
|
this.path = void 0;
|
|
21997
|
-
this.regexp = pathRegexp(
|
|
21998
|
-
this.regexp.fast_star =
|
|
21999
|
-
this.regexp.fast_slash =
|
|
21997
|
+
this.regexp = pathRegexp(path6, this.keys = [], opts);
|
|
21998
|
+
this.regexp.fast_star = path6 === "*";
|
|
21999
|
+
this.regexp.fast_slash = path6 === "/" && opts.end === false;
|
|
22000
22000
|
}
|
|
22001
22001
|
Layer.prototype.handle_error = function handle_error(error2, req, res, next) {
|
|
22002
22002
|
var fn = this.handle;
|
|
@@ -22020,20 +22020,20 @@ var require_layer = __commonJS({
|
|
|
22020
22020
|
next(err);
|
|
22021
22021
|
}
|
|
22022
22022
|
};
|
|
22023
|
-
Layer.prototype.match = function match(
|
|
22023
|
+
Layer.prototype.match = function match(path6) {
|
|
22024
22024
|
var match2;
|
|
22025
|
-
if (
|
|
22025
|
+
if (path6 != null) {
|
|
22026
22026
|
if (this.regexp.fast_slash) {
|
|
22027
22027
|
this.params = {};
|
|
22028
22028
|
this.path = "";
|
|
22029
22029
|
return true;
|
|
22030
22030
|
}
|
|
22031
22031
|
if (this.regexp.fast_star) {
|
|
22032
|
-
this.params = { "0": decode_param(
|
|
22033
|
-
this.path =
|
|
22032
|
+
this.params = { "0": decode_param(path6) };
|
|
22033
|
+
this.path = path6;
|
|
22034
22034
|
return true;
|
|
22035
22035
|
}
|
|
22036
|
-
match2 = this.regexp.exec(
|
|
22036
|
+
match2 = this.regexp.exec(path6);
|
|
22037
22037
|
}
|
|
22038
22038
|
if (!match2) {
|
|
22039
22039
|
this.params = void 0;
|
|
@@ -22126,10 +22126,10 @@ var require_route = __commonJS({
|
|
|
22126
22126
|
var slice = Array.prototype.slice;
|
|
22127
22127
|
var toString = Object.prototype.toString;
|
|
22128
22128
|
module2.exports = Route;
|
|
22129
|
-
function Route(
|
|
22130
|
-
this.path =
|
|
22129
|
+
function Route(path6) {
|
|
22130
|
+
this.path = path6;
|
|
22131
22131
|
this.stack = [];
|
|
22132
|
-
debug("new %o",
|
|
22132
|
+
debug("new %o", path6);
|
|
22133
22133
|
this.methods = {};
|
|
22134
22134
|
}
|
|
22135
22135
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -22341,8 +22341,8 @@ var require_router = __commonJS({
|
|
|
22341
22341
|
if (++sync > 100) {
|
|
22342
22342
|
return setImmediate(next, err);
|
|
22343
22343
|
}
|
|
22344
|
-
var
|
|
22345
|
-
if (
|
|
22344
|
+
var path6 = getPathname(req);
|
|
22345
|
+
if (path6 == null) {
|
|
22346
22346
|
return done(layerError);
|
|
22347
22347
|
}
|
|
22348
22348
|
var layer;
|
|
@@ -22350,7 +22350,7 @@ var require_router = __commonJS({
|
|
|
22350
22350
|
var route;
|
|
22351
22351
|
while (match !== true && idx < stack.length) {
|
|
22352
22352
|
layer = stack[idx++];
|
|
22353
|
-
match = matchLayer(layer,
|
|
22353
|
+
match = matchLayer(layer, path6);
|
|
22354
22354
|
route = layer.route;
|
|
22355
22355
|
if (typeof match !== "boolean") {
|
|
22356
22356
|
layerError = layerError || match;
|
|
@@ -22388,18 +22388,18 @@ var require_router = __commonJS({
|
|
|
22388
22388
|
} else if (route) {
|
|
22389
22389
|
layer.handle_request(req, res, next);
|
|
22390
22390
|
} else {
|
|
22391
|
-
trim_prefix(layer, layerError, layerPath,
|
|
22391
|
+
trim_prefix(layer, layerError, layerPath, path6);
|
|
22392
22392
|
}
|
|
22393
22393
|
sync = 0;
|
|
22394
22394
|
});
|
|
22395
22395
|
}
|
|
22396
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
22396
|
+
function trim_prefix(layer, layerError, layerPath, path6) {
|
|
22397
22397
|
if (layerPath.length !== 0) {
|
|
22398
|
-
if (layerPath !==
|
|
22398
|
+
if (layerPath !== path6.slice(0, layerPath.length)) {
|
|
22399
22399
|
next(layerError);
|
|
22400
22400
|
return;
|
|
22401
22401
|
}
|
|
22402
|
-
var c =
|
|
22402
|
+
var c = path6[layerPath.length];
|
|
22403
22403
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
22404
22404
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
22405
22405
|
removed = layerPath;
|
|
@@ -22477,7 +22477,7 @@ var require_router = __commonJS({
|
|
|
22477
22477
|
};
|
|
22478
22478
|
proto.use = function use(fn) {
|
|
22479
22479
|
var offset = 0;
|
|
22480
|
-
var
|
|
22480
|
+
var path6 = "/";
|
|
22481
22481
|
if (typeof fn !== "function") {
|
|
22482
22482
|
var arg = fn;
|
|
22483
22483
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -22485,7 +22485,7 @@ var require_router = __commonJS({
|
|
|
22485
22485
|
}
|
|
22486
22486
|
if (typeof arg !== "function") {
|
|
22487
22487
|
offset = 1;
|
|
22488
|
-
|
|
22488
|
+
path6 = fn;
|
|
22489
22489
|
}
|
|
22490
22490
|
}
|
|
22491
22491
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -22497,8 +22497,8 @@ var require_router = __commonJS({
|
|
|
22497
22497
|
if (typeof fn !== "function") {
|
|
22498
22498
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
22499
22499
|
}
|
|
22500
|
-
debug("use %o %s",
|
|
22501
|
-
var layer = new Layer(
|
|
22500
|
+
debug("use %o %s", path6, fn.name || "<anonymous>");
|
|
22501
|
+
var layer = new Layer(path6, {
|
|
22502
22502
|
sensitive: this.caseSensitive,
|
|
22503
22503
|
strict: false,
|
|
22504
22504
|
end: false
|
|
@@ -22508,9 +22508,9 @@ var require_router = __commonJS({
|
|
|
22508
22508
|
}
|
|
22509
22509
|
return this;
|
|
22510
22510
|
};
|
|
22511
|
-
proto.route = function route(
|
|
22512
|
-
var route2 = new Route(
|
|
22513
|
-
var layer = new Layer(
|
|
22511
|
+
proto.route = function route(path6) {
|
|
22512
|
+
var route2 = new Route(path6);
|
|
22513
|
+
var layer = new Layer(path6, {
|
|
22514
22514
|
sensitive: this.caseSensitive,
|
|
22515
22515
|
strict: this.strict,
|
|
22516
22516
|
end: true
|
|
@@ -22520,8 +22520,8 @@ var require_router = __commonJS({
|
|
|
22520
22520
|
return route2;
|
|
22521
22521
|
};
|
|
22522
22522
|
methods.concat("all").forEach(function(method) {
|
|
22523
|
-
proto[method] = function(
|
|
22524
|
-
var route = this.route(
|
|
22523
|
+
proto[method] = function(path6) {
|
|
22524
|
+
var route = this.route(path6);
|
|
22525
22525
|
route[method].apply(route, slice.call(arguments, 1));
|
|
22526
22526
|
return this;
|
|
22527
22527
|
};
|
|
@@ -22557,9 +22557,9 @@ var require_router = __commonJS({
|
|
|
22557
22557
|
}
|
|
22558
22558
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
22559
22559
|
}
|
|
22560
|
-
function matchLayer(layer,
|
|
22560
|
+
function matchLayer(layer, path6) {
|
|
22561
22561
|
try {
|
|
22562
|
-
return layer.match(
|
|
22562
|
+
return layer.match(path6);
|
|
22563
22563
|
} catch (err) {
|
|
22564
22564
|
return err;
|
|
22565
22565
|
}
|
|
@@ -22677,13 +22677,13 @@ var require_view = __commonJS({
|
|
|
22677
22677
|
"node_modules/express/lib/view.js"(exports2, module2) {
|
|
22678
22678
|
"use strict";
|
|
22679
22679
|
var debug = require_src3()("express:view");
|
|
22680
|
-
var
|
|
22680
|
+
var path6 = require("path");
|
|
22681
22681
|
var fs = require("fs");
|
|
22682
|
-
var dirname =
|
|
22683
|
-
var basename =
|
|
22684
|
-
var extname =
|
|
22685
|
-
var join2 =
|
|
22686
|
-
var resolve =
|
|
22682
|
+
var dirname = path6.dirname;
|
|
22683
|
+
var basename = path6.basename;
|
|
22684
|
+
var extname = path6.extname;
|
|
22685
|
+
var join2 = path6.join;
|
|
22686
|
+
var resolve = path6.resolve;
|
|
22687
22687
|
module2.exports = View;
|
|
22688
22688
|
function View(name, options) {
|
|
22689
22689
|
var opts = options || {};
|
|
@@ -22712,17 +22712,17 @@ var require_view = __commonJS({
|
|
|
22712
22712
|
this.path = this.lookup(fileName);
|
|
22713
22713
|
}
|
|
22714
22714
|
View.prototype.lookup = function lookup(name) {
|
|
22715
|
-
var
|
|
22715
|
+
var path7;
|
|
22716
22716
|
var roots = [].concat(this.root);
|
|
22717
22717
|
debug('lookup "%s"', name);
|
|
22718
|
-
for (var i = 0; i < roots.length && !
|
|
22718
|
+
for (var i = 0; i < roots.length && !path7; i++) {
|
|
22719
22719
|
var root = roots[i];
|
|
22720
22720
|
var loc = resolve(root, name);
|
|
22721
22721
|
var dir = dirname(loc);
|
|
22722
22722
|
var file2 = basename(loc);
|
|
22723
|
-
|
|
22723
|
+
path7 = this.resolve(dir, file2);
|
|
22724
22724
|
}
|
|
22725
|
-
return
|
|
22725
|
+
return path7;
|
|
22726
22726
|
};
|
|
22727
22727
|
View.prototype.render = function render(options, callback) {
|
|
22728
22728
|
debug('render "%s"', this.path);
|
|
@@ -22730,21 +22730,21 @@ var require_view = __commonJS({
|
|
|
22730
22730
|
};
|
|
22731
22731
|
View.prototype.resolve = function resolve2(dir, file2) {
|
|
22732
22732
|
var ext = this.ext;
|
|
22733
|
-
var
|
|
22734
|
-
var stat = tryStat(
|
|
22733
|
+
var path7 = join2(dir, file2);
|
|
22734
|
+
var stat = tryStat(path7);
|
|
22735
22735
|
if (stat && stat.isFile()) {
|
|
22736
|
-
return
|
|
22736
|
+
return path7;
|
|
22737
22737
|
}
|
|
22738
|
-
|
|
22739
|
-
stat = tryStat(
|
|
22738
|
+
path7 = join2(dir, basename(file2, ext), "index" + ext);
|
|
22739
|
+
stat = tryStat(path7);
|
|
22740
22740
|
if (stat && stat.isFile()) {
|
|
22741
|
-
return
|
|
22741
|
+
return path7;
|
|
22742
22742
|
}
|
|
22743
22743
|
};
|
|
22744
|
-
function tryStat(
|
|
22745
|
-
debug('stat "%s"',
|
|
22744
|
+
function tryStat(path7) {
|
|
22745
|
+
debug('stat "%s"', path7);
|
|
22746
22746
|
try {
|
|
22747
|
-
return fs.statSync(
|
|
22747
|
+
return fs.statSync(path7);
|
|
22748
22748
|
} catch (e) {
|
|
22749
22749
|
return void 0;
|
|
22750
22750
|
}
|
|
@@ -23522,7 +23522,7 @@ var require_types = __commonJS({
|
|
|
23522
23522
|
// node_modules/mime/mime.js
|
|
23523
23523
|
var require_mime = __commonJS({
|
|
23524
23524
|
"node_modules/mime/mime.js"(exports2, module2) {
|
|
23525
|
-
var
|
|
23525
|
+
var path6 = require("path");
|
|
23526
23526
|
var fs = require("fs");
|
|
23527
23527
|
function Mime() {
|
|
23528
23528
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
@@ -23552,8 +23552,8 @@ var require_mime = __commonJS({
|
|
|
23552
23552
|
this.define(map2);
|
|
23553
23553
|
this._loading = null;
|
|
23554
23554
|
};
|
|
23555
|
-
Mime.prototype.lookup = function(
|
|
23556
|
-
var ext =
|
|
23555
|
+
Mime.prototype.lookup = function(path7, fallback) {
|
|
23556
|
+
var ext = path7.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
23557
23557
|
return this.types[ext] || fallback || this.default_type;
|
|
23558
23558
|
};
|
|
23559
23559
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -23787,28 +23787,28 @@ var require_send = __commonJS({
|
|
|
23787
23787
|
var ms = require_ms5();
|
|
23788
23788
|
var onFinished = require_on_finished();
|
|
23789
23789
|
var parseRange = require_range_parser();
|
|
23790
|
-
var
|
|
23790
|
+
var path6 = require("path");
|
|
23791
23791
|
var statuses = require_statuses();
|
|
23792
23792
|
var Stream = require("stream");
|
|
23793
23793
|
var util2 = require("util");
|
|
23794
|
-
var extname =
|
|
23795
|
-
var join2 =
|
|
23796
|
-
var normalize =
|
|
23797
|
-
var resolve =
|
|
23798
|
-
var sep =
|
|
23794
|
+
var extname = path6.extname;
|
|
23795
|
+
var join2 = path6.join;
|
|
23796
|
+
var normalize = path6.normalize;
|
|
23797
|
+
var resolve = path6.resolve;
|
|
23798
|
+
var sep = path6.sep;
|
|
23799
23799
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
23800
23800
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
23801
23801
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
23802
23802
|
module2.exports = send;
|
|
23803
23803
|
module2.exports.mime = mime;
|
|
23804
|
-
function send(req,
|
|
23805
|
-
return new SendStream(req,
|
|
23804
|
+
function send(req, path7, options) {
|
|
23805
|
+
return new SendStream(req, path7, options);
|
|
23806
23806
|
}
|
|
23807
|
-
function SendStream(req,
|
|
23807
|
+
function SendStream(req, path7, options) {
|
|
23808
23808
|
Stream.call(this);
|
|
23809
23809
|
var opts = options || {};
|
|
23810
23810
|
this.options = opts;
|
|
23811
|
-
this.path =
|
|
23811
|
+
this.path = path7;
|
|
23812
23812
|
this.req = req;
|
|
23813
23813
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
23814
23814
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -23854,8 +23854,8 @@ var require_send = __commonJS({
|
|
|
23854
23854
|
this._index = index2;
|
|
23855
23855
|
return this;
|
|
23856
23856
|
}, "send.index: pass index as option");
|
|
23857
|
-
SendStream.prototype.root = function root(
|
|
23858
|
-
this._root = resolve(String(
|
|
23857
|
+
SendStream.prototype.root = function root(path7) {
|
|
23858
|
+
this._root = resolve(String(path7));
|
|
23859
23859
|
debug("root %s", this._root);
|
|
23860
23860
|
return this;
|
|
23861
23861
|
};
|
|
@@ -23968,10 +23968,10 @@ var require_send = __commonJS({
|
|
|
23968
23968
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
23969
23969
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
23970
23970
|
};
|
|
23971
|
-
SendStream.prototype.redirect = function redirect(
|
|
23971
|
+
SendStream.prototype.redirect = function redirect(path7) {
|
|
23972
23972
|
var res = this.res;
|
|
23973
23973
|
if (hasListeners(this, "directory")) {
|
|
23974
|
-
this.emit("directory", res,
|
|
23974
|
+
this.emit("directory", res, path7);
|
|
23975
23975
|
return;
|
|
23976
23976
|
}
|
|
23977
23977
|
if (this.hasTrailingSlash()) {
|
|
@@ -23991,42 +23991,42 @@ var require_send = __commonJS({
|
|
|
23991
23991
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
23992
23992
|
var root = this._root;
|
|
23993
23993
|
this.res = res;
|
|
23994
|
-
var
|
|
23995
|
-
if (
|
|
23994
|
+
var path7 = decode3(this.path);
|
|
23995
|
+
if (path7 === -1) {
|
|
23996
23996
|
this.error(400);
|
|
23997
23997
|
return res;
|
|
23998
23998
|
}
|
|
23999
|
-
if (~
|
|
23999
|
+
if (~path7.indexOf("\0")) {
|
|
24000
24000
|
this.error(400);
|
|
24001
24001
|
return res;
|
|
24002
24002
|
}
|
|
24003
24003
|
var parts;
|
|
24004
24004
|
if (root !== null) {
|
|
24005
|
-
if (
|
|
24006
|
-
|
|
24005
|
+
if (path7) {
|
|
24006
|
+
path7 = normalize("." + sep + path7);
|
|
24007
24007
|
}
|
|
24008
|
-
if (UP_PATH_REGEXP.test(
|
|
24009
|
-
debug('malicious path "%s"',
|
|
24008
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
24009
|
+
debug('malicious path "%s"', path7);
|
|
24010
24010
|
this.error(403);
|
|
24011
24011
|
return res;
|
|
24012
24012
|
}
|
|
24013
|
-
parts =
|
|
24014
|
-
|
|
24013
|
+
parts = path7.split(sep);
|
|
24014
|
+
path7 = normalize(join2(root, path7));
|
|
24015
24015
|
} else {
|
|
24016
|
-
if (UP_PATH_REGEXP.test(
|
|
24017
|
-
debug('malicious path "%s"',
|
|
24016
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
24017
|
+
debug('malicious path "%s"', path7);
|
|
24018
24018
|
this.error(403);
|
|
24019
24019
|
return res;
|
|
24020
24020
|
}
|
|
24021
|
-
parts = normalize(
|
|
24022
|
-
|
|
24021
|
+
parts = normalize(path7).split(sep);
|
|
24022
|
+
path7 = resolve(path7);
|
|
24023
24023
|
}
|
|
24024
24024
|
if (containsDotFile(parts)) {
|
|
24025
24025
|
var access = this._dotfiles;
|
|
24026
24026
|
if (access === void 0) {
|
|
24027
24027
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
24028
24028
|
}
|
|
24029
|
-
debug('%s dotfile "%s"', access,
|
|
24029
|
+
debug('%s dotfile "%s"', access, path7);
|
|
24030
24030
|
switch (access) {
|
|
24031
24031
|
case "allow":
|
|
24032
24032
|
break;
|
|
@@ -24040,13 +24040,13 @@ var require_send = __commonJS({
|
|
|
24040
24040
|
}
|
|
24041
24041
|
}
|
|
24042
24042
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
24043
|
-
this.sendIndex(
|
|
24043
|
+
this.sendIndex(path7);
|
|
24044
24044
|
return res;
|
|
24045
24045
|
}
|
|
24046
|
-
this.sendFile(
|
|
24046
|
+
this.sendFile(path7);
|
|
24047
24047
|
return res;
|
|
24048
24048
|
};
|
|
24049
|
-
SendStream.prototype.send = function send2(
|
|
24049
|
+
SendStream.prototype.send = function send2(path7, stat) {
|
|
24050
24050
|
var len = stat.size;
|
|
24051
24051
|
var options = this.options;
|
|
24052
24052
|
var opts = {};
|
|
@@ -24058,9 +24058,9 @@ var require_send = __commonJS({
|
|
|
24058
24058
|
this.headersAlreadySent();
|
|
24059
24059
|
return;
|
|
24060
24060
|
}
|
|
24061
|
-
debug('pipe "%s"',
|
|
24062
|
-
this.setHeader(
|
|
24063
|
-
this.type(
|
|
24061
|
+
debug('pipe "%s"', path7);
|
|
24062
|
+
this.setHeader(path7, stat);
|
|
24063
|
+
this.type(path7);
|
|
24064
24064
|
if (this.isConditionalGET()) {
|
|
24065
24065
|
if (this.isPreconditionFailure()) {
|
|
24066
24066
|
this.error(412);
|
|
@@ -24109,26 +24109,26 @@ var require_send = __commonJS({
|
|
|
24109
24109
|
res.end();
|
|
24110
24110
|
return;
|
|
24111
24111
|
}
|
|
24112
|
-
this.stream(
|
|
24112
|
+
this.stream(path7, opts);
|
|
24113
24113
|
};
|
|
24114
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
24114
|
+
SendStream.prototype.sendFile = function sendFile(path7) {
|
|
24115
24115
|
var i = 0;
|
|
24116
24116
|
var self2 = this;
|
|
24117
|
-
debug('stat "%s"',
|
|
24118
|
-
fs.stat(
|
|
24119
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
24117
|
+
debug('stat "%s"', path7);
|
|
24118
|
+
fs.stat(path7, function onstat(err, stat) {
|
|
24119
|
+
if (err && err.code === "ENOENT" && !extname(path7) && path7[path7.length - 1] !== sep) {
|
|
24120
24120
|
return next(err);
|
|
24121
24121
|
}
|
|
24122
24122
|
if (err) return self2.onStatError(err);
|
|
24123
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
24124
|
-
self2.emit("file",
|
|
24125
|
-
self2.send(
|
|
24123
|
+
if (stat.isDirectory()) return self2.redirect(path7);
|
|
24124
|
+
self2.emit("file", path7, stat);
|
|
24125
|
+
self2.send(path7, stat);
|
|
24126
24126
|
});
|
|
24127
24127
|
function next(err) {
|
|
24128
24128
|
if (self2._extensions.length <= i) {
|
|
24129
24129
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
24130
24130
|
}
|
|
24131
|
-
var p =
|
|
24131
|
+
var p = path7 + "." + self2._extensions[i++];
|
|
24132
24132
|
debug('stat "%s"', p);
|
|
24133
24133
|
fs.stat(p, function(err2, stat) {
|
|
24134
24134
|
if (err2) return next(err2);
|
|
@@ -24138,7 +24138,7 @@ var require_send = __commonJS({
|
|
|
24138
24138
|
});
|
|
24139
24139
|
}
|
|
24140
24140
|
};
|
|
24141
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
24141
|
+
SendStream.prototype.sendIndex = function sendIndex(path7) {
|
|
24142
24142
|
var i = -1;
|
|
24143
24143
|
var self2 = this;
|
|
24144
24144
|
function next(err) {
|
|
@@ -24146,7 +24146,7 @@ var require_send = __commonJS({
|
|
|
24146
24146
|
if (err) return self2.onStatError(err);
|
|
24147
24147
|
return self2.error(404);
|
|
24148
24148
|
}
|
|
24149
|
-
var p = join2(
|
|
24149
|
+
var p = join2(path7, self2._index[i]);
|
|
24150
24150
|
debug('stat "%s"', p);
|
|
24151
24151
|
fs.stat(p, function(err2, stat) {
|
|
24152
24152
|
if (err2) return next(err2);
|
|
@@ -24157,10 +24157,10 @@ var require_send = __commonJS({
|
|
|
24157
24157
|
}
|
|
24158
24158
|
next();
|
|
24159
24159
|
};
|
|
24160
|
-
SendStream.prototype.stream = function stream(
|
|
24160
|
+
SendStream.prototype.stream = function stream(path7, options) {
|
|
24161
24161
|
var self2 = this;
|
|
24162
24162
|
var res = this.res;
|
|
24163
|
-
var stream2 = fs.createReadStream(
|
|
24163
|
+
var stream2 = fs.createReadStream(path7, options);
|
|
24164
24164
|
this.emit("stream", stream2);
|
|
24165
24165
|
stream2.pipe(res);
|
|
24166
24166
|
function cleanup() {
|
|
@@ -24175,10 +24175,10 @@ var require_send = __commonJS({
|
|
|
24175
24175
|
self2.emit("end");
|
|
24176
24176
|
});
|
|
24177
24177
|
};
|
|
24178
|
-
SendStream.prototype.type = function type(
|
|
24178
|
+
SendStream.prototype.type = function type(path7) {
|
|
24179
24179
|
var res = this.res;
|
|
24180
24180
|
if (res.getHeader("Content-Type")) return;
|
|
24181
|
-
var type2 = mime.lookup(
|
|
24181
|
+
var type2 = mime.lookup(path7);
|
|
24182
24182
|
if (!type2) {
|
|
24183
24183
|
debug("no content-type");
|
|
24184
24184
|
return;
|
|
@@ -24187,9 +24187,9 @@ var require_send = __commonJS({
|
|
|
24187
24187
|
debug("content-type %s", type2);
|
|
24188
24188
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
24189
24189
|
};
|
|
24190
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
24190
|
+
SendStream.prototype.setHeader = function setHeader(path7, stat) {
|
|
24191
24191
|
var res = this.res;
|
|
24192
|
-
this.emit("headers", res,
|
|
24192
|
+
this.emit("headers", res, path7, stat);
|
|
24193
24193
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
24194
24194
|
debug("accept ranges");
|
|
24195
24195
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -24248,9 +24248,9 @@ var require_send = __commonJS({
|
|
|
24248
24248
|
}
|
|
24249
24249
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
24250
24250
|
}
|
|
24251
|
-
function decode3(
|
|
24251
|
+
function decode3(path7) {
|
|
24252
24252
|
try {
|
|
24253
|
-
return decodeURIComponent(
|
|
24253
|
+
return decodeURIComponent(path7);
|
|
24254
24254
|
} catch (err) {
|
|
24255
24255
|
return -1;
|
|
24256
24256
|
}
|
|
@@ -25159,10 +25159,10 @@ var require_utils2 = __commonJS({
|
|
|
25159
25159
|
var querystring = require("querystring");
|
|
25160
25160
|
exports2.etag = createETagGenerator({ weak: false });
|
|
25161
25161
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
25162
|
-
exports2.isAbsolute = function(
|
|
25163
|
-
if ("/" ===
|
|
25164
|
-
if (":" ===
|
|
25165
|
-
if ("\\\\" ===
|
|
25162
|
+
exports2.isAbsolute = function(path6) {
|
|
25163
|
+
if ("/" === path6[0]) return true;
|
|
25164
|
+
if (":" === path6[1] && ("\\" === path6[2] || "/" === path6[2])) return true;
|
|
25165
|
+
if ("\\\\" === path6.substring(0, 2)) return true;
|
|
25166
25166
|
};
|
|
25167
25167
|
exports2.flatten = deprecate.function(
|
|
25168
25168
|
flatten,
|
|
@@ -25373,7 +25373,7 @@ var require_application = __commonJS({
|
|
|
25373
25373
|
};
|
|
25374
25374
|
app.use = function use(fn) {
|
|
25375
25375
|
var offset = 0;
|
|
25376
|
-
var
|
|
25376
|
+
var path6 = "/";
|
|
25377
25377
|
if (typeof fn !== "function") {
|
|
25378
25378
|
var arg = fn;
|
|
25379
25379
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -25381,7 +25381,7 @@ var require_application = __commonJS({
|
|
|
25381
25381
|
}
|
|
25382
25382
|
if (typeof arg !== "function") {
|
|
25383
25383
|
offset = 1;
|
|
25384
|
-
|
|
25384
|
+
path6 = fn;
|
|
25385
25385
|
}
|
|
25386
25386
|
}
|
|
25387
25387
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -25392,12 +25392,12 @@ var require_application = __commonJS({
|
|
|
25392
25392
|
var router = this._router;
|
|
25393
25393
|
fns.forEach(function(fn2) {
|
|
25394
25394
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
25395
|
-
return router.use(
|
|
25395
|
+
return router.use(path6, fn2);
|
|
25396
25396
|
}
|
|
25397
|
-
debug(".use app under %s",
|
|
25398
|
-
fn2.mountpath =
|
|
25397
|
+
debug(".use app under %s", path6);
|
|
25398
|
+
fn2.mountpath = path6;
|
|
25399
25399
|
fn2.parent = this;
|
|
25400
|
-
router.use(
|
|
25400
|
+
router.use(path6, function mounted_app(req, res, next) {
|
|
25401
25401
|
var orig = req.app;
|
|
25402
25402
|
fn2.handle(req, res, function(err) {
|
|
25403
25403
|
setPrototypeOf(req, orig.request);
|
|
@@ -25409,9 +25409,9 @@ var require_application = __commonJS({
|
|
|
25409
25409
|
}, this);
|
|
25410
25410
|
return this;
|
|
25411
25411
|
};
|
|
25412
|
-
app.route = function route(
|
|
25412
|
+
app.route = function route(path6) {
|
|
25413
25413
|
this.lazyrouter();
|
|
25414
|
-
return this._router.route(
|
|
25414
|
+
return this._router.route(path6);
|
|
25415
25415
|
};
|
|
25416
25416
|
app.engine = function engine(ext, fn) {
|
|
25417
25417
|
if (typeof fn !== "function") {
|
|
@@ -25462,7 +25462,7 @@ var require_application = __commonJS({
|
|
|
25462
25462
|
}
|
|
25463
25463
|
return this;
|
|
25464
25464
|
};
|
|
25465
|
-
app.path = function
|
|
25465
|
+
app.path = function path6() {
|
|
25466
25466
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
25467
25467
|
};
|
|
25468
25468
|
app.enabled = function enabled(setting) {
|
|
@@ -25478,19 +25478,19 @@ var require_application = __commonJS({
|
|
|
25478
25478
|
return this.set(setting, false);
|
|
25479
25479
|
};
|
|
25480
25480
|
methods.forEach(function(method) {
|
|
25481
|
-
app[method] = function(
|
|
25481
|
+
app[method] = function(path6) {
|
|
25482
25482
|
if (method === "get" && arguments.length === 1) {
|
|
25483
|
-
return this.set(
|
|
25483
|
+
return this.set(path6);
|
|
25484
25484
|
}
|
|
25485
25485
|
this.lazyrouter();
|
|
25486
|
-
var route = this._router.route(
|
|
25486
|
+
var route = this._router.route(path6);
|
|
25487
25487
|
route[method].apply(route, slice.call(arguments, 1));
|
|
25488
25488
|
return this;
|
|
25489
25489
|
};
|
|
25490
25490
|
});
|
|
25491
|
-
app.all = function all(
|
|
25491
|
+
app.all = function all(path6) {
|
|
25492
25492
|
this.lazyrouter();
|
|
25493
|
-
var route = this._router.route(
|
|
25493
|
+
var route = this._router.route(path6);
|
|
25494
25494
|
var args = slice.call(arguments, 1);
|
|
25495
25495
|
for (var i = 0; i < methods.length; i++) {
|
|
25496
25496
|
route[methods[i]].apply(route, args);
|
|
@@ -26249,7 +26249,7 @@ var require_request = __commonJS({
|
|
|
26249
26249
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
26250
26250
|
return subdomains2.slice(offset);
|
|
26251
26251
|
});
|
|
26252
|
-
defineGetter(req, "path", function
|
|
26252
|
+
defineGetter(req, "path", function path6() {
|
|
26253
26253
|
return parse3(this).pathname;
|
|
26254
26254
|
});
|
|
26255
26255
|
defineGetter(req, "hostname", function hostname3() {
|
|
@@ -26571,7 +26571,7 @@ var require_response = __commonJS({
|
|
|
26571
26571
|
var http2 = require("http");
|
|
26572
26572
|
var isAbsolute = require_utils2().isAbsolute;
|
|
26573
26573
|
var onFinished = require_on_finished();
|
|
26574
|
-
var
|
|
26574
|
+
var path6 = require("path");
|
|
26575
26575
|
var statuses = require_statuses();
|
|
26576
26576
|
var merge2 = require_utils_merge();
|
|
26577
26577
|
var sign = require_cookie_signature().sign;
|
|
@@ -26580,9 +26580,9 @@ var require_response = __commonJS({
|
|
|
26580
26580
|
var setCharset = require_utils2().setCharset;
|
|
26581
26581
|
var cookie = require_cookie();
|
|
26582
26582
|
var send = require_send();
|
|
26583
|
-
var extname =
|
|
26583
|
+
var extname = path6.extname;
|
|
26584
26584
|
var mime = send.mime;
|
|
26585
|
-
var resolve =
|
|
26585
|
+
var resolve = path6.resolve;
|
|
26586
26586
|
var vary = require_vary();
|
|
26587
26587
|
var res = Object.create(http2.ServerResponse.prototype);
|
|
26588
26588
|
module2.exports = res;
|
|
@@ -26759,26 +26759,26 @@ var require_response = __commonJS({
|
|
|
26759
26759
|
this.type("txt");
|
|
26760
26760
|
return this.send(body);
|
|
26761
26761
|
};
|
|
26762
|
-
res.sendFile = function sendFile(
|
|
26762
|
+
res.sendFile = function sendFile(path7, options, callback) {
|
|
26763
26763
|
var done = callback;
|
|
26764
26764
|
var req = this.req;
|
|
26765
26765
|
var res2 = this;
|
|
26766
26766
|
var next = req.next;
|
|
26767
26767
|
var opts = options || {};
|
|
26768
|
-
if (!
|
|
26768
|
+
if (!path7) {
|
|
26769
26769
|
throw new TypeError("path argument is required to res.sendFile");
|
|
26770
26770
|
}
|
|
26771
|
-
if (typeof
|
|
26771
|
+
if (typeof path7 !== "string") {
|
|
26772
26772
|
throw new TypeError("path must be a string to res.sendFile");
|
|
26773
26773
|
}
|
|
26774
26774
|
if (typeof options === "function") {
|
|
26775
26775
|
done = options;
|
|
26776
26776
|
opts = {};
|
|
26777
26777
|
}
|
|
26778
|
-
if (!opts.root && !isAbsolute(
|
|
26778
|
+
if (!opts.root && !isAbsolute(path7)) {
|
|
26779
26779
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
26780
26780
|
}
|
|
26781
|
-
var pathname = encodeURI(
|
|
26781
|
+
var pathname = encodeURI(path7);
|
|
26782
26782
|
var file2 = send(req, pathname, opts);
|
|
26783
26783
|
sendfile(res2, file2, opts, function(err) {
|
|
26784
26784
|
if (done) return done(err);
|
|
@@ -26788,7 +26788,7 @@ var require_response = __commonJS({
|
|
|
26788
26788
|
}
|
|
26789
26789
|
});
|
|
26790
26790
|
};
|
|
26791
|
-
res.sendfile = function(
|
|
26791
|
+
res.sendfile = function(path7, options, callback) {
|
|
26792
26792
|
var done = callback;
|
|
26793
26793
|
var req = this.req;
|
|
26794
26794
|
var res2 = this;
|
|
@@ -26798,7 +26798,7 @@ var require_response = __commonJS({
|
|
|
26798
26798
|
done = options;
|
|
26799
26799
|
opts = {};
|
|
26800
26800
|
}
|
|
26801
|
-
var file2 = send(req,
|
|
26801
|
+
var file2 = send(req, path7, opts);
|
|
26802
26802
|
sendfile(res2, file2, opts, function(err) {
|
|
26803
26803
|
if (done) return done(err);
|
|
26804
26804
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -26811,7 +26811,7 @@ var require_response = __commonJS({
|
|
|
26811
26811
|
res.sendfile,
|
|
26812
26812
|
"res.sendfile: Use res.sendFile instead"
|
|
26813
26813
|
);
|
|
26814
|
-
res.download = function download(
|
|
26814
|
+
res.download = function download(path7, filename, options, callback) {
|
|
26815
26815
|
var done = callback;
|
|
26816
26816
|
var name = filename;
|
|
26817
26817
|
var opts = options || null;
|
|
@@ -26828,7 +26828,7 @@ var require_response = __commonJS({
|
|
|
26828
26828
|
opts = filename;
|
|
26829
26829
|
}
|
|
26830
26830
|
var headers = {
|
|
26831
|
-
"Content-Disposition": contentDisposition(name ||
|
|
26831
|
+
"Content-Disposition": contentDisposition(name || path7)
|
|
26832
26832
|
};
|
|
26833
26833
|
if (opts && opts.headers) {
|
|
26834
26834
|
var keys = Object.keys(opts.headers);
|
|
@@ -26841,7 +26841,7 @@ var require_response = __commonJS({
|
|
|
26841
26841
|
}
|
|
26842
26842
|
opts = Object.create(opts);
|
|
26843
26843
|
opts.headers = headers;
|
|
26844
|
-
var fullPath = !opts.root ? resolve(
|
|
26844
|
+
var fullPath = !opts.root ? resolve(path7) : path7;
|
|
26845
26845
|
return this.sendFile(fullPath, opts, done);
|
|
26846
26846
|
};
|
|
26847
26847
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -27142,11 +27142,11 @@ var require_serve_static = __commonJS({
|
|
|
27142
27142
|
}
|
|
27143
27143
|
var forwardError = !fallthrough;
|
|
27144
27144
|
var originalUrl = parseUrl.original(req);
|
|
27145
|
-
var
|
|
27146
|
-
if (
|
|
27147
|
-
|
|
27145
|
+
var path6 = parseUrl(req).pathname;
|
|
27146
|
+
if (path6 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
27147
|
+
path6 = "";
|
|
27148
27148
|
}
|
|
27149
|
-
var stream = send(req,
|
|
27149
|
+
var stream = send(req, path6, opts);
|
|
27150
27150
|
stream.on("directory", onDirectory);
|
|
27151
27151
|
if (setHeaders) {
|
|
27152
27152
|
stream.on("headers", setHeaders);
|
|
@@ -45002,11 +45002,11 @@ var require_mime_types2 = __commonJS({
|
|
|
45002
45002
|
}
|
|
45003
45003
|
return exts[0];
|
|
45004
45004
|
}
|
|
45005
|
-
function lookup(
|
|
45006
|
-
if (!
|
|
45005
|
+
function lookup(path6) {
|
|
45006
|
+
if (!path6 || typeof path6 !== "string") {
|
|
45007
45007
|
return false;
|
|
45008
45008
|
}
|
|
45009
|
-
var extension3 = extname("x." +
|
|
45009
|
+
var extension3 = extname("x." + path6).toLowerCase().slice(1);
|
|
45010
45010
|
if (!extension3) {
|
|
45011
45011
|
return false;
|
|
45012
45012
|
}
|
|
@@ -45820,13 +45820,13 @@ var require_view2 = __commonJS({
|
|
|
45820
45820
|
"node_modules/@telepath-computer/tool-router/node_modules/express/lib/view.js"(exports2, module2) {
|
|
45821
45821
|
"use strict";
|
|
45822
45822
|
var debug = require_src5()("express:view");
|
|
45823
|
-
var
|
|
45823
|
+
var path6 = require("node:path");
|
|
45824
45824
|
var fs = require("node:fs");
|
|
45825
|
-
var dirname =
|
|
45826
|
-
var basename =
|
|
45827
|
-
var extname =
|
|
45828
|
-
var join2 =
|
|
45829
|
-
var resolve =
|
|
45825
|
+
var dirname = path6.dirname;
|
|
45826
|
+
var basename = path6.basename;
|
|
45827
|
+
var extname = path6.extname;
|
|
45828
|
+
var join2 = path6.join;
|
|
45829
|
+
var resolve = path6.resolve;
|
|
45830
45830
|
module2.exports = View;
|
|
45831
45831
|
function View(name, options) {
|
|
45832
45832
|
var opts = options || {};
|
|
@@ -45855,17 +45855,17 @@ var require_view2 = __commonJS({
|
|
|
45855
45855
|
this.path = this.lookup(fileName);
|
|
45856
45856
|
}
|
|
45857
45857
|
View.prototype.lookup = function lookup(name) {
|
|
45858
|
-
var
|
|
45858
|
+
var path7;
|
|
45859
45859
|
var roots = [].concat(this.root);
|
|
45860
45860
|
debug('lookup "%s"', name);
|
|
45861
|
-
for (var i = 0; i < roots.length && !
|
|
45861
|
+
for (var i = 0; i < roots.length && !path7; i++) {
|
|
45862
45862
|
var root = roots[i];
|
|
45863
45863
|
var loc = resolve(root, name);
|
|
45864
45864
|
var dir = dirname(loc);
|
|
45865
45865
|
var file2 = basename(loc);
|
|
45866
|
-
|
|
45866
|
+
path7 = this.resolve(dir, file2);
|
|
45867
45867
|
}
|
|
45868
|
-
return
|
|
45868
|
+
return path7;
|
|
45869
45869
|
};
|
|
45870
45870
|
View.prototype.render = function render(options, callback) {
|
|
45871
45871
|
var sync = true;
|
|
@@ -45887,21 +45887,21 @@ var require_view2 = __commonJS({
|
|
|
45887
45887
|
};
|
|
45888
45888
|
View.prototype.resolve = function resolve2(dir, file2) {
|
|
45889
45889
|
var ext = this.ext;
|
|
45890
|
-
var
|
|
45891
|
-
var stat = tryStat(
|
|
45890
|
+
var path7 = join2(dir, file2);
|
|
45891
|
+
var stat = tryStat(path7);
|
|
45892
45892
|
if (stat && stat.isFile()) {
|
|
45893
|
-
return
|
|
45893
|
+
return path7;
|
|
45894
45894
|
}
|
|
45895
|
-
|
|
45896
|
-
stat = tryStat(
|
|
45895
|
+
path7 = join2(dir, basename(file2, ext), "index" + ext);
|
|
45896
|
+
stat = tryStat(path7);
|
|
45897
45897
|
if (stat && stat.isFile()) {
|
|
45898
|
-
return
|
|
45898
|
+
return path7;
|
|
45899
45899
|
}
|
|
45900
45900
|
};
|
|
45901
|
-
function tryStat(
|
|
45902
|
-
debug('stat "%s"',
|
|
45901
|
+
function tryStat(path7) {
|
|
45902
|
+
debug('stat "%s"', path7);
|
|
45903
45903
|
try {
|
|
45904
|
-
return fs.statSync(
|
|
45904
|
+
return fs.statSync(path7);
|
|
45905
45905
|
} catch (e) {
|
|
45906
45906
|
return void 0;
|
|
45907
45907
|
}
|
|
@@ -46217,15 +46217,15 @@ var require_dist = __commonJS({
|
|
|
46217
46217
|
if (token.type === endType)
|
|
46218
46218
|
break;
|
|
46219
46219
|
if (token.type === "char" || token.type === "escape") {
|
|
46220
|
-
let
|
|
46220
|
+
let path6 = token.value;
|
|
46221
46221
|
let cur = tokens[pos];
|
|
46222
46222
|
while (cur.type === "char" || cur.type === "escape") {
|
|
46223
|
-
|
|
46223
|
+
path6 += cur.value;
|
|
46224
46224
|
cur = tokens[++pos];
|
|
46225
46225
|
}
|
|
46226
46226
|
output.push({
|
|
46227
46227
|
type: "text",
|
|
46228
|
-
value: encodePath(
|
|
46228
|
+
value: encodePath(path6)
|
|
46229
46229
|
});
|
|
46230
46230
|
continue;
|
|
46231
46231
|
}
|
|
@@ -46249,16 +46249,16 @@ var require_dist = __commonJS({
|
|
|
46249
46249
|
}
|
|
46250
46250
|
return new TokenData(consumeUntil("end"), str);
|
|
46251
46251
|
}
|
|
46252
|
-
function compile(
|
|
46252
|
+
function compile(path6, options = {}) {
|
|
46253
46253
|
const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
46254
|
-
const data = typeof
|
|
46254
|
+
const data = typeof path6 === "object" ? path6 : parse3(path6, options);
|
|
46255
46255
|
const fn = tokensToFunction(data.tokens, delimiter, encode3);
|
|
46256
|
-
return function
|
|
46257
|
-
const [
|
|
46256
|
+
return function path7(params = {}) {
|
|
46257
|
+
const [path8, ...missing] = fn(params);
|
|
46258
46258
|
if (missing.length) {
|
|
46259
46259
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
46260
46260
|
}
|
|
46261
|
-
return
|
|
46261
|
+
return path8;
|
|
46262
46262
|
};
|
|
46263
46263
|
}
|
|
46264
46264
|
function tokensToFunction(tokens, delimiter, encode3) {
|
|
@@ -46314,9 +46314,9 @@ var require_dist = __commonJS({
|
|
|
46314
46314
|
return [encodeValue(value)];
|
|
46315
46315
|
};
|
|
46316
46316
|
}
|
|
46317
|
-
function match(
|
|
46317
|
+
function match(path6, options = {}) {
|
|
46318
46318
|
const { decode: decode3 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
46319
|
-
const { regexp, keys } = pathToRegexp(
|
|
46319
|
+
const { regexp, keys } = pathToRegexp(path6, options);
|
|
46320
46320
|
const decoders = keys.map((key) => {
|
|
46321
46321
|
if (decode3 === false)
|
|
46322
46322
|
return NOOP_VALUE;
|
|
@@ -46328,7 +46328,7 @@ var require_dist = __commonJS({
|
|
|
46328
46328
|
const m2 = regexp.exec(input);
|
|
46329
46329
|
if (!m2)
|
|
46330
46330
|
return false;
|
|
46331
|
-
const
|
|
46331
|
+
const path7 = m2[0];
|
|
46332
46332
|
const params = /* @__PURE__ */ Object.create(null);
|
|
46333
46333
|
for (let i = 1; i < m2.length; i++) {
|
|
46334
46334
|
if (m2[i] === void 0)
|
|
@@ -46337,22 +46337,22 @@ var require_dist = __commonJS({
|
|
|
46337
46337
|
const decoder = decoders[i - 1];
|
|
46338
46338
|
params[key.name] = decoder(m2[i]);
|
|
46339
46339
|
}
|
|
46340
|
-
return { path:
|
|
46340
|
+
return { path: path7, params };
|
|
46341
46341
|
};
|
|
46342
46342
|
}
|
|
46343
|
-
function pathToRegexp(
|
|
46343
|
+
function pathToRegexp(path6, options = {}) {
|
|
46344
46344
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
46345
46345
|
const keys = [];
|
|
46346
46346
|
const sources = [];
|
|
46347
|
-
const paths = [
|
|
46347
|
+
const paths = [path6];
|
|
46348
46348
|
let combinations = 0;
|
|
46349
46349
|
while (paths.length) {
|
|
46350
|
-
const
|
|
46351
|
-
if (Array.isArray(
|
|
46352
|
-
paths.push(...
|
|
46350
|
+
const path7 = paths.shift();
|
|
46351
|
+
if (Array.isArray(path7)) {
|
|
46352
|
+
paths.push(...path7);
|
|
46353
46353
|
continue;
|
|
46354
46354
|
}
|
|
46355
|
-
const data = typeof
|
|
46355
|
+
const data = typeof path7 === "object" ? path7 : parse3(path7, options);
|
|
46356
46356
|
flatten(data.tokens, 0, [], (tokens) => {
|
|
46357
46357
|
if (combinations++ >= 256) {
|
|
46358
46358
|
throw new PathError("Too many path combinations", data.originalPath);
|
|
@@ -46497,18 +46497,18 @@ var require_layer2 = __commonJS({
|
|
|
46497
46497
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
46498
46498
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
46499
46499
|
module2.exports = Layer;
|
|
46500
|
-
function Layer(
|
|
46500
|
+
function Layer(path6, options, fn) {
|
|
46501
46501
|
if (!(this instanceof Layer)) {
|
|
46502
|
-
return new Layer(
|
|
46502
|
+
return new Layer(path6, options, fn);
|
|
46503
46503
|
}
|
|
46504
|
-
debug("new %o",
|
|
46504
|
+
debug("new %o", path6);
|
|
46505
46505
|
const opts = options || {};
|
|
46506
46506
|
this.handle = fn;
|
|
46507
46507
|
this.keys = [];
|
|
46508
46508
|
this.name = fn.name || "<anonymous>";
|
|
46509
46509
|
this.params = void 0;
|
|
46510
46510
|
this.path = void 0;
|
|
46511
|
-
this.slash =
|
|
46511
|
+
this.slash = path6 === "/" && opts.end === false;
|
|
46512
46512
|
function matcher(_path) {
|
|
46513
46513
|
if (_path instanceof RegExp) {
|
|
46514
46514
|
const keys = [];
|
|
@@ -46547,7 +46547,7 @@ var require_layer2 = __commonJS({
|
|
|
46547
46547
|
decode: decodeParam
|
|
46548
46548
|
});
|
|
46549
46549
|
}
|
|
46550
|
-
this.matchers = Array.isArray(
|
|
46550
|
+
this.matchers = Array.isArray(path6) ? path6.map(matcher) : [matcher(path6)];
|
|
46551
46551
|
}
|
|
46552
46552
|
Layer.prototype.handleError = function handleError(error2, req, res, next) {
|
|
46553
46553
|
const fn = this.handle;
|
|
@@ -46587,9 +46587,9 @@ var require_layer2 = __commonJS({
|
|
|
46587
46587
|
next(err);
|
|
46588
46588
|
}
|
|
46589
46589
|
};
|
|
46590
|
-
Layer.prototype.match = function match(
|
|
46590
|
+
Layer.prototype.match = function match(path6) {
|
|
46591
46591
|
let match2;
|
|
46592
|
-
if (
|
|
46592
|
+
if (path6 != null) {
|
|
46593
46593
|
if (this.slash) {
|
|
46594
46594
|
this.params = {};
|
|
46595
46595
|
this.path = "";
|
|
@@ -46597,7 +46597,7 @@ var require_layer2 = __commonJS({
|
|
|
46597
46597
|
}
|
|
46598
46598
|
let i = 0;
|
|
46599
46599
|
while (!match2 && i < this.matchers.length) {
|
|
46600
|
-
match2 = this.matchers[i](
|
|
46600
|
+
match2 = this.matchers[i](path6);
|
|
46601
46601
|
i++;
|
|
46602
46602
|
}
|
|
46603
46603
|
}
|
|
@@ -46625,13 +46625,13 @@ var require_layer2 = __commonJS({
|
|
|
46625
46625
|
throw err;
|
|
46626
46626
|
}
|
|
46627
46627
|
}
|
|
46628
|
-
function loosen(
|
|
46629
|
-
if (
|
|
46630
|
-
return
|
|
46628
|
+
function loosen(path6) {
|
|
46629
|
+
if (path6 instanceof RegExp || path6 === "/") {
|
|
46630
|
+
return path6;
|
|
46631
46631
|
}
|
|
46632
|
-
return Array.isArray(
|
|
46632
|
+
return Array.isArray(path6) ? path6.map(function(p) {
|
|
46633
46633
|
return loosen(p);
|
|
46634
|
-
}) : String(
|
|
46634
|
+
}) : String(path6).replace(TRAILING_SLASH_REGEXP, "");
|
|
46635
46635
|
}
|
|
46636
46636
|
}
|
|
46637
46637
|
});
|
|
@@ -46647,9 +46647,9 @@ var require_route2 = __commonJS({
|
|
|
46647
46647
|
var flatten = Array.prototype.flat;
|
|
46648
46648
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
46649
46649
|
module2.exports = Route;
|
|
46650
|
-
function Route(
|
|
46651
|
-
debug("new %o",
|
|
46652
|
-
this.path =
|
|
46650
|
+
function Route(path6) {
|
|
46651
|
+
debug("new %o", path6);
|
|
46652
|
+
this.path = path6;
|
|
46653
46653
|
this.stack = [];
|
|
46654
46654
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
46655
46655
|
}
|
|
@@ -46857,8 +46857,8 @@ var require_router2 = __commonJS({
|
|
|
46857
46857
|
if (++sync > 100) {
|
|
46858
46858
|
return setImmediate(next, err);
|
|
46859
46859
|
}
|
|
46860
|
-
const
|
|
46861
|
-
if (
|
|
46860
|
+
const path6 = getPathname(req);
|
|
46861
|
+
if (path6 == null) {
|
|
46862
46862
|
return done(layerError);
|
|
46863
46863
|
}
|
|
46864
46864
|
let layer;
|
|
@@ -46866,7 +46866,7 @@ var require_router2 = __commonJS({
|
|
|
46866
46866
|
let route;
|
|
46867
46867
|
while (match !== true && idx < stack.length) {
|
|
46868
46868
|
layer = stack[idx++];
|
|
46869
|
-
match = matchLayer(layer,
|
|
46869
|
+
match = matchLayer(layer, path6);
|
|
46870
46870
|
route = layer.route;
|
|
46871
46871
|
if (typeof match !== "boolean") {
|
|
46872
46872
|
layerError = layerError || match;
|
|
@@ -46904,18 +46904,18 @@ var require_router2 = __commonJS({
|
|
|
46904
46904
|
} else if (route) {
|
|
46905
46905
|
layer.handleRequest(req, res, next);
|
|
46906
46906
|
} else {
|
|
46907
|
-
trimPrefix(layer, layerError, layerPath,
|
|
46907
|
+
trimPrefix(layer, layerError, layerPath, path6);
|
|
46908
46908
|
}
|
|
46909
46909
|
sync = 0;
|
|
46910
46910
|
});
|
|
46911
46911
|
}
|
|
46912
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
46912
|
+
function trimPrefix(layer, layerError, layerPath, path6) {
|
|
46913
46913
|
if (layerPath.length !== 0) {
|
|
46914
|
-
if (layerPath !==
|
|
46914
|
+
if (layerPath !== path6.substring(0, layerPath.length)) {
|
|
46915
46915
|
next(layerError);
|
|
46916
46916
|
return;
|
|
46917
46917
|
}
|
|
46918
|
-
const c =
|
|
46918
|
+
const c = path6[layerPath.length];
|
|
46919
46919
|
if (c && c !== "/") {
|
|
46920
46920
|
next(layerError);
|
|
46921
46921
|
return;
|
|
@@ -46939,7 +46939,7 @@ var require_router2 = __commonJS({
|
|
|
46939
46939
|
};
|
|
46940
46940
|
Router2.prototype.use = function use(handler) {
|
|
46941
46941
|
let offset = 0;
|
|
46942
|
-
let
|
|
46942
|
+
let path6 = "/";
|
|
46943
46943
|
if (typeof handler !== "function") {
|
|
46944
46944
|
let arg = handler;
|
|
46945
46945
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -46947,7 +46947,7 @@ var require_router2 = __commonJS({
|
|
|
46947
46947
|
}
|
|
46948
46948
|
if (typeof arg !== "function") {
|
|
46949
46949
|
offset = 1;
|
|
46950
|
-
|
|
46950
|
+
path6 = handler;
|
|
46951
46951
|
}
|
|
46952
46952
|
}
|
|
46953
46953
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -46959,8 +46959,8 @@ var require_router2 = __commonJS({
|
|
|
46959
46959
|
if (typeof fn !== "function") {
|
|
46960
46960
|
throw new TypeError("argument handler must be a function");
|
|
46961
46961
|
}
|
|
46962
|
-
debug("use %o %s",
|
|
46963
|
-
const layer = new Layer(
|
|
46962
|
+
debug("use %o %s", path6, fn.name || "<anonymous>");
|
|
46963
|
+
const layer = new Layer(path6, {
|
|
46964
46964
|
sensitive: this.caseSensitive,
|
|
46965
46965
|
strict: false,
|
|
46966
46966
|
end: false
|
|
@@ -46970,9 +46970,9 @@ var require_router2 = __commonJS({
|
|
|
46970
46970
|
}
|
|
46971
46971
|
return this;
|
|
46972
46972
|
};
|
|
46973
|
-
Router2.prototype.route = function route(
|
|
46974
|
-
const route2 = new Route(
|
|
46975
|
-
const layer = new Layer(
|
|
46973
|
+
Router2.prototype.route = function route(path6) {
|
|
46974
|
+
const route2 = new Route(path6);
|
|
46975
|
+
const layer = new Layer(path6, {
|
|
46976
46976
|
sensitive: this.caseSensitive,
|
|
46977
46977
|
strict: this.strict,
|
|
46978
46978
|
end: true
|
|
@@ -46985,8 +46985,8 @@ var require_router2 = __commonJS({
|
|
|
46985
46985
|
return route2;
|
|
46986
46986
|
};
|
|
46987
46987
|
methods.concat("all").forEach(function(method) {
|
|
46988
|
-
Router2.prototype[method] = function(
|
|
46989
|
-
const route = this.route(
|
|
46988
|
+
Router2.prototype[method] = function(path6) {
|
|
46989
|
+
const route = this.route(path6);
|
|
46990
46990
|
route[method].apply(route, slice.call(arguments, 1));
|
|
46991
46991
|
return this;
|
|
46992
46992
|
};
|
|
@@ -47015,9 +47015,9 @@ var require_router2 = __commonJS({
|
|
|
47015
47015
|
const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
|
|
47016
47016
|
return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
47017
47017
|
}
|
|
47018
|
-
function matchLayer(layer,
|
|
47018
|
+
function matchLayer(layer, path6) {
|
|
47019
47019
|
try {
|
|
47020
|
-
return layer.match(
|
|
47020
|
+
return layer.match(path6);
|
|
47021
47021
|
} catch (err) {
|
|
47022
47022
|
return err;
|
|
47023
47023
|
}
|
|
@@ -47245,7 +47245,7 @@ var require_application2 = __commonJS({
|
|
|
47245
47245
|
};
|
|
47246
47246
|
app.use = function use(fn) {
|
|
47247
47247
|
var offset = 0;
|
|
47248
|
-
var
|
|
47248
|
+
var path6 = "/";
|
|
47249
47249
|
if (typeof fn !== "function") {
|
|
47250
47250
|
var arg = fn;
|
|
47251
47251
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -47253,7 +47253,7 @@ var require_application2 = __commonJS({
|
|
|
47253
47253
|
}
|
|
47254
47254
|
if (typeof arg !== "function") {
|
|
47255
47255
|
offset = 1;
|
|
47256
|
-
|
|
47256
|
+
path6 = fn;
|
|
47257
47257
|
}
|
|
47258
47258
|
}
|
|
47259
47259
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -47263,12 +47263,12 @@ var require_application2 = __commonJS({
|
|
|
47263
47263
|
var router = this.router;
|
|
47264
47264
|
fns.forEach(function(fn2) {
|
|
47265
47265
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
47266
|
-
return router.use(
|
|
47266
|
+
return router.use(path6, fn2);
|
|
47267
47267
|
}
|
|
47268
|
-
debug(".use app under %s",
|
|
47269
|
-
fn2.mountpath =
|
|
47268
|
+
debug(".use app under %s", path6);
|
|
47269
|
+
fn2.mountpath = path6;
|
|
47270
47270
|
fn2.parent = this;
|
|
47271
|
-
router.use(
|
|
47271
|
+
router.use(path6, function mounted_app(req, res, next) {
|
|
47272
47272
|
var orig = req.app;
|
|
47273
47273
|
fn2.handle(req, res, function(err) {
|
|
47274
47274
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -47280,8 +47280,8 @@ var require_application2 = __commonJS({
|
|
|
47280
47280
|
}, this);
|
|
47281
47281
|
return this;
|
|
47282
47282
|
};
|
|
47283
|
-
app.route = function route(
|
|
47284
|
-
return this.router.route(
|
|
47283
|
+
app.route = function route(path6) {
|
|
47284
|
+
return this.router.route(path6);
|
|
47285
47285
|
};
|
|
47286
47286
|
app.engine = function engine(ext, fn) {
|
|
47287
47287
|
if (typeof fn !== "function") {
|
|
@@ -47324,7 +47324,7 @@ var require_application2 = __commonJS({
|
|
|
47324
47324
|
}
|
|
47325
47325
|
return this;
|
|
47326
47326
|
};
|
|
47327
|
-
app.path = function
|
|
47327
|
+
app.path = function path6() {
|
|
47328
47328
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
47329
47329
|
};
|
|
47330
47330
|
app.enabled = function enabled(setting) {
|
|
@@ -47340,17 +47340,17 @@ var require_application2 = __commonJS({
|
|
|
47340
47340
|
return this.set(setting, false);
|
|
47341
47341
|
};
|
|
47342
47342
|
methods.forEach(function(method) {
|
|
47343
|
-
app[method] = function(
|
|
47343
|
+
app[method] = function(path6) {
|
|
47344
47344
|
if (method === "get" && arguments.length === 1) {
|
|
47345
|
-
return this.set(
|
|
47345
|
+
return this.set(path6);
|
|
47346
47346
|
}
|
|
47347
|
-
var route = this.route(
|
|
47347
|
+
var route = this.route(path6);
|
|
47348
47348
|
route[method].apply(route, slice.call(arguments, 1));
|
|
47349
47349
|
return this;
|
|
47350
47350
|
};
|
|
47351
47351
|
});
|
|
47352
|
-
app.all = function all(
|
|
47353
|
-
var route = this.route(
|
|
47352
|
+
app.all = function all(path6) {
|
|
47353
|
+
var route = this.route(path6);
|
|
47354
47354
|
var args = slice.call(arguments, 1);
|
|
47355
47355
|
for (var i = 0; i < methods.length; i++) {
|
|
47356
47356
|
route[methods[i]].apply(route, args);
|
|
@@ -48179,7 +48179,7 @@ var require_request2 = __commonJS({
|
|
|
48179
48179
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
48180
48180
|
return subdomains2.slice(offset);
|
|
48181
48181
|
});
|
|
48182
|
-
defineGetter(req, "path", function
|
|
48182
|
+
defineGetter(req, "path", function path6() {
|
|
48183
48183
|
return parse3(this).pathname;
|
|
48184
48184
|
});
|
|
48185
48185
|
defineGetter(req, "host", function host() {
|
|
@@ -48425,27 +48425,27 @@ var require_send2 = __commonJS({
|
|
|
48425
48425
|
var ms = require_ms5();
|
|
48426
48426
|
var onFinished = require_on_finished();
|
|
48427
48427
|
var parseRange = require_range_parser();
|
|
48428
|
-
var
|
|
48428
|
+
var path6 = require("path");
|
|
48429
48429
|
var statuses = require_statuses();
|
|
48430
48430
|
var Stream = require("stream");
|
|
48431
48431
|
var util2 = require("util");
|
|
48432
|
-
var extname =
|
|
48433
|
-
var join2 =
|
|
48434
|
-
var normalize =
|
|
48435
|
-
var resolve =
|
|
48436
|
-
var sep =
|
|
48432
|
+
var extname = path6.extname;
|
|
48433
|
+
var join2 = path6.join;
|
|
48434
|
+
var normalize = path6.normalize;
|
|
48435
|
+
var resolve = path6.resolve;
|
|
48436
|
+
var sep = path6.sep;
|
|
48437
48437
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
48438
48438
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
48439
48439
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
48440
48440
|
module2.exports = send;
|
|
48441
|
-
function send(req,
|
|
48442
|
-
return new SendStream(req,
|
|
48441
|
+
function send(req, path7, options) {
|
|
48442
|
+
return new SendStream(req, path7, options);
|
|
48443
48443
|
}
|
|
48444
|
-
function SendStream(req,
|
|
48444
|
+
function SendStream(req, path7, options) {
|
|
48445
48445
|
Stream.call(this);
|
|
48446
48446
|
var opts = options || {};
|
|
48447
48447
|
this.options = opts;
|
|
48448
|
-
this.path =
|
|
48448
|
+
this.path = path7;
|
|
48449
48449
|
this.req = req;
|
|
48450
48450
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
48451
48451
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -48559,10 +48559,10 @@ var require_send2 = __commonJS({
|
|
|
48559
48559
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
48560
48560
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
48561
48561
|
};
|
|
48562
|
-
SendStream.prototype.redirect = function redirect(
|
|
48562
|
+
SendStream.prototype.redirect = function redirect(path7) {
|
|
48563
48563
|
var res = this.res;
|
|
48564
48564
|
if (hasListeners(this, "directory")) {
|
|
48565
|
-
this.emit("directory", res,
|
|
48565
|
+
this.emit("directory", res, path7);
|
|
48566
48566
|
return;
|
|
48567
48567
|
}
|
|
48568
48568
|
if (this.hasTrailingSlash()) {
|
|
@@ -48582,38 +48582,38 @@ var require_send2 = __commonJS({
|
|
|
48582
48582
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
48583
48583
|
var root = this._root;
|
|
48584
48584
|
this.res = res;
|
|
48585
|
-
var
|
|
48586
|
-
if (
|
|
48585
|
+
var path7 = decode3(this.path);
|
|
48586
|
+
if (path7 === -1) {
|
|
48587
48587
|
this.error(400);
|
|
48588
48588
|
return res;
|
|
48589
48589
|
}
|
|
48590
|
-
if (~
|
|
48590
|
+
if (~path7.indexOf("\0")) {
|
|
48591
48591
|
this.error(400);
|
|
48592
48592
|
return res;
|
|
48593
48593
|
}
|
|
48594
48594
|
var parts;
|
|
48595
48595
|
if (root !== null) {
|
|
48596
|
-
if (
|
|
48597
|
-
|
|
48596
|
+
if (path7) {
|
|
48597
|
+
path7 = normalize("." + sep + path7);
|
|
48598
48598
|
}
|
|
48599
|
-
if (UP_PATH_REGEXP.test(
|
|
48600
|
-
debug('malicious path "%s"',
|
|
48599
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
48600
|
+
debug('malicious path "%s"', path7);
|
|
48601
48601
|
this.error(403);
|
|
48602
48602
|
return res;
|
|
48603
48603
|
}
|
|
48604
|
-
parts =
|
|
48605
|
-
|
|
48604
|
+
parts = path7.split(sep);
|
|
48605
|
+
path7 = normalize(join2(root, path7));
|
|
48606
48606
|
} else {
|
|
48607
|
-
if (UP_PATH_REGEXP.test(
|
|
48608
|
-
debug('malicious path "%s"',
|
|
48607
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
48608
|
+
debug('malicious path "%s"', path7);
|
|
48609
48609
|
this.error(403);
|
|
48610
48610
|
return res;
|
|
48611
48611
|
}
|
|
48612
|
-
parts = normalize(
|
|
48613
|
-
|
|
48612
|
+
parts = normalize(path7).split(sep);
|
|
48613
|
+
path7 = resolve(path7);
|
|
48614
48614
|
}
|
|
48615
48615
|
if (containsDotFile(parts)) {
|
|
48616
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
48616
|
+
debug('%s dotfile "%s"', this._dotfiles, path7);
|
|
48617
48617
|
switch (this._dotfiles) {
|
|
48618
48618
|
case "allow":
|
|
48619
48619
|
break;
|
|
@@ -48627,13 +48627,13 @@ var require_send2 = __commonJS({
|
|
|
48627
48627
|
}
|
|
48628
48628
|
}
|
|
48629
48629
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
48630
|
-
this.sendIndex(
|
|
48630
|
+
this.sendIndex(path7);
|
|
48631
48631
|
return res;
|
|
48632
48632
|
}
|
|
48633
|
-
this.sendFile(
|
|
48633
|
+
this.sendFile(path7);
|
|
48634
48634
|
return res;
|
|
48635
48635
|
};
|
|
48636
|
-
SendStream.prototype.send = function send2(
|
|
48636
|
+
SendStream.prototype.send = function send2(path7, stat) {
|
|
48637
48637
|
var len = stat.size;
|
|
48638
48638
|
var options = this.options;
|
|
48639
48639
|
var opts = {};
|
|
@@ -48645,9 +48645,9 @@ var require_send2 = __commonJS({
|
|
|
48645
48645
|
this.headersAlreadySent();
|
|
48646
48646
|
return;
|
|
48647
48647
|
}
|
|
48648
|
-
debug('pipe "%s"',
|
|
48649
|
-
this.setHeader(
|
|
48650
|
-
this.type(
|
|
48648
|
+
debug('pipe "%s"', path7);
|
|
48649
|
+
this.setHeader(path7, stat);
|
|
48650
|
+
this.type(path7);
|
|
48651
48651
|
if (this.isConditionalGET()) {
|
|
48652
48652
|
if (this.isPreconditionFailure()) {
|
|
48653
48653
|
this.error(412);
|
|
@@ -48696,28 +48696,28 @@ var require_send2 = __commonJS({
|
|
|
48696
48696
|
res.end();
|
|
48697
48697
|
return;
|
|
48698
48698
|
}
|
|
48699
|
-
this.stream(
|
|
48699
|
+
this.stream(path7, opts);
|
|
48700
48700
|
};
|
|
48701
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
48701
|
+
SendStream.prototype.sendFile = function sendFile(path7) {
|
|
48702
48702
|
var i = 0;
|
|
48703
48703
|
var self2 = this;
|
|
48704
|
-
debug('stat "%s"',
|
|
48705
|
-
fs.stat(
|
|
48706
|
-
var pathEndsWithSep =
|
|
48707
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
48704
|
+
debug('stat "%s"', path7);
|
|
48705
|
+
fs.stat(path7, function onstat(err, stat) {
|
|
48706
|
+
var pathEndsWithSep = path7[path7.length - 1] === sep;
|
|
48707
|
+
if (err && err.code === "ENOENT" && !extname(path7) && !pathEndsWithSep) {
|
|
48708
48708
|
return next(err);
|
|
48709
48709
|
}
|
|
48710
48710
|
if (err) return self2.onStatError(err);
|
|
48711
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
48711
|
+
if (stat.isDirectory()) return self2.redirect(path7);
|
|
48712
48712
|
if (pathEndsWithSep) return self2.error(404);
|
|
48713
|
-
self2.emit("file",
|
|
48714
|
-
self2.send(
|
|
48713
|
+
self2.emit("file", path7, stat);
|
|
48714
|
+
self2.send(path7, stat);
|
|
48715
48715
|
});
|
|
48716
48716
|
function next(err) {
|
|
48717
48717
|
if (self2._extensions.length <= i) {
|
|
48718
48718
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
48719
48719
|
}
|
|
48720
|
-
var p =
|
|
48720
|
+
var p = path7 + "." + self2._extensions[i++];
|
|
48721
48721
|
debug('stat "%s"', p);
|
|
48722
48722
|
fs.stat(p, function(err2, stat) {
|
|
48723
48723
|
if (err2) return next(err2);
|
|
@@ -48727,7 +48727,7 @@ var require_send2 = __commonJS({
|
|
|
48727
48727
|
});
|
|
48728
48728
|
}
|
|
48729
48729
|
};
|
|
48730
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
48730
|
+
SendStream.prototype.sendIndex = function sendIndex(path7) {
|
|
48731
48731
|
var i = -1;
|
|
48732
48732
|
var self2 = this;
|
|
48733
48733
|
function next(err) {
|
|
@@ -48735,7 +48735,7 @@ var require_send2 = __commonJS({
|
|
|
48735
48735
|
if (err) return self2.onStatError(err);
|
|
48736
48736
|
return self2.error(404);
|
|
48737
48737
|
}
|
|
48738
|
-
var p = join2(
|
|
48738
|
+
var p = join2(path7, self2._index[i]);
|
|
48739
48739
|
debug('stat "%s"', p);
|
|
48740
48740
|
fs.stat(p, function(err2, stat) {
|
|
48741
48741
|
if (err2) return next(err2);
|
|
@@ -48746,10 +48746,10 @@ var require_send2 = __commonJS({
|
|
|
48746
48746
|
}
|
|
48747
48747
|
next();
|
|
48748
48748
|
};
|
|
48749
|
-
SendStream.prototype.stream = function stream(
|
|
48749
|
+
SendStream.prototype.stream = function stream(path7, options) {
|
|
48750
48750
|
var self2 = this;
|
|
48751
48751
|
var res = this.res;
|
|
48752
|
-
var stream2 = fs.createReadStream(
|
|
48752
|
+
var stream2 = fs.createReadStream(path7, options);
|
|
48753
48753
|
this.emit("stream", stream2);
|
|
48754
48754
|
stream2.pipe(res);
|
|
48755
48755
|
function cleanup() {
|
|
@@ -48764,17 +48764,17 @@ var require_send2 = __commonJS({
|
|
|
48764
48764
|
self2.emit("end");
|
|
48765
48765
|
});
|
|
48766
48766
|
};
|
|
48767
|
-
SendStream.prototype.type = function type(
|
|
48767
|
+
SendStream.prototype.type = function type(path7) {
|
|
48768
48768
|
var res = this.res;
|
|
48769
48769
|
if (res.getHeader("Content-Type")) return;
|
|
48770
|
-
var ext = extname(
|
|
48770
|
+
var ext = extname(path7);
|
|
48771
48771
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
48772
48772
|
debug("content-type %s", type2);
|
|
48773
48773
|
res.setHeader("Content-Type", type2);
|
|
48774
48774
|
};
|
|
48775
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
48775
|
+
SendStream.prototype.setHeader = function setHeader(path7, stat) {
|
|
48776
48776
|
var res = this.res;
|
|
48777
|
-
this.emit("headers", res,
|
|
48777
|
+
this.emit("headers", res, path7, stat);
|
|
48778
48778
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
48779
48779
|
debug("accept ranges");
|
|
48780
48780
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -48832,9 +48832,9 @@ var require_send2 = __commonJS({
|
|
|
48832
48832
|
}
|
|
48833
48833
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
48834
48834
|
}
|
|
48835
|
-
function decode3(
|
|
48835
|
+
function decode3(path7) {
|
|
48836
48836
|
try {
|
|
48837
|
-
return decodeURIComponent(
|
|
48837
|
+
return decodeURIComponent(path7);
|
|
48838
48838
|
} catch (err) {
|
|
48839
48839
|
return -1;
|
|
48840
48840
|
}
|
|
@@ -48905,7 +48905,7 @@ var require_response2 = __commonJS({
|
|
|
48905
48905
|
var http2 = require("node:http");
|
|
48906
48906
|
var onFinished = require_on_finished();
|
|
48907
48907
|
var mime = require_mime_types2();
|
|
48908
|
-
var
|
|
48908
|
+
var path6 = require("node:path");
|
|
48909
48909
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
48910
48910
|
var statuses = require_statuses();
|
|
48911
48911
|
var sign = require_cookie_signature2().sign;
|
|
@@ -48914,8 +48914,8 @@ var require_response2 = __commonJS({
|
|
|
48914
48914
|
var setCharset = require_utils4().setCharset;
|
|
48915
48915
|
var cookie = require_cookie();
|
|
48916
48916
|
var send = require_send2();
|
|
48917
|
-
var extname =
|
|
48918
|
-
var resolve =
|
|
48917
|
+
var extname = path6.extname;
|
|
48918
|
+
var resolve = path6.resolve;
|
|
48919
48919
|
var vary = require_vary();
|
|
48920
48920
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
48921
48921
|
var res = Object.create(http2.ServerResponse.prototype);
|
|
@@ -49061,26 +49061,26 @@ var require_response2 = __commonJS({
|
|
|
49061
49061
|
this.type("txt");
|
|
49062
49062
|
return this.send(body);
|
|
49063
49063
|
};
|
|
49064
|
-
res.sendFile = function sendFile(
|
|
49064
|
+
res.sendFile = function sendFile(path7, options, callback) {
|
|
49065
49065
|
var done = callback;
|
|
49066
49066
|
var req = this.req;
|
|
49067
49067
|
var res2 = this;
|
|
49068
49068
|
var next = req.next;
|
|
49069
49069
|
var opts = options || {};
|
|
49070
|
-
if (!
|
|
49070
|
+
if (!path7) {
|
|
49071
49071
|
throw new TypeError("path argument is required to res.sendFile");
|
|
49072
49072
|
}
|
|
49073
|
-
if (typeof
|
|
49073
|
+
if (typeof path7 !== "string") {
|
|
49074
49074
|
throw new TypeError("path must be a string to res.sendFile");
|
|
49075
49075
|
}
|
|
49076
49076
|
if (typeof options === "function") {
|
|
49077
49077
|
done = options;
|
|
49078
49078
|
opts = {};
|
|
49079
49079
|
}
|
|
49080
|
-
if (!opts.root && !pathIsAbsolute(
|
|
49080
|
+
if (!opts.root && !pathIsAbsolute(path7)) {
|
|
49081
49081
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
49082
49082
|
}
|
|
49083
|
-
var pathname = encodeURI(
|
|
49083
|
+
var pathname = encodeURI(path7);
|
|
49084
49084
|
opts.etag = this.app.enabled("etag");
|
|
49085
49085
|
var file2 = send(req, pathname, opts);
|
|
49086
49086
|
sendfile(res2, file2, opts, function(err) {
|
|
@@ -49091,7 +49091,7 @@ var require_response2 = __commonJS({
|
|
|
49091
49091
|
}
|
|
49092
49092
|
});
|
|
49093
49093
|
};
|
|
49094
|
-
res.download = function download(
|
|
49094
|
+
res.download = function download(path7, filename, options, callback) {
|
|
49095
49095
|
var done = callback;
|
|
49096
49096
|
var name = filename;
|
|
49097
49097
|
var opts = options || null;
|
|
@@ -49108,7 +49108,7 @@ var require_response2 = __commonJS({
|
|
|
49108
49108
|
opts = filename;
|
|
49109
49109
|
}
|
|
49110
49110
|
var headers = {
|
|
49111
|
-
"Content-Disposition": contentDisposition(name ||
|
|
49111
|
+
"Content-Disposition": contentDisposition(name || path7)
|
|
49112
49112
|
};
|
|
49113
49113
|
if (opts && opts.headers) {
|
|
49114
49114
|
var keys = Object.keys(opts.headers);
|
|
@@ -49121,7 +49121,7 @@ var require_response2 = __commonJS({
|
|
|
49121
49121
|
}
|
|
49122
49122
|
opts = Object.create(opts);
|
|
49123
49123
|
opts.headers = headers;
|
|
49124
|
-
var fullPath = !opts.root ? resolve(
|
|
49124
|
+
var fullPath = !opts.root ? resolve(path7) : path7;
|
|
49125
49125
|
return this.sendFile(fullPath, opts, done);
|
|
49126
49126
|
};
|
|
49127
49127
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -49404,11 +49404,11 @@ var require_serve_static2 = __commonJS({
|
|
|
49404
49404
|
}
|
|
49405
49405
|
var forwardError = !fallthrough;
|
|
49406
49406
|
var originalUrl = parseUrl.original(req);
|
|
49407
|
-
var
|
|
49408
|
-
if (
|
|
49409
|
-
|
|
49407
|
+
var path6 = parseUrl(req).pathname;
|
|
49408
|
+
if (path6 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
49409
|
+
path6 = "";
|
|
49410
49410
|
}
|
|
49411
|
-
var stream = send(req,
|
|
49411
|
+
var stream = send(req, path6, opts);
|
|
49412
49412
|
stream.on("directory", onDirectory);
|
|
49413
49413
|
if (setHeaders) {
|
|
49414
49414
|
stream.on("headers", setHeaders);
|
|
@@ -52708,8 +52708,8 @@ var require_utils5 = __commonJS({
|
|
|
52708
52708
|
}
|
|
52709
52709
|
return ind;
|
|
52710
52710
|
}
|
|
52711
|
-
function removeDotSegments(
|
|
52712
|
-
let input =
|
|
52711
|
+
function removeDotSegments(path6) {
|
|
52712
|
+
let input = path6;
|
|
52713
52713
|
const output = [];
|
|
52714
52714
|
let nextSlash = -1;
|
|
52715
52715
|
let len = 0;
|
|
@@ -52908,8 +52908,8 @@ var require_schemes = __commonJS({
|
|
|
52908
52908
|
wsComponent.secure = void 0;
|
|
52909
52909
|
}
|
|
52910
52910
|
if (wsComponent.resourceName) {
|
|
52911
|
-
const [
|
|
52912
|
-
wsComponent.path =
|
|
52911
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
52912
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
|
|
52913
52913
|
wsComponent.query = query;
|
|
52914
52914
|
wsComponent.resourceName = void 0;
|
|
52915
52915
|
}
|
|
@@ -59908,7 +59908,7 @@ __export(index_exports, {
|
|
|
59908
59908
|
});
|
|
59909
59909
|
module.exports = __toCommonJS(index_exports);
|
|
59910
59910
|
var import_node_fs4 = require("node:fs");
|
|
59911
|
-
var
|
|
59911
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
59912
59912
|
|
|
59913
59913
|
// node_modules/commander/esm.mjs
|
|
59914
59914
|
var import_index = __toESM(require_commander(), 1);
|
|
@@ -60021,22 +60021,22 @@ var Daemon = class {
|
|
|
60021
60021
|
}
|
|
60022
60022
|
async install() {
|
|
60023
60023
|
if (this.platform === "darwin") {
|
|
60024
|
-
const
|
|
60025
|
-
if ((0, import_node_fs.existsSync)(
|
|
60026
|
-
await this.exec("launchctl", ["unload", "-w",
|
|
60024
|
+
const path6 = plistPath(this.home, this.name);
|
|
60025
|
+
if ((0, import_node_fs.existsSync)(path6)) {
|
|
60026
|
+
await this.exec("launchctl", ["unload", "-w", path6]).catch(() => void 0);
|
|
60027
60027
|
}
|
|
60028
60028
|
await (0, import_promises.mkdir)((0, import_node_path.join)(this.home, "Library", "LaunchAgents"), { recursive: true });
|
|
60029
|
-
await (0, import_promises.writeFile)(
|
|
60030
|
-
await this.exec("launchctl", ["load", "-w",
|
|
60029
|
+
await (0, import_promises.writeFile)(path6, renderPlist(this.name, this.programArgs, this.env), "utf8");
|
|
60030
|
+
await this.exec("launchctl", ["load", "-w", path6]);
|
|
60031
60031
|
return;
|
|
60032
60032
|
}
|
|
60033
60033
|
if (this.platform === "linux") {
|
|
60034
|
-
const
|
|
60035
|
-
if ((0, import_node_fs.existsSync)(
|
|
60034
|
+
const path6 = unitPath(this.home, this.name);
|
|
60035
|
+
if ((0, import_node_fs.existsSync)(path6)) {
|
|
60036
60036
|
await this.exec("systemctl", ["--user", "disable", "--now", `${this.name}.service`]).catch(() => void 0);
|
|
60037
60037
|
}
|
|
60038
60038
|
await (0, import_promises.mkdir)((0, import_node_path.join)(this.home, ".config", "systemd", "user"), { recursive: true });
|
|
60039
|
-
await (0, import_promises.writeFile)(
|
|
60039
|
+
await (0, import_promises.writeFile)(path6, renderUnit(this.description, this.programArgs, this.env), "utf8");
|
|
60040
60040
|
await this.exec("systemctl", ["--user", "daemon-reload"]);
|
|
60041
60041
|
await this.exec("systemctl", ["--user", "enable", "--now", `${this.name}.service`]);
|
|
60042
60042
|
return;
|
|
@@ -60045,17 +60045,17 @@ var Daemon = class {
|
|
|
60045
60045
|
}
|
|
60046
60046
|
async uninstall() {
|
|
60047
60047
|
if (this.platform === "darwin") {
|
|
60048
|
-
const
|
|
60049
|
-
if ((0, import_node_fs.existsSync)(
|
|
60050
|
-
await this.exec("launchctl", ["unload", "-w",
|
|
60051
|
-
await (0, import_promises.rm)(
|
|
60048
|
+
const path6 = plistPath(this.home, this.name);
|
|
60049
|
+
if ((0, import_node_fs.existsSync)(path6)) {
|
|
60050
|
+
await this.exec("launchctl", ["unload", "-w", path6]).catch(() => void 0);
|
|
60051
|
+
await (0, import_promises.rm)(path6, { force: true });
|
|
60052
60052
|
}
|
|
60053
60053
|
return;
|
|
60054
60054
|
}
|
|
60055
60055
|
if (this.platform === "linux") {
|
|
60056
|
-
const
|
|
60056
|
+
const path6 = unitPath(this.home, this.name);
|
|
60057
60057
|
await this.exec("systemctl", ["--user", "disable", "--now", `${this.name}.service`]).catch(() => void 0);
|
|
60058
|
-
await (0, import_promises.rm)(
|
|
60058
|
+
await (0, import_promises.rm)(path6, { force: true });
|
|
60059
60059
|
await this.exec("systemctl", ["--user", "daemon-reload"]);
|
|
60060
60060
|
return;
|
|
60061
60061
|
}
|
|
@@ -60063,8 +60063,8 @@ var Daemon = class {
|
|
|
60063
60063
|
}
|
|
60064
60064
|
async status() {
|
|
60065
60065
|
if (this.platform === "darwin") {
|
|
60066
|
-
const
|
|
60067
|
-
if (!(0, import_node_fs.existsSync)(
|
|
60066
|
+
const path6 = plistPath(this.home, this.name);
|
|
60067
|
+
if (!(0, import_node_fs.existsSync)(path6))
|
|
60068
60068
|
return { installed: false, running: false };
|
|
60069
60069
|
try {
|
|
60070
60070
|
await this.exec("launchctl", ["list", this.name]);
|
|
@@ -60074,8 +60074,8 @@ var Daemon = class {
|
|
|
60074
60074
|
}
|
|
60075
60075
|
}
|
|
60076
60076
|
if (this.platform === "linux") {
|
|
60077
|
-
const
|
|
60078
|
-
if (!(0, import_node_fs.existsSync)(
|
|
60077
|
+
const path6 = unitPath(this.home, this.name);
|
|
60078
|
+
if (!(0, import_node_fs.existsSync)(path6))
|
|
60079
60079
|
return { installed: false, running: false };
|
|
60080
60080
|
try {
|
|
60081
60081
|
const result = await this.exec("systemctl", [
|
|
@@ -60594,8 +60594,8 @@ function getErrorMap() {
|
|
|
60594
60594
|
|
|
60595
60595
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
60596
60596
|
var makeIssue = (params) => {
|
|
60597
|
-
const { data, path:
|
|
60598
|
-
const fullPath = [...
|
|
60597
|
+
const { data, path: path6, errorMaps, issueData } = params;
|
|
60598
|
+
const fullPath = [...path6, ...issueData.path || []];
|
|
60599
60599
|
const fullIssue = {
|
|
60600
60600
|
...issueData,
|
|
60601
60601
|
path: fullPath
|
|
@@ -60710,11 +60710,11 @@ var errorUtil;
|
|
|
60710
60710
|
|
|
60711
60711
|
// node_modules/zod/v3/types.js
|
|
60712
60712
|
var ParseInputLazyPath = class {
|
|
60713
|
-
constructor(parent, value,
|
|
60713
|
+
constructor(parent, value, path6, key) {
|
|
60714
60714
|
this._cachedPath = [];
|
|
60715
60715
|
this.parent = parent;
|
|
60716
60716
|
this.data = value;
|
|
60717
|
-
this._path =
|
|
60717
|
+
this._path = path6;
|
|
60718
60718
|
this._key = key;
|
|
60719
60719
|
}
|
|
60720
60720
|
get path() {
|
|
@@ -64360,10 +64360,10 @@ function mergeDefs(...defs) {
|
|
|
64360
64360
|
function cloneDef(schema) {
|
|
64361
64361
|
return mergeDefs(schema._zod.def);
|
|
64362
64362
|
}
|
|
64363
|
-
function getElementAtPath(obj,
|
|
64364
|
-
if (!
|
|
64363
|
+
function getElementAtPath(obj, path6) {
|
|
64364
|
+
if (!path6)
|
|
64365
64365
|
return obj;
|
|
64366
|
-
return
|
|
64366
|
+
return path6.reduce((acc, key) => acc?.[key], obj);
|
|
64367
64367
|
}
|
|
64368
64368
|
function promiseAllObject(promisesObj) {
|
|
64369
64369
|
const keys = Object.keys(promisesObj);
|
|
@@ -64746,11 +64746,11 @@ function aborted(x2, startIndex = 0) {
|
|
|
64746
64746
|
}
|
|
64747
64747
|
return false;
|
|
64748
64748
|
}
|
|
64749
|
-
function prefixIssues(
|
|
64749
|
+
function prefixIssues(path6, issues) {
|
|
64750
64750
|
return issues.map((iss) => {
|
|
64751
64751
|
var _a2;
|
|
64752
64752
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
64753
|
-
iss.path.unshift(
|
|
64753
|
+
iss.path.unshift(path6);
|
|
64754
64754
|
return iss;
|
|
64755
64755
|
});
|
|
64756
64756
|
}
|
|
@@ -75562,6 +75562,163 @@ var import_subprotocol = __toESM(require_subprotocol(), 1);
|
|
|
75562
75562
|
var import_websocket = __toESM(require_websocket(), 1);
|
|
75563
75563
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
75564
75564
|
|
|
75565
|
+
// src/server/acp-bridge.ts
|
|
75566
|
+
var import_node_child_process2 = require("node:child_process");
|
|
75567
|
+
var import_promises2 = require("node:fs/promises");
|
|
75568
|
+
var import_node_os3 = require("node:os");
|
|
75569
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
75570
|
+
var ACP_COMMAND = "openclaw";
|
|
75571
|
+
var ACP_ARGS = ["acp"];
|
|
75572
|
+
var ACP_STOP_TIMEOUT_MS = 5e3;
|
|
75573
|
+
var ACP_STUB_CWD = import_node_path3.default.join((0, import_node_os3.homedir)(), ".television", "acp");
|
|
75574
|
+
var ACPBridge = class {
|
|
75575
|
+
child = null;
|
|
75576
|
+
status = "exited";
|
|
75577
|
+
error = null;
|
|
75578
|
+
stdoutBuffer = "";
|
|
75579
|
+
stderrBuffer = "";
|
|
75580
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
75581
|
+
send;
|
|
75582
|
+
constructor(send) {
|
|
75583
|
+
this.send = send;
|
|
75584
|
+
}
|
|
75585
|
+
handleClientMessage(socket, message) {
|
|
75586
|
+
switch (message.type) {
|
|
75587
|
+
case "acp-bridge-connect":
|
|
75588
|
+
this.subscribers.add(socket);
|
|
75589
|
+
this.ensureStarted();
|
|
75590
|
+
this.sendStatus(socket);
|
|
75591
|
+
return;
|
|
75592
|
+
case "acp-bridge-message":
|
|
75593
|
+
if (!this.child || this.status !== "ready") {
|
|
75594
|
+
this.sendStatus(socket);
|
|
75595
|
+
return;
|
|
75596
|
+
}
|
|
75597
|
+
this.child.stdin.write(`${JSON.stringify(message.message)}
|
|
75598
|
+
`);
|
|
75599
|
+
return;
|
|
75600
|
+
}
|
|
75601
|
+
}
|
|
75602
|
+
detachSocket(socket) {
|
|
75603
|
+
this.subscribers.delete(socket);
|
|
75604
|
+
}
|
|
75605
|
+
async stop() {
|
|
75606
|
+
this.subscribers.clear();
|
|
75607
|
+
if (!this.child) {
|
|
75608
|
+
return;
|
|
75609
|
+
}
|
|
75610
|
+
const child = this.child;
|
|
75611
|
+
this.child = null;
|
|
75612
|
+
this.status = "exited";
|
|
75613
|
+
await new Promise((resolve) => {
|
|
75614
|
+
const timeout = setTimeout(() => {
|
|
75615
|
+
child.kill("SIGKILL");
|
|
75616
|
+
}, ACP_STOP_TIMEOUT_MS);
|
|
75617
|
+
child.once("exit", () => {
|
|
75618
|
+
clearTimeout(timeout);
|
|
75619
|
+
resolve();
|
|
75620
|
+
});
|
|
75621
|
+
child.kill();
|
|
75622
|
+
});
|
|
75623
|
+
}
|
|
75624
|
+
async ensureStarted() {
|
|
75625
|
+
if (this.child || this.status === "launching") {
|
|
75626
|
+
return;
|
|
75627
|
+
}
|
|
75628
|
+
this.status = "launching";
|
|
75629
|
+
this.error = null;
|
|
75630
|
+
this.broadcastStatus();
|
|
75631
|
+
await (0, import_promises2.mkdir)(ACP_STUB_CWD, { recursive: true });
|
|
75632
|
+
const child = (0, import_node_child_process2.spawn)(ACP_COMMAND, ACP_ARGS, {
|
|
75633
|
+
cwd: ACP_STUB_CWD,
|
|
75634
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
75635
|
+
});
|
|
75636
|
+
this.child = child;
|
|
75637
|
+
child.once("spawn", () => {
|
|
75638
|
+
this.status = "ready";
|
|
75639
|
+
this.error = null;
|
|
75640
|
+
this.broadcastStatus();
|
|
75641
|
+
});
|
|
75642
|
+
child.once("error", (error2) => {
|
|
75643
|
+
this.child = null;
|
|
75644
|
+
this.status = "error";
|
|
75645
|
+
this.error = error2.message;
|
|
75646
|
+
this.broadcastStatus();
|
|
75647
|
+
});
|
|
75648
|
+
child.once("exit", () => {
|
|
75649
|
+
this.child = null;
|
|
75650
|
+
this.status = "exited";
|
|
75651
|
+
this.error = this.stderrBuffer.trim() || this.error;
|
|
75652
|
+
this.broadcastStatus();
|
|
75653
|
+
});
|
|
75654
|
+
child.stdout.on("data", (chunk) => {
|
|
75655
|
+
this.stdoutBuffer += chunk.toString();
|
|
75656
|
+
this.flushStdoutBuffer();
|
|
75657
|
+
});
|
|
75658
|
+
child.stderr.on("data", (chunk) => {
|
|
75659
|
+
this.stderrBuffer += chunk.toString();
|
|
75660
|
+
this.error = this.stderrBuffer.trim() || this.error;
|
|
75661
|
+
});
|
|
75662
|
+
}
|
|
75663
|
+
flushStdoutBuffer() {
|
|
75664
|
+
while (true) {
|
|
75665
|
+
const newlineIndex = this.stdoutBuffer.indexOf("\n");
|
|
75666
|
+
if (newlineIndex === -1) {
|
|
75667
|
+
return;
|
|
75668
|
+
}
|
|
75669
|
+
const line = this.stdoutBuffer.slice(0, newlineIndex).trim();
|
|
75670
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
|
|
75671
|
+
if (!line) {
|
|
75672
|
+
continue;
|
|
75673
|
+
}
|
|
75674
|
+
try {
|
|
75675
|
+
const message = JSON.parse(line);
|
|
75676
|
+
this.broadcast({ type: "acp-bridge-message", message });
|
|
75677
|
+
} catch (error2) {
|
|
75678
|
+
this.status = "error";
|
|
75679
|
+
this.error = error2 instanceof Error ? error2.message : String(error2);
|
|
75680
|
+
this.broadcastStatus();
|
|
75681
|
+
}
|
|
75682
|
+
}
|
|
75683
|
+
}
|
|
75684
|
+
sendStatus(socket) {
|
|
75685
|
+
const message = {
|
|
75686
|
+
type: "acp-bridge-status",
|
|
75687
|
+
status: this.status,
|
|
75688
|
+
...this.error ? { error: this.error } : {}
|
|
75689
|
+
};
|
|
75690
|
+
this.send(socket, message);
|
|
75691
|
+
}
|
|
75692
|
+
broadcastStatus() {
|
|
75693
|
+
this.broadcast({
|
|
75694
|
+
type: "acp-bridge-status",
|
|
75695
|
+
status: this.status,
|
|
75696
|
+
...this.error ? { error: this.error } : {}
|
|
75697
|
+
});
|
|
75698
|
+
}
|
|
75699
|
+
broadcast(message) {
|
|
75700
|
+
for (const socket of this.subscribers) {
|
|
75701
|
+
this.send(socket, message);
|
|
75702
|
+
}
|
|
75703
|
+
}
|
|
75704
|
+
};
|
|
75705
|
+
|
|
75706
|
+
// src/acp-bridge-types.ts
|
|
75707
|
+
function isACPBridgeClientMessage(value) {
|
|
75708
|
+
if (typeof value !== "object" || value === null || !("type" in value)) {
|
|
75709
|
+
return false;
|
|
75710
|
+
}
|
|
75711
|
+
const message = value;
|
|
75712
|
+
switch (message.type) {
|
|
75713
|
+
case "acp-bridge-connect":
|
|
75714
|
+
return true;
|
|
75715
|
+
case "acp-bridge-message":
|
|
75716
|
+
return "message" in message;
|
|
75717
|
+
default:
|
|
75718
|
+
return false;
|
|
75719
|
+
}
|
|
75720
|
+
}
|
|
75721
|
+
|
|
75565
75722
|
// src/server/tools.ts
|
|
75566
75723
|
function listWorkspaceChoices(workspaces) {
|
|
75567
75724
|
return workspaces.map((workspace) => `${workspace.name} (${workspace.id})`).join(", ");
|
|
@@ -75743,7 +75900,7 @@ function createTools(store) {
|
|
|
75743
75900
|
|
|
75744
75901
|
// src/server/artifact-renderer.ts
|
|
75745
75902
|
var import_node_fs2 = require("node:fs");
|
|
75746
|
-
var
|
|
75903
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
75747
75904
|
|
|
75748
75905
|
// node_modules/marked/lib/marked.esm.js
|
|
75749
75906
|
function M() {
|
|
@@ -77093,12 +77250,12 @@ function wrapArtifactHTML(input) {
|
|
|
77093
77250
|
var cachedBundle = null;
|
|
77094
77251
|
function findRuntimeDir(staticDir) {
|
|
77095
77252
|
const candidates = [
|
|
77096
|
-
staticDir ?
|
|
77097
|
-
|
|
77098
|
-
|
|
77253
|
+
staticDir ? import_node_path4.default.resolve(staticDir, "..", "artifact-runtime") : null,
|
|
77254
|
+
import_node_path4.default.resolve(process.cwd(), "dist", "artifact-runtime"),
|
|
77255
|
+
import_node_path4.default.resolve(process.cwd(), "src", "artifact-runtime")
|
|
77099
77256
|
].filter((candidate) => typeof candidate === "string");
|
|
77100
77257
|
for (const candidate of candidates) {
|
|
77101
|
-
if ((0, import_node_fs2.existsSync)(
|
|
77258
|
+
if ((0, import_node_fs2.existsSync)(import_node_path4.default.join(candidate, "style.css")) && (0, import_node_fs2.existsSync)(import_node_path4.default.join(candidate, "index.js")) || (0, import_node_fs2.existsSync)(import_node_path4.default.join(candidate, "base.css")) && (0, import_node_fs2.existsSync)(import_node_path4.default.join(candidate, "runtime.js"))) {
|
|
77102
77259
|
return candidate;
|
|
77103
77260
|
}
|
|
77104
77261
|
}
|
|
@@ -77109,8 +77266,8 @@ function loadRuntimeFiles(staticDir) {
|
|
|
77109
77266
|
return cachedBundle;
|
|
77110
77267
|
}
|
|
77111
77268
|
const runtimeDir = findRuntimeDir(staticDir);
|
|
77112
|
-
const cssPath = (0, import_node_fs2.existsSync)(
|
|
77113
|
-
const jsPath = (0, import_node_fs2.existsSync)(
|
|
77269
|
+
const cssPath = (0, import_node_fs2.existsSync)(import_node_path4.default.join(runtimeDir, "style.css")) ? import_node_path4.default.join(runtimeDir, "style.css") : import_node_path4.default.join(runtimeDir, "base.css");
|
|
77270
|
+
const jsPath = (0, import_node_fs2.existsSync)(import_node_path4.default.join(runtimeDir, "index.js")) ? import_node_path4.default.join(runtimeDir, "index.js") : import_node_path4.default.join(runtimeDir, "runtime.js");
|
|
77114
77271
|
const bundle = {
|
|
77115
77272
|
css: (0, import_node_fs2.readFileSync)(cssPath, "utf8"),
|
|
77116
77273
|
js: (0, import_node_fs2.readFileSync)(jsPath, "utf8")
|
|
@@ -77135,6 +77292,7 @@ var Server2 = class {
|
|
|
77135
77292
|
httpServer;
|
|
77136
77293
|
wsServer;
|
|
77137
77294
|
store;
|
|
77295
|
+
acpBridge;
|
|
77138
77296
|
host;
|
|
77139
77297
|
port;
|
|
77140
77298
|
publicServer;
|
|
@@ -77146,6 +77304,7 @@ var Server2 = class {
|
|
|
77146
77304
|
this.port = options.port ?? DEFAULT_SERVER_PORT;
|
|
77147
77305
|
this.publicServer = options.public ?? false;
|
|
77148
77306
|
this.baseURL = buildServerURL(this.host ?? DEFAULT_SERVER_HOST, this.port);
|
|
77307
|
+
this.acpBridge = new ACPBridge((socket, message) => this.send(socket, message));
|
|
77149
77308
|
this.app = (0, import_express2.default)();
|
|
77150
77309
|
this.httpServer = import_node_http.default.createServer(this.app);
|
|
77151
77310
|
this.wsServer = new import_websocket_server.default({ server: this.httpServer, path: "/ws" });
|
|
@@ -77190,6 +77349,9 @@ var Server2 = class {
|
|
|
77190
77349
|
socket.on("message", (data) => {
|
|
77191
77350
|
this.handleClientMessage(socket, data.toString());
|
|
77192
77351
|
});
|
|
77352
|
+
socket.on("close", () => {
|
|
77353
|
+
this.acpBridge.detachSocket(socket);
|
|
77354
|
+
});
|
|
77193
77355
|
});
|
|
77194
77356
|
this.store.addEventListener("store-change", (event) => {
|
|
77195
77357
|
this.broadcast(event.message);
|
|
@@ -77224,21 +77386,23 @@ var Server2 = class {
|
|
|
77224
77386
|
for (const socket of this.wsServer.clients) {
|
|
77225
77387
|
socket.terminate();
|
|
77226
77388
|
}
|
|
77227
|
-
this.
|
|
77228
|
-
|
|
77229
|
-
|
|
77230
|
-
|
|
77231
|
-
}
|
|
77232
|
-
this.httpServer.closeAllConnections?.();
|
|
77233
|
-
this.httpServer.closeIdleConnections?.();
|
|
77234
|
-
this.httpServer.close((httpError) => {
|
|
77235
|
-
if (httpError) {
|
|
77236
|
-
reject(httpError);
|
|
77389
|
+
void this.acpBridge.stop().then(() => {
|
|
77390
|
+
this.wsServer.close((wsError) => {
|
|
77391
|
+
if (wsError) {
|
|
77392
|
+
reject(wsError);
|
|
77237
77393
|
return;
|
|
77238
77394
|
}
|
|
77239
|
-
|
|
77395
|
+
this.httpServer.closeAllConnections?.();
|
|
77396
|
+
this.httpServer.closeIdleConnections?.();
|
|
77397
|
+
this.httpServer.close((httpError) => {
|
|
77398
|
+
if (httpError) {
|
|
77399
|
+
reject(httpError);
|
|
77400
|
+
return;
|
|
77401
|
+
}
|
|
77402
|
+
resolve();
|
|
77403
|
+
});
|
|
77240
77404
|
});
|
|
77241
|
-
});
|
|
77405
|
+
}).catch(reject);
|
|
77242
77406
|
});
|
|
77243
77407
|
}
|
|
77244
77408
|
handleClientMessage(socket, rawMessage) {
|
|
@@ -77249,6 +77413,10 @@ var Server2 = class {
|
|
|
77249
77413
|
this.send(socket, { type: "error", message: "Invalid message" });
|
|
77250
77414
|
return;
|
|
77251
77415
|
}
|
|
77416
|
+
if (isACPBridgeClientMessage(message)) {
|
|
77417
|
+
this.acpBridge.handleClientMessage(socket, message);
|
|
77418
|
+
return;
|
|
77419
|
+
}
|
|
77252
77420
|
if (!isClientMessage(message)) {
|
|
77253
77421
|
this.send(socket, { type: "error", message: "Unknown message type" });
|
|
77254
77422
|
return;
|
|
@@ -77450,7 +77618,7 @@ var StoreChangeEvent = defineEvent();
|
|
|
77450
77618
|
// src/server/server-store.ts
|
|
77451
77619
|
var import_node_crypto2 = require("node:crypto");
|
|
77452
77620
|
var import_node_fs3 = require("node:fs");
|
|
77453
|
-
var
|
|
77621
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
77454
77622
|
|
|
77455
77623
|
// src/constants.ts
|
|
77456
77624
|
var LAYOUT_FULL_WIDTH_UNITS = 4;
|
|
@@ -78021,7 +78189,7 @@ var ServerStore = class extends EventTarget {
|
|
|
78021
78189
|
}
|
|
78022
78190
|
load() {
|
|
78023
78191
|
for (const file2 of this.readEntityFiles(this.workspacesDir)) {
|
|
78024
|
-
const filePath =
|
|
78192
|
+
const filePath = import_node_path5.default.join(this.workspacesDir, file2);
|
|
78025
78193
|
const raw = this.readJsonFile(filePath);
|
|
78026
78194
|
if (!raw || typeof raw !== "object") continue;
|
|
78027
78195
|
const renamedLegacyFields = migrateWorkspaceJson(raw);
|
|
@@ -78035,7 +78203,7 @@ var ServerStore = class extends EventTarget {
|
|
|
78035
78203
|
}
|
|
78036
78204
|
for (const file2 of this.readEntityFiles(this.artifactsDir)) {
|
|
78037
78205
|
const artifact = this.readJsonFile(
|
|
78038
|
-
|
|
78206
|
+
import_node_path5.default.join(this.artifactsDir, file2)
|
|
78039
78207
|
);
|
|
78040
78208
|
if (!artifact) continue;
|
|
78041
78209
|
this.artifacts.set(artifact.id, artifact);
|
|
@@ -78076,32 +78244,32 @@ var ServerStore = class extends EventTarget {
|
|
|
78076
78244
|
}
|
|
78077
78245
|
persistWorkspace(workspace) {
|
|
78078
78246
|
(0, import_node_fs3.writeFileSync)(
|
|
78079
|
-
|
|
78247
|
+
import_node_path5.default.join(this.workspacesDir, `${workspace.id}.json`),
|
|
78080
78248
|
JSON.stringify(workspace, null, JSON_INDENT_SPACES)
|
|
78081
78249
|
);
|
|
78082
78250
|
}
|
|
78083
78251
|
persistArtifact(artifact) {
|
|
78084
78252
|
(0, import_node_fs3.writeFileSync)(
|
|
78085
|
-
|
|
78253
|
+
import_node_path5.default.join(this.artifactsDir, `${artifact.id}.json`),
|
|
78086
78254
|
JSON.stringify(artifact, null, JSON_INDENT_SPACES)
|
|
78087
78255
|
);
|
|
78088
78256
|
}
|
|
78089
78257
|
deleteArtifactFile(artifactID) {
|
|
78090
|
-
(0, import_node_fs3.rmSync)(
|
|
78258
|
+
(0, import_node_fs3.rmSync)(import_node_path5.default.join(this.artifactsDir, `${artifactID}.json`), { force: true });
|
|
78091
78259
|
}
|
|
78092
78260
|
deleteWorkspaceFile(workspaceID) {
|
|
78093
|
-
(0, import_node_fs3.rmSync)(
|
|
78261
|
+
(0, import_node_fs3.rmSync)(import_node_path5.default.join(this.workspacesDir, `${workspaceID}.json`), {
|
|
78094
78262
|
force: true
|
|
78095
78263
|
});
|
|
78096
78264
|
}
|
|
78097
78265
|
get workspacesDir() {
|
|
78098
|
-
return
|
|
78266
|
+
return import_node_path5.default.join(this.dataDir, "workspaces");
|
|
78099
78267
|
}
|
|
78100
78268
|
get artifactsDir() {
|
|
78101
|
-
return
|
|
78269
|
+
return import_node_path5.default.join(this.dataDir, "artifacts");
|
|
78102
78270
|
}
|
|
78103
78271
|
get tokenPath() {
|
|
78104
|
-
return
|
|
78272
|
+
return import_node_path5.default.join(this.dataDir, "token");
|
|
78105
78273
|
}
|
|
78106
78274
|
};
|
|
78107
78275
|
|
|
@@ -78130,15 +78298,15 @@ function parsePortOption(value) {
|
|
|
78130
78298
|
function resolveStaticDirFromEntrypoint(entrypoint) {
|
|
78131
78299
|
if (!entrypoint) return void 0;
|
|
78132
78300
|
const resolvedEntrypoint = (0, import_node_fs4.realpathSync)(entrypoint);
|
|
78133
|
-
const entryDir =
|
|
78301
|
+
const entryDir = import_node_path6.default.dirname(resolvedEntrypoint);
|
|
78134
78302
|
const candidates = [
|
|
78135
|
-
|
|
78136
|
-
|
|
78303
|
+
import_node_path6.default.resolve(entryDir, "../../dist/browser"),
|
|
78304
|
+
import_node_path6.default.resolve(entryDir, "browser")
|
|
78137
78305
|
];
|
|
78138
|
-
return candidates.find((candidate) => (0, import_node_fs4.existsSync)(
|
|
78306
|
+
return candidates.find((candidate) => (0, import_node_fs4.existsSync)(import_node_path6.default.join(candidate, "index.html")));
|
|
78139
78307
|
}
|
|
78140
78308
|
function readAuthToken(dataDir) {
|
|
78141
|
-
const tokenPath =
|
|
78309
|
+
const tokenPath = import_node_path6.default.join(dataDir, "token");
|
|
78142
78310
|
if (!(0, import_node_fs4.existsSync)(tokenPath)) {
|
|
78143
78311
|
return void 0;
|
|
78144
78312
|
}
|