@lolyjs/core 0.3.0-alpha.3 → 0.3.0-alpha.4

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/index.cjs CHANGED
@@ -11407,7 +11407,14 @@ var FilesystemRouteLoader = class {
11407
11407
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.apiRoutes.length === 0) {
11408
11408
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11409
11409
  const fileStats = buildFileStats(files);
11410
- this.cache.apiRoutes = await loadApiRoutes(this.appDir);
11410
+ const apiRoutes = await loadApiRoutes(this.appDir);
11411
+ if (!this.cache) {
11412
+ await this.loadRoutes();
11413
+ if (!this.cache) {
11414
+ throw new Error("Failed to initialize route cache");
11415
+ }
11416
+ }
11417
+ this.cache.apiRoutes = apiRoutes;
11411
11418
  this.cache.fileStats = fileStats;
11412
11419
  this.cache.timestamp = Date.now();
11413
11420
  }
@@ -11424,7 +11431,14 @@ var FilesystemRouteLoader = class {
11424
11431
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.wssRoutes.length === 0) {
11425
11432
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11426
11433
  const fileStats = buildFileStats(files);
11427
- this.cache.wssRoutes = await loadWssRoutes(this.appDir);
11434
+ const wssRoutes = await loadWssRoutes(this.appDir);
11435
+ if (!this.cache) {
11436
+ await this.loadRoutes();
11437
+ if (!this.cache) {
11438
+ throw new Error("Failed to initialize route cache");
11439
+ }
11440
+ }
11441
+ this.cache.wssRoutes = wssRoutes;
11428
11442
  this.cache.fileStats = fileStats;
11429
11443
  this.cache.timestamp = Date.now();
11430
11444
  }
@@ -11441,7 +11455,14 @@ var FilesystemRouteLoader = class {
11441
11455
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.notFoundRoute === void 0) {
11442
11456
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11443
11457
  const fileStats = buildFileStats(files);
11444
- this.cache.notFoundRoute = await loadNotFoundRouteFromFilesystem(this.appDir, this.projectRoot);
11458
+ const notFoundRoute = await loadNotFoundRouteFromFilesystem(this.appDir, this.projectRoot);
11459
+ if (!this.cache) {
11460
+ await this.loadRoutes();
11461
+ if (!this.cache) {
11462
+ throw new Error("Failed to initialize route cache");
11463
+ }
11464
+ }
11465
+ this.cache.notFoundRoute = notFoundRoute;
11445
11466
  this.cache.fileStats = fileStats;
11446
11467
  this.cache.timestamp = Date.now();
11447
11468
  }
@@ -11458,7 +11479,14 @@ var FilesystemRouteLoader = class {
11458
11479
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.errorRoute === void 0) {
11459
11480
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11460
11481
  const fileStats = buildFileStats(files);
11461
- this.cache.errorRoute = await loadErrorRouteFromFilesystem(this.appDir, this.projectRoot);
11482
+ const errorRoute = await loadErrorRouteFromFilesystem(this.appDir, this.projectRoot);
11483
+ if (!this.cache) {
11484
+ await this.loadRoutes();
11485
+ if (!this.cache) {
11486
+ throw new Error("Failed to initialize route cache");
11487
+ }
11488
+ }
11489
+ this.cache.errorRoute = errorRoute;
11462
11490
  this.cache.fileStats = fileStats;
11463
11491
  this.cache.timestamp = Date.now();
11464
11492
  }