@webtypen/webframez-react 0.0.23 → 0.0.24

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/dist/http.cjs CHANGED
@@ -409,8 +409,25 @@ function renderHeadToString(head) {
409
409
  }
410
410
  return tags.join("\n");
411
411
  }
412
- function resolveModule(modulePath) {
413
- delete require.cache[modulePath];
412
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
413
+ const resolvedPath = require.resolve(modulePath);
414
+ if (visited.has(resolvedPath)) {
415
+ return;
416
+ }
417
+ visited.add(resolvedPath);
418
+ const cachedModule = require.cache[resolvedPath];
419
+ if (!cachedModule) {
420
+ return;
421
+ }
422
+ for (const child of cachedModule.children) {
423
+ if (child.id.startsWith(rootDir)) {
424
+ clearModuleCache(child.id, rootDir, visited);
425
+ }
426
+ }
427
+ delete require.cache[resolvedPath];
428
+ }
429
+ function resolveModule(modulePath, rootDir) {
430
+ clearModuleCache(modulePath, rootDir);
414
431
  return require(modulePath);
415
432
  }
416
433
  async function resolveHead(candidate, context) {
@@ -497,7 +514,7 @@ function createFileRouter(options) {
497
514
  message,
498
515
  payload
499
516
  };
500
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
517
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
501
518
  if (!import_node_fs.default.existsSync(errorPath)) {
502
519
  const fallback = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
503
520
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: statusCode }),
@@ -511,7 +528,7 @@ function createFileRouter(options) {
511
528
  }
512
529
  };
513
530
  }
514
- const errorModule = resolveModule(errorPath);
531
+ const errorModule = resolveModule(errorPath, pagesDir);
515
532
  const errorNode = await errorModule.default(errorProps);
516
533
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
517
534
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -560,7 +577,10 @@ function createFileRouter(options) {
560
577
  message: `Invalid middleware '${middlewareNames[0]}'`
561
578
  });
562
579
  }
563
- const middlewareModule = resolveModule(middlewaresPath);
580
+ const middlewareModule = resolveModule(
581
+ middlewaresPath,
582
+ pagesDir
583
+ );
564
584
  const registry = middlewareModule.middlewares;
565
585
  if (!registry) {
566
586
  if (!requiresNamedMiddleware) {
@@ -615,8 +635,8 @@ function createFileRouter(options) {
615
635
  params: match.params
616
636
  };
617
637
  activeContext = context;
618
- const pageModule = resolveModule(match.entry.filePath);
619
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
638
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
639
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
620
640
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
621
641
  activeContext = middlewareContext;
622
642
  const pageData = await resolvePageData(pageModule, middlewareContext);
package/dist/http.js CHANGED
@@ -384,8 +384,25 @@ function renderHeadToString(head) {
384
384
  }
385
385
  return tags.join("\n");
386
386
  }
387
- function resolveModule(modulePath) {
388
- delete __require.cache[modulePath];
387
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
388
+ const resolvedPath = __require.resolve(modulePath);
389
+ if (visited.has(resolvedPath)) {
390
+ return;
391
+ }
392
+ visited.add(resolvedPath);
393
+ const cachedModule = __require.cache[resolvedPath];
394
+ if (!cachedModule) {
395
+ return;
396
+ }
397
+ for (const child of cachedModule.children) {
398
+ if (child.id.startsWith(rootDir)) {
399
+ clearModuleCache(child.id, rootDir, visited);
400
+ }
401
+ }
402
+ delete __require.cache[resolvedPath];
403
+ }
404
+ function resolveModule(modulePath, rootDir) {
405
+ clearModuleCache(modulePath, rootDir);
389
406
  return __require(modulePath);
390
407
  }
391
408
  async function resolveHead(candidate, context) {
@@ -472,7 +489,7 @@ function createFileRouter(options) {
472
489
  message,
473
490
  payload
474
491
  };
475
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
492
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
476
493
  if (!fs.existsSync(errorPath)) {
477
494
  const fallback = /* @__PURE__ */ jsxs("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
478
495
  /* @__PURE__ */ jsx("h1", { children: statusCode }),
@@ -486,7 +503,7 @@ function createFileRouter(options) {
486
503
  }
487
504
  };
488
505
  }
489
- const errorModule = resolveModule(errorPath);
506
+ const errorModule = resolveModule(errorPath, pagesDir);
490
507
  const errorNode = await errorModule.default(errorProps);
491
508
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
492
509
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -535,7 +552,10 @@ function createFileRouter(options) {
535
552
  message: `Invalid middleware '${middlewareNames[0]}'`
536
553
  });
537
554
  }
