Fix API bundler. Use new esbuild context builder for it.

This commit is contained in:
2026-04-11 12:06:53 +01:00
parent c4f7cf9164
commit 814a289460
30 changed files with 465 additions and 15 deletions
+1
View File
@@ -1,6 +1,7 @@
import type { PageFiles } from "../types";
type Params = {
exclude_api?: boolean;
api_only?: boolean;
};
export default function grabAllPages(params?: Params): PageFiles[];
export {};
+3
View File
@@ -9,6 +9,9 @@ export default function grabAllPages(params) {
if (params?.exclude_api) {
return pages.filter((p) => !Boolean(p.url_path.startsWith("/api/")));
}
if (params?.api_only) {
return pages.filter((p) => Boolean(p.url_path.startsWith("/api/")));
}
return pages;
}
function grabPageDirRecursively({ page_dir }) {
+2 -1
View File
@@ -1,6 +1,7 @@
import type { BunxRouteParams } from "../types";
type Params = {
req: Request;
query?: any;
};
export default function grabRouteParams({ req, }: Params): Promise<BunxRouteParams>;
export default function grabRouteParams({ req, query: passed_query, }: Params): Promise<BunxRouteParams>;
export {};
+3 -2
View File
@@ -1,5 +1,6 @@
import _ from "lodash";
import deserializeQuery from "./deserialize-query";
export default async function grabRouteParams({ req, }) {
export default async function grabRouteParams({ req, query: passed_query, }) {
const url = new URL(req.url);
const query = deserializeQuery(Object.fromEntries(url.searchParams));
const body = await (async () => {
@@ -13,7 +14,7 @@ export default async function grabRouteParams({ req, }) {
const routeParams = {
req,
url,
query,
query: _.merge(query, passed_query),
body,
server: global.SERVER,
};