bun-plugin-stx 0.2.104 → 0.2.105

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/serve.d.ts CHANGED
@@ -116,6 +116,11 @@ export declare interface ServeOptions {
116
116
  | null
117
117
  | undefined
118
118
  | Promise<Response | Record<string, unknown> | null | undefined>
119
+ onResponse?: (req: Request, response: Response) =>
120
+ | Response
121
+ | null
122
+ | undefined
123
+ | Promise<Response | null | undefined>
119
124
  middleware?: Record<string, MiddlewareHandler>
120
125
  globalMiddleware?: string[]
121
126
  middlewareGroups?: Record<string, string[]>
package/dist/serve.js CHANGED
@@ -10327,7 +10327,13 @@ ${pageSetupScripts.join(`
10327
10327
  activeServeIp = "";
10328
10328
  }
10329
10329
  })();
10330
- return applyI18nToResponse(_i18nResp, i18nLocale ?? (i18nConfig?.defaultLocale ?? "en"), path);
10330
+ const _finalResp = await applyI18nToResponse(_i18nResp, i18nLocale ?? (i18nConfig?.defaultLocale ?? "en"), path);
10331
+ if (options.onResponse) {
10332
+ const hooked = await options.onResponse(req, _finalResp);
10333
+ if (hooked instanceof Response)
10334
+ return hooked;
10335
+ }
10336
+ return _finalResp;
10331
10337
  }
10332
10338
  });
10333
10339
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.104",
4
+ "version": "0.2.105",
5
5
  "description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",