538
- const middlewareModule = resolveModule(middlewaresPath);
555
+ const middlewareModule = resolveModule(
556
+ middlewaresPath,
557
+ pagesDir
558
+ );
539
559
  const registry = middlewareModule.middlewares;
540
560
  if (!registry) {
541
561
  if (!requiresNamedMiddleware) {
@@ -590,8 +610,8 @@ function createFileRouter(options) {
590
610
  params: match.params
591
611
  };
592
612
  activeContext = context;
593
- const pageModule = resolveModule(match.entry.filePath);
594
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
613
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
614
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
595
615
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
596
616
  activeContext = middlewareContext;
597
617
  const pageData = await resolvePageData(pageModule, middlewareContext);
package/dist/index.cjs CHANGED
@@ -442,8 +442,25 @@ function renderHeadToString(head) {
442
442
  }
443
443
  return tags.join("\n");
444
444
  }
445
- function resolveModule(modulePath) {
446
- delete require.cache[modulePath];
445
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
446
+ const resolvedPath = require.resolve(modulePath);
447
+ if (visited.has(resolvedPath)) {
448
+ return;
449
+ }
450
+ visited.add(resolvedPath);
451
+ const cachedModule = require.cache[resolvedPath];
452
+ if (!cachedModule) {
453
+ return;
454
+ }
455
+ for (const child of cachedModule.children) {
456
+ if (child.id.startsWith(rootDir)) {
457
+ clearModuleCache(child.id, rootDir, visited);
458
+ }
459
+ }
460
+ delete require.cache[resolvedPath];
461
+ }
462
+ function resolveModule(modulePath, rootDir) {
463
+ clearModuleCache(modulePath, rootDir);
447
464
  return require(modulePath);
448
465
  }
449
466
  async function resolveHead(candidate, context) {
@@ -530,7 +547,7 @@ function createFileRouter(options) {
530
547
  message,
531
548
  payload
532
549
  };
533
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
550
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
534
551
  if (!import_node_fs.default.existsSync(errorPath)) {
535
552
  const fallback = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
536
553
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: statusCode }),
@@ -544,7 +561,7 @@ function createFileRouter(options) {
544
561
  }
545
562
  };
546
563
  }
547
- const errorModule = resolveModule(errorPath);
564
+ const errorModule = resolveModule(errorPath, pagesDir);
548
565
  const errorNode = await errorModule.default(errorProps);
549
566
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
550
567
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -593,7 +610,10 @@ function createFileRouter(options) {
593
610
  message: `Invalid middleware '${middlewareNames[0]}'`
594
611
  });
595
612
  }
596
- const middlewareModule = resolveModule(middlewaresPath);
613
+ const middlewareModule = resolveModule(
614
+ middlewaresPath,
615
+ pagesDir
616
+ );
597
617
  const registry = middlewareModule.middlewares;
598
618
  if (!registry) {
599
619
  if (!requiresNamedMiddleware) {
@@ -648,8 +668,8 @@ function createFileRouter(options) {
648
668
  params: match.params
649
669
  };
650
670
  activeContext = context;
651
- const pageModule = resolveModule(match.entry.filePath);
652
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
671
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
672
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
653
673
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
654
674
  activeContext = middlewareContext;
655
675
  const pageData = await resolvePageData(pageModule, middlewareContext);
package/dist/index.js CHANGED
@@ -406,8 +406,25 @@ function renderHeadToString(head) {
406
406
  }
407
407
  return tags.join("\n");
408
408
  }
409
- function resolveModule(modulePath) {
410
- delete __require.cache[modulePath];
409
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
410
+ const resolvedPath = __require.resolve(modulePath);
411
+ if (visited.has(resolvedPath)) {
412
+ return;
413
+ }
414
+ visited.add(resolvedPath);
415
+ const cachedModule = __require.cache[resolvedPath];
416
+ if (!cachedModule) {
417
+ return;
418
+ }
419
+ for (const child of cachedModule.children) {
420
+ if (child.id.startsWith(rootDir)) {
421
+ clearModuleCache(child.id, rootDir, visited);
422
+ }
423
+ }
424
+ delete __require.cache[resolvedPath];
425
+ }
426
+ function resolveModule(modulePath, rootDir) {
427
+ clearModuleCache(modulePath, rootDir);
411
428
  return __require(modulePath);
412
429
  }
413
430
  async function resolveHead(candidate, context) {
@@ -494,7 +511,7 @@ function createFileRouter(options) {
494
511
  message,
495
512
  payload
496
513
  };
497
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
514
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
498
515
  if (!fs.existsSync(errorPath)) {
499
516
  const fallback = /* @__PURE__ */ jsxs("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
500
517
  /* @__PURE__ */ jsx("h1", { children: statusCode }),
@@ -508,7 +525,7 @@ function createFileRouter(options) {
508
525
  }
509
526
  };
510
527
  }
511
- const errorModule = resolveModule(errorPath);
528
+ const errorModule = resolveModule(errorPath, pagesDir);
512
529
  const errorNode = await errorModule.default(errorProps);
513
530
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
514
531
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -557,7 +574,10 @@ function createFileRouter(options) {
557
574
  message: `Invalid middleware '${middlewareNames[0]}'`
558
575
  });
559
576
  }
