bun-plugin-stx 0.2.371 → 0.2.372

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
@@ -1,3 +1,4 @@
1
+ import { serve as bunServe } from 'bun';
1
2
  import type { MiddlewareContext, MiddlewareHandler, MiddlewareRequest, PageMiddleware, PrepareMiddlewareRequest } from './page-middleware';
2
3
  export type { MiddlewareContext, MiddlewareDefinition, MiddlewareHandler, MiddlewareRequest, PageMiddleware, PrepareMiddlewareRequest } from './page-middleware';
3
4
  /**
@@ -347,7 +348,7 @@ export declare interface ServeOptions {
347
348
  i18n?: import('@stacksjs/stx').ResolvedI18n
348
349
  site?: import('@stacksjs/stx').SiteConfig
349
350
  routes?: Record<string, (req: Request) => Response | Promise<Response>>
350
- onRequest?: (req: Request) =>
351
+ onRequest?: (req: Request, server: ServeServer) =>
351
352
  | Response
352
353
  | Record<string, unknown>
353
354
  | null
@@ -381,3 +382,5 @@ export declare interface ServeOptions {
381
382
  * `cwcss-crosswind.d.ts`). `typeof import` cannot drift from the real engine.
382
383
  */
383
384
  declare type CssEngine = Pick<typeof import('@stacksjs/ts-css/engine'), 'CSSGenerator' | 'config'>;
385
+ /** The Bun server `serve()` started - handed to `onRequest` beside each request. */
386
+ export type ServeServer = ReturnType<typeof bunServe>;
package/dist/serve.js CHANGED
@@ -10662,7 +10662,7 @@ ${block}`;
10662
10662
  return new Response(content2, { headers });
10663
10663
  }
10664
10664
  if (options.onRequest) {
10665
- const hookResult = await options.onRequest(req);
10665
+ const hookResult = await options.onRequest(req, server);
10666
10666
  if (hookResult instanceof Response)
10667
10667
  return hookResult;
10668
10668
  if (hookResult && typeof hookResult === "object")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.371",
4
+ "version": "0.2.372",
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",
@@ -74,7 +74,7 @@
74
74
  "typecheck": "bun tsc --noEmit"
75
75
  },
76
76
  "dependencies": {
77
- "@stacksjs/stx": "0.2.371",
78
- "stx-router": "0.2.371"
77
+ "@stacksjs/stx": "0.2.372",
78
+ "stx-router": "0.2.372"
79
79
  }
80
80
  }