binja 0.8.0 → 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/dist/cli.js +14 -14
- package/dist/engines/index.d.ts +2 -1
- package/dist/engines/twig/index.d.ts +35 -0
- package/dist/engines/twig/lexer.d.ts +16 -0
- package/dist/engines/twig/parser.d.ts +20 -0
- package/dist/index.js +61 -61
- package/dist/lexer/tokens.d.ts +3 -1
- package/package.json +16 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elysia Adapter for binja
|
|
3
|
+
* Seamless integration with Elysia framework
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { Elysia } from 'elysia'
|
|
8
|
+
* import { binja } from 'binja/elysia'
|
|
9
|
+
*
|
|
10
|
+
* const app = new Elysia()
|
|
11
|
+
* .use(binja({ root: './views' }))
|
|
12
|
+
* .get('/', ({ render }) => render('index', { title: 'Home' }))
|
|
13
|
+
* .listen(3000)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import type { Elysia } from 'elysia';
|
|
17
|
+
export interface BinjaElysiaOptions {
|
|
18
|
+
/** Root directory for templates (default: './views') */
|
|
19
|
+
root?: string;
|
|
20
|
+
/** Default file extension (default: '.html') */
|
|
21
|
+
extension?: string;
|
|
22
|
+
/** Template engine: 'jinja2' | 'handlebars' | 'liquid' | 'twig' (default: 'jinja2') */
|
|
23
|
+
engine?: 'jinja2' | 'handlebars' | 'liquid' | 'twig';
|
|
24
|
+
/** Enable debug panel (default: false) */
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
/** Cache compiled templates (default: true in production) */
|
|
27
|
+
cache?: boolean;
|
|
28
|
+
/** Global context data available in all templates */
|
|
29
|
+
globals?: Record<string, any>;
|
|
30
|
+
/** Layout template name (optional) */
|
|
31
|
+
layout?: string;
|
|
32
|
+
/** Content variable name in layout (default: 'content') */
|
|
33
|
+
contentVar?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create binja plugin for Elysia
|
|
37
|
+
*/
|
|
38
|
+
export declare function binja(options?: BinjaElysiaOptions): (app: Elysia) => Elysia<"", {
|
|
39
|
+
decorator: {};
|
|
40
|
+
store: {};
|
|
41
|
+
derive: {};
|
|
42
|
+
resolve: {};
|
|
43
|
+
}, {
|
|
44
|
+
typebox: {};
|
|
45
|
+
error: {};
|
|
46
|
+
}, {
|
|
47
|
+
schema: {};
|
|
48
|
+
standaloneSchema: {};
|
|
49
|
+
macro: {};
|
|
50
|
+
macroFn: {};
|
|
51
|
+
parser: {};
|
|
52
|
+
response: {};
|
|
53
|
+
}, {}, {
|
|
54
|
+
derive: {};
|
|
55
|
+
resolve: {};
|
|
56
|
+
schema: {};
|
|
57
|
+
standaloneSchema: {};
|
|
58
|
+
response: {};
|
|
59
|
+
}, {
|
|
60
|
+
derive: {
|
|
61
|
+
readonly render: (template: string, context?: Record<string, any>) => Promise<Response>;
|
|
62
|
+
};
|
|
63
|
+
resolve: {};
|
|
64
|
+
schema: {};
|
|
65
|
+
standaloneSchema: {};
|
|
66
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
67
|
+
readonly render: (template: string, context?: Record<string, any>) => Promise<Response>;
|
|
68
|
+
}>;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Clear template cache
|
|
72
|
+
*/
|
|
73
|
+
export declare function clearCache(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Get cache stats
|
|
76
|
+
*/
|
|
77
|
+
export declare function getCacheStats(): {
|
|
78
|
+
size: number;
|
|
79
|
+
keys: string[];
|
|
80
|
+
};
|
|
81
|
+
export default binja;
|
|
82
|
+
//# sourceMappingURL=elysia.d.ts.map
|