binja 0.8.1 → 0.9.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.
- package/dist/adapters/elysia.d.ts +82 -0
- package/dist/adapters/elysia.js +381 -0
- package/dist/adapters/hono.d.ts +57 -0
- package/dist/adapters/hono.js +389 -0
- package/dist/adapters/index.d.ts +7 -0
- package/package.json +16 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hono Adapter for binja
|
|
3
|
+
* Seamless integration with Hono framework
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { Hono } from 'hono'
|
|
8
|
+
* import { binja } from 'binja/hono'
|
|
9
|
+
*
|
|
10
|
+
* const app = new Hono()
|
|
11
|
+
*
|
|
12
|
+
* app.use(binja({ root: './views' }))
|
|
13
|
+
*
|
|
14
|
+
* app.get('/', (c) => c.render('index', { title: 'Home' }))
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import type { MiddlewareHandler } from 'hono';
|
|
18
|
+
export interface BinjaHonoOptions {
|
|
19
|
+
/** Root directory for templates (default: './views') */
|
|
20
|
+
root?: string;
|
|
21
|
+
/** Default file extension (default: '.html') */
|
|
22
|
+
extension?: string;
|
|
23
|
+
/** Template engine: 'jinja2' | 'handlebars' | 'liquid' | 'twig' (default: 'jinja2') */
|
|
24
|
+
engine?: 'jinja2' | 'handlebars' | 'liquid' | 'twig';
|
|
25
|
+
/** Enable debug panel (default: false) */
|
|
26
|
+
debug?: boolean;
|
|
27
|
+
/** Cache compiled templates (default: true in production) */
|
|
28
|
+
cache?: boolean;
|
|
29
|
+
/** Global context data available in all templates */
|
|
30
|
+
globals?: Record<string, any>;
|
|
31
|
+
/** Layout template name (optional) */
|
|
32
|
+
layout?: string;
|
|
33
|
+
/** Content variable name in layout (default: 'content') */
|
|
34
|
+
contentVar?: string;
|
|
35
|
+
}
|
|
36
|
+
declare module 'hono' {
|
|
37
|
+
interface ContextRenderer {
|
|
38
|
+
(template: string, context?: Record<string, any>): Response | Promise<Response>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create binja middleware for Hono
|
|
43
|
+
*/
|
|
44
|
+
export declare function binja(options?: BinjaHonoOptions): MiddlewareHandler;
|
|
45
|
+
/**
|
|
46
|
+
* Clear template cache
|
|
47
|
+
*/
|
|
48
|
+
export declare function clearCache(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get cache stats
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCacheStats(): {
|
|
53
|
+
size: number;
|
|
54
|
+
keys: string[];
|
|
55
|
+
};
|
|
56
|
+
export default binja;
|
|
57
|
+
//# sourceMappingURL=hono.d.ts.map
|