barejs 0.1.45 → 0.1.48

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.
@@ -9,10 +9,11 @@ export interface NotFoundResponse {
9
9
  export declare class BareJS extends BareRouter {
10
10
  private tree;
11
11
  private pool;
12
- private poolIdx;
13
12
  private hotFetch?;
14
13
  private compiled;
15
14
  private poolMask;
15
+ private _useLog;
16
+ useLog(enabled?: boolean): this;
16
17
  constructor(poolSize?: number);
17
18
  private notFoundHandler;
18
19
  setNotFound(handler: () => NotFoundResponse): void;
@@ -11,6 +11,7 @@ export declare class Context {
11
11
  _headers?: Record<string, string> | undefined;
12
12
  store: Map<string, any>;
13
13
  body: any;
14
+ query: Record<string, string>;
14
15
  constructor();
15
16
  jsonBody(): Promise<any>;
16
17
  reset(req: Request): this;
@@ -19,4 +20,5 @@ export declare class Context {
19
20
  set(key: string, value: any): this;
20
21
  get(key: string): any;
21
22
  setHeader(name: string, value: string): this;
23
+ send(message: string, extra?: Record<string, any>): Response;
22
24
  }
@@ -3,11 +3,7 @@ type HandlersChain = (Middleware | Handler)[];
3
3
  export declare class BareRouter {
4
4
  prefix: string;
5
5
  groupMiddleware: any[];
6
- routes: {
7
- method: string;
8
- path: string;
9
- handlers: any[];
10
- }[];
6
+ routes: any[];
11
7
  constructor(prefix?: string, groupMiddleware?: any[]);
12
8
  private _add;
13
9
  get: (path: string, ...h: HandlersChain) => this;
@@ -16,10 +12,6 @@ export declare class BareRouter {
16
12
  patch: (path: string, ...h: HandlersChain) => this;
17
13
  delete: (path: string, ...h: HandlersChain) => this;
18
14
  group: (path: string, ...args: any[]) => this;
19
- /**
20
- * 🔗 Use: Mounts a router or middleware
21
- * Supports nested routers with automatic path prefixing
22
- */
23
15
  use(mw: any): this;
24
16
  }
25
17
  export {};
@@ -16,7 +16,6 @@ import { Type } from "@sinclair/typebox";
16
16
  export { Type, Type as T, Type as TypeBox };
17
17
  import { typebox, zod, native, validate, Z } from './security/validators';
18
18
  export { typebox, typebox as t, zod, zod as z, Z, Z as Zod, native, native as n, validate, validate as v };
19
- export { logger } from './utils/logger';
20
19
  export { cors } from './security/cors';
21
20
  export { staticFile } from './utils/static';
22
21
  export { BareRouter } from './core/router';
@@ -5,9 +5,9 @@ import type { Next } from '../core/context';
5
5
  export declare const createToken: (payload: object, secret: string) => Promise<string>;
6
6
  /**
7
7
  * 1. BARE TOKEN AUTH (Standard JWT Middleware)
8
- * High-performance JWT alternative for BareJS
8
+ * High-performance, constant-time JWT middleware for BareJS
9
9
  */
10
- export declare const bareAuth: (secret: string) => (ctx: any, next: any) => Promise<any>;
10
+ export declare const bareAuth: (secret: string) => (ctx: any, next: any) => any;
11
11
  /**
12
12
  * 2. BASIC AUTH
13
13
  * Useful for internal tools and simple admin panels
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barejs",
3
- "version": "0.1.45",
3
+ "version": "0.1.48",
4
4
  "author": "xarhang",
5
5
  "description": "High-performance JIT-specialized web framework for Bun",
6
6
  "main": "./dist/index.js",