@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/cli.mjs CHANGED
@@ -11323,7 +11323,14 @@ var FilesystemRouteLoader = class {
11323
11323
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.apiRoutes.length === 0) {
11324
11324
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11325
11325
  const fileStats = buildFileStats(files);
11326
- this.cache.apiRoutes = await loadApiRoutes(this.appDir);
11326
+ const apiRoutes = await loadApiRoutes(this.appDir);
11327
+ if (!this.cache) {
11328
+ await this.loadRoutes();
11329
+ if (!this.cache) {
11330
+ throw new Error("Failed to initialize route cache");
11331
+ }
11332
+ }
11333
+ this.cache.apiRoutes = apiRoutes;
11327
11334
  this.cache.fileStats = fileStats;
11328
11335
  this.cache.timestamp = Date.now();
11329
11336
  }
@@ -11340,7 +11347,14 @@ var FilesystemRouteLoader = class {
11340
11347
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.wssRoutes.length === 0) {
11341
11348
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11342
11349
  const fileStats = buildFileStats(files);
11343
- this.cache.wssRoutes = await loadWssRoutes(this.appDir);
11350
+ const wssRoutes = await loadWssRoutes(this.appDir);
11351
+ if (!this.cache) {
11352
+ await this.loadRoutes();
11353
+ if (!this.cache) {
11354
+ throw new Error("Failed to initialize route cache");
11355
+ }
11356
+ }
11357
+ this.cache.wssRoutes = wssRoutes;
11344
11358
  this.cache.fileStats = fileStats;
11345
11359
  this.cache.timestamp = Date.now();
11346
11360
  }
@@ -11357,7 +11371,14 @@ var FilesystemRouteLoader = class {
11357
11371
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.notFoundRoute === void 0) {
11358
11372
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11359
11373
  const fileStats = buildFileStats(files);
11360
- this.cache.notFoundRoute = await loadNotFoundRouteFromFilesystem(this.appDir, this.projectRoot);
11374
+ const notFoundRoute = await loadNotFoundRouteFromFilesystem(this.appDir, this.projectRoot);
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.notFoundRoute = notFoundRoute;
11361
11382
  this.cache.fileStats = fileStats;
11362
11383
  this.cache.timestamp = Date.now();
11363
11384
  }
@@ -11374,7 +11395,14 @@ var FilesystemRouteLoader = class {
11374
11395
  if (hasFilesChanged(this.appDir, this.projectRoot, this.cache.fileStats) || this.cache.errorRoute === void 0) {
11375
11396
  const files = getRelevantFiles(this.appDir, this.projectRoot);
11376
11397
  const fileStats = buildFileStats(files);
11377
- this.cache.errorRoute = await loadErrorRouteFromFilesystem(this.appDir, this.projectRoot);
11398
+ const errorRoute = await loadErrorRouteFromFilesystem(this.appDir, this.projectRoot);
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.errorRoute = errorRoute;
11378
11406
  this.cache.fileStats = fileStats;
11379
11407
  this.cache.timestamp = Date.now();
11380
11408
  }