mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
Updates
This commit is contained in:
@@ -16,3 +16,13 @@ The spec for bundler configuration object is defined in [`bun-build-config.ts`][
|
||||
A class for orchestrating builds & HTTP. This class is a layer that sits on top of the `Bun.build` and `Bun.serve`, intended primarily for use by framework authors.
|
||||
|
||||
- `class` [`Bun.App`][./bun-app.ts]: other possible names: `Bun.Builder`, `Bun.Engine`, `Bun.Framework`
|
||||
|
||||
High-level: an `App` consists of a set of _bundlers_ and _routers_. During build/serve, Bun will:
|
||||
|
||||
- iterate over all routers
|
||||
- each router specifies a bundler configuration (the `build` key) and an `entrypoint`/`dir`
|
||||
- if dir, all files in entrypoint are considered entrypoints
|
||||
- everything is bundled
|
||||
- the built results are served over HTTP
|
||||
- each router has a route `prefix` from which its build assets are served
|
||||
- for "mode: handler", the handler is loaded and called instead of served as a static asset
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
import { FileSystemRouter, MatchedRoute, ServeOptions, Server } from "bun";
|
||||
|
||||
import { BuildManifest, BuildConfig, BundlerConfig } from "./bun-build-config";
|
||||
import { BuildManifest, BuildConfig } from "./bun-build-config";
|
||||
import { BuildResult } from "./bun-build";
|
||||
|
||||
interface AppConfig {
|
||||
configs: Array<BuildConfig & { name: string }>;
|
||||
configs: Array<Omit<BuildConfig, "entrypoints"> & { name: string }>;
|
||||
routers: Array<AppServeRouter>;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Bun.App
|
||||
*
|
||||
* On build/serve:
|
||||
* - iterate over all routers
|
||||
* - each router specifies either an `entrypoint`/`dir` & build config
|
||||
* - if dir, all files in entrypoint are considered entrypoints
|
||||
* - everything is built
|
||||
* - the built results are served over HTTP
|
||||
* - each router has a route `prefix` from which its build assets are served
|
||||
* - for "mode: handler", the handler is loaded and called instead of served as a static asset
|
||||
*/
|
||||
|
||||
type AppServeRouter =
|
||||
| {
|
||||
// handler mode
|
||||
|
||||
Reference in New Issue
Block a user