560
- const middlewareModule = resolveModule(middlewaresPath);
577
+ const middlewareModule = resolveModule(
578
+ middlewaresPath,
579
+ pagesDir
580
+ );
561
581
  const registry = middlewareModule.middlewares;
562
582
  if (!registry) {
563
583
  if (!requiresNamedMiddleware) {
@@ -612,8 +632,8 @@ function createFileRouter(options) {
612
632
  params: match.params
613
633
  };
614
634
  activeContext = context;
615
- const pageModule = resolveModule(match.entry.filePath);
616
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
635
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
636
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
617
637
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
618
638
  activeContext = middlewareContext;
619
639
  const pageData = await resolvePageData(pageModule, middlewareContext);
package/dist/router.cjs CHANGED
@@ -300,8 +300,25 @@ function renderHeadToString(head) {
300
300
  }
301
301
  return tags.join("\n");
302
302
  }
303
- function resolveModule(modulePath) {
304
- delete require.cache[modulePath];
303
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
304
+ const resolvedPath = require.resolve(modulePath);
305
+ if (visited.has(resolvedPath)) {
306
+ return;
307
+ }
308
+ visited.add(resolvedPath);
309
+ const cachedModule = require.cache[resolvedPath];
310
+ if (!cachedModule) {
311
+ return;
312
+ }
313
+ for (const child of cachedModule.children) {
314
+ if (child.id.startsWith(rootDir)) {
315
+ clearModuleCache(child.id, rootDir, visited);
316
+ }
317
+ }
318
+ delete require.cache[resolvedPath];
319
+ }
320
+ function resolveModule(modulePath, rootDir) {
321
+ clearModuleCache(modulePath, rootDir);
305
322
  return require(modulePath);
306
323
  }
307
324
  async function resolveHead(candidate, context) {
@@ -388,7 +405,7 @@ function createFileRouter(options) {
388
405
  message,
389
406
  payload
390
407
  };
391
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
408
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
392
409
  if (!import_node_fs.default.existsSync(errorPath)) {
393
410
  const fallback = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
394
411
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: statusCode }),
@@ -402,7 +419,7 @@ function createFileRouter(options) {
402
419
  }
403
420
  };
404
421
  }
405
- const errorModule = resolveModule(errorPath);
422
+ const errorModule = resolveModule(errorPath, pagesDir);
406
423
  const errorNode = await errorModule.default(errorProps);
407
424
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
408
425
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -451,7 +468,10 @@ function createFileRouter(options) {
451
468
  message: `Invalid middleware '${middlewareNames[0]}'`
452
469
  });
453
470
  }
454
- const middlewareModule = resolveModule(middlewaresPath);
471
+ const middlewareModule = resolveModule(
472
+ middlewaresPath,
473
+ pagesDir
474
+ );
455
475
  const registry = middlewareModule.middlewares;
