@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +16 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnchn/buntastic",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "A simple static site generator built with Bun",
5
5
  "type": "module",
6
6
  "bin": {
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 file = Bun.file(distPath);
293
- const mimeType = getMimeType(distPath);
294
- return new Response(file, {
295
- headers: { "Content-Type": mimeType },
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 file = Bun.file(distPath);
376
- const mimeType = getMimeType(distPath);
377
- return new Response(file, {
378
- headers: { "Content-Type": mimeType },
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 === "/") {