@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.mjs CHANGED
@@ -11371,7 +11371,14 @@ var FilesystemRouteLoader = class {
11371
11371
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.apiRoutes.length === 0) {
11372
11372
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11373
11373
  const fileStats = buildFileStats(files);
11374
- this.cache.apiRoutes = await loadApiRoutes(this.appDir);
11374
+ const apiRoutes = await loadApiRoutes(this.appDir);
11375
+ if (!this.cache) {
11376
+ await this.loadRoutes();
11377
+ if (!this.cache) {
11378
+ throw new Error("Failed to initialize route cache");
11379
+ }
11380
+ }
11381
+ this.cache.apiRoutes = apiRoutes;
11375
11382
  this.cache.fileStats = fileStats;
11376
11383
  this.cache.timestamp = Date.now();
11377
11384
  }
@@ -11388,7 +11395,14 @@ var FilesystemRouteLoader = class {
11388
11395
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.wssRoutes.length === 0) {
11389
11396
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11390
11397
  const fileStats = buildFileStats(files);
11391
- this.cache.wssRoutes = await loadWssRoutes(this.appDir);
11398
+ const wssRoutes = await loadWssRoutes(this.appDir);
11399
+ if (!this.cache) {
11400
+ await this.loadRoutes();
11401
+ if (!this.cache) {
11402
+ throw new Error("Failed to initialize route cache");
11403
+ }
11404
+ }
11405
+ this.cache.wssRoutes = wssRoutes;
11392
11406
  this.cache.fileStats = fileStats;
11393
11407
  this.cache.timestamp = Date.now();
11394
11408
  }
@@ -11405,7 +11419,14 @@ var FilesystemRouteLoader = class {
11405
11419
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.notFoundRoute === void 0) {
11406
11420
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11407
11421
  const fileStats = buildFileStats(files);
11408
- this.cache.notFoundRoute = await loadNotFoundRouteFromFilesystem(this.appDir, this.projectRoot);
11422
+ const notFoundRoute = await loadNotFoundRouteFromFilesystem(this.appDir, this.projectRoot);
11423
+ if (!this.cache) {
11424
+ await this.loadRoutes();
11425
+ if (!this.cache) {
11426
+ throw new Error("Failed to initialize route cache");
11427
+ }
11428
+ }
11429
+ this.cache.notFoundRoute = notFoundRoute;
11409
11430
  this.cache.fileStats = fileStats;
11410
11431
  this.cache.timestamp = Date.now();
11411
11432
  }
@@ -11422,7 +11443,14 @@ var FilesystemRouteLoader = class {
11422
11443
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.errorRoute === void 0) {
11423
11444
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11424
11445
  const fileStats = buildFileStats(files);
11425
- this.cache.errorRoute = await loadErrorRouteFromFilesystem(this.appDir, this.projectRoot);
11446
+ const errorRoute = await loadErrorRouteFromFilesystem(this.appDir, this.projectRoot);
11447
+ if (!this.cache) {
11448
+ await this.loadRoutes();
11449
+ if (!this.cache) {
11450
+ throw new Error("Failed to initialize route cache");
11451
+ }
11452
+ }
11453
+ this.cache.errorRoute = errorRoute;
11426
11454
  this.cache.fileStats = fileStats;
11427
11455
  this.cache.timestamp = Date.now();
11428
11456
  }