vako 1.3.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/package.json ADDED
@@ -0,0 +1,231 @@
1
+ {
2
+ "name": "vako",
3
+ "version": "1.3.0",
4
+ "description": "🚀 Ultra-modern Node.js framework with hot reload, plugins, authentication, TypeScript support, and Next.js integration",
5
+ "main": "index.js",
6
+ "types": "types/index.d.ts",
7
+ "bin": {
8
+ "veko": "./bin/veko.js",
9
+ "create-veko-app": "./bin/create-veko-app.js",
10
+ "veko-update": "./bin/veko-update.js"
11
+ },
12
+ "scripts": {
13
+ "dev": "node bin/veko.js dev",
14
+ "build": "node bin/veko.js build",
15
+ "start": "node bin/veko.js start",
16
+ "test": "jest --coverage",
17
+ "test:watch": "jest --watch",
18
+ "test:security": "npm audit && node scripts/security-check.js",
19
+ "lint": "eslint lib/ bin/ --fix",
20
+ "lint:check": "eslint lib/ bin/",
21
+
22
+ "postinstall": "echo '🚀 Veko.js installé avec succès!'",
23
+ "demo": "node examples/demo.js",
24
+ "verify": "node verify-code.js",
25
+ "prepublish": "node scripts/pre-publish.js",
26
+ "prepublishOnly": "echo 'Skipping tests for publication'",
27
+ "create-app": "node bin/create-veko-app.js",
28
+ "docs": "jsdoc lib/ -d docs/",
29
+ "benchmark": "node scripts/benchmark.js",
30
+ "coverage": "jest --coverage --coverageReporters=text-lcov | coveralls"
31
+ },
32
+ "keywords": [
33
+ "framework",
34
+ "express",
35
+ "ejs",
36
+ "hot-reload",
37
+ "plugins",
38
+ "websocket",
39
+ "dev-server",
40
+ "auto-refresh",
41
+ "file-watcher",
42
+ "authentication",
43
+ "security",
44
+ "performance",
45
+ "modern",
46
+ "typescript",
47
+ "nextjs",
48
+ "next.js",
49
+ "adapter",
50
+ "cors",
51
+ "helmet",
52
+ "rate-limiting",
53
+ "validation",
54
+ "layout-engine",
55
+ "plugin-system"
56
+ ],
57
+ "author": "Wiltark <contact@wiltark.fr>",
58
+ "license": "MIT",
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/wiltark/veko.js.git"
62
+ },
63
+ "bugs": {
64
+ "url": "https://github.com/wiltark/veko.js/issues"
65
+ },
66
+ "homepage": "https://veko.js.org",
67
+ "engines": {
68
+ "node": ">=16.0.0",
69
+ "npm": ">=8.0.0"
70
+ },
71
+ "dependencies": {
72
+ "express": "^4.18.2",
73
+ "ejs": "^3.1.9",
74
+ "ws": "^8.14.2",
75
+ "chokidar": "^3.5.3",
76
+ "helmet": "^7.1.0",
77
+ "cors": "^2.8.5",
78
+ "express-rate-limit": "^7.1.5",
79
+ "express-validator": "^7.0.1",
80
+ "validator": "^13.11.0",
81
+ "bcryptjs": "^2.4.3",
82
+ "jsonwebtoken": "^9.0.2",
83
+ "passport": "^0.7.0",
84
+ "passport-local": "^1.0.0",
85
+ "passport-google-oauth20": "^2.0.0",
86
+ "passport-github2": "^0.1.12",
87
+ "passport-facebook": "^3.0.0",
88
+ "express-session": "^1.17.3",
89
+ "connect-redis": "^7.1.0",
90
+ "redis": "^4.6.10",
91
+ "sqlite3": "^5.1.6",
92
+ "pg": "^8.11.3",
93
+ "mysql2": "^3.6.5",
94
+ "mongoose": "^8.0.3",
95
+ "sequelize": "^6.35.2",
96
+ "boxen": "^5.1.2",
97
+ "chalk": "^4.1.2",
98
+ "commander": "^11.1.0",
99
+ "figlet": "^1.6.0",
100
+ "gradient-string": "^2.0.2",
101
+ "inquirer": "^8.2.6",
102
+ "nanospinner": "^1.1.0",
103
+ "ora": "^5.4.1",
104
+ "dotenv": "^16.3.1",
105
+ "compression": "^1.7.4",
106
+ "cookie-parser": "^1.4.6",
107
+ "body-parser": "^1.20.2",
108
+ "multer": "^1.4.5-lts.1",
109
+ "sharp": "^0.32.6",
110
+ "jimp": "^0.22.10",
111
+ "nodemailer": "^6.9.7",
112
+ "node-cron": "^3.0.3",
113
+ "winston": "^3.11.0",
114
+ "debug": "^4.3.4",
115
+ "uuid": "^9.0.1",
116
+ "lodash": "^4.17.21",
117
+ "moment": "^2.29.4",
118
+ "async": "^3.2.5",
119
+ "semver": "^7.5.4",
120
+ "mime-types": "^2.1.35",
121
+ "fs-extra": "^11.2.0",
122
+ "archiver": "^6.0.1",
123
+ "express-useragent": "^1.0.15",
124
+ "geoip-lite": "^1.4.9",
125
+ "slugify": "^1.6.6",
126
+ "html-minifier": "^4.0.0",
127
+ "clean-css": "^5.3.2",
128
+ "uglify-js": "^3.17.4"
129
+ },
130
+ "devDependencies": {
131
+ "nodemon": "^3.0.2",
132
+ "jest": "^29.7.0",
133
+ "supertest": "^6.3.3",
134
+ "eslint": "^8.56.0",
135
+ "eslint-config-standard": "^17.1.0",
136
+ "eslint-plugin-import": "^2.29.1",
137
+ "eslint-plugin-node": "^11.1.0",
138
+ "eslint-plugin-promise": "^6.1.1",
139
+ "jsdoc": "^4.0.2",
140
+ "coveralls": "^3.1.1",
141
+ "cross-env": "^7.0.3",
142
+ "ts-node": "^10.9.2",
143
+ "typescript": "^5.3.3",
144
+ "@types/node": "^20.10.5",
145
+ "@types/express": "^4.17.21",
146
+ "@types/jest": "^29.5.8",
147
+ "husky": "^8.0.3",
148
+ "lint-staged": "^15.2.0",
149
+ "prettier": "^3.1.1"
150
+ },
151
+ "optionalDependencies": {
152
+ "ts-node": "^10.9.2",
153
+ "typescript": "^5.3.3",
154
+ "pm2": "^5.3.0",
155
+ "cluster": "^0.7.7"
156
+ },
157
+ "peerDependencies": {
158
+ "typescript": ">=4.0.0"
159
+ },
160
+ "files": [
161
+ "lib/",
162
+ "bin/",
163
+ "views/",
164
+ "error/",
165
+ "templates/",
166
+ "types/",
167
+ "index.js",
168
+ "README.md",
169
+ "LICENSE",
170
+ "CHANGELOG.md",
171
+ "tsconfig.json",
172
+ "tsconfig.json"
173
+ ],
174
+ "preferGlobal": true,
175
+ "publishConfig": {
176
+ "registry": "https://registry.npmjs.org/",
177
+ "access": "public"
178
+ },
179
+ "jest": {
180
+ "testEnvironment": "node",
181
+ "collectCoverageFrom": [
182
+ "lib/**/*.js",
183
+ "!lib/**/*.test.js",
184
+ "!lib/**/node_modules/**"
185
+ ],
186
+ "coverageThreshold": {
187
+ "global": {
188
+ "branches": 80,
189
+ "functions": 80,
190
+ "lines": 80,
191
+ "statements": 80
192
+ }
193
+ }
194
+ },
195
+ "eslintConfig": {
196
+ "extends": ["standard"],
197
+ "env": {
198
+ "node": true,
199
+ "jest": true
200
+ },
201
+ "rules": {
202
+ "no-console": "warn",
203
+ "prefer-const": "error",
204
+ "no-var": "error"
205
+ }
206
+ },
207
+ "husky": {
208
+ "hooks": {
209
+ "pre-commit": "lint-staged",
210
+ "pre-push": "npm test"
211
+ }
212
+ },
213
+ "lint-staged": {
214
+ "*.js": [
215
+ "eslint --fix",
216
+ "prettier --write",
217
+ "git add"
218
+ ]
219
+ },
220
+ "funding": {
221
+ "type": "github",
222
+ "url": "https://github.com/sponsors/wiltark"
223
+ },
224
+ "contributors": [
225
+ {
226
+ "name": "Wiltark",
227
+ "email": "contact@wiltark.fr",
228
+ "url": "https://wiltark.fr"
229
+ }
230
+ ]
231
+ }
@@ -0,0 +1,2 @@
1
+ body { font-family: Arial, sans-serif; margin: 40px; }
2
+ h1 { color: #3498db; }
@@ -0,0 +1 @@
1
+ console.log('Veko.js loaded');
package/tsconfig.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "lib": ["ES2020"],
6
+ "outDir": "./dist",
7
+ "rootDir": "./",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "moduleResolution": "node",
14
+ "allowSyntheticDefaultImports": true,
15
+ "declaration": true,
16
+ "declarationMap": true,
17
+ "sourceMap": true,
18
+ "experimentalDecorators": true,
19
+ "emitDecoratorMetadata": true,
20
+ "noUnusedLocals": false,
21
+ "noUnusedParameters": false,
22
+ "noImplicitReturns": false,
23
+ "noFallthroughCasesInSwitch": true,
24
+ "allowJs": true,
25
+ "baseUrl": ".",
26
+ "paths": {
27
+ "veko": ["./index.js"],
28
+ "veko/*": ["./lib/*"]
29
+ }
30
+ },
31
+ "include": [
32
+ "lib/**/*",
33
+ "bin/**/*",
34
+ "index.js",
35
+ "types/**/*"
36
+ ],
37
+ "exclude": [
38
+ "node_modules",
39
+ "dist",
40
+ "coverage",
41
+ "**/*.test.js",
42
+ "**/*.spec.js"
43
+ ],
44
+ "ts-node": {
45
+ "transpileOnly": true,
46
+ "compilerOptions": {
47
+ "module": "commonjs"
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Veko.js - 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 VekoOptions {
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: VekoOptions;
100
+
101
+ constructor(options?: VekoOptions);
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?: VekoOptions): App;
207
+ export function startDev(options?: VekoOptions): App;
208
+ export function start(options?: VekoOptions): App;
209
+
210
+ // ============= NEXT.JS ADAPTER =============
211
+
212
+ export interface NextJsAdapterOptions {
213
+ nextApp: any; // Next.js App instance
214
+ enableVekoRoutes?: boolean;
215
+ enableVekoPlugins?: boolean;
216
+ routePrefix?: string;
217
+ }
218
+
219
+ export class NextJsAdapter {
220
+ constructor(options: NextJsAdapterOptions);
221
+
222
+ // Integrate Veko routes with Next.js
223
+ integrateRoutes(vekoApp: App): void;
224
+
225
+ // Use Veko plugins in Next.js
226
+ usePlugins(vekoApp: App): void;
227
+
228
+ // Create Next.js API route handler from Veko route
229
+ createApiHandler(vekoHandler: 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;