vako 1.3.0 → 1.3.4
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/CHANGELOG.md +63 -63
- package/README.md +311 -1661
- package/bin/commands/setup-executor.js +1 -1
- package/bin/commands/setup.js +10 -10
- package/bin/create-veko-app.js +10 -10
- package/bin/vako.js +188 -0
- package/bin/veko-update.js +15 -15
- package/bin/veko.js +13 -13
- package/error/error.ejs +4 -4
- package/lib/adapters/nextjs-adapter.js +241 -241
- package/lib/app.js +10 -10
- package/lib/core/auth-manager.js +2 -2
- package/lib/core/auto-updater.js +50 -50
- package/lib/core/module-installer.js +2 -2
- package/lib/dev/dev-server.js +3 -3
- package/lib/layout/layout-manager.js +3 -3
- package/lib/plugin-manager.js +2 -2
- package/lib/routing/route-manager.js +3 -3
- package/package.json +12 -13
- package/templates/public/js/main.js +1 -1
- package/tsconfig.json +50 -50
- package/types/index.d.ts +238 -238
package/types/index.d.ts
CHANGED
|
@@ -1,238 +1,238 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* TypeScript definitions
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Express, Request, Response, NextFunction } from 'express';
|
|
7
|
-
|
|
8
|
-
// ============= CORE TYPES =============
|
|
9
|
-
|
|
10
|
-
export interface
|
|
11
|
-
port?: number;
|
|
12
|
-
wsPort?: number;
|
|
13
|
-
viewsDir?: string;
|
|
14
|
-
staticDir?: string;
|
|
15
|
-
routesDir?: string;
|
|
16
|
-
isDev?: boolean;
|
|
17
|
-
watchDirs?: string[];
|
|
18
|
-
errorLog?: string;
|
|
19
|
-
showStack?: boolean;
|
|
20
|
-
autoInstall?: boolean;
|
|
21
|
-
security?: SecurityOptions;
|
|
22
|
-
layouts?: LayoutOptions;
|
|
23
|
-
plugins?: PluginOptions;
|
|
24
|
-
prefetch?: PrefetchOptions;
|
|
25
|
-
autoUpdater?: AutoUpdaterOptions;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface SecurityOptions {
|
|
29
|
-
helmet?: boolean;
|
|
30
|
-
rateLimit?: {
|
|
31
|
-
windowMs: number;
|
|
32
|
-
max: number;
|
|
33
|
-
message?: string;
|
|
34
|
-
};
|
|
35
|
-
cors?: {
|
|
36
|
-
origin?: string[] | boolean;
|
|
37
|
-
credentials?: boolean;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface LayoutOptions {
|
|
42
|
-
enabled?: boolean;
|
|
43
|
-
layoutsDir?: string;
|
|
44
|
-
defaultLayout?: string;
|
|
45
|
-
extension?: string;
|
|
46
|
-
sections?: string[];
|
|
47
|
-
cache?: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface PluginOptions {
|
|
51
|
-
enabled?: boolean;
|
|
52
|
-
autoLoad?: boolean;
|
|
53
|
-
pluginsDir?: string;
|
|
54
|
-
whitelist?: string[];
|
|
55
|
-
supportTypeScript?: boolean;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface PrefetchOptions {
|
|
59
|
-
enabled?: boolean;
|
|
60
|
-
maxConcurrent?: number;
|
|
61
|
-
notifyUser?: boolean;
|
|
62
|
-
cacheRoutes?: boolean;
|
|
63
|
-
prefetchDelay?: number;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface AutoUpdaterOptions {
|
|
67
|
-
enabled?: boolean;
|
|
68
|
-
checkOnStart?: boolean;
|
|
69
|
-
autoUpdate?: boolean;
|
|
70
|
-
updateChannel?: 'stable' | 'beta' | 'alpha';
|
|
71
|
-
securityUpdates?: boolean;
|
|
72
|
-
showNotifications?: boolean;
|
|
73
|
-
backupCount?: number;
|
|
74
|
-
checkInterval?: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// ============= APP CLASS =============
|
|
78
|
-
|
|
79
|
-
export interface RouteHandler {
|
|
80
|
-
(req: Request, res: Response, next?: NextFunction): void | Promise<void>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface RouteHandlers {
|
|
84
|
-
get?: RouteHandler | RouteHandler[];
|
|
85
|
-
post?: RouteHandler | RouteHandler[];
|
|
86
|
-
put?: RouteHandler | RouteHandler[];
|
|
87
|
-
delete?: RouteHandler | RouteHandler[];
|
|
88
|
-
patch?: RouteHandler | RouteHandler[];
|
|
89
|
-
all?: RouteHandler | RouteHandler[];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export class App {
|
|
93
|
-
express: Express;
|
|
94
|
-
app: Express;
|
|
95
|
-
logger: Logger;
|
|
96
|
-
layoutManager: LayoutManager;
|
|
97
|
-
routeManager: RouteManager;
|
|
98
|
-
pluginManager: PluginManager;
|
|
99
|
-
options:
|
|
100
|
-
|
|
101
|
-
constructor(options?:
|
|
102
|
-
|
|
103
|
-
// Route management
|
|
104
|
-
loadRoutes(routesDir?: string): this;
|
|
105
|
-
createRoute(method: string, path: string, handler: RouteHandler | RouteHandler[], options?: any): void;
|
|
106
|
-
deleteRoute(method: string, path: string): void;
|
|
107
|
-
updateRoute(method: string, path: string, handler: RouteHandler): void;
|
|
108
|
-
listRoutes(): Array<{ method: string; path: string }>;
|
|
109
|
-
|
|
110
|
-
// Layout management
|
|
111
|
-
createLayout(name: string, content: string): void;
|
|
112
|
-
deleteLayout(name: string): void;
|
|
113
|
-
listLayouts(): string[];
|
|
114
|
-
reloadLayouts(): void;
|
|
115
|
-
renderWithCustomLayout(res: Response, view: string, layout: string, data?: any): void;
|
|
116
|
-
renderWithoutLayout(res: Response, view: string, data?: any): void;
|
|
117
|
-
|
|
118
|
-
// Plugin management
|
|
119
|
-
loadPlugin(plugin: string | Plugin, config?: any): Promise<void>;
|
|
120
|
-
unloadPlugin(pluginName: string): Promise<void>;
|
|
121
|
-
reloadPlugin(pluginName: string, config?: any): Promise<void>;
|
|
122
|
-
listPlugins(): PluginInfo[];
|
|
123
|
-
|
|
124
|
-
// Logging
|
|
125
|
-
log(type: LogType, message: string, details?: string): void;
|
|
126
|
-
|
|
127
|
-
// Server
|
|
128
|
-
listen(port?: number): void;
|
|
129
|
-
stop(): void;
|
|
130
|
-
|
|
131
|
-
// Middleware
|
|
132
|
-
use(middleware: any): void;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// ============= PLUGIN SYSTEM =============
|
|
136
|
-
|
|
137
|
-
export interface Plugin {
|
|
138
|
-
name: string;
|
|
139
|
-
version: string;
|
|
140
|
-
description?: string;
|
|
141
|
-
author?: string;
|
|
142
|
-
dependencies?: string[];
|
|
143
|
-
defaultConfig?: any;
|
|
144
|
-
|
|
145
|
-
load?(app: App, config: any, context: PluginContext): Promise<void> | void;
|
|
146
|
-
unload?(app: App, config: any): Promise<void> | void;
|
|
147
|
-
activate?(app: App, config: any): Promise<void> | void;
|
|
148
|
-
deactivate?(app: App, config: any): Promise<void> | void;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface PluginContext {
|
|
152
|
-
// Hooks
|
|
153
|
-
hook(hookName: string, callback: Function): void;
|
|
154
|
-
removeHook(hookName: string, callback: Function): void;
|
|
155
|
-
|
|
156
|
-
// Routes and middleware
|
|
157
|
-
addRoute(method: string, path: string, ...handlers: RouteHandler[]): void;
|
|
158
|
-
addMiddleware(middleware: RouteHandler): void;
|
|
159
|
-
addCommand(name: string, handler: Function, description?: string): void;
|
|
160
|
-
|
|
161
|
-
// Logging
|
|
162
|
-
log(type: LogType, message: string, details?: string): void;
|
|
163
|
-
|
|
164
|
-
// Plugin access
|
|
165
|
-
getPlugin(name: string): PluginInfo | undefined;
|
|
166
|
-
listPlugins(): PluginInfo[];
|
|
167
|
-
|
|
168
|
-
// Configuration
|
|
169
|
-
getConfig(): any;
|
|
170
|
-
updateConfig(config: any): void;
|
|
171
|
-
|
|
172
|
-
// Storage
|
|
173
|
-
storage: {
|
|
174
|
-
set(key: string, value: any): void;
|
|
175
|
-
set(data: Record<string, any>): void;
|
|
176
|
-
get(key?: string, defaultValue?: any): any;
|
|
177
|
-
delete(key: string): void;
|
|
178
|
-
clear(): void;
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface PluginInfo {
|
|
183
|
-
name: string;
|
|
184
|
-
version: string;
|
|
185
|
-
loaded: boolean;
|
|
186
|
-
active: boolean;
|
|
187
|
-
config?: any;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export type LogType =
|
|
191
|
-
| 'success'
|
|
192
|
-
| 'error'
|
|
193
|
-
| 'warning'
|
|
194
|
-
| 'info'
|
|
195
|
-
| 'server'
|
|
196
|
-
| 'route'
|
|
197
|
-
| 'dev'
|
|
198
|
-
| 'file'
|
|
199
|
-
| 'reload'
|
|
200
|
-
| 'create'
|
|
201
|
-
| 'delete'
|
|
202
|
-
| 'install';
|
|
203
|
-
|
|
204
|
-
// ============= UTILITY FUNCTIONS =============
|
|
205
|
-
|
|
206
|
-
export function createApp(options?:
|
|
207
|
-
export function startDev(options?:
|
|
208
|
-
export function start(options?:
|
|
209
|
-
|
|
210
|
-
// ============= NEXT.JS ADAPTER =============
|
|
211
|
-
|
|
212
|
-
export interface NextJsAdapterOptions {
|
|
213
|
-
nextApp: any; // Next.js App instance
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
routePrefix?: string;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export class NextJsAdapter {
|
|
220
|
-
constructor(options: NextJsAdapterOptions);
|
|
221
|
-
|
|
222
|
-
// Integrate
|
|
223
|
-
integrateRoutes(
|
|
224
|
-
|
|
225
|
-
// Use
|
|
226
|
-
usePlugins(
|
|
227
|
-
|
|
228
|
-
// Create Next.js API route handler from
|
|
229
|
-
createApiHandler(
|
|
230
|
-
|
|
231
|
-
// Middleware for Next.js
|
|
232
|
-
middleware(): (req: Request, res: Response, next: NextFunction) => void;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// ============= EXPORTS =============
|
|
236
|
-
|
|
237
|
-
export { App, createApp, startDev, start, NextJsAdapter };
|
|
238
|
-
export default App;
|
|
1
|
+
/**
|
|
2
|
+
* Vako - Ultra-modern Node.js framework
|
|
3
|
+
* TypeScript definitions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Express, Request, Response, NextFunction } from 'express';
|
|
7
|
+
|
|
8
|
+
// ============= CORE TYPES =============
|
|
9
|
+
|
|
10
|
+
export interface VakoOptions {
|
|
11
|
+
port?: number;
|
|
12
|
+
wsPort?: number;
|
|
13
|
+
viewsDir?: string;
|
|
14
|
+
staticDir?: string;
|
|
15
|
+
routesDir?: string;
|
|
16
|
+
isDev?: boolean;
|
|
17
|
+
watchDirs?: string[];
|
|
18
|
+
errorLog?: string;
|
|
19
|
+
showStack?: boolean;
|
|
20
|
+
autoInstall?: boolean;
|
|
21
|
+
security?: SecurityOptions;
|
|
22
|
+
layouts?: LayoutOptions;
|
|
23
|
+
plugins?: PluginOptions;
|
|
24
|
+
prefetch?: PrefetchOptions;
|
|
25
|
+
autoUpdater?: AutoUpdaterOptions;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SecurityOptions {
|
|
29
|
+
helmet?: boolean;
|
|
30
|
+
rateLimit?: {
|
|
31
|
+
windowMs: number;
|
|
32
|
+
max: number;
|
|
33
|
+
message?: string;
|
|
34
|
+
};
|
|
35
|
+
cors?: {
|
|
36
|
+
origin?: string[] | boolean;
|
|
37
|
+
credentials?: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface LayoutOptions {
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
layoutsDir?: string;
|
|
44
|
+
defaultLayout?: string;
|
|
45
|
+
extension?: string;
|
|
46
|
+
sections?: string[];
|
|
47
|
+
cache?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface PluginOptions {
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
autoLoad?: boolean;
|
|
53
|
+
pluginsDir?: string;
|
|
54
|
+
whitelist?: string[];
|
|
55
|
+
supportTypeScript?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PrefetchOptions {
|
|
59
|
+
enabled?: boolean;
|
|
60
|
+
maxConcurrent?: number;
|
|
61
|
+
notifyUser?: boolean;
|
|
62
|
+
cacheRoutes?: boolean;
|
|
63
|
+
prefetchDelay?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface AutoUpdaterOptions {
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
checkOnStart?: boolean;
|
|
69
|
+
autoUpdate?: boolean;
|
|
70
|
+
updateChannel?: 'stable' | 'beta' | 'alpha';
|
|
71
|
+
securityUpdates?: boolean;
|
|
72
|
+
showNotifications?: boolean;
|
|
73
|
+
backupCount?: number;
|
|
74
|
+
checkInterval?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ============= APP CLASS =============
|
|
78
|
+
|
|
79
|
+
export interface RouteHandler {
|
|
80
|
+
(req: Request, res: Response, next?: NextFunction): void | Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface RouteHandlers {
|
|
84
|
+
get?: RouteHandler | RouteHandler[];
|
|
85
|
+
post?: RouteHandler | RouteHandler[];
|
|
86
|
+
put?: RouteHandler | RouteHandler[];
|
|
87
|
+
delete?: RouteHandler | RouteHandler[];
|
|
88
|
+
patch?: RouteHandler | RouteHandler[];
|
|
89
|
+
all?: RouteHandler | RouteHandler[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export class App {
|
|
93
|
+
express: Express;
|
|
94
|
+
app: Express;
|
|
95
|
+
logger: Logger;
|
|
96
|
+
layoutManager: LayoutManager;
|
|
97
|
+
routeManager: RouteManager;
|
|
98
|
+
pluginManager: PluginManager;
|
|
99
|
+
options: VakoOptions;
|
|
100
|
+
|
|
101
|
+
constructor(options?: VakoOptions);
|
|
102
|
+
|
|
103
|
+
// Route management
|
|
104
|
+
loadRoutes(routesDir?: string): this;
|
|
105
|
+
createRoute(method: string, path: string, handler: RouteHandler | RouteHandler[], options?: any): void;
|
|
106
|
+
deleteRoute(method: string, path: string): void;
|
|
107
|
+
updateRoute(method: string, path: string, handler: RouteHandler): void;
|
|
108
|
+
listRoutes(): Array<{ method: string; path: string }>;
|
|
109
|
+
|
|
110
|
+
// Layout management
|
|
111
|
+
createLayout(name: string, content: string): void;
|
|
112
|
+
deleteLayout(name: string): void;
|
|
113
|
+
listLayouts(): string[];
|
|
114
|
+
reloadLayouts(): void;
|
|
115
|
+
renderWithCustomLayout(res: Response, view: string, layout: string, data?: any): void;
|
|
116
|
+
renderWithoutLayout(res: Response, view: string, data?: any): void;
|
|
117
|
+
|
|
118
|
+
// Plugin management
|
|
119
|
+
loadPlugin(plugin: string | Plugin, config?: any): Promise<void>;
|
|
120
|
+
unloadPlugin(pluginName: string): Promise<void>;
|
|
121
|
+
reloadPlugin(pluginName: string, config?: any): Promise<void>;
|
|
122
|
+
listPlugins(): PluginInfo[];
|
|
123
|
+
|
|
124
|
+
// Logging
|
|
125
|
+
log(type: LogType, message: string, details?: string): void;
|
|
126
|
+
|
|
127
|
+
// Server
|
|
128
|
+
listen(port?: number): void;
|
|
129
|
+
stop(): void;
|
|
130
|
+
|
|
131
|
+
// Middleware
|
|
132
|
+
use(middleware: any): void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ============= PLUGIN SYSTEM =============
|
|
136
|
+
|
|
137
|
+
export interface Plugin {
|
|
138
|
+
name: string;
|
|
139
|
+
version: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
author?: string;
|
|
142
|
+
dependencies?: string[];
|
|
143
|
+
defaultConfig?: any;
|
|
144
|
+
|
|
145
|
+
load?(app: App, config: any, context: PluginContext): Promise<void> | void;
|
|
146
|
+
unload?(app: App, config: any): Promise<void> | void;
|
|
147
|
+
activate?(app: App, config: any): Promise<void> | void;
|
|
148
|
+
deactivate?(app: App, config: any): Promise<void> | void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface PluginContext {
|
|
152
|
+
// Hooks
|
|
153
|
+
hook(hookName: string, callback: Function): void;
|
|
154
|
+
removeHook(hookName: string, callback: Function): void;
|
|
155
|
+
|
|
156
|
+
// Routes and middleware
|
|
157
|
+
addRoute(method: string, path: string, ...handlers: RouteHandler[]): void;
|
|
158
|
+
addMiddleware(middleware: RouteHandler): void;
|
|
159
|
+
addCommand(name: string, handler: Function, description?: string): void;
|
|
160
|
+
|
|
161
|
+
// Logging
|
|
162
|
+
log(type: LogType, message: string, details?: string): void;
|
|
163
|
+
|
|
164
|
+
// Plugin access
|
|
165
|
+
getPlugin(name: string): PluginInfo | undefined;
|
|
166
|
+
listPlugins(): PluginInfo[];
|
|
167
|
+
|
|
168
|
+
// Configuration
|
|
169
|
+
getConfig(): any;
|
|
170
|
+
updateConfig(config: any): void;
|
|
171
|
+
|
|
172
|
+
// Storage
|
|
173
|
+
storage: {
|
|
174
|
+
set(key: string, value: any): void;
|
|
175
|
+
set(data: Record<string, any>): void;
|
|
176
|
+
get(key?: string, defaultValue?: any): any;
|
|
177
|
+
delete(key: string): void;
|
|
178
|
+
clear(): void;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface PluginInfo {
|
|
183
|
+
name: string;
|
|
184
|
+
version: string;
|
|
185
|
+
loaded: boolean;
|
|
186
|
+
active: boolean;
|
|
187
|
+
config?: any;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type LogType =
|
|
191
|
+
| 'success'
|
|
192
|
+
| 'error'
|
|
193
|
+
| 'warning'
|
|
194
|
+
| 'info'
|
|
195
|
+
| 'server'
|
|
196
|
+
| 'route'
|
|
197
|
+
| 'dev'
|
|
198
|
+
| 'file'
|
|
199
|
+
| 'reload'
|
|
200
|
+
| 'create'
|
|
201
|
+
| 'delete'
|
|
202
|
+
| 'install';
|
|
203
|
+
|
|
204
|
+
// ============= UTILITY FUNCTIONS =============
|
|
205
|
+
|
|
206
|
+
export function createApp(options?: VakoOptions): App;
|
|
207
|
+
export function startDev(options?: VakoOptions): App;
|
|
208
|
+
export function start(options?: VakoOptions): App;
|
|
209
|
+
|
|
210
|
+
// ============= NEXT.JS ADAPTER =============
|
|
211
|
+
|
|
212
|
+
export interface NextJsAdapterOptions {
|
|
213
|
+
nextApp: any; // Next.js App instance
|
|
214
|
+
enableVakoRoutes?: boolean;
|
|
215
|
+
enableVakoPlugins?: boolean;
|
|
216
|
+
routePrefix?: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export class NextJsAdapter {
|
|
220
|
+
constructor(options: NextJsAdapterOptions);
|
|
221
|
+
|
|
222
|
+
// Integrate Vako routes with Next.js
|
|
223
|
+
integrateRoutes(vakoApp: App): void;
|
|
224
|
+
|
|
225
|
+
// Use Vako plugins in Next.js
|
|
226
|
+
usePlugins(vakoApp: App): void;
|
|
227
|
+
|
|
228
|
+
// Create Next.js API route handler from Vako route
|
|
229
|
+
createApiHandler(vakoHandler: RouteHandler): (req: Request, res: Response) => Promise<void>;
|
|
230
|
+
|
|
231
|
+
// Middleware for Next.js
|
|
232
|
+
middleware(): (req: Request, res: Response, next: NextFunction) => void;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// ============= EXPORTS =============
|
|
236
|
+
|
|
237
|
+
export { App, createApp, startDev, start, NextJsAdapter };
|
|
238
|
+
export default App;
|