bun-dev-server 0.9.83 → 0.9.85

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.
@@ -117,13 +117,13 @@ export interface BunDevServerConfig extends Partial<BunServeConfig> {
117
117
  * Event listener to execute before Bun builds
118
118
  * @param env Supplied environment for the build
119
119
  */
120
- beforeBuild?: (env: BuildEnv) => void;
120
+ beforeBuild?: (env: BuildEnv) => Promise<void> | void;
121
121
  /**
122
122
  * Event listener to execute after Bun builds
123
123
  * @param output The output of the build
124
124
  * @param env Supplied environment for the build
125
125
  */
126
- afterBuild?: (output: BuildOutput, env: BuildEnv) => void;
126
+ afterBuild?: (output: BuildOutput, env: BuildEnv) => Promise<void> | void;
127
127
  }
128
128
  export interface BunServeConfig {
129
129
  port: number;
package/dist/index.js CHANGED
@@ -1741,6 +1741,9 @@ async function startBunDevServer(serverConfig, importMeta) {
1741
1741
  });
1742
1742
  const watcher = watch(srcWatch, { recursive: true });
1743
1743
  for await (const event of watcher) {
1744
+ if (queue.pending > 0) {
1745
+ continue;
1746
+ }
1744
1747
  try {
1745
1748
  if (queue.size > 0) {
1746
1749
  queue.clear();
@@ -1774,7 +1777,7 @@ async function cleanBuildAndNotify(importerMeta, finalConfig, destinationPath, b
1774
1777
  bunServer,
1775
1778
  event
1776
1779
  };
1777
- finalConfig.beforeBuild?.(buildEnv);
1780
+ await finalConfig.beforeBuild?.(buildEnv);
1778
1781
  try {
1779
1782
  const output = await build(buildCfg);
1780
1783
  publishOutputLogs(bunServer, output, finalConfig, event);
@@ -1784,7 +1787,7 @@ async function cleanBuildAndNotify(importerMeta, finalConfig, destinationPath, b
1784
1787
  if (finalConfig.writeManifest) {
1785
1788
  writeManifest(output, destinationPath, finalConfig.manifestWithHash, finalConfig.manifestName);
1786
1789
  }
1787
- finalConfig.afterBuild?.(output, buildEnv);
1790
+ await finalConfig.afterBuild?.(output, buildEnv);
1788
1791
  if (finalConfig.reloadOnChange && !finalConfig.waitForTSCSuccessBeforeReload) {
1789
1792
  bunServer.publish("message", JSON.stringify({ type: "reload" }));
1790
1793
  }
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "exports": {
25
25
  ".": "./dist/index.js"
26
26
  },
27
- "version": "0.9.83",
27
+ "version": "0.9.85",
28
28
  "module": "index.ts",
29
29
  "type": "module",
30
30
  "license": "MIT",
@@ -32,10 +32,10 @@
32
32
  "build": "bun run ./build.ts"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/bun": "^1.2.8"
35
+ "@types/bun": "^1.2.20"
36
36
  },
37
37
  "peerDependencies": {
38
- "typescript": "^5.8.3"
38
+ "typescript": "^5.9.2"
39
39
  },
40
40
  "dependencies": {
41
41
  "@types/ejs": "^3.1.5",