@flightdev/core 0.6.7
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 +541 -0
- package/dist/actions/index.d.ts +743 -0
- package/dist/actions/index.js +3 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/adapters/index.d.ts +502 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/cache/index.d.ts +191 -0
- package/dist/cache/index.js +3 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/chunk-62HISNA3.js +354 -0
- package/dist/chunk-62HISNA3.js.map +1 -0
- package/dist/chunk-63LWTEDQ.js +341 -0
- package/dist/chunk-63LWTEDQ.js.map +1 -0
- package/dist/chunk-63SCEXD7.js +3 -0
- package/dist/chunk-63SCEXD7.js.map +1 -0
- package/dist/chunk-72MYOTUB.js +667 -0
- package/dist/chunk-72MYOTUB.js.map +1 -0
- package/dist/chunk-7CNW24MQ.js +257 -0
- package/dist/chunk-7CNW24MQ.js.map +1 -0
- package/dist/chunk-7WIEAUJT.js +300 -0
- package/dist/chunk-7WIEAUJT.js.map +1 -0
- package/dist/chunk-7ZZF4ULK.js +259 -0
- package/dist/chunk-7ZZF4ULK.js.map +1 -0
- package/dist/chunk-AE3JTS73.js +222 -0
- package/dist/chunk-AE3JTS73.js.map +1 -0
- package/dist/chunk-AP5NLUSB.js +258 -0
- package/dist/chunk-AP5NLUSB.js.map +1 -0
- package/dist/chunk-C37YQQI7.js +221 -0
- package/dist/chunk-C37YQQI7.js.map +1 -0
- package/dist/chunk-DCLVXFVH.js +225 -0
- package/dist/chunk-DCLVXFVH.js.map +1 -0
- package/dist/chunk-DZMWWDFD.js +223 -0
- package/dist/chunk-DZMWWDFD.js.map +1 -0
- package/dist/chunk-GCQZ4FHI.js +245 -0
- package/dist/chunk-GCQZ4FHI.js.map +1 -0
- package/dist/chunk-IPP44XY6.js +47 -0
- package/dist/chunk-IPP44XY6.js.map +1 -0
- package/dist/chunk-IW7FTQQX.js +267 -0
- package/dist/chunk-IW7FTQQX.js.map +1 -0
- package/dist/chunk-JX4YSCBH.js +428 -0
- package/dist/chunk-JX4YSCBH.js.map +1 -0
- package/dist/chunk-KX6UYWWR.js +229 -0
- package/dist/chunk-KX6UYWWR.js.map +1 -0
- package/dist/chunk-LWVETFJV.js +46 -0
- package/dist/chunk-LWVETFJV.js.map +1 -0
- package/dist/chunk-MCL2MCA2.js +285 -0
- package/dist/chunk-MCL2MCA2.js.map +1 -0
- package/dist/chunk-MZXCF35B.js +205 -0
- package/dist/chunk-MZXCF35B.js.map +1 -0
- package/dist/chunk-NCGPUFWV.js +96 -0
- package/dist/chunk-NCGPUFWV.js.map +1 -0
- package/dist/chunk-OEJMIE2Q.js +351 -0
- package/dist/chunk-OEJMIE2Q.js.map +1 -0
- package/dist/chunk-OYF2OAKS.js +394 -0
- package/dist/chunk-OYF2OAKS.js.map +1 -0
- package/dist/chunk-P6S43FYZ.js +316 -0
- package/dist/chunk-P6S43FYZ.js.map +1 -0
- package/dist/chunk-PL37KFRJ.js +3 -0
- package/dist/chunk-PL37KFRJ.js.map +1 -0
- package/dist/chunk-Q7BS5QC5.js +197 -0
- package/dist/chunk-Q7BS5QC5.js.map +1 -0
- package/dist/chunk-SDYPG3JD.js +288 -0
- package/dist/chunk-SDYPG3JD.js.map +1 -0
- package/dist/chunk-SUG56SZO.js +256 -0
- package/dist/chunk-SUG56SZO.js.map +1 -0
- package/dist/chunk-UVH5XJRP.js +164 -0
- package/dist/chunk-UVH5XJRP.js.map +1 -0
- package/dist/chunk-WZIJKCL3.js +282 -0
- package/dist/chunk-WZIJKCL3.js.map +1 -0
- package/dist/chunk-Y22AMGTM.js +3 -0
- package/dist/chunk-Y22AMGTM.js.map +1 -0
- package/dist/chunk-Z7G23XWU.js +200 -0
- package/dist/chunk-Z7G23XWU.js.map +1 -0
- package/dist/chunk-ZJU5M4IB.js +125 -0
- package/dist/chunk-ZJU5M4IB.js.map +1 -0
- package/dist/chunk-ZVC3ZWLM.js +52 -0
- package/dist/chunk-ZVC3ZWLM.js.map +1 -0
- package/dist/chunk-ZZZML7Y3.js +310 -0
- package/dist/chunk-ZZZML7Y3.js.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.js +16 -0
- package/dist/client.js.map +1 -0
- package/dist/config/index.d.ts +170 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/errors/index.d.ts +267 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/file-router/index.d.ts +184 -0
- package/dist/file-router/index.js +3 -0
- package/dist/file-router/index.js.map +1 -0
- package/dist/file-router/streaming-hints.d.ts +129 -0
- package/dist/file-router/streaming-hints.js +3 -0
- package/dist/file-router/streaming-hints.js.map +1 -0
- package/dist/handlers/index.d.ts +59 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index.d.ts +588 -0
- package/dist/index.js +886 -0
- package/dist/index.js.map +1 -0
- package/dist/islands/index.d.ts +234 -0
- package/dist/islands/index.js +3 -0
- package/dist/islands/index.js.map +1 -0
- package/dist/middleware/index.d.ts +305 -0
- package/dist/middleware/index.js +3 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/react/index.d.ts +73 -0
- package/dist/react/index.js +52 -0
- package/dist/react/index.js.map +1 -0
- package/dist/render/index.d.ts +131 -0
- package/dist/render/index.js +3 -0
- package/dist/render/index.js.map +1 -0
- package/dist/router/index.d.ts +65 -0
- package/dist/router/index.js +3 -0
- package/dist/router/index.js.map +1 -0
- package/dist/rsc/adapters/index.d.ts +8 -0
- package/dist/rsc/adapters/index.js +7 -0
- package/dist/rsc/adapters/index.js.map +1 -0
- package/dist/rsc/adapters/preact.d.ts +97 -0
- package/dist/rsc/adapters/preact.js +3 -0
- package/dist/rsc/adapters/preact.js.map +1 -0
- package/dist/rsc/adapters/react.d.ts +82 -0
- package/dist/rsc/adapters/react.js +3 -0
- package/dist/rsc/adapters/react.js.map +1 -0
- package/dist/rsc/adapters/solid.d.ts +84 -0
- package/dist/rsc/adapters/solid.js +3 -0
- package/dist/rsc/adapters/solid.js.map +1 -0
- package/dist/rsc/adapters/vue.d.ts +80 -0
- package/dist/rsc/adapters/vue.js +3 -0
- package/dist/rsc/adapters/vue.js.map +1 -0
- package/dist/rsc/boundaries.d.ts +182 -0
- package/dist/rsc/boundaries.js +3 -0
- package/dist/rsc/boundaries.js.map +1 -0
- package/dist/rsc/context.d.ts +201 -0
- package/dist/rsc/context.js +3 -0
- package/dist/rsc/context.js.map +1 -0
- package/dist/rsc/index.d.ts +232 -0
- package/dist/rsc/index.js +15 -0
- package/dist/rsc/index.js.map +1 -0
- package/dist/rsc/legacy.d.ts +155 -0
- package/dist/rsc/legacy.js +3 -0
- package/dist/rsc/legacy.js.map +1 -0
- package/dist/rsc/payload.d.ts +262 -0
- package/dist/rsc/payload.js +3 -0
- package/dist/rsc/payload.js.map +1 -0
- package/dist/rsc/plugins/esbuild.d.ts +124 -0
- package/dist/rsc/plugins/esbuild.js +4 -0
- package/dist/rsc/plugins/esbuild.js.map +1 -0
- package/dist/rsc/plugins/index.d.ts +4 -0
- package/dist/rsc/plugins/index.js +6 -0
- package/dist/rsc/plugins/index.js.map +1 -0
- package/dist/rsc/plugins/rollup.d.ts +103 -0
- package/dist/rsc/plugins/rollup.js +4 -0
- package/dist/rsc/plugins/rollup.js.map +1 -0
- package/dist/rsc/renderer.d.ts +162 -0
- package/dist/rsc/renderer.js +5 -0
- package/dist/rsc/renderer.js.map +1 -0
- package/dist/rsc/stream.d.ts +129 -0
- package/dist/rsc/stream.js +3 -0
- package/dist/rsc/stream.js.map +1 -0
- package/dist/rsc/vite-plugin.d.ts +78 -0
- package/dist/rsc/vite-plugin.js +4 -0
- package/dist/rsc/vite-plugin.js.map +1 -0
- package/dist/server/index.d.ts +135 -0
- package/dist/server/index.js +6 -0
- package/dist/server/index.js.map +1 -0
- package/dist/streaming/adapters/index.d.ts +223 -0
- package/dist/streaming/adapters/index.js +3 -0
- package/dist/streaming/adapters/index.js.map +1 -0
- package/dist/streaming/conditional.d.ts +130 -0
- package/dist/streaming/conditional.js +3 -0
- package/dist/streaming/conditional.js.map +1 -0
- package/dist/streaming/index.d.ts +177 -0
- package/dist/streaming/index.js +3 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/observability.d.ts +201 -0
- package/dist/streaming/observability.js +4 -0
- package/dist/streaming/observability.js.map +1 -0
- package/dist/streaming/priority.d.ts +103 -0
- package/dist/streaming/priority.js +3 -0
- package/dist/streaming/priority.js.map +1 -0
- package/dist/utils/index.d.ts +42 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +228 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ServerContext } from '../context.js';
|
|
2
|
+
import { FlightElement, FlightChunk } from '../payload.js';
|
|
3
|
+
import { UIAdapter } from '../renderer.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Minimal Preact VNode interface
|
|
7
|
+
*/
|
|
8
|
+
interface PreactVNode {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key: string | number | null;
|
|
12
|
+
ref: unknown;
|
|
13
|
+
__?: unknown;
|
|
14
|
+
__k?: unknown[];
|
|
15
|
+
__b?: number;
|
|
16
|
+
__e?: unknown;
|
|
17
|
+
__c?: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Preact dependencies (user provides these)
|
|
21
|
+
*/
|
|
22
|
+
interface PreactDependencies {
|
|
23
|
+
/** preact module */
|
|
24
|
+
preact: {
|
|
25
|
+
h: (type: unknown, props?: unknown, ...children: unknown[]) => PreactVNode;
|
|
26
|
+
Fragment?: unknown;
|
|
27
|
+
Component?: unknown;
|
|
28
|
+
isValidElement?: (value: unknown) => boolean;
|
|
29
|
+
cloneElement?: (vnode: PreactVNode, props?: unknown) => PreactVNode;
|
|
30
|
+
};
|
|
31
|
+
/** preact-render-to-string module (optional - for SSR) */
|
|
32
|
+
renderToString?: (vnode: PreactVNode) => string;
|
|
33
|
+
/** preact/hooks module (optional) */
|
|
34
|
+
hooks?: {
|
|
35
|
+
useState: <T>(initial: T) => [T, (v: T) => void];
|
|
36
|
+
useEffect: (fn: () => void | (() => void), deps?: unknown[]) => void;
|
|
37
|
+
useMemo: <T>(fn: () => T, deps: unknown[]) => T;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create Preact UI Adapter
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import { createPreactAdapter } from '@flightdev/core/rsc/adapters/preact';
|
|
46
|
+
* import * as preact from 'preact';
|
|
47
|
+
* import renderToString from 'preact-render-to-string';
|
|
48
|
+
*
|
|
49
|
+
* const adapter = createPreactAdapter({
|
|
50
|
+
* preact,
|
|
51
|
+
* renderToString,
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* const renderer = createRenderer(adapter);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function createPreactAdapter(deps?: PreactDependencies): UIAdapter;
|
|
58
|
+
/**
|
|
59
|
+
* Options for Preact consumer
|
|
60
|
+
*/
|
|
61
|
+
interface PreactConsumerOptions {
|
|
62
|
+
/** Registry of client components */
|
|
63
|
+
registry?: Map<string, () => Promise<unknown>>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create a Preact client-side consumer for Flight payloads
|
|
67
|
+
*/
|
|
68
|
+
declare function createPreactConsumer(deps: PreactDependencies, options?: PreactConsumerOptions): {
|
|
69
|
+
/**
|
|
70
|
+
* Register a client component
|
|
71
|
+
*/
|
|
72
|
+
register(id: string, loader: () => Promise<unknown>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Convert Flight elements to Preact VNodes
|
|
75
|
+
*/
|
|
76
|
+
toPreactElement(element: FlightElement): unknown;
|
|
77
|
+
/**
|
|
78
|
+
* Hydrate Flight payload into DOM
|
|
79
|
+
*/
|
|
80
|
+
hydrate(chunks: FlightChunk[], container: Element, hydrateFn?: (vnode: unknown, container: Element) => void): void;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Type helper for Preact Server Component
|
|
84
|
+
*/
|
|
85
|
+
type PreactServerComponent<P = Record<string, unknown>> = (props: P, ctx: ServerContext) => Promise<PreactVNode> | PreactVNode;
|
|
86
|
+
/**
|
|
87
|
+
* Mark a Preact component as a client component
|
|
88
|
+
*/
|
|
89
|
+
declare function markAsPreactClientComponent<T extends (...args: unknown[]) => unknown>(component: T, moduleId: string, exportName?: string): T;
|
|
90
|
+
/**
|
|
91
|
+
* Create a lazy-loading component for Preact
|
|
92
|
+
*/
|
|
93
|
+
declare function lazy<T extends (...args: unknown[]) => unknown>(loader: () => Promise<{
|
|
94
|
+
default: T;
|
|
95
|
+
}>): T;
|
|
96
|
+
|
|
97
|
+
export { type PreactConsumerOptions, type PreactDependencies, type PreactServerComponent, createPreactAdapter, createPreactConsumer, lazy, markAsPreactClientComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"preact.js"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ServerContext } from '../context.js';
|
|
3
|
+
import { FlightElement, FlightChunk } from '../payload.js';
|
|
4
|
+
import { UIAdapter } from '../renderer.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create React UI Adapter
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createReactAdapter } from '@flightdev/core/rsc/adapters/react';
|
|
12
|
+
* import { renderToString } from 'react-dom/server';
|
|
13
|
+
* import * as React from 'react';
|
|
14
|
+
*
|
|
15
|
+
* const adapter = createReactAdapter({
|
|
16
|
+
* React,
|
|
17
|
+
* renderToString,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const renderer = createRenderer(adapter);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare function createReactAdapter(deps?: {
|
|
24
|
+
/** React module (optional - for SSR) */
|
|
25
|
+
React?: {
|
|
26
|
+
isValidElement: (value: unknown) => boolean;
|
|
27
|
+
Children: {
|
|
28
|
+
toArray: (children: unknown) => unknown[];
|
|
29
|
+
};
|
|
30
|
+
Fragment: symbol;
|
|
31
|
+
Suspense: unknown;
|
|
32
|
+
};
|
|
33
|
+
/** renderToString function (optional - for SSR fallbacks) */
|
|
34
|
+
renderToString?: (element: unknown) => string;
|
|
35
|
+
}): UIAdapter;
|
|
36
|
+
/**
|
|
37
|
+
* Opciones para el consumer de React
|
|
38
|
+
*/
|
|
39
|
+
interface ReactConsumerOptions {
|
|
40
|
+
/** Registry de client components */
|
|
41
|
+
registry?: Map<string, () => Promise<unknown>>;
|
|
42
|
+
/** Callback when hydration completes */
|
|
43
|
+
onHydrate?: (id: string) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a React client-side consumer for Flight payloads
|
|
47
|
+
*
|
|
48
|
+
* This reconstructs React elements from Flight chunks on the client.
|
|
49
|
+
*/
|
|
50
|
+
declare function createReactConsumer(deps: {
|
|
51
|
+
React: {
|
|
52
|
+
createElement: (type: unknown, props?: unknown, ...children: unknown[]) => unknown;
|
|
53
|
+
Suspense: unknown;
|
|
54
|
+
Fragment: unknown;
|
|
55
|
+
lazy: (factory: () => Promise<{
|
|
56
|
+
default: unknown;
|
|
57
|
+
}>) => unknown;
|
|
58
|
+
};
|
|
59
|
+
}, options?: ReactConsumerOptions): {
|
|
60
|
+
/**
|
|
61
|
+
* Register a client component
|
|
62
|
+
*/
|
|
63
|
+
register(id: string, loader: () => Promise<unknown>): void;
|
|
64
|
+
/**
|
|
65
|
+
* Convert Flight elements to React elements
|
|
66
|
+
*/
|
|
67
|
+
toReactElement(element: FlightElement): unknown;
|
|
68
|
+
/**
|
|
69
|
+
* Process Flight chunks and build React tree
|
|
70
|
+
*/
|
|
71
|
+
processChunks(chunks: FlightChunk[]): unknown;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Type helper for React Server Component
|
|
75
|
+
*/
|
|
76
|
+
type ReactServerComponent<P = Record<string, unknown>> = (props: P, ctx: ServerContext) => Promise<ReturnType<typeof react.createElement>> | ReturnType<typeof react.createElement>;
|
|
77
|
+
/**
|
|
78
|
+
* Mark a component as a client component (for use without bundler transform)
|
|
79
|
+
*/
|
|
80
|
+
declare function markAsClientComponent<T extends (...args: unknown[]) => unknown>(component: T, moduleId: string, exportName?: string): T;
|
|
81
|
+
|
|
82
|
+
export { type ReactConsumerOptions, type ReactServerComponent, createReactAdapter, createReactConsumer, markAsClientComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"react.js"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ServerContext } from '../context.js';
|
|
2
|
+
import { FlightElement, FlightChunk } from '../payload.js';
|
|
3
|
+
import { UIAdapter } from '../renderer.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Solid dependencies (user provides these)
|
|
7
|
+
*/
|
|
8
|
+
interface SolidDependencies {
|
|
9
|
+
/** solid-js module */
|
|
10
|
+
solid: {
|
|
11
|
+
createSignal: <T>(value: T) => [() => T, (v: T) => void];
|
|
12
|
+
createMemo: <T>(fn: () => T) => () => T;
|
|
13
|
+
createEffect: (fn: () => void) => void;
|
|
14
|
+
children: (fn: () => unknown) => () => unknown[];
|
|
15
|
+
splitProps: <T extends object, K extends keyof T>(props: T, ...keys: K[][]) => [Pick<T, K>, Omit<T, K>][];
|
|
16
|
+
For?: unknown;
|
|
17
|
+
Show?: unknown;
|
|
18
|
+
Switch?: unknown;
|
|
19
|
+
Match?: unknown;
|
|
20
|
+
Suspense?: unknown;
|
|
21
|
+
ErrorBoundary?: unknown;
|
|
22
|
+
};
|
|
23
|
+
/** solid-js/web module */
|
|
24
|
+
web: {
|
|
25
|
+
render?: (code: () => unknown, element: Element) => () => void;
|
|
26
|
+
hydrate?: (code: () => unknown, element: Element) => () => void;
|
|
27
|
+
renderToString?: (code: () => unknown) => string;
|
|
28
|
+
renderToStringAsync?: (code: () => unknown) => Promise<string>;
|
|
29
|
+
isServer?: boolean;
|
|
30
|
+
Dynamic?: unknown;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create Solid.js UI Adapter
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { createSolidAdapter } from '@flightdev/core/rsc/adapters/solid';
|
|
39
|
+
* import * as solid from 'solid-js';
|
|
40
|
+
* import * as web from 'solid-js/web';
|
|
41
|
+
*
|
|
42
|
+
* const adapter = createSolidAdapter({ solid, web });
|
|
43
|
+
* const renderer = createRenderer(adapter);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare function createSolidAdapter(deps?: SolidDependencies): UIAdapter;
|
|
47
|
+
/**
|
|
48
|
+
* Options for Solid consumer
|
|
49
|
+
*/
|
|
50
|
+
interface SolidConsumerOptions {
|
|
51
|
+
/** Registry of client components */
|
|
52
|
+
registry?: Map<string, () => Promise<unknown>>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a Solid client-side consumer for Flight payloads
|
|
56
|
+
*/
|
|
57
|
+
declare function createSolidConsumer(deps: SolidDependencies, options?: SolidConsumerOptions): {
|
|
58
|
+
/**
|
|
59
|
+
* Register a client component
|
|
60
|
+
*/
|
|
61
|
+
register(id: string, loader: () => Promise<unknown>): void;
|
|
62
|
+
/**
|
|
63
|
+
* Convert Flight elements to Solid JSX
|
|
64
|
+
*/
|
|
65
|
+
toSolidElement(element: FlightElement): unknown;
|
|
66
|
+
/**
|
|
67
|
+
* Hydrate Flight payload into DOM
|
|
68
|
+
*/
|
|
69
|
+
hydrate(chunks: FlightChunk[], container: Element): (() => void) | undefined;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Type helper for Solid Server Component
|
|
73
|
+
*/
|
|
74
|
+
type SolidServerComponent<P = Record<string, unknown>> = (props: P, ctx: ServerContext) => Promise<unknown> | unknown;
|
|
75
|
+
/**
|
|
76
|
+
* Mark a Solid component as a client component
|
|
77
|
+
*/
|
|
78
|
+
declare function markAsSolidClientComponent<T extends object>(component: T, moduleId: string, exportName?: string): T;
|
|
79
|
+
/**
|
|
80
|
+
* Check if running on server (Solid isServer helper)
|
|
81
|
+
*/
|
|
82
|
+
declare function isServer(deps?: SolidDependencies): boolean;
|
|
83
|
+
|
|
84
|
+
export { type SolidConsumerOptions, type SolidDependencies, type SolidServerComponent, createSolidAdapter, createSolidConsumer, isServer, markAsSolidClientComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"solid.js"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ServerContext } from '../context.js';
|
|
2
|
+
import { FlightElement } from '../payload.js';
|
|
3
|
+
import { UIAdapter } from '../renderer.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Minimal Vue VNode interface
|
|
7
|
+
*/
|
|
8
|
+
interface VueVNode {
|
|
9
|
+
__v_isVNode?: boolean;
|
|
10
|
+
type: unknown;
|
|
11
|
+
props: Record<string, unknown> | null;
|
|
12
|
+
children: unknown;
|
|
13
|
+
key: string | number | null;
|
|
14
|
+
component?: unknown;
|
|
15
|
+
shapeFlag?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Vue dependencies (user provides these)
|
|
19
|
+
*/
|
|
20
|
+
interface VueDependencies {
|
|
21
|
+
/** Vue module */
|
|
22
|
+
Vue: {
|
|
23
|
+
h: (type: unknown, props?: unknown, children?: unknown) => VueVNode;
|
|
24
|
+
isVNode: (value: unknown) => boolean;
|
|
25
|
+
createSSRApp?: (rootComponent: unknown) => unknown;
|
|
26
|
+
Fragment?: symbol;
|
|
27
|
+
Suspense?: unknown;
|
|
28
|
+
Text?: symbol;
|
|
29
|
+
};
|
|
30
|
+
/** renderToString from vue/server-renderer (optional - for SSR) */
|
|
31
|
+
renderToString?: (app: unknown) => Promise<string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create Vue UI Adapter
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { createVueAdapter } from '@flightdev/core/rsc/adapters/vue';
|
|
39
|
+
* import * as Vue from 'vue';
|
|
40
|
+
* import { renderToString } from 'vue/server-renderer';
|
|
41
|
+
*
|
|
42
|
+
* const adapter = createVueAdapter({
|
|
43
|
+
* Vue,
|
|
44
|
+
* renderToString,
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* const renderer = createRenderer(adapter);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function createVueAdapter(deps?: VueDependencies): UIAdapter;
|
|
51
|
+
/**
|
|
52
|
+
* Options for Vue consumer
|
|
53
|
+
*/
|
|
54
|
+
interface VueConsumerOptions {
|
|
55
|
+
/** Registry of client components */
|
|
56
|
+
registry?: Map<string, () => Promise<unknown>>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create a Vue client-side consumer for Flight payloads
|
|
60
|
+
*/
|
|
61
|
+
declare function createVueConsumer(deps: VueDependencies, options?: VueConsumerOptions): {
|
|
62
|
+
/**
|
|
63
|
+
* Register a client component
|
|
64
|
+
*/
|
|
65
|
+
register(id: string, loader: () => Promise<unknown>): void;
|
|
66
|
+
/**
|
|
67
|
+
* Convert Flight elements to Vue VNodes
|
|
68
|
+
*/
|
|
69
|
+
toVueElement(element: FlightElement): unknown;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Type helper for Vue Server Component
|
|
73
|
+
*/
|
|
74
|
+
type VueServerComponent<P = Record<string, unknown>> = (props: P, ctx: ServerContext) => Promise<VueVNode> | VueVNode;
|
|
75
|
+
/**
|
|
76
|
+
* Mark a Vue component as a client component
|
|
77
|
+
*/
|
|
78
|
+
declare function markAsVueClientComponent<T extends object>(component: T, moduleId: string, exportName?: string): T;
|
|
79
|
+
|
|
80
|
+
export { type VueConsumerOptions, type VueDependencies, type VueServerComponent, createVueAdapter, createVueConsumer, markAsVueClientComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"vue.js"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flightdev/core - Component Boundary Detection
|
|
3
|
+
*
|
|
4
|
+
* Sistema de detección de boundaries client/server para Server Components.
|
|
5
|
+
* Soporta directivas 'use client' y 'use server' tanto a nivel de archivo
|
|
6
|
+
* como inline en funciones.
|
|
7
|
+
*
|
|
8
|
+
* Filosofía Flight:
|
|
9
|
+
* - Detección en build-time (no runtime overhead)
|
|
10
|
+
* - Soporte para directivas estándar de React
|
|
11
|
+
* - Extensible para otros frameworks
|
|
12
|
+
* - Zero dependencies
|
|
13
|
+
*
|
|
14
|
+
* @module @flightdev/core/rsc/boundaries
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Tipo de boundary de componente
|
|
18
|
+
*/
|
|
19
|
+
type BoundaryType = 'server' | 'client' | 'shared';
|
|
20
|
+
/**
|
|
21
|
+
* Información de un boundary detectado
|
|
22
|
+
*/
|
|
23
|
+
interface ComponentBoundary {
|
|
24
|
+
/** Tipo de boundary */
|
|
25
|
+
type: BoundaryType;
|
|
26
|
+
/** ID del módulo (path relativo o absoluto) */
|
|
27
|
+
moduleId: string;
|
|
28
|
+
/** Nombre del export */
|
|
29
|
+
exportName: string;
|
|
30
|
+
/** Línea donde se detectó la directiva */
|
|
31
|
+
line?: number;
|
|
32
|
+
/** Es una directiva inline (dentro de función) */
|
|
33
|
+
inline?: boolean;
|
|
34
|
+
/** Metadata adicional */
|
|
35
|
+
meta?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resultado del análisis de un módulo
|
|
39
|
+
*/
|
|
40
|
+
interface ModuleAnalysis {
|
|
41
|
+
/** Path del módulo */
|
|
42
|
+
moduleId: string;
|
|
43
|
+
/** Directiva a nivel de archivo ('use client' o 'use server') */
|
|
44
|
+
fileDirective?: 'client' | 'server';
|
|
45
|
+
/** Boundaries detectados */
|
|
46
|
+
boundaries: ComponentBoundary[];
|
|
47
|
+
/** Exports que son Server Actions */
|
|
48
|
+
serverActions: string[];
|
|
49
|
+
/** Exports que son Client Components */
|
|
50
|
+
clientComponents: string[];
|
|
51
|
+
/** El módulo tiene componentes async */
|
|
52
|
+
hasAsyncComponents: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Referencia a un Client Component
|
|
56
|
+
*/
|
|
57
|
+
interface ClientReference<T = unknown> {
|
|
58
|
+
$$typeof: symbol;
|
|
59
|
+
$$id: string;
|
|
60
|
+
$$async: boolean;
|
|
61
|
+
__flight_client: true;
|
|
62
|
+
__flight_module: string;
|
|
63
|
+
__flight_export: string;
|
|
64
|
+
(props: T extends (props: infer P) => unknown ? P : unknown): unknown;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Referencia a una Server Function (Action)
|
|
68
|
+
*/
|
|
69
|
+
interface ServerReference<T extends (...args: unknown[]) => unknown = (...args: unknown[]) => unknown> {
|
|
70
|
+
$$typeof: symbol;
|
|
71
|
+
$$id: string;
|
|
72
|
+
$$bound: unknown[] | null;
|
|
73
|
+
__flight_server: true;
|
|
74
|
+
__flight_action: string;
|
|
75
|
+
(...args: Parameters<T>): Promise<ReturnType<T>>;
|
|
76
|
+
}
|
|
77
|
+
declare const CLIENT_REFERENCE: unique symbol;
|
|
78
|
+
declare const SERVER_REFERENCE: unique symbol;
|
|
79
|
+
/**
|
|
80
|
+
* Detecta si un archivo tiene la directiva 'use client'
|
|
81
|
+
*/
|
|
82
|
+
declare function hasUseClientDirective(source: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Detecta si un archivo tiene la directiva 'use server' a nivel de archivo
|
|
85
|
+
*/
|
|
86
|
+
declare function hasUseServerDirective(source: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Detecta el tipo de componente basado en directivas
|
|
89
|
+
*/
|
|
90
|
+
declare function detectBoundaryType(source: string): BoundaryType;
|
|
91
|
+
/**
|
|
92
|
+
* Detecta Server Actions inline en el código
|
|
93
|
+
* Busca funciones que contienen 'use server' dentro de su cuerpo
|
|
94
|
+
*/
|
|
95
|
+
declare function detectInlineServerActions(source: string): string[];
|
|
96
|
+
/**
|
|
97
|
+
* Detecta componentes async (Server Components potenciales)
|
|
98
|
+
*/
|
|
99
|
+
declare function detectAsyncComponents(source: string): string[];
|
|
100
|
+
/**
|
|
101
|
+
* Análisis completo de un módulo
|
|
102
|
+
*/
|
|
103
|
+
declare function analyzeModule(source: string, moduleId: string): ModuleAnalysis;
|
|
104
|
+
/**
|
|
105
|
+
* Crea una referencia a un Client Component
|
|
106
|
+
* Para uso en build-time (transformación de código)
|
|
107
|
+
*/
|
|
108
|
+
declare function createClientReference<T>(moduleId: string, exportName: string, isAsync?: boolean): ClientReference<T>;
|
|
109
|
+
/**
|
|
110
|
+
* Crea una referencia a una Server Function (Action)
|
|
111
|
+
* Para uso en build-time (transformación de código)
|
|
112
|
+
*/
|
|
113
|
+
declare function createServerReference<T extends (...args: unknown[]) => unknown>(actionId: string, boundArgs?: unknown[]): ServerReference<T>;
|
|
114
|
+
/**
|
|
115
|
+
* Verifica si un valor es una Client Reference
|
|
116
|
+
*/
|
|
117
|
+
declare function isClientReference(value: unknown): value is ClientReference;
|
|
118
|
+
/**
|
|
119
|
+
* Verifica si un valor es una Server Reference
|
|
120
|
+
*/
|
|
121
|
+
declare function isServerReference(value: unknown): value is ServerReference;
|
|
122
|
+
/**
|
|
123
|
+
* Obtiene el ID de una referencia
|
|
124
|
+
*/
|
|
125
|
+
declare function getReferenceId(ref: ClientReference | ServerReference): string;
|
|
126
|
+
/**
|
|
127
|
+
* Registry de boundaries para uso en runtime
|
|
128
|
+
*/
|
|
129
|
+
declare class BoundaryRegistry {
|
|
130
|
+
private clientModules;
|
|
131
|
+
private serverActions;
|
|
132
|
+
/**
|
|
133
|
+
* Registra un Client Component
|
|
134
|
+
*/
|
|
135
|
+
registerClient(id: string, loader: () => Promise<unknown>): void;
|
|
136
|
+
/**
|
|
137
|
+
* Registra una Server Action
|
|
138
|
+
*/
|
|
139
|
+
registerServer(id: string, action: (...args: unknown[]) => Promise<unknown>): void;
|
|
140
|
+
/**
|
|
141
|
+
* Obtiene un Client Component loader
|
|
142
|
+
*/
|
|
143
|
+
getClient(id: string): (() => Promise<unknown>) | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Obtiene una Server Action
|
|
146
|
+
*/
|
|
147
|
+
getServer(id: string): ((...args: unknown[]) => Promise<unknown>) | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Verifica si un client module está registrado
|
|
150
|
+
*/
|
|
151
|
+
hasClient(id: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Verifica si una server action está registrada
|
|
154
|
+
*/
|
|
155
|
+
hasServer(id: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Obtiene todos los IDs de client modules
|
|
158
|
+
*/
|
|
159
|
+
getClientIds(): string[];
|
|
160
|
+
/**
|
|
161
|
+
* Obtiene todos los IDs de server actions
|
|
162
|
+
*/
|
|
163
|
+
getServerIds(): string[];
|
|
164
|
+
/**
|
|
165
|
+
* Limpia el registry
|
|
166
|
+
*/
|
|
167
|
+
clear(): void;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Registry global (singleton)
|
|
171
|
+
*/
|
|
172
|
+
declare const globalRegistry: BoundaryRegistry;
|
|
173
|
+
/**
|
|
174
|
+
* Registra un Client Component en el registry global
|
|
175
|
+
*/
|
|
176
|
+
declare function registerClientComponent(id: string, loader: () => Promise<unknown>): void;
|
|
177
|
+
/**
|
|
178
|
+
* Registra una Server Action en el registry global
|
|
179
|
+
*/
|
|
180
|
+
declare function registerServerAction(id: string, action: (...args: unknown[]) => Promise<unknown>): void;
|
|
181
|
+
|
|
182
|
+
export { BoundaryRegistry, type BoundaryType, CLIENT_REFERENCE, type ClientReference, type ComponentBoundary, type ModuleAnalysis, SERVER_REFERENCE, type ServerReference, analyzeModule, createClientReference, createServerReference, detectAsyncComponents, detectBoundaryType, detectInlineServerActions, getReferenceId, globalRegistry, hasUseClientDirective, hasUseServerDirective, isClientReference, isServerReference, registerClientComponent, registerServerAction };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BoundaryRegistry, CLIENT_REFERENCE, SERVER_REFERENCE, analyzeModule, createClientReference, createServerReference, detectAsyncComponents, detectBoundaryType, detectInlineServerActions, getReferenceId, globalRegistry, hasUseClientDirective, hasUseServerDirective, isClientReference, isServerReference, registerClientComponent, registerServerAction } from '../chunk-AP5NLUSB.js';
|
|
2
|
+
//# sourceMappingURL=boundaries.js.map
|
|
3
|
+
//# sourceMappingURL=boundaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"boundaries.js"}
|