bun-dev-server 0.9.7 → 0.9.81

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1179,7 +1179,11 @@ async function startBunDevServer(serverConfig, importMeta) {
1179
1179
  } catch (e) {
1180
1180
  if (e.code === "ENOENT") {
1181
1181
  console.log("Directory not found, creating it...");
1182
- await $2`mkdir ${destinationPath}`;
1182
+ try {
1183
+ await $2`mkdir ${destinationPath}`;
1184
+ } catch (e2) {
1185
+ console.error("Unable to create directory", e2);
1186
+ }
1183
1187
  } else {
1184
1188
  throw e;
1185
1189
  }
@@ -1290,10 +1294,14 @@ function publishOutputLogs(bunServer, output, config, event) {
1290
1294
  bunServer.publish("message", JSON.stringify({ type: "message", message: `[Bun HMR] ${event.filename} ${event.eventType}` }));
1291
1295
  const outTable = output.outputs.filter((o) => o.kind !== "sourcemap").map((o) => {
1292
1296
  const a = Bun.pathToFileURL(o.path);
1297
+ const distPath = Bun.pathToFileURL(config.buildConfig.outdir ?? "./dist");
1298
+ const distPathHref = distPath.href;
1299
+ const lastDistIdx = distPathHref.lastIndexOf("/") + 1;
1293
1300
  const fileName = a.href.substring(a.href.lastIndexOf("/") + 1);
1301
+ const fileWithPath = a.href.substring(lastDistIdx);
1294
1302
  return {
1295
1303
  name: fileName,
1296
- path: o.path,
1304
+ path: fileWithPath,
1297
1305
  size: convertBytes(o.size)
1298
1306
  };
1299
1307
  });
@@ -1328,7 +1336,7 @@ async function cleanDirectory(dst) {
1328
1336
  if (stderr.indexOf("no matches found") > -1) {
1329
1337
  console.log("Directory is empty");
1330
1338
  } else {
1331
- throw stderr;
1339
+ console.warn("Unable to clean directory", stderr.toString("utf8"));
1332
1340
  }
1333
1341
  }
1334
1342
  }
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "exports": {
25
25
  ".": "./dist/index.js"
26
26
  },
27
- "version": "0.9.7",
27
+ "version": "0.9.81",
28
28
  "module": "index.ts",
29
29
  "type": "module",
30
30
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "build": "bun run ./build.ts"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/bun": "^1.2.5"
35
+ "@types/bun": "^1.2.7"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "typescript": "^5.8.2"