bun-dev-server 0.2.0 → 0.4.0

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/README.md CHANGED
@@ -1,32 +1,33 @@
1
1
  # Bun Dev Server
2
2
 
3
- ```
3
+ ```ts
4
4
  //devserver.ts
5
- import {startBunDevServer} from "bun-dev-server"
6
- import { file } from "bun"
5
+ import { startBunDevServer } from "bun-dev-server";
6
+ import { file } from "bun";
7
7
 
8
8
  startBunDevServer({
9
- buildConfig: {
10
- entrypoints: ["./src/app.ts"],
11
- outdir: "dist",
12
- splitting: true,
13
- naming: {
14
- asset: "assets/[name]-[hash].[ext]",
15
- chunk: "chunks/[name]-[hash].[ext]",
16
- }
17
- },
18
- tls: {
19
- cert: file("./serve_cert.pem"),
20
- key: file("./serve_key.pem"),
9
+ buildConfig: {
10
+ entrypoints: ["./src/app.ts"],
11
+ //...
12
+ outdir: "dist",
13
+ splitting: true,
14
+ naming: {
15
+ asset: "assets/[name]-[hash].[ext]",
16
+ chunk: "chunks/[name]-[hash].[ext]",
21
17
  },
22
- writeManifest: true,
23
- cleanServePath: true,
24
- port: 4567,
25
- enableTypeScriptWatch: true,
26
- watchDir: "./src",
27
- })
18
+ },
19
+ tls: {
20
+ cert: file("./serve_cert.pem"),
21
+ key: file("./serve_key.pem"),
22
+ },
23
+ writeManifest: true,
24
+ cleanServePath: true,
25
+ port: 4567,
26
+ enableTypeScriptWatch: true,
27
+ watchDir: "./src",
28
+ });
28
29
  ```
29
30
 
30
31
  ```
31
32
  bun run devserver.ts
32
- ```
33
+ ```
@@ -0,0 +1,3 @@
1
+ import type { BunHMROptions } from "./bunHmrPlugin";
2
+ export declare const DEFAULT_HMR_PATH = "/hmr-ws";
3
+ export declare function bunHotReload(bunServerConfig: BunHMROptions): string;
@@ -0,0 +1,8 @@
1
+ import type { BunPlugin } from "bun";
2
+ export interface BunHMROptions {
3
+ secure?: boolean;
4
+ port: number;
5
+ websocketPath?: string;
6
+ }
7
+ export declare function bunHotReloadPlugin(config: BunHMROptions): BunPlugin;
8
+ export declare function getBunHMRFooter(config: BunHMROptions): string;
@@ -0,0 +1,2 @@
1
+ import { type BuildOutput } from "bun";
2
+ export declare function writeManifest(output: BuildOutput, outdir: string, withHash?: boolean, manifestName?: string): void;
@@ -1,27 +1,26 @@
1
- import { type BuildConfig, type TLSOptions } from "bun";
2
-
3
- export interface BunDevServerConfig extends Partial<BunDevServerSocketConfig> {
4
- port: number;
5
- buildConfig: BuildConfig;
6
- watchDir?: string;
7
- enableTypeScriptWatch?: boolean;
8
- writeManifest?: boolean;
9
- manifestName?: string;
10
- manifestWithHash?: boolean;
11
- reloadOnChange?: boolean;
12
- /**
13
- * The path to the directory to serve files from.
14
- * Takes precedence over `buildConfig.outdir`.
15
- * Defaults to "dist".
16
- */
17
- servePath?: string;
18
- cleanServePath?: boolean;
19
- serveOutputEjs?: string;
20
- serveOutputHtml?: string;
21
- }
22
-
23
- export interface BunDevServerSocketConfig {
24
- port: number;
25
- tls?: TLSOptions;
26
- websocketPath: string;
27
- }
1
+ import { type BuildConfig, type TLSOptions } from "bun";
2
+ export interface BunDevServerConfig extends Partial<BunDevServerSocketConfig> {
3
+ port: number;
4
+ buildConfig: BuildConfig;
5
+ watchDir: string;
6
+ enableTSC?: boolean;
7
+ writeManifest?: boolean;
8
+ manifestName?: string;
9
+ manifestWithHash?: boolean;
10
+ hotReload?: "plugin" | "footer";
11
+ reloadOnChange?: boolean;
12
+ /**
13
+ * The path to the directory to serve files from.
14
+ * Takes precedence over `buildConfig.outdir`.
15
+ * Defaults to "dist".
16
+ */
17
+ servePath?: string;
18
+ cleanServePath?: boolean;
19
+ serveOutputEjs?: string;
20
+ serveOutputHtml?: string;
21
+ }
22
+ export interface BunDevServerSocketConfig {
23
+ port: number;
24
+ tls?: TLSOptions;
25
+ websocketPath?: string;
26
+ }
@@ -0,0 +1,2 @@
1
+ import { type Server } from "bun";
2
+ export declare function startTSWatcher(server: Server, watchDir: URL): Promise<void>;
@@ -0,0 +1,3 @@
1
+ export * from "./server";
2
+ export * from "./bunServeConfig";
3
+ export * from "./bunHmrPlugin";