@jsenv/server 17.2.0 → 17.3.0

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.
@@ -4377,6 +4377,13 @@ const createPluginsController = async ({
4377
4377
  getLastPluginUsed: () => lastPluginUsed,
4378
4378
  getCurrentPlugin: () => currentPlugin,
4379
4379
  getCurrentHookName: () => currentHookName,
4380
+ destroyAllPlugins: async () => {
4381
+ for (const plugin of activePlugins) {
4382
+ if (plugin.destroy) {
4383
+ await plugin.destroy();
4384
+ }
4385
+ }
4386
+ },
4380
4387
  };
4381
4388
  };
4382
4389
 
@@ -7445,6 +7452,7 @@ const startServer = async ({
7445
7452
  stopCallbackSet.clear();
7446
7453
  await Promise.all(promises);
7447
7454
  serverPluginsController.callHooks("serverStopped", { reason });
7455
+ await serverPluginsController.destroyAllPlugins();
7448
7456
  status = "stopped";
7449
7457
  stoppedResolve(reason);
7450
7458
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/server",
3
- "version": "17.2.0",
3
+ "version": "17.3.0",
4
4
  "type": "module",
5
5
  "description": "A modern Node.js HTTP server with declarative routing, content negotiation, and WebSocket support",
6
6
  "repository": {
@@ -339,6 +339,13 @@ export const createPluginsController = async ({
339
339
  getLastPluginUsed: () => lastPluginUsed,
340
340
  getCurrentPlugin: () => currentPlugin,
341
341
  getCurrentHookName: () => currentHookName,
342
+ destroyAllPlugins: async () => {
343
+ for (const plugin of activePlugins) {
344
+ if (plugin.destroy) {
345
+ await plugin.destroy();
346
+ }
347
+ }
348
+ },
342
349
  };
343
350
  };
344
351
 
@@ -408,6 +408,7 @@ export const startServer = async ({
408
408
  stopCallbackSet.clear();
409
409
  await Promise.all(promises);
410
410
  serverPluginsController.callHooks("serverStopped", { reason });
411
+ await serverPluginsController.destroyAllPlugins();
411
412
  status = "stopped";
412
413
  stoppedResolve(reason);
413
414
  });