@jsnchn/buntastic 0.0.10 → 0.0.11
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/package.json +1 -1
- package/src/index.ts +16 -10
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -289,11 +289,14 @@ async function dev(): Promise<void> {
|
|
|
289
289
|
const distPath = join(DIST_DIR, path);
|
|
290
290
|
|
|
291
291
|
if (await exists(distPath)) {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
const stat = await import("fs").then(fs => fs.statSync(distPath));
|
|
293
|
+
if (stat.isFile()) {
|
|
294
|
+
const file = Bun.file(distPath);
|
|
295
|
+
const mimeType = getMimeType(distPath);
|
|
296
|
+
return new Response(file, {
|
|
297
|
+
headers: { "Content-Type": mimeType },
|
|
298
|
+
});
|
|
299
|
+
}
|
|
297
300
|
}
|
|
298
301
|
|
|
299
302
|
if (path === "/") {
|
|
@@ -372,11 +375,14 @@ async function preview(): Promise<void> {
|
|
|
372
375
|
const distPath = join(DIST_DIR, path);
|
|
373
376
|
|
|
374
377
|
if (await exists(distPath)) {
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
const stat = await import("fs").then(fs => fs.statSync(distPath));
|
|
379
|
+
if (stat.isFile()) {
|
|
380
|
+
const file = Bun.file(distPath);
|
|
381
|
+
const mimeType = getMimeType(distPath);
|
|
382
|
+
return new Response(file, {
|
|
383
|
+
headers: { "Content-Type": mimeType },
|
|
384
|
+
});
|
|
385
|
+
}
|
|
380
386
|
}
|
|
381
387
|
|
|
382
388
|
if (path === "/") {
|