@adonisjs/http-server 7.2.3 → 7.2.5

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.
@@ -3766,6 +3766,7 @@ function defineNamedMiddleware(collection) {
3766
3766
 
3767
3767
  // src/router/main.ts
3768
3768
  var Router = class extends LookupStore {
3769
+ #commited = false;
3769
3770
  /**
3770
3771
  * Application is needed to resolve string based controller expressions
3771
3772
  */
@@ -3801,6 +3802,14 @@ var Router = class extends LookupStore {
3801
3802
  * Shortcut methods for commonly used route matchers
3802
3803
  */
3803
3804
  matchers = new RouteMatchers();
3805
+ /**
3806
+ * Check if routes have been committed to the store. Once
3807
+ * routes are committed, defining new set of routes will
3808
+ * have no impact
3809
+ */
3810
+ get commited() {
3811
+ return this.#commited;
3812
+ }
3804
3813
  constructor(app, encryption, qsParser) {
3805
3814
  super(encryption, qsParser);
3806
3815
  this.#app = app;
@@ -3963,6 +3972,10 @@ var Router = class extends LookupStore {
3963
3972
  * commit method is called.
3964
3973
  */
3965
3974
  commit() {
3975
+ if (this.#commited) {
3976
+ return;
3977
+ }
3978
+ debug_default("Committing routes to the routes store");
3966
3979
  const routeNamesByDomain = /* @__PURE__ */ new Map();
3967
3980
  toRoutesJSON(this.routes).forEach((route) => {
3968
3981
  if (!routeNamesByDomain.has(route.domain)) {
@@ -3985,6 +3998,7 @@ var Router = class extends LookupStore {
3985
3998
  this.routes = [];
3986
3999
  this.#globalMatchers = {};
3987
4000
  this.#middleware = [];
4001
+ this.#commited = true;
3988
4002
  }
3989
4003
  /**
3990
4004
  * Find route for a given URL, method and optionally domain
@@ -4198,6 +4212,7 @@ function middlewareHandler(resolver, ctx) {
4198
4212
 
4199
4213
  // src/server/main.ts
4200
4214
  var Server = class {
4215
+ #booted = false;
4201
4216
  /**
4202
4217
  * The default error handler to use
4203
4218
  */
@@ -4271,6 +4286,12 @@ var Server = class {
4271
4286
  this.#resolvedErrorHandler.report(error, ctx);
4272
4287
  return this.#resolvedErrorHandler.handle(error, ctx);
4273
4288
  };
4289
+ /**
4290
+ * Check if the server has already been booted
4291
+ */
4292
+ get booted() {
4293
+ return this.#booted;
4294
+ }
4274
4295
  /**
4275
4296
  * Know if async local storage is enabled or not.
4276
4297
  */
@@ -4369,6 +4390,9 @@ var Server = class {
4369
4390
  * - Resolve and construct the error handler.
4370
4391
  */
4371
4392
  async boot() {
4393
+ if (this.#booted) {
4394
+ return;
4395
+ }
4372
4396
  debug_default("booting HTTP server");
4373
4397
  this.#createServerMiddlewareStack();
4374
4398
  this.#router.commit();
@@ -4379,6 +4403,7 @@ var Server = class {
4379
4403
  const moduleExports = await this.#errorHandler();
4380
4404
  this.#resolvedErrorHandler = await this.#app.container.make(moduleExports.default);
4381
4405
  }
4406
+ this.#booted = true;
4382
4407
  }
4383
4408
  /**
4384
4409
  * Set the HTTP server instance used to listen for requests.
@@ -4524,4 +4549,4 @@ export {
4524
4549
  Server,
4525
4550
  defineConfig
4526
4551
  };
4527
- //# sourceMappingURL=chunk-UQEGDK7Z.js.map
4552
+ //# sourceMappingURL=chunk-GCLM3D4C.js.map