meshy-node 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/assets/DashboardPage-BUtwv0kD.js +124 -0
- package/dashboard/assets/{DashboardShared-BPoKdeND.js → DashboardShared-BSDgKTOF.js} +1 -1
- package/dashboard/assets/{DiffTab-Ds8uRZxS.js → DiffTab-_2QRJdG0.js} +1 -1
- package/dashboard/assets/{FilesTab-xmmeWdn_.js → FilesTab-_pFba0dN.js} +1 -1
- package/dashboard/assets/{PreviewTab-CDc000ji.js → PreviewTab-C5UehUZ1.js} +1 -1
- package/dashboard/assets/{SharedConversationPage-C95MHBQu.js → SharedConversationPage-e35GHbGI.js} +3 -3
- package/dashboard/assets/{file-CdPV4WjM.js → file-3EwPAA-4.js} +1 -1
- package/dashboard/assets/{folder-Dd4BWbi-.js → folder-B6d9_x4J.js} +1 -1
- package/dashboard/assets/index-6tOxJBZf.js +276 -0
- package/dashboard/assets/{input-DtRxMGzO.js → input-DMp80MWI.js} +1 -1
- package/dashboard/index.html +1 -1
- package/main.cjs +284 -320
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-DIxwHSA7.js +0 -124
- package/dashboard/assets/index-n69fx3B-.js +0 -276
package/main.cjs
CHANGED
|
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
|
|
|
6629
6629
|
}
|
|
6630
6630
|
break;
|
|
6631
6631
|
case "FILE":
|
|
6632
|
-
var
|
|
6633
|
-
stream2 = new
|
|
6632
|
+
var fs22 = require("fs");
|
|
6633
|
+
stream2 = new fs22.SyncWriteStream(fd2, { autoClose: false });
|
|
6634
6634
|
stream2._type = "fs";
|
|
6635
6635
|
break;
|
|
6636
6636
|
case "PIPE":
|
|
@@ -19420,11 +19420,11 @@ var require_mime_types = __commonJS({
|
|
|
19420
19420
|
}
|
|
19421
19421
|
return exts[0];
|
|
19422
19422
|
}
|
|
19423
|
-
function lookup(
|
|
19424
|
-
if (!
|
|
19423
|
+
function lookup(path23) {
|
|
19424
|
+
if (!path23 || typeof path23 !== "string") {
|
|
19425
19425
|
return false;
|
|
19426
19426
|
}
|
|
19427
|
-
var extension2 = extname3("x." +
|
|
19427
|
+
var extension2 = extname3("x." + path23).toLowerCase().substr(1);
|
|
19428
19428
|
if (!extension2) {
|
|
19429
19429
|
return false;
|
|
19430
19430
|
}
|
|
@@ -22942,7 +22942,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
22942
22942
|
"use strict";
|
|
22943
22943
|
module2.exports = pathToRegexp;
|
|
22944
22944
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
22945
|
-
function pathToRegexp(
|
|
22945
|
+
function pathToRegexp(path23, keys, options) {
|
|
22946
22946
|
options = options || {};
|
|
22947
22947
|
keys = keys || [];
|
|
22948
22948
|
var strict = options.strict;
|
|
@@ -22956,8 +22956,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
22956
22956
|
var pos = 0;
|
|
22957
22957
|
var backtrack = "";
|
|
22958
22958
|
var m;
|
|
22959
|
-
if (
|
|
22960
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
22959
|
+
if (path23 instanceof RegExp) {
|
|
22960
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path23.source)) {
|
|
22961
22961
|
if (m[0][0] === "\\") continue;
|
|
22962
22962
|
keys.push({
|
|
22963
22963
|
name: m[1] || name2++,
|
|
@@ -22965,18 +22965,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
22965
22965
|
offset: m.index
|
|
22966
22966
|
});
|
|
22967
22967
|
}
|
|
22968
|
-
return
|
|
22968
|
+
return path23;
|
|
22969
22969
|
}
|
|
22970
|
-
if (Array.isArray(
|
|
22971
|
-
|
|
22970
|
+
if (Array.isArray(path23)) {
|
|
22971
|
+
path23 = path23.map(function(value) {
|
|
22972
22972
|
return pathToRegexp(value, keys, options).source;
|
|
22973
22973
|
});
|
|
22974
|
-
return new RegExp(
|
|
22974
|
+
return new RegExp(path23.join("|"), flags);
|
|
22975
22975
|
}
|
|
22976
|
-
if (typeof
|
|
22976
|
+
if (typeof path23 !== "string") {
|
|
22977
22977
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
22978
22978
|
}
|
|
22979
|
-
|
|
22979
|
+
path23 = path23.replace(
|
|
22980
22980
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
22981
22981
|
function(match, slash, format, key, capture, star, optional, offset) {
|
|
22982
22982
|
if (match[0] === "\\") {
|
|
@@ -22993,7 +22993,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
22993
22993
|
if (slash || format) {
|
|
22994
22994
|
backtrack = "";
|
|
22995
22995
|
} else {
|
|
22996
|
-
backtrack +=
|
|
22996
|
+
backtrack += path23.slice(pos, offset);
|
|
22997
22997
|
}
|
|
22998
22998
|
pos = offset + match.length;
|
|
22999
22999
|
if (match === "*") {
|
|
@@ -23023,7 +23023,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
23023
23023
|
return result;
|
|
23024
23024
|
}
|
|
23025
23025
|
);
|
|
23026
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
23026
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path23)) {
|
|
23027
23027
|
if (m[0][0] === "\\") continue;
|
|
23028
23028
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
23029
23029
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -23035,13 +23035,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
23035
23035
|
}
|
|
23036
23036
|
i++;
|
|
23037
23037
|
}
|
|
23038
|
-
|
|
23038
|
+
path23 += strict ? "" : path23[path23.length - 1] === "/" ? "?" : "/?";
|
|
23039
23039
|
if (end) {
|
|
23040
|
-
|
|
23041
|
-
} else if (
|
|
23042
|
-
|
|
23040
|
+
path23 += "$";
|
|
23041
|
+
} else if (path23[path23.length - 1] !== "/") {
|
|
23042
|
+
path23 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
23043
23043
|
}
|
|
23044
|
-
return new RegExp("^" +
|
|
23044
|
+
return new RegExp("^" + path23, flags);
|
|
23045
23045
|
}
|
|
23046
23046
|
}
|
|
23047
23047
|
});
|
|
@@ -23054,19 +23054,19 @@ var require_layer = __commonJS({
|
|
|
23054
23054
|
var debug = require_src2()("express:router:layer");
|
|
23055
23055
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
23056
23056
|
module2.exports = Layer;
|
|
23057
|
-
function Layer(
|
|
23057
|
+
function Layer(path23, options, fn) {
|
|
23058
23058
|
if (!(this instanceof Layer)) {
|
|
23059
|
-
return new Layer(
|
|
23059
|
+
return new Layer(path23, options, fn);
|
|
23060
23060
|
}
|
|
23061
|
-
debug("new %o",
|
|
23061
|
+
debug("new %o", path23);
|
|
23062
23062
|
var opts = options || {};
|
|
23063
23063
|
this.handle = fn;
|
|
23064
23064
|
this.name = fn.name || "<anonymous>";
|
|
23065
23065
|
this.params = void 0;
|
|
23066
23066
|
this.path = void 0;
|
|
23067
|
-
this.regexp = pathRegexp(
|
|
23068
|
-
this.regexp.fast_star =
|
|
23069
|
-
this.regexp.fast_slash =
|
|
23067
|
+
this.regexp = pathRegexp(path23, this.keys = [], opts);
|
|
23068
|
+
this.regexp.fast_star = path23 === "*";
|
|
23069
|
+
this.regexp.fast_slash = path23 === "/" && opts.end === false;
|
|
23070
23070
|
}
|
|
23071
23071
|
Layer.prototype.handle_error = function handle_error(error, req, res, next) {
|
|
23072
23072
|
var fn = this.handle;
|
|
@@ -23090,20 +23090,20 @@ var require_layer = __commonJS({
|
|
|
23090
23090
|
next(err);
|
|
23091
23091
|
}
|
|
23092
23092
|
};
|
|
23093
|
-
Layer.prototype.match = function match(
|
|
23093
|
+
Layer.prototype.match = function match(path23) {
|
|
23094
23094
|
var match2;
|
|
23095
|
-
if (
|
|
23095
|
+
if (path23 != null) {
|
|
23096
23096
|
if (this.regexp.fast_slash) {
|
|
23097
23097
|
this.params = {};
|
|
23098
23098
|
this.path = "";
|
|
23099
23099
|
return true;
|
|
23100
23100
|
}
|
|
23101
23101
|
if (this.regexp.fast_star) {
|
|
23102
|
-
this.params = { "0": decode_param(
|
|
23103
|
-
this.path =
|
|
23102
|
+
this.params = { "0": decode_param(path23) };
|
|
23103
|
+
this.path = path23;
|
|
23104
23104
|
return true;
|
|
23105
23105
|
}
|
|
23106
|
-
match2 = this.regexp.exec(
|
|
23106
|
+
match2 = this.regexp.exec(path23);
|
|
23107
23107
|
}
|
|
23108
23108
|
if (!match2) {
|
|
23109
23109
|
this.params = void 0;
|
|
@@ -23196,10 +23196,10 @@ var require_route = __commonJS({
|
|
|
23196
23196
|
var slice = Array.prototype.slice;
|
|
23197
23197
|
var toString = Object.prototype.toString;
|
|
23198
23198
|
module2.exports = Route;
|
|
23199
|
-
function Route(
|
|
23200
|
-
this.path =
|
|
23199
|
+
function Route(path23) {
|
|
23200
|
+
this.path = path23;
|
|
23201
23201
|
this.stack = [];
|
|
23202
|
-
debug("new %o",
|
|
23202
|
+
debug("new %o", path23);
|
|
23203
23203
|
this.methods = {};
|
|
23204
23204
|
}
|
|
23205
23205
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -23412,8 +23412,8 @@ var require_router = __commonJS({
|
|
|
23412
23412
|
if (++sync > 100) {
|
|
23413
23413
|
return setImmediate(next, err);
|
|
23414
23414
|
}
|
|
23415
|
-
var
|
|
23416
|
-
if (
|
|
23415
|
+
var path23 = getPathname(req);
|
|
23416
|
+
if (path23 == null) {
|
|
23417
23417
|
return done(layerError);
|
|
23418
23418
|
}
|
|
23419
23419
|
var layer;
|
|
@@ -23421,7 +23421,7 @@ var require_router = __commonJS({
|
|
|
23421
23421
|
var route;
|
|
23422
23422
|
while (match !== true && idx < stack.length) {
|
|
23423
23423
|
layer = stack[idx++];
|
|
23424
|
-
match = matchLayer(layer,
|
|
23424
|
+
match = matchLayer(layer, path23);
|
|
23425
23425
|
route = layer.route;
|
|
23426
23426
|
if (typeof match !== "boolean") {
|
|
23427
23427
|
layerError = layerError || match;
|
|
@@ -23459,18 +23459,18 @@ var require_router = __commonJS({
|
|
|
23459
23459
|
} else if (route) {
|
|
23460
23460
|
layer.handle_request(req, res, next);
|
|
23461
23461
|
} else {
|
|
23462
|
-
trim_prefix(layer, layerError, layerPath,
|
|
23462
|
+
trim_prefix(layer, layerError, layerPath, path23);
|
|
23463
23463
|
}
|
|
23464
23464
|
sync = 0;
|
|
23465
23465
|
});
|
|
23466
23466
|
}
|
|
23467
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
23467
|
+
function trim_prefix(layer, layerError, layerPath, path23) {
|
|
23468
23468
|
if (layerPath.length !== 0) {
|
|
23469
|
-
if (layerPath !==
|
|
23469
|
+
if (layerPath !== path23.slice(0, layerPath.length)) {
|
|
23470
23470
|
next(layerError);
|
|
23471
23471
|
return;
|
|
23472
23472
|
}
|
|
23473
|
-
var c =
|
|
23473
|
+
var c = path23[layerPath.length];
|
|
23474
23474
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
23475
23475
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
23476
23476
|
removed = layerPath;
|
|
@@ -23548,7 +23548,7 @@ var require_router = __commonJS({
|
|
|
23548
23548
|
};
|
|
23549
23549
|
proto.use = function use(fn) {
|
|
23550
23550
|
var offset = 0;
|
|
23551
|
-
var
|
|
23551
|
+
var path23 = "/";
|
|
23552
23552
|
if (typeof fn !== "function") {
|
|
23553
23553
|
var arg = fn;
|
|
23554
23554
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -23556,7 +23556,7 @@ var require_router = __commonJS({
|
|
|
23556
23556
|
}
|
|
23557
23557
|
if (typeof arg !== "function") {
|
|
23558
23558
|
offset = 1;
|
|
23559
|
-
|
|
23559
|
+
path23 = fn;
|
|
23560
23560
|
}
|
|
23561
23561
|
}
|
|
23562
23562
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -23568,8 +23568,8 @@ var require_router = __commonJS({
|
|
|
23568
23568
|
if (typeof fn !== "function") {
|
|
23569
23569
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
23570
23570
|
}
|
|
23571
|
-
debug("use %o %s",
|
|
23572
|
-
var layer = new Layer(
|
|
23571
|
+
debug("use %o %s", path23, fn.name || "<anonymous>");
|
|
23572
|
+
var layer = new Layer(path23, {
|
|
23573
23573
|
sensitive: this.caseSensitive,
|
|
23574
23574
|
strict: false,
|
|
23575
23575
|
end: false
|
|
@@ -23579,9 +23579,9 @@ var require_router = __commonJS({
|
|
|
23579
23579
|
}
|
|
23580
23580
|
return this;
|
|
23581
23581
|
};
|
|
23582
|
-
proto.route = function route(
|
|
23583
|
-
var route2 = new Route(
|
|
23584
|
-
var layer = new Layer(
|
|
23582
|
+
proto.route = function route(path23) {
|
|
23583
|
+
var route2 = new Route(path23);
|
|
23584
|
+
var layer = new Layer(path23, {
|
|
23585
23585
|
sensitive: this.caseSensitive,
|
|
23586
23586
|
strict: this.strict,
|
|
23587
23587
|
end: true
|
|
@@ -23591,8 +23591,8 @@ var require_router = __commonJS({
|
|
|
23591
23591
|
return route2;
|
|
23592
23592
|
};
|
|
23593
23593
|
methods.concat("all").forEach(function(method) {
|
|
23594
|
-
proto[method] = function(
|
|
23595
|
-
var route = this.route(
|
|
23594
|
+
proto[method] = function(path23) {
|
|
23595
|
+
var route = this.route(path23);
|
|
23596
23596
|
route[method].apply(route, slice.call(arguments, 1));
|
|
23597
23597
|
return this;
|
|
23598
23598
|
};
|
|
@@ -23628,9 +23628,9 @@ var require_router = __commonJS({
|
|
|
23628
23628
|
}
|
|
23629
23629
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
23630
23630
|
}
|
|
23631
|
-
function matchLayer(layer,
|
|
23631
|
+
function matchLayer(layer, path23) {
|
|
23632
23632
|
try {
|
|
23633
|
-
return layer.match(
|
|
23633
|
+
return layer.match(path23);
|
|
23634
23634
|
} catch (err) {
|
|
23635
23635
|
return err;
|
|
23636
23636
|
}
|
|
@@ -23748,13 +23748,13 @@ var require_view = __commonJS({
|
|
|
23748
23748
|
"../../node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports2, module2) {
|
|
23749
23749
|
"use strict";
|
|
23750
23750
|
var debug = require_src2()("express:view");
|
|
23751
|
-
var
|
|
23752
|
-
var
|
|
23753
|
-
var dirname7 =
|
|
23754
|
-
var basename5 =
|
|
23755
|
-
var extname3 =
|
|
23756
|
-
var
|
|
23757
|
-
var resolve15 =
|
|
23751
|
+
var path23 = require("path");
|
|
23752
|
+
var fs22 = require("fs");
|
|
23753
|
+
var dirname7 = path23.dirname;
|
|
23754
|
+
var basename5 = path23.basename;
|
|
23755
|
+
var extname3 = path23.extname;
|
|
23756
|
+
var join17 = path23.join;
|
|
23757
|
+
var resolve15 = path23.resolve;
|
|
23758
23758
|
module2.exports = View;
|
|
23759
23759
|
function View(name2, options) {
|
|
23760
23760
|
var opts = options || {};
|
|
@@ -23783,17 +23783,17 @@ var require_view = __commonJS({
|
|
|
23783
23783
|
this.path = this.lookup(fileName);
|
|
23784
23784
|
}
|
|
23785
23785
|
View.prototype.lookup = function lookup(name2) {
|
|
23786
|
-
var
|
|
23786
|
+
var path24;
|
|
23787
23787
|
var roots = [].concat(this.root);
|
|
23788
23788
|
debug('lookup "%s"', name2);
|
|
23789
|
-
for (var i = 0; i < roots.length && !
|
|
23789
|
+
for (var i = 0; i < roots.length && !path24; i++) {
|
|
23790
23790
|
var root = roots[i];
|
|
23791
23791
|
var loc = resolve15(root, name2);
|
|
23792
23792
|
var dir = dirname7(loc);
|
|
23793
23793
|
var file = basename5(loc);
|
|
23794
|
-
|
|
23794
|
+
path24 = this.resolve(dir, file);
|
|
23795
23795
|
}
|
|
23796
|
-
return
|
|
23796
|
+
return path24;
|
|
23797
23797
|
};
|
|
23798
23798
|
View.prototype.render = function render(options, callback) {
|
|
23799
23799
|
debug('render "%s"', this.path);
|
|
@@ -23801,21 +23801,21 @@ var require_view = __commonJS({
|
|
|
23801
23801
|
};
|
|
23802
23802
|
View.prototype.resolve = function resolve16(dir, file) {
|
|
23803
23803
|
var ext = this.ext;
|
|
23804
|
-
var
|
|
23805
|
-
var stat = tryStat(
|
|
23804
|
+
var path24 = join17(dir, file);
|
|
23805
|
+
var stat = tryStat(path24);
|
|
23806
23806
|
if (stat && stat.isFile()) {
|
|
23807
|
-
return
|
|
23807
|
+
return path24;
|
|
23808
23808
|
}
|
|
23809
|
-
|
|
23810
|
-
stat = tryStat(
|
|
23809
|
+
path24 = join17(dir, basename5(file, ext), "index" + ext);
|
|
23810
|
+
stat = tryStat(path24);
|
|
23811
23811
|
if (stat && stat.isFile()) {
|
|
23812
|
-
return
|
|
23812
|
+
return path24;
|
|
23813
23813
|
}
|
|
23814
23814
|
};
|
|
23815
|
-
function tryStat(
|
|
23816
|
-
debug('stat "%s"',
|
|
23815
|
+
function tryStat(path24) {
|
|
23816
|
+
debug('stat "%s"', path24);
|
|
23817
23817
|
try {
|
|
23818
|
-
return
|
|
23818
|
+
return fs22.statSync(path24);
|
|
23819
23819
|
} catch (e) {
|
|
23820
23820
|
return void 0;
|
|
23821
23821
|
}
|
|
@@ -24112,8 +24112,8 @@ var require_types = __commonJS({
|
|
|
24112
24112
|
var require_mime = __commonJS({
|
|
24113
24113
|
"../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module2) {
|
|
24114
24114
|
"use strict";
|
|
24115
|
-
var
|
|
24116
|
-
var
|
|
24115
|
+
var path23 = require("path");
|
|
24116
|
+
var fs22 = require("fs");
|
|
24117
24117
|
function Mime() {
|
|
24118
24118
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
24119
24119
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -24134,7 +24134,7 @@ var require_mime = __commonJS({
|
|
|
24134
24134
|
};
|
|
24135
24135
|
Mime.prototype.load = function(file) {
|
|
24136
24136
|
this._loading = file;
|
|
24137
|
-
var map = {}, content =
|
|
24137
|
+
var map = {}, content = fs22.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
24138
24138
|
lines.forEach(function(line) {
|
|
24139
24139
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
24140
24140
|
map[fields.shift()] = fields;
|
|
@@ -24142,8 +24142,8 @@ var require_mime = __commonJS({
|
|
|
24142
24142
|
this.define(map);
|
|
24143
24143
|
this._loading = null;
|
|
24144
24144
|
};
|
|
24145
|
-
Mime.prototype.lookup = function(
|
|
24146
|
-
var ext =
|
|
24145
|
+
Mime.prototype.lookup = function(path24, fallback) {
|
|
24146
|
+
var ext = path24.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
24147
24147
|
return this.types[ext] || fallback || this.default_type;
|
|
24148
24148
|
};
|
|
24149
24149
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -24256,33 +24256,33 @@ var require_send = __commonJS({
|
|
|
24256
24256
|
var escapeHtml2 = require_escape_html();
|
|
24257
24257
|
var etag = require_etag();
|
|
24258
24258
|
var fresh = require_fresh();
|
|
24259
|
-
var
|
|
24259
|
+
var fs22 = require("fs");
|
|
24260
24260
|
var mime = require_mime();
|
|
24261
24261
|
var ms = require_ms();
|
|
24262
24262
|
var onFinished = require_on_finished();
|
|
24263
24263
|
var parseRange = require_range_parser();
|
|
24264
|
-
var
|
|
24264
|
+
var path23 = require("path");
|
|
24265
24265
|
var statuses = require_statuses();
|
|
24266
24266
|
var Stream = require("stream");
|
|
24267
24267
|
var util3 = require("util");
|
|
24268
|
-
var extname3 =
|
|
24269
|
-
var
|
|
24270
|
-
var normalize =
|
|
24271
|
-
var resolve15 =
|
|
24272
|
-
var sep4 =
|
|
24268
|
+
var extname3 = path23.extname;
|
|
24269
|
+
var join17 = path23.join;
|
|
24270
|
+
var normalize = path23.normalize;
|
|
24271
|
+
var resolve15 = path23.resolve;
|
|
24272
|
+
var sep4 = path23.sep;
|
|
24273
24273
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
24274
24274
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
24275
24275
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
24276
24276
|
module2.exports = send;
|
|
24277
24277
|
module2.exports.mime = mime;
|
|
24278
|
-
function send(req,
|
|
24279
|
-
return new SendStream(req,
|
|
24278
|
+
function send(req, path24, options) {
|
|
24279
|
+
return new SendStream(req, path24, options);
|
|
24280
24280
|
}
|
|
24281
|
-
function SendStream(req,
|
|
24281
|
+
function SendStream(req, path24, options) {
|
|
24282
24282
|
Stream.call(this);
|
|
24283
24283
|
var opts = options || {};
|
|
24284
24284
|
this.options = opts;
|
|
24285
|
-
this.path =
|
|
24285
|
+
this.path = path24;
|
|
24286
24286
|
this.req = req;
|
|
24287
24287
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
24288
24288
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -24328,8 +24328,8 @@ var require_send = __commonJS({
|
|
|
24328
24328
|
this._index = index2;
|
|
24329
24329
|
return this;
|
|
24330
24330
|
}, "send.index: pass index as option");
|
|
24331
|
-
SendStream.prototype.root = function root(
|
|
24332
|
-
this._root = resolve15(String(
|
|
24331
|
+
SendStream.prototype.root = function root(path24) {
|
|
24332
|
+
this._root = resolve15(String(path24));
|
|
24333
24333
|
debug("root %s", this._root);
|
|
24334
24334
|
return this;
|
|
24335
24335
|
};
|
|
@@ -24442,10 +24442,10 @@ var require_send = __commonJS({
|
|
|
24442
24442
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
24443
24443
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
24444
24444
|
};
|
|
24445
|
-
SendStream.prototype.redirect = function redirect(
|
|
24445
|
+
SendStream.prototype.redirect = function redirect(path24) {
|
|
24446
24446
|
var res = this.res;
|
|
24447
24447
|
if (hasListeners(this, "directory")) {
|
|
24448
|
-
this.emit("directory", res,
|
|
24448
|
+
this.emit("directory", res, path24);
|
|
24449
24449
|
return;
|
|
24450
24450
|
}
|
|
24451
24451
|
if (this.hasTrailingSlash()) {
|
|
@@ -24465,42 +24465,42 @@ var require_send = __commonJS({
|
|
|
24465
24465
|
SendStream.prototype.pipe = function pipe(res) {
|
|
24466
24466
|
var root = this._root;
|
|
24467
24467
|
this.res = res;
|
|
24468
|
-
var
|
|
24469
|
-
if (
|
|
24468
|
+
var path24 = decode(this.path);
|
|
24469
|
+
if (path24 === -1) {
|
|
24470
24470
|
this.error(400);
|
|
24471
24471
|
return res;
|
|
24472
24472
|
}
|
|
24473
|
-
if (~
|
|
24473
|
+
if (~path24.indexOf("\0")) {
|
|
24474
24474
|
this.error(400);
|
|
24475
24475
|
return res;
|
|
24476
24476
|
}
|
|
24477
24477
|
var parts;
|
|
24478
24478
|
if (root !== null) {
|
|
24479
|
-
if (
|
|
24480
|
-
|
|
24479
|
+
if (path24) {
|
|
24480
|
+
path24 = normalize("." + sep4 + path24);
|
|
24481
24481
|
}
|
|
24482
|
-
if (UP_PATH_REGEXP.test(
|
|
24483
|
-
debug('malicious path "%s"',
|
|
24482
|
+
if (UP_PATH_REGEXP.test(path24)) {
|
|
24483
|
+
debug('malicious path "%s"', path24);
|
|
24484
24484
|
this.error(403);
|
|
24485
24485
|
return res;
|
|
24486
24486
|
}
|
|
24487
|
-
parts =
|
|
24488
|
-
|
|
24487
|
+
parts = path24.split(sep4);
|
|
24488
|
+
path24 = normalize(join17(root, path24));
|
|
24489
24489
|
} else {
|
|
24490
|
-
if (UP_PATH_REGEXP.test(
|
|
24491
|
-
debug('malicious path "%s"',
|
|
24490
|
+
if (UP_PATH_REGEXP.test(path24)) {
|
|
24491
|
+
debug('malicious path "%s"', path24);
|
|
24492
24492
|
this.error(403);
|
|
24493
24493
|
return res;
|
|
24494
24494
|
}
|
|
24495
|
-
parts = normalize(
|
|
24496
|
-
|
|
24495
|
+
parts = normalize(path24).split(sep4);
|
|
24496
|
+
path24 = resolve15(path24);
|
|
24497
24497
|
}
|
|
24498
24498
|
if (containsDotFile(parts)) {
|
|
24499
24499
|
var access = this._dotfiles;
|
|
24500
24500
|
if (access === void 0) {
|
|
24501
24501
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
24502
24502
|
}
|
|
24503
|
-
debug('%s dotfile "%s"', access,
|
|
24503
|
+
debug('%s dotfile "%s"', access, path24);
|
|
24504
24504
|
switch (access) {
|
|
24505
24505
|
case "allow":
|
|
24506
24506
|
break;
|
|
@@ -24514,13 +24514,13 @@ var require_send = __commonJS({
|
|
|
24514
24514
|
}
|
|
24515
24515
|
}
|
|
24516
24516
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
24517
|
-
this.sendIndex(
|
|
24517
|
+
this.sendIndex(path24);
|
|
24518
24518
|
return res;
|
|
24519
24519
|
}
|
|
24520
|
-
this.sendFile(
|
|
24520
|
+
this.sendFile(path24);
|
|
24521
24521
|
return res;
|
|
24522
24522
|
};
|
|
24523
|
-
SendStream.prototype.send = function send2(
|
|
24523
|
+
SendStream.prototype.send = function send2(path24, stat) {
|
|
24524
24524
|
var len = stat.size;
|
|
24525
24525
|
var options = this.options;
|
|
24526
24526
|
var opts = {};
|
|
@@ -24532,9 +24532,9 @@ var require_send = __commonJS({
|
|
|
24532
24532
|
this.headersAlreadySent();
|
|
24533
24533
|
return;
|
|
24534
24534
|
}
|
|
24535
|
-
debug('pipe "%s"',
|
|
24536
|
-
this.setHeader(
|
|
24537
|
-
this.type(
|
|
24535
|
+
debug('pipe "%s"', path24);
|
|
24536
|
+
this.setHeader(path24, stat);
|
|
24537
|
+
this.type(path24);
|
|
24538
24538
|
if (this.isConditionalGET()) {
|
|
24539
24539
|
if (this.isPreconditionFailure()) {
|
|
24540
24540
|
this.error(412);
|
|
@@ -24583,28 +24583,28 @@ var require_send = __commonJS({
|
|
|
24583
24583
|
res.end();
|
|
24584
24584
|
return;
|
|
24585
24585
|
}
|
|
24586
|
-
this.stream(
|
|
24586
|
+
this.stream(path24, opts);
|
|
24587
24587
|
};
|
|
24588
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
24588
|
+
SendStream.prototype.sendFile = function sendFile(path24) {
|
|
24589
24589
|
var i = 0;
|
|
24590
24590
|
var self2 = this;
|
|
24591
|
-
debug('stat "%s"',
|
|
24592
|
-
|
|
24593
|
-
if (err && err.code === "ENOENT" && !extname3(
|
|
24591
|
+
debug('stat "%s"', path24);
|
|
24592
|
+
fs22.stat(path24, function onstat(err, stat) {
|
|
24593
|
+
if (err && err.code === "ENOENT" && !extname3(path24) && path24[path24.length - 1] !== sep4) {
|
|
24594
24594
|
return next(err);
|
|
24595
24595
|
}
|
|
24596
24596
|
if (err) return self2.onStatError(err);
|
|
24597
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
24598
|
-
self2.emit("file",
|
|
24599
|
-
self2.send(
|
|
24597
|
+
if (stat.isDirectory()) return self2.redirect(path24);
|
|
24598
|
+
self2.emit("file", path24, stat);
|
|
24599
|
+
self2.send(path24, stat);
|
|
24600
24600
|
});
|
|
24601
24601
|
function next(err) {
|
|
24602
24602
|
if (self2._extensions.length <= i) {
|
|
24603
24603
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
24604
24604
|
}
|
|
24605
|
-
var p =
|
|
24605
|
+
var p = path24 + "." + self2._extensions[i++];
|
|
24606
24606
|
debug('stat "%s"', p);
|
|
24607
|
-
|
|
24607
|
+
fs22.stat(p, function(err2, stat) {
|
|
24608
24608
|
if (err2) return next(err2);
|
|
24609
24609
|
if (stat.isDirectory()) return next();
|
|
24610
24610
|
self2.emit("file", p, stat);
|
|
@@ -24612,7 +24612,7 @@ var require_send = __commonJS({
|
|
|
24612
24612
|
});
|
|
24613
24613
|
}
|
|
24614
24614
|
};
|
|
24615
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
24615
|
+
SendStream.prototype.sendIndex = function sendIndex(path24) {
|
|
24616
24616
|
var i = -1;
|
|
24617
24617
|
var self2 = this;
|
|
24618
24618
|
function next(err) {
|
|
@@ -24620,9 +24620,9 @@ var require_send = __commonJS({
|
|
|
24620
24620
|
if (err) return self2.onStatError(err);
|
|
24621
24621
|
return self2.error(404);
|
|
24622
24622
|
}
|
|
24623
|
-
var p =
|
|
24623
|
+
var p = join17(path24, self2._index[i]);
|
|
24624
24624
|
debug('stat "%s"', p);
|
|
24625
|
-
|
|
24625
|
+
fs22.stat(p, function(err2, stat) {
|
|
24626
24626
|
if (err2) return next(err2);
|
|
24627
24627
|
if (stat.isDirectory()) return next();
|
|
24628
24628
|
self2.emit("file", p, stat);
|
|
@@ -24631,10 +24631,10 @@ var require_send = __commonJS({
|
|
|
24631
24631
|
}
|
|
24632
24632
|
next();
|
|
24633
24633
|
};
|
|
24634
|
-
SendStream.prototype.stream = function stream(
|
|
24634
|
+
SendStream.prototype.stream = function stream(path24, options) {
|
|
24635
24635
|
var self2 = this;
|
|
24636
24636
|
var res = this.res;
|
|
24637
|
-
var stream2 =
|
|
24637
|
+
var stream2 = fs22.createReadStream(path24, options);
|
|
24638
24638
|
this.emit("stream", stream2);
|
|
24639
24639
|
stream2.pipe(res);
|
|
24640
24640
|
function cleanup() {
|
|
@@ -24649,10 +24649,10 @@ var require_send = __commonJS({
|
|
|
24649
24649
|
self2.emit("end");
|
|
24650
24650
|
});
|
|
24651
24651
|
};
|
|
24652
|
-
SendStream.prototype.type = function type(
|
|
24652
|
+
SendStream.prototype.type = function type(path24) {
|
|
24653
24653
|
var res = this.res;
|
|
24654
24654
|
if (res.getHeader("Content-Type")) return;
|
|
24655
|
-
var type2 = mime.lookup(
|
|
24655
|
+
var type2 = mime.lookup(path24);
|
|
24656
24656
|
if (!type2) {
|
|
24657
24657
|
debug("no content-type");
|
|
24658
24658
|
return;
|
|
@@ -24661,9 +24661,9 @@ var require_send = __commonJS({
|
|
|
24661
24661
|
debug("content-type %s", type2);
|
|
24662
24662
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
24663
24663
|
};
|
|
24664
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
24664
|
+
SendStream.prototype.setHeader = function setHeader(path24, stat) {
|
|
24665
24665
|
var res = this.res;
|
|
24666
|
-
this.emit("headers", res,
|
|
24666
|
+
this.emit("headers", res, path24, stat);
|
|
24667
24667
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
24668
24668
|
debug("accept ranges");
|
|
24669
24669
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -24722,9 +24722,9 @@ var require_send = __commonJS({
|
|
|
24722
24722
|
}
|
|
24723
24723
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
24724
24724
|
}
|
|
24725
|
-
function decode(
|
|
24725
|
+
function decode(path24) {
|
|
24726
24726
|
try {
|
|
24727
|
-
return decodeURIComponent(
|
|
24727
|
+
return decodeURIComponent(path24);
|
|
24728
24728
|
} catch (err) {
|
|
24729
24729
|
return -1;
|
|
24730
24730
|
}
|
|
@@ -25634,10 +25634,10 @@ var require_utils2 = __commonJS({
|
|
|
25634
25634
|
var querystring = require("querystring");
|
|
25635
25635
|
exports2.etag = createETagGenerator({ weak: false });
|
|
25636
25636
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
25637
|
-
exports2.isAbsolute = function(
|
|
25638
|
-
if ("/" ===
|
|
25639
|
-
if (":" ===
|
|
25640
|
-
if ("\\\\" ===
|
|
25637
|
+
exports2.isAbsolute = function(path23) {
|
|
25638
|
+
if ("/" === path23[0]) return true;
|
|
25639
|
+
if (":" === path23[1] && ("\\" === path23[2] || "/" === path23[2])) return true;
|
|
25640
|
+
if ("\\\\" === path23.substring(0, 2)) return true;
|
|
25641
25641
|
};
|
|
25642
25642
|
exports2.flatten = deprecate.function(
|
|
25643
25643
|
flatten,
|
|
@@ -25848,7 +25848,7 @@ var require_application = __commonJS({
|
|
|
25848
25848
|
};
|
|
25849
25849
|
app.use = function use(fn) {
|
|
25850
25850
|
var offset = 0;
|
|
25851
|
-
var
|
|
25851
|
+
var path23 = "/";
|
|
25852
25852
|
if (typeof fn !== "function") {
|
|
25853
25853
|
var arg = fn;
|
|
25854
25854
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -25856,7 +25856,7 @@ var require_application = __commonJS({
|
|
|
25856
25856
|
}
|
|
25857
25857
|
if (typeof arg !== "function") {
|
|
25858
25858
|
offset = 1;
|
|
25859
|
-
|
|
25859
|
+
path23 = fn;
|
|
25860
25860
|
}
|
|
25861
25861
|
}
|
|
25862
25862
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -25867,12 +25867,12 @@ var require_application = __commonJS({
|
|
|
25867
25867
|
var router = this._router;
|
|
25868
25868
|
fns.forEach(function(fn2) {
|
|
25869
25869
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
25870
|
-
return router.use(
|
|
25870
|
+
return router.use(path23, fn2);
|
|
25871
25871
|
}
|
|
25872
|
-
debug(".use app under %s",
|
|
25873
|
-
fn2.mountpath =
|
|
25872
|
+
debug(".use app under %s", path23);
|
|
25873
|
+
fn2.mountpath = path23;
|
|
25874
25874
|
fn2.parent = this;
|
|
25875
|
-
router.use(
|
|
25875
|
+
router.use(path23, function mounted_app(req, res, next) {
|
|
25876
25876
|
var orig = req.app;
|
|
25877
25877
|
fn2.handle(req, res, function(err) {
|
|
25878
25878
|
setPrototypeOf(req, orig.request);
|
|
@@ -25884,9 +25884,9 @@ var require_application = __commonJS({
|
|
|
25884
25884
|
}, this);
|
|
25885
25885
|
return this;
|
|
25886
25886
|
};
|
|
25887
|
-
app.route = function route(
|
|
25887
|
+
app.route = function route(path23) {
|
|
25888
25888
|
this.lazyrouter();
|
|
25889
|
-
return this._router.route(
|
|
25889
|
+
return this._router.route(path23);
|
|
25890
25890
|
};
|
|
25891
25891
|
app.engine = function engine(ext, fn) {
|
|
25892
25892
|
if (typeof fn !== "function") {
|
|
@@ -25937,7 +25937,7 @@ var require_application = __commonJS({
|
|
|
25937
25937
|
}
|
|
25938
25938
|
return this;
|
|
25939
25939
|
};
|
|
25940
|
-
app.path = function
|
|
25940
|
+
app.path = function path23() {
|
|
25941
25941
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
25942
25942
|
};
|
|
25943
25943
|
app.enabled = function enabled2(setting) {
|
|
@@ -25953,19 +25953,19 @@ var require_application = __commonJS({
|
|
|
25953
25953
|
return this.set(setting, false);
|
|
25954
25954
|
};
|
|
25955
25955
|
methods.forEach(function(method) {
|
|
25956
|
-
app[method] = function(
|
|
25956
|
+
app[method] = function(path23) {
|
|
25957
25957
|
if (method === "get" && arguments.length === 1) {
|
|
25958
|
-
return this.set(
|
|
25958
|
+
return this.set(path23);
|
|
25959
25959
|
}
|
|
25960
25960
|
this.lazyrouter();
|
|
25961
|
-
var route = this._router.route(
|
|
25961
|
+
var route = this._router.route(path23);
|
|
25962
25962
|
route[method].apply(route, slice.call(arguments, 1));
|
|
25963
25963
|
return this;
|
|
25964
25964
|
};
|
|
25965
25965
|
});
|
|
25966
|
-
app.all = function all(
|
|
25966
|
+
app.all = function all(path23) {
|
|
25967
25967
|
this.lazyrouter();
|
|
25968
|
-
var route = this._router.route(
|
|
25968
|
+
var route = this._router.route(path23);
|
|
25969
25969
|
var args = slice.call(arguments, 1);
|
|
25970
25970
|
for (var i = 0; i < methods.length; i++) {
|
|
25971
25971
|
route[methods[i]].apply(route, args);
|
|
@@ -26724,7 +26724,7 @@ var require_request = __commonJS({
|
|
|
26724
26724
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
26725
26725
|
return subdomains2.slice(offset);
|
|
26726
26726
|
});
|
|
26727
|
-
defineGetter(req, "path", function
|
|
26727
|
+
defineGetter(req, "path", function path23() {
|
|
26728
26728
|
return parse(this).pathname;
|
|
26729
26729
|
});
|
|
26730
26730
|
defineGetter(req, "hostname", function hostname3() {
|
|
@@ -27047,7 +27047,7 @@ var require_response = __commonJS({
|
|
|
27047
27047
|
var http3 = require("http");
|
|
27048
27048
|
var isAbsolute5 = require_utils2().isAbsolute;
|
|
27049
27049
|
var onFinished = require_on_finished();
|
|
27050
|
-
var
|
|
27050
|
+
var path23 = require("path");
|
|
27051
27051
|
var statuses = require_statuses();
|
|
27052
27052
|
var merge = require_utils_merge();
|
|
27053
27053
|
var sign = require_cookie_signature().sign;
|
|
@@ -27056,9 +27056,9 @@ var require_response = __commonJS({
|
|
|
27056
27056
|
var setCharset = require_utils2().setCharset;
|
|
27057
27057
|
var cookie = require_cookie();
|
|
27058
27058
|
var send = require_send();
|
|
27059
|
-
var extname3 =
|
|
27059
|
+
var extname3 = path23.extname;
|
|
27060
27060
|
var mime = send.mime;
|
|
27061
|
-
var resolve15 =
|
|
27061
|
+
var resolve15 = path23.resolve;
|
|
27062
27062
|
var vary = require_vary();
|
|
27063
27063
|
var res = Object.create(http3.ServerResponse.prototype);
|
|
27064
27064
|
module2.exports = res;
|
|
@@ -27235,26 +27235,26 @@ var require_response = __commonJS({
|
|
|
27235
27235
|
this.type("txt");
|
|
27236
27236
|
return this.send(body);
|
|
27237
27237
|
};
|
|
27238
|
-
res.sendFile = function sendFile(
|
|
27238
|
+
res.sendFile = function sendFile(path24, options, callback) {
|
|
27239
27239
|
var done = callback;
|
|
27240
27240
|
var req = this.req;
|
|
27241
27241
|
var res2 = this;
|
|
27242
27242
|
var next = req.next;
|
|
27243
27243
|
var opts = options || {};
|
|
27244
|
-
if (!
|
|
27244
|
+
if (!path24) {
|
|
27245
27245
|
throw new TypeError("path argument is required to res.sendFile");
|
|
27246
27246
|
}
|
|
27247
|
-
if (typeof
|
|
27247
|
+
if (typeof path24 !== "string") {
|
|
27248
27248
|
throw new TypeError("path must be a string to res.sendFile");
|
|
27249
27249
|
}
|
|
27250
27250
|
if (typeof options === "function") {
|
|
27251
27251
|
done = options;
|
|
27252
27252
|
opts = {};
|
|
27253
27253
|
}
|
|
27254
|
-
if (!opts.root && !isAbsolute5(
|
|
27254
|
+
if (!opts.root && !isAbsolute5(path24)) {
|
|
27255
27255
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
27256
27256
|
}
|
|
27257
|
-
var pathname = encodeURI(
|
|
27257
|
+
var pathname = encodeURI(path24);
|
|
27258
27258
|
var file = send(req, pathname, opts);
|
|
27259
27259
|
sendfile(res2, file, opts, function(err) {
|
|
27260
27260
|
if (done) return done(err);
|
|
@@ -27264,7 +27264,7 @@ var require_response = __commonJS({
|
|
|
27264
27264
|
}
|
|
27265
27265
|
});
|
|
27266
27266
|
};
|
|
27267
|
-
res.sendfile = function(
|
|
27267
|
+
res.sendfile = function(path24, options, callback) {
|
|
27268
27268
|
var done = callback;
|
|
27269
27269
|
var req = this.req;
|
|
27270
27270
|
var res2 = this;
|
|
@@ -27274,7 +27274,7 @@ var require_response = __commonJS({
|
|
|
27274
27274
|
done = options;
|
|
27275
27275
|
opts = {};
|
|
27276
27276
|
}
|
|
27277
|
-
var file = send(req,
|
|
27277
|
+
var file = send(req, path24, opts);
|
|
27278
27278
|
sendfile(res2, file, opts, function(err) {
|
|
27279
27279
|
if (done) return done(err);
|
|
27280
27280
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -27287,7 +27287,7 @@ var require_response = __commonJS({
|
|
|
27287
27287
|
res.sendfile,
|
|
27288
27288
|
"res.sendfile: Use res.sendFile instead"
|
|
27289
27289
|
);
|
|
27290
|
-
res.download = function download(
|
|
27290
|
+
res.download = function download(path24, filename, options, callback) {
|
|
27291
27291
|
var done = callback;
|
|
27292
27292
|
var name2 = filename;
|
|
27293
27293
|
var opts = options || null;
|
|
@@ -27304,7 +27304,7 @@ var require_response = __commonJS({
|
|
|
27304
27304
|
opts = filename;
|
|
27305
27305
|
}
|
|
27306
27306
|
var headers = {
|
|
27307
|
-
"Content-Disposition": contentDisposition(name2 ||
|
|
27307
|
+
"Content-Disposition": contentDisposition(name2 || path24)
|
|
27308
27308
|
};
|
|
27309
27309
|
if (opts && opts.headers) {
|
|
27310
27310
|
var keys = Object.keys(opts.headers);
|
|
@@ -27317,7 +27317,7 @@ var require_response = __commonJS({
|
|
|
27317
27317
|
}
|
|
27318
27318
|
opts = Object.create(opts);
|
|
27319
27319
|
opts.headers = headers;
|
|
27320
|
-
var fullPath = !opts.root ? resolve15(
|
|
27320
|
+
var fullPath = !opts.root ? resolve15(path24) : path24;
|
|
27321
27321
|
return this.sendFile(fullPath, opts, done);
|
|
27322
27322
|
};
|
|
27323
27323
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -27618,11 +27618,11 @@ var require_serve_static = __commonJS({
|
|
|
27618
27618
|
}
|
|
27619
27619
|
var forwardError = !fallthrough;
|
|
27620
27620
|
var originalUrl = parseUrl.original(req);
|
|
27621
|
-
var
|
|
27622
|
-
if (
|
|
27623
|
-
|
|
27621
|
+
var path23 = parseUrl(req).pathname;
|
|
27622
|
+
if (path23 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
27623
|
+
path23 = "";
|
|
27624
27624
|
}
|
|
27625
|
-
var stream = send(req,
|
|
27625
|
+
var stream = send(req, path23, opts);
|
|
27626
27626
|
stream.on("directory", onDirectory);
|
|
27627
27627
|
if (setHeaders) {
|
|
27628
27628
|
stream.on("headers", setHeaders);
|
|
@@ -32265,11 +32265,11 @@ function persistNodeStartupTransport(storagePath, transport) {
|
|
|
32265
32265
|
transport
|
|
32266
32266
|
});
|
|
32267
32267
|
}
|
|
32268
|
-
function persistNodeStartupJoin(storagePath,
|
|
32268
|
+
function persistNodeStartupJoin(storagePath, join17) {
|
|
32269
32269
|
const startup = resolveNodeStartupMetadata(storagePath);
|
|
32270
32270
|
persistNodeStartupMetadata(storagePath, {
|
|
32271
32271
|
...startup,
|
|
32272
|
-
join:
|
|
32272
|
+
join: join17
|
|
32273
32273
|
});
|
|
32274
32274
|
}
|
|
32275
32275
|
function resolvePersistedDevTunnelId(storagePath, kind) {
|
|
@@ -33266,19 +33266,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
|
|
|
33266
33266
|
cleanup();
|
|
33267
33267
|
}
|
|
33268
33268
|
}
|
|
33269
|
-
async function fetchNodeWithFallback(node,
|
|
33269
|
+
async function fetchNodeWithFallback(node, path23, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
|
|
33270
33270
|
let lastError;
|
|
33271
33271
|
const endpoints = getNodeRequestEndpoints(node, options);
|
|
33272
33272
|
for (const [index, endpoint] of endpoints.entries()) {
|
|
33273
33273
|
const attempt = index + 1;
|
|
33274
|
-
trace?.onAttempt?.({ attempt, endpoint, path:
|
|
33274
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
33275
33275
|
try {
|
|
33276
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
33277
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
33276
|
+
const response = await fetchWithTimeout(`${endpoint}${path23}`, init, timeoutMs);
|
|
33277
|
+
trace?.onResponse?.({ attempt, endpoint, path: path23, response, timeoutMs, totalEndpoints: endpoints.length });
|
|
33278
33278
|
return { endpoint, response };
|
|
33279
33279
|
} catch (error) {
|
|
33280
33280
|
lastError = error;
|
|
33281
|
-
trace?.onError?.({ attempt, endpoint, error, path:
|
|
33281
|
+
trace?.onError?.({ attempt, endpoint, error, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
33282
33282
|
}
|
|
33283
33283
|
}
|
|
33284
33284
|
throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
|
|
@@ -35341,9 +35341,9 @@ var DataRouter = class {
|
|
|
35341
35341
|
/**
|
|
35342
35342
|
* Returns true if the request should be proxied to the leader.
|
|
35343
35343
|
*/
|
|
35344
|
-
shouldProxy(method,
|
|
35344
|
+
shouldProxy(method, path23) {
|
|
35345
35345
|
if (this.election.isLeader()) return false;
|
|
35346
|
-
if (this.isExcludedPath(
|
|
35346
|
+
if (this.isExcludedPath(path23)) return false;
|
|
35347
35347
|
if (method.toUpperCase() === "GET") return false;
|
|
35348
35348
|
return WRITE_METHODS.has(method.toUpperCase());
|
|
35349
35349
|
}
|
|
@@ -35447,8 +35447,8 @@ var DataRouter = class {
|
|
|
35447
35447
|
};
|
|
35448
35448
|
}
|
|
35449
35449
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
35450
|
-
isExcludedPath(
|
|
35451
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
35450
|
+
isExcludedPath(path23) {
|
|
35451
|
+
return EXCLUDED_PATH_PREFIXES.some((prefix) => path23.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path23.endsWith(suffix));
|
|
35452
35452
|
}
|
|
35453
35453
|
};
|
|
35454
35454
|
|
|
@@ -37171,7 +37171,6 @@ var LEGACY_FILES = [
|
|
|
37171
37171
|
"nodes.json",
|
|
37172
37172
|
"tasks.json",
|
|
37173
37173
|
"shares.json",
|
|
37174
|
-
"node-operations.json",
|
|
37175
37174
|
"election.json"
|
|
37176
37175
|
];
|
|
37177
37176
|
var LEGACY_DIRS = ["logs", "task-logs"];
|
|
@@ -39276,8 +39275,8 @@ function getErrorMap() {
|
|
|
39276
39275
|
|
|
39277
39276
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
39278
39277
|
var makeIssue = (params) => {
|
|
39279
|
-
const { data, path:
|
|
39280
|
-
const fullPath = [...
|
|
39278
|
+
const { data, path: path23, errorMaps, issueData } = params;
|
|
39279
|
+
const fullPath = [...path23, ...issueData.path || []];
|
|
39281
39280
|
const fullIssue = {
|
|
39282
39281
|
...issueData,
|
|
39283
39282
|
path: fullPath
|
|
@@ -39393,11 +39392,11 @@ var errorUtil;
|
|
|
39393
39392
|
|
|
39394
39393
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
39395
39394
|
var ParseInputLazyPath = class {
|
|
39396
|
-
constructor(parent, value,
|
|
39395
|
+
constructor(parent, value, path23, key) {
|
|
39397
39396
|
this._cachedPath = [];
|
|
39398
39397
|
this.parent = parent;
|
|
39399
39398
|
this.data = value;
|
|
39400
|
-
this._path =
|
|
39399
|
+
this._path = path23;
|
|
39401
39400
|
this._key = key;
|
|
39402
39401
|
}
|
|
39403
39402
|
get path() {
|
|
@@ -43325,8 +43324,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
43325
43324
|
});
|
|
43326
43325
|
|
|
43327
43326
|
// ../../packages/api/src/app/server.ts
|
|
43328
|
-
var
|
|
43329
|
-
var
|
|
43327
|
+
var path20 = __toESM(require("path"), 1);
|
|
43328
|
+
var fs19 = __toESM(require("fs"), 1);
|
|
43330
43329
|
var import_express14 = __toESM(require_express2(), 1);
|
|
43331
43330
|
|
|
43332
43331
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -43463,8 +43462,8 @@ function decodePathSegment(value) {
|
|
|
43463
43462
|
return value;
|
|
43464
43463
|
}
|
|
43465
43464
|
}
|
|
43466
|
-
function getSingleTaskDeleteId(
|
|
43467
|
-
const match = /^\/api\/tasks\/([^/]+)$/.exec(
|
|
43465
|
+
function getSingleTaskDeleteId(path23) {
|
|
43466
|
+
const match = /^\/api\/tasks\/([^/]+)$/.exec(path23);
|
|
43468
43467
|
return match ? decodePathSegment(match[1]) : null;
|
|
43469
43468
|
}
|
|
43470
43469
|
function getSuccessfulBatchDeleteIds(body) {
|
|
@@ -44503,8 +44502,6 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
|
44503
44502
|
}
|
|
44504
44503
|
|
|
44505
44504
|
// ../../packages/api/src/node/node-operation-service.ts
|
|
44506
|
-
var fs15 = __toESM(require("fs"), 1);
|
|
44507
|
-
var path17 = __toESM(require("path"), 1);
|
|
44508
44505
|
var import_node_crypto7 = require("crypto");
|
|
44509
44506
|
|
|
44510
44507
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
@@ -44791,6 +44788,7 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
44791
44788
|
}
|
|
44792
44789
|
|
|
44793
44790
|
// ../../packages/api/src/node/node-operation-service.ts
|
|
44791
|
+
var LEADER_REPORT_RETRY_MS = 5e3;
|
|
44794
44792
|
var NodeOperationFailure = class extends Error {
|
|
44795
44793
|
constructor(message, result) {
|
|
44796
44794
|
super(message);
|
|
@@ -44819,60 +44817,6 @@ var InMemoryNodeOperationStore = class {
|
|
|
44819
44817
|
return clone2(next);
|
|
44820
44818
|
}
|
|
44821
44819
|
};
|
|
44822
|
-
var FileNodeOperationStore = class {
|
|
44823
|
-
constructor(storagePath) {
|
|
44824
|
-
this.storagePath = storagePath;
|
|
44825
|
-
}
|
|
44826
|
-
operations = /* @__PURE__ */ new Map();
|
|
44827
|
-
loaded = false;
|
|
44828
|
-
get(id) {
|
|
44829
|
-
this.load();
|
|
44830
|
-
const operation = this.operations.get(id);
|
|
44831
|
-
return operation ? clone2(operation) : null;
|
|
44832
|
-
}
|
|
44833
|
-
list(filter = {}) {
|
|
44834
|
-
this.load();
|
|
44835
|
-
return Array.from(this.operations.values()).filter((operation) => matchesFilter(operation, filter)).sort((a, b) => b.createdAt - a.createdAt).map((operation) => clone2(operation));
|
|
44836
|
-
}
|
|
44837
|
-
upsert(operation) {
|
|
44838
|
-
this.load();
|
|
44839
|
-
const copy = clone2(operation);
|
|
44840
|
-
this.operations.set(copy.id, copy);
|
|
44841
|
-
this.persist();
|
|
44842
|
-
return clone2(copy);
|
|
44843
|
-
}
|
|
44844
|
-
update(id, updates) {
|
|
44845
|
-
this.load();
|
|
44846
|
-
const current = this.operations.get(id);
|
|
44847
|
-
if (!current) return null;
|
|
44848
|
-
const next = { ...current, ...clone2(updates), id, createdAt: current.createdAt };
|
|
44849
|
-
this.operations.set(id, next);
|
|
44850
|
-
this.persist();
|
|
44851
|
-
return clone2(next);
|
|
44852
|
-
}
|
|
44853
|
-
load() {
|
|
44854
|
-
if (this.loaded) return;
|
|
44855
|
-
this.loaded = true;
|
|
44856
|
-
if (!fs15.existsSync(this.filePath)) return;
|
|
44857
|
-
const raw = JSON.parse(fs15.readFileSync(this.filePath, "utf-8"));
|
|
44858
|
-
const entries = Array.isArray(raw) ? raw : Object.values(raw);
|
|
44859
|
-
for (const entry of entries) {
|
|
44860
|
-
if (isNodeOperation(entry)) {
|
|
44861
|
-
this.operations.set(entry.id, clone2(entry));
|
|
44862
|
-
}
|
|
44863
|
-
}
|
|
44864
|
-
}
|
|
44865
|
-
persist() {
|
|
44866
|
-
fs15.mkdirSync(this.storagePath, { recursive: true });
|
|
44867
|
-
const body = JSON.stringify(Object.fromEntries(this.operations), null, 2);
|
|
44868
|
-
const tmpPath = `${this.filePath}.tmp`;
|
|
44869
|
-
fs15.writeFileSync(tmpPath, body, "utf-8");
|
|
44870
|
-
fs15.renameSync(tmpPath, this.filePath);
|
|
44871
|
-
}
|
|
44872
|
-
get filePath() {
|
|
44873
|
-
return path17.join(this.storagePath, "node-operations.json");
|
|
44874
|
-
}
|
|
44875
|
-
};
|
|
44876
44820
|
var NodeOperationService = class {
|
|
44877
44821
|
constructor(deps, store) {
|
|
44878
44822
|
this.deps = deps;
|
|
@@ -44881,6 +44825,7 @@ var NodeOperationService = class {
|
|
|
44881
44825
|
this.registerHandler("workdir.branch-create", runWorkDirBranchCreateOperation);
|
|
44882
44826
|
}
|
|
44883
44827
|
handlers = /* @__PURE__ */ new Map();
|
|
44828
|
+
leaderReportRetryTimers = /* @__PURE__ */ new Map();
|
|
44884
44829
|
registerHandler(kind, handler) {
|
|
44885
44830
|
this.handlers.set(kind, handler);
|
|
44886
44831
|
}
|
|
@@ -44976,25 +44921,46 @@ var NodeOperationService = class {
|
|
|
44976
44921
|
async reportToLeader(operation) {
|
|
44977
44922
|
if (this.deps.nodeRegistry.isLeader()) return;
|
|
44978
44923
|
const leaderEndpoint = this.deps.nodeRegistry.getLeaderEndpoint?.();
|
|
44979
|
-
if (!leaderEndpoint)
|
|
44924
|
+
if (!leaderEndpoint) {
|
|
44925
|
+
this.scheduleLeaderReportRetry(operation);
|
|
44926
|
+
return;
|
|
44927
|
+
}
|
|
44980
44928
|
try {
|
|
44981
|
-
await fetch(`${leaderEndpoint}/api/worker/node-operations/${operation.id}`, applyRequestAuthHeaders({
|
|
44929
|
+
const response = await fetch(`${leaderEndpoint}/api/worker/node-operations/${operation.id}`, applyRequestAuthHeaders({
|
|
44982
44930
|
method: "POST",
|
|
44983
44931
|
headers: { "Content-Type": "application/json" },
|
|
44984
44932
|
body: JSON.stringify(operation)
|
|
44985
44933
|
}));
|
|
44934
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
44935
|
+
this.clearLeaderReportRetry(operation.id);
|
|
44986
44936
|
} catch (err) {
|
|
44987
44937
|
this.deps.logger.child("node-operation").warn("failed to report node operation update to leader", {
|
|
44988
44938
|
operationId: operation.id,
|
|
44989
44939
|
kind: operation.kind,
|
|
44940
|
+
status: operation.status,
|
|
44990
44941
|
error: err instanceof Error ? err.message : String(err)
|
|
44991
44942
|
});
|
|
44943
|
+
this.scheduleLeaderReportRetry(operation);
|
|
44992
44944
|
}
|
|
44993
44945
|
}
|
|
44946
|
+
scheduleLeaderReportRetry(operation) {
|
|
44947
|
+
if (!isTerminalStatus(operation.status) || this.leaderReportRetryTimers.has(operation.id)) return;
|
|
44948
|
+
const timer = setTimeout(() => {
|
|
44949
|
+
this.leaderReportRetryTimers.delete(operation.id);
|
|
44950
|
+
void this.reportToLeader(operation);
|
|
44951
|
+
}, LEADER_REPORT_RETRY_MS);
|
|
44952
|
+
this.leaderReportRetryTimers.set(operation.id, timer);
|
|
44953
|
+
}
|
|
44954
|
+
clearLeaderReportRetry(id) {
|
|
44955
|
+
const timer = this.leaderReportRetryTimers.get(id);
|
|
44956
|
+
if (!timer) return;
|
|
44957
|
+
clearTimeout(timer);
|
|
44958
|
+
this.leaderReportRetryTimers.delete(id);
|
|
44959
|
+
}
|
|
44994
44960
|
};
|
|
44995
44961
|
function getNodeOperationService(deps) {
|
|
44996
44962
|
if (deps.nodeOperationService) return deps.nodeOperationService;
|
|
44997
|
-
const store = deps.nodeOperationStore ??
|
|
44963
|
+
const store = deps.nodeOperationStore ?? new InMemoryNodeOperationStore();
|
|
44998
44964
|
const service = new NodeOperationService(deps, store);
|
|
44999
44965
|
deps.nodeOperationStore = store;
|
|
45000
44966
|
deps.nodeOperationService = service;
|
|
@@ -45064,10 +45030,8 @@ function readSettingsSnapshot(value) {
|
|
|
45064
45030
|
function matchesFilter(operation, filter) {
|
|
45065
45031
|
return (!filter.nodeId || operation.nodeId === filter.nodeId) && (!filter.status || operation.status === filter.status) && (!filter.kind || operation.kind === filter.kind);
|
|
45066
45032
|
}
|
|
45067
|
-
function
|
|
45068
|
-
|
|
45069
|
-
const record = value;
|
|
45070
|
-
return typeof record.id === "string" && typeof record.kind === "string" && typeof record.nodeId === "string" && typeof record.status === "string" && typeof record.createdAt === "number" && typeof record.updatedAt === "number";
|
|
45033
|
+
function isTerminalStatus(status) {
|
|
45034
|
+
return status === "succeeded" || status === "failed";
|
|
45071
45035
|
}
|
|
45072
45036
|
function clone2(value) {
|
|
45073
45037
|
return JSON.parse(JSON.stringify(value));
|
|
@@ -45180,7 +45144,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
|
|
|
45180
45144
|
}
|
|
45181
45145
|
|
|
45182
45146
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
45183
|
-
var
|
|
45147
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
45184
45148
|
var import_node_stream2 = require("stream");
|
|
45185
45149
|
var import_promises5 = require("stream/promises");
|
|
45186
45150
|
|
|
@@ -45242,10 +45206,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
45242
45206
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
45243
45207
|
}
|
|
45244
45208
|
const logPath = engine.getLogPath(taskId);
|
|
45245
|
-
if (!
|
|
45209
|
+
if (!fs15.existsSync(logPath)) {
|
|
45246
45210
|
return { logs: [], total: 0 };
|
|
45247
45211
|
}
|
|
45248
|
-
const content =
|
|
45212
|
+
const content = fs15.readFileSync(logPath, "utf-8");
|
|
45249
45213
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
45250
45214
|
const logs = [];
|
|
45251
45215
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -45480,19 +45444,19 @@ var import_node_child_process10 = require("child_process");
|
|
|
45480
45444
|
var import_node_crypto8 = require("crypto");
|
|
45481
45445
|
|
|
45482
45446
|
// ../../packages/api/src/node/node-terminal-service.ts
|
|
45483
|
-
var
|
|
45484
|
-
var
|
|
45447
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
45448
|
+
var path17 = __toESM(require("path"), 1);
|
|
45485
45449
|
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
45486
45450
|
function isAbsolutePath2(value) {
|
|
45487
|
-
return
|
|
45451
|
+
return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
45488
45452
|
}
|
|
45489
45453
|
function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
|
|
45490
45454
|
if (!rootPath) {
|
|
45491
45455
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
45492
45456
|
}
|
|
45493
45457
|
const requestedCwd = cwd?.trim() || ".";
|
|
45494
|
-
const resolved = isAbsolutePath2(requestedCwd) ?
|
|
45495
|
-
if (!
|
|
45458
|
+
const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
|
|
45459
|
+
if (!fs16.existsSync(resolved) || !fs16.statSync(resolved).isDirectory()) {
|
|
45496
45460
|
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
45497
45461
|
}
|
|
45498
45462
|
return resolved;
|
|
@@ -45731,13 +45695,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
45731
45695
|
}
|
|
45732
45696
|
|
|
45733
45697
|
// ../../packages/api/src/tasks/task-output-service.ts
|
|
45734
|
-
var
|
|
45735
|
-
var
|
|
45698
|
+
var fs18 = __toESM(require("fs"), 1);
|
|
45699
|
+
var path19 = __toESM(require("path"), 1);
|
|
45736
45700
|
|
|
45737
45701
|
// ../../packages/api/src/preview/preview-server.ts
|
|
45738
45702
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
45739
|
-
var
|
|
45740
|
-
var
|
|
45703
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
45704
|
+
var path18 = __toESM(require("path"), 1);
|
|
45741
45705
|
var http2 = __toESM(require("http"), 1);
|
|
45742
45706
|
var import_node_stream3 = require("stream");
|
|
45743
45707
|
var import_promises6 = require("stream/promises");
|
|
@@ -45849,19 +45813,19 @@ function buildPreviewWorkerProxyHeaders(req) {
|
|
|
45849
45813
|
// ../../packages/api/src/preview/preview-server.ts
|
|
45850
45814
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
45851
45815
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
45852
|
-
const resolvedPath =
|
|
45853
|
-
const normalizedRoot =
|
|
45854
|
-
if (!resolvedPath.startsWith(normalizedRoot +
|
|
45816
|
+
const resolvedPath = path18.resolve(rootPath, sanitizedPath);
|
|
45817
|
+
const normalizedRoot = path18.resolve(rootPath);
|
|
45818
|
+
if (!resolvedPath.startsWith(normalizedRoot + path18.sep) && resolvedPath !== normalizedRoot) {
|
|
45855
45819
|
throw new Error("Invalid preview path");
|
|
45856
45820
|
}
|
|
45857
45821
|
return {
|
|
45858
45822
|
absolutePath: resolvedPath,
|
|
45859
|
-
normalizedPath:
|
|
45823
|
+
normalizedPath: path18.relative(normalizedRoot, resolvedPath).split(path18.sep).join("/")
|
|
45860
45824
|
};
|
|
45861
45825
|
}
|
|
45862
45826
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
45863
45827
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
45864
|
-
if (!
|
|
45828
|
+
if (!fs17.existsSync(absolutePath) || !fs17.statSync(absolutePath).isFile()) {
|
|
45865
45829
|
throw new Error("Preview entry not found");
|
|
45866
45830
|
}
|
|
45867
45831
|
return normalizedPath;
|
|
@@ -45963,7 +45927,7 @@ var MIME_MAP2 = {
|
|
|
45963
45927
|
".mdx": "text/markdown"
|
|
45964
45928
|
};
|
|
45965
45929
|
function getMime(filePath) {
|
|
45966
|
-
return MIME_MAP2[
|
|
45930
|
+
return MIME_MAP2[path18.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
45967
45931
|
}
|
|
45968
45932
|
function escapeHtml(value) {
|
|
45969
45933
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -46317,14 +46281,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
|
|
|
46317
46281
|
res.end("Invalid path");
|
|
46318
46282
|
return;
|
|
46319
46283
|
}
|
|
46320
|
-
if (!
|
|
46284
|
+
if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isFile()) {
|
|
46321
46285
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
46322
46286
|
res.end("File not found");
|
|
46323
46287
|
return;
|
|
46324
46288
|
}
|
|
46325
|
-
const ext =
|
|
46289
|
+
const ext = path18.extname(resolved).toLowerCase();
|
|
46326
46290
|
const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
|
|
46327
|
-
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(
|
|
46291
|
+
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs17.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs17.readFileSync(resolved);
|
|
46328
46292
|
res.writeHead(200, {
|
|
46329
46293
|
"Content-Type": mime,
|
|
46330
46294
|
"Content-Length": content.length,
|
|
@@ -46646,13 +46610,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
46646
46610
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
46647
46611
|
try {
|
|
46648
46612
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
46649
|
-
if (!
|
|
46613
|
+
if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
|
|
46650
46614
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
46651
46615
|
}
|
|
46652
46616
|
const { mimeType } = classifyFile(absolutePath);
|
|
46653
|
-
const fileName =
|
|
46617
|
+
const fileName = path19.basename(absolutePath).replace(/"/g, "");
|
|
46654
46618
|
return {
|
|
46655
|
-
content:
|
|
46619
|
+
content: fs18.readFileSync(absolutePath),
|
|
46656
46620
|
headers: {
|
|
46657
46621
|
"Content-Type": mimeType,
|
|
46658
46622
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -49609,8 +49573,8 @@ function hasAuthorizationHeader(req) {
|
|
|
49609
49573
|
function resolveRuntimeBaseDir() {
|
|
49610
49574
|
const entryPath = process.argv[1];
|
|
49611
49575
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
49612
|
-
const resolved =
|
|
49613
|
-
return
|
|
49576
|
+
const resolved = fs19.realpathSync(path20.resolve(entryPath));
|
|
49577
|
+
return path20.dirname(resolved);
|
|
49614
49578
|
}
|
|
49615
49579
|
return process.cwd();
|
|
49616
49580
|
}
|
|
@@ -49618,18 +49582,18 @@ function resolveStaticDir(baseDir) {
|
|
|
49618
49582
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
49619
49583
|
const candidateDirs = [
|
|
49620
49584
|
envStaticDir,
|
|
49621
|
-
|
|
49622
|
-
|
|
49623
|
-
|
|
49624
|
-
|
|
49625
|
-
|
|
49626
|
-
|
|
49627
|
-
|
|
49628
|
-
|
|
49629
|
-
|
|
49585
|
+
path20.resolve(baseDir, "dashboard"),
|
|
49586
|
+
path20.resolve(baseDir, "../dashboard"),
|
|
49587
|
+
path20.resolve(baseDir, "../../dashboard/dist"),
|
|
49588
|
+
path20.resolve(baseDir, "../../../packages/dashboard/dist"),
|
|
49589
|
+
path20.resolve(baseDir, "../public"),
|
|
49590
|
+
path20.resolve(baseDir, "../../packages/api/public"),
|
|
49591
|
+
path20.resolve(baseDir, "../../../packages/api/public"),
|
|
49592
|
+
path20.resolve(process.cwd(), "packages/dashboard/dist"),
|
|
49593
|
+
path20.resolve(process.cwd(), "packages/api/public")
|
|
49630
49594
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
49631
49595
|
for (const candidate of candidateDirs) {
|
|
49632
|
-
if (
|
|
49596
|
+
if (fs19.existsSync(candidate)) {
|
|
49633
49597
|
return candidate;
|
|
49634
49598
|
}
|
|
49635
49599
|
}
|
|
@@ -49730,8 +49694,8 @@ function createServer2(deps) {
|
|
|
49730
49694
|
app.use("/api/node-operations", createNodeOperationRoutes());
|
|
49731
49695
|
app.use("/api/events", createEventRoutes());
|
|
49732
49696
|
if (staticDir) {
|
|
49733
|
-
const indexPath =
|
|
49734
|
-
if (
|
|
49697
|
+
const indexPath = path20.join(staticDir, "index.html");
|
|
49698
|
+
if (fs19.existsSync(indexPath)) {
|
|
49735
49699
|
app.get("*", (req, res, next) => {
|
|
49736
49700
|
if (isApiRequest(req)) {
|
|
49737
49701
|
next();
|
|
@@ -50127,8 +50091,8 @@ var terminalWriter = {
|
|
|
50127
50091
|
};
|
|
50128
50092
|
|
|
50129
50093
|
// src/startup.ts
|
|
50130
|
-
var
|
|
50131
|
-
var
|
|
50094
|
+
var fs20 = __toESM(require("fs"), 1);
|
|
50095
|
+
var path21 = __toESM(require("path"), 1);
|
|
50132
50096
|
var readline = __toESM(require("readline/promises"), 1);
|
|
50133
50097
|
var import_node_child_process12 = require("child_process");
|
|
50134
50098
|
function getDefaultNodeName() {
|
|
@@ -50191,19 +50155,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
50191
50155
|
};
|
|
50192
50156
|
}
|
|
50193
50157
|
function getNodeMetadataPath2(storagePath) {
|
|
50194
|
-
return
|
|
50158
|
+
return path21.join(storagePath, "metadata.json");
|
|
50195
50159
|
}
|
|
50196
50160
|
function readStartupMetadataFile(storagePath) {
|
|
50197
50161
|
try {
|
|
50198
|
-
const raw = JSON.parse(
|
|
50162
|
+
const raw = JSON.parse(fs20.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
50199
50163
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
50200
50164
|
} catch {
|
|
50201
50165
|
return {};
|
|
50202
50166
|
}
|
|
50203
50167
|
}
|
|
50204
50168
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
50205
|
-
|
|
50206
|
-
|
|
50169
|
+
fs20.mkdirSync(storagePath, { recursive: true });
|
|
50170
|
+
fs20.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
50207
50171
|
}
|
|
50208
50172
|
function formatLocalDate2(now) {
|
|
50209
50173
|
const year = now.getFullYear();
|
|
@@ -50442,9 +50406,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
50442
50406
|
metadata
|
|
50443
50407
|
};
|
|
50444
50408
|
}
|
|
50445
|
-
function loadConfigFile(
|
|
50409
|
+
function loadConfigFile(path23) {
|
|
50446
50410
|
try {
|
|
50447
|
-
const raw =
|
|
50411
|
+
const raw = fs20.readFileSync(path23, "utf-8");
|
|
50448
50412
|
return JSON.parse(raw);
|
|
50449
50413
|
} catch {
|
|
50450
50414
|
return {};
|
|
@@ -50622,26 +50586,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
50622
50586
|
}
|
|
50623
50587
|
|
|
50624
50588
|
// src/runtime-metadata.ts
|
|
50625
|
-
var
|
|
50626
|
-
var
|
|
50589
|
+
var fs21 = __toESM(require("fs"), 1);
|
|
50590
|
+
var path22 = __toESM(require("path"), 1);
|
|
50627
50591
|
var import_node_child_process13 = require("child_process");
|
|
50628
50592
|
var runtimeDir = resolveRuntimeDir();
|
|
50629
50593
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
50630
|
-
var repoRoot =
|
|
50594
|
+
var repoRoot = path22.resolve(appRoot, "../..");
|
|
50631
50595
|
function resolveRuntimeDir() {
|
|
50632
50596
|
const entryPath = process.argv[1];
|
|
50633
50597
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
50634
50598
|
try {
|
|
50635
|
-
return
|
|
50599
|
+
return path22.dirname(fs21.realpathSync(path22.resolve(entryPath)));
|
|
50636
50600
|
} catch {
|
|
50637
|
-
return
|
|
50601
|
+
return path22.dirname(path22.resolve(entryPath));
|
|
50638
50602
|
}
|
|
50639
50603
|
}
|
|
50640
50604
|
return process.cwd();
|
|
50641
50605
|
}
|
|
50642
50606
|
function readJsonFile(filePath) {
|
|
50643
50607
|
try {
|
|
50644
|
-
return JSON.parse(
|
|
50608
|
+
return JSON.parse(fs21.readFileSync(filePath, "utf-8"));
|
|
50645
50609
|
} catch {
|
|
50646
50610
|
return null;
|
|
50647
50611
|
}
|
|
@@ -50651,9 +50615,9 @@ function readPackageManifest(filePath) {
|
|
|
50651
50615
|
}
|
|
50652
50616
|
function readEmbeddedRuntimeMetadata() {
|
|
50653
50617
|
const candidates = [
|
|
50654
|
-
|
|
50655
|
-
|
|
50656
|
-
|
|
50618
|
+
path22.join(appRoot, "runtime-metadata.json"),
|
|
50619
|
+
path22.join(runtimeDir, "runtime-metadata.json"),
|
|
50620
|
+
path22.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
|
|
50657
50621
|
];
|
|
50658
50622
|
for (const candidate of candidates) {
|
|
50659
50623
|
const metadata = readJsonFile(candidate);
|
|
@@ -50666,23 +50630,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
50666
50630
|
function resolveAppRoot(baseDir) {
|
|
50667
50631
|
const candidates = [
|
|
50668
50632
|
baseDir,
|
|
50669
|
-
|
|
50670
|
-
|
|
50671
|
-
|
|
50633
|
+
path22.resolve(baseDir, ".."),
|
|
50634
|
+
path22.resolve(process.cwd(), "apps/node/dist"),
|
|
50635
|
+
path22.resolve(process.cwd(), "apps/node"),
|
|
50672
50636
|
process.cwd()
|
|
50673
50637
|
];
|
|
50674
50638
|
for (const candidate of candidates) {
|
|
50675
|
-
const manifest = readPackageManifest(
|
|
50639
|
+
const manifest = readPackageManifest(path22.join(candidate, "package.json"));
|
|
50676
50640
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
50677
50641
|
return candidate;
|
|
50678
50642
|
}
|
|
50679
50643
|
}
|
|
50680
50644
|
for (const candidate of candidates) {
|
|
50681
|
-
if (
|
|
50645
|
+
if (fs21.existsSync(path22.join(candidate, "package.json"))) {
|
|
50682
50646
|
return candidate;
|
|
50683
50647
|
}
|
|
50684
50648
|
}
|
|
50685
|
-
return
|
|
50649
|
+
return path22.resolve(baseDir, "..");
|
|
50686
50650
|
}
|
|
50687
50651
|
function toPackageInfo(filePath) {
|
|
50688
50652
|
const manifest = readPackageManifest(filePath);
|
|
@@ -50742,8 +50706,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
50742
50706
|
components: startupRequirements.components
|
|
50743
50707
|
};
|
|
50744
50708
|
}
|
|
50745
|
-
const appPackage = toPackageInfo(
|
|
50746
|
-
const workspaceManifest = readPackageManifest(
|
|
50709
|
+
const appPackage = toPackageInfo(path22.join(appRoot, "package.json"));
|
|
50710
|
+
const workspaceManifest = readPackageManifest(path22.join(repoRoot, "package.json"));
|
|
50747
50711
|
return {
|
|
50748
50712
|
packageName: appPackage?.name ?? "meshy",
|
|
50749
50713
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -50751,11 +50715,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
50751
50715
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
50752
50716
|
components: startupRequirements.components,
|
|
50753
50717
|
packages: {
|
|
50754
|
-
workspace: toPackageInfo(
|
|
50718
|
+
workspace: toPackageInfo(path22.join(repoRoot, "package.json")),
|
|
50755
50719
|
node: appPackage,
|
|
50756
|
-
core: toPackageInfo(
|
|
50757
|
-
dashboard: toPackageInfo(
|
|
50758
|
-
api: toPackageInfo(
|
|
50720
|
+
core: toPackageInfo(path22.join(repoRoot, "packages/core/package.json")),
|
|
50721
|
+
dashboard: toPackageInfo(path22.join(repoRoot, "packages/dashboard/package.json")),
|
|
50722
|
+
api: toPackageInfo(path22.join(repoRoot, "packages/api/package.json"))
|
|
50759
50723
|
},
|
|
50760
50724
|
repository: {
|
|
50761
50725
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|