@lolyjs/core 0.2.0-alpha.14 → 0.2.0-alpha.16
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/README.md +1016 -755
- package/dist/{bootstrap-DgvWWDim.d.mts → bootstrap-BfGTMUkj.d.mts} +12 -0
- package/dist/{bootstrap-DgvWWDim.d.ts → bootstrap-BfGTMUkj.d.ts} +12 -0
- package/dist/cli.cjs +4389 -2972
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4385 -2968
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +2225 -560
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +9 -75
- package/dist/index.d.ts +9 -75
- package/dist/index.js +2226 -561
- package/dist/index.js.map +1 -1
- package/dist/index.types-BPX6IVAC.d.mts +198 -0
- package/dist/index.types-BPX6IVAC.d.ts +198 -0
- package/dist/react/cache.cjs.map +1 -1
- package/dist/react/cache.d.mts +22 -2
- package/dist/react/cache.d.ts +22 -2
- package/dist/react/cache.js.map +1 -1
- package/dist/react/components.cjs.map +1 -1
- package/dist/react/components.js.map +1 -1
- package/dist/react/hooks.cjs.map +1 -1
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/sockets.cjs.map +1 -1
- package/dist/react/sockets.js.map +1 -1
- package/dist/runtime.cjs +359 -95
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +359 -95
- package/dist/runtime.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { c as bootstrapClient } from './bootstrap-DgvWWDim.mjs';
|
|
2
|
+
export { a as ApiContext, A as ApiMiddleware, G as GenerateStaticParams, L as LoaderResult, M as MetadataLoader, R as RouteMiddleware, S as ServerContext, b as ServerLoader, W as WssContext } from './index.types-BPX6IVAC.mjs';
|
|
3
|
+
export { c as bootstrapClient } from './bootstrap-BfGTMUkj.mjs';
|
|
5
4
|
import { ZodSchema, z } from 'zod';
|
|
6
5
|
import * as express_rate_limit from 'express-rate-limit';
|
|
7
6
|
import pino, { Logger as Logger$1 } from 'pino';
|
|
7
|
+
import { Request, Response } from 'express';
|
|
8
|
+
import 'socket.io';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Framework configuration interface.
|
|
@@ -63,6 +64,7 @@ declare const DEFAULT_CONFIG: FrameworkConfig;
|
|
|
63
64
|
*
|
|
64
65
|
* @param projectRoot - Root directory of the project
|
|
65
66
|
* @returns Framework configuration
|
|
67
|
+
* @throws ConfigValidationError if configuration is invalid
|
|
66
68
|
*/
|
|
67
69
|
declare function loadConfig(projectRoot: string): FrameworkConfig;
|
|
68
70
|
/**
|
|
@@ -119,77 +121,6 @@ interface InitServerData {
|
|
|
119
121
|
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
type GenerateStaticParams = () => Array<Record<string, string>> | Promise<Array<Record<string, string>>>;
|
|
123
|
-
interface ServerContext {
|
|
124
|
-
req: Request;
|
|
125
|
-
res: Response;
|
|
126
|
-
params: Record<string, string>;
|
|
127
|
-
pathname: string;
|
|
128
|
-
locals: Record<string, any>;
|
|
129
|
-
}
|
|
130
|
-
interface WssActions {
|
|
131
|
-
/**
|
|
132
|
-
* Emit an event to all clients in the namespace
|
|
133
|
-
*/
|
|
134
|
-
emit: (event: string, ...args: any[]) => void;
|
|
135
|
-
/**
|
|
136
|
-
* Emit an event to a specific socket by Socket.IO socket ID
|
|
137
|
-
*/
|
|
138
|
-
emitTo: (socketId: string, event: string, ...args: any[]) => void;
|
|
139
|
-
/**
|
|
140
|
-
* Emit an event to a specific client by custom clientId
|
|
141
|
-
* Requires clientId to be stored in socket.data.clientId during connection
|
|
142
|
-
*/
|
|
143
|
-
emitToClient: (clientId: string, event: string, ...args: any[]) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Broadcast an event to all clients in the namespace except the sender
|
|
146
|
-
*/
|
|
147
|
-
broadcast: (event: string, ...args: any[]) => void;
|
|
148
|
-
}
|
|
149
|
-
interface WssContext {
|
|
150
|
-
socket: Socket;
|
|
151
|
-
io: Server;
|
|
152
|
-
params: Record<string, string>;
|
|
153
|
-
pathname: string;
|
|
154
|
-
data?: any;
|
|
155
|
-
actions: WssActions;
|
|
156
|
-
}
|
|
157
|
-
type RouteMiddleware = (ctx: ServerContext & {
|
|
158
|
-
theme?: string;
|
|
159
|
-
}, next: () => Promise<void>) => Promise<void> | void;
|
|
160
|
-
interface LoaderResult {
|
|
161
|
-
props?: Record<string, any>;
|
|
162
|
-
redirect?: {
|
|
163
|
-
destination: string;
|
|
164
|
-
permanent?: boolean;
|
|
165
|
-
};
|
|
166
|
-
notFound?: boolean;
|
|
167
|
-
metadata?: PageMetadata | null;
|
|
168
|
-
className?: string;
|
|
169
|
-
theme?: string;
|
|
170
|
-
}
|
|
171
|
-
type ServerLoader = (ctx: ServerContext) => Promise<LoaderResult>;
|
|
172
|
-
interface PageMetadata {
|
|
173
|
-
title?: string;
|
|
174
|
-
description?: string;
|
|
175
|
-
metaTags?: {
|
|
176
|
-
name?: string;
|
|
177
|
-
property?: string;
|
|
178
|
-
content: string;
|
|
179
|
-
}[];
|
|
180
|
-
}
|
|
181
|
-
type MetadataLoader = (ctx: ServerContext) => PageMetadata | Promise<PageMetadata>;
|
|
182
|
-
interface ApiContext {
|
|
183
|
-
req: Request;
|
|
184
|
-
res: Response;
|
|
185
|
-
Response: (body?: any, status?: number) => Response<any, Record<string, any>>;
|
|
186
|
-
NotFound: (body?: any) => Response<any, Record<string, any>>;
|
|
187
|
-
params: Record<string, string>;
|
|
188
|
-
pathname: string;
|
|
189
|
-
locals: Record<string, any>;
|
|
190
|
-
}
|
|
191
|
-
type ApiMiddleware = (ctx: ApiContext, next: () => Promise<void>) => void | Promise<void>;
|
|
192
|
-
|
|
193
124
|
interface ServerConfig {
|
|
194
125
|
bodyLimit?: string;
|
|
195
126
|
corsOrigin?: string | string[] | boolean | ((origin: string | undefined, callback: (err: Error | null, allow?: boolean) => void) => void);
|
|
@@ -332,12 +263,15 @@ interface RateLimitConfig {
|
|
|
332
263
|
legacyHeaders?: boolean;
|
|
333
264
|
skipSuccessfulRequests?: boolean;
|
|
334
265
|
skipFailedRequests?: boolean;
|
|
266
|
+
keyGenerator?: (req: any) => string;
|
|
267
|
+
skip?: (req: any) => boolean;
|
|
335
268
|
}
|
|
336
269
|
/**
|
|
337
270
|
* Creates a rate limiter middleware with configurable options.
|
|
338
271
|
*
|
|
339
272
|
* @param config - Rate limiting configuration
|
|
340
273
|
* @returns Express rate limit middleware
|
|
274
|
+
* @throws Error if configuration is invalid
|
|
341
275
|
*/
|
|
342
276
|
declare function createRateLimiter(config?: RateLimitConfig): express_rate_limit.RateLimitRequestHandler;
|
|
343
277
|
/**
|
|
@@ -442,4 +376,4 @@ declare function requestLoggerMiddleware(options?: {
|
|
|
442
376
|
*/
|
|
443
377
|
declare function getRequestLogger(req: Request): Logger;
|
|
444
378
|
|
|
445
|
-
export {
|
|
379
|
+
export { DEFAULT_CONFIG, type FrameworkConfig, type InitServerData, type LogLevel, Logger, type LoggerContext, type LoggerOptions, type ServerConfig, ValidationError, buildApp, commonSchemas, createModuleLogger, createRateLimiter, defaultRateLimiter, generateRequestId, getAppDir, getBuildDir, getLogger, getRequestLogger, getStaticDir, lenientRateLimiter, loadConfig, logger, requestLoggerMiddleware, resetLogger, safeValidate, sanitizeObject, sanitizeParams, sanitizeQuery, sanitizeString, setLogger, startDevServer, startProdServer, strictRateLimiter, validate, withCache };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { c as bootstrapClient } from './bootstrap-DgvWWDim.js';
|
|
2
|
+
export { a as ApiContext, A as ApiMiddleware, G as GenerateStaticParams, L as LoaderResult, M as MetadataLoader, R as RouteMiddleware, S as ServerContext, b as ServerLoader, W as WssContext } from './index.types-BPX6IVAC.js';
|
|
3
|
+
export { c as bootstrapClient } from './bootstrap-BfGTMUkj.js';
|
|
5
4
|
import { ZodSchema, z } from 'zod';
|
|
6
5
|
import * as express_rate_limit from 'express-rate-limit';
|
|
7
6
|
import pino, { Logger as Logger$1 } from 'pino';
|
|
7
|
+
import { Request, Response } from 'express';
|
|
8
|
+
import 'socket.io';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Framework configuration interface.
|
|
@@ -63,6 +64,7 @@ declare const DEFAULT_CONFIG: FrameworkConfig;
|
|
|
63
64
|
*
|
|
64
65
|
* @param projectRoot - Root directory of the project
|
|
65
66
|
* @returns Framework configuration
|
|
67
|
+
* @throws ConfigValidationError if configuration is invalid
|
|
66
68
|
*/
|
|
67
69
|
declare function loadConfig(projectRoot: string): FrameworkConfig;
|
|
68
70
|
/**
|
|
@@ -119,77 +121,6 @@ interface InitServerData {
|
|
|
119
121
|
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
type GenerateStaticParams = () => Array<Record<string, string>> | Promise<Array<Record<string, string>>>;
|
|
123
|
-
interface ServerContext {
|
|
124
|
-
req: Request;
|
|
125
|
-
res: Response;
|
|
126
|
-
params: Record<string, string>;
|
|
127
|
-
pathname: string;
|
|
128
|
-
locals: Record<string, any>;
|
|
129
|
-
}
|
|
130
|
-
interface WssActions {
|
|
131
|
-
/**
|
|
132
|
-
* Emit an event to all clients in the namespace
|
|
133
|
-
*/
|
|
134
|
-
emit: (event: string, ...args: any[]) => void;
|
|
135
|
-
/**
|
|
136
|
-
* Emit an event to a specific socket by Socket.IO socket ID
|
|
137
|
-
*/
|
|
138
|
-
emitTo: (socketId: string, event: string, ...args: any[]) => void;
|
|
139
|
-
/**
|
|
140
|
-
* Emit an event to a specific client by custom clientId
|
|
141
|
-
* Requires clientId to be stored in socket.data.clientId during connection
|
|
142
|
-
*/
|
|
143
|
-
emitToClient: (clientId: string, event: string, ...args: any[]) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Broadcast an event to all clients in the namespace except the sender
|
|
146
|
-
*/
|
|
147
|
-
broadcast: (event: string, ...args: any[]) => void;
|
|
148
|
-
}
|
|
149
|
-
interface WssContext {
|
|
150
|
-
socket: Socket;
|
|
151
|
-
io: Server;
|
|
152
|
-
params: Record<string, string>;
|
|
153
|
-
pathname: string;
|
|
154
|
-
data?: any;
|
|
155
|
-
actions: WssActions;
|
|
156
|
-
}
|
|
157
|
-
type RouteMiddleware = (ctx: ServerContext & {
|
|
158
|
-
theme?: string;
|
|
159
|
-
}, next: () => Promise<void>) => Promise<void> | void;
|
|
160
|
-
interface LoaderResult {
|
|
161
|
-
props?: Record<string, any>;
|
|
162
|
-
redirect?: {
|
|
163
|
-
destination: string;
|
|
164
|
-
permanent?: boolean;
|
|
165
|
-
};
|
|
166
|
-
notFound?: boolean;
|
|
167
|
-
metadata?: PageMetadata | null;
|
|
168
|
-
className?: string;
|
|
169
|
-
theme?: string;
|
|
170
|
-
}
|
|
171
|
-
type ServerLoader = (ctx: ServerContext) => Promise<LoaderResult>;
|
|
172
|
-
interface PageMetadata {
|
|
173
|
-
title?: string;
|
|
174
|
-
description?: string;
|
|
175
|
-
metaTags?: {
|
|
176
|
-
name?: string;
|
|
177
|
-
property?: string;
|
|
178
|
-
content: string;
|
|
179
|
-
}[];
|
|
180
|
-
}
|
|
181
|
-
type MetadataLoader = (ctx: ServerContext) => PageMetadata | Promise<PageMetadata>;
|
|
182
|
-
interface ApiContext {
|
|
183
|
-
req: Request;
|
|
184
|
-
res: Response;
|
|
185
|
-
Response: (body?: any, status?: number) => Response<any, Record<string, any>>;
|
|
186
|
-
NotFound: (body?: any) => Response<any, Record<string, any>>;
|
|
187
|
-
params: Record<string, string>;
|
|
188
|
-
pathname: string;
|
|
189
|
-
locals: Record<string, any>;
|
|
190
|
-
}
|
|
191
|
-
type ApiMiddleware = (ctx: ApiContext, next: () => Promise<void>) => void | Promise<void>;
|
|
192
|
-
|
|
193
124
|
interface ServerConfig {
|
|
194
125
|
bodyLimit?: string;
|
|
195
126
|
corsOrigin?: string | string[] | boolean | ((origin: string | undefined, callback: (err: Error | null, allow?: boolean) => void) => void);
|
|
@@ -332,12 +263,15 @@ interface RateLimitConfig {
|
|
|
332
263
|
legacyHeaders?: boolean;
|
|
333
264
|
skipSuccessfulRequests?: boolean;
|
|
334
265
|
skipFailedRequests?: boolean;
|
|
266
|
+
keyGenerator?: (req: any) => string;
|
|
267
|
+
skip?: (req: any) => boolean;
|
|
335
268
|
}
|
|
336
269
|
/**
|
|
337
270
|
* Creates a rate limiter middleware with configurable options.
|
|
338
271
|
*
|
|
339
272
|
* @param config - Rate limiting configuration
|
|
340
273
|
* @returns Express rate limit middleware
|
|
274
|
+
* @throws Error if configuration is invalid
|
|
341
275
|
*/
|
|
342
276
|
declare function createRateLimiter(config?: RateLimitConfig): express_rate_limit.RateLimitRequestHandler;
|
|
343
277
|
/**
|
|
@@ -442,4 +376,4 @@ declare function requestLoggerMiddleware(options?: {
|
|
|
442
376
|
*/
|
|
443
377
|
declare function getRequestLogger(req: Request): Logger;
|
|
444
378
|
|
|
445
|
-
export {
|
|
379
|
+
export { DEFAULT_CONFIG, type FrameworkConfig, type InitServerData, type LogLevel, Logger, type LoggerContext, type LoggerOptions, type ServerConfig, ValidationError, buildApp, commonSchemas, createModuleLogger, createRateLimiter, defaultRateLimiter, generateRequestId, getAppDir, getBuildDir, getLogger, getRequestLogger, getStaticDir, lenientRateLimiter, loadConfig, logger, requestLoggerMiddleware, resetLogger, safeValidate, sanitizeObject, sanitizeParams, sanitizeQuery, sanitizeString, setLogger, startDevServer, startProdServer, strictRateLimiter, validate, withCache };
|