@teamvelix/velix 5.0.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/LICENSE +21 -0
- package/README.md +117 -0
- package/assets/logo.webp +0 -0
- package/dist/build/index.d.ts +19 -0
- package/dist/build/index.js +588 -0
- package/dist/build/index.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +148 -0
- package/dist/client/index.js.map +1 -0
- package/dist/config.d.ts +194 -0
- package/dist/config.js +129 -0
- package/dist/config.js.map +1 -0
- package/dist/index-C4udNtpZ.d.ts +405 -0
- package/dist/index-l0dwPa62.d.ts +106 -0
- package/dist/index.d.ts +792 -0
- package/dist/index.js +3387 -0
- package/dist/index.js.map +1 -0
- package/dist/islands/index.d.ts +97 -0
- package/dist/islands/index.js +182 -0
- package/dist/islands/index.js.map +1 -0
- package/dist/runtime/start-dev.d.ts +2 -0
- package/dist/runtime/start-dev.js +2432 -0
- package/dist/runtime/start-dev.js.map +1 -0
- package/dist/runtime/start-prod.d.ts +2 -0
- package/dist/runtime/start-prod.js +2408 -0
- package/dist/runtime/start-prod.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +2442 -0
- package/dist/server/index.js.map +1 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
export { VelixConfig, VelixConfigSchema, defaultConfig, defineConfig, loadConfig, resolvePaths } from './config.js';
|
|
2
|
+
import * as http from 'http';
|
|
3
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
|
+
import React, { ReactNode, ComponentType, ImgHTMLAttributes } from 'react';
|
|
5
|
+
export { use, useActionState, useOptimistic } from 'react';
|
|
6
|
+
export { a as PluginHooks, P as PluginManager, V as VelixServer, c as createServer, d as definePlugin, l as loadPlugins, p as pluginManager, t as tailwindPlugin } from './index-l0dwPa62.js';
|
|
7
|
+
export { Island, LoadStrategy, createIsland, createLazyIsland, generateAdvancedHydrationScript, generateHydrationScript, getRegisteredIslands } from './islands/index.js';
|
|
8
|
+
export { L as LayoutContext, f as Link, R as RequestContext, d as RouteContext, e as createRequestContext, h as hydrate, r as router, u as useParams, b as usePathname, a as useQuery, c as useRequest, g as useRouter } from './index-C4udNtpZ.js';
|
|
9
|
+
export { build } from './build/index.js';
|
|
10
|
+
export { useFormStatus } from 'react-dom';
|
|
11
|
+
import 'zod';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Velix v5 Core Types
|
|
15
|
+
* Comprehensive type definitions for the framework
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
type RouteType = 'page' | 'api' | 'layout' | 'loading' | 'error' | 'not-found';
|
|
19
|
+
interface Route {
|
|
20
|
+
type: RouteType;
|
|
21
|
+
path: string;
|
|
22
|
+
filePath: string;
|
|
23
|
+
pattern: RegExp;
|
|
24
|
+
segments: string[];
|
|
25
|
+
layout?: string | null;
|
|
26
|
+
loading?: string | null;
|
|
27
|
+
error?: string | null;
|
|
28
|
+
notFound?: string | null;
|
|
29
|
+
template?: string | null;
|
|
30
|
+
middleware?: string | null;
|
|
31
|
+
isServerComponent?: boolean;
|
|
32
|
+
isClientComponent?: boolean;
|
|
33
|
+
isIsland?: boolean;
|
|
34
|
+
params?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
interface RouteTree {
|
|
37
|
+
pages: Route[];
|
|
38
|
+
api: Route[];
|
|
39
|
+
layouts: Map<string, string>;
|
|
40
|
+
tree: Record<string, unknown>;
|
|
41
|
+
appRoutes: Route[];
|
|
42
|
+
rootLayout?: string;
|
|
43
|
+
}
|
|
44
|
+
interface RouteMatch {
|
|
45
|
+
route: Route;
|
|
46
|
+
params: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
type Request$1 = IncomingMessage & {
|
|
49
|
+
params?: Record<string, string>;
|
|
50
|
+
query?: Record<string, string>;
|
|
51
|
+
body?: unknown;
|
|
52
|
+
json?: () => Promise<unknown>;
|
|
53
|
+
};
|
|
54
|
+
type Response$1 = ServerResponse & {
|
|
55
|
+
json?: (data: unknown) => void;
|
|
56
|
+
send?: (data: string) => void;
|
|
57
|
+
status?: (code: number) => Response$1;
|
|
58
|
+
};
|
|
59
|
+
type NextFunction = () => void | Promise<void>;
|
|
60
|
+
type Middleware = (req: Request$1, res: Response$1, next: NextFunction) => void | Promise<void>;
|
|
61
|
+
type ApiHandler = (req: Request$1, res: Response$1) => void | Promise<void>;
|
|
62
|
+
type ActionState<T> = T | Promise<T>;
|
|
63
|
+
type ServerAction<State, Payload = FormData> = (prevState: Awaited<State>, payload: Payload) => State | Promise<State>;
|
|
64
|
+
interface TypedActionResult<T> {
|
|
65
|
+
success: boolean;
|
|
66
|
+
data?: T;
|
|
67
|
+
error?: string;
|
|
68
|
+
errors?: Record<string, string[]>;
|
|
69
|
+
redirect?: string;
|
|
70
|
+
}
|
|
71
|
+
interface PageProps {
|
|
72
|
+
params?: Record<string, string>;
|
|
73
|
+
searchParams?: Record<string, string>;
|
|
74
|
+
}
|
|
75
|
+
interface LayoutProps {
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
params?: Record<string, string>;
|
|
78
|
+
}
|
|
79
|
+
interface ErrorProps {
|
|
80
|
+
error: Error;
|
|
81
|
+
reset: () => void;
|
|
82
|
+
}
|
|
83
|
+
interface LoadingProps {
|
|
84
|
+
}
|
|
85
|
+
interface NotFoundProps {
|
|
86
|
+
}
|
|
87
|
+
type PageComponent = ComponentType<PageProps>;
|
|
88
|
+
type LayoutComponent = ComponentType<LayoutProps>;
|
|
89
|
+
type ErrorComponent = ComponentType<ErrorProps>;
|
|
90
|
+
type LoadingComponent = ComponentType<LoadingProps>;
|
|
91
|
+
type NotFoundComponent = ComponentType<NotFoundProps>;
|
|
92
|
+
interface IslandConfig {
|
|
93
|
+
name: string;
|
|
94
|
+
component: ComponentType<unknown>;
|
|
95
|
+
props?: Record<string, unknown>;
|
|
96
|
+
hydrate?: 'load' | 'idle' | 'visible' | 'media' | 'interaction';
|
|
97
|
+
media?: string;
|
|
98
|
+
}
|
|
99
|
+
interface IslandManifest {
|
|
100
|
+
islands: Map<string, IslandConfig>;
|
|
101
|
+
}
|
|
102
|
+
interface BuildOptions {
|
|
103
|
+
outDir?: string;
|
|
104
|
+
minify?: boolean;
|
|
105
|
+
sourcemap?: boolean;
|
|
106
|
+
target?: string;
|
|
107
|
+
}
|
|
108
|
+
interface BuildResult {
|
|
109
|
+
success: boolean;
|
|
110
|
+
errors?: string[];
|
|
111
|
+
warnings?: string[];
|
|
112
|
+
duration?: number;
|
|
113
|
+
}
|
|
114
|
+
interface StaticPath {
|
|
115
|
+
params: Record<string, string>;
|
|
116
|
+
}
|
|
117
|
+
interface StaticProps {
|
|
118
|
+
props: Record<string, unknown>;
|
|
119
|
+
revalidate?: number | false;
|
|
120
|
+
notFound?: boolean;
|
|
121
|
+
redirect?: {
|
|
122
|
+
destination: string;
|
|
123
|
+
permanent?: boolean;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface VelixPlugin {
|
|
127
|
+
name: string;
|
|
128
|
+
setup?: (config: any) => void | Promise<void>;
|
|
129
|
+
transform?: (code: string, id: string) => string | null | Promise<string | null>;
|
|
130
|
+
buildStart?: () => void | Promise<void>;
|
|
131
|
+
buildEnd?: () => void | Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
interface Metadata$1 {
|
|
134
|
+
title?: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
keywords?: string[];
|
|
137
|
+
author?: string;
|
|
138
|
+
canonical?: string;
|
|
139
|
+
openGraph?: {
|
|
140
|
+
title?: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
image?: string;
|
|
143
|
+
url?: string;
|
|
144
|
+
type?: string;
|
|
145
|
+
siteName?: string;
|
|
146
|
+
};
|
|
147
|
+
twitter?: {
|
|
148
|
+
card?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
149
|
+
title?: string;
|
|
150
|
+
description?: string;
|
|
151
|
+
image?: string;
|
|
152
|
+
site?: string;
|
|
153
|
+
creator?: string;
|
|
154
|
+
};
|
|
155
|
+
robots?: {
|
|
156
|
+
index?: boolean;
|
|
157
|
+
follow?: boolean;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Velix v5 Server Helpers
|
|
163
|
+
* Utility functions for server-side operations
|
|
164
|
+
*/
|
|
165
|
+
declare class RedirectError extends Error {
|
|
166
|
+
readonly url: string;
|
|
167
|
+
readonly statusCode: number;
|
|
168
|
+
readonly type: "redirect";
|
|
169
|
+
constructor(url: string, statusCode?: number);
|
|
170
|
+
}
|
|
171
|
+
declare class NotFoundError extends Error {
|
|
172
|
+
readonly type: "notFound";
|
|
173
|
+
constructor(message?: string);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Redirect to a different URL
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```tsx
|
|
180
|
+
* import { redirect } from 'velix';
|
|
181
|
+
*
|
|
182
|
+
* export default function ProtectedPage() {
|
|
183
|
+
* const user = getUser();
|
|
184
|
+
* if (!user) redirect('/login');
|
|
185
|
+
* return <Dashboard user={user} />;
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
declare function redirect(url: string, type?: 'replace' | 'permanent'): never;
|
|
190
|
+
/**
|
|
191
|
+
* Trigger a 404 Not Found response
|
|
192
|
+
*/
|
|
193
|
+
declare function notFound(message?: string): never;
|
|
194
|
+
/**
|
|
195
|
+
* Create a JSON response
|
|
196
|
+
*/
|
|
197
|
+
declare function json<T>(data: T, options?: {
|
|
198
|
+
status?: number;
|
|
199
|
+
headers?: Record<string, string>;
|
|
200
|
+
}): Response;
|
|
201
|
+
/**
|
|
202
|
+
* Create an HTML response
|
|
203
|
+
*/
|
|
204
|
+
declare function html(content: string, options?: {
|
|
205
|
+
status?: number;
|
|
206
|
+
headers?: Record<string, string>;
|
|
207
|
+
}): Response;
|
|
208
|
+
/**
|
|
209
|
+
* Create a text response
|
|
210
|
+
*/
|
|
211
|
+
declare function text(content: string, options?: {
|
|
212
|
+
status?: number;
|
|
213
|
+
headers?: Record<string, string>;
|
|
214
|
+
}): Response;
|
|
215
|
+
interface CookieOptions {
|
|
216
|
+
maxAge?: number;
|
|
217
|
+
expires?: Date;
|
|
218
|
+
path?: string;
|
|
219
|
+
domain?: string;
|
|
220
|
+
secure?: boolean;
|
|
221
|
+
httpOnly?: boolean;
|
|
222
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
223
|
+
}
|
|
224
|
+
declare const cookies: {
|
|
225
|
+
parse(cookieHeader: string): Record<string, string>;
|
|
226
|
+
get(request: Request, name: string): string | undefined;
|
|
227
|
+
getAll(request: Request): Record<string, string>;
|
|
228
|
+
serialize(name: string, value: string, options?: CookieOptions): string;
|
|
229
|
+
set(name: string, value: string, options?: CookieOptions): string;
|
|
230
|
+
delete(name: string, options?: Omit<CookieOptions, "maxAge" | "expires">): string;
|
|
231
|
+
};
|
|
232
|
+
declare const headers: {
|
|
233
|
+
create(init?: HeadersInit): Headers;
|
|
234
|
+
get(request: Request, name: string): string | null;
|
|
235
|
+
getAll(request: Request): Record<string, string>;
|
|
236
|
+
has(request: Request, name: string): boolean;
|
|
237
|
+
contentType(request: Request): string | null;
|
|
238
|
+
acceptsJson(request: Request): boolean;
|
|
239
|
+
isAjax(request: Request): boolean;
|
|
240
|
+
authorization(request: Request): {
|
|
241
|
+
type: string;
|
|
242
|
+
credentials: string;
|
|
243
|
+
} | null;
|
|
244
|
+
bearerToken(request: Request): string | null;
|
|
245
|
+
security(): Record<string, string>;
|
|
246
|
+
cors(options?: {
|
|
247
|
+
origin?: string;
|
|
248
|
+
methods?: string[];
|
|
249
|
+
headers?: string[];
|
|
250
|
+
credentials?: boolean;
|
|
251
|
+
maxAge?: number;
|
|
252
|
+
}): Record<string, string>;
|
|
253
|
+
cache(options?: {
|
|
254
|
+
maxAge?: number;
|
|
255
|
+
sMaxAge?: number;
|
|
256
|
+
staleWhileRevalidate?: number;
|
|
257
|
+
private?: boolean;
|
|
258
|
+
noStore?: boolean;
|
|
259
|
+
}): Record<string, string>;
|
|
260
|
+
};
|
|
261
|
+
declare function parseJson<T = unknown>(request: Request): Promise<T>;
|
|
262
|
+
declare function parseFormData(request: Request): Promise<FormData>;
|
|
263
|
+
declare function parseSearchParams(request: Request): URLSearchParams;
|
|
264
|
+
declare function getMethod(request: Request): string;
|
|
265
|
+
declare function getPathname(request: Request): string;
|
|
266
|
+
declare function isMethod(request: Request, method: string | string[]): boolean;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Builds the complete route tree from the app/ directory
|
|
270
|
+
*/
|
|
271
|
+
declare function buildRouteTree(appDir: string): {
|
|
272
|
+
pages: any[];
|
|
273
|
+
api: any[];
|
|
274
|
+
layouts: Map<string, string>;
|
|
275
|
+
tree: Record<string, any>;
|
|
276
|
+
appRoutes: any[];
|
|
277
|
+
rootLayout?: string;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Matches URL path against routes
|
|
281
|
+
*/
|
|
282
|
+
declare function matchRoute(urlPath: string, routes: any[]): any;
|
|
283
|
+
/**
|
|
284
|
+
* Finds all layouts that apply to a route
|
|
285
|
+
*/
|
|
286
|
+
declare function findRouteLayouts(route: any, layoutsMap: Map<string, string>): Array<{
|
|
287
|
+
name: string;
|
|
288
|
+
filePath: string | undefined;
|
|
289
|
+
}>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Velix v5 Middleware System
|
|
293
|
+
* Request processing pipeline with composable middleware
|
|
294
|
+
*/
|
|
295
|
+
interface MiddlewareRequest {
|
|
296
|
+
url: string;
|
|
297
|
+
method: string;
|
|
298
|
+
headers: Record<string, string | string[] | undefined>;
|
|
299
|
+
cookies: Record<string, string>;
|
|
300
|
+
params: Record<string, string>;
|
|
301
|
+
query: Record<string, string>;
|
|
302
|
+
body?: any;
|
|
303
|
+
raw: http.IncomingMessage;
|
|
304
|
+
}
|
|
305
|
+
interface MiddlewareResponse {
|
|
306
|
+
status: (code: number) => MiddlewareResponse;
|
|
307
|
+
header: (name: string, value: string) => MiddlewareResponse;
|
|
308
|
+
json: (data: any) => void;
|
|
309
|
+
redirect: (url: string, status?: number) => void;
|
|
310
|
+
rewrite: (url: string) => void;
|
|
311
|
+
next: () => Promise<void>;
|
|
312
|
+
_statusCode: number;
|
|
313
|
+
_headers: Record<string, string>;
|
|
314
|
+
_redirectUrl: string | null;
|
|
315
|
+
_rewriteUrl: string | null;
|
|
316
|
+
_ended: boolean;
|
|
317
|
+
}
|
|
318
|
+
type MiddlewareFunction = (req: MiddlewareRequest, res: MiddlewareResponse, next: () => Promise<void>) => void | Promise<void>;
|
|
319
|
+
type MiddlewareResult = {
|
|
320
|
+
continue: boolean;
|
|
321
|
+
rewritten: boolean;
|
|
322
|
+
};
|
|
323
|
+
declare const middlewares: {
|
|
324
|
+
cors(options?: {
|
|
325
|
+
origin?: string | string[];
|
|
326
|
+
methods?: string[];
|
|
327
|
+
headers?: string[];
|
|
328
|
+
credentials?: boolean;
|
|
329
|
+
maxAge?: number;
|
|
330
|
+
}): MiddlewareFunction;
|
|
331
|
+
rateLimit(options?: {
|
|
332
|
+
windowMs?: number;
|
|
333
|
+
max?: number;
|
|
334
|
+
message?: string;
|
|
335
|
+
}): MiddlewareFunction;
|
|
336
|
+
security(): MiddlewareFunction;
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Loads middleware from the project's middleware/ directory
|
|
340
|
+
*/
|
|
341
|
+
declare function loadMiddleware(projectRoot: string): Promise<MiddlewareFunction[]>;
|
|
342
|
+
/**
|
|
343
|
+
* Runs middleware chain for a request
|
|
344
|
+
*/
|
|
345
|
+
declare function runMiddleware(req: http.IncomingMessage, res: http.ServerResponse, fns: MiddlewareFunction[]): Promise<MiddlewareResult>;
|
|
346
|
+
/**
|
|
347
|
+
* Compose multiple middleware into one
|
|
348
|
+
*/
|
|
349
|
+
declare function composeMiddleware(...fns: MiddlewareFunction[]): MiddlewareFunction;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Velix v5 Metadata & SEO System
|
|
353
|
+
*
|
|
354
|
+
* First-class SEO with automatic:
|
|
355
|
+
* - Meta tags, Open Graph, Twitter Cards
|
|
356
|
+
* - Canonical URLs, robots, sitemaps
|
|
357
|
+
* - JSON-LD structured data
|
|
358
|
+
* - Viewport, theme color, icons
|
|
359
|
+
*/
|
|
360
|
+
interface Metadata {
|
|
361
|
+
title?: string | {
|
|
362
|
+
default: string;
|
|
363
|
+
template?: string;
|
|
364
|
+
absolute?: string;
|
|
365
|
+
};
|
|
366
|
+
description?: string;
|
|
367
|
+
keywords?: string | string[];
|
|
368
|
+
authors?: Author | Author[];
|
|
369
|
+
creator?: string;
|
|
370
|
+
publisher?: string;
|
|
371
|
+
robots?: Robots | string;
|
|
372
|
+
icons?: Icons;
|
|
373
|
+
manifest?: string;
|
|
374
|
+
openGraph?: OpenGraph;
|
|
375
|
+
twitter?: Twitter;
|
|
376
|
+
verification?: Verification;
|
|
377
|
+
alternates?: Alternates;
|
|
378
|
+
viewport?: Viewport | string;
|
|
379
|
+
themeColor?: ThemeColor | ThemeColor[];
|
|
380
|
+
colorScheme?: 'normal' | 'light' | 'dark' | 'light dark' | 'dark light';
|
|
381
|
+
formatDetection?: FormatDetection;
|
|
382
|
+
metadataBase?: URL | string;
|
|
383
|
+
generator?: string;
|
|
384
|
+
applicationName?: string;
|
|
385
|
+
referrer?: string;
|
|
386
|
+
other?: Record<string, string | string[]>;
|
|
387
|
+
}
|
|
388
|
+
interface Author {
|
|
389
|
+
name?: string;
|
|
390
|
+
url?: string;
|
|
391
|
+
}
|
|
392
|
+
interface Robots {
|
|
393
|
+
index?: boolean;
|
|
394
|
+
follow?: boolean;
|
|
395
|
+
noarchive?: boolean;
|
|
396
|
+
nosnippet?: boolean;
|
|
397
|
+
noimageindex?: boolean;
|
|
398
|
+
nocache?: boolean;
|
|
399
|
+
googleBot?: Robots | string;
|
|
400
|
+
}
|
|
401
|
+
interface Icons {
|
|
402
|
+
icon?: IconDescriptor | IconDescriptor[];
|
|
403
|
+
shortcut?: IconDescriptor | IconDescriptor[];
|
|
404
|
+
apple?: IconDescriptor | IconDescriptor[];
|
|
405
|
+
other?: IconDescriptor[];
|
|
406
|
+
}
|
|
407
|
+
interface IconDescriptor {
|
|
408
|
+
url: string;
|
|
409
|
+
type?: string;
|
|
410
|
+
sizes?: string;
|
|
411
|
+
color?: string;
|
|
412
|
+
rel?: string;
|
|
413
|
+
media?: string;
|
|
414
|
+
}
|
|
415
|
+
interface OpenGraph {
|
|
416
|
+
type?: string;
|
|
417
|
+
url?: string;
|
|
418
|
+
title?: string;
|
|
419
|
+
description?: string;
|
|
420
|
+
siteName?: string;
|
|
421
|
+
locale?: string;
|
|
422
|
+
images?: OGImage | OGImage[];
|
|
423
|
+
videos?: OGVideo | OGVideo[];
|
|
424
|
+
determiner?: string;
|
|
425
|
+
publishedTime?: string;
|
|
426
|
+
modifiedTime?: string;
|
|
427
|
+
expirationTime?: string;
|
|
428
|
+
authors?: string | string[];
|
|
429
|
+
section?: string;
|
|
430
|
+
tags?: string[];
|
|
431
|
+
}
|
|
432
|
+
interface OGImage {
|
|
433
|
+
url: string;
|
|
434
|
+
secureUrl?: string;
|
|
435
|
+
type?: string;
|
|
436
|
+
width?: number;
|
|
437
|
+
height?: number;
|
|
438
|
+
alt?: string;
|
|
439
|
+
}
|
|
440
|
+
interface OGVideo {
|
|
441
|
+
url: string;
|
|
442
|
+
secureUrl?: string;
|
|
443
|
+
type?: string;
|
|
444
|
+
width?: number;
|
|
445
|
+
height?: number;
|
|
446
|
+
}
|
|
447
|
+
interface Twitter {
|
|
448
|
+
card?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
449
|
+
site?: string;
|
|
450
|
+
siteId?: string;
|
|
451
|
+
creator?: string;
|
|
452
|
+
creatorId?: string;
|
|
453
|
+
title?: string;
|
|
454
|
+
description?: string;
|
|
455
|
+
images?: string | TwitterImage | (string | TwitterImage)[];
|
|
456
|
+
}
|
|
457
|
+
interface TwitterImage {
|
|
458
|
+
url: string;
|
|
459
|
+
alt?: string;
|
|
460
|
+
}
|
|
461
|
+
interface Verification {
|
|
462
|
+
google?: string | string[];
|
|
463
|
+
yahoo?: string | string[];
|
|
464
|
+
yandex?: string | string[];
|
|
465
|
+
other?: Record<string, string | string[]>;
|
|
466
|
+
}
|
|
467
|
+
interface Alternates {
|
|
468
|
+
canonical?: string;
|
|
469
|
+
languages?: Record<string, string>;
|
|
470
|
+
media?: Record<string, string>;
|
|
471
|
+
}
|
|
472
|
+
interface Viewport {
|
|
473
|
+
width?: number | 'device-width';
|
|
474
|
+
height?: number | 'device-height';
|
|
475
|
+
initialScale?: number;
|
|
476
|
+
minimumScale?: number;
|
|
477
|
+
maximumScale?: number;
|
|
478
|
+
userScalable?: boolean;
|
|
479
|
+
viewportFit?: 'auto' | 'cover' | 'contain';
|
|
480
|
+
}
|
|
481
|
+
interface ThemeColor {
|
|
482
|
+
color: string;
|
|
483
|
+
media?: string;
|
|
484
|
+
}
|
|
485
|
+
interface FormatDetection {
|
|
486
|
+
telephone?: boolean;
|
|
487
|
+
date?: boolean;
|
|
488
|
+
address?: boolean;
|
|
489
|
+
email?: boolean;
|
|
490
|
+
}
|
|
491
|
+
declare function generateMetadataTags(metadata: Metadata, baseUrl?: string): string;
|
|
492
|
+
declare function mergeMetadata(parent: Metadata, child: Metadata): Metadata;
|
|
493
|
+
declare function generateJsonLd(data: Record<string, any>): string;
|
|
494
|
+
declare const jsonLd: {
|
|
495
|
+
website: (c: {
|
|
496
|
+
name: string;
|
|
497
|
+
url: string;
|
|
498
|
+
description?: string;
|
|
499
|
+
}) => {
|
|
500
|
+
'@context': string;
|
|
501
|
+
'@type': string;
|
|
502
|
+
name: string;
|
|
503
|
+
url: string;
|
|
504
|
+
description: string | undefined;
|
|
505
|
+
};
|
|
506
|
+
article: (c: {
|
|
507
|
+
headline: string;
|
|
508
|
+
description?: string;
|
|
509
|
+
image?: string | string[];
|
|
510
|
+
datePublished: string;
|
|
511
|
+
dateModified?: string;
|
|
512
|
+
author: {
|
|
513
|
+
name: string;
|
|
514
|
+
url?: string;
|
|
515
|
+
} | {
|
|
516
|
+
name: string;
|
|
517
|
+
url?: string;
|
|
518
|
+
}[];
|
|
519
|
+
}) => {
|
|
520
|
+
'@context': string;
|
|
521
|
+
'@type': string;
|
|
522
|
+
headline: string;
|
|
523
|
+
description: string | undefined;
|
|
524
|
+
image: string | string[] | undefined;
|
|
525
|
+
datePublished: string;
|
|
526
|
+
dateModified: string;
|
|
527
|
+
author: {
|
|
528
|
+
name: string;
|
|
529
|
+
url?: string;
|
|
530
|
+
'@type': string;
|
|
531
|
+
}[] | {
|
|
532
|
+
name: string;
|
|
533
|
+
url?: string;
|
|
534
|
+
'@type': string;
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
organization: (c: {
|
|
538
|
+
name: string;
|
|
539
|
+
url: string;
|
|
540
|
+
logo?: string;
|
|
541
|
+
sameAs?: string[];
|
|
542
|
+
}) => {
|
|
543
|
+
'@context': string;
|
|
544
|
+
'@type': string;
|
|
545
|
+
name: string;
|
|
546
|
+
url: string;
|
|
547
|
+
logo: string | undefined;
|
|
548
|
+
sameAs: string[] | undefined;
|
|
549
|
+
};
|
|
550
|
+
breadcrumb: (items: {
|
|
551
|
+
name: string;
|
|
552
|
+
url: string;
|
|
553
|
+
}[]) => {
|
|
554
|
+
'@context': string;
|
|
555
|
+
'@type': string;
|
|
556
|
+
itemListElement: {
|
|
557
|
+
'@type': string;
|
|
558
|
+
position: number;
|
|
559
|
+
name: string;
|
|
560
|
+
item: string;
|
|
561
|
+
}[];
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Generate sitemap.xml content from routes
|
|
566
|
+
*/
|
|
567
|
+
declare function generateSitemap(routes: any[], baseUrl: string): string;
|
|
568
|
+
/**
|
|
569
|
+
* Generate robots.txt content
|
|
570
|
+
*/
|
|
571
|
+
declare function generateRobotsTxt(baseUrl: string, options?: {
|
|
572
|
+
disallow?: string[];
|
|
573
|
+
allow?: string[];
|
|
574
|
+
}): string;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Velix v5 Server Actions
|
|
578
|
+
*
|
|
579
|
+
* React 19 native actions with Velix enhancements and security.
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
declare global {
|
|
583
|
+
var __VELIX_ACTIONS__: Record<string, ServerActionFunction>;
|
|
584
|
+
var __VELIX_ACTION_CONTEXT__: ActionContext | null;
|
|
585
|
+
}
|
|
586
|
+
interface ActionContext {
|
|
587
|
+
request: Request;
|
|
588
|
+
cookies: typeof cookies;
|
|
589
|
+
headers: typeof headers;
|
|
590
|
+
redirect: typeof redirect;
|
|
591
|
+
notFound: typeof notFound;
|
|
592
|
+
}
|
|
593
|
+
type ServerActionFunction = (...args: any[]) => Promise<any>;
|
|
594
|
+
interface ActionResult<T = any> {
|
|
595
|
+
success: boolean;
|
|
596
|
+
data?: T;
|
|
597
|
+
error?: string;
|
|
598
|
+
redirect?: string;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Decorator to mark a function as a server action
|
|
602
|
+
*/
|
|
603
|
+
declare function serverAction<T extends ServerActionFunction>(fn: T, actionId?: string): T;
|
|
604
|
+
declare function registerAction(id: string, fn: ServerActionFunction): void;
|
|
605
|
+
declare function getAction(id: string): ServerActionFunction | undefined;
|
|
606
|
+
/**
|
|
607
|
+
* Execute a server action on the server
|
|
608
|
+
*/
|
|
609
|
+
declare function executeAction(actionId: string, args: any[], context?: Partial<ActionContext>): Promise<ActionResult>;
|
|
610
|
+
/**
|
|
611
|
+
* Call a server action from the client
|
|
612
|
+
*/
|
|
613
|
+
declare function callServerAction(actionId: string, args: any[]): Promise<ActionResult>;
|
|
614
|
+
declare function deserializeArgs(args: any[]): any[];
|
|
615
|
+
declare function useActionContext(): ActionContext | null;
|
|
616
|
+
declare function formAction<T>(action: (formData: FormData) => Promise<T>): (formData: FormData) => Promise<ActionResult<T>>;
|
|
617
|
+
declare function useVelixAction<State, Payload>(action: (state: Awaited<State>, payload: Payload) => State | Promise<State>, initialState: Awaited<State>, permalink?: string): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
|
618
|
+
declare function bindArgs<T extends ServerActionFunction>(action: T, ...boundArgs: any[]): T;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Velix v5 Revalidation & Cache Management
|
|
622
|
+
* Inspired by Next.js revalidatePath and revalidateTag
|
|
623
|
+
*/
|
|
624
|
+
type RevalidationType = 'path' | 'tag' | 'layout';
|
|
625
|
+
declare class CacheManager {
|
|
626
|
+
private cache;
|
|
627
|
+
private tagIndex;
|
|
628
|
+
set(path: string, data: any, tags?: string[]): void;
|
|
629
|
+
get(path: string): any | null;
|
|
630
|
+
revalidatePath(path: string): void;
|
|
631
|
+
revalidateTag(tag: string): void;
|
|
632
|
+
clear(): void;
|
|
633
|
+
has(path: string): boolean;
|
|
634
|
+
}
|
|
635
|
+
declare const cacheManager: CacheManager;
|
|
636
|
+
/**
|
|
637
|
+
* Revalidate a specific path
|
|
638
|
+
* @example
|
|
639
|
+
* ```ts
|
|
640
|
+
* import { revalidatePath } from 'velix/actions';
|
|
641
|
+
*
|
|
642
|
+
* await revalidatePath('/blog');
|
|
643
|
+
* await revalidatePath('/blog/[slug]', 'layout');
|
|
644
|
+
* ```
|
|
645
|
+
*/
|
|
646
|
+
declare function revalidatePath(path: string, type?: RevalidationType): void;
|
|
647
|
+
/**
|
|
648
|
+
* Revalidate all paths with a specific cache tag
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* import { revalidateTag } from 'velix/actions';
|
|
652
|
+
*
|
|
653
|
+
* await revalidateTag('blog-posts');
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
declare function revalidateTag(tag: string): void;
|
|
657
|
+
/**
|
|
658
|
+
* Unstable cache wrapper (experimental)
|
|
659
|
+
*/
|
|
660
|
+
declare function unstable_cache<T>(fn: () => Promise<T>, keys: string[], options?: {
|
|
661
|
+
tags?: string[];
|
|
662
|
+
revalidate?: number;
|
|
663
|
+
}): () => Promise<T>;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Velix v5 Hooks
|
|
667
|
+
* React 19 hooks re-exports and Velix-specific hook utilities
|
|
668
|
+
*/
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Async data fetching hook using React 19's use()
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* ```tsx
|
|
675
|
+
* function UserProfile({ userId }: { userId: string }) {
|
|
676
|
+
* const user = useAsyncData(fetchUser(userId));
|
|
677
|
+
* return <div>{user.name}</div>;
|
|
678
|
+
* }
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
declare function useAsyncData<T>(promise: Promise<T>): T;
|
|
682
|
+
/**
|
|
683
|
+
* Optimistic mutation helper with typed update function
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```tsx
|
|
687
|
+
* const [optimisticTodos, addOptimistic] = useOptimisticMutation(
|
|
688
|
+
* todos,
|
|
689
|
+
* (state, newTodo: Todo) => [...state, { ...newTodo, pending: true }]
|
|
690
|
+
* );
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
declare function useOptimisticMutation<T, M>(currentState: T, updateFn: (state: T, mutation: M) => T): [T, (mutation: M) => void];
|
|
694
|
+
/**
|
|
695
|
+
* Resource preloading for Suspense optimization
|
|
696
|
+
*/
|
|
697
|
+
declare function preloadResource<T>(fetcher: () => Promise<T>): Promise<T>;
|
|
698
|
+
|
|
699
|
+
interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'srcSet'> {
|
|
700
|
+
src: string;
|
|
701
|
+
alt: string;
|
|
702
|
+
width?: number | string;
|
|
703
|
+
height?: number | string;
|
|
704
|
+
quality?: number;
|
|
705
|
+
priority?: boolean;
|
|
706
|
+
unoptimized?: boolean;
|
|
707
|
+
}
|
|
708
|
+
declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Velix v5 Utility Functions
|
|
712
|
+
*/
|
|
713
|
+
/**
|
|
714
|
+
* Generates a unique hash for cache busting
|
|
715
|
+
*/
|
|
716
|
+
declare function generateHash(content: string): string;
|
|
717
|
+
/**
|
|
718
|
+
* Escapes HTML special characters
|
|
719
|
+
*/
|
|
720
|
+
declare function escapeHtml(str: string): string;
|
|
721
|
+
/**
|
|
722
|
+
* Recursively finds all files matching a pattern
|
|
723
|
+
*/
|
|
724
|
+
declare function findFiles(dir: string, pattern: RegExp, files?: string[]): string[];
|
|
725
|
+
/**
|
|
726
|
+
* Ensures a directory exists
|
|
727
|
+
*/
|
|
728
|
+
declare function ensureDir(dir: string): void;
|
|
729
|
+
/**
|
|
730
|
+
* Cleans a directory
|
|
731
|
+
*/
|
|
732
|
+
declare function cleanDir(dir: string): void;
|
|
733
|
+
/**
|
|
734
|
+
* Copies a directory recursively
|
|
735
|
+
*/
|
|
736
|
+
declare function copyDir(src: string, dest: string): void;
|
|
737
|
+
/**
|
|
738
|
+
* Debounce function for file watching
|
|
739
|
+
*/
|
|
740
|
+
declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
741
|
+
/**
|
|
742
|
+
* Formats bytes to human-readable string
|
|
743
|
+
*/
|
|
744
|
+
declare function formatBytes(bytes: number): string;
|
|
745
|
+
/**
|
|
746
|
+
* Formats milliseconds to human-readable string
|
|
747
|
+
*/
|
|
748
|
+
declare function formatTime(ms: number): string;
|
|
749
|
+
/**
|
|
750
|
+
* Sleep utility
|
|
751
|
+
*/
|
|
752
|
+
declare function sleep(ms: number): Promise<void>;
|
|
753
|
+
/**
|
|
754
|
+
* Check if a file is a server component (has 'use server' directive)
|
|
755
|
+
*/
|
|
756
|
+
declare function isServerComponent(filePath: string): boolean;
|
|
757
|
+
/**
|
|
758
|
+
* Check if a file is a client component (has 'use client' directive)
|
|
759
|
+
*/
|
|
760
|
+
declare function isClientComponent(filePath: string): boolean;
|
|
761
|
+
/**
|
|
762
|
+
* Check if a component is an island (has 'use island' directive)
|
|
763
|
+
*/
|
|
764
|
+
declare function isIsland(filePath: string): boolean;
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Velix v5 Logger
|
|
768
|
+
* Minimalist, professional output inspired by modern CLIs
|
|
769
|
+
*/
|
|
770
|
+
declare const logger: {
|
|
771
|
+
logo(): void;
|
|
772
|
+
serverStart(config: any, startTime?: number): void;
|
|
773
|
+
request(method: string, path: string, status: number, time: number, extra?: {
|
|
774
|
+
type?: string;
|
|
775
|
+
}): void;
|
|
776
|
+
info(msg: string): void;
|
|
777
|
+
success(msg: string): void;
|
|
778
|
+
warn(msg: string): void;
|
|
779
|
+
error(msg: string, err?: Error | null): void;
|
|
780
|
+
compile(file: string, time: number): void;
|
|
781
|
+
hmr(file: string): void;
|
|
782
|
+
plugin(name: string): void;
|
|
783
|
+
route(path: string, type: string): void;
|
|
784
|
+
divider(): void;
|
|
785
|
+
blank(): void;
|
|
786
|
+
portInUse(port: number | string): void;
|
|
787
|
+
build(stats: {
|
|
788
|
+
time: number;
|
|
789
|
+
}): void;
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
export { type ActionState, type ApiHandler, type BuildOptions, type BuildResult, type CookieOptions, type ErrorComponent, type ErrorProps, Image, type ImageProps, type IslandConfig, type IslandManifest, type LayoutComponent, type LayoutProps, type LoadingComponent, type LoadingProps, type Metadata$1 as Metadata, type Middleware, type NextFunction, type NotFoundComponent, NotFoundError, type NotFoundProps, type PageComponent, type PageProps, RedirectError, type Route, type RouteMatch, type RouteTree, type RouteType, type ServerAction, type StaticPath, type StaticProps, type TypedActionResult, type VelixPlugin, bindArgs, buildRouteTree, cacheManager, callServerAction, cleanDir, composeMiddleware, cookies, copyDir, debounce, deserializeArgs, ensureDir, escapeHtml, executeAction, findFiles, findRouteLayouts, formAction, formatBytes, formatTime, generateHash, generateJsonLd, generateMetadataTags, generateRobotsTxt, generateSitemap, getAction, getMethod, getPathname, headers, html, isClientComponent, isIsland as isIslandComponent, isMethod, isServerComponent, json, jsonLd, loadMiddleware, logger, matchRoute, mergeMetadata, middlewares, notFound, parseFormData, parseJson, parseSearchParams, preloadResource, redirect, registerAction, revalidatePath, revalidateTag, runMiddleware, serverAction, sleep, text, unstable_cache, useActionContext, useAsyncData, useOptimisticMutation, useVelixAction };
|