@noxfly/noxus 3.0.0-dev.8 → 3.0.0-dev.9

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/main.mjs CHANGED
@@ -1086,6 +1086,7 @@ var Router = class {
1086
1086
  this.routes = new RadixTree();
1087
1087
  this.rootMiddlewares = [];
1088
1088
  this.lazyRoutes = /* @__PURE__ */ new Map();
1089
+ this.lazyLoadLock = Promise.resolve();
1089
1090
  }
1090
1091
  // -------------------------------------------------------------------------
1091
1092
  // Registration
@@ -1214,15 +1215,19 @@ var Router = class {
1214
1215
  }
1215
1216
  }
1216
1217
  }
1217
- async loadLazyModule(prefix, entry) {
1218
- const t0 = performance.now();
1219
- InjectorExplorer.beginAccumulate();
1220
- await entry.load?.();
1221
- entry.loading = null;
1222
- entry.load = null;
1223
- await InjectorExplorer.flushAccumulated(entry.guards, entry.middlewares, prefix);
1224
- entry.loaded = true;
1225
- Logger.info(`Lazy-loaded module for prefix {${prefix}} in ${Math.round(performance.now() - t0)}ms`);
1218
+ loadLazyModule(prefix, entry) {
1219
+ const task = this.lazyLoadLock.then(async () => {
1220
+ const t0 = performance.now();
1221
+ InjectorExplorer.beginAccumulate();
1222
+ await entry.load?.();
1223
+ entry.load = null;
1224
+ await InjectorExplorer.flushAccumulated(entry.guards, entry.middlewares, prefix);
1225
+ entry.loaded = true;
1226
+ entry.loading = null;
1227
+ Logger.info(`Lazy-loaded module for prefix {${prefix}} in ${Math.round(performance.now() - t0)}ms`);
1228
+ });
1229
+ this.lazyLoadLock = task;
1230
+ return task;
1226
1231
  }
1227
1232
  // -------------------------------------------------------------------------
1228
1233
  // Pipeline