@threadbase-sh/streamer 1.77.3 → 1.77.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +82 -99
- package/dist/cli.cjs.map +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -150683,6 +150683,8 @@ var bufferToFormData = (arrayBuffer, contentType) => {
|
|
|
150683
150683
|
};
|
|
150684
150684
|
|
|
150685
150685
|
// node_modules/hono/dist/utils/body.js
|
|
150686
|
+
var MAX_NESTING_DEPTH = 32;
|
|
150687
|
+
var MAX_NESTED_OBJECTS = 1e4;
|
|
150686
150688
|
var isRawRequest = (request) => "headers" in request;
|
|
150687
150689
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
150688
150690
|
const { all = false, dot = false } = options;
|
|
@@ -150715,6 +150717,7 @@ async function parseFormData(request, options) {
|
|
|
150715
150717
|
}
|
|
150716
150718
|
function convertFormDataToBodyData(formData, options) {
|
|
150717
150719
|
const form = /* @__PURE__ */ Object.create(null);
|
|
150720
|
+
const nestingState = { count: 0 };
|
|
150718
150721
|
formData.forEach((value, key) => {
|
|
150719
150722
|
const shouldParseAllValues = options.all || key.endsWith("[]");
|
|
150720
150723
|
if (!shouldParseAllValues) {
|
|
@@ -150727,7 +150730,7 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
150727
150730
|
Object.entries(form).forEach(([key, value]) => {
|
|
150728
150731
|
const shouldParseDotValues = key.includes(".");
|
|
150729
150732
|
if (shouldParseDotValues) {
|
|
150730
|
-
handleParsingNestedValues(form, key, value);
|
|
150733
|
+
handleParsingNestedValues(form, key, value, nestingState);
|
|
150731
150734
|
delete form[key];
|
|
150732
150735
|
}
|
|
150733
150736
|
});
|
|
@@ -150750,23 +150753,32 @@ var handleParsingAllValues = (form, key, value) => {
|
|
|
150750
150753
|
}
|
|
150751
150754
|
}
|
|
150752
150755
|
};
|
|
150753
|
-
var handleParsingNestedValues = (form, key, value) => {
|
|
150756
|
+
var handleParsingNestedValues = (form, key, value, state) => {
|
|
150754
150757
|
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
150755
150758
|
return;
|
|
150756
150759
|
}
|
|
150757
150760
|
let nestedForm = form;
|
|
150758
|
-
const keys = key.split(".");
|
|
150761
|
+
const keys = key.split(".", MAX_NESTING_DEPTH + 2);
|
|
150762
|
+
if (keys.length > MAX_NESTING_DEPTH + 1) {
|
|
150763
|
+
throwNestingLimitExceeded();
|
|
150764
|
+
}
|
|
150759
150765
|
keys.forEach((key2, index) => {
|
|
150760
150766
|
if (index === keys.length - 1) {
|
|
150761
150767
|
nestedForm[key2] = value;
|
|
150762
150768
|
} else {
|
|
150763
150769
|
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
|
|
150770
|
+
if (state.count++ >= MAX_NESTED_OBJECTS) {
|
|
150771
|
+
throwNestingLimitExceeded();
|
|
150772
|
+
}
|
|
150764
150773
|
nestedForm[key2] = /* @__PURE__ */ Object.create(null);
|
|
150765
150774
|
}
|
|
150766
150775
|
nestedForm = nestedForm[key2];
|
|
150767
150776
|
}
|
|
150768
150777
|
});
|
|
150769
150778
|
};
|
|
150779
|
+
var throwNestingLimitExceeded = () => {
|
|
150780
|
+
throw new Error("Nesting limit exceeded");
|
|
150781
|
+
};
|
|
150770
150782
|
|
|
150771
150783
|
// node_modules/hono/dist/utils/url.js
|
|
150772
150784
|
var splitPath = (path2) => {
|
|
@@ -150898,6 +150910,10 @@ var _decodeURI = (value) => {
|
|
|
150898
150910
|
return tryDecodeURIComponent(value);
|
|
150899
150911
|
};
|
|
150900
150912
|
var _getQueryParam = (url2, key, multiple) => {
|
|
150913
|
+
const hashIndex = url2.indexOf("#", 8);
|
|
150914
|
+
if (hashIndex !== -1) {
|
|
150915
|
+
url2 = url2.slice(0, hashIndex);
|
|
150916
|
+
}
|
|
150901
150917
|
let encoded;
|
|
150902
150918
|
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
|
|
150903
150919
|
let keyIndex2 = url2.indexOf("?", 8);
|
|
@@ -151014,13 +151030,13 @@ var HonoRequest = class {
|
|
|
151014
151030
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
151015
151031
|
}
|
|
151016
151032
|
#getDecodedParam(key) {
|
|
151017
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
151033
|
+
const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key];
|
|
151018
151034
|
const param = this.#getParamValue(paramKey);
|
|
151019
151035
|
return param && tryDecodeURIComponent(param);
|
|
151020
151036
|
}
|
|
151021
151037
|
#getAllDecodedParams() {
|
|
151022
151038
|
const decoded = {};
|
|
151023
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
151039
|
+
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
151024
151040
|
for (const key of keys) {
|
|
151025
151041
|
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
151026
151042
|
if (value !== void 0) {
|
|
@@ -151767,13 +151783,14 @@ var Hono = class _Hono {
|
|
|
151767
151783
|
const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
|
|
151768
151784
|
allMethods.forEach((method) => {
|
|
151769
151785
|
this[method] = (args1, ...args) => {
|
|
151786
|
+
const methodName = method.toUpperCase();
|
|
151770
151787
|
if (typeof args1 === "string") {
|
|
151771
151788
|
this.#path = args1;
|
|
151772
151789
|
} else {
|
|
151773
|
-
this.#addRoute(
|
|
151790
|
+
this.#addRoute(methodName, this.#path, args1);
|
|
151774
151791
|
}
|
|
151775
151792
|
args.forEach((handler) => {
|
|
151776
|
-
this.#addRoute(
|
|
151793
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
151777
151794
|
});
|
|
151778
151795
|
return this;
|
|
151779
151796
|
};
|
|
@@ -151782,9 +151799,10 @@ var Hono = class _Hono {
|
|
|
151782
151799
|
for (const p2 of [path2].flat()) {
|
|
151783
151800
|
this.#path = p2;
|
|
151784
151801
|
for (const m2 of [method].flat()) {
|
|
151785
|
-
|
|
151786
|
-
|
|
151787
|
-
|
|
151802
|
+
const methodName = m2.toUpperCase();
|
|
151803
|
+
for (const handler of handlers) {
|
|
151804
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
151805
|
+
}
|
|
151788
151806
|
}
|
|
151789
151807
|
}
|
|
151790
151808
|
return this;
|
|
@@ -151985,7 +152003,6 @@ var Hono = class _Hono {
|
|
|
151985
152003
|
return this;
|
|
151986
152004
|
}
|
|
151987
152005
|
#addRoute(method, path2, handler, baseRoutePath) {
|
|
151988
|
-
method = method.toUpperCase();
|
|
151989
152006
|
path2 = mergePath(this._basePath, path2);
|
|
151990
152007
|
const r = {
|
|
151991
152008
|
basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,
|
|
@@ -152107,6 +152124,9 @@ var Hono = class _Hono {
|
|
|
152107
152124
|
};
|
|
152108
152125
|
};
|
|
152109
152126
|
|
|
152127
|
+
// node_modules/hono/dist/router/utils.js
|
|
152128
|
+
var createNullObject = () => /* @__PURE__ */ Object.create(null);
|
|
152129
|
+
|
|
152110
152130
|
// node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
152111
152131
|
var emptyParam = [];
|
|
152112
152132
|
function match(method, path2) {
|
|
@@ -152157,7 +152177,7 @@ var Node = class _Node {
|
|
|
152157
152177
|
// handler index of a dynamic path, or -1 for a static path terminal
|
|
152158
152178
|
#index;
|
|
152159
152179
|
#varIndex;
|
|
152160
|
-
#children =
|
|
152180
|
+
#children = createNullObject();
|
|
152161
152181
|
insert(tokens, index, paramMap, context, isStatic) {
|
|
152162
152182
|
let node = this;
|
|
152163
152183
|
for (let i = 0, len = tokens.length; i < len; i++) {
|
|
@@ -152241,7 +152261,7 @@ var Trie = class {
|
|
|
152241
152261
|
#root = new Node();
|
|
152242
152262
|
#index = 0;
|
|
152243
152263
|
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
152244
|
-
paths =
|
|
152264
|
+
paths = createNullObject();
|
|
152245
152265
|
insert(path2, isStatic) {
|
|
152246
152266
|
if (isStatic) {
|
|
152247
152267
|
this.#root.insert(path2.split(""), 0, [], this.#context, true);
|
|
@@ -152300,22 +152320,16 @@ var Trie = class {
|
|
|
152300
152320
|
};
|
|
152301
152321
|
|
|
152302
152322
|
// node_modules/hono/dist/router/reg-exp-router/router.js
|
|
152303
|
-
var wildcardRegExpCache =
|
|
152323
|
+
var wildcardRegExpCache = createNullObject();
|
|
152304
152324
|
function buildWildcardRegExp(path2) {
|
|
152305
152325
|
return wildcardRegExpCache[path2] ??= new RegExp(
|
|
152306
|
-
|
|
152307
|
-
|
|
152308
|
-
(
|
|
152326
|
+
`^${path2.replace(
|
|
152327
|
+
/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
|
|
152328
|
+
(match2, metaChar) => metaChar ? `\\${metaChar}` : match2 === "/*" ? TAIL_WILDCARD_REG_EXP_STR : match2 === "*" ? ONLY_WILDCARD_REG_EXP_STR : `/:${LABEL_REG_EXP_STR}`
|
|
152309
152329
|
)}$`
|
|
152310
152330
|
);
|
|
152311
152331
|
}
|
|
152312
|
-
function clearWildcardRegExpCache() {
|
|
152313
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
152314
|
-
}
|
|
152315
152332
|
function findMiddleware(middleware, path2) {
|
|
152316
|
-
if (!middleware) {
|
|
152317
|
-
return void 0;
|
|
152318
|
-
}
|
|
152319
152333
|
for (const k2 of Object.keys(middleware).sort((a, b2) => b2.length - a.length)) {
|
|
152320
152334
|
if (buildWildcardRegExp(k2).test(path2)) {
|
|
152321
152335
|
return [...middleware[k2]];
|
|
@@ -152329,8 +152343,8 @@ var RegExpRouter = class {
|
|
|
152329
152343
|
#routes;
|
|
152330
152344
|
#tries;
|
|
152331
152345
|
constructor() {
|
|
152332
|
-
this.#middleware = { [METHOD_NAME_ALL]:
|
|
152333
|
-
this.#routes = { [METHOD_NAME_ALL]:
|
|
152346
|
+
this.#middleware = { [METHOD_NAME_ALL]: createNullObject() };
|
|
152347
|
+
this.#routes = { [METHOD_NAME_ALL]: createNullObject() };
|
|
152334
152348
|
this.#tries = { [METHOD_NAME_ALL]: new Trie() };
|
|
152335
152349
|
}
|
|
152336
152350
|
#insertPath(method, path2) {
|
|
@@ -152343,117 +152357,86 @@ var RegExpRouter = class {
|
|
|
152343
152357
|
add(method, path2, handler) {
|
|
152344
152358
|
const middleware = this.#middleware;
|
|
152345
152359
|
const routes = this.#routes;
|
|
152346
|
-
if (!middleware
|
|
152360
|
+
if (!middleware) {
|
|
152347
152361
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
152348
152362
|
}
|
|
152349
152363
|
if (!middleware[method]) {
|
|
152350
152364
|
this.#tries[method] = new Trie();
|
|
152351
|
-
[middleware, routes]
|
|
152352
|
-
handlerMap[method] =
|
|
152353
|
-
|
|
152365
|
+
for (const handlerMap of [middleware, routes]) {
|
|
152366
|
+
handlerMap[method] = createNullObject();
|
|
152367
|
+
for (const p2 in handlerMap[METHOD_NAME_ALL]) {
|
|
152354
152368
|
handlerMap[method][p2] = [...handlerMap[METHOD_NAME_ALL][p2]];
|
|
152355
152369
|
this.#insertPath(method, p2);
|
|
152356
|
-
}
|
|
152357
|
-
}
|
|
152370
|
+
}
|
|
152371
|
+
}
|
|
152358
152372
|
}
|
|
152359
152373
|
if (path2 === "/*") {
|
|
152360
152374
|
path2 = "*";
|
|
152361
152375
|
}
|
|
152362
|
-
const
|
|
152376
|
+
const methods = method === METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
152363
152377
|
if (/\*$/.test(path2)) {
|
|
152364
152378
|
const re2 = buildWildcardRegExp(path2);
|
|
152365
|
-
|
|
152366
|
-
if (
|
|
152379
|
+
for (const m2 of methods) {
|
|
152380
|
+
if (!middleware[m2][path2]) {
|
|
152367
152381
|
this.#insertPath(m2, path2);
|
|
152368
152382
|
middleware[m2][path2] = findMiddleware(middleware[m2], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || [];
|
|
152369
152383
|
}
|
|
152370
|
-
}
|
|
152371
|
-
|
|
152372
|
-
|
|
152373
|
-
|
|
152374
|
-
re2.test(p2) &&
|
|
152375
|
-
}
|
|
152376
|
-
}
|
|
152377
|
-
});
|
|
152378
|
-
Object.keys(routes).forEach((m2) => {
|
|
152379
|
-
if (method === METHOD_NAME_ALL || method === m2) {
|
|
152380
|
-
Object.keys(routes[m2]).forEach(
|
|
152381
|
-
(p2) => re2.test(p2) && routes[m2][p2].push([handler, paramCount])
|
|
152382
|
-
);
|
|
152384
|
+
}
|
|
152385
|
+
for (const handlerMap of [middleware, routes]) {
|
|
152386
|
+
for (const m2 of methods) {
|
|
152387
|
+
for (const p2 in handlerMap[m2]) {
|
|
152388
|
+
re2.test(p2) && handlerMap[m2][p2].push([handler, path2]);
|
|
152389
|
+
}
|
|
152383
152390
|
}
|
|
152384
|
-
}
|
|
152391
|
+
}
|
|
152385
152392
|
return;
|
|
152386
152393
|
}
|
|
152387
152394
|
const paths = checkOptionalParameter(path2) || [path2];
|
|
152388
|
-
for (
|
|
152389
|
-
const
|
|
152390
|
-
|
|
152391
|
-
|
|
152392
|
-
|
|
152393
|
-
this.#insertPath(m2, path22);
|
|
152394
|
-
routes[m2][path22] = [
|
|
152395
|
-
...findMiddleware(middleware[m2], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
|
|
152396
|
-
];
|
|
152397
|
-
}
|
|
152398
|
-
routes[m2][path22].push([handler, paramCount - len + i + 1]);
|
|
152395
|
+
for (const path22 of paths) {
|
|
152396
|
+
for (const m2 of methods) {
|
|
152397
|
+
if (!routes[m2][path22]) {
|
|
152398
|
+
this.#insertPath(m2, path22);
|
|
152399
|
+
routes[m2][path22] = findMiddleware(middleware[m2], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
|
|
152399
152400
|
}
|
|
152400
|
-
|
|
152401
|
+
routes[m2][path22].push([handler, path22]);
|
|
152402
|
+
}
|
|
152401
152403
|
}
|
|
152402
152404
|
}
|
|
152403
152405
|
match = match;
|
|
152404
152406
|
buildAllMatchers() {
|
|
152405
|
-
const matchers =
|
|
152406
|
-
Object.keys(this.#routes)
|
|
152407
|
-
matchers[method]
|
|
152408
|
-
}
|
|
152407
|
+
const matchers = createNullObject();
|
|
152408
|
+
for (const method of Object.keys(this.#routes)) {
|
|
152409
|
+
matchers[method] = this.#buildMatcher(method);
|
|
152410
|
+
}
|
|
152409
152411
|
this.#middleware = this.#routes = this.#tries = void 0;
|
|
152410
|
-
|
|
152412
|
+
wildcardRegExpCache = createNullObject();
|
|
152411
152413
|
return matchers;
|
|
152412
152414
|
}
|
|
152413
152415
|
#buildMatcher(method) {
|
|
152414
152416
|
const middleware = this.#middleware[method];
|
|
152415
152417
|
const routes = this.#routes[method];
|
|
152416
152418
|
const trie = this.#tries[method];
|
|
152417
|
-
const staticMap =
|
|
152419
|
+
const staticMap = createNullObject();
|
|
152418
152420
|
const handlerData = [];
|
|
152419
|
-
[
|
|
152421
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
152422
|
+
for (const r of [middleware, routes]) {
|
|
152420
152423
|
for (const path2 in r) {
|
|
152421
152424
|
const handlers = r[path2];
|
|
152422
152425
|
const pathData = trie.paths[path2];
|
|
152423
152426
|
if (!pathData) {
|
|
152424
|
-
staticMap[path2] = [handlers.map(([h]) => [h,
|
|
152427
|
+
staticMap[path2] = [handlers.map(([h]) => [h, createNullObject()]), emptyParam];
|
|
152425
152428
|
continue;
|
|
152426
152429
|
}
|
|
152427
|
-
|
|
152428
|
-
|
|
152429
|
-
|
|
152430
|
-
|
|
152431
|
-
|
|
152432
|
-
|
|
152433
|
-
|
|
152434
|
-
}
|
|
152435
|
-
return [h, paramIndexMap];
|
|
152436
|
-
});
|
|
152437
|
-
}
|
|
152438
|
-
});
|
|
152439
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
152440
|
-
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
152441
|
-
for (let j2 = 0, len2 = handlerData[i].length; j2 < len2; j2++) {
|
|
152442
|
-
const map2 = handlerData[i][j2]?.[1];
|
|
152443
|
-
if (!map2) {
|
|
152444
|
-
continue;
|
|
152445
|
-
}
|
|
152446
|
-
const keys = Object.keys(map2);
|
|
152447
|
-
for (let k2 = 0, len3 = keys.length; k2 < len3; k2++) {
|
|
152448
|
-
map2[keys[k2]] = paramReplacementMap[map2[keys[k2]]];
|
|
152449
|
-
}
|
|
152430
|
+
handlerData[pathData[0]] = handlers.map(([h, handlerPath]) => [
|
|
152431
|
+
h,
|
|
152432
|
+
trie.paths[handlerPath][1].reduceRight((map2, [key], i) => {
|
|
152433
|
+
map2[key] = paramReplacementMap[pathData[1][i][1]];
|
|
152434
|
+
return map2;
|
|
152435
|
+
}, createNullObject())
|
|
152436
|
+
]);
|
|
152450
152437
|
}
|
|
152451
152438
|
}
|
|
152452
|
-
|
|
152453
|
-
for (const i in indexReplacementMap) {
|
|
152454
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
152455
|
-
}
|
|
152456
|
-
return [regexp, handlerMap, staticMap];
|
|
152439
|
+
return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
|
|
152457
152440
|
}
|
|
152458
152441
|
};
|
|
152459
152442
|
|
|
@@ -152513,11 +152496,11 @@ var SmartRouter = class {
|
|
|
152513
152496
|
};
|
|
152514
152497
|
|
|
152515
152498
|
// node_modules/hono/dist/router/trie-router/node.js
|
|
152516
|
-
var emptyParams =
|
|
152499
|
+
var emptyParams = createNullObject();
|
|
152517
152500
|
var order = 0;
|
|
152518
152501
|
var Node2 = class _Node2 {
|
|
152519
152502
|
#methods = [];
|
|
152520
|
-
#children =
|
|
152503
|
+
#children = createNullObject();
|
|
152521
152504
|
#patterns = [];
|
|
152522
152505
|
#pattern;
|
|
152523
152506
|
#params = emptyParams;
|
|
@@ -152554,7 +152537,7 @@ var Node2 = class _Node2 {
|
|
|
152554
152537
|
const m2 = node.#methods[i];
|
|
152555
152538
|
const handlerSet = m2[method] || m2[METHOD_NAME_ALL];
|
|
152556
152539
|
if (handlerSet) {
|
|
152557
|
-
handlerSet.params =
|
|
152540
|
+
handlerSet.params = createNullObject();
|
|
152558
152541
|
handlerSets.push(handlerSet);
|
|
152559
152542
|
for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
|
|
152560
152543
|
const key = handlerSet.possibleKeys[i2];
|