@vercube/core 0.0.48 → 1.0.0-beta.1
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/index.d.mts +580 -170
- package/dist/index.mjs +342 -39
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,27 +1,250 @@
|
|
|
1
1
|
import { Container } from "@vercube/di";
|
|
2
2
|
import { FastResponse, ServerPlugin } from "srvx";
|
|
3
|
-
import { LoggerTypes } from "@vercube/logger";
|
|
3
|
+
import { LoggerTypes, RequestLogger } from "@vercube/logger";
|
|
4
|
+
import { BaseEvlogOptions } from "@vercube/logger/toolkit";
|
|
4
5
|
import { DotenvOptions } from "c12";
|
|
5
6
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
7
|
|
|
7
|
-
//#region src/Services/
|
|
8
|
+
//#region src/Services/Middleware/BaseMiddleware.d.ts
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* BaseMiddleware class that serves as a base for all middleware implementations.
|
|
10
11
|
*/
|
|
11
|
-
declare class
|
|
12
|
+
declare class BaseMiddleware<T = any, U = any> {
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Middleware function that processes the HTTP event.
|
|
15
|
+
* This method should be overridden by subclasses to implement specific middleware logic.
|
|
16
|
+
* WARNING: This method cannot return a value, it will be ignored.
|
|
17
|
+
* Middleware can only modify the event object or throw an HttpError like BadRequestError, ForbiddenError, etc.
|
|
18
|
+
*
|
|
19
|
+
* @param {Request} request - The HTTP Request to process
|
|
20
|
+
* @param {T[]} args - Additional arguments for the middleware.
|
|
21
|
+
* @returns {void | Promise<void>} - A void or a promise that resolves when the processing is complete.
|
|
14
22
|
*/
|
|
15
|
-
|
|
23
|
+
onRequest?(request: Request, response: Response, args: MiddlewareOptions<T>): MaybePromise<void | Response>;
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
25
|
+
* Middleware function that processes the response.
|
|
26
|
+
* This method should be overridden by subclasses to implement specific middleware logic.
|
|
27
|
+
* WARNING: This method cannot return a value, it will be ignored.
|
|
28
|
+
* Middleware can only modify the event object or throw an HttpError like BadRequestError, ForbiddenError, etc.
|
|
29
|
+
*
|
|
30
|
+
* @param {Request} request - The HTTP Request to process
|
|
31
|
+
* @param {Response} response - The HTTP Response to process
|
|
32
|
+
* @returns {void | Promise<void>} - A void or a promise that resolves when the processing is complete.
|
|
20
33
|
*/
|
|
21
|
-
|
|
34
|
+
onResponse?(request: Request, response: Response, payload: U): MaybePromise<void | Response>;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/Types/RouterTypes.d.ts
|
|
38
|
+
declare namespace RouterTypes {
|
|
39
|
+
interface Route {
|
|
40
|
+
path: string;
|
|
41
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'CONNECT' | 'TRACE';
|
|
42
|
+
handler: RouterHandler;
|
|
43
|
+
}
|
|
44
|
+
interface RouteFind {
|
|
45
|
+
path: string;
|
|
46
|
+
method: string;
|
|
47
|
+
}
|
|
48
|
+
interface MiddlewareDefinition {
|
|
49
|
+
middleware: BaseMiddleware<unknown, unknown>;
|
|
50
|
+
target: string;
|
|
51
|
+
priority?: number;
|
|
52
|
+
args?: unknown;
|
|
53
|
+
}
|
|
54
|
+
interface RouterHandler {
|
|
55
|
+
instance: any;
|
|
56
|
+
propertyName: string;
|
|
57
|
+
args: MetadataTypes.Arg[];
|
|
58
|
+
middlewares: {
|
|
59
|
+
beforeMiddlewares: MiddlewareDefinition[];
|
|
60
|
+
afterMiddlewares: MiddlewareDefinition[];
|
|
61
|
+
};
|
|
62
|
+
actions: MetadataTypes.Action[];
|
|
63
|
+
}
|
|
64
|
+
interface RouteMatched<T = unknown> {
|
|
65
|
+
data: T;
|
|
66
|
+
params?: Record<string, string>;
|
|
67
|
+
}
|
|
68
|
+
type RouterEvent = RouterTypes.RouteMatched<RouterTypes.RouterHandler> & {
|
|
69
|
+
request: Request;
|
|
70
|
+
response: Response;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/Types/ValidationTypes.d.ts
|
|
75
|
+
declare namespace ValidationTypes {
|
|
76
|
+
type Schema = StandardSchemaV1;
|
|
77
|
+
type Result<T = any> = StandardSchemaV1.Result<T>;
|
|
78
|
+
type Input<T extends Schema = Schema> = StandardSchemaV1.InferInput<T>;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/Types/MetadataTypes.d.ts
|
|
82
|
+
declare namespace MetadataTypes {
|
|
83
|
+
interface Metadata {
|
|
84
|
+
__metadata: Ctx;
|
|
85
|
+
}
|
|
86
|
+
interface Ctx {
|
|
87
|
+
__controller: {
|
|
88
|
+
path: string;
|
|
89
|
+
};
|
|
90
|
+
__middlewares: Middleware[];
|
|
91
|
+
__methods: Record<string, Method>;
|
|
92
|
+
__meta?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
interface Method {
|
|
95
|
+
req: Request | null;
|
|
96
|
+
res: Response | null;
|
|
97
|
+
url: string | null;
|
|
98
|
+
method: string | null;
|
|
99
|
+
args: Arg[];
|
|
100
|
+
actions: Action[];
|
|
101
|
+
meta: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
interface ResolvedData {
|
|
104
|
+
req: Request | null;
|
|
105
|
+
res: Response | null;
|
|
106
|
+
url: string | null;
|
|
107
|
+
args: Arg[];
|
|
108
|
+
actions: Action[];
|
|
109
|
+
middlewares: Middleware[];
|
|
110
|
+
}
|
|
111
|
+
interface Arg {
|
|
112
|
+
idx: number;
|
|
113
|
+
type: string;
|
|
114
|
+
data?: Record<string, any>;
|
|
115
|
+
resolver?: (event: RouterTypes.RouterEvent) => Promise<unknown>;
|
|
116
|
+
resolved?: unknown;
|
|
117
|
+
validate?: boolean;
|
|
118
|
+
validationSchema?: ValidationTypes.Schema;
|
|
119
|
+
}
|
|
120
|
+
interface Action {
|
|
121
|
+
handler: (req: Request, res: Response) => void | Response | ResponseInit;
|
|
122
|
+
}
|
|
123
|
+
interface Middleware<T = unknown, U = unknown> {
|
|
124
|
+
target: string;
|
|
125
|
+
priority?: number;
|
|
126
|
+
middleware: typeof BaseMiddleware<T, U>;
|
|
127
|
+
args?: unknown;
|
|
128
|
+
}
|
|
129
|
+
interface ResolveUrlParams {
|
|
130
|
+
instance: any;
|
|
131
|
+
path: string;
|
|
132
|
+
propertyName: string;
|
|
133
|
+
}
|
|
22
134
|
}
|
|
23
135
|
//#endregion
|
|
24
|
-
//#region
|
|
136
|
+
//#region src/Types/CommonTypes.d.ts
|
|
137
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
138
|
+
interface MiddlewareOptions<T = any> {
|
|
139
|
+
middlewareArgs?: T;
|
|
140
|
+
methodArgs?: MetadataTypes.Arg[];
|
|
141
|
+
}
|
|
142
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] };
|
|
143
|
+
type RequestHandler = (request: Request) => Promise<Response>;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/Types/Plugin.d.ts
|
|
146
|
+
/**
|
|
147
|
+
* Context passed to `BasePlugin.setupCLI` and object-style plugins' `cli` hook when the CLI loads config.
|
|
148
|
+
*/
|
|
149
|
+
interface VercubePluginCliContext {
|
|
150
|
+
/** Current working directory used to resolve the config file. */
|
|
151
|
+
cwd: string;
|
|
152
|
+
/**
|
|
153
|
+
* Citty subcommand when known (for example `dev`, `build`).
|
|
154
|
+
*/
|
|
155
|
+
command?: string;
|
|
156
|
+
/** Merged configuration after the `config` plugin phase. */
|
|
157
|
+
config: ConfigTypes.Config;
|
|
158
|
+
/** Appends decorated command class constructors to the merged `config.cli.commands` list. */
|
|
159
|
+
register: (...commands: (new () => unknown)[]) => void;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Context passed to `BasePlugin.hooks` and object-style plugins' `hooks` hook in the `vercube dev` parent process only.
|
|
163
|
+
*
|
|
164
|
+
* `hooks` is typed as `unknown` so devkit's `Hookable<DevKitTypes.Hooks>` assigns without pulling `@vercube/devkit` into core.
|
|
165
|
+
*/
|
|
166
|
+
interface VercubePluginHooksContext {
|
|
167
|
+
/** Merged configuration for the dev session. */
|
|
168
|
+
config: ConfigTypes.Config;
|
|
169
|
+
/** Devkit hookable instance (`bundler-watch:*`, `dev:reload`, and related events). */
|
|
170
|
+
hooks: unknown;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Environment passed to plugin `config` and `setup` hooks during config loading and app bootstrap.
|
|
174
|
+
*/
|
|
175
|
+
interface VercubePluginEnv {
|
|
176
|
+
/** Working directory for config resolution and path-relative behavior. */
|
|
177
|
+
cwd: string;
|
|
178
|
+
/** Active CLI subcommand when hooks run in a CLI context. */
|
|
179
|
+
command?: string;
|
|
180
|
+
/** True when configuration is loaded for a development session. */
|
|
181
|
+
dev?: boolean;
|
|
182
|
+
/** True when configuration is loaded for production. */
|
|
183
|
+
production?: boolean;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Object-style plugin with optional lifecycle hooks (config merge, runtime setup, CLI registration, dev hooks).
|
|
187
|
+
*/
|
|
188
|
+
interface VercubePlugin {
|
|
189
|
+
/** Display name for logging and debugging. */
|
|
190
|
+
name?: string;
|
|
191
|
+
/**
|
|
192
|
+
* When the `config` hook runs relative to other plugins.
|
|
193
|
+
* `pre` runs first, `post` runs last; default runs in user order between them.
|
|
194
|
+
*/
|
|
195
|
+
enforce?: 'pre' | 'post';
|
|
196
|
+
/**
|
|
197
|
+
* Merge partial configuration into the resolved config; returned values override previous layers.
|
|
198
|
+
*/
|
|
199
|
+
config?: (config: ConfigTypes.Config, env: VercubePluginEnv) => MaybePromise<void | DeepPartial<ConfigTypes.Config>>;
|
|
200
|
+
/** Worker process: DI bindings, services, controllers. */
|
|
201
|
+
setup?: (app: App, env: VercubePluginEnv) => MaybePromise<void>;
|
|
202
|
+
/** Register CLI command classes (citty / `@vercube/cli`). */
|
|
203
|
+
cli?: (ctx: VercubePluginCliContext) => MaybePromise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Parent process only when running `vercube dev`: subscribe to `ctx.hooks` for bundler and reload events.
|
|
206
|
+
*/
|
|
207
|
+
hooks?: (ctx: VercubePluginHooksContext) => MaybePromise<void>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Resolves `TOptions` from a class that extends `BasePlugin<TOptions>`.
|
|
211
|
+
*
|
|
212
|
+
* @typeParam TClass - Constructor type whose instance extends `BasePlugin`.
|
|
213
|
+
*/
|
|
214
|
+
type InferPluginOptions<TClass extends new (...args: any[]) => BasePlugin<any>> = TClass extends (new (...args: any[]) => BasePlugin<infer O>) ? O : never;
|
|
215
|
+
/**
|
|
216
|
+
* Class-only plugin entry as a tuple, checked with `satisfies` against `BasePlugin` options (no runtime helper).
|
|
217
|
+
*
|
|
218
|
+
* @typeParam TClass - `BasePlugin` subclass constructor.
|
|
219
|
+
*/
|
|
220
|
+
type PluginWithOptions<TClass extends new (...args: any[]) => BasePlugin<any>> = readonly [TClass] | readonly [TClass, InferPluginOptions<TClass>];
|
|
221
|
+
/**
|
|
222
|
+
* Raw values allowed in `defineConfig({ plugins: [...] })` before `normalizeVercubePluginInputs`.
|
|
223
|
+
*
|
|
224
|
+
* Includes resolved plugin objects, promises, factories, bare `BasePlugin` classes, and `[Class, options?]` tuples.
|
|
225
|
+
*/
|
|
226
|
+
type VercubePluginInput = VercubePlugin | MaybePromise<VercubePlugin> | (() => MaybePromise<VercubePlugin>) | (new (...args: unknown[]) => BasePlugin) | [new (...args: unknown[]) => BasePlugin, unknown?];
|
|
227
|
+
/**
|
|
228
|
+
* Convenience aliases for config-time plugin typing (`defineConfig`, tooling).
|
|
229
|
+
*/
|
|
230
|
+
declare namespace PluginTypes {
|
|
231
|
+
/**
|
|
232
|
+
* Any `BasePlugin` subclass constructor.
|
|
233
|
+
*/
|
|
234
|
+
type PluginClass = new (...args: any[]) => BasePlugin;
|
|
235
|
+
/**
|
|
236
|
+
* Class entry as a bare constructor or `[Class, options]` before normalization.
|
|
237
|
+
*/
|
|
238
|
+
type PluginDef = PluginClass | [PluginClass, unknown];
|
|
239
|
+
/**
|
|
240
|
+
* Same union as `VercubePluginInput`: all shapes allowed in `plugins` before resolution.
|
|
241
|
+
*/
|
|
242
|
+
type PluginEntry = VercubePluginInput;
|
|
243
|
+
/** Alias for `VercubePluginCliContext`. */
|
|
244
|
+
type CliContext = VercubePluginCliContext;
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region ../../node_modules/.pnpm/rolldown@1.1.1/node_modules/rolldown/dist/shared/logging-BSNejiLS.d.mts
|
|
25
248
|
//#region src/log/logging.d.ts
|
|
26
249
|
/** @inline */
|
|
27
250
|
type LogLevel = "info" | "debug" | "warn";
|
|
@@ -71,7 +294,7 @@ interface RolldownError extends RolldownLog {
|
|
|
71
294
|
}
|
|
72
295
|
type LogOrStringHandler = (level: LogLevelWithError, log: RolldownLogWithString) => void; //#endregion
|
|
73
296
|
//#endregion
|
|
74
|
-
//#region ../../node_modules/.pnpm/@oxc-project+types@0.
|
|
297
|
+
//#region ../../node_modules/.pnpm/@oxc-project+types@0.135.0/node_modules/@oxc-project/types/types.d.ts
|
|
75
298
|
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
76
299
|
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`.
|
|
77
300
|
interface Program extends Span {
|
|
@@ -1370,7 +1593,7 @@ type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
|
|
|
1370
1593
|
type UpdateOperator = "++" | "--";
|
|
1371
1594
|
type Node = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function$1 | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
|
|
1372
1595
|
//#endregion
|
|
1373
|
-
//#region ../../node_modules/.pnpm/rolldown@1.
|
|
1596
|
+
//#region ../../node_modules/.pnpm/rolldown@1.1.1/node_modules/rolldown/dist/shared/binding-DgGsNpT9.d.mts
|
|
1374
1597
|
interface CodegenOptions {
|
|
1375
1598
|
/**
|
|
1376
1599
|
* Remove whitespace.
|
|
@@ -1378,6 +1601,20 @@ interface CodegenOptions {
|
|
|
1378
1601
|
* @default true
|
|
1379
1602
|
*/
|
|
1380
1603
|
removeWhitespace?: boolean;
|
|
1604
|
+
/**
|
|
1605
|
+
* How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
|
|
1606
|
+
*
|
|
1607
|
+
* * `"none"` - Do not preserve any legal comments.
|
|
1608
|
+
* * `"inline"` - Preserve all legal comments inline.
|
|
1609
|
+
* * `"eof"` - Move all legal comments to the end of the file.
|
|
1610
|
+
* * `"external"` - Extract legal comments without linking.
|
|
1611
|
+
* * `{ linked: "path/to/legal.txt" }` - Extract legal comments and add a link comment to the given path.
|
|
1612
|
+
*
|
|
1613
|
+
* @default "none" (when minifying)
|
|
1614
|
+
*/
|
|
1615
|
+
legalComments?: 'none' | 'inline' | 'eof' | 'external' | {
|
|
1616
|
+
linked: string;
|
|
1617
|
+
};
|
|
1381
1618
|
}
|
|
1382
1619
|
interface CompressOptions {
|
|
1383
1620
|
/**
|
|
@@ -1392,7 +1629,7 @@ interface CompressOptions {
|
|
|
1392
1629
|
*
|
|
1393
1630
|
* @default 'esnext'
|
|
1394
1631
|
*
|
|
1395
|
-
* @see [
|
|
1632
|
+
* @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
|
|
1396
1633
|
*/
|
|
1397
1634
|
target?: string | Array<string>;
|
|
1398
1635
|
/**
|
|
@@ -1659,6 +1896,18 @@ interface DecoratorOptions {
|
|
|
1659
1896
|
* @default false
|
|
1660
1897
|
*/
|
|
1661
1898
|
emitDecoratorMetadata?: boolean;
|
|
1899
|
+
/**
|
|
1900
|
+
* Aligns nullable-union `design:type` emission with `--strictNullChecks`.
|
|
1901
|
+
*
|
|
1902
|
+
* When `true` (default), `T | null` and `T | undefined` emit `Object`, matching tsc strict.
|
|
1903
|
+
* When `false`, `null` and `undefined` are elided from the union so the underlying
|
|
1904
|
+
* primitive constructor is emitted, matching tsc with `--strictNullChecks=false`
|
|
1905
|
+
* and `babel-plugin-transform-typescript-metadata`.
|
|
1906
|
+
*
|
|
1907
|
+
* @see https://www.typescriptlang.org/tsconfig/#strictNullChecks
|
|
1908
|
+
* @default true
|
|
1909
|
+
*/
|
|
1910
|
+
strictNullChecks?: boolean;
|
|
1662
1911
|
}
|
|
1663
1912
|
type HelperMode =
|
|
1664
1913
|
/**
|
|
@@ -1792,6 +2041,94 @@ interface PluginsOptions {
|
|
|
1792
2041
|
styledComponents?: StyledComponentsOptions;
|
|
1793
2042
|
taggedTemplateEscape?: boolean;
|
|
1794
2043
|
}
|
|
2044
|
+
/** Dynamic gating for {@link ReactCompilerOptions#dynamicGating}. */
|
|
2045
|
+
interface ReactCompilerDynamicGating {
|
|
2046
|
+
/** Module the gating import comes from. */
|
|
2047
|
+
source: string;
|
|
2048
|
+
}
|
|
2049
|
+
/** Static gating for {@link ReactCompilerOptions#gating}. */
|
|
2050
|
+
interface ReactCompilerGating {
|
|
2051
|
+
/** Module the gating import comes from. */
|
|
2052
|
+
source: string;
|
|
2053
|
+
/** Imported specifier used as the gate. */
|
|
2054
|
+
importSpecifierName: string;
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* Options for the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
|
|
2058
|
+
*
|
|
2059
|
+
* Mirrors the compiler's `PluginOptions`. The deep `environment` configuration
|
|
2060
|
+
* (inference / validation flags) is not surfaced here.
|
|
2061
|
+
*
|
|
2062
|
+
* @see {@link TransformOptions#reactCompiler}
|
|
2063
|
+
*/
|
|
2064
|
+
interface ReactCompilerOptions {
|
|
2065
|
+
/**
|
|
2066
|
+
* Which functions to compile.
|
|
2067
|
+
*
|
|
2068
|
+
* @default 'infer'
|
|
2069
|
+
*/
|
|
2070
|
+
compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
|
|
2071
|
+
/**
|
|
2072
|
+
* What to do when a function cannot be compiled.
|
|
2073
|
+
*
|
|
2074
|
+
* @default 'none'
|
|
2075
|
+
*/
|
|
2076
|
+
panicThreshold?: 'none' | 'critical_errors' | 'all_errors';
|
|
2077
|
+
/**
|
|
2078
|
+
* React runtime version target. `17` and `18` require the
|
|
2079
|
+
* `react-compiler-runtime` package; `19` ships the runtime in `react`.
|
|
2080
|
+
*
|
|
2081
|
+
* @default '19'
|
|
2082
|
+
*/
|
|
2083
|
+
target?: '17' | '18' | '19';
|
|
2084
|
+
/**
|
|
2085
|
+
* Analyze and report diagnostics only; emit no transformed code.
|
|
2086
|
+
*
|
|
2087
|
+
* @default false
|
|
2088
|
+
*/
|
|
2089
|
+
noEmit?: boolean;
|
|
2090
|
+
/**
|
|
2091
|
+
* Compiler output mode.
|
|
2092
|
+
*
|
|
2093
|
+
* @default undefined
|
|
2094
|
+
*/
|
|
2095
|
+
outputMode?: 'client' | 'ssr' | 'lint';
|
|
2096
|
+
/**
|
|
2097
|
+
* Compile even functions marked with the `"use no memo"` / `"use no forget"`
|
|
2098
|
+
* opt-out directives.
|
|
2099
|
+
*
|
|
2100
|
+
* @default false
|
|
2101
|
+
*/
|
|
2102
|
+
ignoreUseNoForget?: boolean;
|
|
2103
|
+
/**
|
|
2104
|
+
* Treat Flow suppression comments as opt-outs.
|
|
2105
|
+
*
|
|
2106
|
+
* @default true
|
|
2107
|
+
*/
|
|
2108
|
+
flowSuppressions?: boolean;
|
|
2109
|
+
/**
|
|
2110
|
+
* Enable `react-native-reanimated` support.
|
|
2111
|
+
*
|
|
2112
|
+
* @default false
|
|
2113
|
+
*/
|
|
2114
|
+
enableReanimated?: boolean;
|
|
2115
|
+
/**
|
|
2116
|
+
* Development mode (extra validation / instrumentation).
|
|
2117
|
+
*
|
|
2118
|
+
* @default false
|
|
2119
|
+
*/
|
|
2120
|
+
isDev?: boolean;
|
|
2121
|
+
/** Source file name, used for the fast-refresh hash and in diagnostics. */
|
|
2122
|
+
filename?: string;
|
|
2123
|
+
/** ESLint rules whose suppressions opt a function out of compilation. */
|
|
2124
|
+
eslintSuppressionRules?: Array<string>;
|
|
2125
|
+
/** Extra directives that opt a function out of compilation. */
|
|
2126
|
+
customOptOutDirectives?: Array<string>;
|
|
2127
|
+
/** Also emit a gated (feature-flagged) version of each compiled function. */
|
|
2128
|
+
gating?: ReactCompilerGating;
|
|
2129
|
+
/** Dynamically-gated compilation. */
|
|
2130
|
+
dynamicGating?: ReactCompilerDynamicGating;
|
|
2131
|
+
}
|
|
1795
2132
|
interface ReactRefreshOptions {
|
|
1796
2133
|
/**
|
|
1797
2134
|
* Specify the identifier of the refresh registration variable.
|
|
@@ -1951,6 +2288,14 @@ interface TransformOptions$1 {
|
|
|
1951
2288
|
inject?: Record<string, string | [string, string]>;
|
|
1952
2289
|
/** Decorator plugin */
|
|
1953
2290
|
decorator?: DecoratorOptions;
|
|
2291
|
+
/**
|
|
2292
|
+
* Enable the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
|
|
2293
|
+
*
|
|
2294
|
+
* `true` enables it with default options; an object enables it with the
|
|
2295
|
+
* given options; `false` or omitted disables it. When enabled, the compiler
|
|
2296
|
+
* runs as the first transform and memoizes React components and hooks.
|
|
2297
|
+
*/
|
|
2298
|
+
reactCompiler?: boolean | ReactCompilerOptions;
|
|
1954
2299
|
/**
|
|
1955
2300
|
* Third-party plugins to use.
|
|
1956
2301
|
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
|
|
@@ -2286,7 +2631,8 @@ interface ViteImportGlobMeta {
|
|
|
2286
2631
|
isSubImportsPattern?: boolean;
|
|
2287
2632
|
} //#endregion
|
|
2288
2633
|
//#endregion
|
|
2289
|
-
//#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.
|
|
2634
|
+
//#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter/index.d.mts
|
|
2635
|
+
//#region src/filter/composable-filters.d.ts
|
|
2290
2636
|
type StringOrRegExp$1 = string | RegExp;
|
|
2291
2637
|
type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
2292
2638
|
type FilterExpression = And | Or | Not | Id | ImporterId | ModuleType$1 | Code | Query;
|
|
@@ -2348,7 +2694,7 @@ declare class Exclude$1 {
|
|
|
2348
2694
|
constructor(expr: FilterExpression);
|
|
2349
2695
|
}
|
|
2350
2696
|
//#endregion
|
|
2351
|
-
//#region ../../node_modules/.pnpm/rolldown@1.
|
|
2697
|
+
//#region ../../node_modules/.pnpm/rolldown@1.1.1/node_modules/rolldown/dist/shared/define-config-ChOOV2QZ.d.mts
|
|
2352
2698
|
//#region src/types/misc.d.ts
|
|
2353
2699
|
/** @inline */
|
|
2354
2700
|
type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
|
|
@@ -3476,6 +3822,20 @@ type CodeSplittingGroup = {
|
|
|
3476
3822
|
*/
|
|
3477
3823
|
entriesAwareMergeThreshold?: number;
|
|
3478
3824
|
/**
|
|
3825
|
+
* Whether to include captured modules' dependencies.
|
|
3826
|
+
*
|
|
3827
|
+
* Enabling this option reduces the chance of generating circular chunks.
|
|
3828
|
+
*
|
|
3829
|
+
* If you want to disable this behavior, it's recommended to both set
|
|
3830
|
+
* - {@linkcode InputOptions.preserveEntrySignatures | preserveEntrySignatures}: `false | 'allow-extension'`
|
|
3831
|
+
* - {@linkcode OutputOptions.strictExecutionOrder | strictExecutionOrder}: `true`
|
|
3832
|
+
*
|
|
3833
|
+
* to avoid generating invalid chunks.
|
|
3834
|
+
*
|
|
3835
|
+
* @default true
|
|
3836
|
+
*/
|
|
3837
|
+
includeDependenciesRecursively?: boolean;
|
|
3838
|
+
/**
|
|
3479
3839
|
* Filter modules by tags. Only modules that have **all** specified tags
|
|
3480
3840
|
* are captured by this group. Combines with `test` and other filters —
|
|
3481
3841
|
* a module must match all criteria.
|
|
@@ -3501,15 +3861,7 @@ type CodeSplittingGroup = {
|
|
|
3501
3861
|
*/
|
|
3502
3862
|
type CodeSplittingOptions = {
|
|
3503
3863
|
/**
|
|
3504
|
-
*
|
|
3505
|
-
*
|
|
3506
|
-
* If you want to disable this behavior, it's recommended to both set
|
|
3507
|
-
* - {@linkcode InputOptions.preserveEntrySignatures | preserveEntrySignatures}: `false | 'allow-extension'`
|
|
3508
|
-
* - {@linkcode OutputOptions.strictExecutionOrder | strictExecutionOrder}: `true`
|
|
3509
|
-
*
|
|
3510
|
-
* to avoid generating invalid chunks.
|
|
3511
|
-
*
|
|
3512
|
-
* @default true
|
|
3864
|
+
* Global fallback of {@linkcode CodeSplittingGroup.includeDependenciesRecursively | group.includeDependenciesRecursively}, if it's not specified in the group.
|
|
3513
3865
|
*/
|
|
3514
3866
|
includeDependenciesRecursively?: boolean;
|
|
3515
3867
|
/**
|
|
@@ -3723,9 +4075,16 @@ interface ChecksOptions {
|
|
|
3723
4075
|
* Such modules can significantly slow down module resolution. Consider using
|
|
3724
4076
|
* [`@rolldown/plugin-transform-imports`](https://github.com/rolldown/plugins/tree/main/packages/transform-imports)
|
|
3725
4077
|
* to rewrite barrel imports at the source level so the barrel file is never loaded.
|
|
4078
|
+
*
|
|
4079
|
+
* See [Large barrel modules](https://rolldown.rs/in-depth/lazy-barrel-optimization#large-barrel-modules) for more details.
|
|
3726
4080
|
* @default true
|
|
3727
4081
|
* */
|
|
3728
4082
|
largeBarrelModules?: boolean;
|
|
4083
|
+
/**
|
|
4084
|
+
* Whether to emit warnings when a plugin transforms code without generating a sourcemap.
|
|
4085
|
+
* @default true
|
|
4086
|
+
* */
|
|
4087
|
+
sourcemapBroken?: boolean;
|
|
3729
4088
|
} //#endregion
|
|
3730
4089
|
//#region src/options/transform-options.d.ts
|
|
3731
4090
|
interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject" | "jsx"> {
|
|
@@ -5769,8 +6128,11 @@ interface InputOptions {
|
|
|
5769
6128
|
* Lazy barrel optimization avoids compiling unused re-export modules in side-effect-free barrel modules,
|
|
5770
6129
|
* significantly improving build performance for large codebases with many barrel modules.
|
|
5771
6130
|
*
|
|
6131
|
+
* This option is planned to be removed in the future. If you need to opt out, please open an issue
|
|
6132
|
+
* describing your use case so we can address it before the option is gone.
|
|
6133
|
+
*
|
|
5772
6134
|
* @see {@link https://rolldown.rs/in-depth/lazy-barrel-optimization | Lazy Barrel Documentation}
|
|
5773
|
-
* @default
|
|
6135
|
+
* @default true
|
|
5774
6136
|
*/
|
|
5775
6137
|
lazyBarrel?: boolean;
|
|
5776
6138
|
};
|
|
@@ -6004,6 +6366,13 @@ declare namespace ConfigTypes {
|
|
|
6004
6366
|
* The logging level for the application.
|
|
6005
6367
|
*/
|
|
6006
6368
|
logLevel?: LoggerTypes.Level;
|
|
6369
|
+
/**
|
|
6370
|
+
* Enables the evlog request middleware, which emits one structured
|
|
6371
|
+
* wide event per request (method, path, status, duration).
|
|
6372
|
+
*
|
|
6373
|
+
* @default true
|
|
6374
|
+
*/
|
|
6375
|
+
requestLogging?: boolean;
|
|
6007
6376
|
/**
|
|
6008
6377
|
* Server configuration options.
|
|
6009
6378
|
*/
|
|
@@ -6021,6 +6390,22 @@ declare namespace ConfigTypes {
|
|
|
6021
6390
|
* This property is only used when using vercube cli.
|
|
6022
6391
|
*/
|
|
6023
6392
|
build?: BuildOptions;
|
|
6393
|
+
/**
|
|
6394
|
+
* CLI configuration options.
|
|
6395
|
+
* This property is only used when using vercube cli.
|
|
6396
|
+
*/
|
|
6397
|
+
cli?: {
|
|
6398
|
+
/**
|
|
6399
|
+
* List of command classes to register in the CLI.
|
|
6400
|
+
* Each class must be decorated with @Command.
|
|
6401
|
+
*/
|
|
6402
|
+
commands?: (new () => unknown)[];
|
|
6403
|
+
};
|
|
6404
|
+
/**
|
|
6405
|
+
* Framework plugins (config, runtime, CLI, dev `hooks`).
|
|
6406
|
+
* @see {@link https://vercube.dev/docs/advanced/custom-plugin} - Plugins documentation
|
|
6407
|
+
*/
|
|
6408
|
+
plugins?: VercubePluginInput[];
|
|
6024
6409
|
/**
|
|
6025
6410
|
* Additional configuration for c12.
|
|
6026
6411
|
*/
|
|
@@ -6033,6 +6418,56 @@ declare namespace ConfigTypes {
|
|
|
6033
6418
|
}
|
|
6034
6419
|
}
|
|
6035
6420
|
//#endregion
|
|
6421
|
+
//#region src/Services/Plugins/BasePlugin.d.ts
|
|
6422
|
+
/**
|
|
6423
|
+
* Base class for class-based plugins registered via `defineConfig({ plugins })` or `app.addPlugin()`.
|
|
6424
|
+
*
|
|
6425
|
+
* @typeParam T - Options type passed into `configure`, `setup` / `use`, and `hooks` when provided.
|
|
6426
|
+
*/
|
|
6427
|
+
declare class BasePlugin<T = unknown> {
|
|
6428
|
+
/** Stable identifier used by the plugin registry and logging. */
|
|
6429
|
+
name: string;
|
|
6430
|
+
/**
|
|
6431
|
+
* Legacy runtime attach when the plugin is not registered with a `setup` implementation.
|
|
6432
|
+
*
|
|
6433
|
+
* @param app - Running application instance.
|
|
6434
|
+
* @param options - Optional plugin options from registration or config tuple.
|
|
6435
|
+
* @returns Void or a promise that settles when attachment is done.
|
|
6436
|
+
*/
|
|
6437
|
+
use(app: App, options?: T): void | Promise<void>;
|
|
6438
|
+
/**
|
|
6439
|
+
* Merges partial config during the plugin `config` phase (config file and CLI load).
|
|
6440
|
+
*
|
|
6441
|
+
* @param config - Current merged configuration.
|
|
6442
|
+
* @param options - Optional options from `[Class, options]` or adapter.
|
|
6443
|
+
* @returns Partial config to merge, or void.
|
|
6444
|
+
*/
|
|
6445
|
+
configure?(config: ConfigTypes.Config, options?: T): MaybePromise<void | DeepPartial<ConfigTypes.Config>>;
|
|
6446
|
+
/**
|
|
6447
|
+
* Worker runtime setup when listed in config `plugins`. If defined, runs instead of {@link use}.
|
|
6448
|
+
*
|
|
6449
|
+
* @param app - Running application instance.
|
|
6450
|
+
* @param options - Optional plugin options.
|
|
6451
|
+
* @returns Void or a promise that settles when setup is done.
|
|
6452
|
+
*/
|
|
6453
|
+
setup?(app: App, options?: T): MaybePromise<void>;
|
|
6454
|
+
/**
|
|
6455
|
+
* Registers CLI commands when config is loaded (citty / `@vercube/cli`).
|
|
6456
|
+
*
|
|
6457
|
+
* @param ctx - CLI context with `register` and merged `config`.
|
|
6458
|
+
* @returns Void or a promise that settles when registration is done.
|
|
6459
|
+
*/
|
|
6460
|
+
setupCLI?(ctx: VercubePluginCliContext): MaybePromise<void>;
|
|
6461
|
+
/**
|
|
6462
|
+
* Dev parent process only (`vercube dev`): subscribe to bundler and reload hooks.
|
|
6463
|
+
*
|
|
6464
|
+
* @param ctx - Merged config and devkit `hooks` instance.
|
|
6465
|
+
* @param options - Optional plugin options from the class adapter.
|
|
6466
|
+
* @returns Void or a promise that settles when subscriptions are registered.
|
|
6467
|
+
*/
|
|
6468
|
+
hooks?(ctx: VercubePluginHooksContext, options?: T): MaybePromise<void>;
|
|
6469
|
+
}
|
|
6470
|
+
//#endregion
|
|
6036
6471
|
//#region src/Common/App.d.ts
|
|
6037
6472
|
/**
|
|
6038
6473
|
* Represents the main application class.
|
|
@@ -6096,150 +6531,13 @@ declare class App {
|
|
|
6096
6531
|
*/
|
|
6097
6532
|
fetch(request: Request): Promise<Response>;
|
|
6098
6533
|
/**
|
|
6099
|
-
*
|
|
6534
|
+
* Initializes registry plugins, then runs `setup` on each normalized config plugin in order.
|
|
6100
6535
|
*
|
|
6101
|
-
* @
|
|
6536
|
+
* @returns Resolves when all plugin `setup` hooks have been awaited.
|
|
6102
6537
|
*/
|
|
6103
6538
|
private resolvePlugins;
|
|
6104
6539
|
}
|
|
6105
6540
|
//#endregion
|
|
6106
|
-
//#region src/Services/Middleware/BaseMiddleware.d.ts
|
|
6107
|
-
/**
|
|
6108
|
-
* BaseMiddleware class that serves as a base for all middleware implementations.
|
|
6109
|
-
*/
|
|
6110
|
-
declare class BaseMiddleware<T = any, U = any> {
|
|
6111
|
-
/**
|
|
6112
|
-
* Middleware function that processes the HTTP event.
|
|
6113
|
-
* This method should be overridden by subclasses to implement specific middleware logic.
|
|
6114
|
-
* WARNING: This method cannot return a value, it will be ignored.
|
|
6115
|
-
* Middleware can only modify the event object or throw an HttpError like BadRequestError, ForbiddenError, etc.
|
|
6116
|
-
*
|
|
6117
|
-
* @param {Request} request - The HTTP Request to process
|
|
6118
|
-
* @param {T[]} args - Additional arguments for the middleware.
|
|
6119
|
-
* @returns {void | Promise<void>} - A void or a promise that resolves when the processing is complete.
|
|
6120
|
-
*/
|
|
6121
|
-
onRequest?(request: Request, response: Response, args: MiddlewareOptions<T>): MaybePromise<void | Response>;
|
|
6122
|
-
/**
|
|
6123
|
-
* Middleware function that processes the response.
|
|
6124
|
-
* This method should be overridden by subclasses to implement specific middleware logic.
|
|
6125
|
-
* WARNING: This method cannot return a value, it will be ignored.
|
|
6126
|
-
* Middleware can only modify the event object or throw an HttpError like BadRequestError, ForbiddenError, etc.
|
|
6127
|
-
*
|
|
6128
|
-
* @param {Request} request - The HTTP Request to process
|
|
6129
|
-
* @param {Response} response - The HTTP Response to process
|
|
6130
|
-
* @returns {void | Promise<void>} - A void or a promise that resolves when the processing is complete.
|
|
6131
|
-
*/
|
|
6132
|
-
onResponse?(request: Request, response: Response, payload: U): MaybePromise<void | Response>;
|
|
6133
|
-
}
|
|
6134
|
-
//#endregion
|
|
6135
|
-
//#region src/Types/RouterTypes.d.ts
|
|
6136
|
-
declare namespace RouterTypes {
|
|
6137
|
-
interface Route {
|
|
6138
|
-
path: string;
|
|
6139
|
-
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'CONNECT' | 'TRACE';
|
|
6140
|
-
handler: RouterHandler;
|
|
6141
|
-
}
|
|
6142
|
-
interface RouteFind {
|
|
6143
|
-
path: string;
|
|
6144
|
-
method: string;
|
|
6145
|
-
}
|
|
6146
|
-
interface MiddlewareDefinition {
|
|
6147
|
-
middleware: BaseMiddleware<unknown, unknown>;
|
|
6148
|
-
target: string;
|
|
6149
|
-
priority?: number;
|
|
6150
|
-
args?: unknown;
|
|
6151
|
-
}
|
|
6152
|
-
interface RouterHandler {
|
|
6153
|
-
instance: any;
|
|
6154
|
-
propertyName: string;
|
|
6155
|
-
args: MetadataTypes.Arg[];
|
|
6156
|
-
middlewares: {
|
|
6157
|
-
beforeMiddlewares: MiddlewareDefinition[];
|
|
6158
|
-
afterMiddlewares: MiddlewareDefinition[];
|
|
6159
|
-
};
|
|
6160
|
-
actions: MetadataTypes.Action[];
|
|
6161
|
-
}
|
|
6162
|
-
interface RouteMatched<T = unknown> {
|
|
6163
|
-
data: T;
|
|
6164
|
-
params?: Record<string, string>;
|
|
6165
|
-
}
|
|
6166
|
-
type RouterEvent = RouterTypes.RouteMatched<RouterTypes.RouterHandler> & {
|
|
6167
|
-
request: Request;
|
|
6168
|
-
response: Response;
|
|
6169
|
-
};
|
|
6170
|
-
}
|
|
6171
|
-
//#endregion
|
|
6172
|
-
//#region src/Types/ValidationTypes.d.ts
|
|
6173
|
-
declare namespace ValidationTypes {
|
|
6174
|
-
type Schema = StandardSchemaV1;
|
|
6175
|
-
type Result<T = any> = StandardSchemaV1.Result<T>;
|
|
6176
|
-
type Input<T extends Schema = Schema> = StandardSchemaV1.InferInput<T>;
|
|
6177
|
-
}
|
|
6178
|
-
//#endregion
|
|
6179
|
-
//#region src/Types/MetadataTypes.d.ts
|
|
6180
|
-
declare namespace MetadataTypes {
|
|
6181
|
-
interface Metadata {
|
|
6182
|
-
__metadata: Ctx;
|
|
6183
|
-
}
|
|
6184
|
-
interface Ctx {
|
|
6185
|
-
__controller: {
|
|
6186
|
-
path: string;
|
|
6187
|
-
};
|
|
6188
|
-
__middlewares: Middleware[];
|
|
6189
|
-
__methods: Record<string, Method>;
|
|
6190
|
-
__meta?: Record<string, unknown>;
|
|
6191
|
-
}
|
|
6192
|
-
interface Method {
|
|
6193
|
-
req: Request | null;
|
|
6194
|
-
res: Response | null;
|
|
6195
|
-
url: string | null;
|
|
6196
|
-
method: string | null;
|
|
6197
|
-
args: Arg[];
|
|
6198
|
-
actions: Action[];
|
|
6199
|
-
meta: Record<string, unknown>;
|
|
6200
|
-
}
|
|
6201
|
-
interface ResolvedData {
|
|
6202
|
-
req: Request | null;
|
|
6203
|
-
res: Response | null;
|
|
6204
|
-
url: string | null;
|
|
6205
|
-
args: Arg[];
|
|
6206
|
-
actions: Action[];
|
|
6207
|
-
middlewares: Middleware[];
|
|
6208
|
-
}
|
|
6209
|
-
interface Arg {
|
|
6210
|
-
idx: number;
|
|
6211
|
-
type: string;
|
|
6212
|
-
data?: Record<string, any>;
|
|
6213
|
-
resolver?: (event: RouterTypes.RouterEvent) => Promise<unknown>;
|
|
6214
|
-
resolved?: unknown;
|
|
6215
|
-
validate?: boolean;
|
|
6216
|
-
validationSchema?: ValidationTypes.Schema;
|
|
6217
|
-
}
|
|
6218
|
-
interface Action {
|
|
6219
|
-
handler: (req: Request, res: Response) => void | Response | ResponseInit;
|
|
6220
|
-
}
|
|
6221
|
-
interface Middleware<T = unknown, U = unknown> {
|
|
6222
|
-
target: string;
|
|
6223
|
-
priority?: number;
|
|
6224
|
-
middleware: typeof BaseMiddleware<T, U>;
|
|
6225
|
-
args?: unknown;
|
|
6226
|
-
}
|
|
6227
|
-
interface ResolveUrlParams {
|
|
6228
|
-
instance: any;
|
|
6229
|
-
path: string;
|
|
6230
|
-
propertyName: string;
|
|
6231
|
-
}
|
|
6232
|
-
}
|
|
6233
|
-
//#endregion
|
|
6234
|
-
//#region src/Types/CommonTypes.d.ts
|
|
6235
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
6236
|
-
interface MiddlewareOptions<T = any> {
|
|
6237
|
-
middlewareArgs?: T;
|
|
6238
|
-
methodArgs?: MetadataTypes.Arg[];
|
|
6239
|
-
}
|
|
6240
|
-
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] };
|
|
6241
|
-
type RequestHandler = (request: Request) => Promise<Response>;
|
|
6242
|
-
//#endregion
|
|
6243
6541
|
//#region src/Common/CreateApp.d.ts
|
|
6244
6542
|
interface CreateAppOptions {
|
|
6245
6543
|
cfg?: ConfigTypes.Config;
|
|
@@ -6264,12 +6562,22 @@ declare function createApp({
|
|
|
6264
6562
|
declare function defineConfig<T = Record<string, unknown>>(config: ConfigTypes.Config<T>): ConfigTypes.Config<T>;
|
|
6265
6563
|
//#endregion
|
|
6266
6564
|
//#region src/Config/Loader.d.ts
|
|
6565
|
+
interface LoadVercubeConfigOptions {
|
|
6566
|
+
/** Directory containing `vercube.config` (defaults to `process.cwd()`). */
|
|
6567
|
+
cwd?: string;
|
|
6568
|
+
/** Custom ESM importer (for example CLI `jiti`) when loading the config module. */
|
|
6569
|
+
import?: (id: string) => Promise<unknown>;
|
|
6570
|
+
/** Active CLI subcommand name, forwarded to `VercubePluginEnv.command` for plugins. */
|
|
6571
|
+
command?: string;
|
|
6572
|
+
}
|
|
6267
6573
|
/**
|
|
6268
|
-
* Loads
|
|
6269
|
-
*
|
|
6270
|
-
* @
|
|
6574
|
+
* Loads and merges `vercube` config from disk, applies defaults, runs env setup, then the plugin `config` and `cli` pipeline.
|
|
6575
|
+
*
|
|
6576
|
+
* @param overrides - Values merged on top of file-based config (wins over file).
|
|
6577
|
+
* @param options - `cwd`, optional `import`, and `command` for plugin context.
|
|
6578
|
+
* @returns Fully merged config with normalized `plugins` and aggregated `cli.commands`.
|
|
6271
6579
|
*/
|
|
6272
|
-
declare function loadVercubeConfig(overrides?: ConfigTypes.Config): Promise<ConfigTypes.Config>;
|
|
6580
|
+
declare function loadVercubeConfig(overrides?: ConfigTypes.Config, options?: LoadVercubeConfigOptions): Promise<ConfigTypes.Config>;
|
|
6273
6581
|
//#endregion
|
|
6274
6582
|
//#region src/Decorators/Http/Body.d.ts
|
|
6275
6583
|
interface BodyDecoratorOptions {
|
|
@@ -6715,6 +7023,61 @@ declare class HooksService {
|
|
|
6715
7023
|
private objectToClass;
|
|
6716
7024
|
}
|
|
6717
7025
|
//#endregion
|
|
7026
|
+
//#region src/Plugins/VercubePlugin.d.ts
|
|
7027
|
+
/**
|
|
7028
|
+
* Returns the same plugin object; narrows the type for object literals.
|
|
7029
|
+
*
|
|
7030
|
+
* @param plugin - Plugin definition with optional hooks.
|
|
7031
|
+
* @returns The input plugin unchanged.
|
|
7032
|
+
*/
|
|
7033
|
+
declare function defineVercubePlugin(plugin: VercubePlugin): VercubePlugin;
|
|
7034
|
+
/**
|
|
7035
|
+
* Builds a `[PluginClass, options]` tuple with options typed from the class `BasePlugin` generic.
|
|
7036
|
+
*
|
|
7037
|
+
* @param PluginClass - Constructor extending `BasePlugin<TOptions>`.
|
|
7038
|
+
* @param options - Options object matching `TOptions` for that class.
|
|
7039
|
+
* @returns Tuple consumed by the config `plugins` pipeline.
|
|
7040
|
+
*/
|
|
7041
|
+
declare function withPluginOptions<TClass extends new (...args: any[]) => BasePlugin<any>>(PluginClass: TClass, options: NoInfer<InferPluginOptions<TClass>>): [TClass, InferPluginOptions<TClass>];
|
|
7042
|
+
/**
|
|
7043
|
+
* @param value - Any value to test.
|
|
7044
|
+
* @returns True if `value` is a constructor whose prototype extends `BasePlugin`.
|
|
7045
|
+
*/
|
|
7046
|
+
declare function isBasePluginClass(value: unknown): value is new (...args: unknown[]) => BasePlugin;
|
|
7047
|
+
/**
|
|
7048
|
+
* Adapts a `BasePlugin` subclass into a `VercubePlugin` for `defineConfig({ plugins })`.
|
|
7049
|
+
*
|
|
7050
|
+
* @param PluginClass - Plugin class constructor.
|
|
7051
|
+
* @param options - Optional value passed into `configure`, `setup` / `use`, and `hooks`.
|
|
7052
|
+
* @param displayName - Optional name; defaults to `PluginClass.name`.
|
|
7053
|
+
* @returns Object implementing `VercubePlugin` that delegates to the class.
|
|
7054
|
+
*/
|
|
7055
|
+
declare function vercubePluginFromClass<T>(PluginClass: (new (...args: unknown[]) => BasePlugin<T>) & typeof BasePlugin<T>, options?: T, displayName?: string): VercubePlugin;
|
|
7056
|
+
/**
|
|
7057
|
+
* Resolves async plugin factories and normalizes class entries into `VercubePlugin` objects.
|
|
7058
|
+
*
|
|
7059
|
+
* @param inputs - Raw `plugins` array from config, or undefined.
|
|
7060
|
+
* @returns Resolved plugins in source order (before `enforce` sorting elsewhere).
|
|
7061
|
+
* @throws {Error} If an array entry is neither `[Class]`, `[Class, options]`, nor a valid plugin shape.
|
|
7062
|
+
*/
|
|
7063
|
+
declare function normalizeVercubePluginInputs(inputs: readonly VercubePluginInput[] | undefined): Promise<VercubePlugin[]>;
|
|
7064
|
+
/**
|
|
7065
|
+
* Runs each plugin's `config` hook (merge order), normalizes `plugins` to resolved objects, runs `cli` hooks, and merges registered commands into `config.cli.commands`.
|
|
7066
|
+
*
|
|
7067
|
+
* @param config - Full Vercube config (may contain raw plugin inputs).
|
|
7068
|
+
* @param env - Working directory and CLI context flags.
|
|
7069
|
+
* @returns Config with `plugins` normalized and CLI commands aggregated.
|
|
7070
|
+
*/
|
|
7071
|
+
declare function applyVercubePluginHooks(config: ConfigTypes.Config, env: VercubePluginEnv): Promise<ConfigTypes.Config>;
|
|
7072
|
+
/**
|
|
7073
|
+
* Invokes `hooks` on each resolved plugin (dev parent process only).
|
|
7074
|
+
*
|
|
7075
|
+
* @param plugins - Normalized plugins from config (after `applyVercubePluginHooks`).
|
|
7076
|
+
* @param ctx - Hooks context from devkit (`config`, `hooks`).
|
|
7077
|
+
* @returns Resolves when every plugin `hooks` call completes.
|
|
7078
|
+
*/
|
|
7079
|
+
declare function invokeVercubePluginDevHooks(plugins: VercubePlugin[] | undefined, ctx: VercubePluginHooksContext): Promise<void>;
|
|
7080
|
+
//#endregion
|
|
6718
7081
|
//#region src/Services/Middleware/GlobalMiddlewareRegistry.d.ts
|
|
6719
7082
|
interface GlobalMiddlewareParams<T> extends Omit<MetadataTypes.Middleware<T>, 'middleware'> {}
|
|
6720
7083
|
/**
|
|
@@ -6742,6 +7105,53 @@ declare class GlobalMiddlewareRegistry {
|
|
|
6742
7105
|
registerGlobalMiddleware<T = unknown, U = unknown>(middleware: typeof BaseMiddleware<T, U>, opts?: GlobalMiddlewareParams<T>): void;
|
|
6743
7106
|
}
|
|
6744
7107
|
//#endregion
|
|
7108
|
+
//#region src/Middleware/EvlogMiddleware.d.ts
|
|
7109
|
+
/**
|
|
7110
|
+
* Key under which the request-scoped evlog logger is stored in {@link RequestContext}.
|
|
7111
|
+
*/
|
|
7112
|
+
declare const EVLOG_REQUEST_LOGGER_KEY = "evlog:requestLogger";
|
|
7113
|
+
/**
|
|
7114
|
+
* Key under which the evlog `finish` callback is stored in {@link RequestContext}.
|
|
7115
|
+
*/
|
|
7116
|
+
declare const EVLOG_FINISH_KEY = "evlog:finish";
|
|
7117
|
+
/**
|
|
7118
|
+
* Global middleware that emits one structured wide event per request using
|
|
7119
|
+
* evlog (https://evlog.dev).
|
|
7120
|
+
*
|
|
7121
|
+
* On each request it creates a request-scoped logger via evlog's toolkit and
|
|
7122
|
+
* stores it in {@link RequestContext} (so handlers can enrich the event), then
|
|
7123
|
+
* emits the accumulated wide event - including method, path, status and
|
|
7124
|
+
* duration - when the response is produced.
|
|
7125
|
+
*
|
|
7126
|
+
* Registered automatically by the framework; disable via `requestLogging: false`
|
|
7127
|
+
* in the application config.
|
|
7128
|
+
*/
|
|
7129
|
+
declare class EvlogMiddleware extends BaseMiddleware<BaseEvlogOptions> {
|
|
7130
|
+
/**
|
|
7131
|
+
* Request context used to carry the request-scoped logger across the lifecycle.
|
|
7132
|
+
*/
|
|
7133
|
+
private gRequestContext;
|
|
7134
|
+
/**
|
|
7135
|
+
* Creates a request-scoped evlog logger and stores it in the request context.
|
|
7136
|
+
*
|
|
7137
|
+
* @param request - The incoming HTTP request
|
|
7138
|
+
* @param _response - The current response (unused)
|
|
7139
|
+
* @param args - Middleware options (evlog include/exclude/drain/enrich/keep)
|
|
7140
|
+
*/
|
|
7141
|
+
onRequest(request: Request, _response: Response, args: MiddlewareOptions<BaseEvlogOptions>): void;
|
|
7142
|
+
/**
|
|
7143
|
+
* Emits the request wide event with the final response status.
|
|
7144
|
+
*
|
|
7145
|
+
* @param _request - The HTTP request (unused)
|
|
7146
|
+
* @param response - The final HTTP response
|
|
7147
|
+
*/
|
|
7148
|
+
onResponse(_request: Request, response: Response): Promise<void>;
|
|
7149
|
+
}
|
|
7150
|
+
/**
|
|
7151
|
+
* Request-scoped wide-event logger type, re-exported for handler ergonomics.
|
|
7152
|
+
*/
|
|
7153
|
+
type EvlogRequestLogger = RequestLogger;
|
|
7154
|
+
//#endregion
|
|
6745
7155
|
//#region src/Services/HttpServer/HttpServer.d.ts
|
|
6746
7156
|
/**
|
|
6747
7157
|
* HTTP server implementation for handling incoming web requests
|
|
@@ -7624,4 +8034,4 @@ declare function sanitizeObject(obj: Record<string, unknown>): Record<string, un
|
|
|
7624
8034
|
*/
|
|
7625
8035
|
declare function safeAssign(target: any, source: Record<string, unknown>): void;
|
|
7626
8036
|
//#endregion
|
|
7627
|
-
export { App, BadRequestError, BaseMiddleware, BasePlugin, Body, ConfigTypes, Connect, Controller, CreateAppOptions, DANGEROUS_PROPERTIES, DeepPartial, Delete, ErrorHandlerProvider, FastResponse, ForbiddenError, Get, GlobalMiddlewareRegistry, HTTPStatus, Head, Header, Headers, HooksService, HooksTypes, HttpError, HttpServer, HttpStatusCode, InternalServerError, Listen, MaybePromise, MetadataResolver, MetadataTypes, MethodNotAllowedError, Middleware$1 as Middleware, MiddlewareOptions, MultipartFormData, NotAcceptableError, NotFoundError, Options, Param, Patch, Post, Put, QueryParam, QueryParams, Redirect, Request$1 as Request, RequestContext, RequestHandler, Response$1 as Response, Router, RouterTypes, RuntimeConfig$1 as RuntimeConfig, SetHeader, StandardSchemaValidationProvider, Status, Trace, UnauthorizedError, ValidationProvider, ValidationTypes, createApp, createMetadataCtx, createMetadataMethod, defineConfig, initializeMetadata, initializeMetadataMethod, isSafeProperty, loadVercubeConfig, safeAssign, safeJsonParse, sanitizeObject, secureReviver };
|
|
8037
|
+
export { App, BadRequestError, BaseMiddleware, BasePlugin, Body, ConfigTypes, Connect, Controller, CreateAppOptions, DANGEROUS_PROPERTIES, DeepPartial, Delete, EVLOG_FINISH_KEY, EVLOG_REQUEST_LOGGER_KEY, ErrorHandlerProvider, EvlogMiddleware, EvlogRequestLogger, FastResponse, ForbiddenError, Get, GlobalMiddlewareRegistry, HTTPStatus, Head, Header, Headers, HooksService, HooksTypes, HttpError, HttpServer, HttpStatusCode, InferPluginOptions, InternalServerError, Listen, type LoadVercubeConfigOptions, MaybePromise, MetadataResolver, MetadataTypes, MethodNotAllowedError, Middleware$1 as Middleware, MiddlewareOptions, MultipartFormData, NotAcceptableError, NotFoundError, Options, Param, Patch, PluginTypes, PluginWithOptions, Post, Put, QueryParam, QueryParams, Redirect, Request$1 as Request, RequestContext, RequestHandler, Response$1 as Response, Router, RouterTypes, RuntimeConfig$1 as RuntimeConfig, SetHeader, StandardSchemaValidationProvider, Status, Trace, UnauthorizedError, ValidationProvider, ValidationTypes, VercubePlugin, VercubePluginCliContext, VercubePluginEnv, VercubePluginHooksContext, VercubePluginInput, applyVercubePluginHooks, createApp, createMetadataCtx, createMetadataMethod, defineConfig, defineVercubePlugin, initializeMetadata, initializeMetadataMethod, invokeVercubePluginDevHooks, isBasePluginClass, isSafeProperty, loadVercubeConfig, normalizeVercubePluginInputs, safeAssign, safeJsonParse, sanitizeObject, secureReviver, vercubePluginFromClass, withPluginOptions };
|