Handle browser Errors.

This commit is contained in:
2026-03-21 06:34:32 +01:00
parent d893a31d73
commit 7ef114ee70
97 changed files with 849 additions and 277 deletions
+31
View File
@@ -0,0 +1,31 @@
import { type ExecSyncOptions } from "child_process";
declare const BuildKeys: readonly [{
readonly key: "production";
}, {
readonly key: "bytecode";
}, {
readonly key: "conditions";
}, {
readonly key: "format";
}, {
readonly key: "root";
}, {
readonly key: "splitting";
}, {
readonly key: "cdd-chunking";
}];
type Params = {
src: string;
out_dir: string;
entry_naming?: string;
minify?: boolean;
exec_options?: ExecSyncOptions;
debug?: boolean;
sourcemap?: boolean;
target?: "browser" | "node" | "bun";
build_options?: {
[k in (typeof BuildKeys)[number]["key"]]: string | boolean;
};
};
export default function bundle({ out_dir, src, minify, exec_options, debug, entry_naming, sourcemap, target, build_options, }: Params): void;
export {};
+8
View File
@@ -0,0 +1,8 @@
/**
* # Convert Serialized Query back to object
*/
export default function deserializeQuery(query: string | {
[s: string]: any;
}): {
[s: string]: any;
};
+17
View File
@@ -0,0 +1,17 @@
/**
* # EJSON parse string
*/
declare function parse(string: string | null | number, reviver?: (this: any, key: string, value: any) => any): {
[s: string]: any;
} | {
[s: string]: any;
}[] | undefined;
/**
* # EJSON stringify object
*/
declare function stringify(value: any, replacer?: ((this: any, key: string, value: any) => any) | null, space?: string | number): string | undefined;
declare const EJSON: {
parse: typeof parse;
stringify: typeof stringify;
};
export default EJSON;
+1
View File
@@ -0,0 +1 @@
export default function exitWithError(msg: string, code?: number): void;
+6
View File
@@ -0,0 +1,6 @@
import type { PageFiles } from "../types";
type Params = {
exclude_api?: boolean;
};
export default function grabAllPages(params?: Params): PageFiles[];
export {};
+1 -1
View File
@@ -26,7 +26,7 @@ function grabPageDirRecursively({ page_dir }) {
if (page.match(new RegExp(`${AppNames["RootPagesComponentName"]}`))) {
continue;
}
if (page.match(/\(|\)|--/)) {
if (page.match(/\(|\)|--|\/api\//)) {
continue;
}
const page_stat = statSync(full_page_path);
+9
View File
@@ -0,0 +1,9 @@
declare const AppNames: {
readonly defaultPort: 7000;
readonly defaultAssetPrefix: "_bunext/static";
readonly name: "Bunext";
readonly version: "1.0.1";
readonly defaultDistDir: ".bunext";
readonly RootPagesComponentName: "__root";
};
export default AppNames;
+1
View File
@@ -0,0 +1 @@
export default function grabAppPort(): number;
+1
View File
@@ -0,0 +1 @@
export default function grabAssetsPrefix(): string;
+9
View File
@@ -0,0 +1,9 @@
export default function grabConstants(): {
readonly ClientRootElementIDName: "__bunext";
readonly ClientWindowPagePropsName: "__PAGE_PROPS__";
readonly MBInBytes: number;
readonly ServerDefaultRequestBodyLimitBytes: number;
readonly ClientRootComponentWindowName: "BUNEXT_ROOT";
readonly MaxBundlerRebuilds: 5;
readonly config: import("../types").BunextConfig;
};
+21
View File
@@ -0,0 +1,21 @@
export default function grabDirNames(): {
ROOT_DIR: string;
SRC_DIR: string;
PAGES_DIR: string;
API_DIR: string;
PUBLIC_DIR: string;
HYDRATION_DST_DIR: string;
BUNX_ROOT_DIR: string;
CONFIG_FILE: string;
BUNX_TMP_DIR: string;
BUNX_HYDRATION_SRC_DIR: string;
BUNX_ROOT_SRC_DIR: string;
BUNX_ROOT_PRESETS_DIR: string;
BUNX_ROOT_500_PRESET_COMPONENT: string;
BUNX_ROOT_500_FILE_NAME: string;
BUNX_ROOT_404_PRESET_COMPONENT: string;
BUNX_ROOT_404_FILE_NAME: string;
HYDRATION_DST_DIR_MAP_JSON_FILE: string;
BUNEXT_CACHE_DIR: string;
BUNX_CWD_MODULE_CACHE_DIR: string;
};
+1
View File
@@ -0,0 +1 @@
export default function grabOrigin(): string;
+5
View File
@@ -0,0 +1,5 @@
type Params = {
path: string;
};
export default function grabPageName(params: Params): string;
export {};
+6
View File
@@ -0,0 +1,6 @@
import type { BunxRouteParams } from "../types";
type Params = {
req: Request;
};
export default function grabRouteParams({ req, }: Params): Promise<BunxRouteParams>;
export {};
+1
View File
@@ -0,0 +1 @@
export default function grabRouter(): import("bun").FileSystemRouter;
+1
View File
@@ -0,0 +1 @@
export default function isDevelopment(): boolean;
+10
View File
@@ -0,0 +1,10 @@
export declare const log: {
info: (msg: string, log?: any) => void;
success: (msg: string, log?: any) => void;
error: (msg: string | Error) => void;
warn: (msg: string) => void;
build: (msg: string) => void;
watch: (msg: string) => void;
server: (url: string) => void;
banner: () => void;
};
+2
View File
@@ -0,0 +1,2 @@
export default function numberfy(num: any, decimals?: number): number;
export declare const _n: typeof numberfy;
+1
View File
@@ -0,0 +1 @@
export default function refreshRouter(): void;
+1
View File
@@ -0,0 +1 @@
export default function registerDevPlugin(): void;