@jsnchn/buntastic 0.0.6 → 0.0.8

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 +18 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnchn/buntastic",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "A simple static site generator built with Bun",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -300,12 +300,19 @@ async function dev(): Promise<void> {
300
300
 
301
301
  const watchers = [watcher1, watcher2, watcher3];
302
302
 
303
+ let isBuilding = false;
303
304
  let debounceTimer: ReturnType<typeof setTimeout> | undefined;
304
305
  const rebuild = () => {
305
306
  clearTimeout(debounceTimer);
306
307
  debounceTimer = setTimeout(async () => {
308
+ if (isBuilding) return;
309
+ isBuilding = true;
307
310
  console.log("Rebuilding...");
308
- await build(false);
311
+ try {
312
+ await build(false);
313
+ } finally {
314
+ isBuilding = false;
315
+ }
309
316
  }, 100);
310
317
  };
311
318
 
@@ -313,6 +320,16 @@ async function dev(): Promise<void> {
313
320
  for (const watcher of watchers) {
314
321
  (async () => {
315
322
  for await (const event of watcher) {
323
+ const filename = event.filename || "";
324
+ const isPublicFile = filename.includes("public");
325
+
326
+ if (isPublicFile) {
327
+ const ext = filename.split(".").pop()?.toLowerCase();
328
+ if (ext !== "css" && ext !== "js" && ext !== "ts") {
329
+ continue;
330
+ }
331
+ }
332
+
316
333
  console.log(`[${event.eventType}] ${event.filename} - rebuilding...`);
317
334
  rebuild();
318
335
  }