456
476
  if (!registry) {
457
477
  if (!requiresNamedMiddleware) {
@@ -506,8 +526,8 @@ function createFileRouter(options) {
506
526
  params: match.params
507
527
  };
508
528
  activeContext = context;
509
- const pageModule = resolveModule(match.entry.filePath);
510
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
529
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
530
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
511
531
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
512
532
  activeContext = middlewareContext;
513
533
  const pageData = await resolvePageData(pageModule, middlewareContext);
package/dist/router.js CHANGED
@@ -270,8 +270,25 @@ function renderHeadToString(head) {
270
270
  }
271
271
  return tags.join("\n");
272
272
  }
273
- function resolveModule(modulePath) {
274
- delete __require.cache[modulePath];
273
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
274
+ const resolvedPath = __require.resolve(modulePath);
275
+ if (visited.has(resolvedPath)) {
276
+ return;
277
+ }
278
+ visited.add(resolvedPath);
279
+ const cachedModule = __require.cache[resolvedPath];
280
+ if (!cachedModule) {
281
+ return;
282
+ }
283
+ for (const child of cachedModule.children) {
284
+ if (child.id.startsWith(rootDir)) {
285
+ clearModuleCache(child.id, rootDir, visited);
286
+ }
287
+ }
288
+ delete __require.cache[resolvedPath];
289
+ }
290
+ function resolveModule(modulePath, rootDir) {
291
+ clearModuleCache(modulePath, rootDir);
275
292
  return __require(modulePath);
276
293
  }
277
294
  async function resolveHead(candidate, context) {
@@ -358,7 +375,7 @@ function createFileRouter(options) {
358
375
  message,
359
376
  payload
360
377
  };
361
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
378
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
362
379
  if (!fs.existsSync(errorPath)) {
363
380
  const fallback = /* @__PURE__ */ jsxs("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
364
381
  /* @__PURE__ */ jsx("h1", { children: statusCode }),
@@ -372,7 +389,7 @@ function createFileRouter(options) {
372
389
  }
373
390
  };
374
391
  }
375
- const errorModule = resolveModule(errorPath);
392
+ const errorModule = resolveModule(errorPath, pagesDir);
376
393
  const errorNode = await errorModule.default(errorProps);
377
394
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
378
395
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -421,7 +438,10 @@ function createFileRouter(options) {
421
438
  message: `Invalid middleware '${middlewareNames[0]}'`
422
439
  });
423
440
  }
424
- const middlewareModule = resolveModule(middlewaresPath);
441
+ const middlewareModule = resolveModule(
442
+ middlewaresPath,
443
+ pagesDir
444
+ );
425
445
  const registry = middlewareModule.middlewares;
426
446
  if (!registry) {
427
447
  if (!requiresNamedMiddleware) {
@@ -476,8 +496,8 @@ function createFileRouter(options) {
476
496
  params: match.params
477
497
  };
478
498
  activeContext = context;
479
- const pageModule = resolveModule(match.entry.filePath);
480
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
499
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
500
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
481
501
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
482
502
  activeContext = middlewareContext;
483
503
  const pageData = await resolvePageData(pageModule, middlewareContext);
@@ -412,8 +412,25 @@ function renderHeadToString(head) {
412
412
  }
413
413
  return tags.join("\n");
414
414
  }
415
- function resolveModule(modulePath) {
416
- delete require.cache[modulePath];
415
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
416
+ const resolvedPath = require.resolve(modulePath);
417
+ if (visited.has(resolvedPath)) {
418
+ return;
419
+ }
420
+ visited.add(resolvedPath);
421
+ const cachedModule = require.cache[resolvedPath];
422
+ if (!cachedModule) {
423
+ return;
424
+ }
425
+ for (const child of cachedModule.children) {
426
+ if (child.id.startsWith(rootDir)) {
427
+ clearModuleCache(child.id, rootDir, visited);
428
+ }
429
+ }
430
+ delete require.cache[resolvedPath];
431
+ }
432
+ function resolveModule(modulePath, rootDir) {
433
+ clearModuleCache(modulePath, rootDir);
417
434
  return require(modulePath);
418
435
  }
419
436
  async function resolveHead(candidate, context) {
@@ -500,7 +517,7 @@ function createFileRouter(options) {
500
517
  message,
501
518
  payload
502
519
  };
503
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
520
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
504
521
  if (!import_node_fs.default.existsSync(errorPath)) {
505
522
  const fallback = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
506
523
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: statusCode }),
@@ -514,7 +531,7 @@ function createFileRouter(options) {
514
531
  }
515
532
  };
516
533
  }
517
- const errorModule = resolveModule(errorPath);
534
+ const errorModule = resolveModule(errorPath, pagesDir);
518
535
  const errorNode = await errorModule.default(errorProps);
