@teamvelix/velix 5.1.6 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/build/index.js +3 -2
- package/dist/chunk-4S5YQJHB.js +11 -0
- package/dist/chunk-4S5YQJHB.js.map +1 -0
- package/dist/{chunk-TGNK4MY5.js → chunk-DTF3KTLR.js} +116 -53
- package/dist/chunk-DTF3KTLR.js.map +1 -0
- package/dist/{chunk-OIZNYND3.js → chunk-JI2HJFUT.js} +2 -2
- package/dist/chunk-JI2HJFUT.js.map +1 -0
- package/dist/{chunk-RFWV4CDG.js → chunk-QIPVMOXL.js} +4 -4
- package/dist/chunk-QIPVMOXL.js.map +1 -0
- package/dist/{chunk-INOZP2VD.js → chunk-QLFG6PW3.js} +3 -2
- package/dist/chunk-QLFG6PW3.js.map +1 -0
- package/dist/{chunk-BXDKUP2L.js → chunk-XXPHGRLC.js} +3 -3
- package/dist/{chunk-BXDKUP2L.js.map → chunk-XXPHGRLC.js.map} +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +2 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +1 -0
- package/dist/{image-optimizer-I6TWWH6W.js → image-optimizer-KPRXE5VI.js} +3 -3
- package/dist/image-optimizer-KPRXE5VI.js.map +1 -0
- package/dist/index-8CqitL9K.d.ts +300 -0
- package/dist/{index-C4udNtpZ.d.ts → index-ChyKLf1W.d.ts} +18 -3
- package/dist/index.d.ts +104 -226
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/islands/index.d.ts +22 -10
- package/dist/islands/index.js +2 -1
- package/dist/runtime/start-build.js +2 -2
- package/dist/runtime/start-build.js.map +1 -1
- package/dist/runtime/start-dev.js +117 -46
- package/dist/runtime/start-dev.js.map +1 -1
- package/dist/runtime/start-prod.js +117 -46
- package/dist/runtime/start-prod.js.map +1 -1
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.js +4 -3
- package/package.json +60 -58
- package/dist/chunk-INOZP2VD.js.map +0 -1
- package/dist/chunk-OIZNYND3.js.map +0 -1
- package/dist/chunk-RFWV4CDG.js.map +0 -1
- package/dist/chunk-TGNK4MY5.js.map +0 -1
- package/dist/image-optimizer-I6TWWH6W.js.map +0 -1
- package/dist/index-DYgxL3mE.d.ts +0 -107
package/dist/index.d.ts
CHANGED
|
@@ -1,162 +1,76 @@
|
|
|
1
1
|
export { VelixConfig, VelixConfigSchema, defaultConfig, defineConfig, loadConfig, resolvePaths } from './config.js';
|
|
2
|
+
import { R as Route, a as RouteTreeNode, b as RouteType } from './index-8CqitL9K.js';
|
|
3
|
+
export { m as ActionState, A as ApiHandler, B as BuildOptions, o as BuildResult, h as ErrorComponent, E as ErrorProps, I as IslandConfig, k as IslandManifest, g as LayoutComponent, L as LayoutProps, i as LoadingComponent, e as LoadingProps, n as Metadata, M as Middleware, l as NextFunction, j as NotFoundComponent, N as NotFoundProps, f as PageComponent, P as PageProps, x as PluginHooks, w as PluginManager, d as RouteMatch, c as RouteTree, S as ServerAction, p as StaticPath, q as StaticProps, T as TypedActionResult, V as VelixPlugin, s as VelixServer, r as createServer, t as definePlugin, v as loadPlugins, u as pluginManager, y as tailwindPlugin } from './index-8CqitL9K.js';
|
|
4
|
+
export { InferActionInput, InferActionOutput, InferLoaderData } from '@teamvelix/velix-core';
|
|
2
5
|
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-DYgxL3mE.js';
|
|
7
6
|
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-
|
|
7
|
+
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-ChyKLf1W.js';
|
|
8
|
+
import React, { ImgHTMLAttributes } from 'react';
|
|
9
|
+
export { use, useActionState, useOptimistic } from 'react';
|
|
9
10
|
export { build } from './build/index.js';
|
|
10
11
|
export { useFormStatus } from 'react-dom';
|
|
11
12
|
import 'zod';
|
|
13
|
+
import '@teamvelix/velix-react';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
|
-
* Velix v5
|
|
15
|
-
*
|
|
16
|
+
* Velix v5 Middleware System
|
|
17
|
+
* Request processing pipeline with composable middleware
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
19
|
+
interface MiddlewareRequest {
|
|
20
|
+
url: string;
|
|
21
|
+
method: string;
|
|
22
|
+
headers: Record<string, string | string[] | undefined>;
|
|
23
|
+
cookies: Record<string, string>;
|
|
46
24
|
params: Record<string, string>;
|
|
47
|
-
|
|
48
|
-
type Request$1 = IncomingMessage & {
|
|
49
|
-
params?: Record<string, string>;
|
|
50
|
-
query?: Record<string, string>;
|
|
25
|
+
query: Record<string, string>;
|
|
51
26
|
body?: unknown;
|
|
52
|
-
|
|
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>;
|
|
27
|
+
raw: http.IncomingMessage;
|
|
132
28
|
}
|
|
133
|
-
interface
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
};
|
|
29
|
+
interface MiddlewareResponse {
|
|
30
|
+
status: (code: number) => MiddlewareResponse;
|
|
31
|
+
header: (name: string, value: string) => MiddlewareResponse;
|
|
32
|
+
json: (data: unknown) => void;
|
|
33
|
+
redirect: (url: string, status?: number) => void;
|
|
34
|
+
rewrite: (url: string) => void;
|
|
35
|
+
next: () => Promise<void>;
|
|
36
|
+
_statusCode: number;
|
|
37
|
+
_headers: Record<string, string>;
|
|
38
|
+
_redirectUrl: string | null;
|
|
39
|
+
_rewriteUrl: string | null;
|
|
40
|
+
_ended: boolean;
|
|
159
41
|
}
|
|
42
|
+
type MiddlewareFunction = (req: MiddlewareRequest, res: MiddlewareResponse, next: () => Promise<void>) => void | Promise<void>;
|
|
43
|
+
type MiddlewareResult = {
|
|
44
|
+
continue: boolean;
|
|
45
|
+
rewritten: boolean;
|
|
46
|
+
};
|
|
47
|
+
declare const middlewares: {
|
|
48
|
+
cors(options?: {
|
|
49
|
+
origin?: string | string[];
|
|
50
|
+
methods?: string[];
|
|
51
|
+
headers?: string[];
|
|
52
|
+
credentials?: boolean;
|
|
53
|
+
maxAge?: number;
|
|
54
|
+
}): MiddlewareFunction;
|
|
55
|
+
rateLimit(options?: {
|
|
56
|
+
windowMs?: number;
|
|
57
|
+
max?: number;
|
|
58
|
+
message?: string;
|
|
59
|
+
}): MiddlewareFunction;
|
|
60
|
+
security(): MiddlewareFunction;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Loads proxy middleware from the project root (proxy.ts or proxy.js)
|
|
64
|
+
*/
|
|
65
|
+
declare function loadMiddleware(projectRoot: string): Promise<MiddlewareFunction[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Runs middleware chain for a request
|
|
68
|
+
*/
|
|
69
|
+
declare function runMiddleware(req: http.IncomingMessage, res: http.ServerResponse, fns: MiddlewareFunction[]): Promise<MiddlewareResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Compose multiple middleware into one
|
|
72
|
+
*/
|
|
73
|
+
declare function composeMiddleware(...fns: MiddlewareFunction[]): MiddlewareFunction;
|
|
160
74
|
|
|
161
75
|
/**
|
|
162
76
|
* Velix v5 Server Helpers
|
|
@@ -269,85 +183,41 @@ declare function isMethod(request: Request, method: string | string[]): boolean;
|
|
|
269
183
|
* Builds the complete route tree from the app/ directory
|
|
270
184
|
*/
|
|
271
185
|
declare function buildRouteTree(appDir: string): {
|
|
272
|
-
pages:
|
|
273
|
-
api:
|
|
186
|
+
pages: Route[];
|
|
187
|
+
api: Route[];
|
|
274
188
|
layouts: Map<string, string>;
|
|
275
|
-
tree:
|
|
276
|
-
appRoutes:
|
|
189
|
+
tree: RouteTreeNode;
|
|
190
|
+
appRoutes: Route[];
|
|
277
191
|
rootLayout?: string;
|
|
278
192
|
};
|
|
279
193
|
/**
|
|
280
194
|
* Matches URL path against routes
|
|
281
195
|
*/
|
|
282
|
-
declare function matchRoute(urlPath: string, routes:
|
|
196
|
+
declare function matchRoute(urlPath: string, routes: Route[]): {
|
|
197
|
+
params: Record<string, string>;
|
|
198
|
+
type: RouteType;
|
|
199
|
+
path: string;
|
|
200
|
+
filePath: string;
|
|
201
|
+
pattern: RegExp;
|
|
202
|
+
segments: string[];
|
|
203
|
+
layout?: string | null;
|
|
204
|
+
loading?: string | null;
|
|
205
|
+
error?: string | null;
|
|
206
|
+
notFound?: string | null;
|
|
207
|
+
template?: string | null;
|
|
208
|
+
middleware?: string | null;
|
|
209
|
+
isServerComponent?: boolean;
|
|
210
|
+
isClientComponent?: boolean;
|
|
211
|
+
isIsland?: boolean;
|
|
212
|
+
} | null;
|
|
283
213
|
/**
|
|
284
214
|
* Finds all layouts that apply to a route
|
|
285
215
|
*/
|
|
286
|
-
declare function findRouteLayouts(route:
|
|
216
|
+
declare function findRouteLayouts(route: Route, layoutsMap: Map<string, string>): Array<{
|
|
287
217
|
name: string;
|
|
288
218
|
filePath: string | undefined;
|
|
289
219
|
}>;
|
|
290
220
|
|
|
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
221
|
/**
|
|
352
222
|
* Velix v5 Metadata & SEO System
|
|
353
223
|
*
|
|
@@ -490,7 +360,7 @@ interface FormatDetection {
|
|
|
490
360
|
}
|
|
491
361
|
declare function generateMetadataTags(metadata: Metadata, baseUrl?: string): string;
|
|
492
362
|
declare function mergeMetadata(parent: Metadata, child: Metadata): Metadata;
|
|
493
|
-
declare function generateJsonLd(data: Record<string,
|
|
363
|
+
declare function generateJsonLd(data: Record<string, unknown>): string;
|
|
494
364
|
declare const jsonLd: {
|
|
495
365
|
website: (c: {
|
|
496
366
|
name: string;
|
|
@@ -564,7 +434,10 @@ declare const jsonLd: {
|
|
|
564
434
|
/**
|
|
565
435
|
* Generate sitemap.xml content from routes
|
|
566
436
|
*/
|
|
567
|
-
declare function generateSitemap(routes:
|
|
437
|
+
declare function generateSitemap(routes: Array<{
|
|
438
|
+
type: string;
|
|
439
|
+
path: string;
|
|
440
|
+
}>, baseUrl: string): string;
|
|
568
441
|
/**
|
|
569
442
|
* Generate robots.txt content
|
|
570
443
|
*/
|
|
@@ -590,8 +463,8 @@ interface ActionContext {
|
|
|
590
463
|
redirect: typeof redirect;
|
|
591
464
|
notFound: typeof notFound;
|
|
592
465
|
}
|
|
593
|
-
type ServerActionFunction = (...args:
|
|
594
|
-
interface ActionResult<T =
|
|
466
|
+
type ServerActionFunction<TArgs extends unknown[] = unknown[], TReturn = unknown> = (...args: TArgs) => Promise<TReturn>;
|
|
467
|
+
interface ActionResult<T = unknown> {
|
|
595
468
|
success: boolean;
|
|
596
469
|
data?: T;
|
|
597
470
|
error?: string;
|
|
@@ -600,22 +473,22 @@ interface ActionResult<T = any> {
|
|
|
600
473
|
/**
|
|
601
474
|
* Decorator to mark a function as a server action
|
|
602
475
|
*/
|
|
603
|
-
declare function serverAction<
|
|
476
|
+
declare function serverAction<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, actionId?: string): (...args: TArgs) => Promise<ActionResult<TReturn>>;
|
|
604
477
|
declare function registerAction(id: string, fn: ServerActionFunction): void;
|
|
605
478
|
declare function getAction(id: string): ServerActionFunction | undefined;
|
|
606
479
|
/**
|
|
607
480
|
* Execute a server action on the server
|
|
608
481
|
*/
|
|
609
|
-
declare function executeAction(actionId: string, args:
|
|
482
|
+
declare function executeAction(actionId: string, args: unknown[], context?: Partial<ActionContext>): Promise<ActionResult>;
|
|
610
483
|
/**
|
|
611
484
|
* Call a server action from the client
|
|
612
485
|
*/
|
|
613
|
-
declare function callServerAction(actionId: string, args:
|
|
614
|
-
declare function deserializeArgs(args:
|
|
486
|
+
declare function callServerAction(actionId: string, args: unknown[]): Promise<ActionResult>;
|
|
487
|
+
declare function deserializeArgs(args: unknown[]): unknown[];
|
|
615
488
|
declare function useActionContext(): ActionContext | null;
|
|
616
489
|
declare function formAction<T>(action: (formData: FormData) => Promise<T>): (formData: FormData) => Promise<ActionResult<T>>;
|
|
617
490
|
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<
|
|
491
|
+
declare function bindArgs<TArgs extends unknown[], TBound extends unknown[], TReturn>(action: (...args: [...TBound, ...TArgs]) => Promise<ActionResult<TReturn>>, ...boundArgs: TBound): (...args: TArgs) => Promise<ActionResult<TReturn>>;
|
|
619
492
|
|
|
620
493
|
/**
|
|
621
494
|
* Velix v5 Revalidation & Cache Management
|
|
@@ -625,8 +498,8 @@ type RevalidationType = 'path' | 'tag' | 'layout';
|
|
|
625
498
|
declare class CacheManager {
|
|
626
499
|
private cache;
|
|
627
500
|
private tagIndex;
|
|
628
|
-
set(path: string, data:
|
|
629
|
-
get(path: string):
|
|
501
|
+
set(path: string, data: unknown, tags?: string[]): void;
|
|
502
|
+
get(path: string): unknown | null;
|
|
630
503
|
revalidatePath(path: string): void;
|
|
631
504
|
revalidateTag(tag: string): void;
|
|
632
505
|
clear(): void;
|
|
@@ -737,7 +610,7 @@ declare function copyDir(src: string, dest: string): void;
|
|
|
737
610
|
/**
|
|
738
611
|
* Debounce function for file watching
|
|
739
612
|
*/
|
|
740
|
-
declare function debounce<T extends (...args:
|
|
613
|
+
declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
741
614
|
/**
|
|
742
615
|
* Formats bytes to human-readable string
|
|
743
616
|
*/
|
|
@@ -769,7 +642,12 @@ declare function isIsland(filePath: string): boolean;
|
|
|
769
642
|
*/
|
|
770
643
|
declare const logger: {
|
|
771
644
|
logo(): void;
|
|
772
|
-
serverStart(config:
|
|
645
|
+
serverStart(config: {
|
|
646
|
+
port: number | string;
|
|
647
|
+
host: string;
|
|
648
|
+
mode: string;
|
|
649
|
+
pagesDir?: string;
|
|
650
|
+
}, startTime?: number): void;
|
|
773
651
|
request(method: string, path: string, status: number, time: number, extra?: {
|
|
774
652
|
type?: string;
|
|
775
653
|
}): void;
|
|
@@ -789,4 +667,4 @@ declare const logger: {
|
|
|
789
667
|
}): void;
|
|
790
668
|
};
|
|
791
669
|
|
|
792
|
-
export { type
|
|
670
|
+
export { type CookieOptions, Image, type ImageProps, NotFoundError, RedirectError, Route, RouteType, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { build } from './chunk-
|
|
2
|
-
export { LayoutContext, Link, RequestContext, RouteContext, createRequestContext, hydrate, router, useParams, usePathname, useQuery, useRequest, useRouter } from './chunk-
|
|
3
|
-
export { NotFoundError, PluginHooks, PluginManager, RedirectError, bindArgs, callServerAction, composeMiddleware, cookies, createServer, definePlugin, deserializeArgs, executeAction, formAction, generateJsonLd, generateMetadataTags, generateRobotsTxt, generateSitemap, getAction, getMethod, getPathname, headers, html, isMethod, json, jsonLd, loadMiddleware, loadPlugins, mergeMetadata, middlewares, notFound, parseFormData, parseJson, parseSearchParams, pluginManager, redirect, registerAction, runMiddleware, serverAction, tailwindPlugin, text, useActionContext, useActionState, useFormStatus, useOptimistic, useVelixAction } from './chunk-
|
|
4
|
-
export { buildRouteTree, cleanDir, copyDir, debounce, ensureDir, escapeHtml, findFiles, findRouteLayouts, formatBytes, formatTime, generateHash, isClientComponent, isIsland as isIslandComponent, isServerComponent, logger, matchRoute, sleep } from './chunk-
|
|
1
|
+
export { build } from './chunk-XXPHGRLC.js';
|
|
2
|
+
export { LayoutContext, Link, RequestContext, RouteContext, createRequestContext, hydrate, router, useParams, usePathname, useQuery, useRequest, useRouter } from './chunk-QLFG6PW3.js';
|
|
3
|
+
export { NotFoundError, PluginHooks, PluginManager, RedirectError, bindArgs, callServerAction, composeMiddleware, cookies, createServer, definePlugin, deserializeArgs, executeAction, formAction, generateJsonLd, generateMetadataTags, generateRobotsTxt, generateSitemap, getAction, getMethod, getPathname, headers, html, isMethod, json, jsonLd, loadMiddleware, loadPlugins, mergeMetadata, middlewares, notFound, parseFormData, parseJson, parseSearchParams, pluginManager, redirect, registerAction, runMiddleware, serverAction, tailwindPlugin, text, useActionContext, useActionState, useFormStatus, useOptimistic, useVelixAction } from './chunk-DTF3KTLR.js';
|
|
4
|
+
export { buildRouteTree, cleanDir, copyDir, debounce, ensureDir, escapeHtml, findFiles, findRouteLayouts, formatBytes, formatTime, generateHash, isClientComponent, isIsland as isIslandComponent, isServerComponent, logger, matchRoute, sleep } from './chunk-QIPVMOXL.js';
|
|
5
5
|
export { VelixConfigSchema, defaultConfig, defineConfig, loadConfig, resolvePaths } from './chunk-F24Q2MX3.js';
|
|
6
|
-
export { Island, LoadStrategy, createIsland, createLazyIsland, generateAdvancedHydrationScript, generateHydrationScript, getRegisteredIslands } from './chunk-
|
|
7
|
-
import
|
|
6
|
+
export { Island, LoadStrategy, createIsland, createLazyIsland, generateAdvancedHydrationScript, generateHydrationScript, getRegisteredIslands } from './chunk-JI2HJFUT.js';
|
|
7
|
+
import './chunk-4S5YQJHB.js';
|
|
8
|
+
import React, { forwardRef, useState, use, useOptimistic } from 'react';
|
|
8
9
|
export { use } from 'react';
|
|
9
10
|
import 'react-dom';
|
|
10
11
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -86,6 +87,11 @@ function unstable_cache(fn, keys, options) {
|
|
|
86
87
|
return result;
|
|
87
88
|
};
|
|
88
89
|
}
|
|
90
|
+
React.createContext(null);
|
|
91
|
+
React.createContext(null);
|
|
92
|
+
React.createContext(null);
|
|
93
|
+
|
|
94
|
+
// ../velix-react/src/hooks/index.ts
|
|
89
95
|
function useAsyncData(promise) {
|
|
90
96
|
return use(promise);
|
|
91
97
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../actions/revalidation.ts","../hooks/index.ts","../components/Image.tsx"],"names":["use","useOptimisticReact"],"mappings":";;;;;;;;;;;;AAcA,IAAM,eAAN,MAAmB;AAAA,EACT,KAAA,uBAAY,GAAA,EAAwB;AAAA,EACpC,QAAA,uBAAe,GAAA,EAAyB;AAAA,EAEhD,GAAA,CAAI,IAAA,EAAc,IAAA,EAAW,IAAA,GAAiB,EAAC,EAAS;AACtD,IAAA,MAAM,KAAA,GAAoB;AAAA,MACxB,IAAA;AAAA,MACA,IAAA,EAAM,IAAI,GAAA,CAAI,IAAI,CAAA;AAAA,MAClB,SAAA,EAAW,KAAK,GAAA,EAAI;AAAA,MACpB;AAAA,KACF;AAEA,IAAA,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,IAAA,EAAM,KAAK,CAAA;AAG1B,IAAA,IAAA,CAAK,QAAQ,CAAA,GAAA,KAAO;AAClB,MAAA,IAAI,CAAC,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAG,CAAA,EAAG;AAC3B,QAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAA,kBAAK,IAAI,KAAK,CAAA;AAAA,MAClC;AACA,MAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAG,CAAA,CAAG,IAAI,IAAI,CAAA;AAAA,IAClC,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,IAAI,IAAA,EAA0B;AAC5B,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,IAAI,CAAA;AACjC,IAAA,OAAO,KAA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MAC9B,QAAA,EAAU,WAAW,MAAA,GAAS,OAAA;AAAA,MAC9B,SAAA;AAAA,MACA,KAAA,EAAO;AAAA,QACL,KAAA,EAAO,aAAA;AAAA,QACP,GAAG;AAAA,OACL;AAAA,MACA,MAAA,EAAQ,CAAC,CAAA,KAAM;AACb,QAAA,WAAA,CAAY,IAAI,CAAA;AAChB,QAAA,IAAI,IAAA,CAAK,MAAA,EAAQ,IAAA,CAAK,MAAA,CAAO,CAAC,CAAA;AAAA,MAChC,CAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ,CAAC;AAED,KAAA,CAAM,WAAA,GAAc,OAAA","file":"index.js","sourcesContent":["/**\n * Velix v5 Revalidation & Cache Management\n * Inspired by Next.js revalidatePath and revalidateTag\n */\n\nexport type RevalidationType = 'path' | 'tag' | 'layout';\n\ninterface CacheEntry {\n path: string;\n tags: Set<string>;\n timestamp: number;\n data: any;\n}\n\nclass CacheManager {\n private cache = new Map<string, CacheEntry>();\n private tagIndex = new Map<string, Set<string>>();\n\n set(path: string, data: any, tags: string[] = []): void {\n const entry: CacheEntry = {\n path,\n tags: new Set(tags),\n timestamp: Date.now(),\n data,\n };\n\n this.cache.set(path, entry);\n\n // Index by tags\n tags.forEach(tag => {\n if (!this.tagIndex.has(tag)) {\n this.tagIndex.set(tag, new Set());\n }\n this.tagIndex.get(tag)!.add(path);\n });\n }\n\n get(path: string): any | null {\n const entry = this.cache.get(path);\n return entry ? entry.data : null;\n }\n\n revalidatePath(path: string): void {\n this.cache.delete(path);\n }\n\n revalidateTag(tag: string): void {\n const paths = this.tagIndex.get(tag);\n if (paths) {\n paths.forEach(path => this.cache.delete(path));\n this.tagIndex.delete(tag);\n }\n }\n\n clear(): void {\n this.cache.clear();\n this.tagIndex.clear();\n }\n\n has(path: string): boolean {\n return this.cache.has(path);\n }\n}\n\nexport const cacheManager = new CacheManager();\n\n/**\n * Revalidate a specific path\n * @example\n * ```ts\n * import { revalidatePath } from 'velix/actions';\n * \n * await revalidatePath('/blog');\n * await revalidatePath('/blog/[slug]', 'layout');\n * ```\n */\nexport function revalidatePath(path: string, type: RevalidationType = 'path'): void {\n cacheManager.revalidatePath(path);\n \n // Notify connected clients via HMR\n if (typeof global !== 'undefined' && (global as any).__VELIX_HMR_SERVER__) {\n (global as any).__VELIX_HMR_SERVER__.broadcast(JSON.stringify({\n type: 'revalidate',\n path,\n revalidationType: type,\n }));\n }\n}\n\n/**\n * Revalidate all paths with a specific cache tag\n * @example\n * ```ts\n * import { revalidateTag } from 'velix/actions';\n * \n * await revalidateTag('blog-posts');\n * ```\n */\nexport function revalidateTag(tag: string): void {\n cacheManager.revalidateTag(tag);\n\n // Notify connected clients\n if (typeof global !== 'undefined' && (global as any).__VELIX_HMR_SERVER__) {\n (global as any).__VELIX_HMR_SERVER__.broadcast(JSON.stringify({\n type: 'revalidate',\n tag,\n }));\n }\n}\n\n/**\n * Unstable cache wrapper (experimental)\n */\nexport function unstable_cache<T>(\n fn: () => Promise<T>,\n keys: string[],\n options?: { tags?: string[]; revalidate?: number }\n): () => Promise<T> {\n return async () => {\n const cacheKey = keys.join(':');\n \n if (cacheManager.has(cacheKey)) {\n return cacheManager.get(cacheKey);\n }\n\n const result = await fn();\n cacheManager.set(cacheKey, result, options?.tags || []);\n\n if (options?.revalidate) {\n setTimeout(() => {\n cacheManager.revalidatePath(cacheKey);\n }, options.revalidate * 1000);\n }\n\n return result;\n };\n}\n","/**\n * Velix v5 Hooks\n * React 19 hooks re-exports and Velix-specific hook utilities\n */\n\n// React 19 Core Hooks\nexport { useActionState, useOptimistic, use } from 'react';\nexport { useFormStatus } from 'react-dom';\n\n// Velix Context Hooks\nexport { useParams, useQuery, usePathname, useRequest } from '../context.js';\n\n// ============================================================================\n// Velix Enhanced Hooks\n// ============================================================================\n\nimport { use, useOptimistic as useOptimisticReact } from 'react';\n\n/**\n * Async data fetching hook using React 19's use()\n *\n * @example\n * ```tsx\n * function UserProfile({ userId }: { userId: string }) {\n * const user = useAsyncData(fetchUser(userId));\n * return <div>{user.name}</div>;\n * }\n * ```\n */\nexport function useAsyncData<T>(promise: Promise<T>): T {\n return use(promise);\n}\n\n/**\n * Optimistic mutation helper with typed update function\n *\n * @example\n * ```tsx\n * const [optimisticTodos, addOptimistic] = useOptimisticMutation(\n * todos,\n * (state, newTodo: Todo) => [...state, { ...newTodo, pending: true }]\n * );\n * ```\n */\nexport function useOptimisticMutation<T, M>(\n currentState: T,\n updateFn: (state: T, mutation: M) => T\n): [T, (mutation: M) => void] {\n return useOptimisticReact(currentState, updateFn);\n}\n\n/**\n * Resource preloading for Suspense optimization\n */\nexport function preloadResource<T>(fetcher: () => Promise<T>): Promise<T> {\n return fetcher();\n}\n\nexport default { useAsyncData, useOptimisticMutation, preloadResource };\n","import React, { ImgHTMLAttributes, forwardRef, useState, useEffect } from 'react';\n\nexport interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'srcSet'> {\n src: string;\n alt: string;\n width?: number | string;\n height?: number | string;\n quality?: number;\n priority?: boolean;\n unoptimized?: boolean;\n}\n\nconst defaultWidths = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\nconst defaultQuality = 75;\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(({\n src,\n alt,\n width,\n height,\n quality = defaultQuality,\n priority = false,\n unoptimized = false,\n className,\n style,\n ...rest\n}, ref) => {\n const [isLoaded, setIsLoaded] = useState(false);\n\n // If it's an external URL (http) or unoptimized is set, we skip the optimization router\n const isExternal = src.startsWith('http');\n const skipOptimization = unoptimized || (isExternal && !src.includes('our-domain'));\n\n const generateSrcSet = () => {\n if (skipOptimization) return undefined;\n return defaultWidths\n .map(w => `/__velix/image?url=${encodeURIComponent(src)}&w=${w}&q=${quality} ${w}w`)\n .join(', ');\n };\n\n const optimizedSrc = skipOptimization\n ? src\n : `/__velix/image?url=${encodeURIComponent(src)}&w=${width || 1080}&q=${quality}`;\n\n return (\n <img\n ref={ref}\n src={optimizedSrc}\n srcSet={generateSrcSet()}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n decoding={priority ? 'sync' : 'async'}\n className={className}\n style={{\n color: 'transparent',\n ...style\n }}\n onLoad={(e) => {\n setIsLoaded(true);\n if (rest.onLoad) rest.onLoad(e);\n }}\n {...rest}\n />\n );\n});\n\nImage.displayName = 'Image';\n"]}
|
|
1
|
+
{"version":3,"sources":["../actions/revalidation.ts","../../velix-react/src/context.ts","../../velix-react/src/hooks/index.ts","../../velix-react/src/components/Image.tsx"],"names":["use","useOptimisticReact","useState"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,eAAN,MAAmB;AAAA,EACT,KAAA,uBAAY,GAAA,EAAwB;AAAA,EACpC,QAAA,uBAAe,GAAA,EAAyB;AAAA,EAEhD,GAAA,CAAI,IAAA,EAAc,IAAA,EAAe,IAAA,GAAiB,EAAC,EAAS;AAC1D,IAAA,MAAM,KAAA,GAAoB;AAAA,MACxB,IAAA;AAAA,MACA,IAAA,EAAM,IAAI,GAAA,CAAI,IAAI,CAAA;AAAA,MAClB,SAAA,EAAW,KAAK,GAAA,EAAI;AAAA,MACpB;AAAA,KACF;AAEA,IAAA,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,IAAA,EAAM,KAAK,CAAA;AAG1B,IAAA,IAAA,CAAK,QAAQ,CAAA,GAAA,KAAO;AAClB,MAAA,IAAI,CAAC,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAG,CAAA,EAAG;AAC3B,QAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAA,kBAAK,IAAI,KAAK,CAAA;AAAA,MAClC;AACA,MAAA,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,GAAG,CAAA,CAAG,IAAI,IAAI,CAAA;AAAA,IAClC,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,IAAI,IAAA,EAA8B;AAChC,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,IAAI,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GAAA,EAAK,YAAA;AAAA,MACL,QAAQ,cAAA,EAAe;AAAA,MACvB,GAAA;AAAA,MACA,KAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA,EAAS,WAAW,OAAA,GAAU,MAAA;AAAA,MAC9B,QAAA,EAAU,WAAW,MAAA,GAAS,OAAA;AAAA,MAC9B,SAAA;AAAA,MACA,KAAA,EAAO;AAAA,QACL,KAAA,EAAO,aAAA;AAAA,QACP,GAAG;AAAA,OACL;AAAA,MACA,MAAA,EAAQ,CAAC,CAAA,KAAM;AACb,QAAA,WAAA,CAAY,IAAI,CAAA;AAChB,QAAA,IAAI,IAAA,CAAK,MAAA,EAAQ,IAAA,CAAK,MAAA,CAAO,CAAC,CAAA;AAAA,MAChC,CAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ,CAAC;AAED,KAAA,CAAM,WAAA,GAAc,OAAA","file":"index.js","sourcesContent":["/**\n * Velix v5 Revalidation & Cache Management\n * Inspired by Next.js revalidatePath and revalidateTag\n */\n\nexport type RevalidationType = 'path' | 'tag' | 'layout';\n\ninterface CacheEntry {\n path: string;\n tags: Set<string>;\n timestamp: number;\n data: unknown;\n}\n\nclass CacheManager {\n private cache = new Map<string, CacheEntry>();\n private tagIndex = new Map<string, Set<string>>();\n\n set(path: string, data: unknown, tags: string[] = []): void {\n const entry: CacheEntry = {\n path,\n tags: new Set(tags),\n timestamp: Date.now(),\n data,\n };\n\n this.cache.set(path, entry);\n\n // Index by tags\n tags.forEach(tag => {\n if (!this.tagIndex.has(tag)) {\n this.tagIndex.set(tag, new Set());\n }\n this.tagIndex.get(tag)!.add(path);\n });\n }\n\n get(path: string): unknown | null {\n const entry = this.cache.get(path);\n return entry ? entry.data : null;\n }\n\n revalidatePath(path: string): void {\n this.cache.delete(path);\n }\n\n revalidateTag(tag: string): void {\n const paths = this.tagIndex.get(tag);\n if (paths) {\n paths.forEach(path => this.cache.delete(path));\n this.tagIndex.delete(tag);\n }\n }\n\n clear(): void {\n this.cache.clear();\n this.tagIndex.clear();\n }\n\n has(path: string): boolean {\n return this.cache.has(path);\n }\n}\n\nexport const cacheManager = new CacheManager();\n\n/**\n * Revalidate a specific path\n * @example\n * ```ts\n * import { revalidatePath } from 'velix/actions';\n * \n * await revalidatePath('/blog');\n * await revalidatePath('/blog/[slug]', 'layout');\n * ```\n */\nexport function revalidatePath(path: string, type: RevalidationType = 'path'): void {\n cacheManager.revalidatePath(path);\n \n // Notify connected clients via HMR\n if (typeof global !== 'undefined' && (global as unknown as { __VELIX_HMR_SERVER__?: { broadcast: (msg: string) => void } }).__VELIX_HMR_SERVER__) {\n (global as unknown as { __VELIX_HMR_SERVER__: { broadcast: (msg: string) => void } }).__VELIX_HMR_SERVER__.broadcast(JSON.stringify({\n type: 'revalidate',\n path,\n revalidationType: type,\n }));\n }\n}\n\n/**\n * Revalidate all paths with a specific cache tag\n * @example\n * ```ts\n * import { revalidateTag } from 'velix/actions';\n * \n * await revalidateTag('blog-posts');\n * ```\n */\nexport function revalidateTag(tag: string): void {\n cacheManager.revalidateTag(tag);\n\n // Notify connected clients\n if (typeof global !== 'undefined' && (global as unknown as { __VELIX_HMR_SERVER__?: { broadcast: (msg: string) => void } }).__VELIX_HMR_SERVER__) {\n (global as unknown as { __VELIX_HMR_SERVER__: { broadcast: (msg: string) => void } }).__VELIX_HMR_SERVER__.broadcast(JSON.stringify({\n type: 'revalidate',\n tag,\n }));\n }\n}\n\n/**\n * Unstable cache wrapper (experimental)\n */\nexport function unstable_cache<T>(\n fn: () => Promise<T>,\n keys: string[],\n options?: { tags?: string[]; revalidate?: number }\n): () => Promise<T> {\n return async () => {\n const cacheKey = keys.join(':');\n \n if (cacheManager.has(cacheKey)) {\n return cacheManager.get(cacheKey) as T;\n }\n\n const result = await fn();\n cacheManager.set(cacheKey, result, options?.tags || []);\n\n if (options?.revalidate) {\n setTimeout(() => {\n cacheManager.revalidatePath(cacheKey);\n }, options.revalidate * 1000);\n }\n\n return result;\n };\n}\n","/**\n * Velix v5 Context System\n * Provides request context and shared state for SSR\n */\n\nimport React from 'react';\n\n// Route context type\ninterface RouteContextType {\n params: Record<string, string>;\n query: Record<string, string>;\n pathname: string;\n}\n\n// Server-side request context\ninterface RequestContextType {\n req: import('http').IncomingMessage;\n res: import('http').ServerResponse;\n params: Record<string, string>;\n query: Record<string, string>;\n url: string | undefined;\n method: string | undefined;\n headers: import('http').IncomingHttpHeaders;\n cookies: Record<string, string>;\n}\nexport const RequestContext = React.createContext<RequestContextType | null>(null);\n\n// Route context for nested routes\nexport const RouteContext = React.createContext<RouteContextType | null>(null);\n\n// Layout context\ninterface LayoutContextType {\n children: React.ReactNode;\n params?: Record<string, string>;\n}\nexport const LayoutContext = React.createContext<LayoutContextType | null>(null);\n\n/**\n * Creates a request context value\n */\nexport function createRequestContext(\n req: import('http').IncomingMessage,\n res: import('http').ServerResponse,\n params: Record<string, string> = {},\n query: Record<string, string> = {}\n) {\n return {\n req,\n res,\n params,\n query,\n url: req.url,\n method: req.method,\n headers: req.headers,\n cookies: parseCookies(req.headers.cookie || '')\n };\n}\n\n/**\n * Parse cookies from header string\n */\nfunction parseCookies(cookieHeader: string): Record<string, string> {\n const cookies: Record<string, string> = {};\n if (!cookieHeader) return cookies;\n cookieHeader.split(';').forEach((cookie: string) => {\n const [name, ...rest] = cookie.split('=');\n if (name) cookies[name.trim()] = rest.join('=').trim();\n });\n return cookies;\n}\n\n/**\n * Hook to access request context (server-side only)\n */\nexport function useRequest() {\n const context = React.useContext(RequestContext);\n if (!context) throw new Error('useRequest must be used within a RequestContext provider');\n return context;\n}\n\n/**\n * Hook to access route params\n */\nexport function useParams() {\n const context = React.useContext(RouteContext);\n return context?.params || {};\n}\n\n/**\n * Hook to access query parameters\n */\nexport function useQuery() {\n const context = React.useContext(RouteContext);\n return context?.query || {};\n}\n\n/**\n * Hook to access current pathname\n */\nexport function usePathname() {\n const context = React.useContext(RouteContext);\n return context?.pathname || '/';\n}\n","/**\n * Velix v5 Hooks\n * React 19 hooks re-exports and Velix-specific hook utilities\n */\n\n// React 19 Core Hooks\nexport { useActionState, useOptimistic, use } from 'react';\nexport { useFormStatus } from 'react-dom';\n\n// Velix Context Hooks\nexport { useParams, useQuery, usePathname, useRequest } from '../context.js';\n\n// ============================================================================\n// Velix Enhanced Hooks\n// ============================================================================\n\nimport { use, useOptimistic as useOptimisticReact } from 'react';\n\n/**\n * Async data fetching hook using React 19's use()\n *\n * @example\n * ```tsx\n * function UserProfile({ userId }: { userId: string }) {\n * const user = useAsyncData(fetchUser(userId));\n * return <div>{user.name}</div>;\n * }\n * ```\n */\nexport function useAsyncData<T>(promise: Promise<T>): T {\n return use(promise);\n}\n\n/**\n * Optimistic mutation helper with typed update function\n *\n * @example\n * ```tsx\n * const [optimisticTodos, addOptimistic] = useOptimisticMutation(\n * todos,\n * (state, newTodo: Todo) => [...state, { ...newTodo, pending: true }]\n * );\n * ```\n */\nexport function useOptimisticMutation<T, M>(\n currentState: T,\n updateFn: (state: T, mutation: M) => T\n): [T, (mutation: M) => void] {\n return useOptimisticReact(currentState, updateFn);\n}\n\n/**\n * Resource preloading for Suspense optimization\n */\nexport function preloadResource<T>(fetcher: () => Promise<T>): Promise<T> {\n return fetcher();\n}\n\nexport * from './use-action.js';\n\nexport default { useAsyncData, useOptimisticMutation, preloadResource };\n","import React, { ImgHTMLAttributes, forwardRef, useState, useEffect } from 'react';\n\nexport interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'srcSet'> {\n src: string;\n alt: string;\n width?: number | string;\n height?: number | string;\n quality?: number;\n priority?: boolean;\n unoptimized?: boolean;\n}\n\nconst defaultWidths = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\nconst defaultQuality = 75;\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(({\n src,\n alt,\n width,\n height,\n quality = defaultQuality,\n priority = false,\n unoptimized = false,\n className,\n style,\n ...rest\n}, ref) => {\n const [isLoaded, setIsLoaded] = useState(false);\n\n // If it's an external URL (http) or unoptimized is set, we skip the optimization router\n const isExternal = src.startsWith('http');\n const skipOptimization = unoptimized || (isExternal && !src.includes('our-domain'));\n\n const generateSrcSet = () => {\n if (skipOptimization) return undefined;\n return defaultWidths\n .map(w => `/__velix/image?url=${encodeURIComponent(src)}&w=${w}&q=${quality} ${w}w`)\n .join(', ');\n };\n\n const optimizedSrc = skipOptimization\n ? src\n : `/__velix/image?url=${encodeURIComponent(src)}&w=${width || 1080}&q=${quality}`;\n\n return (\n <img\n ref={ref}\n src={optimizedSrc}\n srcSet={generateSrcSet()}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n decoding={priority ? 'sync' : 'async'}\n className={className}\n style={{\n color: 'transparent',\n ...style\n }}\n onLoad={(e) => {\n setIsLoaded(true);\n if (rest.onLoad) rest.onLoad(e);\n }}\n {...rest}\n />\n );\n});\n\nImage.displayName = 'Image';\n"]}
|
package/dist/islands/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ import React from 'react';
|
|
|
13
13
|
* Island wrapper component for server-side rendering
|
|
14
14
|
*/
|
|
15
15
|
declare function Island({ component: Component, props, name, clientPath }: {
|
|
16
|
-
component: React.ComponentType<
|
|
17
|
-
props?:
|
|
16
|
+
component: React.ComponentType<Record<string, unknown>>;
|
|
17
|
+
props?: Record<string, unknown>;
|
|
18
18
|
name: string;
|
|
19
19
|
clientPath: string;
|
|
20
20
|
}): React.ReactElement<{
|
|
@@ -29,18 +29,18 @@ declare function getRegisteredIslands(): any[];
|
|
|
29
29
|
/**
|
|
30
30
|
* Creates an island component wrapper
|
|
31
31
|
*/
|
|
32
|
-
declare function createIsland(Component: React.ComponentType<
|
|
32
|
+
declare function createIsland(Component: React.ComponentType<Record<string, unknown>>, options?: {
|
|
33
33
|
name?: string;
|
|
34
34
|
clientPath?: string;
|
|
35
35
|
}): {
|
|
36
|
-
(props:
|
|
36
|
+
(props: Record<string, unknown>): React.ReactElement<{
|
|
37
37
|
'data-island': string;
|
|
38
38
|
'data-island-name': string;
|
|
39
39
|
'data-island-props': string;
|
|
40
40
|
}, string | React.JSXElementConstructor<any>>;
|
|
41
41
|
displayName: string;
|
|
42
42
|
isIsland: boolean;
|
|
43
|
-
originalComponent: React.ComponentType<
|
|
43
|
+
originalComponent: React.ComponentType<Record<string, unknown>>;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
46
|
* Island loading strategies
|
|
@@ -54,15 +54,15 @@ declare const LoadStrategy: {
|
|
|
54
54
|
/**
|
|
55
55
|
* Creates a lazy island that hydrates based on strategy
|
|
56
56
|
*/
|
|
57
|
-
declare function createLazyIsland(Component: React.ComponentType<
|
|
57
|
+
declare function createLazyIsland(Component: React.ComponentType<Record<string, unknown>>, options?: {
|
|
58
58
|
name?: string;
|
|
59
59
|
clientPath?: string;
|
|
60
60
|
strategy?: string;
|
|
61
61
|
media?: string | null;
|
|
62
62
|
}): {
|
|
63
|
-
(props:
|
|
63
|
+
(props: Record<string, unknown>): React.ReactElement<{
|
|
64
64
|
'data-island': string;
|
|
65
|
-
'data-island-name':
|
|
65
|
+
'data-island-name': string;
|
|
66
66
|
'data-island-strategy': string;
|
|
67
67
|
'data-island-media': string | null;
|
|
68
68
|
'data-island-props': string;
|
|
@@ -74,11 +74,23 @@ declare function createLazyIsland(Component: React.ComponentType<any>, options?:
|
|
|
74
74
|
/**
|
|
75
75
|
* Generates the client-side hydration script for islands
|
|
76
76
|
*/
|
|
77
|
-
declare function generateHydrationScript(islands:
|
|
77
|
+
declare function generateHydrationScript(islands: Array<{
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
clientPath: string;
|
|
81
|
+
props: Record<string, unknown>;
|
|
82
|
+
}>): string;
|
|
78
83
|
/**
|
|
79
84
|
* Generates advanced hydration script with loading strategies
|
|
80
85
|
*/
|
|
81
|
-
declare function generateAdvancedHydrationScript(islands:
|
|
86
|
+
declare function generateAdvancedHydrationScript(islands: Array<{
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
clientPath: string;
|
|
90
|
+
props: Record<string, unknown>;
|
|
91
|
+
strategy?: string;
|
|
92
|
+
media?: string | null;
|
|
93
|
+
}>): string;
|
|
82
94
|
declare const _default: {
|
|
83
95
|
Island: typeof Island;
|
|
84
96
|
createIsland: typeof createIsland;
|
package/dist/islands/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { Island, LoadStrategy, createIsland, createLazyIsland, islands_default as default, generateAdvancedHydrationScript, generateHydrationScript, getRegisteredIslands } from '../chunk-
|
|
1
|
+
export { Island, LoadStrategy, createIsland, createLazyIsland, islands_default as default, generateAdvancedHydrationScript, generateHydrationScript, getRegisteredIslands } from '../chunk-JI2HJFUT.js';
|
|
2
|
+
import '../chunk-4S5YQJHB.js';
|
|
2
3
|
//# sourceMappingURL=index.js.map
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -196,7 +196,7 @@ function buildRouteTree(appDir) {
|
|
|
196
196
|
pages: [],
|
|
197
197
|
api: [],
|
|
198
198
|
layouts: /* @__PURE__ */ new Map(),
|
|
199
|
-
tree: {},
|
|
199
|
+
tree: { children: {}, routes: [] },
|
|
200
200
|
appRoutes: []
|
|
201
201
|
};
|
|
202
202
|
if (fs3.existsSync(appDir)) {
|
|
@@ -348,7 +348,7 @@ function buildTree(routes) {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// version.ts
|
|
351
|
-
var VERSION = "5.1.
|
|
351
|
+
var VERSION = "5.1.7";
|
|
352
352
|
|
|
353
353
|
// logger.ts
|
|
354
354
|
var colors = {
|