@mandujs/core 0.9.13 → 0.9.14

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mandujs/core",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "Mandu Framework Core - Spec, Generator, Guard, Runtime",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -2,6 +2,7 @@ import type { RoutesManifest, RouteSpec } from "../spec/schema";
2
2
  import { generateApiHandler, generatePageComponent, generateSlotLogic } from "./templates";
3
3
  import { generateContractTypeGlue, generateContractTemplate, generateContractTypesIndex } from "./contract-glue";
4
4
  import { computeHash } from "../spec/lock";
5
+ import { getWatcher } from "../watcher/watcher";
5
6
  import path from "path";
6
7
  import fs from "fs/promises";
7
8
 
@@ -135,6 +136,10 @@ export async function generateRoutes(
135
136
  warnings: [],
136
137
  };
137
138
 
139
+ // Suppress watcher during generation to avoid false positives
140
+ const watcher = getWatcher();
141
+ watcher?.suppress();
142
+
138
143
  const serverRoutesDir = path.join(rootDir, "apps/server/generated/routes");
139
144
  const webRoutesDir = path.join(rootDir, "apps/web/generated/routes");
140
145
  const typesDir = path.join(rootDir, "apps/server/generated/types");
@@ -338,5 +343,8 @@ export async function generateRoutes(
338
343
  const mapPath = path.join(mapDir, "generated.map.json");
339
344
  await Bun.write(mapPath, JSON.stringify(generatedMap, null, 2));
340
345
 
346
+ // Resume watcher after generation
347
+ watcher?.resume();
348
+
341
349
  return result;
342
350
  }
@@ -67,6 +67,7 @@ export class FileWatcher {
67
67
  private logFile: string | null = null;
68
68
  private logStream: fs.WriteStream | null = null;
69
69
  private tailProcess: ChildProcess | null = null;
70
+ private _suppressed: boolean = false;
70
71
 
71
72
  constructor(config: WatcherConfig) {
72
73
  this.config = {
@@ -229,6 +230,20 @@ export class FileWatcher {
229
230
  this.recentWarnings = [];
230
231
  }
231
232
 
233
+ /**
234
+ * Suppress warnings (e.g. during generate)
235
+ */
236
+ suppress(): void {
237
+ this._suppressed = true;
238
+ }
239
+
240
+ /**
241
+ * Resume warnings after suppression
242
+ */
243
+ resume(): void {
244
+ this._suppressed = false;
245
+ }
246
+
232
247
  /**
233
248
  * Open a new terminal window tailing the log file
234
249
  */
@@ -266,6 +281,8 @@ export class FileWatcher {
266
281
  event: "create" | "modify" | "delete",
267
282
  filePath: string
268
283
  ): Promise<void> {
284
+ if (this._suppressed) return;
285
+
269
286
  const { rootDir } = this.config;
270
287
 
271
288
  // Validate file against rules