519
536
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
520
537
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -563,7 +580,10 @@ function createFileRouter(options) {
563
580
  message: `Invalid middleware '${middlewareNames[0]}'`
564
581
  });
565
582
  }
566
- const middlewareModule = resolveModule(middlewaresPath);
583
+ const middlewareModule = resolveModule(
584
+ middlewaresPath,
585
+ pagesDir
586
+ );
567
587
  const registry = middlewareModule.middlewares;
568
588
  if (!registry) {
569
589
  if (!requiresNamedMiddleware) {
@@ -618,8 +638,8 @@ function createFileRouter(options) {
618
638
  params: match.params
619
639
  };
620
640
  activeContext = context;
621
- const pageModule = resolveModule(match.entry.filePath);
622
- const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
641
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
642
+ const layoutModule = import_node_fs.default.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
623
643
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
624
644
  activeContext = middlewareContext;
625
645
  const pageData = await resolvePageData(pageModule, middlewareContext);
@@ -384,8 +384,25 @@ function renderHeadToString(head) {
384
384
  }
385
385
  return tags.join("\n");
386
386
  }
387
- function resolveModule(modulePath) {
388
- delete __require.cache[modulePath];
387
+ function clearModuleCache(modulePath, rootDir, visited = /* @__PURE__ */ new Set()) {
388
+ const resolvedPath = __require.resolve(modulePath);
389
+ if (visited.has(resolvedPath)) {
390
+ return;
391
+ }
392
+ visited.add(resolvedPath);
393
+ const cachedModule = __require.cache[resolvedPath];
394
+ if (!cachedModule) {
395
+ return;
396
+ }
397
+ for (const child of cachedModule.children) {
398
+ if (child.id.startsWith(rootDir)) {
399
+ clearModuleCache(child.id, rootDir, visited);
400
+ }
401
+ }
402
+ delete __require.cache[resolvedPath];
403
+ }
404
+ function resolveModule(modulePath, rootDir) {
405
+ clearModuleCache(modulePath, rootDir);
389
406
  return __require(modulePath);
390
407
  }
391
408
  async function resolveHead(candidate, context) {
@@ -472,7 +489,7 @@ function createFileRouter(options) {
472
489
  message,
473
490
  payload
474
491
  };
475
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
492
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
476
493
  if (!fs.existsSync(errorPath)) {
477
494
  const fallback = /* @__PURE__ */ jsxs("main", { style: { fontFamily: "system-ui, sans-serif", padding: 24 }, children: [
478
495
  /* @__PURE__ */ jsx("h1", { children: statusCode }),
@@ -486,7 +503,7 @@ function createFileRouter(options) {
486
503
  }
487
504
  };
488
505
  }
489
- const errorModule = resolveModule(errorPath);
506
+ const errorModule = resolveModule(errorPath, pagesDir);
490
507
  const errorNode = await errorModule.default(errorProps);
491
508
  const layoutHead = layoutModule ? await resolveHead(layoutModule, context) : void 0;
492
509
  const errorHead = await resolveHead(errorModule, errorProps);
@@ -535,7 +552,10 @@ function createFileRouter(options) {
535
552
  message: `Invalid middleware '${middlewareNames[0]}'`
536
553
  });
537
554
  }
538
- const middlewareModule = resolveModule(middlewaresPath);
555
+ const middlewareModule = resolveModule(
556
+ middlewaresPath,
557
+ pagesDir
558
+ );
539
559
  const registry = middlewareModule.middlewares;
540
560
  if (!registry) {
541
561
  if (!requiresNamedMiddleware) {
@@ -590,8 +610,8 @@ function createFileRouter(options) {
590
610
  params: match.params
591
611
  };
592
612
  activeContext = context;
593
- const pageModule = resolveModule(match.entry.filePath);
594
- const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath) : null;
613
+ const pageModule = resolveModule(match.entry.filePath, pagesDir);
614
+ const layoutModule = fs.existsSync(layoutPath) ? resolveModule(layoutPath, pagesDir) : null;
595
615
  const middlewareContext = await resolveMiddlewares(pageModule.middlewares, context);
596
616
  activeContext = middlewareContext;
597
617
  const pageData = await resolvePageData(pageModule, middlewareContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-react",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "TypeScript React RSC addition for @webtypen/webframez-core",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "author": {