staklink 0.3.78 → 0.3.80
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/proxy-server.cjs +506 -385
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -1289,8 +1289,8 @@ var require_node = __commonJS({
|
|
|
1289
1289
|
}
|
|
1290
1290
|
break;
|
|
1291
1291
|
case "FILE":
|
|
1292
|
-
var
|
|
1293
|
-
stream3 = new
|
|
1292
|
+
var fs15 = require("fs");
|
|
1293
|
+
stream3 = new fs15.SyncWriteStream(fd2, { autoClose: false });
|
|
1294
1294
|
stream3._type = "fs";
|
|
1295
1295
|
break;
|
|
1296
1296
|
case "PIPE":
|
|
@@ -14077,11 +14077,11 @@ var require_mime_types = __commonJS({
|
|
|
14077
14077
|
}
|
|
14078
14078
|
return exts[0];
|
|
14079
14079
|
}
|
|
14080
|
-
function lookup(
|
|
14081
|
-
if (!
|
|
14080
|
+
function lookup(path12) {
|
|
14081
|
+
if (!path12 || typeof path12 !== "string") {
|
|
14082
14082
|
return false;
|
|
14083
14083
|
}
|
|
14084
|
-
var extension2 = extname("x." +
|
|
14084
|
+
var extension2 = extname("x." + path12).toLowerCase().substr(1);
|
|
14085
14085
|
if (!extension2) {
|
|
14086
14086
|
return false;
|
|
14087
14087
|
}
|
|
@@ -17508,8 +17508,8 @@ var require_node2 = __commonJS({
|
|
|
17508
17508
|
}
|
|
17509
17509
|
break;
|
|
17510
17510
|
case "FILE":
|
|
17511
|
-
var
|
|
17512
|
-
stream3 = new
|
|
17511
|
+
var fs15 = require("fs");
|
|
17512
|
+
stream3 = new fs15.SyncWriteStream(fd2, { autoClose: false });
|
|
17513
17513
|
stream3._type = "fs";
|
|
17514
17514
|
break;
|
|
17515
17515
|
case "PIPE":
|
|
@@ -18227,8 +18227,8 @@ var require_node3 = __commonJS({
|
|
|
18227
18227
|
}
|
|
18228
18228
|
break;
|
|
18229
18229
|
case "FILE":
|
|
18230
|
-
var
|
|
18231
|
-
stream3 = new
|
|
18230
|
+
var fs15 = require("fs");
|
|
18231
|
+
stream3 = new fs15.SyncWriteStream(fd2, { autoClose: false });
|
|
18232
18232
|
stream3._type = "fs";
|
|
18233
18233
|
break;
|
|
18234
18234
|
case "PIPE":
|
|
@@ -18316,7 +18316,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18316
18316
|
"node_modules/path-to-regexp/index.js"(exports2, module2) {
|
|
18317
18317
|
module2.exports = pathToRegexp;
|
|
18318
18318
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
18319
|
-
function pathToRegexp(
|
|
18319
|
+
function pathToRegexp(path12, keys, options) {
|
|
18320
18320
|
options = options || {};
|
|
18321
18321
|
keys = keys || [];
|
|
18322
18322
|
var strict = options.strict;
|
|
@@ -18330,8 +18330,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
18330
18330
|
var pos = 0;
|
|
18331
18331
|
var backtrack = "";
|
|
18332
18332
|
var m;
|
|
18333
|
-
if (
|
|
18334
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18333
|
+
if (path12 instanceof RegExp) {
|
|
18334
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path12.source)) {
|
|
18335
18335
|
if (m[0][0] === "\\") continue;
|
|
18336
18336
|
keys.push({
|
|
18337
18337
|
name: m[1] || name40++,
|
|
@@ -18339,18 +18339,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
18339
18339
|
offset: m.index
|
|
18340
18340
|
});
|
|
18341
18341
|
}
|
|
18342
|
-
return
|
|
18342
|
+
return path12;
|
|
18343
18343
|
}
|
|
18344
|
-
if (Array.isArray(
|
|
18345
|
-
|
|
18344
|
+
if (Array.isArray(path12)) {
|
|
18345
|
+
path12 = path12.map(function(value) {
|
|
18346
18346
|
return pathToRegexp(value, keys, options).source;
|
|
18347
18347
|
});
|
|
18348
|
-
return new RegExp(
|
|
18348
|
+
return new RegExp(path12.join("|"), flags);
|
|
18349
18349
|
}
|
|
18350
|
-
if (typeof
|
|
18350
|
+
if (typeof path12 !== "string") {
|
|
18351
18351
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18352
18352
|
}
|
|
18353
|
-
|
|
18353
|
+
path12 = path12.replace(
|
|
18354
18354
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
18355
18355
|
function(match2, slash, format, key, capture, star3, optional3, offset) {
|
|
18356
18356
|
if (match2[0] === "\\") {
|
|
@@ -18367,7 +18367,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18367
18367
|
if (slash || format) {
|
|
18368
18368
|
backtrack = "";
|
|
18369
18369
|
} else {
|
|
18370
|
-
backtrack +=
|
|
18370
|
+
backtrack += path12.slice(pos, offset);
|
|
18371
18371
|
}
|
|
18372
18372
|
pos = offset + match2.length;
|
|
18373
18373
|
if (match2 === "*") {
|
|
@@ -18395,7 +18395,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18395
18395
|
return result;
|
|
18396
18396
|
}
|
|
18397
18397
|
);
|
|
18398
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
18398
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path12)) {
|
|
18399
18399
|
if (m[0][0] === "\\") continue;
|
|
18400
18400
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
18401
18401
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -18407,13 +18407,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
18407
18407
|
}
|
|
18408
18408
|
i++;
|
|
18409
18409
|
}
|
|
18410
|
-
|
|
18410
|
+
path12 += strict ? "" : path12[path12.length - 1] === "/" ? "?" : "/?";
|
|
18411
18411
|
if (end) {
|
|
18412
|
-
|
|
18413
|
-
} else if (
|
|
18414
|
-
|
|
18412
|
+
path12 += "$";
|
|
18413
|
+
} else if (path12[path12.length - 1] !== "/") {
|
|
18414
|
+
path12 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
18415
18415
|
}
|
|
18416
|
-
return new RegExp("^" +
|
|
18416
|
+
return new RegExp("^" + path12, flags);
|
|
18417
18417
|
}
|
|
18418
18418
|
}
|
|
18419
18419
|
});
|
|
@@ -18426,19 +18426,19 @@ var require_layer = __commonJS({
|
|
|
18426
18426
|
var debug = require_src3()("express:router:layer");
|
|
18427
18427
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
18428
18428
|
module2.exports = Layer;
|
|
18429
|
-
function Layer(
|
|
18429
|
+
function Layer(path12, options, fn) {
|
|
18430
18430
|
if (!(this instanceof Layer)) {
|
|
18431
|
-
return new Layer(
|
|
18431
|
+
return new Layer(path12, options, fn);
|
|
18432
18432
|
}
|
|
18433
|
-
debug("new %o",
|
|
18433
|
+
debug("new %o", path12);
|
|
18434
18434
|
var opts = options || {};
|
|
18435
18435
|
this.handle = fn;
|
|
18436
18436
|
this.name = fn.name || "<anonymous>";
|
|
18437
18437
|
this.params = void 0;
|
|
18438
18438
|
this.path = void 0;
|
|
18439
|
-
this.regexp = pathRegexp(
|
|
18440
|
-
this.regexp.fast_star =
|
|
18441
|
-
this.regexp.fast_slash =
|
|
18439
|
+
this.regexp = pathRegexp(path12, this.keys = [], opts);
|
|
18440
|
+
this.regexp.fast_star = path12 === "*";
|
|
18441
|
+
this.regexp.fast_slash = path12 === "/" && opts.end === false;
|
|
18442
18442
|
}
|
|
18443
18443
|
Layer.prototype.handle_error = function handle_error(error87, req, res, next) {
|
|
18444
18444
|
var fn = this.handle;
|
|
@@ -18462,20 +18462,20 @@ var require_layer = __commonJS({
|
|
|
18462
18462
|
next(err);
|
|
18463
18463
|
}
|
|
18464
18464
|
};
|
|
18465
|
-
Layer.prototype.match = function match2(
|
|
18465
|
+
Layer.prototype.match = function match2(path12) {
|
|
18466
18466
|
var match3;
|
|
18467
|
-
if (
|
|
18467
|
+
if (path12 != null) {
|
|
18468
18468
|
if (this.regexp.fast_slash) {
|
|
18469
18469
|
this.params = {};
|
|
18470
18470
|
this.path = "";
|
|
18471
18471
|
return true;
|
|
18472
18472
|
}
|
|
18473
18473
|
if (this.regexp.fast_star) {
|
|
18474
|
-
this.params = { "0": decode_param(
|
|
18475
|
-
this.path =
|
|
18474
|
+
this.params = { "0": decode_param(path12) };
|
|
18475
|
+
this.path = path12;
|
|
18476
18476
|
return true;
|
|
18477
18477
|
}
|
|
18478
|
-
match3 = this.regexp.exec(
|
|
18478
|
+
match3 = this.regexp.exec(path12);
|
|
18479
18479
|
}
|
|
18480
18480
|
if (!match3) {
|
|
18481
18481
|
this.params = void 0;
|
|
@@ -18568,10 +18568,10 @@ var require_route = __commonJS({
|
|
|
18568
18568
|
var slice = Array.prototype.slice;
|
|
18569
18569
|
var toString = Object.prototype.toString;
|
|
18570
18570
|
module2.exports = Route;
|
|
18571
|
-
function Route(
|
|
18572
|
-
this.path =
|
|
18571
|
+
function Route(path12) {
|
|
18572
|
+
this.path = path12;
|
|
18573
18573
|
this.stack = [];
|
|
18574
|
-
debug("new %o",
|
|
18574
|
+
debug("new %o", path12);
|
|
18575
18575
|
this.methods = {};
|
|
18576
18576
|
}
|
|
18577
18577
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -18783,8 +18783,8 @@ var require_router = __commonJS({
|
|
|
18783
18783
|
if (++sync2 > 100) {
|
|
18784
18784
|
return setImmediate(next, err);
|
|
18785
18785
|
}
|
|
18786
|
-
var
|
|
18787
|
-
if (
|
|
18786
|
+
var path12 = getPathname(req);
|
|
18787
|
+
if (path12 == null) {
|
|
18788
18788
|
return done(layerError);
|
|
18789
18789
|
}
|
|
18790
18790
|
var layer;
|
|
@@ -18792,7 +18792,7 @@ var require_router = __commonJS({
|
|
|
18792
18792
|
var route;
|
|
18793
18793
|
while (match2 !== true && idx < stack.length) {
|
|
18794
18794
|
layer = stack[idx++];
|
|
18795
|
-
match2 = matchLayer(layer,
|
|
18795
|
+
match2 = matchLayer(layer, path12);
|
|
18796
18796
|
route = layer.route;
|
|
18797
18797
|
if (typeof match2 !== "boolean") {
|
|
18798
18798
|
layerError = layerError || match2;
|
|
@@ -18830,18 +18830,18 @@ var require_router = __commonJS({
|
|
|
18830
18830
|
} else if (route) {
|
|
18831
18831
|
layer.handle_request(req, res, next);
|
|
18832
18832
|
} else {
|
|
18833
|
-
trim_prefix(layer, layerError, layerPath,
|
|
18833
|
+
trim_prefix(layer, layerError, layerPath, path12);
|
|
18834
18834
|
}
|
|
18835
18835
|
sync2 = 0;
|
|
18836
18836
|
});
|
|
18837
18837
|
}
|
|
18838
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
18838
|
+
function trim_prefix(layer, layerError, layerPath, path12) {
|
|
18839
18839
|
if (layerPath.length !== 0) {
|
|
18840
|
-
if (layerPath !==
|
|
18840
|
+
if (layerPath !== path12.slice(0, layerPath.length)) {
|
|
18841
18841
|
next(layerError);
|
|
18842
18842
|
return;
|
|
18843
18843
|
}
|
|
18844
|
-
var c =
|
|
18844
|
+
var c = path12[layerPath.length];
|
|
18845
18845
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
18846
18846
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
18847
18847
|
removed = layerPath;
|
|
@@ -18919,7 +18919,7 @@ var require_router = __commonJS({
|
|
|
18919
18919
|
};
|
|
18920
18920
|
proto.use = function use(fn) {
|
|
18921
18921
|
var offset = 0;
|
|
18922
|
-
var
|
|
18922
|
+
var path12 = "/";
|
|
18923
18923
|
if (typeof fn !== "function") {
|
|
18924
18924
|
var arg = fn;
|
|
18925
18925
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -18927,7 +18927,7 @@ var require_router = __commonJS({
|
|
|
18927
18927
|
}
|
|
18928
18928
|
if (typeof arg !== "function") {
|
|
18929
18929
|
offset = 1;
|
|
18930
|
-
|
|
18930
|
+
path12 = fn;
|
|
18931
18931
|
}
|
|
18932
18932
|
}
|
|
18933
18933
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -18939,8 +18939,8 @@ var require_router = __commonJS({
|
|
|
18939
18939
|
if (typeof fn !== "function") {
|
|
18940
18940
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
18941
18941
|
}
|
|
18942
|
-
debug("use %o %s",
|
|
18943
|
-
var layer = new Layer(
|
|
18942
|
+
debug("use %o %s", path12, fn.name || "<anonymous>");
|
|
18943
|
+
var layer = new Layer(path12, {
|
|
18944
18944
|
sensitive: this.caseSensitive,
|
|
18945
18945
|
strict: false,
|
|
18946
18946
|
end: false
|
|
@@ -18950,9 +18950,9 @@ var require_router = __commonJS({
|
|
|
18950
18950
|
}
|
|
18951
18951
|
return this;
|
|
18952
18952
|
};
|
|
18953
|
-
proto.route = function route(
|
|
18954
|
-
var route2 = new Route(
|
|
18955
|
-
var layer = new Layer(
|
|
18953
|
+
proto.route = function route(path12) {
|
|
18954
|
+
var route2 = new Route(path12);
|
|
18955
|
+
var layer = new Layer(path12, {
|
|
18956
18956
|
sensitive: this.caseSensitive,
|
|
18957
18957
|
strict: this.strict,
|
|
18958
18958
|
end: true
|
|
@@ -18962,8 +18962,8 @@ var require_router = __commonJS({
|
|
|
18962
18962
|
return route2;
|
|
18963
18963
|
};
|
|
18964
18964
|
methods.concat("all").forEach(function(method) {
|
|
18965
|
-
proto[method] = function(
|
|
18966
|
-
var route = this.route(
|
|
18965
|
+
proto[method] = function(path12) {
|
|
18966
|
+
var route = this.route(path12);
|
|
18967
18967
|
route[method].apply(route, slice.call(arguments, 1));
|
|
18968
18968
|
return this;
|
|
18969
18969
|
};
|
|
@@ -18999,9 +18999,9 @@ var require_router = __commonJS({
|
|
|
18999
18999
|
}
|
|
19000
19000
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
19001
19001
|
}
|
|
19002
|
-
function matchLayer(layer,
|
|
19002
|
+
function matchLayer(layer, path12) {
|
|
19003
19003
|
try {
|
|
19004
|
-
return layer.match(
|
|
19004
|
+
return layer.match(path12);
|
|
19005
19005
|
} catch (err) {
|
|
19006
19006
|
return err;
|
|
19007
19007
|
}
|
|
@@ -19119,13 +19119,13 @@ var require_view = __commonJS({
|
|
|
19119
19119
|
"node_modules/express/lib/view.js"(exports2, module2) {
|
|
19120
19120
|
"use strict";
|
|
19121
19121
|
var debug = require_src3()("express:view");
|
|
19122
|
-
var
|
|
19123
|
-
var
|
|
19124
|
-
var dirname2 =
|
|
19125
|
-
var basename2 =
|
|
19126
|
-
var extname =
|
|
19127
|
-
var join7 =
|
|
19128
|
-
var resolve5 =
|
|
19122
|
+
var path12 = require("path");
|
|
19123
|
+
var fs15 = require("fs");
|
|
19124
|
+
var dirname2 = path12.dirname;
|
|
19125
|
+
var basename2 = path12.basename;
|
|
19126
|
+
var extname = path12.extname;
|
|
19127
|
+
var join7 = path12.join;
|
|
19128
|
+
var resolve5 = path12.resolve;
|
|
19129
19129
|
module2.exports = View;
|
|
19130
19130
|
function View(name40, options) {
|
|
19131
19131
|
var opts = options || {};
|
|
@@ -19154,17 +19154,17 @@ var require_view = __commonJS({
|
|
|
19154
19154
|
this.path = this.lookup(fileName);
|
|
19155
19155
|
}
|
|
19156
19156
|
View.prototype.lookup = function lookup(name40) {
|
|
19157
|
-
var
|
|
19157
|
+
var path13;
|
|
19158
19158
|
var roots = [].concat(this.root);
|
|
19159
19159
|
debug('lookup "%s"', name40);
|
|
19160
|
-
for (var i = 0; i < roots.length && !
|
|
19160
|
+
for (var i = 0; i < roots.length && !path13; i++) {
|
|
19161
19161
|
var root = roots[i];
|
|
19162
19162
|
var loc = resolve5(root, name40);
|
|
19163
19163
|
var dir = dirname2(loc);
|
|
19164
19164
|
var file3 = basename2(loc);
|
|
19165
|
-
|
|
19165
|
+
path13 = this.resolve(dir, file3);
|
|
19166
19166
|
}
|
|
19167
|
-
return
|
|
19167
|
+
return path13;
|
|
19168
19168
|
};
|
|
19169
19169
|
View.prototype.render = function render(options, callback) {
|
|
19170
19170
|
debug('render "%s"', this.path);
|
|
@@ -19172,21 +19172,21 @@ var require_view = __commonJS({
|
|
|
19172
19172
|
};
|
|
19173
19173
|
View.prototype.resolve = function resolve6(dir, file3) {
|
|
19174
19174
|
var ext2 = this.ext;
|
|
19175
|
-
var
|
|
19176
|
-
var stat4 = tryStat(
|
|
19175
|
+
var path13 = join7(dir, file3);
|
|
19176
|
+
var stat4 = tryStat(path13);
|
|
19177
19177
|
if (stat4 && stat4.isFile()) {
|
|
19178
|
-
return
|
|
19178
|
+
return path13;
|
|
19179
19179
|
}
|
|
19180
|
-
|
|
19181
|
-
stat4 = tryStat(
|
|
19180
|
+
path13 = join7(dir, basename2(file3, ext2), "index" + ext2);
|
|
19181
|
+
stat4 = tryStat(path13);
|
|
19182
19182
|
if (stat4 && stat4.isFile()) {
|
|
19183
|
-
return
|
|
19183
|
+
return path13;
|
|
19184
19184
|
}
|
|
19185
19185
|
};
|
|
19186
|
-
function tryStat(
|
|
19187
|
-
debug('stat "%s"',
|
|
19186
|
+
function tryStat(path13) {
|
|
19187
|
+
debug('stat "%s"', path13);
|
|
19188
19188
|
try {
|
|
19189
|
-
return
|
|
19189
|
+
return fs15.statSync(path13);
|
|
19190
19190
|
} catch (e) {
|
|
19191
19191
|
return void 0;
|
|
19192
19192
|
}
|
|
@@ -19791,8 +19791,8 @@ var require_node4 = __commonJS({
|
|
|
19791
19791
|
}
|
|
19792
19792
|
break;
|
|
19793
19793
|
case "FILE":
|
|
19794
|
-
var
|
|
19795
|
-
stream3 = new
|
|
19794
|
+
var fs15 = require("fs");
|
|
19795
|
+
stream3 = new fs15.SyncWriteStream(fd2, { autoClose: false });
|
|
19796
19796
|
stream3._type = "fs";
|
|
19797
19797
|
break;
|
|
19798
19798
|
case "PIPE":
|
|
@@ -19978,8 +19978,8 @@ var require_types = __commonJS({
|
|
|
19978
19978
|
// node_modules/mime/mime.js
|
|
19979
19979
|
var require_mime = __commonJS({
|
|
19980
19980
|
"node_modules/mime/mime.js"(exports2, module2) {
|
|
19981
|
-
var
|
|
19982
|
-
var
|
|
19981
|
+
var path12 = require("path");
|
|
19982
|
+
var fs15 = require("fs");
|
|
19983
19983
|
function Mime() {
|
|
19984
19984
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
19985
19985
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -20000,7 +20000,7 @@ var require_mime = __commonJS({
|
|
|
20000
20000
|
};
|
|
20001
20001
|
Mime.prototype.load = function(file3) {
|
|
20002
20002
|
this._loading = file3;
|
|
20003
|
-
var map3 = {}, content =
|
|
20003
|
+
var map3 = {}, content = fs15.readFileSync(file3, "ascii"), lines = content.split(/[\r\n]+/);
|
|
20004
20004
|
lines.forEach(function(line) {
|
|
20005
20005
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
20006
20006
|
map3[fields.shift()] = fields;
|
|
@@ -20008,8 +20008,8 @@ var require_mime = __commonJS({
|
|
|
20008
20008
|
this.define(map3);
|
|
20009
20009
|
this._loading = null;
|
|
20010
20010
|
};
|
|
20011
|
-
Mime.prototype.lookup = function(
|
|
20012
|
-
var ext2 =
|
|
20011
|
+
Mime.prototype.lookup = function(path13, fallback) {
|
|
20012
|
+
var ext2 = path13.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
20013
20013
|
return this.types[ext2] || fallback || this.default_type;
|
|
20014
20014
|
};
|
|
20015
20015
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -20238,33 +20238,33 @@ var require_send = __commonJS({
|
|
|
20238
20238
|
var escapeHtml = require_escape_html();
|
|
20239
20239
|
var etag = require_etag();
|
|
20240
20240
|
var fresh = require_fresh();
|
|
20241
|
-
var
|
|
20241
|
+
var fs15 = require("fs");
|
|
20242
20242
|
var mime = require_mime();
|
|
20243
20243
|
var ms = require_ms5();
|
|
20244
20244
|
var onFinished = require_on_finished();
|
|
20245
20245
|
var parseRange = require_range_parser();
|
|
20246
|
-
var
|
|
20246
|
+
var path12 = require("path");
|
|
20247
20247
|
var statuses = require_statuses();
|
|
20248
20248
|
var Stream2 = require("stream");
|
|
20249
20249
|
var util4 = require("util");
|
|
20250
|
-
var extname =
|
|
20251
|
-
var join7 =
|
|
20252
|
-
var normalize2 =
|
|
20253
|
-
var resolve5 =
|
|
20254
|
-
var sep2 =
|
|
20250
|
+
var extname = path12.extname;
|
|
20251
|
+
var join7 = path12.join;
|
|
20252
|
+
var normalize2 = path12.normalize;
|
|
20253
|
+
var resolve5 = path12.resolve;
|
|
20254
|
+
var sep2 = path12.sep;
|
|
20255
20255
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
20256
20256
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
20257
20257
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
20258
20258
|
module2.exports = send;
|
|
20259
20259
|
module2.exports.mime = mime;
|
|
20260
|
-
function send(req,
|
|
20261
|
-
return new SendStream(req,
|
|
20260
|
+
function send(req, path13, options) {
|
|
20261
|
+
return new SendStream(req, path13, options);
|
|
20262
20262
|
}
|
|
20263
|
-
function SendStream(req,
|
|
20263
|
+
function SendStream(req, path13, options) {
|
|
20264
20264
|
Stream2.call(this);
|
|
20265
20265
|
var opts = options || {};
|
|
20266
20266
|
this.options = opts;
|
|
20267
|
-
this.path =
|
|
20267
|
+
this.path = path13;
|
|
20268
20268
|
this.req = req;
|
|
20269
20269
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
20270
20270
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -20310,8 +20310,8 @@ var require_send = __commonJS({
|
|
|
20310
20310
|
this._index = index2;
|
|
20311
20311
|
return this;
|
|
20312
20312
|
}, "send.index: pass index as option");
|
|
20313
|
-
SendStream.prototype.root = function root(
|
|
20314
|
-
this._root = resolve5(String(
|
|
20313
|
+
SendStream.prototype.root = function root(path13) {
|
|
20314
|
+
this._root = resolve5(String(path13));
|
|
20315
20315
|
debug("root %s", this._root);
|
|
20316
20316
|
return this;
|
|
20317
20317
|
};
|
|
@@ -20424,10 +20424,10 @@ var require_send = __commonJS({
|
|
|
20424
20424
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
20425
20425
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
20426
20426
|
};
|
|
20427
|
-
SendStream.prototype.redirect = function redirect(
|
|
20427
|
+
SendStream.prototype.redirect = function redirect(path13) {
|
|
20428
20428
|
var res = this.res;
|
|
20429
20429
|
if (hasListeners(this, "directory")) {
|
|
20430
|
-
this.emit("directory", res,
|
|
20430
|
+
this.emit("directory", res, path13);
|
|
20431
20431
|
return;
|
|
20432
20432
|
}
|
|
20433
20433
|
if (this.hasTrailingSlash()) {
|
|
@@ -20447,42 +20447,42 @@ var require_send = __commonJS({
|
|
|
20447
20447
|
SendStream.prototype.pipe = function pipe3(res) {
|
|
20448
20448
|
var root = this._root;
|
|
20449
20449
|
this.res = res;
|
|
20450
|
-
var
|
|
20451
|
-
if (
|
|
20450
|
+
var path13 = decode4(this.path);
|
|
20451
|
+
if (path13 === -1) {
|
|
20452
20452
|
this.error(400);
|
|
20453
20453
|
return res;
|
|
20454
20454
|
}
|
|
20455
|
-
if (~
|
|
20455
|
+
if (~path13.indexOf("\0")) {
|
|
20456
20456
|
this.error(400);
|
|
20457
20457
|
return res;
|
|
20458
20458
|
}
|
|
20459
20459
|
var parts;
|
|
20460
20460
|
if (root !== null) {
|
|
20461
|
-
if (
|
|
20462
|
-
|
|
20461
|
+
if (path13) {
|
|
20462
|
+
path13 = normalize2("." + sep2 + path13);
|
|
20463
20463
|
}
|
|
20464
|
-
if (UP_PATH_REGEXP.test(
|
|
20465
|
-
debug('malicious path "%s"',
|
|
20464
|
+
if (UP_PATH_REGEXP.test(path13)) {
|
|
20465
|
+
debug('malicious path "%s"', path13);
|
|
20466
20466
|
this.error(403);
|
|
20467
20467
|
return res;
|
|
20468
20468
|
}
|
|
20469
|
-
parts =
|
|
20470
|
-
|
|
20469
|
+
parts = path13.split(sep2);
|
|
20470
|
+
path13 = normalize2(join7(root, path13));
|
|
20471
20471
|
} else {
|
|
20472
|
-
if (UP_PATH_REGEXP.test(
|
|
20473
|
-
debug('malicious path "%s"',
|
|
20472
|
+
if (UP_PATH_REGEXP.test(path13)) {
|
|
20473
|
+
debug('malicious path "%s"', path13);
|
|
20474
20474
|
this.error(403);
|
|
20475
20475
|
return res;
|
|
20476
20476
|
}
|
|
20477
|
-
parts = normalize2(
|
|
20478
|
-
|
|
20477
|
+
parts = normalize2(path13).split(sep2);
|
|
20478
|
+
path13 = resolve5(path13);
|
|
20479
20479
|
}
|
|
20480
20480
|
if (containsDotFile(parts)) {
|
|
20481
20481
|
var access4 = this._dotfiles;
|
|
20482
20482
|
if (access4 === void 0) {
|
|
20483
20483
|
access4 = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
20484
20484
|
}
|
|
20485
|
-
debug('%s dotfile "%s"', access4,
|
|
20485
|
+
debug('%s dotfile "%s"', access4, path13);
|
|
20486
20486
|
switch (access4) {
|
|
20487
20487
|
case "allow":
|
|
20488
20488
|
break;
|
|
@@ -20496,13 +20496,13 @@ var require_send = __commonJS({
|
|
|
20496
20496
|
}
|
|
20497
20497
|
}
|
|
20498
20498
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
20499
|
-
this.sendIndex(
|
|
20499
|
+
this.sendIndex(path13);
|
|
20500
20500
|
return res;
|
|
20501
20501
|
}
|
|
20502
|
-
this.sendFile(
|
|
20502
|
+
this.sendFile(path13);
|
|
20503
20503
|
return res;
|
|
20504
20504
|
};
|
|
20505
|
-
SendStream.prototype.send = function send2(
|
|
20505
|
+
SendStream.prototype.send = function send2(path13, stat4) {
|
|
20506
20506
|
var len = stat4.size;
|
|
20507
20507
|
var options = this.options;
|
|
20508
20508
|
var opts = {};
|
|
@@ -20514,9 +20514,9 @@ var require_send = __commonJS({
|
|
|
20514
20514
|
this.headersAlreadySent();
|
|
20515
20515
|
return;
|
|
20516
20516
|
}
|
|
20517
|
-
debug('pipe "%s"',
|
|
20518
|
-
this.setHeader(
|
|
20519
|
-
this.type(
|
|
20517
|
+
debug('pipe "%s"', path13);
|
|
20518
|
+
this.setHeader(path13, stat4);
|
|
20519
|
+
this.type(path13);
|
|
20520
20520
|
if (this.isConditionalGET()) {
|
|
20521
20521
|
if (this.isPreconditionFailure()) {
|
|
20522
20522
|
this.error(412);
|
|
@@ -20565,28 +20565,28 @@ var require_send = __commonJS({
|
|
|
20565
20565
|
res.end();
|
|
20566
20566
|
return;
|
|
20567
20567
|
}
|
|
20568
|
-
this.stream(
|
|
20568
|
+
this.stream(path13, opts);
|
|
20569
20569
|
};
|
|
20570
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
20570
|
+
SendStream.prototype.sendFile = function sendFile(path13) {
|
|
20571
20571
|
var i = 0;
|
|
20572
20572
|
var self = this;
|
|
20573
|
-
debug('stat "%s"',
|
|
20574
|
-
|
|
20575
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
20573
|
+
debug('stat "%s"', path13);
|
|
20574
|
+
fs15.stat(path13, function onstat(err, stat4) {
|
|
20575
|
+
if (err && err.code === "ENOENT" && !extname(path13) && path13[path13.length - 1] !== sep2) {
|
|
20576
20576
|
return next(err);
|
|
20577
20577
|
}
|
|
20578
20578
|
if (err) return self.onStatError(err);
|
|
20579
|
-
if (stat4.isDirectory()) return self.redirect(
|
|
20580
|
-
self.emit("file",
|
|
20581
|
-
self.send(
|
|
20579
|
+
if (stat4.isDirectory()) return self.redirect(path13);
|
|
20580
|
+
self.emit("file", path13, stat4);
|
|
20581
|
+
self.send(path13, stat4);
|
|
20582
20582
|
});
|
|
20583
20583
|
function next(err) {
|
|
20584
20584
|
if (self._extensions.length <= i) {
|
|
20585
20585
|
return err ? self.onStatError(err) : self.error(404);
|
|
20586
20586
|
}
|
|
20587
|
-
var p =
|
|
20587
|
+
var p = path13 + "." + self._extensions[i++];
|
|
20588
20588
|
debug('stat "%s"', p);
|
|
20589
|
-
|
|
20589
|
+
fs15.stat(p, function(err2, stat4) {
|
|
20590
20590
|
if (err2) return next(err2);
|
|
20591
20591
|
if (stat4.isDirectory()) return next();
|
|
20592
20592
|
self.emit("file", p, stat4);
|
|
@@ -20594,7 +20594,7 @@ var require_send = __commonJS({
|
|
|
20594
20594
|
});
|
|
20595
20595
|
}
|
|
20596
20596
|
};
|
|
20597
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
20597
|
+
SendStream.prototype.sendIndex = function sendIndex(path13) {
|
|
20598
20598
|
var i = -1;
|
|
20599
20599
|
var self = this;
|
|
20600
20600
|
function next(err) {
|
|
@@ -20602,9 +20602,9 @@ var require_send = __commonJS({
|
|
|
20602
20602
|
if (err) return self.onStatError(err);
|
|
20603
20603
|
return self.error(404);
|
|
20604
20604
|
}
|
|
20605
|
-
var p = join7(
|
|
20605
|
+
var p = join7(path13, self._index[i]);
|
|
20606
20606
|
debug('stat "%s"', p);
|
|
20607
|
-
|
|
20607
|
+
fs15.stat(p, function(err2, stat4) {
|
|
20608
20608
|
if (err2) return next(err2);
|
|
20609
20609
|
if (stat4.isDirectory()) return next();
|
|
20610
20610
|
self.emit("file", p, stat4);
|
|
@@ -20613,10 +20613,10 @@ var require_send = __commonJS({
|
|
|
20613
20613
|
}
|
|
20614
20614
|
next();
|
|
20615
20615
|
};
|
|
20616
|
-
SendStream.prototype.stream = function stream2(
|
|
20616
|
+
SendStream.prototype.stream = function stream2(path13, options) {
|
|
20617
20617
|
var self = this;
|
|
20618
20618
|
var res = this.res;
|
|
20619
|
-
var stream3 =
|
|
20619
|
+
var stream3 = fs15.createReadStream(path13, options);
|
|
20620
20620
|
this.emit("stream", stream3);
|
|
20621
20621
|
stream3.pipe(res);
|
|
20622
20622
|
function cleanup2() {
|
|
@@ -20631,10 +20631,10 @@ var require_send = __commonJS({
|
|
|
20631
20631
|
self.emit("end");
|
|
20632
20632
|
});
|
|
20633
20633
|
};
|
|
20634
|
-
SendStream.prototype.type = function type(
|
|
20634
|
+
SendStream.prototype.type = function type(path13) {
|
|
20635
20635
|
var res = this.res;
|
|
20636
20636
|
if (res.getHeader("Content-Type")) return;
|
|
20637
|
-
var type2 = mime.lookup(
|
|
20637
|
+
var type2 = mime.lookup(path13);
|
|
20638
20638
|
if (!type2) {
|
|
20639
20639
|
debug("no content-type");
|
|
20640
20640
|
return;
|
|
@@ -20643,9 +20643,9 @@ var require_send = __commonJS({
|
|
|
20643
20643
|
debug("content-type %s", type2);
|
|
20644
20644
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
20645
20645
|
};
|
|
20646
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
20646
|
+
SendStream.prototype.setHeader = function setHeader(path13, stat4) {
|
|
20647
20647
|
var res = this.res;
|
|
20648
|
-
this.emit("headers", res,
|
|
20648
|
+
this.emit("headers", res, path13, stat4);
|
|
20649
20649
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
20650
20650
|
debug("accept ranges");
|
|
20651
20651
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -20704,9 +20704,9 @@ var require_send = __commonJS({
|
|
|
20704
20704
|
}
|
|
20705
20705
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
20706
20706
|
}
|
|
20707
|
-
function decode4(
|
|
20707
|
+
function decode4(path13) {
|
|
20708
20708
|
try {
|
|
20709
|
-
return decodeURIComponent(
|
|
20709
|
+
return decodeURIComponent(path13);
|
|
20710
20710
|
} catch (err) {
|
|
20711
20711
|
return -1;
|
|
20712
20712
|
}
|
|
@@ -21615,10 +21615,10 @@ var require_utils2 = __commonJS({
|
|
|
21615
21615
|
var querystring = require("querystring");
|
|
21616
21616
|
exports2.etag = createETagGenerator({ weak: false });
|
|
21617
21617
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
21618
|
-
exports2.isAbsolute = function(
|
|
21619
|
-
if ("/" ===
|
|
21620
|
-
if (":" ===
|
|
21621
|
-
if ("\\\\" ===
|
|
21618
|
+
exports2.isAbsolute = function(path12) {
|
|
21619
|
+
if ("/" === path12[0]) return true;
|
|
21620
|
+
if (":" === path12[1] && ("\\" === path12[2] || "/" === path12[2])) return true;
|
|
21621
|
+
if ("\\\\" === path12.substring(0, 2)) return true;
|
|
21622
21622
|
};
|
|
21623
21623
|
exports2.flatten = deprecate.function(
|
|
21624
21624
|
flatten,
|
|
@@ -21829,7 +21829,7 @@ var require_application = __commonJS({
|
|
|
21829
21829
|
};
|
|
21830
21830
|
app.use = function use(fn) {
|
|
21831
21831
|
var offset = 0;
|
|
21832
|
-
var
|
|
21832
|
+
var path12 = "/";
|
|
21833
21833
|
if (typeof fn !== "function") {
|
|
21834
21834
|
var arg = fn;
|
|
21835
21835
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -21837,7 +21837,7 @@ var require_application = __commonJS({
|
|
|
21837
21837
|
}
|
|
21838
21838
|
if (typeof arg !== "function") {
|
|
21839
21839
|
offset = 1;
|
|
21840
|
-
|
|
21840
|
+
path12 = fn;
|
|
21841
21841
|
}
|
|
21842
21842
|
}
|
|
21843
21843
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -21848,12 +21848,12 @@ var require_application = __commonJS({
|
|
|
21848
21848
|
var router = this._router;
|
|
21849
21849
|
fns.forEach(function(fn2) {
|
|
21850
21850
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
21851
|
-
return router.use(
|
|
21851
|
+
return router.use(path12, fn2);
|
|
21852
21852
|
}
|
|
21853
|
-
debug(".use app under %s",
|
|
21854
|
-
fn2.mountpath =
|
|
21853
|
+
debug(".use app under %s", path12);
|
|
21854
|
+
fn2.mountpath = path12;
|
|
21855
21855
|
fn2.parent = this;
|
|
21856
|
-
router.use(
|
|
21856
|
+
router.use(path12, function mounted_app(req, res, next) {
|
|
21857
21857
|
var orig = req.app;
|
|
21858
21858
|
fn2.handle(req, res, function(err) {
|
|
21859
21859
|
setPrototypeOf(req, orig.request);
|
|
@@ -21865,9 +21865,9 @@ var require_application = __commonJS({
|
|
|
21865
21865
|
}, this);
|
|
21866
21866
|
return this;
|
|
21867
21867
|
};
|
|
21868
|
-
app.route = function route(
|
|
21868
|
+
app.route = function route(path12) {
|
|
21869
21869
|
this.lazyrouter();
|
|
21870
|
-
return this._router.route(
|
|
21870
|
+
return this._router.route(path12);
|
|
21871
21871
|
};
|
|
21872
21872
|
app.engine = function engine(ext2, fn) {
|
|
21873
21873
|
if (typeof fn !== "function") {
|
|
@@ -21918,7 +21918,7 @@ var require_application = __commonJS({
|
|
|
21918
21918
|
}
|
|
21919
21919
|
return this;
|
|
21920
21920
|
};
|
|
21921
|
-
app.path = function
|
|
21921
|
+
app.path = function path12() {
|
|
21922
21922
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
21923
21923
|
};
|
|
21924
21924
|
app.enabled = function enabled(setting) {
|
|
@@ -21934,19 +21934,19 @@ var require_application = __commonJS({
|
|
|
21934
21934
|
return this.set(setting, false);
|
|
21935
21935
|
};
|
|
21936
21936
|
methods.forEach(function(method) {
|
|
21937
|
-
app[method] = function(
|
|
21937
|
+
app[method] = function(path12) {
|
|
21938
21938
|
if (method === "get" && arguments.length === 1) {
|
|
21939
|
-
return this.set(
|
|
21939
|
+
return this.set(path12);
|
|
21940
21940
|
}
|
|
21941
21941
|
this.lazyrouter();
|
|
21942
|
-
var route = this._router.route(
|
|
21942
|
+
var route = this._router.route(path12);
|
|
21943
21943
|
route[method].apply(route, slice.call(arguments, 1));
|
|
21944
21944
|
return this;
|
|
21945
21945
|
};
|
|
21946
21946
|
});
|
|
21947
|
-
app.all = function all(
|
|
21947
|
+
app.all = function all(path12) {
|
|
21948
21948
|
this.lazyrouter();
|
|
21949
|
-
var route = this._router.route(
|
|
21949
|
+
var route = this._router.route(path12);
|
|
21950
21950
|
var args = slice.call(arguments, 1);
|
|
21951
21951
|
for (var i = 0; i < methods.length; i++) {
|
|
21952
21952
|
route[methods[i]].apply(route, args);
|
|
@@ -22705,7 +22705,7 @@ var require_request = __commonJS({
|
|
|
22705
22705
|
var subdomains2 = !isIP(hostname5) ? hostname5.split(".").reverse() : [hostname5];
|
|
22706
22706
|
return subdomains2.slice(offset);
|
|
22707
22707
|
});
|
|
22708
|
-
defineGetter(req, "path", function
|
|
22708
|
+
defineGetter(req, "path", function path12() {
|
|
22709
22709
|
return parse7(this).pathname;
|
|
22710
22710
|
});
|
|
22711
22711
|
defineGetter(req, "hostname", function hostname5() {
|
|
@@ -23026,7 +23026,7 @@ var require_response = __commonJS({
|
|
|
23026
23026
|
var http = require("http");
|
|
23027
23027
|
var isAbsolute = require_utils2().isAbsolute;
|
|
23028
23028
|
var onFinished = require_on_finished();
|
|
23029
|
-
var
|
|
23029
|
+
var path12 = require("path");
|
|
23030
23030
|
var statuses = require_statuses();
|
|
23031
23031
|
var merge3 = require_utils_merge();
|
|
23032
23032
|
var sign2 = require_cookie_signature().sign;
|
|
@@ -23035,9 +23035,9 @@ var require_response = __commonJS({
|
|
|
23035
23035
|
var setCharset = require_utils2().setCharset;
|
|
23036
23036
|
var cookie = require_cookie();
|
|
23037
23037
|
var send = require_send();
|
|
23038
|
-
var extname =
|
|
23038
|
+
var extname = path12.extname;
|
|
23039
23039
|
var mime = send.mime;
|
|
23040
|
-
var resolve5 =
|
|
23040
|
+
var resolve5 = path12.resolve;
|
|
23041
23041
|
var vary = require_vary();
|
|
23042
23042
|
var res = Object.create(http.ServerResponse.prototype);
|
|
23043
23043
|
module2.exports = res;
|
|
@@ -23214,26 +23214,26 @@ var require_response = __commonJS({
|
|
|
23214
23214
|
this.type("txt");
|
|
23215
23215
|
return this.send(body);
|
|
23216
23216
|
};
|
|
23217
|
-
res.sendFile = function sendFile(
|
|
23217
|
+
res.sendFile = function sendFile(path13, options, callback) {
|
|
23218
23218
|
var done = callback;
|
|
23219
23219
|
var req = this.req;
|
|
23220
23220
|
var res2 = this;
|
|
23221
23221
|
var next = req.next;
|
|
23222
23222
|
var opts = options || {};
|
|
23223
|
-
if (!
|
|
23223
|
+
if (!path13) {
|
|
23224
23224
|
throw new TypeError("path argument is required to res.sendFile");
|
|
23225
23225
|
}
|
|
23226
|
-
if (typeof
|
|
23226
|
+
if (typeof path13 !== "string") {
|
|
23227
23227
|
throw new TypeError("path must be a string to res.sendFile");
|
|
23228
23228
|
}
|
|
23229
23229
|
if (typeof options === "function") {
|
|
23230
23230
|
done = options;
|
|
23231
23231
|
opts = {};
|
|
23232
23232
|
}
|
|
23233
|
-
if (!opts.root && !isAbsolute(
|
|
23233
|
+
if (!opts.root && !isAbsolute(path13)) {
|
|
23234
23234
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
23235
23235
|
}
|
|
23236
|
-
var pathname = encodeURI(
|
|
23236
|
+
var pathname = encodeURI(path13);
|
|
23237
23237
|
var file3 = send(req, pathname, opts);
|
|
23238
23238
|
sendfile(res2, file3, opts, function(err) {
|
|
23239
23239
|
if (done) return done(err);
|
|
@@ -23243,7 +23243,7 @@ var require_response = __commonJS({
|
|
|
23243
23243
|
}
|
|
23244
23244
|
});
|
|
23245
23245
|
};
|
|
23246
|
-
res.sendfile = function(
|
|
23246
|
+
res.sendfile = function(path13, options, callback) {
|
|
23247
23247
|
var done = callback;
|
|
23248
23248
|
var req = this.req;
|
|
23249
23249
|
var res2 = this;
|
|
@@ -23253,7 +23253,7 @@ var require_response = __commonJS({
|
|
|
23253
23253
|
done = options;
|
|
23254
23254
|
opts = {};
|
|
23255
23255
|
}
|
|
23256
|
-
var file3 = send(req,
|
|
23256
|
+
var file3 = send(req, path13, opts);
|
|
23257
23257
|
sendfile(res2, file3, opts, function(err) {
|
|
23258
23258
|
if (done) return done(err);
|
|
23259
23259
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -23266,7 +23266,7 @@ var require_response = __commonJS({
|
|
|
23266
23266
|
res.sendfile,
|
|
23267
23267
|
"res.sendfile: Use res.sendFile instead"
|
|
23268
23268
|
);
|
|
23269
|
-
res.download = function download3(
|
|
23269
|
+
res.download = function download3(path13, filename, options, callback) {
|
|
23270
23270
|
var done = callback;
|
|
23271
23271
|
var name40 = filename;
|
|
23272
23272
|
var opts = options || null;
|
|
@@ -23283,7 +23283,7 @@ var require_response = __commonJS({
|
|
|
23283
23283
|
opts = filename;
|
|
23284
23284
|
}
|
|
23285
23285
|
var headers = {
|
|
23286
|
-
"Content-Disposition": contentDisposition(name40 ||
|
|
23286
|
+
"Content-Disposition": contentDisposition(name40 || path13)
|
|
23287
23287
|
};
|
|
23288
23288
|
if (opts && opts.headers) {
|
|
23289
23289
|
var keys = Object.keys(opts.headers);
|
|
@@ -23296,7 +23296,7 @@ var require_response = __commonJS({
|
|
|
23296
23296
|
}
|
|
23297
23297
|
opts = Object.create(opts);
|
|
23298
23298
|
opts.headers = headers;
|
|
23299
|
-
var fullPath = !opts.root ? resolve5(
|
|
23299
|
+
var fullPath = !opts.root ? resolve5(path13) : path13;
|
|
23300
23300
|
return this.sendFile(fullPath, opts, done);
|
|
23301
23301
|
};
|
|
23302
23302
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -23597,11 +23597,11 @@ var require_serve_static = __commonJS({
|
|
|
23597
23597
|
}
|
|
23598
23598
|
var forwardError = !fallthrough;
|
|
23599
23599
|
var originalUrl = parseUrl.original(req);
|
|
23600
|
-
var
|
|
23601
|
-
if (
|
|
23602
|
-
|
|
23600
|
+
var path12 = parseUrl(req).pathname;
|
|
23601
|
+
if (path12 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
23602
|
+
path12 = "";
|
|
23603
23603
|
}
|
|
23604
|
-
var stream2 = send(req,
|
|
23604
|
+
var stream2 = send(req, path12, opts);
|
|
23605
23605
|
stream2.on("directory", onDirectory);
|
|
23606
23606
|
if (setHeaders) {
|
|
23607
23607
|
stream2.on("headers", setHeaders);
|
|
@@ -24059,19 +24059,19 @@ var require_token_io = __commonJS({
|
|
|
24059
24059
|
getUserDataDir: () => getUserDataDir
|
|
24060
24060
|
});
|
|
24061
24061
|
module2.exports = __toCommonJS(token_io_exports);
|
|
24062
|
-
var
|
|
24063
|
-
var
|
|
24062
|
+
var import_path4 = __toESM2(require("path"));
|
|
24063
|
+
var import_fs4 = __toESM2(require("fs"));
|
|
24064
24064
|
var import_os = __toESM2(require("os"));
|
|
24065
24065
|
var import_token_error = require_token_error();
|
|
24066
24066
|
function findRootDir() {
|
|
24067
24067
|
try {
|
|
24068
24068
|
let dir = process.cwd();
|
|
24069
|
-
while (dir !==
|
|
24070
|
-
const pkgPath =
|
|
24071
|
-
if (
|
|
24069
|
+
while (dir !== import_path4.default.dirname(dir)) {
|
|
24070
|
+
const pkgPath = import_path4.default.join(dir, ".vercel");
|
|
24071
|
+
if (import_fs4.default.existsSync(pkgPath)) {
|
|
24072
24072
|
return dir;
|
|
24073
24073
|
}
|
|
24074
|
-
dir =
|
|
24074
|
+
dir = import_path4.default.dirname(dir);
|
|
24075
24075
|
}
|
|
24076
24076
|
} catch (e) {
|
|
24077
24077
|
throw new import_token_error.VercelOidcTokenError(
|
|
@@ -24086,9 +24086,9 @@ var require_token_io = __commonJS({
|
|
|
24086
24086
|
}
|
|
24087
24087
|
switch (import_os.default.platform()) {
|
|
24088
24088
|
case "darwin":
|
|
24089
|
-
return
|
|
24089
|
+
return import_path4.default.join(import_os.default.homedir(), "Library/Application Support");
|
|
24090
24090
|
case "linux":
|
|
24091
|
-
return
|
|
24091
|
+
return import_path4.default.join(import_os.default.homedir(), ".local/share");
|
|
24092
24092
|
case "win32":
|
|
24093
24093
|
if (process.env.LOCALAPPDATA) {
|
|
24094
24094
|
return process.env.LOCALAPPDATA;
|
|
@@ -24145,8 +24145,8 @@ var require_token_util = __commonJS({
|
|
|
24145
24145
|
saveToken: () => saveToken
|
|
24146
24146
|
});
|
|
24147
24147
|
module2.exports = __toCommonJS(token_util_exports);
|
|
24148
|
-
var
|
|
24149
|
-
var
|
|
24148
|
+
var path12 = __toESM2(require("path"));
|
|
24149
|
+
var fs15 = __toESM2(require("fs"));
|
|
24150
24150
|
var import_token_error = require_token_error();
|
|
24151
24151
|
var import_token_io = require_token_io();
|
|
24152
24152
|
function getVercelDataDir() {
|
|
@@ -24155,18 +24155,18 @@ var require_token_util = __commonJS({
|
|
|
24155
24155
|
if (!dataDir) {
|
|
24156
24156
|
return null;
|
|
24157
24157
|
}
|
|
24158
|
-
return
|
|
24158
|
+
return path12.join(dataDir, vercelFolder);
|
|
24159
24159
|
}
|
|
24160
24160
|
function getVercelCliToken() {
|
|
24161
24161
|
const dataDir = getVercelDataDir();
|
|
24162
24162
|
if (!dataDir) {
|
|
24163
24163
|
return null;
|
|
24164
24164
|
}
|
|
24165
|
-
const tokenPath =
|
|
24166
|
-
if (!
|
|
24165
|
+
const tokenPath = path12.join(dataDir, "auth.json");
|
|
24166
|
+
if (!fs15.existsSync(tokenPath)) {
|
|
24167
24167
|
return null;
|
|
24168
24168
|
}
|
|
24169
|
-
const token =
|
|
24169
|
+
const token = fs15.readFileSync(tokenPath, "utf8");
|
|
24170
24170
|
if (!token) {
|
|
24171
24171
|
return null;
|
|
24172
24172
|
}
|
|
@@ -24207,11 +24207,11 @@ var require_token_util = __commonJS({
|
|
|
24207
24207
|
throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
|
|
24208
24208
|
}
|
|
24209
24209
|
try {
|
|
24210
|
-
const prjPath =
|
|
24211
|
-
if (!
|
|
24210
|
+
const prjPath = path12.join(dir, ".vercel", "project.json");
|
|
24211
|
+
if (!fs15.existsSync(prjPath)) {
|
|
24212
24212
|
throw new import_token_error.VercelOidcTokenError("project.json not found");
|
|
24213
24213
|
}
|
|
24214
|
-
const prj = JSON.parse(
|
|
24214
|
+
const prj = JSON.parse(fs15.readFileSync(prjPath, "utf8"));
|
|
24215
24215
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
24216
24216
|
throw new TypeError("Expected a string-valued projectId property");
|
|
24217
24217
|
}
|
|
@@ -24226,11 +24226,11 @@ var require_token_util = __commonJS({
|
|
|
24226
24226
|
if (!dir) {
|
|
24227
24227
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory");
|
|
24228
24228
|
}
|
|
24229
|
-
const tokenPath =
|
|
24229
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
24230
24230
|
const tokenJson = JSON.stringify(token);
|
|
24231
|
-
|
|
24232
|
-
|
|
24233
|
-
|
|
24231
|
+
fs15.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
|
|
24232
|
+
fs15.writeFileSync(tokenPath, tokenJson);
|
|
24233
|
+
fs15.chmodSync(tokenPath, 432);
|
|
24234
24234
|
return;
|
|
24235
24235
|
} catch (e) {
|
|
24236
24236
|
throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);
|
|
@@ -24242,11 +24242,11 @@ var require_token_util = __commonJS({
|
|
|
24242
24242
|
if (!dir) {
|
|
24243
24243
|
return null;
|
|
24244
24244
|
}
|
|
24245
|
-
const tokenPath =
|
|
24246
|
-
if (!
|
|
24245
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
24246
|
+
if (!fs15.existsSync(tokenPath)) {
|
|
24247
24247
|
return null;
|
|
24248
24248
|
}
|
|
24249
|
-
const token = JSON.parse(
|
|
24249
|
+
const token = JSON.parse(fs15.readFileSync(tokenPath, "utf8"));
|
|
24250
24250
|
assertVercelOidcTokenResponse(token);
|
|
24251
24251
|
return token;
|
|
24252
24252
|
} catch (e) {
|
|
@@ -26198,19 +26198,19 @@ var require_token_io2 = __commonJS({
|
|
|
26198
26198
|
getUserDataDir: () => getUserDataDir
|
|
26199
26199
|
});
|
|
26200
26200
|
module2.exports = __toCommonJS(token_io_exports);
|
|
26201
|
-
var
|
|
26202
|
-
var
|
|
26201
|
+
var import_path4 = __toESM2(require("path"));
|
|
26202
|
+
var import_fs4 = __toESM2(require("fs"));
|
|
26203
26203
|
var import_os = __toESM2(require("os"));
|
|
26204
26204
|
var import_token_error = require_token_error2();
|
|
26205
26205
|
function findRootDir() {
|
|
26206
26206
|
try {
|
|
26207
26207
|
let dir = process.cwd();
|
|
26208
|
-
while (dir !==
|
|
26209
|
-
const pkgPath =
|
|
26210
|
-
if (
|
|
26208
|
+
while (dir !== import_path4.default.dirname(dir)) {
|
|
26209
|
+
const pkgPath = import_path4.default.join(dir, ".vercel");
|
|
26210
|
+
if (import_fs4.default.existsSync(pkgPath)) {
|
|
26211
26211
|
return dir;
|
|
26212
26212
|
}
|
|
26213
|
-
dir =
|
|
26213
|
+
dir = import_path4.default.dirname(dir);
|
|
26214
26214
|
}
|
|
26215
26215
|
} catch (e) {
|
|
26216
26216
|
throw new import_token_error.VercelOidcTokenError(
|
|
@@ -26225,9 +26225,9 @@ var require_token_io2 = __commonJS({
|
|
|
26225
26225
|
}
|
|
26226
26226
|
switch (import_os.default.platform()) {
|
|
26227
26227
|
case "darwin":
|
|
26228
|
-
return
|
|
26228
|
+
return import_path4.default.join(import_os.default.homedir(), "Library/Application Support");
|
|
26229
26229
|
case "linux":
|
|
26230
|
-
return
|
|
26230
|
+
return import_path4.default.join(import_os.default.homedir(), ".local/share");
|
|
26231
26231
|
case "win32":
|
|
26232
26232
|
if (process.env.LOCALAPPDATA) {
|
|
26233
26233
|
return process.env.LOCALAPPDATA;
|
|
@@ -26278,8 +26278,8 @@ var require_auth_config = __commonJS({
|
|
|
26278
26278
|
writeAuthConfig: () => writeAuthConfig
|
|
26279
26279
|
});
|
|
26280
26280
|
module2.exports = __toCommonJS(auth_config_exports);
|
|
26281
|
-
var
|
|
26282
|
-
var
|
|
26281
|
+
var fs15 = __toESM2(require("fs"));
|
|
26282
|
+
var path12 = __toESM2(require("path"));
|
|
26283
26283
|
var import_token_util = require_token_util2();
|
|
26284
26284
|
function getAuthConfigPath() {
|
|
26285
26285
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
@@ -26288,15 +26288,15 @@ var require_auth_config = __commonJS({
|
|
|
26288
26288
|
`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
|
|
26289
26289
|
);
|
|
26290
26290
|
}
|
|
26291
|
-
return
|
|
26291
|
+
return path12.join(dataDir, "auth.json");
|
|
26292
26292
|
}
|
|
26293
26293
|
function readAuthConfig() {
|
|
26294
26294
|
try {
|
|
26295
26295
|
const authPath = getAuthConfigPath();
|
|
26296
|
-
if (!
|
|
26296
|
+
if (!fs15.existsSync(authPath)) {
|
|
26297
26297
|
return null;
|
|
26298
26298
|
}
|
|
26299
|
-
const content =
|
|
26299
|
+
const content = fs15.readFileSync(authPath, "utf8");
|
|
26300
26300
|
if (!content) {
|
|
26301
26301
|
return null;
|
|
26302
26302
|
}
|
|
@@ -26307,11 +26307,11 @@ var require_auth_config = __commonJS({
|
|
|
26307
26307
|
}
|
|
26308
26308
|
function writeAuthConfig(config4) {
|
|
26309
26309
|
const authPath = getAuthConfigPath();
|
|
26310
|
-
const authDir =
|
|
26311
|
-
if (!
|
|
26312
|
-
|
|
26310
|
+
const authDir = path12.dirname(authPath);
|
|
26311
|
+
if (!fs15.existsSync(authDir)) {
|
|
26312
|
+
fs15.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
26313
26313
|
}
|
|
26314
|
-
|
|
26314
|
+
fs15.writeFileSync(authPath, JSON.stringify(config4, null, 2), { mode: 384 });
|
|
26315
26315
|
}
|
|
26316
26316
|
function isValidAccessToken(authConfig) {
|
|
26317
26317
|
if (!authConfig.token)
|
|
@@ -26457,8 +26457,8 @@ var require_token_util2 = __commonJS({
|
|
|
26457
26457
|
saveToken: () => saveToken
|
|
26458
26458
|
});
|
|
26459
26459
|
module2.exports = __toCommonJS(token_util_exports);
|
|
26460
|
-
var
|
|
26461
|
-
var
|
|
26460
|
+
var path12 = __toESM2(require("path"));
|
|
26461
|
+
var fs15 = __toESM2(require("fs"));
|
|
26462
26462
|
var import_token_error = require_token_error2();
|
|
26463
26463
|
var import_token_io = require_token_io2();
|
|
26464
26464
|
var import_auth_config = require_auth_config();
|
|
@@ -26469,7 +26469,7 @@ var require_token_util2 = __commonJS({
|
|
|
26469
26469
|
if (!dataDir) {
|
|
26470
26470
|
return null;
|
|
26471
26471
|
}
|
|
26472
|
-
return
|
|
26472
|
+
return path12.join(dataDir, vercelFolder);
|
|
26473
26473
|
}
|
|
26474
26474
|
async function getVercelCliToken() {
|
|
26475
26475
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -26542,13 +26542,13 @@ var require_token_util2 = __commonJS({
|
|
|
26542
26542
|
"Unable to find project root directory. Have you linked your project with `vc link?`"
|
|
26543
26543
|
);
|
|
26544
26544
|
}
|
|
26545
|
-
const prjPath =
|
|
26546
|
-
if (!
|
|
26545
|
+
const prjPath = path12.join(dir, ".vercel", "project.json");
|
|
26546
|
+
if (!fs15.existsSync(prjPath)) {
|
|
26547
26547
|
throw new import_token_error.VercelOidcTokenError(
|
|
26548
26548
|
"project.json not found, have you linked your project with `vc link?`"
|
|
26549
26549
|
);
|
|
26550
26550
|
}
|
|
26551
|
-
const prj = JSON.parse(
|
|
26551
|
+
const prj = JSON.parse(fs15.readFileSync(prjPath, "utf8"));
|
|
26552
26552
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
26553
26553
|
throw new TypeError(
|
|
26554
26554
|
"Expected a string-valued projectId property. Try running `vc link` to re-link your project."
|
|
@@ -26563,11 +26563,11 @@ var require_token_util2 = __commonJS({
|
|
|
26563
26563
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
26564
26564
|
);
|
|
26565
26565
|
}
|
|
26566
|
-
const tokenPath =
|
|
26566
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
26567
26567
|
const tokenJson = JSON.stringify(token);
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26568
|
+
fs15.mkdirSync(path12.dirname(tokenPath), { mode: 504, recursive: true });
|
|
26569
|
+
fs15.writeFileSync(tokenPath, tokenJson);
|
|
26570
|
+
fs15.chmodSync(tokenPath, 432);
|
|
26571
26571
|
return;
|
|
26572
26572
|
}
|
|
26573
26573
|
function loadToken(projectId) {
|
|
@@ -26577,11 +26577,11 @@ var require_token_util2 = __commonJS({
|
|
|
26577
26577
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
26578
26578
|
);
|
|
26579
26579
|
}
|
|
26580
|
-
const tokenPath =
|
|
26581
|
-
if (!
|
|
26580
|
+
const tokenPath = path12.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
26581
|
+
if (!fs15.existsSync(tokenPath)) {
|
|
26582
26582
|
return null;
|
|
26583
26583
|
}
|
|
26584
|
-
const token = JSON.parse(
|
|
26584
|
+
const token = JSON.parse(fs15.readFileSync(tokenPath, "utf8"));
|
|
26585
26585
|
assertVercelOidcTokenResponse(token);
|
|
26586
26586
|
return token;
|
|
26587
26587
|
}
|
|
@@ -31463,14 +31463,14 @@ var require_util = __commonJS({
|
|
|
31463
31463
|
}
|
|
31464
31464
|
const port = url3.port != null ? url3.port : url3.protocol === "https:" ? 443 : 80;
|
|
31465
31465
|
let origin = url3.origin != null ? url3.origin : `${url3.protocol || ""}//${url3.hostname || ""}:${port}`;
|
|
31466
|
-
let
|
|
31466
|
+
let path12 = url3.path != null ? url3.path : `${url3.pathname || ""}${url3.search || ""}`;
|
|
31467
31467
|
if (origin[origin.length - 1] === "/") {
|
|
31468
31468
|
origin = origin.slice(0, origin.length - 1);
|
|
31469
31469
|
}
|
|
31470
|
-
if (
|
|
31471
|
-
|
|
31470
|
+
if (path12 && path12[0] !== "/") {
|
|
31471
|
+
path12 = `/${path12}`;
|
|
31472
31472
|
}
|
|
31473
|
-
return new URL(`${origin}${
|
|
31473
|
+
return new URL(`${origin}${path12}`);
|
|
31474
31474
|
}
|
|
31475
31475
|
if (!isHttpOrHttpsPrefixed(url3.origin || url3.protocol)) {
|
|
31476
31476
|
throw new InvalidArgumentError9("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -32031,9 +32031,9 @@ var require_diagnostics = __commonJS({
|
|
|
32031
32031
|
"undici:client:sendHeaders",
|
|
32032
32032
|
(evt) => {
|
|
32033
32033
|
const {
|
|
32034
|
-
request: { method, path:
|
|
32034
|
+
request: { method, path: path12, origin }
|
|
32035
32035
|
} = evt;
|
|
32036
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
32036
|
+
debugLog("sending request to %s %s%s", method, origin, path12);
|
|
32037
32037
|
}
|
|
32038
32038
|
);
|
|
32039
32039
|
}
|
|
@@ -32047,14 +32047,14 @@ var require_diagnostics = __commonJS({
|
|
|
32047
32047
|
"undici:request:headers",
|
|
32048
32048
|
(evt) => {
|
|
32049
32049
|
const {
|
|
32050
|
-
request: { method, path:
|
|
32050
|
+
request: { method, path: path12, origin },
|
|
32051
32051
|
response: { statusCode }
|
|
32052
32052
|
} = evt;
|
|
32053
32053
|
debugLog(
|
|
32054
32054
|
"received response to %s %s%s - HTTP %d",
|
|
32055
32055
|
method,
|
|
32056
32056
|
origin,
|
|
32057
|
-
|
|
32057
|
+
path12,
|
|
32058
32058
|
statusCode
|
|
32059
32059
|
);
|
|
32060
32060
|
}
|
|
@@ -32063,23 +32063,23 @@ var require_diagnostics = __commonJS({
|
|
|
32063
32063
|
"undici:request:trailers",
|
|
32064
32064
|
(evt) => {
|
|
32065
32065
|
const {
|
|
32066
|
-
request: { method, path:
|
|
32066
|
+
request: { method, path: path12, origin }
|
|
32067
32067
|
} = evt;
|
|
32068
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
32068
|
+
debugLog("trailers received from %s %s%s", method, origin, path12);
|
|
32069
32069
|
}
|
|
32070
32070
|
);
|
|
32071
32071
|
diagnosticsChannel.subscribe(
|
|
32072
32072
|
"undici:request:error",
|
|
32073
32073
|
(evt) => {
|
|
32074
32074
|
const {
|
|
32075
|
-
request: { method, path:
|
|
32075
|
+
request: { method, path: path12, origin },
|
|
32076
32076
|
error: error87
|
|
32077
32077
|
} = evt;
|
|
32078
32078
|
debugLog(
|
|
32079
32079
|
"request to %s %s%s errored - %s",
|
|
32080
32080
|
method,
|
|
32081
32081
|
origin,
|
|
32082
|
-
|
|
32082
|
+
path12,
|
|
32083
32083
|
error87.message
|
|
32084
32084
|
);
|
|
32085
32085
|
}
|
|
@@ -32175,7 +32175,7 @@ var require_request2 = __commonJS({
|
|
|
32175
32175
|
var kHandler = Symbol("handler");
|
|
32176
32176
|
var Request = class {
|
|
32177
32177
|
constructor(origin, {
|
|
32178
|
-
path:
|
|
32178
|
+
path: path12,
|
|
32179
32179
|
method,
|
|
32180
32180
|
body,
|
|
32181
32181
|
headers,
|
|
@@ -32191,11 +32191,11 @@ var require_request2 = __commonJS({
|
|
|
32191
32191
|
throwOnError,
|
|
32192
32192
|
maxRedirections
|
|
32193
32193
|
}, handler) {
|
|
32194
|
-
if (typeof
|
|
32194
|
+
if (typeof path12 !== "string") {
|
|
32195
32195
|
throw new InvalidArgumentError9("path must be a string");
|
|
32196
|
-
} else if (
|
|
32196
|
+
} else if (path12[0] !== "/" && !(path12.startsWith("http://") || path12.startsWith("https://")) && method !== "CONNECT") {
|
|
32197
32197
|
throw new InvalidArgumentError9("path must be an absolute URL or start with a slash");
|
|
32198
|
-
} else if (invalidPathRegex.test(
|
|
32198
|
+
} else if (invalidPathRegex.test(path12)) {
|
|
32199
32199
|
throw new InvalidArgumentError9("invalid request path");
|
|
32200
32200
|
}
|
|
32201
32201
|
if (typeof method !== "string") {
|
|
@@ -32263,7 +32263,7 @@ var require_request2 = __commonJS({
|
|
|
32263
32263
|
this.completed = false;
|
|
32264
32264
|
this.aborted = false;
|
|
32265
32265
|
this.upgrade = upgrade || null;
|
|
32266
|
-
this.path = query ? serializePathWithQuery(
|
|
32266
|
+
this.path = query ? serializePathWithQuery(path12, query) : path12;
|
|
32267
32267
|
this.origin = origin;
|
|
32268
32268
|
this.protocol = getProtocolFromUrlString(origin);
|
|
32269
32269
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -37070,7 +37070,7 @@ var require_client_h1 = __commonJS({
|
|
|
37070
37070
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
37071
37071
|
}
|
|
37072
37072
|
function writeH1(client, request) {
|
|
37073
|
-
const { method, path:
|
|
37073
|
+
const { method, path: path12, host, upgrade, blocking, reset } = request;
|
|
37074
37074
|
let { body, headers, contentLength } = request;
|
|
37075
37075
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
37076
37076
|
if (util4.isFormDataLike(body)) {
|
|
@@ -37136,7 +37136,7 @@ var require_client_h1 = __commonJS({
|
|
|
37136
37136
|
if (blocking) {
|
|
37137
37137
|
socket[kBlocking] = true;
|
|
37138
37138
|
}
|
|
37139
|
-
let header = `${method} ${
|
|
37139
|
+
let header = `${method} ${path12} HTTP/1.1\r
|
|
37140
37140
|
`;
|
|
37141
37141
|
if (typeof host === "string") {
|
|
37142
37142
|
header += `host: ${host}\r
|
|
@@ -37693,7 +37693,7 @@ var require_client_h2 = __commonJS({
|
|
|
37693
37693
|
function writeH2(client, request) {
|
|
37694
37694
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
37695
37695
|
const session = client[kHTTP2Session];
|
|
37696
|
-
const { method, path:
|
|
37696
|
+
const { method, path: path12, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
37697
37697
|
let { body } = request;
|
|
37698
37698
|
if (upgrade) {
|
|
37699
37699
|
util4.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -37772,7 +37772,7 @@ var require_client_h2 = __commonJS({
|
|
|
37772
37772
|
stream2.setTimeout(requestTimeout);
|
|
37773
37773
|
return true;
|
|
37774
37774
|
}
|
|
37775
|
-
headers[HTTP2_HEADER_PATH] =
|
|
37775
|
+
headers[HTTP2_HEADER_PATH] = path12;
|
|
37776
37776
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
37777
37777
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
37778
37778
|
if (body && typeof body.read === "function") {
|
|
@@ -39244,10 +39244,10 @@ var require_proxy_agent = __commonJS({
|
|
|
39244
39244
|
};
|
|
39245
39245
|
const {
|
|
39246
39246
|
origin,
|
|
39247
|
-
path:
|
|
39247
|
+
path: path12 = "/",
|
|
39248
39248
|
headers = {}
|
|
39249
39249
|
} = opts;
|
|
39250
|
-
opts.path = origin +
|
|
39250
|
+
opts.path = origin + path12;
|
|
39251
39251
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
39252
39252
|
const { host } = new URL(origin);
|
|
39253
39253
|
headers.host = host;
|
|
@@ -41333,20 +41333,20 @@ var require_mock_utils = __commonJS({
|
|
|
41333
41333
|
}
|
|
41334
41334
|
return normalizedQp;
|
|
41335
41335
|
}
|
|
41336
|
-
function safeUrl(
|
|
41337
|
-
if (typeof
|
|
41338
|
-
return
|
|
41336
|
+
function safeUrl(path12) {
|
|
41337
|
+
if (typeof path12 !== "string") {
|
|
41338
|
+
return path12;
|
|
41339
41339
|
}
|
|
41340
|
-
const pathSegments =
|
|
41340
|
+
const pathSegments = path12.split("?", 3);
|
|
41341
41341
|
if (pathSegments.length !== 2) {
|
|
41342
|
-
return
|
|
41342
|
+
return path12;
|
|
41343
41343
|
}
|
|
41344
41344
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
41345
41345
|
qp.sort();
|
|
41346
41346
|
return [...pathSegments, qp.toString()].join("?");
|
|
41347
41347
|
}
|
|
41348
|
-
function matchKey(mockDispatch2, { path:
|
|
41349
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
41348
|
+
function matchKey(mockDispatch2, { path: path12, method, body, headers }) {
|
|
41349
|
+
const pathMatch = matchValue(mockDispatch2.path, path12);
|
|
41350
41350
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
41351
41351
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
41352
41352
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -41371,8 +41371,8 @@ var require_mock_utils = __commonJS({
|
|
|
41371
41371
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
41372
41372
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
41373
41373
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
41374
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
41375
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
41374
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path12, ignoreTrailingSlash }) => {
|
|
41375
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path12)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path12), resolvedPath);
|
|
41376
41376
|
});
|
|
41377
41377
|
if (matchedMockDispatches.length === 0) {
|
|
41378
41378
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -41410,19 +41410,19 @@ var require_mock_utils = __commonJS({
|
|
|
41410
41410
|
mockDispatches.splice(index, 1);
|
|
41411
41411
|
}
|
|
41412
41412
|
}
|
|
41413
|
-
function removeTrailingSlash(
|
|
41414
|
-
while (
|
|
41415
|
-
|
|
41413
|
+
function removeTrailingSlash(path12) {
|
|
41414
|
+
while (path12.endsWith("/")) {
|
|
41415
|
+
path12 = path12.slice(0, -1);
|
|
41416
41416
|
}
|
|
41417
|
-
if (
|
|
41418
|
-
|
|
41417
|
+
if (path12.length === 0) {
|
|
41418
|
+
path12 = "/";
|
|
41419
41419
|
}
|
|
41420
|
-
return
|
|
41420
|
+
return path12;
|
|
41421
41421
|
}
|
|
41422
41422
|
function buildKey(opts) {
|
|
41423
|
-
const { path:
|
|
41423
|
+
const { path: path12, method, body, headers, query } = opts;
|
|
41424
41424
|
return {
|
|
41425
|
-
path:
|
|
41425
|
+
path: path12,
|
|
41426
41426
|
method,
|
|
41427
41427
|
body,
|
|
41428
41428
|
headers,
|
|
@@ -42080,10 +42080,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
42080
42080
|
}
|
|
42081
42081
|
format(pendingInterceptors) {
|
|
42082
42082
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
42083
|
-
({ method, path:
|
|
42083
|
+
({ method, path: path12, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
42084
42084
|
Method: method,
|
|
42085
42085
|
Origin: origin,
|
|
42086
|
-
Path:
|
|
42086
|
+
Path: path12,
|
|
42087
42087
|
"Status code": statusCode,
|
|
42088
42088
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
42089
42089
|
Invocations: timesInvoked,
|
|
@@ -42163,9 +42163,9 @@ var require_mock_agent = __commonJS({
|
|
|
42163
42163
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
42164
42164
|
const dispatchOpts = { ...opts };
|
|
42165
42165
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
42166
|
-
const [
|
|
42166
|
+
const [path12, searchParams] = dispatchOpts.path.split("?");
|
|
42167
42167
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
42168
|
-
dispatchOpts.path = `${
|
|
42168
|
+
dispatchOpts.path = `${path12}?${normalizedSearchParams}`;
|
|
42169
42169
|
}
|
|
42170
42170
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
42171
42171
|
}
|
|
@@ -42562,12 +42562,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
42562
42562
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
42563
42563
|
*/
|
|
42564
42564
|
async loadSnapshots(filePath) {
|
|
42565
|
-
const
|
|
42566
|
-
if (!
|
|
42565
|
+
const path12 = filePath || this.#snapshotPath;
|
|
42566
|
+
if (!path12) {
|
|
42567
42567
|
throw new InvalidArgumentError9("Snapshot path is required");
|
|
42568
42568
|
}
|
|
42569
42569
|
try {
|
|
42570
|
-
const data = await readFile6(resolve5(
|
|
42570
|
+
const data = await readFile6(resolve5(path12), "utf8");
|
|
42571
42571
|
const parsed = JSON.parse(data);
|
|
42572
42572
|
if (Array.isArray(parsed)) {
|
|
42573
42573
|
this.#snapshots.clear();
|
|
@@ -42581,7 +42581,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
42581
42581
|
if (error87.code === "ENOENT") {
|
|
42582
42582
|
this.#snapshots.clear();
|
|
42583
42583
|
} else {
|
|
42584
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
42584
|
+
throw new UndiciError(`Failed to load snapshots from ${path12}`, { cause: error87 });
|
|
42585
42585
|
}
|
|
42586
42586
|
}
|
|
42587
42587
|
}
|
|
@@ -42592,11 +42592,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
42592
42592
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
42593
42593
|
*/
|
|
42594
42594
|
async saveSnapshots(filePath) {
|
|
42595
|
-
const
|
|
42596
|
-
if (!
|
|
42595
|
+
const path12 = filePath || this.#snapshotPath;
|
|
42596
|
+
if (!path12) {
|
|
42597
42597
|
throw new InvalidArgumentError9("Snapshot path is required");
|
|
42598
42598
|
}
|
|
42599
|
-
const resolvedPath = resolve5(
|
|
42599
|
+
const resolvedPath = resolve5(path12);
|
|
42600
42600
|
await mkdir2(dirname2(resolvedPath), { recursive: true });
|
|
42601
42601
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
42602
42602
|
hash: hash2,
|
|
@@ -43222,15 +43222,15 @@ var require_redirect_handler = __commonJS({
|
|
|
43222
43222
|
return;
|
|
43223
43223
|
}
|
|
43224
43224
|
const { origin, pathname, search } = util4.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
43225
|
-
const
|
|
43226
|
-
const redirectUrlString = `${origin}${
|
|
43225
|
+
const path12 = search ? `${pathname}${search}` : pathname;
|
|
43226
|
+
const redirectUrlString = `${origin}${path12}`;
|
|
43227
43227
|
for (const historyUrl of this.history) {
|
|
43228
43228
|
if (historyUrl.toString() === redirectUrlString) {
|
|
43229
43229
|
throw new InvalidArgumentError9(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
43230
43230
|
}
|
|
43231
43231
|
}
|
|
43232
43232
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
43233
|
-
this.opts.path =
|
|
43233
|
+
this.opts.path = path12;
|
|
43234
43234
|
this.opts.origin = origin;
|
|
43235
43235
|
this.opts.query = null;
|
|
43236
43236
|
}
|
|
@@ -49621,9 +49621,9 @@ var require_util4 = __commonJS({
|
|
|
49621
49621
|
}
|
|
49622
49622
|
}
|
|
49623
49623
|
}
|
|
49624
|
-
function validateCookiePath(
|
|
49625
|
-
for (let i = 0; i <
|
|
49626
|
-
const code =
|
|
49624
|
+
function validateCookiePath(path12) {
|
|
49625
|
+
for (let i = 0; i < path12.length; ++i) {
|
|
49626
|
+
const code = path12.charCodeAt(i);
|
|
49627
49627
|
if (code < 32 || // exclude CTLs (0-31)
|
|
49628
49628
|
code === 127 || // DEL
|
|
49629
49629
|
code === 59) {
|
|
@@ -52731,11 +52731,11 @@ var require_undici = __commonJS({
|
|
|
52731
52731
|
if (typeof opts.path !== "string") {
|
|
52732
52732
|
throw new InvalidArgumentError9("invalid opts.path");
|
|
52733
52733
|
}
|
|
52734
|
-
let
|
|
52734
|
+
let path12 = opts.path;
|
|
52735
52735
|
if (!opts.path.startsWith("/")) {
|
|
52736
|
-
|
|
52736
|
+
path12 = `/${path12}`;
|
|
52737
52737
|
}
|
|
52738
|
-
url3 = new URL(util4.parseOrigin(url3).origin +
|
|
52738
|
+
url3 = new URL(util4.parseOrigin(url3).origin + path12);
|
|
52739
52739
|
} else {
|
|
52740
52740
|
if (!opts) {
|
|
52741
52741
|
opts = typeof url3 === "object" ? url3 : {};
|
|
@@ -53870,7 +53870,7 @@ function parseXmlResponse(xmlString) {
|
|
|
53870
53870
|
const fileXml = remainingXml.slice(fileStart, fileEnd);
|
|
53871
53871
|
const pathMatch = fileXml.match(/path="([^"]*)"/);
|
|
53872
53872
|
const actionMatch = fileXml.match(/action="([^"]*)"/);
|
|
53873
|
-
const
|
|
53873
|
+
const path12 = pathMatch ? pathMatch[1] : "";
|
|
53874
53874
|
const action = actionMatch ? actionMatch[1] : "modify";
|
|
53875
53875
|
const changes = [];
|
|
53876
53876
|
let changeXml = fileXml;
|
|
@@ -53919,7 +53919,7 @@ function parseXmlResponse(xmlString) {
|
|
|
53919
53919
|
changeXml = changeXml.slice(changeEnd);
|
|
53920
53920
|
}
|
|
53921
53921
|
if (changes.length > 0) {
|
|
53922
|
-
files2.push({ path:
|
|
53922
|
+
files2.push({ path: path12, action, changes });
|
|
53923
53923
|
}
|
|
53924
53924
|
remainingXml = remainingXml.slice(fileEnd);
|
|
53925
53925
|
}
|
|
@@ -57978,12 +57978,12 @@ var PathBase = class {
|
|
|
57978
57978
|
/**
|
|
57979
57979
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
57980
57980
|
*/
|
|
57981
|
-
resolve(
|
|
57982
|
-
if (!
|
|
57981
|
+
resolve(path12) {
|
|
57982
|
+
if (!path12) {
|
|
57983
57983
|
return this;
|
|
57984
57984
|
}
|
|
57985
|
-
const rootPath = this.getRootString(
|
|
57986
|
-
const dir =
|
|
57985
|
+
const rootPath = this.getRootString(path12);
|
|
57986
|
+
const dir = path12.substring(rootPath.length);
|
|
57987
57987
|
const dirParts = dir.split(this.splitSep);
|
|
57988
57988
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
57989
57989
|
return result;
|
|
@@ -58735,8 +58735,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
58735
58735
|
/**
|
|
58736
58736
|
* @internal
|
|
58737
58737
|
*/
|
|
58738
|
-
getRootString(
|
|
58739
|
-
return import_node_path.win32.parse(
|
|
58738
|
+
getRootString(path12) {
|
|
58739
|
+
return import_node_path.win32.parse(path12).root;
|
|
58740
58740
|
}
|
|
58741
58741
|
/**
|
|
58742
58742
|
* @internal
|
|
@@ -58782,8 +58782,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
58782
58782
|
/**
|
|
58783
58783
|
* @internal
|
|
58784
58784
|
*/
|
|
58785
|
-
getRootString(
|
|
58786
|
-
return
|
|
58785
|
+
getRootString(path12) {
|
|
58786
|
+
return path12.startsWith("/") ? "/" : "";
|
|
58787
58787
|
}
|
|
58788
58788
|
/**
|
|
58789
58789
|
* @internal
|
|
@@ -58832,8 +58832,8 @@ var PathScurryBase = class {
|
|
|
58832
58832
|
*
|
|
58833
58833
|
* @internal
|
|
58834
58834
|
*/
|
|
58835
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
58836
|
-
this.#fs = fsFromOption(
|
|
58835
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs15 = defaultFS } = {}) {
|
|
58836
|
+
this.#fs = fsFromOption(fs15);
|
|
58837
58837
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
58838
58838
|
cwd = (0, import_node_url.fileURLToPath)(cwd);
|
|
58839
58839
|
}
|
|
@@ -58872,11 +58872,11 @@ var PathScurryBase = class {
|
|
|
58872
58872
|
/**
|
|
58873
58873
|
* Get the depth of a provided path, string, or the cwd
|
|
58874
58874
|
*/
|
|
58875
|
-
depth(
|
|
58876
|
-
if (typeof
|
|
58877
|
-
|
|
58875
|
+
depth(path12 = this.cwd) {
|
|
58876
|
+
if (typeof path12 === "string") {
|
|
58877
|
+
path12 = this.cwd.resolve(path12);
|
|
58878
58878
|
}
|
|
58879
|
-
return
|
|
58879
|
+
return path12.depth();
|
|
58880
58880
|
}
|
|
58881
58881
|
/**
|
|
58882
58882
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -59363,9 +59363,9 @@ var PathScurryBase = class {
|
|
|
59363
59363
|
process2();
|
|
59364
59364
|
return results;
|
|
59365
59365
|
}
|
|
59366
|
-
chdir(
|
|
59366
|
+
chdir(path12 = this.cwd) {
|
|
59367
59367
|
const oldCwd = this.cwd;
|
|
59368
|
-
this.cwd = typeof
|
|
59368
|
+
this.cwd = typeof path12 === "string" ? this.cwd.resolve(path12) : path12;
|
|
59369
59369
|
this.cwd[setAsCwd](oldCwd);
|
|
59370
59370
|
}
|
|
59371
59371
|
};
|
|
@@ -59391,8 +59391,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
59391
59391
|
/**
|
|
59392
59392
|
* @internal
|
|
59393
59393
|
*/
|
|
59394
|
-
newRoot(
|
|
59395
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
59394
|
+
newRoot(fs15) {
|
|
59395
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs15 });
|
|
59396
59396
|
}
|
|
59397
59397
|
/**
|
|
59398
59398
|
* Return true if the provided path string is an absolute path
|
|
@@ -59420,8 +59420,8 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
59420
59420
|
/**
|
|
59421
59421
|
* @internal
|
|
59422
59422
|
*/
|
|
59423
|
-
newRoot(
|
|
59424
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
59423
|
+
newRoot(fs15) {
|
|
59424
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs15 });
|
|
59425
59425
|
}
|
|
59426
59426
|
/**
|
|
59427
59427
|
* Return true if the provided path string is an absolute path
|
|
@@ -59721,8 +59721,8 @@ var MatchRecord = class {
|
|
|
59721
59721
|
}
|
|
59722
59722
|
// match, absolute, ifdir
|
|
59723
59723
|
entries() {
|
|
59724
|
-
return [...this.store.entries()].map(([
|
|
59725
|
-
|
|
59724
|
+
return [...this.store.entries()].map(([path12, n]) => [
|
|
59725
|
+
path12,
|
|
59726
59726
|
!!(n & 2),
|
|
59727
59727
|
!!(n & 1)
|
|
59728
59728
|
]);
|
|
@@ -59927,9 +59927,9 @@ var GlobUtil = class {
|
|
|
59927
59927
|
signal;
|
|
59928
59928
|
maxDepth;
|
|
59929
59929
|
includeChildMatches;
|
|
59930
|
-
constructor(patterns,
|
|
59930
|
+
constructor(patterns, path12, opts) {
|
|
59931
59931
|
this.patterns = patterns;
|
|
59932
|
-
this.path =
|
|
59932
|
+
this.path = path12;
|
|
59933
59933
|
this.opts = opts;
|
|
59934
59934
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
59935
59935
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -59948,11 +59948,11 @@ var GlobUtil = class {
|
|
|
59948
59948
|
});
|
|
59949
59949
|
}
|
|
59950
59950
|
}
|
|
59951
|
-
#ignored(
|
|
59952
|
-
return this.seen.has(
|
|
59951
|
+
#ignored(path12) {
|
|
59952
|
+
return this.seen.has(path12) || !!this.#ignore?.ignored?.(path12);
|
|
59953
59953
|
}
|
|
59954
|
-
#childrenIgnored(
|
|
59955
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
59954
|
+
#childrenIgnored(path12) {
|
|
59955
|
+
return !!this.#ignore?.childrenIgnored?.(path12);
|
|
59956
59956
|
}
|
|
59957
59957
|
// backpressure mechanism
|
|
59958
59958
|
pause() {
|
|
@@ -60167,8 +60167,8 @@ var GlobUtil = class {
|
|
|
60167
60167
|
};
|
|
60168
60168
|
var GlobWalker = class extends GlobUtil {
|
|
60169
60169
|
matches = /* @__PURE__ */ new Set();
|
|
60170
|
-
constructor(patterns,
|
|
60171
|
-
super(patterns,
|
|
60170
|
+
constructor(patterns, path12, opts) {
|
|
60171
|
+
super(patterns, path12, opts);
|
|
60172
60172
|
}
|
|
60173
60173
|
matchEmit(e) {
|
|
60174
60174
|
this.matches.add(e);
|
|
@@ -60205,8 +60205,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
60205
60205
|
};
|
|
60206
60206
|
var GlobStream = class extends GlobUtil {
|
|
60207
60207
|
results;
|
|
60208
|
-
constructor(patterns,
|
|
60209
|
-
super(patterns,
|
|
60208
|
+
constructor(patterns, path12, opts) {
|
|
60209
|
+
super(patterns, path12, opts);
|
|
60210
60210
|
this.results = new Minipass({
|
|
60211
60211
|
signal: this.signal,
|
|
60212
60212
|
objectMode: true
|
|
@@ -61213,7 +61213,7 @@ var SSEManager = class {
|
|
|
61213
61213
|
var sseManager = new SSEManager();
|
|
61214
61214
|
|
|
61215
61215
|
// src/proxy/version.ts
|
|
61216
|
-
var VERSION = "0.3.
|
|
61216
|
+
var VERSION = "0.3.80";
|
|
61217
61217
|
|
|
61218
61218
|
// node_modules/uuid/dist/esm/stringify.js
|
|
61219
61219
|
var byteToHex = [];
|
|
@@ -62131,10 +62131,10 @@ function mergeDefs(...defs) {
|
|
|
62131
62131
|
function cloneDef(schema) {
|
|
62132
62132
|
return mergeDefs(schema._zod.def);
|
|
62133
62133
|
}
|
|
62134
|
-
function getElementAtPath(obj,
|
|
62135
|
-
if (!
|
|
62134
|
+
function getElementAtPath(obj, path12) {
|
|
62135
|
+
if (!path12)
|
|
62136
62136
|
return obj;
|
|
62137
|
-
return
|
|
62137
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
62138
62138
|
}
|
|
62139
62139
|
function promiseAllObject(promisesObj) {
|
|
62140
62140
|
const keys = Object.keys(promisesObj);
|
|
@@ -62495,11 +62495,11 @@ function aborted(x, startIndex = 0) {
|
|
|
62495
62495
|
}
|
|
62496
62496
|
return false;
|
|
62497
62497
|
}
|
|
62498
|
-
function prefixIssues(
|
|
62498
|
+
function prefixIssues(path12, issues) {
|
|
62499
62499
|
return issues.map((iss) => {
|
|
62500
62500
|
var _a40;
|
|
62501
62501
|
(_a40 = iss).path ?? (_a40.path = []);
|
|
62502
|
-
iss.path.unshift(
|
|
62502
|
+
iss.path.unshift(path12);
|
|
62503
62503
|
return iss;
|
|
62504
62504
|
});
|
|
62505
62505
|
}
|
|
@@ -62661,7 +62661,7 @@ function formatError(error87, mapper = (issue4) => issue4.message) {
|
|
|
62661
62661
|
}
|
|
62662
62662
|
function treeifyError(error87, mapper = (issue4) => issue4.message) {
|
|
62663
62663
|
const result = { errors: [] };
|
|
62664
|
-
const processError = (error88,
|
|
62664
|
+
const processError = (error88, path12 = []) => {
|
|
62665
62665
|
var _a40, _b31;
|
|
62666
62666
|
for (const issue4 of error88.issues) {
|
|
62667
62667
|
if (issue4.code === "invalid_union" && issue4.errors.length) {
|
|
@@ -62671,7 +62671,7 @@ function treeifyError(error87, mapper = (issue4) => issue4.message) {
|
|
|
62671
62671
|
} else if (issue4.code === "invalid_element") {
|
|
62672
62672
|
processError({ issues: issue4.issues }, issue4.path);
|
|
62673
62673
|
} else {
|
|
62674
|
-
const fullpath = [...
|
|
62674
|
+
const fullpath = [...path12, ...issue4.path];
|
|
62675
62675
|
if (fullpath.length === 0) {
|
|
62676
62676
|
result.errors.push(mapper(issue4));
|
|
62677
62677
|
continue;
|
|
@@ -62703,8 +62703,8 @@ function treeifyError(error87, mapper = (issue4) => issue4.message) {
|
|
|
62703
62703
|
}
|
|
62704
62704
|
function toDotPath(_path) {
|
|
62705
62705
|
const segs = [];
|
|
62706
|
-
const
|
|
62707
|
-
for (const seg of
|
|
62706
|
+
const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
62707
|
+
for (const seg of path12) {
|
|
62708
62708
|
if (typeof seg === "number")
|
|
62709
62709
|
segs.push(`[${seg}]`);
|
|
62710
62710
|
else if (typeof seg === "symbol")
|
|
@@ -74301,8 +74301,8 @@ function getErrorMap2() {
|
|
|
74301
74301
|
|
|
74302
74302
|
// node_modules/aieo/node_modules/zod/v3/helpers/parseUtil.js
|
|
74303
74303
|
var makeIssue = (params) => {
|
|
74304
|
-
const { data, path:
|
|
74305
|
-
const fullPath = [...
|
|
74304
|
+
const { data, path: path12, errorMaps, issueData } = params;
|
|
74305
|
+
const fullPath = [...path12, ...issueData.path || []];
|
|
74306
74306
|
const fullIssue = {
|
|
74307
74307
|
...issueData,
|
|
74308
74308
|
path: fullPath
|
|
@@ -74417,11 +74417,11 @@ var errorUtil;
|
|
|
74417
74417
|
|
|
74418
74418
|
// node_modules/aieo/node_modules/zod/v3/types.js
|
|
74419
74419
|
var ParseInputLazyPath = class {
|
|
74420
|
-
constructor(parent, value,
|
|
74420
|
+
constructor(parent, value, path12, key) {
|
|
74421
74421
|
this._cachedPath = [];
|
|
74422
74422
|
this.parent = parent;
|
|
74423
74423
|
this.data = value;
|
|
74424
|
-
this._path =
|
|
74424
|
+
this._path = path12;
|
|
74425
74425
|
this._key = key;
|
|
74426
74426
|
}
|
|
74427
74427
|
get path() {
|
|
@@ -79747,8 +79747,8 @@ function getErrorMap3() {
|
|
|
79747
79747
|
|
|
79748
79748
|
// node_modules/@ai-sdk/provider-utils/node_modules/zod/v3/helpers/parseUtil.js
|
|
79749
79749
|
var makeIssue2 = (params) => {
|
|
79750
|
-
const { data, path:
|
|
79751
|
-
const fullPath = [...
|
|
79750
|
+
const { data, path: path12, errorMaps, issueData } = params;
|
|
79751
|
+
const fullPath = [...path12, ...issueData.path || []];
|
|
79752
79752
|
const fullIssue = {
|
|
79753
79753
|
...issueData,
|
|
79754
79754
|
path: fullPath
|
|
@@ -79863,11 +79863,11 @@ var errorUtil2;
|
|
|
79863
79863
|
|
|
79864
79864
|
// node_modules/@ai-sdk/provider-utils/node_modules/zod/v3/types.js
|
|
79865
79865
|
var ParseInputLazyPath2 = class {
|
|
79866
|
-
constructor(parent, value,
|
|
79866
|
+
constructor(parent, value, path12, key) {
|
|
79867
79867
|
this._cachedPath = [];
|
|
79868
79868
|
this.parent = parent;
|
|
79869
79869
|
this.data = value;
|
|
79870
|
-
this._path =
|
|
79870
|
+
this._path = path12;
|
|
79871
79871
|
this._key = key;
|
|
79872
79872
|
}
|
|
79873
79873
|
get path() {
|
|
@@ -105235,37 +105235,37 @@ function createOpenAI(options = {}) {
|
|
|
105235
105235
|
);
|
|
105236
105236
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
105237
105237
|
provider: `${providerName}.chat`,
|
|
105238
|
-
url: ({ path:
|
|
105238
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105239
105239
|
headers: getHeaders,
|
|
105240
105240
|
fetch: options.fetch
|
|
105241
105241
|
});
|
|
105242
105242
|
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
105243
105243
|
provider: `${providerName}.completion`,
|
|
105244
|
-
url: ({ path:
|
|
105244
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105245
105245
|
headers: getHeaders,
|
|
105246
105246
|
fetch: options.fetch
|
|
105247
105247
|
});
|
|
105248
105248
|
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
105249
105249
|
provider: `${providerName}.embedding`,
|
|
105250
|
-
url: ({ path:
|
|
105250
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105251
105251
|
headers: getHeaders,
|
|
105252
105252
|
fetch: options.fetch
|
|
105253
105253
|
});
|
|
105254
105254
|
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
105255
105255
|
provider: `${providerName}.image`,
|
|
105256
|
-
url: ({ path:
|
|
105256
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105257
105257
|
headers: getHeaders,
|
|
105258
105258
|
fetch: options.fetch
|
|
105259
105259
|
});
|
|
105260
105260
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
105261
105261
|
provider: `${providerName}.transcription`,
|
|
105262
|
-
url: ({ path:
|
|
105262
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105263
105263
|
headers: getHeaders,
|
|
105264
105264
|
fetch: options.fetch
|
|
105265
105265
|
});
|
|
105266
105266
|
const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
|
|
105267
105267
|
provider: `${providerName}.speech`,
|
|
105268
|
-
url: ({ path:
|
|
105268
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105269
105269
|
headers: getHeaders,
|
|
105270
105270
|
fetch: options.fetch
|
|
105271
105271
|
});
|
|
@@ -105280,7 +105280,7 @@ function createOpenAI(options = {}) {
|
|
|
105280
105280
|
const createResponsesModel = (modelId) => {
|
|
105281
105281
|
return new OpenAIResponsesLanguageModel(modelId, {
|
|
105282
105282
|
provider: `${providerName}.responses`,
|
|
105283
|
-
url: ({ path:
|
|
105283
|
+
url: ({ path: path12 }) => `${baseURL}${path12}`,
|
|
105284
105284
|
headers: getHeaders,
|
|
105285
105285
|
fetch: options.fetch,
|
|
105286
105286
|
fileIdPrefixes: ["file-"]
|
|
@@ -106453,10 +106453,10 @@ function assignProp2(target, prop, value) {
|
|
|
106453
106453
|
configurable: true
|
|
106454
106454
|
});
|
|
106455
106455
|
}
|
|
106456
|
-
function getElementAtPath2(obj,
|
|
106457
|
-
if (!
|
|
106456
|
+
function getElementAtPath2(obj, path12) {
|
|
106457
|
+
if (!path12)
|
|
106458
106458
|
return obj;
|
|
106459
|
-
return
|
|
106459
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
106460
106460
|
}
|
|
106461
106461
|
function promiseAllObject2(promisesObj) {
|
|
106462
106462
|
const keys = Object.keys(promisesObj);
|
|
@@ -106776,11 +106776,11 @@ function aborted3(x, startIndex = 0) {
|
|
|
106776
106776
|
}
|
|
106777
106777
|
return false;
|
|
106778
106778
|
}
|
|
106779
|
-
function prefixIssues3(
|
|
106779
|
+
function prefixIssues3(path12, issues) {
|
|
106780
106780
|
return issues.map((iss) => {
|
|
106781
106781
|
var _a40;
|
|
106782
106782
|
(_a40 = iss).path ?? (_a40.path = []);
|
|
106783
|
-
iss.path.unshift(
|
|
106783
|
+
iss.path.unshift(path12);
|
|
106784
106784
|
return iss;
|
|
106785
106785
|
});
|
|
106786
106786
|
}
|
|
@@ -106917,7 +106917,7 @@ function treeifyError3(error87, _mapper) {
|
|
|
106917
106917
|
return issue4.message;
|
|
106918
106918
|
};
|
|
106919
106919
|
const result = { errors: [] };
|
|
106920
|
-
const processError = (error88,
|
|
106920
|
+
const processError = (error88, path12 = []) => {
|
|
106921
106921
|
var _a40, _b31;
|
|
106922
106922
|
for (const issue4 of error88.issues) {
|
|
106923
106923
|
if (issue4.code === "invalid_union" && issue4.errors.length) {
|
|
@@ -106927,7 +106927,7 @@ function treeifyError3(error87, _mapper) {
|
|
|
106927
106927
|
} else if (issue4.code === "invalid_element") {
|
|
106928
106928
|
processError({ issues: issue4.issues }, issue4.path);
|
|
106929
106929
|
} else {
|
|
106930
|
-
const fullpath = [...
|
|
106930
|
+
const fullpath = [...path12, ...issue4.path];
|
|
106931
106931
|
if (fullpath.length === 0) {
|
|
106932
106932
|
result.errors.push(mapper(issue4));
|
|
106933
106933
|
continue;
|
|
@@ -106957,9 +106957,9 @@ function treeifyError3(error87, _mapper) {
|
|
|
106957
106957
|
processError(error87);
|
|
106958
106958
|
return result;
|
|
106959
106959
|
}
|
|
106960
|
-
function toDotPath2(
|
|
106960
|
+
function toDotPath2(path12) {
|
|
106961
106961
|
const segs = [];
|
|
106962
|
-
for (const seg of
|
|
106962
|
+
for (const seg of path12) {
|
|
106963
106963
|
if (typeof seg === "number")
|
|
106964
106964
|
segs.push(`[${seg}]`);
|
|
106965
106965
|
else if (typeof seg === "symbol")
|
|
@@ -117299,8 +117299,8 @@ function getErrorMap5() {
|
|
|
117299
117299
|
|
|
117300
117300
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
117301
117301
|
var makeIssue3 = (params) => {
|
|
117302
|
-
const { data, path:
|
|
117303
|
-
const fullPath = [...
|
|
117302
|
+
const { data, path: path12, errorMaps, issueData } = params;
|
|
117303
|
+
const fullPath = [...path12, ...issueData.path || []];
|
|
117304
117304
|
const fullIssue = {
|
|
117305
117305
|
...issueData,
|
|
117306
117306
|
path: fullPath
|
|
@@ -117415,11 +117415,11 @@ var errorUtil3;
|
|
|
117415
117415
|
|
|
117416
117416
|
// node_modules/zod/v3/types.js
|
|
117417
117417
|
var ParseInputLazyPath3 = class {
|
|
117418
|
-
constructor(parent, value,
|
|
117418
|
+
constructor(parent, value, path12, key) {
|
|
117419
117419
|
this._cachedPath = [];
|
|
117420
117420
|
this.parent = parent;
|
|
117421
117421
|
this.data = value;
|
|
117422
|
-
this._path =
|
|
117422
|
+
this._path = path12;
|
|
117423
117423
|
this._key = key;
|
|
117424
117424
|
}
|
|
117425
117425
|
get path() {
|
|
@@ -121586,9 +121586,10 @@ async function runAgent({
|
|
|
121586
121586
|
system_prompt,
|
|
121587
121587
|
session,
|
|
121588
121588
|
summarize,
|
|
121589
|
-
model
|
|
121589
|
+
model,
|
|
121590
|
+
searchApiKey
|
|
121590
121591
|
}) {
|
|
121591
|
-
createGooseConfig();
|
|
121592
|
+
createGooseConfig(searchApiKey);
|
|
121592
121593
|
const env = goose_env(apiKey, model);
|
|
121593
121594
|
console.log("RUN goose with env", env);
|
|
121594
121595
|
const cleanPrompt = sanitizeShellArg(prompt);
|
|
@@ -121607,6 +121608,9 @@ async function runAgent({
|
|
|
121607
121608
|
} catch {
|
|
121608
121609
|
}
|
|
121609
121610
|
}
|
|
121611
|
+
if (searchApiKey) {
|
|
121612
|
+
cmd += ` --with-streamable-http-extension "https://mcp.exa.ai/mcp?exaApiKey=${searchApiKey}"`;
|
|
121613
|
+
}
|
|
121610
121614
|
const res = await executeCommand(cmd, cwd, env, (l) => console.log(l));
|
|
121611
121615
|
const output = res.stdout;
|
|
121612
121616
|
if (summarize && session) {
|
|
@@ -121616,10 +121620,10 @@ async function runAgent({
|
|
|
121616
121620
|
}
|
|
121617
121621
|
return output;
|
|
121618
121622
|
}
|
|
121619
|
-
function createGooseConfig() {
|
|
121623
|
+
function createGooseConfig(exaApiKey) {
|
|
121620
121624
|
const configDir = path7.join(os.homedir(), ".config", "goose");
|
|
121621
121625
|
const configPath = path7.join(configDir, "config.yaml");
|
|
121622
|
-
|
|
121626
|
+
let configContent = `extensions:
|
|
121623
121627
|
extension_name:
|
|
121624
121628
|
bundled: true
|
|
121625
121629
|
display_name: "Dev"
|
|
@@ -121628,6 +121632,17 @@ function createGooseConfig() {
|
|
|
121628
121632
|
timeout: 300
|
|
121629
121633
|
type: "builtin"
|
|
121630
121634
|
`;
|
|
121635
|
+
if (exaApiKey) {
|
|
121636
|
+
configContent += `
|
|
121637
|
+
exa:
|
|
121638
|
+
enabled: true
|
|
121639
|
+
type: streamable_http
|
|
121640
|
+
name: exa
|
|
121641
|
+
description: "Search the web and github"
|
|
121642
|
+
uri: https://mcp.exa.ai/mcp?exaApiKey=2f23c2d5-9304-43e7-986f-e73596406e98
|
|
121643
|
+
timeout: 300
|
|
121644
|
+
`;
|
|
121645
|
+
}
|
|
121631
121646
|
try {
|
|
121632
121647
|
if (!fs8.existsSync(configDir)) {
|
|
121633
121648
|
fs8.mkdirSync(configDir, { recursive: true });
|
|
@@ -132901,7 +132916,7 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132901
132916
|
console.log("Session doesn't exist, don't resume");
|
|
132902
132917
|
}
|
|
132903
132918
|
log("Streaming Goose to SSE", { sessionId, prompt, apiKey, resume });
|
|
132904
|
-
createGooseConfig();
|
|
132919
|
+
createGooseConfig(options?.searchApiKey);
|
|
132905
132920
|
const textAccumulators = /* @__PURE__ */ new Map();
|
|
132906
132921
|
let finishData = null;
|
|
132907
132922
|
try {
|
|
@@ -133043,7 +133058,7 @@ var SESSIONS = /* @__PURE__ */ new Map();
|
|
|
133043
133058
|
function issueToken(sessionId) {
|
|
133044
133059
|
return jwt3.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
|
|
133045
133060
|
}
|
|
133046
|
-
function createSession(sessionId, webhookUrl, apiKey) {
|
|
133061
|
+
function createSession(sessionId, webhookUrl, apiKey, searchApiKey) {
|
|
133047
133062
|
const now3 = Date.now();
|
|
133048
133063
|
const existing = SESSIONS.get(sessionId);
|
|
133049
133064
|
if (existing) {
|
|
@@ -133054,6 +133069,9 @@ function createSession(sessionId, webhookUrl, apiKey) {
|
|
|
133054
133069
|
if (apiKey !== void 0) {
|
|
133055
133070
|
existing.apiKey = apiKey;
|
|
133056
133071
|
}
|
|
133072
|
+
if (searchApiKey !== void 0) {
|
|
133073
|
+
existing.searchApiKey = searchApiKey;
|
|
133074
|
+
}
|
|
133057
133075
|
return { token: issueToken(sessionId), created: false };
|
|
133058
133076
|
}
|
|
133059
133077
|
SESSIONS.set(sessionId, {
|
|
@@ -133061,7 +133079,8 @@ function createSession(sessionId, webhookUrl, apiKey) {
|
|
|
133061
133079
|
createdAt: now3,
|
|
133062
133080
|
lastActivity: now3,
|
|
133063
133081
|
webhookUrl,
|
|
133064
|
-
apiKey
|
|
133082
|
+
apiKey,
|
|
133083
|
+
searchApiKey
|
|
133065
133084
|
});
|
|
133066
133085
|
return { token: issueToken(sessionId), created: true };
|
|
133067
133086
|
}
|
|
@@ -133097,7 +133116,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133097
133116
|
return async (req, res) => {
|
|
133098
133117
|
const request_id = startReq();
|
|
133099
133118
|
try {
|
|
133100
|
-
const { repoName, apiKey, agent_name, session, summarize, model } = req.body;
|
|
133119
|
+
const { repoName, apiKey, agent_name, session, summarize, model, searchApiKey } = req.body;
|
|
133101
133120
|
const params = getParams(req);
|
|
133102
133121
|
const workspaceRoot2 = await workspaceRoot();
|
|
133103
133122
|
let repoPath = workspaceRoot2;
|
|
@@ -133119,7 +133138,8 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133119
133138
|
system_prompt: params.system,
|
|
133120
133139
|
session,
|
|
133121
133140
|
summarize: summarize ? true : false,
|
|
133122
|
-
model
|
|
133141
|
+
model,
|
|
133142
|
+
searchApiKey
|
|
133123
133143
|
}).then((result) => {
|
|
133124
133144
|
const finalResult = transformResult ? transformResult(result) : result;
|
|
133125
133145
|
finishReq(request_id, {
|
|
@@ -133710,6 +133730,11 @@ async function takeScreenshot(port) {
|
|
|
133710
133730
|
}
|
|
133711
133731
|
}
|
|
133712
133732
|
|
|
133733
|
+
// src/proxy/git_actions.ts
|
|
133734
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
133735
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
133736
|
+
var import_child_process6 = require("child_process");
|
|
133737
|
+
|
|
133713
133738
|
// src/proxy/gh.ts
|
|
133714
133739
|
var import_child_process5 = require("child_process");
|
|
133715
133740
|
var import_util18 = require("util");
|
|
@@ -134126,6 +134151,31 @@ Stderr: ${error87.stderr}`
|
|
|
134126
134151
|
}
|
|
134127
134152
|
}
|
|
134128
134153
|
}
|
|
134154
|
+
/**
|
|
134155
|
+
* Create a new repository under an organization and push local code to it
|
|
134156
|
+
*/
|
|
134157
|
+
async createRepository(options) {
|
|
134158
|
+
const { organization, repoName, sourceDir, visibility, description } = options;
|
|
134159
|
+
const args = [
|
|
134160
|
+
"repo",
|
|
134161
|
+
"create",
|
|
134162
|
+
`${organization}/${repoName}`,
|
|
134163
|
+
"--source",
|
|
134164
|
+
sourceDir,
|
|
134165
|
+
`--${visibility}`,
|
|
134166
|
+
"--push"
|
|
134167
|
+
];
|
|
134168
|
+
if (description) {
|
|
134169
|
+
args.push("--description", `"${sanitizeGitHubText(description)}"`);
|
|
134170
|
+
}
|
|
134171
|
+
try {
|
|
134172
|
+
const { stdout } = await this.execGH(args.join(" "));
|
|
134173
|
+
const repoUrl = stdout.trim() || `https://github.com/${organization}/${repoName}`;
|
|
134174
|
+
return { repoUrl };
|
|
134175
|
+
} catch (error87) {
|
|
134176
|
+
throw new Error(`Failed to create repository: ${error87}`);
|
|
134177
|
+
}
|
|
134178
|
+
}
|
|
134129
134179
|
};
|
|
134130
134180
|
|
|
134131
134181
|
// src/proxy/git_actions.ts
|
|
@@ -134529,10 +134579,74 @@ async function handlePr(req, res) {
|
|
|
134529
134579
|
fail(res, e);
|
|
134530
134580
|
}
|
|
134531
134581
|
}
|
|
134582
|
+
async function handleCreateRepo(req, res) {
|
|
134583
|
+
try {
|
|
134584
|
+
const body = req.body;
|
|
134585
|
+
if (!body.source_dir) {
|
|
134586
|
+
res.status(400).json({ success: false, error: "source_dir is required" });
|
|
134587
|
+
return;
|
|
134588
|
+
}
|
|
134589
|
+
if (!body.organization) {
|
|
134590
|
+
res.status(400).json({ success: false, error: "organization is required" });
|
|
134591
|
+
return;
|
|
134592
|
+
}
|
|
134593
|
+
if (!body.repo_name) {
|
|
134594
|
+
res.status(400).json({ success: false, error: "repo_name is required" });
|
|
134595
|
+
return;
|
|
134596
|
+
}
|
|
134597
|
+
if (!body.visibility || !["public", "private"].includes(body.visibility)) {
|
|
134598
|
+
res.status(400).json({
|
|
134599
|
+
success: false,
|
|
134600
|
+
error: "visibility must be 'public' or 'private'"
|
|
134601
|
+
});
|
|
134602
|
+
return;
|
|
134603
|
+
}
|
|
134604
|
+
if (!body.token) {
|
|
134605
|
+
res.status(400).json({ success: false, error: "token is required" });
|
|
134606
|
+
return;
|
|
134607
|
+
}
|
|
134608
|
+
let sourceDir = body.source_dir;
|
|
134609
|
+
if (!import_path3.default.isAbsolute(sourceDir)) {
|
|
134610
|
+
const workspaceRoot2 = await workspaceRoot();
|
|
134611
|
+
sourceDir = import_path3.default.join(workspaceRoot2, sourceDir);
|
|
134612
|
+
}
|
|
134613
|
+
log(`=> Creating repo ${body.organization}/${body.repo_name}`);
|
|
134614
|
+
log(`=> Source directory: ${sourceDir}`);
|
|
134615
|
+
if (!import_fs3.default.existsSync(sourceDir)) {
|
|
134616
|
+
res.status(400).json({
|
|
134617
|
+
success: false,
|
|
134618
|
+
error: `Source directory does not exist: ${sourceDir}`
|
|
134619
|
+
});
|
|
134620
|
+
return;
|
|
134621
|
+
}
|
|
134622
|
+
if (!import_fs3.default.existsSync(import_path3.default.join(sourceDir, ".git"))) {
|
|
134623
|
+
log(`=> Initializing git repository in ${sourceDir}`);
|
|
134624
|
+
(0, import_child_process6.execSync)("git init", { cwd: sourceDir });
|
|
134625
|
+
(0, import_child_process6.execSync)("git add -A", { cwd: sourceDir });
|
|
134626
|
+
(0, import_child_process6.execSync)('git commit -m "Initial commit"', { cwd: sourceDir });
|
|
134627
|
+
}
|
|
134628
|
+
const gh = new GitHubCLI(body.token, "main", sourceDir);
|
|
134629
|
+
const { repoUrl } = await gh.createRepository({
|
|
134630
|
+
organization: body.organization,
|
|
134631
|
+
repoName: body.repo_name,
|
|
134632
|
+
sourceDir,
|
|
134633
|
+
visibility: body.visibility,
|
|
134634
|
+
description: body.description
|
|
134635
|
+
});
|
|
134636
|
+
log(`=> Repository created: ${repoUrl}`);
|
|
134637
|
+
res.json({ success: true, repo_url: repoUrl });
|
|
134638
|
+
} catch (e) {
|
|
134639
|
+
error("Error creating repository:", e);
|
|
134640
|
+
res.status(500).json({
|
|
134641
|
+
success: false,
|
|
134642
|
+
error: e instanceof Error ? e.message : String(e)
|
|
134643
|
+
});
|
|
134644
|
+
}
|
|
134645
|
+
}
|
|
134532
134646
|
|
|
134533
134647
|
// src/proxy/code_actions.ts
|
|
134534
|
-
var
|
|
134535
|
-
var
|
|
134648
|
+
var fs13 = __toESM(require("fs/promises"), 1);
|
|
134649
|
+
var path11 = __toESM(require("path"), 1);
|
|
134536
134650
|
async function processCode(code) {
|
|
134537
134651
|
const results = [];
|
|
134538
134652
|
const workspaceHasOneRepo = await hasOnlyOneRepo();
|
|
@@ -134606,24 +134720,24 @@ async function applyFileAction(file3, filePath) {
|
|
|
134606
134720
|
}
|
|
134607
134721
|
async function createFile(filePath, content) {
|
|
134608
134722
|
try {
|
|
134609
|
-
await
|
|
134723
|
+
await fs13.stat(filePath);
|
|
134610
134724
|
throw new Error(`File ${filePath} already exists`);
|
|
134611
134725
|
} catch (e) {
|
|
134612
134726
|
if (e.code !== "ENOENT") {
|
|
134613
134727
|
throw e;
|
|
134614
134728
|
}
|
|
134615
134729
|
}
|
|
134616
|
-
const dirPath =
|
|
134730
|
+
const dirPath = path11.dirname(filePath);
|
|
134617
134731
|
try {
|
|
134618
|
-
await
|
|
134732
|
+
await fs13.mkdir(dirPath, { recursive: true });
|
|
134619
134733
|
} catch (e) {
|
|
134620
134734
|
}
|
|
134621
|
-
await
|
|
134735
|
+
await fs13.writeFile(filePath, content, "utf8");
|
|
134622
134736
|
}
|
|
134623
134737
|
async function rewriteFile(filePath, content) {
|
|
134624
134738
|
try {
|
|
134625
|
-
await
|
|
134626
|
-
await
|
|
134739
|
+
await fs13.stat(filePath);
|
|
134740
|
+
await fs13.writeFile(filePath, content, "utf8");
|
|
134627
134741
|
} catch (e) {
|
|
134628
134742
|
if (e.code === "ENOENT") {
|
|
134629
134743
|
await createFile(filePath, content);
|
|
@@ -134634,7 +134748,7 @@ async function rewriteFile(filePath, content) {
|
|
|
134634
134748
|
}
|
|
134635
134749
|
async function modifyFile(filePath, changes) {
|
|
134636
134750
|
try {
|
|
134637
|
-
const originalContent = await
|
|
134751
|
+
const originalContent = await fs13.readFile(filePath, "utf8");
|
|
134638
134752
|
let newContent = originalContent.replace(/\r\n/g, "\n");
|
|
134639
134753
|
const finalChange = changes[changes.length - 1];
|
|
134640
134754
|
if (finalChange && finalChange.search) {
|
|
@@ -134659,7 +134773,7 @@ async function modifyFile(filePath, changes) {
|
|
|
134659
134773
|
}
|
|
134660
134774
|
}
|
|
134661
134775
|
if (originalContent !== newContent) {
|
|
134662
|
-
await
|
|
134776
|
+
await fs13.writeFile(filePath, newContent, "utf8");
|
|
134663
134777
|
} else {
|
|
134664
134778
|
log(`=> NO CHANGES to file ${filePath}`);
|
|
134665
134779
|
}
|
|
@@ -134668,7 +134782,7 @@ async function modifyFile(filePath, changes) {
|
|
|
134668
134782
|
}
|
|
134669
134783
|
}
|
|
134670
134784
|
async function deleteFile(filePath) {
|
|
134671
|
-
await
|
|
134785
|
+
await fs13.unlink(filePath);
|
|
134672
134786
|
}
|
|
134673
134787
|
|
|
134674
134788
|
// src/proxy/server.ts
|
|
@@ -134903,6 +135017,13 @@ async function startProxyServer() {
|
|
|
134903
135017
|
log(`===> POST /pr`);
|
|
134904
135018
|
await handlePr(req, res);
|
|
134905
135019
|
});
|
|
135020
|
+
app.post(
|
|
135021
|
+
"/create-repo",
|
|
135022
|
+
async (req, res) => {
|
|
135023
|
+
log(`===> POST /create-repo`);
|
|
135024
|
+
await handleCreateRepo(req, res);
|
|
135025
|
+
}
|
|
135026
|
+
);
|
|
134906
135027
|
app.get("/events", (req, res) => {
|
|
134907
135028
|
log("===> GET /events");
|
|
134908
135029
|
try {
|
|
@@ -135234,20 +135355,20 @@ async function startProxyServer() {
|
|
|
135234
135355
|
prompt,
|
|
135235
135356
|
session.apiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
135236
135357
|
res,
|
|
135237
|
-
{ system, webhookUrl: session.webhookUrl }
|
|
135358
|
+
{ system, webhookUrl: session.webhookUrl, searchApiKey: session.searchApiKey }
|
|
135238
135359
|
);
|
|
135239
135360
|
clearInterval(keepAliveInterval);
|
|
135240
135361
|
});
|
|
135241
135362
|
app.use(requireAuth);
|
|
135242
135363
|
app.post("/session", async (req, res) => {
|
|
135243
|
-
const { sessionId, webhookUrl, apiKey } = req.body;
|
|
135364
|
+
const { sessionId, webhookUrl, apiKey, searchApiKey } = req.body;
|
|
135244
135365
|
if (!sessionId) {
|
|
135245
135366
|
res.status(400).json({
|
|
135246
135367
|
error: "Missing required fields: sessionId, webhookUrl"
|
|
135247
135368
|
});
|
|
135248
135369
|
return;
|
|
135249
135370
|
}
|
|
135250
|
-
const { token, created } = createSession(sessionId, webhookUrl, apiKey);
|
|
135371
|
+
const { token, created } = createSession(sessionId, webhookUrl, apiKey, searchApiKey);
|
|
135251
135372
|
res.json({
|
|
135252
135373
|
sessionId,
|
|
135253
135374
|
token,
|