@cerefox/memory 1.14.2 → 1.14.3
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/AGENT_GUIDE.md +1 -1
- package/dist/bin/cerefox.js +609 -415
- package/dist/server-assets/_shared/ef-meta/index.ts +3 -3
- package/dist/server-assets/_shared/mcp-tools/metadata-search.ts +69 -20
- package/dist/server-assets/_shared/mcp-tools/search.ts +259 -65
- package/dist/server-assets/supabase/functions/cerefox-search/index.ts +53 -15
- package/docs/guides/connect-agents.md +11 -6
- package/docs/guides/response-limits.md +25 -3
- package/package.json +3 -3
package/dist/bin/cerefox.js
CHANGED
|
@@ -7400,7 +7400,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
7400
7400
|
});
|
|
7401
7401
|
|
|
7402
7402
|
// src/meta.ts
|
|
7403
|
-
var PKG_VERSION = "1.14.
|
|
7403
|
+
var PKG_VERSION = "1.14.3";
|
|
7404
7404
|
var init_meta = () => {};
|
|
7405
7405
|
|
|
7406
7406
|
// ../../_shared/config/paths.ts
|
|
@@ -23278,23 +23278,6 @@ function getConfiguredSearchAlpha() {
|
|
|
23278
23278
|
function getMinTermCoverage() {
|
|
23279
23279
|
return;
|
|
23280
23280
|
}
|
|
23281
|
-
function applyByteBudget(rows, maxBytes) {
|
|
23282
|
-
const accepted = [];
|
|
23283
|
-
let usedBytes = 0;
|
|
23284
|
-
let truncated = false;
|
|
23285
|
-
let cut = rows.length;
|
|
23286
|
-
for (const [i, row] of rows.entries()) {
|
|
23287
|
-
const rowBytes = new TextEncoder().encode(JSON.stringify(row)).length;
|
|
23288
|
-
if (usedBytes + rowBytes > maxBytes) {
|
|
23289
|
-
truncated = true;
|
|
23290
|
-
cut = i;
|
|
23291
|
-
break;
|
|
23292
|
-
}
|
|
23293
|
-
accepted.push(row);
|
|
23294
|
-
usedBytes += rowBytes;
|
|
23295
|
-
}
|
|
23296
|
-
return { accepted, dropped: rows.slice(cut), truncated, usedBytes };
|
|
23297
|
-
}
|
|
23298
23281
|
function extractConflictHashes(message) {
|
|
23299
23282
|
return {
|
|
23300
23283
|
expected: message.match(/expected hash ([0-9a-f]{64})/)?.[1] ?? "unknown",
|
|
@@ -25776,7 +25759,7 @@ var init_bundled_docs = __esm(() => {
|
|
|
25776
25759
|
});
|
|
25777
25760
|
|
|
25778
25761
|
// ../../_shared/ef-meta/index.ts
|
|
25779
|
-
var EF_VERSION = "1.14.
|
|
25762
|
+
var EF_VERSION = "1.14.3", CEREFOX_VERSION = "1.14.3", EF_LAST_CHANGED = "1.14.3";
|
|
25780
25763
|
var init_ef_meta = () => {};
|
|
25781
25764
|
|
|
25782
25765
|
// ../../_shared/compatibility/index.ts
|
|
@@ -56411,7 +56394,7 @@ async function handler10(supabase, args, ctx) {
|
|
|
56411
56394
|
const project_name = args.project_name;
|
|
56412
56395
|
const updated_since = args.updated_since;
|
|
56413
56396
|
const created_since = args.created_since;
|
|
56414
|
-
const limit = args.limit
|
|
56397
|
+
const limit = Math.min(Math.max(1, Math.floor(Number(args.limit)) || 10), 500);
|
|
56415
56398
|
const include_content = args.include_content ?? false;
|
|
56416
56399
|
const requested_max_bytes = args.max_bytes;
|
|
56417
56400
|
if (metadata_filter !== undefined && (typeof metadata_filter !== "object" || Array.isArray(metadata_filter))) {
|
|
@@ -56428,7 +56411,8 @@ async function handler10(supabase, args, ctx) {
|
|
|
56428
56411
|
throw new Error(`Project not found: ${project_name}`);
|
|
56429
56412
|
}
|
|
56430
56413
|
const ceiling = getMaxResponseBytes();
|
|
56431
|
-
const
|
|
56414
|
+
const requestedBytes = Math.floor(Number(requested_max_bytes));
|
|
56415
|
+
const max_bytes = include_content ? Math.min(Number.isFinite(requestedBytes) ? Math.max(requestedBytes, 1) : ceiling, ceiling) : null;
|
|
56432
56416
|
const params = {
|
|
56433
56417
|
p_metadata_filter: metadata_filter ?? {},
|
|
56434
56418
|
p_project_id: projectId,
|
|
@@ -56443,31 +56427,45 @@ async function handler10(supabase, args, ctx) {
|
|
|
56443
56427
|
if (error)
|
|
56444
56428
|
throw new Error(`RPC error: ${error.message}`);
|
|
56445
56429
|
const rows = data ?? [];
|
|
56446
|
-
logUsage(supabase, {
|
|
56430
|
+
const log = (result_count, extra) => logUsage(supabase, {
|
|
56447
56431
|
operation: "metadata_search",
|
|
56448
56432
|
accessPath: ctx.accessPath,
|
|
56449
56433
|
requestor: callerIdentity(args),
|
|
56450
56434
|
query_text: JSON.stringify(metadata_filter ?? {}),
|
|
56451
56435
|
project_id: projectId,
|
|
56452
|
-
result_count
|
|
56436
|
+
result_count,
|
|
56437
|
+
...extra ? { extra } : {}
|
|
56453
56438
|
});
|
|
56454
56439
|
if (rows.length === 0) {
|
|
56455
56440
|
if (include_content && max_bytes !== null) {
|
|
56456
|
-
const { data: headers } = await supabase.rpc("cerefox_metadata_search", {
|
|
56457
|
-
|
|
56458
|
-
|
|
56459
|
-
|
|
56460
|
-
}
|
|
56441
|
+
const { data: headers, error: probeError } = await supabase.rpc("cerefox_metadata_search", { ...params, p_include_content: false, p_max_bytes: null });
|
|
56442
|
+
if (probeError) {
|
|
56443
|
+
log(0, { degraded_probe_failed: true });
|
|
56444
|
+
return `⚠ Nothing fit max_bytes=${max_bytes} with include_content, and the ` + `follow-up query that lists what matched failed: ${probeError.message}. ` + `This is NOT a confirmed empty result — retry with a larger max_bytes, ` + `or with include_content: false.`;
|
|
56445
|
+
}
|
|
56461
56446
|
const headerRows = headers ?? [];
|
|
56462
56447
|
if (headerRows.length > 0) {
|
|
56463
|
-
|
|
56464
|
-
|
|
56465
|
-
|
|
56466
|
-
|
|
56448
|
+
const lead = `⚠ ${headerRows.length} document(s) match, but none fit max_bytes=${max_bytes} ` + `with include_content. This is NOT an empty result. Listing them without ` + `content — raise max_bytes, or read one with cerefox_get_document ` + `(outline: true for structure).`;
|
|
56449
|
+
const lines = [];
|
|
56450
|
+
let used = new TextEncoder().encode(lead).length;
|
|
56451
|
+
for (const r of headerRows) {
|
|
56452
|
+
const line = `## ${r.title} [id: ${r.document_id}]`;
|
|
56453
|
+
const size = new TextEncoder().encode(line).length + 1;
|
|
56454
|
+
if (used + size > max_bytes)
|
|
56455
|
+
break;
|
|
56456
|
+
lines.push(line);
|
|
56457
|
+
used += size;
|
|
56458
|
+
}
|
|
56459
|
+
log(headerRows.length, { returned: lines.length, degraded: true });
|
|
56460
|
+
return lines.length > 0 ? `${lead}
|
|
56461
|
+
${lines.join(`
|
|
56462
|
+
`)}` : lead;
|
|
56467
56463
|
}
|
|
56468
56464
|
}
|
|
56465
|
+
log(0);
|
|
56469
56466
|
return "No documents match the given criteria.";
|
|
56470
56467
|
}
|
|
56468
|
+
log(rows.length);
|
|
56471
56469
|
const showReview = await reviewWorkflowEnabled(supabase);
|
|
56472
56470
|
const parts = rows.map((row) => {
|
|
56473
56471
|
const projects = row.project_names?.length ? ` | projects: ${row.project_names.join(", ")}` : "";
|
|
@@ -56539,19 +56537,51 @@ var init_metadata_search = __esm(() => {
|
|
|
56539
56537
|
});
|
|
56540
56538
|
|
|
56541
56539
|
// ../../_shared/mcp-tools/search.ts
|
|
56542
|
-
function
|
|
56543
|
-
|
|
56540
|
+
function rowContent(row) {
|
|
56541
|
+
return row.full_content ?? row.content ?? "";
|
|
56542
|
+
}
|
|
56543
|
+
function rowHeading(row) {
|
|
56544
|
+
const doc = row.doc_title ?? "Untitled";
|
|
56545
|
+
const path = [...row.heading_path ?? []];
|
|
56546
|
+
if (path.length > 0 && path[0] === doc)
|
|
56547
|
+
path.shift();
|
|
56548
|
+
const section = path.length ? path.filter(Boolean).join(" › ") : row.title && row.title !== doc ? row.title : "";
|
|
56544
56549
|
const docId = row.document_id ? ` [id: ${row.document_id}]` : "";
|
|
56550
|
+
const chunk = row.chunk_index != null ? ` (chunk ${row.chunk_index})` : "";
|
|
56551
|
+
return `${doc}${section ? ` › ${section}` : ""}${docId}${chunk}`;
|
|
56552
|
+
}
|
|
56553
|
+
function shortLabel(row) {
|
|
56554
|
+
const doc = row.doc_title ?? "Untitled";
|
|
56555
|
+
const path = [...row.heading_path ?? []];
|
|
56556
|
+
if (path.length > 0 && path[0] === doc)
|
|
56557
|
+
path.shift();
|
|
56558
|
+
const leaf = path.filter(Boolean).at(-1) ?? (row.title && row.title !== doc ? row.title : "");
|
|
56559
|
+
const chunk = row.chunk_index != null ? ` (chunk ${row.chunk_index})` : "";
|
|
56560
|
+
const id = row.document_id ? ` [id: ${row.document_id}]` : "";
|
|
56561
|
+
return `${leaf ? `${doc} › ${leaf}` : doc}${chunk}${id}`;
|
|
56562
|
+
}
|
|
56563
|
+
function renderRow(row) {
|
|
56564
|
+
const raw = row.best_score ?? row.score;
|
|
56565
|
+
const score = raw != null ? ` (score: ${raw.toFixed(3)})` : "";
|
|
56566
|
+
const partial = row.is_partial ? ` -- partial (${row.chunk_count} of ${(row.total_chars ?? 0).toLocaleString()} chars)` : "";
|
|
56567
|
+
const hash = row.content_hash ? `
|
|
56568
|
+
hash: ${row.content_hash}` : "";
|
|
56569
|
+
return `## ${rowHeading(row)}${score}${partial}${hash}
|
|
56570
|
+
|
|
56571
|
+
${rowContent(row)}`;
|
|
56572
|
+
}
|
|
56573
|
+
function headerLine(row) {
|
|
56545
56574
|
const raw = row.best_score ?? row.score;
|
|
56546
56575
|
const score = raw != null ? ` (score: ${raw.toFixed(3)})` : "";
|
|
56547
56576
|
const size = row.total_chars != null ? ` -- ${row.total_chars.toLocaleString()} chars` : "";
|
|
56548
56577
|
const hash = row.content_hash ? `
|
|
56549
56578
|
hash: ${row.content_hash}` : "";
|
|
56550
|
-
return `## ${
|
|
56579
|
+
return `## ${rowHeading(row)}${score}${size}${hash}`;
|
|
56551
56580
|
}
|
|
56552
|
-
function degradedToHeaders(matched, maxBytes) {
|
|
56553
|
-
const biggest = Math.max(...
|
|
56554
|
-
const
|
|
56581
|
+
function degradedToHeaders(matched, rendered, maxBytes, belowConfidence) {
|
|
56582
|
+
const biggest = Math.max(...rendered.map((t) => new TextEncoder().encode(t).length));
|
|
56583
|
+
const confidence = belowConfidence ? "None of these cleared the confidence threshold — they are the closest " + "candidates, so judge relevance from the scores. " : "";
|
|
56584
|
+
const lead = `⚠ ${matched.length} result(s) matched, but none fit max_bytes=${maxBytes} ` + `(the largest is ${biggest.toLocaleString()} bytes). ${confidence}This is NOT an ` + `empty knowledge base. Listing what matched, without content — raise max_bytes ` + `to read it, or read one document with cerefox_get_document (outline: true for ` + `structure, or section: "## Heading" for one part).`;
|
|
56555
56585
|
const lines = [];
|
|
56556
56586
|
let used = new TextEncoder().encode(lead).length;
|
|
56557
56587
|
for (const row of matched) {
|
|
@@ -56571,7 +56601,7 @@ ${lines.join(`
|
|
|
56571
56601
|
async function handler11(supabase, args, ctx) {
|
|
56572
56602
|
const query = args.query;
|
|
56573
56603
|
const project_name = args.project_name;
|
|
56574
|
-
const match_count = args.match_count
|
|
56604
|
+
const match_count = Math.min(Math.max(1, Math.floor(Number(args.match_count)) || 5), 200);
|
|
56575
56605
|
const mode = args.mode ?? "docs";
|
|
56576
56606
|
const alpha = args.alpha ?? getConfiguredSearchAlpha();
|
|
56577
56607
|
const min_score = args.min_score ?? getConfiguredMinSearchScore();
|
|
@@ -56582,7 +56612,8 @@ async function handler11(supabase, args, ctx) {
|
|
|
56582
56612
|
const metadata_filter = args.metadata_filter ?? null;
|
|
56583
56613
|
const requested_max_bytes = args.max_bytes;
|
|
56584
56614
|
const ceiling = getMaxResponseBytes();
|
|
56585
|
-
const
|
|
56615
|
+
const requestedBytes = Math.floor(Number(requested_max_bytes));
|
|
56616
|
+
const max_bytes = Math.min(Number.isFinite(requestedBytes) ? Math.max(requestedBytes, 1) : ceiling, ceiling);
|
|
56586
56617
|
if (metadata_filter !== null && metadata_filter !== undefined && (typeof metadata_filter !== "object" || Array.isArray(metadata_filter))) {
|
|
56587
56618
|
throw new McpInvalidParams("metadata_filter must be a JSON object or null");
|
|
56588
56619
|
}
|
|
@@ -56643,50 +56674,102 @@ async function handler11(supabase, args, ctx) {
|
|
|
56643
56674
|
if (error)
|
|
56644
56675
|
throw new Error(`RPC error: ${error.message}`);
|
|
56645
56676
|
const matched = data ?? [];
|
|
56646
|
-
const
|
|
56647
|
-
|
|
56648
|
-
|
|
56649
|
-
|
|
56650
|
-
|
|
56651
|
-
|
|
56652
|
-
|
|
56653
|
-
|
|
56654
|
-
|
|
56655
|
-
|
|
56656
|
-
if (matched.length === 0)
|
|
56677
|
+
const belowConfidence = matched.length > 0 && matched.every((r) => r.below_confidence === true);
|
|
56678
|
+
if (matched.length === 0) {
|
|
56679
|
+
logUsage(supabase, {
|
|
56680
|
+
operation: "search",
|
|
56681
|
+
accessPath: ctx.accessPath,
|
|
56682
|
+
requestor: callerIdentity(args),
|
|
56683
|
+
query_text: query,
|
|
56684
|
+
project_id: projectId,
|
|
56685
|
+
result_count: 0
|
|
56686
|
+
});
|
|
56657
56687
|
return "No results found.";
|
|
56658
|
-
if (accepted.length === 0) {
|
|
56659
|
-
return degradedToHeaders(matched, max_bytes);
|
|
56660
56688
|
}
|
|
56661
|
-
const
|
|
56662
|
-
const
|
|
56663
|
-
const
|
|
56664
|
-
const title = row.doc_title ?? "Untitled";
|
|
56665
|
-
const docId = row.document_id ? ` [id: ${row.document_id}]` : "";
|
|
56666
|
-
const rawScore = row.best_score ?? row.score;
|
|
56667
|
-
const score = rawScore != null ? ` (score: ${rawScore.toFixed(3)})` : "";
|
|
56668
|
-
const partial = row.is_partial ? ` -- partial (${row.chunk_count} of ${(row.total_chars ?? 0).toLocaleString()} chars)` : "";
|
|
56669
|
-
const hash = row.content_hash ? `
|
|
56670
|
-
hash: ${row.content_hash}` : "";
|
|
56671
|
-
return `## ${title}${docId}${score}${partial}${hash}
|
|
56672
|
-
|
|
56673
|
-
${row.full_content ?? ""}`;
|
|
56674
|
-
});
|
|
56675
|
-
let output = parts.join(`
|
|
56689
|
+
const rendered = matched.map(renderRow);
|
|
56690
|
+
const size = (t) => new TextEncoder().encode(t).length;
|
|
56691
|
+
const SEP = `
|
|
56676
56692
|
|
|
56677
56693
|
---
|
|
56678
56694
|
|
|
56679
|
-
|
|
56680
|
-
|
|
56681
|
-
output = `⚠ No results cleared the confidence threshold. Showing the closest ${rows.length} ` + `candidate(s) with scores — judge relevance yourself; a low score means weak signal, ` + `not necessarily absent knowledge.
|
|
56695
|
+
`;
|
|
56696
|
+
const banner = (take, short) => !belowConfidence ? "" : short ? `⚠ Below the confidence threshold — judge relevance from the scores.
|
|
56682
56697
|
|
|
56683
|
-
` +
|
|
56684
|
-
|
|
56685
|
-
|
|
56686
|
-
|
|
56698
|
+
` : `⚠ No results cleared the confidence threshold. Showing the closest ${take} ` + `candidate(s) with scores — judge relevance yourself; a low score means weak ` + `signal, not necessarily absent knowledge.
|
|
56699
|
+
|
|
56700
|
+
`;
|
|
56701
|
+
const assemble = (keptCount, short) => {
|
|
56702
|
+
const kept = keptIdx.slice(0, keptCount);
|
|
56703
|
+
const body = banner(keptCount, short) + kept.map((i) => rendered[i]).join(SEP);
|
|
56704
|
+
if (kept.length === matched.length)
|
|
56705
|
+
return body;
|
|
56706
|
+
const droppedRows = matched.filter((_, i) => !kept.includes(i));
|
|
56707
|
+
const room = max_bytes - size(body);
|
|
56708
|
+
const footer = (named) => {
|
|
56709
|
+
const labels = droppedRows.slice(0, named).map(shortLabel);
|
|
56710
|
+
const rest = droppedRows.length - labels.length;
|
|
56711
|
+
const naming = labels.length ? `: ${labels.join(", ")}${rest > 0 ? ` and ${rest} more` : ""}` : "";
|
|
56712
|
+
return `
|
|
56713
|
+
|
|
56714
|
+
[${kept.length} of ${matched.length} result(s) shown; ${droppedRows.length} did ` + `not fit max_bytes=${max_bytes}${naming}. Raise max_bytes, narrow the query, or ` + `lower match_count.]`;
|
|
56715
|
+
};
|
|
56716
|
+
for (let named = Math.min(5, droppedRows.length);named >= 1; named--) {
|
|
56717
|
+
const candidate = footer(named);
|
|
56718
|
+
if (size(candidate) <= room)
|
|
56719
|
+
return body + candidate;
|
|
56720
|
+
}
|
|
56721
|
+
const bare = footer(0);
|
|
56722
|
+
if (size(bare) <= room)
|
|
56723
|
+
return body + bare;
|
|
56724
|
+
return body + `
|
|
56687
56725
|
|
|
56688
|
-
[${
|
|
56726
|
+
[${kept.length} of ${matched.length} shown; raise max_bytes]`;
|
|
56727
|
+
};
|
|
56728
|
+
const sepBytes = size(SEP);
|
|
56729
|
+
const keptIdx = [];
|
|
56730
|
+
let acc = 0;
|
|
56731
|
+
for (let i = 0;i < rendered.length; i++) {
|
|
56732
|
+
const add = size(rendered[i]) + (keptIdx.length > 0 ? sepBytes : 0);
|
|
56733
|
+
if (acc + add > max_bytes)
|
|
56734
|
+
continue;
|
|
56735
|
+
acc += add;
|
|
56736
|
+
keptIdx.push(i);
|
|
56689
56737
|
}
|
|
56738
|
+
if (keptIdx.length === 0) {
|
|
56739
|
+
logUsage(supabase, {
|
|
56740
|
+
operation: "search",
|
|
56741
|
+
accessPath: ctx.accessPath,
|
|
56742
|
+
requestor: callerIdentity(args),
|
|
56743
|
+
query_text: query,
|
|
56744
|
+
project_id: projectId,
|
|
56745
|
+
result_count: matched.length,
|
|
56746
|
+
extra: { returned: 0, truncated: true, degraded: true }
|
|
56747
|
+
});
|
|
56748
|
+
return degradedToHeaders(matched, rendered, max_bytes, belowConfidence);
|
|
56749
|
+
}
|
|
56750
|
+
let keptCount = keptIdx.length;
|
|
56751
|
+
let short = false;
|
|
56752
|
+
let output = assemble(keptCount, short);
|
|
56753
|
+
while (size(output) > max_bytes) {
|
|
56754
|
+
if (belowConfidence && !short)
|
|
56755
|
+
short = true;
|
|
56756
|
+
else if (keptCount > 1) {
|
|
56757
|
+
keptCount -= 1;
|
|
56758
|
+
short = belowConfidence;
|
|
56759
|
+
} else
|
|
56760
|
+
break;
|
|
56761
|
+
output = assemble(keptCount, short);
|
|
56762
|
+
}
|
|
56763
|
+
const take = keptCount;
|
|
56764
|
+
logUsage(supabase, {
|
|
56765
|
+
operation: "search",
|
|
56766
|
+
accessPath: ctx.accessPath,
|
|
56767
|
+
requestor: callerIdentity(args),
|
|
56768
|
+
query_text: query,
|
|
56769
|
+
project_id: projectId,
|
|
56770
|
+
result_count: matched.length,
|
|
56771
|
+
...take < matched.length ? { extra: { returned: take, truncated: true } } : {}
|
|
56772
|
+
});
|
|
56690
56773
|
return output;
|
|
56691
56774
|
}
|
|
56692
56775
|
var searchTool;
|
|
@@ -56711,7 +56794,7 @@ var init_search = __esm(() => {
|
|
|
56711
56794
|
query: { type: "string", description: "Natural-language search query" },
|
|
56712
56795
|
match_count: {
|
|
56713
56796
|
type: "integer",
|
|
56714
|
-
description: "Maximum number of documents to return (default: 5)"
|
|
56797
|
+
description: "Maximum number of documents to return (default: 5, maximum: 200)"
|
|
56715
56798
|
},
|
|
56716
56799
|
project_name: {
|
|
56717
56800
|
type: "string",
|
|
@@ -81389,7 +81472,7 @@ function envGitignoreWarning(path) {
|
|
|
81389
81472
|
// src/web/auth.ts
|
|
81390
81473
|
import { existsSync as existsSync16 } from "node:fs";
|
|
81391
81474
|
|
|
81392
|
-
// ../../node_modules/.bun/@hono+node-server@2.
|
|
81475
|
+
// ../../node_modules/.bun/@hono+node-server@2.1.1+2ac783cc5e75a70c/node_modules/@hono/node-server/dist/conninfo.mjs
|
|
81393
81476
|
var getConnInfo = (c) => {
|
|
81394
81477
|
const bindings = c.env.server ? c.env.server : c.env;
|
|
81395
81478
|
const address = bindings.incoming.socket.remoteAddress;
|
|
@@ -81732,15 +81815,15 @@ init_sync_self_docs();
|
|
|
81732
81815
|
init_cli_core();
|
|
81733
81816
|
import { readFileSync as readFileSync20 } from "node:fs";
|
|
81734
81817
|
|
|
81735
|
-
// ../../node_modules/.bun/@hono+node-server@2.
|
|
81818
|
+
// ../../node_modules/.bun/@hono+node-server@2.1.1+2ac783cc5e75a70c/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
81736
81819
|
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
81737
81820
|
|
|
81738
|
-
// ../../node_modules/.bun/@hono+node-server@2.
|
|
81821
|
+
// ../../node_modules/.bun/@hono+node-server@2.1.1+2ac783cc5e75a70c/node_modules/@hono/node-server/dist/index.mjs
|
|
81739
81822
|
import { STATUS_CODES, createServer } from "node:http";
|
|
81740
81823
|
import { Http2ServerRequest, constants } from "node:http2";
|
|
81741
81824
|
import { Readable } from "node:stream";
|
|
81742
81825
|
|
|
81743
|
-
// ../../node_modules/.bun/hono@4.
|
|
81826
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/helper/websocket/index.js
|
|
81744
81827
|
var defineWebSocketHelper = (handler) => {
|
|
81745
81828
|
return (...args) => {
|
|
81746
81829
|
if (typeof args[0] === "function") {
|
|
@@ -81766,13 +81849,174 @@ var defineWebSocketHelper = (handler) => {
|
|
|
81766
81849
|
};
|
|
81767
81850
|
};
|
|
81768
81851
|
|
|
81769
|
-
// ../../node_modules/.bun/@hono+node-server@2.
|
|
81852
|
+
// ../../node_modules/.bun/@hono+node-server@2.1.1+2ac783cc5e75a70c/node_modules/@hono/node-server/dist/index.mjs
|
|
81770
81853
|
var RequestError = class extends Error {
|
|
81771
81854
|
constructor(message, options) {
|
|
81772
81855
|
super(message, options);
|
|
81773
81856
|
this.name = "RequestError";
|
|
81774
81857
|
}
|
|
81775
81858
|
};
|
|
81859
|
+
var nonJoinedHeaders = new Set([
|
|
81860
|
+
"age",
|
|
81861
|
+
"authorization",
|
|
81862
|
+
"content-length",
|
|
81863
|
+
"content-type",
|
|
81864
|
+
"etag",
|
|
81865
|
+
"expires",
|
|
81866
|
+
"from",
|
|
81867
|
+
"host",
|
|
81868
|
+
"if-modified-since",
|
|
81869
|
+
"if-unmodified-since",
|
|
81870
|
+
"last-modified",
|
|
81871
|
+
"location",
|
|
81872
|
+
"max-forwards",
|
|
81873
|
+
"proxy-authorization",
|
|
81874
|
+
"referer",
|
|
81875
|
+
"retry-after",
|
|
81876
|
+
"server",
|
|
81877
|
+
"user-agent"
|
|
81878
|
+
]);
|
|
81879
|
+
var validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
|
|
81880
|
+
var isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
|
|
81881
|
+
var normalizeHeaderValue = (value) => {
|
|
81882
|
+
if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1)))
|
|
81883
|
+
return value;
|
|
81884
|
+
let start = 0;
|
|
81885
|
+
let end = value.length;
|
|
81886
|
+
while (start < end && isHttpWhitespace(value.charCodeAt(start)))
|
|
81887
|
+
start++;
|
|
81888
|
+
while (end > start && isHttpWhitespace(value.charCodeAt(end - 1)))
|
|
81889
|
+
end--;
|
|
81890
|
+
return value.slice(start, end);
|
|
81891
|
+
};
|
|
81892
|
+
var forbiddenHeaderValue = /[\0\r\n]/;
|
|
81893
|
+
var GlobalHeaders = globalThis.Headers;
|
|
81894
|
+
var materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
|
|
81895
|
+
const headers = new HeadersCtor;
|
|
81896
|
+
for (let i = 0;i < rawHeaders.length; i += 2) {
|
|
81897
|
+
const name = rawHeaders[i];
|
|
81898
|
+
if (!name.startsWith(":"))
|
|
81899
|
+
headers.append(name, rawHeaders[i + 1]);
|
|
81900
|
+
}
|
|
81901
|
+
return headers;
|
|
81902
|
+
};
|
|
81903
|
+
var RequestHeaders = class {
|
|
81904
|
+
#incoming;
|
|
81905
|
+
#rawHeaders;
|
|
81906
|
+
#headers;
|
|
81907
|
+
#invalidValue;
|
|
81908
|
+
constructor(incoming) {
|
|
81909
|
+
this.#incoming = incoming;
|
|
81910
|
+
if (incoming instanceof Http2ServerRequest)
|
|
81911
|
+
this.#rawHeaders = incoming.rawHeaders.slice();
|
|
81912
|
+
}
|
|
81913
|
+
get #lazyRawHeaders() {
|
|
81914
|
+
return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
|
|
81915
|
+
}
|
|
81916
|
+
get #native() {
|
|
81917
|
+
if (!this.#headers) {
|
|
81918
|
+
this.#headers = materializeHeaders(this.#lazyRawHeaders);
|
|
81919
|
+
this.#rawHeaders = undefined;
|
|
81920
|
+
}
|
|
81921
|
+
return this.#headers;
|
|
81922
|
+
}
|
|
81923
|
+
#normalizedName(name) {
|
|
81924
|
+
if (typeof name !== "string")
|
|
81925
|
+
return;
|
|
81926
|
+
if (!validHeaderName.test(name))
|
|
81927
|
+
throw new TypeError(`Invalid header name: ${name}`);
|
|
81928
|
+
return name.toLowerCase();
|
|
81929
|
+
}
|
|
81930
|
+
#lookupHttp1(lowerName) {
|
|
81931
|
+
const headers = this.#incoming instanceof Http2ServerRequest ? undefined : this.#incoming.headers;
|
|
81932
|
+
if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__")
|
|
81933
|
+
return;
|
|
81934
|
+
if (!Object.hasOwn(headers, lowerName))
|
|
81935
|
+
return null;
|
|
81936
|
+
const rawValue = headers[lowerName];
|
|
81937
|
+
if (typeof rawValue === "string") {
|
|
81938
|
+
const value = normalizeHeaderValue(rawValue);
|
|
81939
|
+
return forbiddenHeaderValue.test(value) ? undefined : value;
|
|
81940
|
+
}
|
|
81941
|
+
}
|
|
81942
|
+
#lookup(rawHeaders, lowerName) {
|
|
81943
|
+
const separator = lowerName === "cookie" ? "; " : ", ";
|
|
81944
|
+
let value = null;
|
|
81945
|
+
for (let i = 0;i < rawHeaders.length; i += 2) {
|
|
81946
|
+
const rawName = rawHeaders[i];
|
|
81947
|
+
if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
|
|
81948
|
+
const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
|
|
81949
|
+
if (forbiddenHeaderValue.test(rawValue)) {
|
|
81950
|
+
this.#invalidValue = true;
|
|
81951
|
+
return;
|
|
81952
|
+
}
|
|
81953
|
+
value = value === null ? rawValue : value + separator + rawValue;
|
|
81954
|
+
}
|
|
81955
|
+
}
|
|
81956
|
+
return value;
|
|
81957
|
+
}
|
|
81958
|
+
append(name, value) {
|
|
81959
|
+
this.#native.append(name, value);
|
|
81960
|
+
}
|
|
81961
|
+
delete(name) {
|
|
81962
|
+
this.#native.delete(name);
|
|
81963
|
+
}
|
|
81964
|
+
get(name) {
|
|
81965
|
+
const lowerName = this.#normalizedName(name);
|
|
81966
|
+
if (lowerName && !this.#headers && !this.#invalidValue) {
|
|
81967
|
+
const http1Value = this.#lookupHttp1(lowerName);
|
|
81968
|
+
if (http1Value !== undefined)
|
|
81969
|
+
return http1Value;
|
|
81970
|
+
const value = this.#lookup(this.#lazyRawHeaders, lowerName);
|
|
81971
|
+
if (value !== undefined)
|
|
81972
|
+
return value;
|
|
81973
|
+
}
|
|
81974
|
+
return this.#native.get(name);
|
|
81975
|
+
}
|
|
81976
|
+
has(name) {
|
|
81977
|
+
const lowerName = this.#normalizedName(name);
|
|
81978
|
+
if (lowerName && !this.#headers && !this.#invalidValue) {
|
|
81979
|
+
const http1Value = this.#lookupHttp1(lowerName);
|
|
81980
|
+
if (http1Value !== undefined)
|
|
81981
|
+
return http1Value !== null;
|
|
81982
|
+
const value = this.#lookup(this.#lazyRawHeaders, lowerName);
|
|
81983
|
+
if (value !== undefined)
|
|
81984
|
+
return value !== null;
|
|
81985
|
+
}
|
|
81986
|
+
return this.#native.has(name);
|
|
81987
|
+
}
|
|
81988
|
+
set(name, value) {
|
|
81989
|
+
this.#native.set(name, value);
|
|
81990
|
+
}
|
|
81991
|
+
getSetCookie() {
|
|
81992
|
+
return this.#native.getSetCookie();
|
|
81993
|
+
}
|
|
81994
|
+
keys() {
|
|
81995
|
+
return this.#native.keys();
|
|
81996
|
+
}
|
|
81997
|
+
values() {
|
|
81998
|
+
return this.#native.values();
|
|
81999
|
+
}
|
|
82000
|
+
entries() {
|
|
82001
|
+
return this.#native.entries();
|
|
82002
|
+
}
|
|
82003
|
+
forEach(callback, thisArg) {
|
|
82004
|
+
this.#native.forEach((value, key) => {
|
|
82005
|
+
callback.call(thisArg, value, key, this);
|
|
82006
|
+
});
|
|
82007
|
+
}
|
|
82008
|
+
[Symbol.iterator]() {
|
|
82009
|
+
return this.entries();
|
|
82010
|
+
}
|
|
82011
|
+
};
|
|
82012
|
+
Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
|
|
82013
|
+
return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
|
|
82014
|
+
...options,
|
|
82015
|
+
depth: depth == null ? null : depth - 1
|
|
82016
|
+
})}`;
|
|
82017
|
+
} });
|
|
82018
|
+
Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
|
|
82019
|
+
var newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers);
|
|
81776
82020
|
var reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
|
|
81777
82021
|
var reDotSegment = /\/\.\.?(?:[/?#]|$)/;
|
|
81778
82022
|
var reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
|
|
@@ -81812,16 +82056,6 @@ var Request$1 = class extends GlobalRequest {
|
|
|
81812
82056
|
super(input, options);
|
|
81813
82057
|
}
|
|
81814
82058
|
};
|
|
81815
|
-
var newHeadersFromIncoming = (incoming) => {
|
|
81816
|
-
const headerRecord = [];
|
|
81817
|
-
const rawHeaders = incoming.rawHeaders;
|
|
81818
|
-
for (let i = 0, len = rawHeaders.length;i < len; i += 2) {
|
|
81819
|
-
const key = rawHeaders[i];
|
|
81820
|
-
if (key.charCodeAt(0) !== 58)
|
|
81821
|
-
headerRecord.push([key, rawHeaders[i + 1]]);
|
|
81822
|
-
}
|
|
81823
|
-
return new Headers(headerRecord);
|
|
81824
|
-
};
|
|
81825
82059
|
var wrapBodyStream = Symbol("wrapBodyStream");
|
|
81826
82060
|
var byteExactEncodings = new Set([
|
|
81827
82061
|
"latin1",
|
|
@@ -82522,8 +82756,12 @@ var drainIncoming = (incoming) => {
|
|
|
82522
82756
|
const forceClose = () => {
|
|
82523
82757
|
cleanup();
|
|
82524
82758
|
const socket = incoming.socket;
|
|
82525
|
-
if (socket && !socket.destroyed)
|
|
82526
|
-
socket.destroySoon
|
|
82759
|
+
if (socket && !socket.destroyed) {
|
|
82760
|
+
if (typeof socket.destroySoon === "function")
|
|
82761
|
+
socket.destroySoon();
|
|
82762
|
+
else if (typeof socket.destroy === "function")
|
|
82763
|
+
socket.destroy();
|
|
82764
|
+
}
|
|
82527
82765
|
};
|
|
82528
82766
|
const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
|
|
82529
82767
|
timer.unref?.();
|
|
@@ -83040,7 +83278,7 @@ var serve = (options, listeningListener) => {
|
|
|
83040
83278
|
return server;
|
|
83041
83279
|
};
|
|
83042
83280
|
|
|
83043
|
-
// ../../node_modules/.bun/@hono+node-server@2.
|
|
83281
|
+
// ../../node_modules/.bun/@hono+node-server@2.1.1+2ac783cc5e75a70c/node_modules/@hono/node-server/dist/utils/stream.mjs
|
|
83044
83282
|
import { Readable as Readable2 } from "node:stream";
|
|
83045
83283
|
import { versions as versions2 } from "node:process";
|
|
83046
83284
|
var pr54206Applied = () => {
|
|
@@ -83106,7 +83344,7 @@ var createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) => {
|
|
|
83106
83344
|
});
|
|
83107
83345
|
};
|
|
83108
83346
|
|
|
83109
|
-
// ../../node_modules/.bun/hono@4.
|
|
83347
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/mime.js
|
|
83110
83348
|
var getMimeType = (filename, mimes = baseMimes) => {
|
|
83111
83349
|
const regexp = /\.([a-zA-Z0-9]+?)$/;
|
|
83112
83350
|
const match = filename.match(regexp);
|
|
@@ -83175,7 +83413,7 @@ var _baseMimes = {
|
|
|
83175
83413
|
};
|
|
83176
83414
|
var baseMimes = _baseMimes;
|
|
83177
83415
|
|
|
83178
|
-
// ../../node_modules/.bun/@hono+node-server@2.
|
|
83416
|
+
// ../../node_modules/.bun/@hono+node-server@2.1.1+2ac783cc5e75a70c/node_modules/@hono/node-server/dist/serve-static.mjs
|
|
83179
83417
|
import { createReadStream, existsSync as existsSync17, statSync as statSync5 } from "node:fs";
|
|
83180
83418
|
import { join as join14 } from "node:path";
|
|
83181
83419
|
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
@@ -83337,7 +83575,7 @@ import { existsSync as existsSync21 } from "node:fs";
|
|
|
83337
83575
|
import { readFileSync as readFileSync19, statSync as statSync8 } from "node:fs";
|
|
83338
83576
|
import { join as join18 } from "node:path";
|
|
83339
83577
|
|
|
83340
|
-
// ../../node_modules/.bun/hono@4.
|
|
83578
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/compose.js
|
|
83341
83579
|
var compose = (middleware, onError, onNotFound) => {
|
|
83342
83580
|
return (context, next) => {
|
|
83343
83581
|
let index = -1;
|
|
@@ -83381,10 +83619,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
83381
83619
|
};
|
|
83382
83620
|
};
|
|
83383
83621
|
|
|
83384
|
-
// ../../node_modules/.bun/hono@4.
|
|
83622
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/request/constants.js
|
|
83385
83623
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
83386
83624
|
|
|
83387
|
-
// ../../node_modules/.bun/hono@4.
|
|
83625
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/buffer.js
|
|
83388
83626
|
var bufferToFormData = (arrayBuffer, contentType) => {
|
|
83389
83627
|
const response = new Response(arrayBuffer, {
|
|
83390
83628
|
headers: {
|
|
@@ -83394,7 +83632,9 @@ var bufferToFormData = (arrayBuffer, contentType) => {
|
|
|
83394
83632
|
return response.formData();
|
|
83395
83633
|
};
|
|
83396
83634
|
|
|
83397
|
-
// ../../node_modules/.bun/hono@4.
|
|
83635
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/body.js
|
|
83636
|
+
var MAX_NESTING_DEPTH = 32;
|
|
83637
|
+
var MAX_NESTED_OBJECTS = 1e4;
|
|
83398
83638
|
var isRawRequest = (request) => ("headers" in request);
|
|
83399
83639
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
83400
83640
|
const { all = false, dot = false } = options;
|
|
@@ -83424,6 +83664,7 @@ async function parseFormData(request, options) {
|
|
|
83424
83664
|
}
|
|
83425
83665
|
function convertFormDataToBodyData(formData, options) {
|
|
83426
83666
|
const form = /* @__PURE__ */ Object.create(null);
|
|
83667
|
+
const nestingState = { count: 0 };
|
|
83427
83668
|
formData.forEach((value, key) => {
|
|
83428
83669
|
const shouldParseAllValues = options.all || key.endsWith("[]");
|
|
83429
83670
|
if (!shouldParseAllValues) {
|
|
@@ -83436,7 +83677,7 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
83436
83677
|
Object.entries(form).forEach(([key, value]) => {
|
|
83437
83678
|
const shouldParseDotValues = key.includes(".");
|
|
83438
83679
|
if (shouldParseDotValues) {
|
|
83439
|
-
handleParsingNestedValues(form, key, value);
|
|
83680
|
+
handleParsingNestedValues(form, key, value, nestingState);
|
|
83440
83681
|
delete form[key];
|
|
83441
83682
|
}
|
|
83442
83683
|
});
|
|
@@ -83458,25 +83699,34 @@ var handleParsingAllValues = (form, key, value) => {
|
|
|
83458
83699
|
}
|
|
83459
83700
|
}
|
|
83460
83701
|
};
|
|
83461
|
-
var handleParsingNestedValues = (form, key, value) => {
|
|
83702
|
+
var handleParsingNestedValues = (form, key, value, state) => {
|
|
83462
83703
|
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
83463
83704
|
return;
|
|
83464
83705
|
}
|
|
83465
83706
|
let nestedForm = form;
|
|
83466
|
-
const keys = key.split(".");
|
|
83707
|
+
const keys = key.split(".", MAX_NESTING_DEPTH + 2);
|
|
83708
|
+
if (keys.length > MAX_NESTING_DEPTH + 1) {
|
|
83709
|
+
throwNestingLimitExceeded();
|
|
83710
|
+
}
|
|
83467
83711
|
keys.forEach((key2, index) => {
|
|
83468
83712
|
if (index === keys.length - 1) {
|
|
83469
83713
|
nestedForm[key2] = value;
|
|
83470
83714
|
} else {
|
|
83471
83715
|
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
|
|
83716
|
+
if (state.count++ >= MAX_NESTED_OBJECTS) {
|
|
83717
|
+
throwNestingLimitExceeded();
|
|
83718
|
+
}
|
|
83472
83719
|
nestedForm[key2] = /* @__PURE__ */ Object.create(null);
|
|
83473
83720
|
}
|
|
83474
83721
|
nestedForm = nestedForm[key2];
|
|
83475
83722
|
}
|
|
83476
83723
|
});
|
|
83477
83724
|
};
|
|
83725
|
+
var throwNestingLimitExceeded = () => {
|
|
83726
|
+
throw new Error("Nesting limit exceeded");
|
|
83727
|
+
};
|
|
83478
83728
|
|
|
83479
|
-
// ../../node_modules/.bun/hono@4.
|
|
83729
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/url.js
|
|
83480
83730
|
var splitPath = (path) => {
|
|
83481
83731
|
const paths = path.split("/");
|
|
83482
83732
|
if (paths[0] === "") {
|
|
@@ -83582,13 +83832,13 @@ var checkOptionalParameter = (path) => {
|
|
|
83582
83832
|
if (segment !== "" && !/\:/.test(segment)) {
|
|
83583
83833
|
basePath += "/" + segment;
|
|
83584
83834
|
} else if (/\:/.test(segment)) {
|
|
83585
|
-
if (
|
|
83835
|
+
if (segment.charCodeAt(segment.length - 1) === 63) {
|
|
83586
83836
|
if (results.length === 0 && basePath === "") {
|
|
83587
83837
|
results.push("/");
|
|
83588
83838
|
} else {
|
|
83589
83839
|
results.push(basePath);
|
|
83590
83840
|
}
|
|
83591
|
-
const optionalSegment = segment.
|
|
83841
|
+
const optionalSegment = segment.slice(0, -1);
|
|
83592
83842
|
basePath += "/" + optionalSegment;
|
|
83593
83843
|
results.push(basePath);
|
|
83594
83844
|
} else {
|
|
@@ -83598,18 +83848,20 @@ var checkOptionalParameter = (path) => {
|
|
|
83598
83848
|
});
|
|
83599
83849
|
return results.filter((v, i, a) => a.indexOf(v) === i);
|
|
83600
83850
|
};
|
|
83851
|
+
var tryDecodeURIComponent = (str) => str.indexOf("%") !== -1 ? tryDecode2(str, decodeURIComponent_) : str;
|
|
83601
83852
|
var _decodeURI = (value) => {
|
|
83602
|
-
if (!/[%+]/.test(value)) {
|
|
83603
|
-
return value;
|
|
83604
|
-
}
|
|
83605
83853
|
if (value.indexOf("+") !== -1) {
|
|
83606
83854
|
value = value.replace(/\+/g, " ");
|
|
83607
83855
|
}
|
|
83608
|
-
return
|
|
83856
|
+
return tryDecodeURIComponent(value);
|
|
83609
83857
|
};
|
|
83610
83858
|
var _getQueryParam = (url, key, multiple) => {
|
|
83859
|
+
const hashIndex = url.indexOf("#", 8);
|
|
83860
|
+
if (hashIndex !== -1) {
|
|
83861
|
+
url = url.slice(0, hashIndex);
|
|
83862
|
+
}
|
|
83611
83863
|
let encoded;
|
|
83612
|
-
if (!multiple && key &&
|
|
83864
|
+
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
|
|
83613
83865
|
let keyIndex2 = url.indexOf("?", 8);
|
|
83614
83866
|
if (keyIndex2 === -1) {
|
|
83615
83867
|
return;
|
|
@@ -83676,8 +83928,7 @@ var getQueryParams = (url, key) => {
|
|
|
83676
83928
|
};
|
|
83677
83929
|
var decodeURIComponent_ = decodeURIComponent;
|
|
83678
83930
|
|
|
83679
|
-
// ../../node_modules/.bun/hono@4.
|
|
83680
|
-
var tryDecodeURIComponent = (str) => tryDecode2(str, decodeURIComponent_);
|
|
83931
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/request.js
|
|
83681
83932
|
var HonoRequest = class {
|
|
83682
83933
|
raw;
|
|
83683
83934
|
#validatedData;
|
|
@@ -83689,23 +83940,22 @@ var HonoRequest = class {
|
|
|
83689
83940
|
this.raw = request;
|
|
83690
83941
|
this.path = path;
|
|
83691
83942
|
this.#matchResult = matchResult;
|
|
83692
|
-
this.#validatedData = {};
|
|
83693
83943
|
}
|
|
83694
83944
|
param(key) {
|
|
83695
83945
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
83696
83946
|
}
|
|
83697
83947
|
#getDecodedParam(key) {
|
|
83698
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
83948
|
+
const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key];
|
|
83699
83949
|
const param = this.#getParamValue(paramKey);
|
|
83700
|
-
return param &&
|
|
83950
|
+
return param && tryDecodeURIComponent(param);
|
|
83701
83951
|
}
|
|
83702
83952
|
#getAllDecodedParams() {
|
|
83703
83953
|
const decoded = {};
|
|
83704
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
83954
|
+
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
83705
83955
|
for (const key of keys) {
|
|
83706
83956
|
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
83707
83957
|
if (value !== undefined) {
|
|
83708
|
-
decoded[key] =
|
|
83958
|
+
decoded[key] = tryDecodeURIComponent(value);
|
|
83709
83959
|
}
|
|
83710
83960
|
}
|
|
83711
83961
|
return decoded;
|
|
@@ -83738,8 +83988,7 @@ var HonoRequest = class {
|
|
|
83738
83988
|
if (cachedBody) {
|
|
83739
83989
|
return cachedBody;
|
|
83740
83990
|
}
|
|
83741
|
-
const anyCachedKey
|
|
83742
|
-
if (anyCachedKey) {
|
|
83991
|
+
for (const anyCachedKey in bodyCache) {
|
|
83743
83992
|
return bodyCache[anyCachedKey].then((body) => {
|
|
83744
83993
|
if (anyCachedKey === "json") {
|
|
83745
83994
|
body = JSON.stringify(body);
|
|
@@ -83768,10 +84017,10 @@ var HonoRequest = class {
|
|
|
83768
84017
|
return this.#cachedBody("formData");
|
|
83769
84018
|
}
|
|
83770
84019
|
addValidatedData(target, data) {
|
|
83771
|
-
this.#validatedData[target] = data;
|
|
84020
|
+
(this.#validatedData ??= {})[target] = data;
|
|
83772
84021
|
}
|
|
83773
84022
|
valid(target) {
|
|
83774
|
-
return this.#validatedData[target];
|
|
84023
|
+
return this.#validatedData?.[target];
|
|
83775
84024
|
}
|
|
83776
84025
|
get url() {
|
|
83777
84026
|
return this.raw.url;
|
|
@@ -83790,7 +84039,7 @@ var HonoRequest = class {
|
|
|
83790
84039
|
}
|
|
83791
84040
|
};
|
|
83792
84041
|
|
|
83793
|
-
// ../../node_modules/.bun/hono@4.
|
|
84042
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/html.js
|
|
83794
84043
|
var HtmlEscapedCallbackPhase = {
|
|
83795
84044
|
Stringify: 1,
|
|
83796
84045
|
BeforeStream: 2,
|
|
@@ -83828,7 +84077,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
83828
84077
|
}
|
|
83829
84078
|
};
|
|
83830
84079
|
|
|
83831
|
-
// ../../node_modules/.bun/hono@4.
|
|
84080
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/context.js
|
|
83832
84081
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
83833
84082
|
var setDefaultContentType = (contentType, headers) => {
|
|
83834
84083
|
return {
|
|
@@ -83946,11 +84195,11 @@ var Context = class {
|
|
|
83946
84195
|
return Object.fromEntries(this.#var);
|
|
83947
84196
|
}
|
|
83948
84197
|
#newResponse(data, arg, headers) {
|
|
83949
|
-
|
|
83950
|
-
if (typeof arg === "object" &&
|
|
83951
|
-
|
|
83952
|
-
for (const [key, value] of
|
|
83953
|
-
if (key
|
|
84198
|
+
let responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders;
|
|
84199
|
+
if (typeof arg === "object" && arg.headers) {
|
|
84200
|
+
responseHeaders ??= new Headers;
|
|
84201
|
+
for (const [key, value] of new Headers(arg.headers)) {
|
|
84202
|
+
if (key === "set-cookie") {
|
|
83954
84203
|
responseHeaders.append(key, value);
|
|
83955
84204
|
} else {
|
|
83956
84205
|
responseHeaders.set(key, value);
|
|
@@ -83958,19 +84207,34 @@ var Context = class {
|
|
|
83958
84207
|
}
|
|
83959
84208
|
}
|
|
83960
84209
|
if (headers) {
|
|
83961
|
-
|
|
83962
|
-
|
|
83963
|
-
|
|
83964
|
-
|
|
83965
|
-
|
|
83966
|
-
|
|
83967
|
-
|
|
84210
|
+
if (!responseHeaders) {
|
|
84211
|
+
let count = 0;
|
|
84212
|
+
for (const k in headers) {
|
|
84213
|
+
if (++count > 1 || typeof headers[k] !== "string") {
|
|
84214
|
+
responseHeaders = new Headers;
|
|
84215
|
+
break;
|
|
84216
|
+
}
|
|
84217
|
+
}
|
|
84218
|
+
}
|
|
84219
|
+
if (responseHeaders) {
|
|
84220
|
+
for (const k in headers) {
|
|
84221
|
+
const v = headers[k];
|
|
84222
|
+
if (typeof v === "string") {
|
|
84223
|
+
responseHeaders.set(k, v);
|
|
84224
|
+
} else {
|
|
84225
|
+
responseHeaders.delete(k);
|
|
84226
|
+
for (const v2 of v) {
|
|
84227
|
+
responseHeaders.append(k, v2);
|
|
84228
|
+
}
|
|
83968
84229
|
}
|
|
83969
84230
|
}
|
|
83970
84231
|
}
|
|
83971
84232
|
}
|
|
83972
84233
|
const status = typeof arg === "number" ? arg : arg?.status ?? this.#status;
|
|
83973
|
-
return createResponseInstance(data, {
|
|
84234
|
+
return createResponseInstance(data, {
|
|
84235
|
+
status,
|
|
84236
|
+
headers: responseHeaders ?? headers
|
|
84237
|
+
});
|
|
83974
84238
|
}
|
|
83975
84239
|
newResponse = (...args) => this.#newResponse(...args);
|
|
83976
84240
|
body = (data, arg, headers) => this.#newResponse(data, arg, headers);
|
|
@@ -83995,18 +84259,18 @@ var Context = class {
|
|
|
83995
84259
|
};
|
|
83996
84260
|
};
|
|
83997
84261
|
|
|
83998
|
-
// ../../node_modules/.bun/hono@4.
|
|
84262
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router.js
|
|
83999
84263
|
var METHOD_NAME_ALL = "ALL";
|
|
84000
84264
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
84001
|
-
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
84265
|
+
var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
|
|
84002
84266
|
var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
84003
84267
|
var UnsupportedPathError = class extends Error {
|
|
84004
84268
|
};
|
|
84005
84269
|
|
|
84006
|
-
// ../../node_modules/.bun/hono@4.
|
|
84270
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/constants.js
|
|
84007
84271
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
84008
84272
|
|
|
84009
|
-
// ../../node_modules/.bun/hono@4.
|
|
84273
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/hono-base.js
|
|
84010
84274
|
var notFoundHandler = (c) => {
|
|
84011
84275
|
return c.text("404 Not Found", 404);
|
|
84012
84276
|
};
|
|
@@ -84025,6 +84289,7 @@ var Hono = class _Hono {
|
|
|
84025
84289
|
delete;
|
|
84026
84290
|
options;
|
|
84027
84291
|
patch;
|
|
84292
|
+
query;
|
|
84028
84293
|
all;
|
|
84029
84294
|
on;
|
|
84030
84295
|
use;
|
|
@@ -84037,13 +84302,14 @@ var Hono = class _Hono {
|
|
|
84037
84302
|
const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
|
|
84038
84303
|
allMethods.forEach((method) => {
|
|
84039
84304
|
this[method] = (args1, ...args) => {
|
|
84305
|
+
const methodName = method.toUpperCase();
|
|
84040
84306
|
if (typeof args1 === "string") {
|
|
84041
84307
|
this.#path = args1;
|
|
84042
84308
|
} else {
|
|
84043
|
-
this.#addRoute(
|
|
84309
|
+
this.#addRoute(methodName, this.#path, args1);
|
|
84044
84310
|
}
|
|
84045
84311
|
args.forEach((handler) => {
|
|
84046
|
-
this.#addRoute(
|
|
84312
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
84047
84313
|
});
|
|
84048
84314
|
return this;
|
|
84049
84315
|
};
|
|
@@ -84052,9 +84318,10 @@ var Hono = class _Hono {
|
|
|
84052
84318
|
for (const p of [path].flat()) {
|
|
84053
84319
|
this.#path = p;
|
|
84054
84320
|
for (const m of [method].flat()) {
|
|
84055
|
-
|
|
84056
|
-
|
|
84057
|
-
|
|
84321
|
+
const methodName = m.toUpperCase();
|
|
84322
|
+
for (const handler of handlers) {
|
|
84323
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
84324
|
+
}
|
|
84058
84325
|
}
|
|
84059
84326
|
}
|
|
84060
84327
|
return this;
|
|
@@ -84159,7 +84426,6 @@ var Hono = class _Hono {
|
|
|
84159
84426
|
return this;
|
|
84160
84427
|
}
|
|
84161
84428
|
#addRoute(method, path, handler, baseRoutePath) {
|
|
84162
|
-
method = method.toUpperCase();
|
|
84163
84429
|
path = mergePath(this._basePath, path);
|
|
84164
84430
|
const r = {
|
|
84165
84431
|
basePath: baseRoutePath !== undefined ? mergePath(this._basePath, baseRoutePath) : this._basePath,
|
|
@@ -84230,7 +84496,10 @@ var Hono = class _Hono {
|
|
|
84230
84496
|
};
|
|
84231
84497
|
};
|
|
84232
84498
|
|
|
84233
|
-
// ../../node_modules/.bun/hono@4.
|
|
84499
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/utils.js
|
|
84500
|
+
var createNullObject = () => /* @__PURE__ */ Object.create(null);
|
|
84501
|
+
|
|
84502
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
84234
84503
|
var emptyParam = [];
|
|
84235
84504
|
function match(method, path) {
|
|
84236
84505
|
const matchers = this.buildAllMatchers();
|
|
@@ -84251,7 +84520,7 @@ function match(method, path) {
|
|
|
84251
84520
|
return match2(method, path);
|
|
84252
84521
|
}
|
|
84253
84522
|
|
|
84254
|
-
// ../../node_modules/.bun/hono@4.
|
|
84523
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
84255
84524
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
84256
84525
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
84257
84526
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -84265,7 +84534,7 @@ function compareKey(a, b) {
|
|
|
84265
84534
|
return 1;
|
|
84266
84535
|
}
|
|
84267
84536
|
if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {
|
|
84268
|
-
return 1;
|
|
84537
|
+
return b === TAIL_WILDCARD_REG_EXP_STR ? -1 : 1;
|
|
84269
84538
|
} else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {
|
|
84270
84539
|
return -1;
|
|
84271
84540
|
}
|
|
@@ -84279,70 +84548,69 @@ function compareKey(a, b) {
|
|
|
84279
84548
|
var Node = class _Node {
|
|
84280
84549
|
#index;
|
|
84281
84550
|
#varIndex;
|
|
84282
|
-
#children =
|
|
84283
|
-
insert(tokens, index, paramMap, context,
|
|
84284
|
-
|
|
84285
|
-
|
|
84286
|
-
|
|
84287
|
-
}
|
|
84288
|
-
|
|
84289
|
-
|
|
84290
|
-
|
|
84291
|
-
|
|
84292
|
-
|
|
84293
|
-
|
|
84294
|
-
|
|
84295
|
-
|
|
84296
|
-
|
|
84297
|
-
|
|
84298
|
-
|
|
84299
|
-
|
|
84300
|
-
|
|
84301
|
-
|
|
84302
|
-
|
|
84303
|
-
}
|
|
84304
|
-
|
|
84305
|
-
if (
|
|
84306
|
-
|
|
84307
|
-
|
|
84308
|
-
|
|
84309
|
-
|
|
84310
|
-
|
|
84311
|
-
|
|
84312
|
-
|
|
84313
|
-
|
|
84314
|
-
if (pathErrorCheckOnly) {
|
|
84315
|
-
return;
|
|
84551
|
+
#children = createNullObject();
|
|
84552
|
+
insert(tokens, index, paramMap, context, isStatic) {
|
|
84553
|
+
let node = this;
|
|
84554
|
+
for (let i = 0, len = tokens.length;i < len; i++) {
|
|
84555
|
+
const token = tokens[i];
|
|
84556
|
+
const pattern = token.length === 1 ? token === "*" ? i === len - 1 ? ["", "", ONLY_WILDCARD_REG_EXP_STR] : ["", "", LABEL_REG_EXP_STR] : null : token === "/*" ? ["", "", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
84557
|
+
let nextNode;
|
|
84558
|
+
if (pattern) {
|
|
84559
|
+
const name = pattern[1];
|
|
84560
|
+
let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
|
|
84561
|
+
if (name && pattern[2]) {
|
|
84562
|
+
if (regexpStr === ".*") {
|
|
84563
|
+
throw PATH_ERROR;
|
|
84564
|
+
}
|
|
84565
|
+
regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
|
|
84566
|
+
if (/\((?!\?:)/.test(regexpStr)) {
|
|
84567
|
+
throw PATH_ERROR;
|
|
84568
|
+
}
|
|
84569
|
+
if (regexpStr.length === 1 && regExpMetaChars.has(regexpStr)) {
|
|
84570
|
+
throw PATH_ERROR;
|
|
84571
|
+
}
|
|
84572
|
+
}
|
|
84573
|
+
nextNode = node.#children[regexpStr];
|
|
84574
|
+
if (!nextNode) {
|
|
84575
|
+
if (regexpStr !== ONLY_WILDCARD_REG_EXP_STR && regexpStr !== TAIL_WILDCARD_REG_EXP_STR) {
|
|
84576
|
+
for (const k in node.#children) {
|
|
84577
|
+
if ((regexpStr.length > 1 || k.length > 1) && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR) {
|
|
84578
|
+
throw PATH_ERROR;
|
|
84579
|
+
}
|
|
84580
|
+
}
|
|
84581
|
+
}
|
|
84582
|
+
nextNode = node.#children[regexpStr] = new _Node;
|
|
84316
84583
|
}
|
|
84317
|
-
node = this.#children[regexpStr] = new _Node;
|
|
84318
84584
|
if (name !== "") {
|
|
84319
|
-
|
|
84585
|
+
nextNode.#varIndex ??= context.varIndex++;
|
|
84586
|
+
paramMap.push([name, nextNode.#varIndex]);
|
|
84320
84587
|
}
|
|
84321
|
-
}
|
|
84322
|
-
|
|
84323
|
-
|
|
84324
|
-
|
|
84325
|
-
|
|
84326
|
-
|
|
84327
|
-
|
|
84328
|
-
|
|
84329
|
-
|
|
84330
|
-
}
|
|
84331
|
-
if (pathErrorCheckOnly) {
|
|
84332
|
-
return;
|
|
84588
|
+
} else {
|
|
84589
|
+
nextNode = node.#children[token];
|
|
84590
|
+
if (!nextNode) {
|
|
84591
|
+
for (const k in node.#children) {
|
|
84592
|
+
if (k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR) {
|
|
84593
|
+
throw PATH_ERROR;
|
|
84594
|
+
}
|
|
84595
|
+
}
|
|
84596
|
+
nextNode = node.#children[token] = new _Node;
|
|
84333
84597
|
}
|
|
84334
|
-
node = this.#children[token] = new _Node;
|
|
84335
84598
|
}
|
|
84599
|
+
node = nextNode;
|
|
84336
84600
|
}
|
|
84337
|
-
node
|
|
84601
|
+
if (node.#index !== undefined) {
|
|
84602
|
+
throw PATH_ERROR;
|
|
84603
|
+
}
|
|
84604
|
+
node.#index = isStatic ? -1 : index;
|
|
84338
84605
|
}
|
|
84339
84606
|
buildRegExpStr() {
|
|
84340
84607
|
const childKeys = Object.keys(this.#children).sort(compareKey);
|
|
84341
84608
|
const strList = childKeys.map((k) => {
|
|
84342
84609
|
const c = this.#children[k];
|
|
84343
|
-
|
|
84344
|
-
|
|
84345
|
-
|
|
84610
|
+
const childStr = c.buildRegExpStr();
|
|
84611
|
+
return childStr === "" ? "" : (typeof c.#varIndex === "number" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + childStr;
|
|
84612
|
+
}).filter(Boolean);
|
|
84613
|
+
if (typeof this.#index === "number" && this.#index !== -1) {
|
|
84346
84614
|
strList.unshift(`#${this.#index}`);
|
|
84347
84615
|
}
|
|
84348
84616
|
if (strList.length === 0) {
|
|
@@ -84355,16 +84623,23 @@ var Node = class _Node {
|
|
|
84355
84623
|
}
|
|
84356
84624
|
};
|
|
84357
84625
|
|
|
84358
|
-
// ../../node_modules/.bun/hono@4.
|
|
84626
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
84359
84627
|
var Trie = class {
|
|
84360
84628
|
#context = { varIndex: 0 };
|
|
84361
84629
|
#root = new Node;
|
|
84362
|
-
|
|
84630
|
+
#index = 0;
|
|
84631
|
+
paths = createNullObject();
|
|
84632
|
+
insert(path, isStatic) {
|
|
84633
|
+
if (isStatic) {
|
|
84634
|
+
this.#root.insert(path.split(""), 0, [], this.#context, true);
|
|
84635
|
+
return;
|
|
84636
|
+
}
|
|
84363
84637
|
const paramAssoc = [];
|
|
84364
84638
|
const groups = [];
|
|
84639
|
+
let markedPath = path;
|
|
84365
84640
|
for (let i = 0;; ) {
|
|
84366
84641
|
let replaced = false;
|
|
84367
|
-
|
|
84642
|
+
markedPath = markedPath.replace(/\{[^}]+\}/g, (m) => {
|
|
84368
84643
|
const mark = `@\\${i}`;
|
|
84369
84644
|
groups[i] = [mark, m];
|
|
84370
84645
|
i++;
|
|
@@ -84375,7 +84650,7 @@ var Trie = class {
|
|
|
84375
84650
|
break;
|
|
84376
84651
|
}
|
|
84377
84652
|
}
|
|
84378
|
-
const tokens =
|
|
84653
|
+
const tokens = markedPath.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
84379
84654
|
for (let i = groups.length - 1;i >= 0; i--) {
|
|
84380
84655
|
const [mark] = groups[i];
|
|
84381
84656
|
for (let j = tokens.length - 1;j >= 0; j--) {
|
|
@@ -84385,8 +84660,8 @@ var Trie = class {
|
|
|
84385
84660
|
}
|
|
84386
84661
|
}
|
|
84387
84662
|
}
|
|
84388
|
-
this.#root.insert(tokens, index, paramAssoc, this.#context,
|
|
84389
|
-
|
|
84663
|
+
this.#root.insert(tokens, this.#index, paramAssoc, this.#context, false);
|
|
84664
|
+
this.paths[path] = [this.#index++, paramAssoc];
|
|
84390
84665
|
}
|
|
84391
84666
|
buildRegExp() {
|
|
84392
84667
|
let regexp = this.#root.buildRegExpStr();
|
|
@@ -84411,72 +84686,12 @@ var Trie = class {
|
|
|
84411
84686
|
}
|
|
84412
84687
|
};
|
|
84413
84688
|
|
|
84414
|
-
// ../../node_modules/.bun/hono@4.
|
|
84415
|
-
var
|
|
84416
|
-
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
84689
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
84690
|
+
var wildcardRegExpCache = createNullObject();
|
|
84417
84691
|
function buildWildcardRegExp(path) {
|
|
84418
|
-
return wildcardRegExpCache[path] ??= new RegExp(
|
|
84419
|
-
}
|
|
84420
|
-
function clearWildcardRegExpCache() {
|
|
84421
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
84422
|
-
}
|
|
84423
|
-
function buildMatcherFromPreprocessedRoutes(routes) {
|
|
84424
|
-
const trie = new Trie;
|
|
84425
|
-
const handlerData = [];
|
|
84426
|
-
if (routes.length === 0) {
|
|
84427
|
-
return nullMatcher;
|
|
84428
|
-
}
|
|
84429
|
-
const routesWithStaticPathFlag = routes.map((route) => [!/\*|\/:/.test(route[0]), ...route]).sort(([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length);
|
|
84430
|
-
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
84431
|
-
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length;i < len; i++) {
|
|
84432
|
-
const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];
|
|
84433
|
-
if (pathErrorCheckOnly) {
|
|
84434
|
-
staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
84435
|
-
} else {
|
|
84436
|
-
j++;
|
|
84437
|
-
}
|
|
84438
|
-
let paramAssoc;
|
|
84439
|
-
try {
|
|
84440
|
-
paramAssoc = trie.insert(path, j, pathErrorCheckOnly);
|
|
84441
|
-
} catch (e) {
|
|
84442
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
|
|
84443
|
-
}
|
|
84444
|
-
if (pathErrorCheckOnly) {
|
|
84445
|
-
continue;
|
|
84446
|
-
}
|
|
84447
|
-
handlerData[j] = handlers.map(([h, paramCount]) => {
|
|
84448
|
-
const paramIndexMap = /* @__PURE__ */ Object.create(null);
|
|
84449
|
-
paramCount -= 1;
|
|
84450
|
-
for (;paramCount >= 0; paramCount--) {
|
|
84451
|
-
const [key, value] = paramAssoc[paramCount];
|
|
84452
|
-
paramIndexMap[key] = value;
|
|
84453
|
-
}
|
|
84454
|
-
return [h, paramIndexMap];
|
|
84455
|
-
});
|
|
84456
|
-
}
|
|
84457
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
84458
|
-
for (let i = 0, len = handlerData.length;i < len; i++) {
|
|
84459
|
-
for (let j = 0, len2 = handlerData[i].length;j < len2; j++) {
|
|
84460
|
-
const map = handlerData[i][j]?.[1];
|
|
84461
|
-
if (!map) {
|
|
84462
|
-
continue;
|
|
84463
|
-
}
|
|
84464
|
-
const keys = Object.keys(map);
|
|
84465
|
-
for (let k = 0, len3 = keys.length;k < len3; k++) {
|
|
84466
|
-
map[keys[k]] = paramReplacementMap[map[keys[k]]];
|
|
84467
|
-
}
|
|
84468
|
-
}
|
|
84469
|
-
}
|
|
84470
|
-
const handlerMap = [];
|
|
84471
|
-
for (const i in indexReplacementMap) {
|
|
84472
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
84473
|
-
}
|
|
84474
|
-
return [regexp, handlerMap, staticMap];
|
|
84692
|
+
return wildcardRegExpCache[path] ??= new RegExp(`^${path.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g, (match2, metaChar) => metaChar ? `\\${metaChar}` : match2 === "/*" ? TAIL_WILDCARD_REG_EXP_STR : match2 === "*" ? ONLY_WILDCARD_REG_EXP_STR : `/:${LABEL_REG_EXP_STR}`)}$`);
|
|
84475
84693
|
}
|
|
84476
84694
|
function findMiddleware(middleware, path) {
|
|
84477
|
-
if (!middleware) {
|
|
84478
|
-
return;
|
|
84479
|
-
}
|
|
84480
84695
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
84481
84696
|
if (buildWildcardRegExp(k).test(path)) {
|
|
84482
84697
|
return [...middleware[k]];
|
|
@@ -84488,95 +84703,106 @@ var RegExpRouter = class {
|
|
|
84488
84703
|
name = "RegExpRouter";
|
|
84489
84704
|
#middleware;
|
|
84490
84705
|
#routes;
|
|
84706
|
+
#tries;
|
|
84491
84707
|
constructor() {
|
|
84492
|
-
this.#middleware = { [METHOD_NAME_ALL]:
|
|
84493
|
-
this.#routes = { [METHOD_NAME_ALL]:
|
|
84708
|
+
this.#middleware = { [METHOD_NAME_ALL]: createNullObject() };
|
|
84709
|
+
this.#routes = { [METHOD_NAME_ALL]: createNullObject() };
|
|
84710
|
+
this.#tries = { [METHOD_NAME_ALL]: new Trie };
|
|
84711
|
+
}
|
|
84712
|
+
#insertPath(method, path) {
|
|
84713
|
+
try {
|
|
84714
|
+
this.#tries[method].insert(path, !/\*|\/:/.test(path));
|
|
84715
|
+
} catch (e) {
|
|
84716
|
+
throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
|
|
84717
|
+
}
|
|
84494
84718
|
}
|
|
84495
84719
|
add(method, path, handler) {
|
|
84496
84720
|
const middleware = this.#middleware;
|
|
84497
84721
|
const routes = this.#routes;
|
|
84498
|
-
if (!middleware
|
|
84722
|
+
if (!middleware) {
|
|
84499
84723
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
84500
84724
|
}
|
|
84501
84725
|
if (!middleware[method]) {
|
|
84502
|
-
[
|
|
84503
|
-
|
|
84504
|
-
|
|
84726
|
+
this.#tries[method] = new Trie;
|
|
84727
|
+
for (const handlerMap of [middleware, routes]) {
|
|
84728
|
+
handlerMap[method] = createNullObject();
|
|
84729
|
+
for (const p in handlerMap[METHOD_NAME_ALL]) {
|
|
84505
84730
|
handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
|
|
84506
|
-
|
|
84507
|
-
|
|
84731
|
+
this.#insertPath(method, p);
|
|
84732
|
+
}
|
|
84733
|
+
}
|
|
84508
84734
|
}
|
|
84509
84735
|
if (path === "/*") {
|
|
84510
84736
|
path = "*";
|
|
84511
84737
|
}
|
|
84512
|
-
const
|
|
84738
|
+
const methods = method === METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
84513
84739
|
if (/\*$/.test(path)) {
|
|
84514
84740
|
const re = buildWildcardRegExp(path);
|
|
84515
|
-
|
|
84516
|
-
|
|
84517
|
-
|
|
84518
|
-
|
|
84519
|
-
} else {
|
|
84520
|
-
middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
|
|
84521
|
-
}
|
|
84522
|
-
Object.keys(middleware).forEach((m) => {
|
|
84523
|
-
if (method === METHOD_NAME_ALL || method === m) {
|
|
84524
|
-
Object.keys(middleware[m]).forEach((p) => {
|
|
84525
|
-
re.test(p) && middleware[m][p].push([handler, paramCount]);
|
|
84526
|
-
});
|
|
84741
|
+
for (const m of methods) {
|
|
84742
|
+
if (!middleware[m][path]) {
|
|
84743
|
+
this.#insertPath(m, path);
|
|
84744
|
+
middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
|
|
84527
84745
|
}
|
|
84528
|
-
}
|
|
84529
|
-
|
|
84530
|
-
|
|
84531
|
-
|
|
84746
|
+
}
|
|
84747
|
+
for (const handlerMap of [middleware, routes]) {
|
|
84748
|
+
for (const m of methods) {
|
|
84749
|
+
for (const p in handlerMap[m]) {
|
|
84750
|
+
re.test(p) && handlerMap[m][p].push([handler, path]);
|
|
84751
|
+
}
|
|
84532
84752
|
}
|
|
84533
|
-
}
|
|
84753
|
+
}
|
|
84534
84754
|
return;
|
|
84535
84755
|
}
|
|
84536
84756
|
const paths = checkOptionalParameter(path) || [path];
|
|
84537
|
-
for (
|
|
84538
|
-
const
|
|
84539
|
-
|
|
84540
|
-
|
|
84541
|
-
routes[m][path2]
|
|
84542
|
-
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
|
|
84543
|
-
];
|
|
84544
|
-
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
84757
|
+
for (const path2 of paths) {
|
|
84758
|
+
for (const m of methods) {
|
|
84759
|
+
if (!routes[m][path2]) {
|
|
84760
|
+
this.#insertPath(m, path2);
|
|
84761
|
+
routes[m][path2] = findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || [];
|
|
84545
84762
|
}
|
|
84546
|
-
|
|
84763
|
+
routes[m][path2].push([handler, path2]);
|
|
84764
|
+
}
|
|
84547
84765
|
}
|
|
84548
84766
|
}
|
|
84549
84767
|
match = match;
|
|
84550
84768
|
buildAllMatchers() {
|
|
84551
|
-
const matchers =
|
|
84552
|
-
Object.keys(this.#routes)
|
|
84553
|
-
matchers[method]
|
|
84554
|
-
}
|
|
84555
|
-
this.#middleware = this.#routes = undefined;
|
|
84556
|
-
|
|
84769
|
+
const matchers = createNullObject();
|
|
84770
|
+
for (const method of Object.keys(this.#routes)) {
|
|
84771
|
+
matchers[method] = this.#buildMatcher(method);
|
|
84772
|
+
}
|
|
84773
|
+
this.#middleware = this.#routes = this.#tries = undefined;
|
|
84774
|
+
wildcardRegExpCache = createNullObject();
|
|
84557
84775
|
return matchers;
|
|
84558
84776
|
}
|
|
84559
84777
|
#buildMatcher(method) {
|
|
84560
|
-
const
|
|
84561
|
-
|
|
84562
|
-
|
|
84563
|
-
|
|
84564
|
-
|
|
84565
|
-
|
|
84566
|
-
|
|
84567
|
-
|
|
84568
|
-
|
|
84778
|
+
const middleware = this.#middleware[method];
|
|
84779
|
+
const routes = this.#routes[method];
|
|
84780
|
+
const trie = this.#tries[method];
|
|
84781
|
+
const staticMap = createNullObject();
|
|
84782
|
+
const handlerData = [];
|
|
84783
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
84784
|
+
for (const r of [middleware, routes]) {
|
|
84785
|
+
for (const path in r) {
|
|
84786
|
+
const handlers = r[path];
|
|
84787
|
+
const pathData = trie.paths[path];
|
|
84788
|
+
if (!pathData) {
|
|
84789
|
+
staticMap[path] = [handlers.map(([h]) => [h, createNullObject()]), emptyParam];
|
|
84790
|
+
continue;
|
|
84791
|
+
}
|
|
84792
|
+
handlerData[pathData[0]] = handlers.map(([h, handlerPath]) => [
|
|
84793
|
+
h,
|
|
84794
|
+
trie.paths[handlerPath][1].reduceRight((map, [key], i) => {
|
|
84795
|
+
map[key] = paramReplacementMap[pathData[1][i][1]];
|
|
84796
|
+
return map;
|
|
84797
|
+
}, createNullObject())
|
|
84798
|
+
]);
|
|
84569
84799
|
}
|
|
84570
|
-
});
|
|
84571
|
-
if (!hasOwnRoute) {
|
|
84572
|
-
return null;
|
|
84573
|
-
} else {
|
|
84574
|
-
return buildMatcherFromPreprocessedRoutes(routes);
|
|
84575
84800
|
}
|
|
84801
|
+
return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
|
|
84576
84802
|
}
|
|
84577
84803
|
};
|
|
84578
84804
|
|
|
84579
|
-
// ../../node_modules/.bun/hono@4.
|
|
84805
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/smart-router/router.js
|
|
84580
84806
|
var SmartRouter = class {
|
|
84581
84807
|
name = "SmartRouter";
|
|
84582
84808
|
#routers = [];
|
|
@@ -84631,78 +84857,53 @@ var SmartRouter = class {
|
|
|
84631
84857
|
}
|
|
84632
84858
|
};
|
|
84633
84859
|
|
|
84634
|
-
// ../../node_modules/.bun/hono@4.
|
|
84635
|
-
var emptyParams =
|
|
84636
|
-
var
|
|
84637
|
-
for (const _ in children) {
|
|
84638
|
-
return true;
|
|
84639
|
-
}
|
|
84640
|
-
return false;
|
|
84641
|
-
};
|
|
84860
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/trie-router/node.js
|
|
84861
|
+
var emptyParams = createNullObject();
|
|
84862
|
+
var order = 0;
|
|
84642
84863
|
var Node2 = class _Node {
|
|
84643
|
-
#methods;
|
|
84644
|
-
#children;
|
|
84645
|
-
#patterns;
|
|
84646
|
-
#
|
|
84864
|
+
#methods = [];
|
|
84865
|
+
#children = createNullObject();
|
|
84866
|
+
#patterns = [];
|
|
84867
|
+
#pattern;
|
|
84647
84868
|
#params = emptyParams;
|
|
84648
|
-
constructor(method, handler, children) {
|
|
84649
|
-
this.#children = children || /* @__PURE__ */ Object.create(null);
|
|
84650
|
-
this.#methods = [];
|
|
84651
|
-
if (method && handler) {
|
|
84652
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
84653
|
-
m[method] = { handler, possibleKeys: [], score: 0 };
|
|
84654
|
-
this.#methods = [m];
|
|
84655
|
-
}
|
|
84656
|
-
this.#patterns = [];
|
|
84657
|
-
}
|
|
84658
84869
|
insert(method, path, handler) {
|
|
84659
|
-
this.#order = ++this.#order;
|
|
84660
84870
|
let curNode = this;
|
|
84661
84871
|
const parts = splitRoutingPath(path);
|
|
84662
|
-
const possibleKeys =
|
|
84663
|
-
|
|
84664
|
-
|
|
84665
|
-
const nextP = parts[i
|
|
84666
|
-
const pattern = getPattern(p, nextP);
|
|
84667
|
-
const
|
|
84668
|
-
|
|
84669
|
-
|
|
84670
|
-
|
|
84671
|
-
|
|
84672
|
-
|
|
84673
|
-
continue;
|
|
84872
|
+
const possibleKeys = /* @__PURE__ */ new Set;
|
|
84873
|
+
let i = 0;
|
|
84874
|
+
for (const p of parts) {
|
|
84875
|
+
const nextP = parts[++i];
|
|
84876
|
+
const pattern = getPattern(p, nextP) || (nextP === undefined && p && p.indexOf("*") === p.length - 1 ? p : null);
|
|
84877
|
+
const isParam = Array.isArray(pattern);
|
|
84878
|
+
const key = isParam ? pattern[0] : pattern || p;
|
|
84879
|
+
const child = curNode.#children[key] ||= new _Node;
|
|
84880
|
+
if (pattern && !child.#pattern) {
|
|
84881
|
+
child.#pattern = pattern;
|
|
84882
|
+
curNode.#patterns.push(child);
|
|
84674
84883
|
}
|
|
84675
|
-
curNode
|
|
84676
|
-
if (
|
|
84677
|
-
|
|
84678
|
-
possibleKeys.push(pattern[1]);
|
|
84884
|
+
curNode = child;
|
|
84885
|
+
if (isParam) {
|
|
84886
|
+
possibleKeys.add(pattern[1]);
|
|
84679
84887
|
}
|
|
84680
|
-
curNode = curNode.#children[key];
|
|
84681
84888
|
}
|
|
84682
84889
|
curNode.#methods.push({
|
|
84683
84890
|
[method]: {
|
|
84684
84891
|
handler,
|
|
84685
|
-
possibleKeys: possibleKeys
|
|
84686
|
-
score:
|
|
84892
|
+
possibleKeys: [...possibleKeys],
|
|
84893
|
+
score: ++order
|
|
84687
84894
|
}
|
|
84688
84895
|
});
|
|
84689
|
-
return curNode;
|
|
84690
84896
|
}
|
|
84691
84897
|
#pushHandlerSets(handlerSets, node, method, nodeParams, params) {
|
|
84692
84898
|
for (let i = 0, len = node.#methods.length;i < len; i++) {
|
|
84693
84899
|
const m = node.#methods[i];
|
|
84694
84900
|
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
84695
|
-
|
|
84696
|
-
|
|
84697
|
-
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
84901
|
+
if (handlerSet) {
|
|
84902
|
+
handlerSet.params = createNullObject();
|
|
84698
84903
|
handlerSets.push(handlerSet);
|
|
84699
|
-
|
|
84700
|
-
|
|
84701
|
-
|
|
84702
|
-
const processed = processedSet[handlerSet.score];
|
|
84703
|
-
handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
|
|
84704
|
-
processedSet[handlerSet.score] = true;
|
|
84705
|
-
}
|
|
84904
|
+
for (let i2 = 0, len2 = handlerSet.possibleKeys.length;i2 < len2; i2++) {
|
|
84905
|
+
const key = handlerSet.possibleKeys[i2];
|
|
84906
|
+
handlerSet.params[key] = params?.[key] && !i2 ? params[key] : nodeParams[key] ?? params?.[key];
|
|
84706
84907
|
}
|
|
84707
84908
|
}
|
|
84708
84909
|
}
|
|
@@ -84734,33 +84935,33 @@ var Node2 = class _Node {
|
|
|
84734
84935
|
tempNodes.push(nextNode);
|
|
84735
84936
|
}
|
|
84736
84937
|
}
|
|
84737
|
-
for (
|
|
84738
|
-
const pattern =
|
|
84938
|
+
for (const child of node.#patterns) {
|
|
84939
|
+
const pattern = child.#pattern;
|
|
84739
84940
|
const params = node.#params === emptyParams ? {} : { ...node.#params };
|
|
84740
|
-
if (pattern === "
|
|
84741
|
-
|
|
84742
|
-
|
|
84743
|
-
|
|
84744
|
-
|
|
84745
|
-
|
|
84941
|
+
if (typeof pattern === "string") {
|
|
84942
|
+
if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
|
|
84943
|
+
this.#pushHandlerSets(handlerSets, child, method, node.#params);
|
|
84944
|
+
if (pattern === "*") {
|
|
84945
|
+
child.#params = params;
|
|
84946
|
+
tempNodes.push(child);
|
|
84947
|
+
}
|
|
84746
84948
|
}
|
|
84747
84949
|
continue;
|
|
84748
84950
|
}
|
|
84749
|
-
const [
|
|
84750
|
-
if (!part &&
|
|
84951
|
+
const [, name, matcher] = pattern;
|
|
84952
|
+
if (!part && matcher === true) {
|
|
84751
84953
|
continue;
|
|
84752
84954
|
}
|
|
84753
|
-
|
|
84754
|
-
|
|
84755
|
-
|
|
84756
|
-
partOffsets = new Array(len);
|
|
84955
|
+
if (matcher !== true) {
|
|
84956
|
+
if (!partOffsets) {
|
|
84957
|
+
partOffsets = [];
|
|
84757
84958
|
let offset = path[0] === "/" ? 1 : 0;
|
|
84758
84959
|
for (let p = 0;p < len; p++) {
|
|
84759
84960
|
partOffsets[p] = offset;
|
|
84760
84961
|
offset += parts[p].length + 1;
|
|
84761
84962
|
}
|
|
84762
84963
|
}
|
|
84763
|
-
const restPathString = path.
|
|
84964
|
+
const restPathString = path.slice(partOffsets[i]);
|
|
84764
84965
|
const m = matcher.exec(restPathString);
|
|
84765
84966
|
if (m) {
|
|
84766
84967
|
params[name] = m[0];
|
|
@@ -84768,11 +84969,12 @@ var Node2 = class _Node {
|
|
|
84768
84969
|
if (m[0].length === restPathString.length && child.#children["*"]) {
|
|
84769
84970
|
this.#pushHandlerSets(handlerSets, child.#children["*"], method, node.#params, params);
|
|
84770
84971
|
}
|
|
84771
|
-
|
|
84972
|
+
for (const _ in child.#children) {
|
|
84772
84973
|
child.#params = params;
|
|
84773
|
-
const componentCount = m[0].match(/\//)?.length ?? 0;
|
|
84974
|
+
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
84774
84975
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
84775
84976
|
targetCurNodes.push(child);
|
|
84977
|
+
break;
|
|
84776
84978
|
}
|
|
84777
84979
|
continue;
|
|
84778
84980
|
}
|
|
@@ -84794,7 +84996,7 @@ var Node2 = class _Node {
|
|
|
84794
84996
|
const shifted = curNodesQueue.shift();
|
|
84795
84997
|
curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
|
|
84796
84998
|
}
|
|
84797
|
-
if (handlerSets
|
|
84999
|
+
if (handlerSets[1]) {
|
|
84798
85000
|
handlerSets.sort((a, b) => {
|
|
84799
85001
|
return a.score - b.score;
|
|
84800
85002
|
});
|
|
@@ -84803,29 +85005,21 @@ var Node2 = class _Node {
|
|
|
84803
85005
|
}
|
|
84804
85006
|
};
|
|
84805
85007
|
|
|
84806
|
-
// ../../node_modules/.bun/hono@4.
|
|
85008
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/router/trie-router/router.js
|
|
84807
85009
|
var TrieRouter = class {
|
|
84808
85010
|
name = "TrieRouter";
|
|
84809
|
-
#node;
|
|
84810
|
-
constructor() {
|
|
84811
|
-
this.#node = new Node2;
|
|
84812
|
-
}
|
|
85011
|
+
#node = new Node2;
|
|
84813
85012
|
add(method, path, handler) {
|
|
84814
|
-
const
|
|
84815
|
-
|
|
84816
|
-
for (let i = 0, len = results.length;i < len; i++) {
|
|
84817
|
-
this.#node.insert(method, results[i], handler);
|
|
84818
|
-
}
|
|
84819
|
-
return;
|
|
85013
|
+
for (const result of checkOptionalParameter(path) || [path]) {
|
|
85014
|
+
this.#node.insert(method, result, handler);
|
|
84820
85015
|
}
|
|
84821
|
-
this.#node.insert(method, path, handler);
|
|
84822
85016
|
}
|
|
84823
85017
|
match(method, path) {
|
|
84824
85018
|
return this.#node.search(method, path);
|
|
84825
85019
|
}
|
|
84826
85020
|
};
|
|
84827
85021
|
|
|
84828
|
-
// ../../node_modules/.bun/hono@4.
|
|
85022
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/hono.js
|
|
84829
85023
|
var Hono2 = class extends Hono {
|
|
84830
85024
|
constructor(options = {}) {
|
|
84831
85025
|
super(options);
|
|
@@ -84835,7 +85029,7 @@ var Hono2 = class extends Hono {
|
|
|
84835
85029
|
}
|
|
84836
85030
|
};
|
|
84837
85031
|
|
|
84838
|
-
// ../../node_modules/.bun/hono@4.
|
|
85032
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/utils/color.js
|
|
84839
85033
|
function getColorEnabled() {
|
|
84840
85034
|
const { process: process2, Deno: Deno2 } = globalThis;
|
|
84841
85035
|
const isNoColor = typeof Deno2?.noColor === "boolean" ? Deno2.noColor : process2 !== undefined ? "NO_COLOR" in process2?.env : false;
|
|
@@ -84854,7 +85048,7 @@ async function getColorEnabledAsync() {
|
|
|
84854
85048
|
return !isNoColor;
|
|
84855
85049
|
}
|
|
84856
85050
|
|
|
84857
|
-
// ../../node_modules/.bun/hono@4.
|
|
85051
|
+
// ../../node_modules/.bun/hono@4.13.7/node_modules/hono/dist/middleware/logger/index.js
|
|
84858
85052
|
var humanize = (times) => {
|
|
84859
85053
|
const [delimiter, separator] = [",", "."];
|
|
84860
85054
|
const orderTimes = times.map((v) => v.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + delimiter));
|