@lolyjs/core 0.2.0-alpha.32 → 0.2.0-alpha.34

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.
@@ -134,6 +134,20 @@ interface WssActions {
134
134
  type RouteMiddleware = (ctx: ServerContext & {
135
135
  theme?: string;
136
136
  }, next: () => Promise<void>) => Promise<void> | void;
137
+ /**
138
+ * Global middleware type for middlewares that run before route matching.
139
+ * These middlewares establish context (ctx.locals) and always execute (both SSR and SPA navigation).
140
+ *
141
+ * @example
142
+ * // global.middleware.ts
143
+ * export const globalMiddlewares: GlobalMiddleware[] = [
144
+ * async (ctx, next) => {
145
+ * ctx.locals.user = await getSession(ctx.req);
146
+ * await next();
147
+ * }
148
+ * ];
149
+ */
150
+ type GlobalMiddleware = (ctx: ServerContext, next: () => Promise<void>) => Promise<void> | void;
137
151
  /**
138
152
  * Result returned by a server loader (getServerSideProps).
139
153
  * @template TProps - Type of props that will be passed to the component (defaults to Record<string, any>)
@@ -263,4 +277,4 @@ interface ApiContext extends BaseContext {
263
277
  */
264
278
  type ApiMiddleware = (ctx: ApiContext, next: () => Promise<void>) => void | Promise<void>;
265
279
 
266
- export { type ApiMiddleware as A, type GenerateStaticParams as G, type LoaderResult as L, type MetadataLoader as M, NotFoundResponse as N, type PageMetadata as P, type RouteMiddleware as R, type ServerContext as S, type WssActions as W, type ApiContext as a, type ServerLoader as b, RedirectResponse as c };
280
+ export { type ApiMiddleware as A, type GlobalMiddleware as G, type LoaderResult as L, type MetadataLoader as M, NotFoundResponse as N, type PageMetadata as P, type RouteMiddleware as R, type ServerContext as S, type WssActions as W, type ApiContext as a, type GenerateStaticParams as b, type ServerLoader as c, RedirectResponse as d };
@@ -134,6 +134,20 @@ interface WssActions {
134
134
  type RouteMiddleware = (ctx: ServerContext & {
135
135
  theme?: string;
136
136
  }, next: () => Promise<void>) => Promise<void> | void;
137
+ /**
138
+ * Global middleware type for middlewares that run before route matching.
139
+ * These middlewares establish context (ctx.locals) and always execute (both SSR and SPA navigation).
140
+ *
141
+ * @example
142
+ * // global.middleware.ts
143
+ * export const globalMiddlewares: GlobalMiddleware[] = [
144
+ * async (ctx, next) => {
145
+ * ctx.locals.user = await getSession(ctx.req);
146
+ * await next();
147
+ * }
148
+ * ];
149
+ */
150
+ type GlobalMiddleware = (ctx: ServerContext, next: () => Promise<void>) => Promise<void> | void;
137
151
  /**
138
152
  * Result returned by a server loader (getServerSideProps).
139
153
  * @template TProps - Type of props that will be passed to the component (defaults to Record<string, any>)
@@ -263,4 +277,4 @@ interface ApiContext extends BaseContext {
263
277
  */
264
278
  type ApiMiddleware = (ctx: ApiContext, next: () => Promise<void>) => void | Promise<void>;
265
279
 
266
- export { type ApiMiddleware as A, type GenerateStaticParams as G, type LoaderResult as L, type MetadataLoader as M, NotFoundResponse as N, type PageMetadata as P, type RouteMiddleware as R, type ServerContext as S, type WssActions as W, type ApiContext as a, type ServerLoader as b, RedirectResponse as c };
280
+ export { type ApiMiddleware as A, type GlobalMiddleware as G, type LoaderResult as L, type MetadataLoader as M, NotFoundResponse as N, type PageMetadata as P, type RouteMiddleware as R, type ServerContext as S, type WssActions as W, type ApiContext as a, type GenerateStaticParams as b, type ServerLoader as c, RedirectResponse as d };
@@ -1,4 +1,4 @@
1
- import { P as PageMetadata } from '../index.types-JJ0KjvFU.mjs';
1
+ import { P as PageMetadata } from '../index.types-Duhjyfit.mjs';
2
2
  import 'express';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { P as PageMetadata } from '../index.types-JJ0KjvFU.js';
1
+ import { P as PageMetadata } from '../index.types-Duhjyfit.js';
2
2
  import 'express';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lolyjs/core",
3
- "version": "0.2.0-alpha.32",
3
+ "version": "0.2.0-alpha.34",
4
4
  "author": {
5
5
  "name": "Valentin Menvielle Candia",
6
6
  "url": "https://github.com/MenvielleValen"