@flight-framework/core 0.0.3 → 0.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/LICENSE +21 -0
- package/dist/{chunk-5KF3QQWZ.js → chunk-3AY23FZP.js} +5 -19
- package/dist/chunk-3AY23FZP.js.map +1 -0
- package/dist/chunk-4F77J5TY.js +324 -0
- package/dist/chunk-4F77J5TY.js.map +1 -0
- package/dist/{chunk-CLMFEKYM.js → chunk-54HPVE7N.js} +67 -2
- package/dist/chunk-54HPVE7N.js.map +1 -0
- package/dist/chunk-5GUCB2CG.js +300 -0
- package/dist/chunk-5GUCB2CG.js.map +1 -0
- package/dist/chunk-62C7LX2E.js +205 -0
- package/dist/chunk-62C7LX2E.js.map +1 -0
- package/dist/chunk-63SCEXD7.js +3 -0
- package/dist/chunk-63SCEXD7.js.map +1 -0
- package/dist/chunk-6BDCTUQY.js +282 -0
- package/dist/chunk-6BDCTUQY.js.map +1 -0
- package/dist/chunk-6CD5FIYI.js +252 -0
- package/dist/chunk-6CD5FIYI.js.map +1 -0
- package/dist/chunk-6XZQPPYC.js +285 -0
- package/dist/chunk-6XZQPPYC.js.map +1 -0
- package/dist/chunk-BJIMTO2I.js +213 -0
- package/dist/chunk-BJIMTO2I.js.map +1 -0
- package/dist/chunk-CLZSB5QD.js +258 -0
- package/dist/chunk-CLZSB5QD.js.map +1 -0
- package/dist/chunk-K2CQZPCG.js +257 -0
- package/dist/chunk-K2CQZPCG.js.map +1 -0
- package/dist/chunk-MQQLYWZZ.js +288 -0
- package/dist/chunk-MQQLYWZZ.js.map +1 -0
- package/dist/chunk-MRLCNFSD.js +341 -0
- package/dist/chunk-MRLCNFSD.js.map +1 -0
- package/dist/chunk-PSJPMEQK.js +212 -0
- package/dist/chunk-PSJPMEQK.js.map +1 -0
- package/dist/chunk-Q62ZQ6FM.js +218 -0
- package/dist/chunk-Q62ZQ6FM.js.map +1 -0
- package/dist/{chunk-ABNCAPQB.js → chunk-RSVA2EYO.js} +2 -2
- package/dist/chunk-RSVA2EYO.js.map +1 -0
- package/dist/chunk-T3S5YC7L.js +256 -0
- package/dist/chunk-T3S5YC7L.js.map +1 -0
- package/dist/chunk-WFAWAHJH.js +267 -0
- package/dist/chunk-WFAWAHJH.js.map +1 -0
- package/dist/chunk-WOEIJWGJ.js +351 -0
- package/dist/chunk-WOEIJWGJ.js.map +1 -0
- package/dist/chunk-XOIYNY4I.js +164 -0
- package/dist/chunk-XOIYNY4I.js.map +1 -0
- package/dist/chunk-XSY5AAXT.js +125 -0
- package/dist/chunk-XSY5AAXT.js.map +1 -0
- package/dist/chunk-Y22AMGTM.js +3 -0
- package/dist/chunk-Y22AMGTM.js.map +1 -0
- package/dist/file-router/index.d.ts +9 -0
- package/dist/file-router/index.js +1 -1
- 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/index.d.ts +9 -1
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- 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/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 +20 -124
- package/dist/rsc/index.js +13 -1
- package/dist/rsc/legacy.d.ts +131 -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 +160 -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/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 +8 -0
- package/dist/streaming/index.js +1 -1
- 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/package.json +180 -100
- package/dist/chunk-5KF3QQWZ.js.map +0 -1
- package/dist/chunk-ABNCAPQB.js.map +0 -1
- package/dist/chunk-CLMFEKYM.js.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flight-framework/core - Legacy RSC Support
|
|
3
|
+
*
|
|
4
|
+
* Backward compatibility module for the original RSC implementation.
|
|
5
|
+
* Use the new API from './index.js' for new features.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use the new RSC API instead
|
|
8
|
+
* @module @flight-framework/core/rsc/legacy
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Component rendering context
|
|
12
|
+
* @deprecated Use ServerContext from './context.js' instead
|
|
13
|
+
*/
|
|
14
|
+
interface RenderContext {
|
|
15
|
+
/** Current request */
|
|
16
|
+
request: Request;
|
|
17
|
+
/** Route params */
|
|
18
|
+
params: Record<string, string>;
|
|
19
|
+
/** Search params */
|
|
20
|
+
searchParams: URLSearchParams;
|
|
21
|
+
/** Request headers */
|
|
22
|
+
headers: Headers;
|
|
23
|
+
/** Cookies */
|
|
24
|
+
cookies: Map<string, string>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Server component definition
|
|
28
|
+
* @deprecated Use ServerComponentFn from './index.js' instead
|
|
29
|
+
*/
|
|
30
|
+
interface ServerComponent<P = unknown> {
|
|
31
|
+
(props: P, context: RenderContext): Promise<string> | string;
|
|
32
|
+
/** Mark as server component */
|
|
33
|
+
__flight_server?: true;
|
|
34
|
+
/** Dependencies for hydration */
|
|
35
|
+
__flight_deps?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Client component definition
|
|
39
|
+
* @deprecated Use ClientReference from './boundaries.js' instead
|
|
40
|
+
*/
|
|
41
|
+
interface ClientComponent<P = unknown> {
|
|
42
|
+
(props: P): unknown;
|
|
43
|
+
/** Mark as client component */
|
|
44
|
+
__flight_client?: true;
|
|
45
|
+
/** Client bundle path */
|
|
46
|
+
__flight_bundle?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Component type detection
|
|
50
|
+
*/
|
|
51
|
+
type ComponentType = 'server' | 'client' | 'hybrid';
|
|
52
|
+
/**
|
|
53
|
+
* Execute an async server component
|
|
54
|
+
* @deprecated Use the new rendering pipeline instead
|
|
55
|
+
*/
|
|
56
|
+
declare function executeServerComponent<P>(component: ServerComponent<P>, props: P, context: RenderContext): Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a render context from a Request
|
|
59
|
+
* @deprecated Use createServerContext from './context.js' instead
|
|
60
|
+
*/
|
|
61
|
+
declare function createRenderContext(request: Request, params?: Record<string, string>): RenderContext;
|
|
62
|
+
/**
|
|
63
|
+
* Server-side fetch with automatic caching
|
|
64
|
+
*/
|
|
65
|
+
declare function serverFetch<T>(url: string, options?: RequestInit & {
|
|
66
|
+
revalidate?: number | false;
|
|
67
|
+
tags?: string[];
|
|
68
|
+
}): Promise<T>;
|
|
69
|
+
/**
|
|
70
|
+
* Invalidate cache by tag
|
|
71
|
+
*/
|
|
72
|
+
declare function revalidateTag(tag: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Invalidate cache by path
|
|
75
|
+
*/
|
|
76
|
+
declare function revalidatePath(path: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Serialize props for transmission to client
|
|
79
|
+
* @deprecated Use serialize from './payload.js' instead
|
|
80
|
+
*/
|
|
81
|
+
declare function serializeProps(props: unknown): string;
|
|
82
|
+
/**
|
|
83
|
+
* Deserialize props on client
|
|
84
|
+
* @deprecated Use deserialize from './payload.js' instead
|
|
85
|
+
*/
|
|
86
|
+
declare function deserializeProps<T>(serialized: string): T;
|
|
87
|
+
/**
|
|
88
|
+
* Create a client boundary placeholder
|
|
89
|
+
* @deprecated Use clientRef from './payload.js' instead
|
|
90
|
+
*/
|
|
91
|
+
declare function createClientBoundary(componentId: string, props: unknown, fallback?: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Helper to create an async server component
|
|
94
|
+
* @deprecated Use async Server Components directly
|
|
95
|
+
*/
|
|
96
|
+
declare function createAsyncComponent<P, T>(fetcher: (props: P, context: RenderContext) => Promise<T>, renderer: (data: T, props: P) => string): ServerComponent<P>;
|
|
97
|
+
/**
|
|
98
|
+
* Compose multiple server components
|
|
99
|
+
* @deprecated Use Promise.all with async components
|
|
100
|
+
*/
|
|
101
|
+
declare function composeComponents(...components: Array<() => Promise<string> | string>): () => Promise<string>;
|
|
102
|
+
/**
|
|
103
|
+
* Wrap a server component with error handling
|
|
104
|
+
* @deprecated Use try/catch in async components
|
|
105
|
+
*/
|
|
106
|
+
declare function withErrorBoundary<P>(component: ServerComponent<P>, errorFallback: (error: Error) => string): ServerComponent<P>;
|
|
107
|
+
/**
|
|
108
|
+
* Throw a not found error
|
|
109
|
+
* @deprecated Use notFound from './context.js' instead
|
|
110
|
+
*/
|
|
111
|
+
declare function notFound(): never;
|
|
112
|
+
/**
|
|
113
|
+
* Check if error is not found
|
|
114
|
+
* @deprecated Use isNotFoundError from './context.js' instead
|
|
115
|
+
*/
|
|
116
|
+
declare function isNotFoundError(error: unknown): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Server-side redirect
|
|
119
|
+
* @deprecated Use redirect from './context.js' instead
|
|
120
|
+
*/
|
|
121
|
+
declare function redirect(url: string, type?: 'replace' | 'push'): never;
|
|
122
|
+
/**
|
|
123
|
+
* Check if error is redirect
|
|
124
|
+
* @deprecated Use isRedirectError from './context.js' instead
|
|
125
|
+
*/
|
|
126
|
+
declare function isRedirectError(error: unknown): {
|
|
127
|
+
url: string;
|
|
128
|
+
type: string;
|
|
129
|
+
} | null;
|
|
130
|
+
|
|
131
|
+
export { type ClientComponent, type ComponentType, type RenderContext, type ServerComponent, composeComponents, createAsyncComponent, createClientBoundary, createRenderContext, deserializeProps, executeServerComponent, isNotFoundError, isRedirectError, notFound, redirect, revalidatePath, revalidateTag, serializeProps, serverFetch, withErrorBoundary };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { composeComponents, createAsyncComponent, createClientBoundary, createRenderContext, deserializeProps, executeServerComponent, isNotFoundError, isRedirectError, notFound, redirect, revalidatePath, revalidateTag, serializeProps, serverFetch, withErrorBoundary } from '../chunk-3AY23FZP.js';
|
|
2
|
+
//# sourceMappingURL=legacy.js.map
|
|
3
|
+
//# sourceMappingURL=legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"legacy.js"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flight-framework/core - Flight Payload System
|
|
3
|
+
*
|
|
4
|
+
* Formato de serialización agnóstico para Server Components.
|
|
5
|
+
* Diseñado para máxima debuggabilidad y compatibilidad multi-framework.
|
|
6
|
+
*
|
|
7
|
+
* Filosofía Flight:
|
|
8
|
+
* - Formato documentado y abierto (NDJSON)
|
|
9
|
+
* - No depende de internals de React
|
|
10
|
+
* - Extensible para cualquier UI framework
|
|
11
|
+
* - Zero vendor lock-in
|
|
12
|
+
*
|
|
13
|
+
* @module @flight-framework/core/rsc/payload
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Union type de todos los chunks que pueden enviarse en un FlightStream
|
|
17
|
+
*/
|
|
18
|
+
type FlightChunk = ServerComponentChunk | ClientReferenceChunk | ServerReferenceChunk | ErrorBoundaryChunk | HintChunk | MetaChunk;
|
|
19
|
+
/**
|
|
20
|
+
* Chunk de Server Component renderizado
|
|
21
|
+
* Contiene el árbol virtual de elementos
|
|
22
|
+
*/
|
|
23
|
+
interface ServerComponentChunk {
|
|
24
|
+
/** Discriminator */
|
|
25
|
+
readonly type: 'S';
|
|
26
|
+
/** Unique chunk ID */
|
|
27
|
+
readonly id: string;
|
|
28
|
+
/** Virtual element tree */
|
|
29
|
+
readonly tree: FlightElement;
|
|
30
|
+
/** IDs de chunks que este depende (para streaming ordenado) */
|
|
31
|
+
readonly awaiting?: readonly string[];
|
|
32
|
+
/** Timestamp para debugging/observability */
|
|
33
|
+
readonly ts?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Referencia a un Client Component
|
|
37
|
+
* El cliente cargará el módulo y lo hidratará
|
|
38
|
+
*/
|
|
39
|
+
interface ClientReferenceChunk {
|
|
40
|
+
/** Discriminator */
|
|
41
|
+
readonly type: 'C';
|
|
42
|
+
/** Reference ID */
|
|
43
|
+
readonly id: string;
|
|
44
|
+
/** Module specifier (relativo al manifest) */
|
|
45
|
+
readonly module: string;
|
|
46
|
+
/** Export name */
|
|
47
|
+
readonly export: string;
|
|
48
|
+
/** Serialized props */
|
|
49
|
+
readonly props: SerializedValue;
|
|
50
|
+
/** Fallback HTML para SSR (opcional) */
|
|
51
|
+
readonly fallback?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Referencia a una Server Function (Action)
|
|
55
|
+
* El cliente la invocará via RPC
|
|
56
|
+
*/
|
|
57
|
+
interface ServerReferenceChunk {
|
|
58
|
+
/** Discriminator */
|
|
59
|
+
readonly type: 'A';
|
|
60
|
+
/** Action ID */
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/** Bound arguments (pre-bound via .bind()) */
|
|
63
|
+
readonly bound?: readonly SerializedValue[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Error en un boundary específico
|
|
67
|
+
*/
|
|
68
|
+
interface ErrorBoundaryChunk {
|
|
69
|
+
/** Discriminator */
|
|
70
|
+
readonly type: 'E';
|
|
71
|
+
/** Boundary ID where error occurred */
|
|
72
|
+
readonly boundary: string;
|
|
73
|
+
/** Safe error message for client */
|
|
74
|
+
readonly message: string;
|
|
75
|
+
/** Error digest for server-side correlation */
|
|
76
|
+
readonly digest: string;
|
|
77
|
+
/** Component stack for development */
|
|
78
|
+
readonly stack?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Hints para el cliente (preload, prefetch, etc.)
|
|
82
|
+
*/
|
|
83
|
+
interface HintChunk {
|
|
84
|
+
/** Discriminator */
|
|
85
|
+
readonly type: 'H';
|
|
86
|
+
/** Hint type */
|
|
87
|
+
readonly hint: 'preload' | 'prefetch' | 'dns-prefetch' | 'preconnect' | 'modulepreload';
|
|
88
|
+
/** Resource URL */
|
|
89
|
+
readonly href: string;
|
|
90
|
+
/** Resource type (for preload) */
|
|
91
|
+
readonly as?: 'script' | 'style' | 'image' | 'font' | 'fetch';
|
|
92
|
+
/** Crossorigin attribute */
|
|
93
|
+
readonly crossorigin?: 'anonymous' | 'use-credentials';
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Metadata chunk (para SSR head injection)
|
|
97
|
+
*/
|
|
98
|
+
interface MetaChunk {
|
|
99
|
+
/** Discriminator */
|
|
100
|
+
readonly type: 'M';
|
|
101
|
+
/** Meta type */
|
|
102
|
+
readonly meta: 'title' | 'description' | 'og' | 'twitter' | 'link' | 'script';
|
|
103
|
+
/** Content */
|
|
104
|
+
readonly content: string | Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Virtual element que puede representar cualquier UI framework
|
|
108
|
+
*/
|
|
109
|
+
type FlightElement = FlightHostElement | FlightTextElement | FlightFragmentElement | FlightSuspenseElement | FlightClientElement | FlightLazyElement | FlightNullElement;
|
|
110
|
+
/**
|
|
111
|
+
* Host element (div, span, etc.)
|
|
112
|
+
*/
|
|
113
|
+
interface FlightHostElement {
|
|
114
|
+
readonly $$type: 'host';
|
|
115
|
+
readonly tag: string;
|
|
116
|
+
readonly key?: string | number;
|
|
117
|
+
readonly props: Readonly<Record<string, SerializedValue>>;
|
|
118
|
+
readonly children: readonly FlightElement[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Text node
|
|
122
|
+
*/
|
|
123
|
+
interface FlightTextElement {
|
|
124
|
+
readonly $$type: 'text';
|
|
125
|
+
readonly value: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Fragment (multiple children, no wrapper)
|
|
129
|
+
*/
|
|
130
|
+
interface FlightFragmentElement {
|
|
131
|
+
readonly $$type: 'fragment';
|
|
132
|
+
readonly children: readonly FlightElement[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Suspense boundary
|
|
136
|
+
*/
|
|
137
|
+
interface FlightSuspenseElement {
|
|
138
|
+
readonly $$type: 'suspense';
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly fallback: FlightElement;
|
|
141
|
+
readonly children: readonly FlightElement[];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Client component reference
|
|
145
|
+
*/
|
|
146
|
+
interface FlightClientElement {
|
|
147
|
+
readonly $$type: 'client';
|
|
148
|
+
/** Reference to ClientReferenceChunk ID */
|
|
149
|
+
readonly ref: string;
|
|
150
|
+
/** Pre-rendered fallback HTML */
|
|
151
|
+
readonly ssr?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Lazy/async element (pending resolution)
|
|
155
|
+
*/
|
|
156
|
+
interface FlightLazyElement {
|
|
157
|
+
readonly $$type: 'lazy';
|
|
158
|
+
readonly id: string;
|
|
159
|
+
readonly fallback?: FlightElement;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Null/empty element
|
|
163
|
+
*/
|
|
164
|
+
interface FlightNullElement {
|
|
165
|
+
readonly $$type: 'null';
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Valores que pueden cruzar el boundary server/client
|
|
169
|
+
*/
|
|
170
|
+
type SerializedValue = string | number | boolean | null | undefined | readonly SerializedValue[] | {
|
|
171
|
+
readonly [key: string]: SerializedValue;
|
|
172
|
+
} | SerializedSpecialValue;
|
|
173
|
+
/**
|
|
174
|
+
* Tipos especiales que requieren serialización custom
|
|
175
|
+
*/
|
|
176
|
+
interface SerializedSpecialValue {
|
|
177
|
+
readonly $$flight: SpecialValueType;
|
|
178
|
+
readonly value: string | readonly unknown[];
|
|
179
|
+
}
|
|
180
|
+
type SpecialValueType = 'date' | 'bigint' | 'map' | 'set' | 'undefined' | 'symbol' | 'regexp' | 'url' | 'error' | 'formdata' | 'blob' | 'arraybuffer';
|
|
181
|
+
/**
|
|
182
|
+
* Serializa un valor para transmisión a través de FlightStream
|
|
183
|
+
*/
|
|
184
|
+
declare function serialize(value: unknown): SerializedValue;
|
|
185
|
+
/**
|
|
186
|
+
* Deserializa un valor recibido de FlightStream
|
|
187
|
+
*/
|
|
188
|
+
declare function deserialize<T = unknown>(value: SerializedValue): T;
|
|
189
|
+
/**
|
|
190
|
+
* Create a host element
|
|
191
|
+
*/
|
|
192
|
+
declare function h(tag: string, props: Record<string, unknown> | null, ...children: unknown[]): FlightHostElement;
|
|
193
|
+
/**
|
|
194
|
+
* Create a text element
|
|
195
|
+
*/
|
|
196
|
+
declare function text(value: string): FlightTextElement;
|
|
197
|
+
/**
|
|
198
|
+
* Create a fragment
|
|
199
|
+
*/
|
|
200
|
+
declare function fragment(...children: unknown[]): FlightFragmentElement;
|
|
201
|
+
/**
|
|
202
|
+
* Create a suspense boundary
|
|
203
|
+
*/
|
|
204
|
+
declare function suspense(id: string, fallback: FlightElement, children: FlightElement[]): FlightSuspenseElement;
|
|
205
|
+
/**
|
|
206
|
+
* Create a client component reference
|
|
207
|
+
*/
|
|
208
|
+
declare function clientRef(refId: string, ssrHtml?: string): FlightClientElement;
|
|
209
|
+
/**
|
|
210
|
+
* Convert any value to a FlightElement
|
|
211
|
+
*/
|
|
212
|
+
declare function toFlightElement(value: unknown): FlightElement;
|
|
213
|
+
/**
|
|
214
|
+
* Type guard for FlightElement
|
|
215
|
+
*/
|
|
216
|
+
declare function isFlightElement(value: unknown): value is FlightElement;
|
|
217
|
+
/**
|
|
218
|
+
* Generate unique chunk ID
|
|
219
|
+
*/
|
|
220
|
+
declare function generateChunkId(prefix?: string): string;
|
|
221
|
+
/**
|
|
222
|
+
* Reset chunk ID counter (for testing)
|
|
223
|
+
*/
|
|
224
|
+
declare function resetChunkIdCounter(): void;
|
|
225
|
+
/**
|
|
226
|
+
* Create a server component chunk
|
|
227
|
+
*/
|
|
228
|
+
declare function createServerChunk(id: string, tree: FlightElement, awaiting?: string[]): ServerComponentChunk;
|
|
229
|
+
/**
|
|
230
|
+
* Create a client reference chunk
|
|
231
|
+
*/
|
|
232
|
+
declare function createClientChunk(id: string, module: string, exportName: string, props: unknown, fallback?: string): ClientReferenceChunk;
|
|
233
|
+
/**
|
|
234
|
+
* Create a server reference (action) chunk
|
|
235
|
+
*/
|
|
236
|
+
declare function createActionChunk(id: string, boundArgs?: unknown[]): ServerReferenceChunk;
|
|
237
|
+
/**
|
|
238
|
+
* Create an error chunk
|
|
239
|
+
*/
|
|
240
|
+
declare function createErrorChunk(boundary: string, error: Error, includeStack?: boolean): ErrorBoundaryChunk;
|
|
241
|
+
/**
|
|
242
|
+
* Create a hint chunk
|
|
243
|
+
*/
|
|
244
|
+
declare function createHintChunk(hint: HintChunk['hint'], href: string, options?: {
|
|
245
|
+
as?: HintChunk['as'];
|
|
246
|
+
crossorigin?: HintChunk['crossorigin'];
|
|
247
|
+
}): HintChunk;
|
|
248
|
+
/**
|
|
249
|
+
* Error thrown during serialization
|
|
250
|
+
*/
|
|
251
|
+
declare class FlightSerializationError extends Error {
|
|
252
|
+
constructor(message: string);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Error thrown during payload processing
|
|
256
|
+
*/
|
|
257
|
+
declare class FlightPayloadError extends Error {
|
|
258
|
+
readonly chunk?: FlightChunk | undefined;
|
|
259
|
+
constructor(message: string, chunk?: FlightChunk | undefined);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { type ClientReferenceChunk, type ErrorBoundaryChunk, type FlightChunk, type FlightClientElement, type FlightElement, type FlightFragmentElement, type FlightHostElement, type FlightLazyElement, type FlightNullElement, FlightPayloadError, FlightSerializationError, type FlightSuspenseElement, type FlightTextElement, type HintChunk, type MetaChunk, type SerializedSpecialValue, type SerializedValue, type ServerComponentChunk, type ServerReferenceChunk, type SpecialValueType, clientRef, createActionChunk, createClientChunk, createErrorChunk, createHintChunk, createServerChunk, deserialize, fragment, generateChunkId, h, isFlightElement, resetChunkIdCounter, serialize, suspense, text, toFlightElement };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { FlightPayloadError, FlightSerializationError, clientRef, createActionChunk, createClientChunk, createErrorChunk, createHintChunk, createServerChunk, deserialize, fragment, generateChunkId, h, isFlightElement, resetChunkIdCounter, serialize, suspense, text, toFlightElement } from '../chunk-K2CQZPCG.js';
|
|
2
|
+
//# sourceMappingURL=payload.js.map
|
|
3
|
+
//# sourceMappingURL=payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"payload.js"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flight-framework/core - esbuild Plugin for RSC
|
|
3
|
+
*
|
|
4
|
+
* esbuild plugin for Flight Server Components.
|
|
5
|
+
* Transforms 'use client' and 'use server' directives at build time.
|
|
6
|
+
*
|
|
7
|
+
* Philosophy: Zero lock-in - esbuild is optional, user decides bundler.
|
|
8
|
+
*
|
|
9
|
+
* @module @flight-framework/core/rsc/plugins/esbuild
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* esbuild Plugin interface (minimal)
|
|
13
|
+
* We define our own to avoid requiring esbuild as dependency
|
|
14
|
+
*/
|
|
15
|
+
interface EsbuildPlugin {
|
|
16
|
+
name: string;
|
|
17
|
+
setup: (build: EsbuildBuild) => void | Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
interface EsbuildBuild {
|
|
20
|
+
initialOptions: EsbuildBuildOptions;
|
|
21
|
+
onStart: (callback: () => void | Promise<void>) => void;
|
|
22
|
+
onEnd: (callback: (result: EsbuildResult) => void | Promise<void>) => void;
|
|
23
|
+
onResolve: (options: {
|
|
24
|
+
filter: RegExp;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
}, callback: (args: EsbuildResolveArgs) => EsbuildResolveResult | null | undefined | Promise<EsbuildResolveResult | null | undefined>) => void;
|
|
27
|
+
onLoad: (options: {
|
|
28
|
+
filter: RegExp;
|
|
29
|
+
namespace?: string;
|
|
30
|
+
}, callback: (args: EsbuildLoadArgs) => EsbuildLoadResult | null | undefined | Promise<EsbuildLoadResult | null | undefined>) => void;
|
|
31
|
+
}
|
|
32
|
+
interface EsbuildBuildOptions {
|
|
33
|
+
outdir?: string;
|
|
34
|
+
write?: boolean;
|
|
35
|
+
metafile?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface EsbuildResult {
|
|
38
|
+
errors: unknown[];
|
|
39
|
+
warnings: unknown[];
|
|
40
|
+
metafile?: unknown;
|
|
41
|
+
}
|
|
42
|
+
interface EsbuildResolveArgs {
|
|
43
|
+
path: string;
|
|
44
|
+
importer: string;
|
|
45
|
+
namespace: string;
|
|
46
|
+
resolveDir: string;
|
|
47
|
+
kind: string;
|
|
48
|
+
}
|
|
49
|
+
interface EsbuildResolveResult {
|
|
50
|
+
path?: string;
|
|
51
|
+
external?: boolean;
|
|
52
|
+
namespace?: string;
|
|
53
|
+
suffix?: string;
|
|
54
|
+
pluginData?: unknown;
|
|
55
|
+
errors?: unknown[];
|
|
56
|
+
warnings?: unknown[];
|
|
57
|
+
watchFiles?: string[];
|
|
58
|
+
watchDirs?: string[];
|
|
59
|
+
}
|
|
60
|
+
interface EsbuildLoadArgs {
|
|
61
|
+
path: string;
|
|
62
|
+
namespace: string;
|
|
63
|
+
suffix: string;
|
|
64
|
+
pluginData: unknown;
|
|
65
|
+
}
|
|
66
|
+
interface EsbuildLoadResult {
|
|
67
|
+
contents?: string;
|
|
68
|
+
loader?: 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'css';
|
|
69
|
+
resolveDir?: string;
|
|
70
|
+
errors?: unknown[];
|
|
71
|
+
warnings?: unknown[];
|
|
72
|
+
watchFiles?: string[];
|
|
73
|
+
watchDirs?: string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Plugin configuration
|
|
77
|
+
*/
|
|
78
|
+
interface FlightEsbuildPluginOptions {
|
|
79
|
+
/** Include patterns (regex) */
|
|
80
|
+
include?: RegExp;
|
|
81
|
+
/** Exclude patterns (regex) */
|
|
82
|
+
exclude?: RegExp;
|
|
83
|
+
/** Server actions endpoint */
|
|
84
|
+
actionsEndpoint?: string;
|
|
85
|
+
/** Output directory for manifests */
|
|
86
|
+
manifestDir?: string;
|
|
87
|
+
/** Is this for SSR build? */
|
|
88
|
+
ssr?: boolean;
|
|
89
|
+
/** Dev mode (include extra debug info) */
|
|
90
|
+
dev?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Manifest entry
|
|
94
|
+
*/
|
|
95
|
+
interface ManifestEntry {
|
|
96
|
+
id: string;
|
|
97
|
+
file: string;
|
|
98
|
+
exports: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Flight RSC esbuild Plugin
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // build.js
|
|
106
|
+
* import * as esbuild from 'esbuild';
|
|
107
|
+
* import { flightRSCEsbuild } from '@flight-framework/core/rsc/plugins/esbuild';
|
|
108
|
+
*
|
|
109
|
+
* await esbuild.build({
|
|
110
|
+
* entryPoints: ['src/index.tsx'],
|
|
111
|
+
* bundle: true,
|
|
112
|
+
* outdir: 'dist',
|
|
113
|
+
* plugins: [
|
|
114
|
+
* flightRSCEsbuild({
|
|
115
|
+
* actionsEndpoint: '/_flight/action',
|
|
116
|
+
* ssr: true,
|
|
117
|
+
* }),
|
|
118
|
+
* ],
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare function flightRSCEsbuild(options?: FlightEsbuildPluginOptions): EsbuildPlugin;
|
|
123
|
+
|
|
124
|
+
export { type EsbuildBuild, type EsbuildBuildOptions, type EsbuildLoadArgs, type EsbuildLoadResult, type EsbuildPlugin, type EsbuildResolveArgs, type EsbuildResolveResult, type EsbuildResult, type FlightEsbuildPluginOptions, type ManifestEntry, flightRSCEsbuild as default, flightRSCEsbuild };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"esbuild.js"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ClientManifestEntry, FlightRSCPluginOptions as FlightVitePluginOptions, ServerManifestEntry, default as flightRSCVite } from '../vite-plugin.js';
|
|
2
|
+
export { EsbuildBuild, EsbuildLoadArgs, EsbuildLoadResult, EsbuildPlugin, EsbuildResolveArgs, EsbuildResolveResult, FlightEsbuildPluginOptions, ManifestEntry, default as flightRSCEsbuild } from './esbuild.js';
|
|
3
|
+
export { FlightRollupPluginOptions, RollupPlugin, RollupPluginContext, default as flightRSCRollup } from './rollup.js';
|
|
4
|
+
import 'vite';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { flightRSCEsbuild } from '../../chunk-6XZQPPYC.js';
|
|
2
|
+
export { flightRSCRollup } from '../../chunk-5GUCB2CG.js';
|
|
3
|
+
export { flightRSC as flightRSCVite } from '../../chunk-MRLCNFSD.js';
|
|
4
|
+
import '../../chunk-CLZSB5QD.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flight-framework/core - Rollup Plugin for RSC
|
|
3
|
+
*
|
|
4
|
+
* Rollup plugin for Flight Server Components.
|
|
5
|
+
* Transforms 'use client' and 'use server' directives at build time.
|
|
6
|
+
*
|
|
7
|
+
* Philosophy: Zero lock-in - Rollup is optional, user decides bundler.
|
|
8
|
+
*
|
|
9
|
+
* @module @flight-framework/core/rsc/plugins/rollup
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Rollup Plugin interface (minimal)
|
|
13
|
+
* We define our own to avoid requiring rollup as dependency
|
|
14
|
+
*/
|
|
15
|
+
interface RollupPlugin {
|
|
16
|
+
name: string;
|
|
17
|
+
buildStart?: (options: unknown) => void | Promise<void>;
|
|
18
|
+
resolveId?: (source: string, importer: string | undefined, options: {
|
|
19
|
+
isEntry: boolean;
|
|
20
|
+
}) => string | null | undefined | {
|
|
21
|
+
id: string;
|
|
22
|
+
external?: boolean;
|
|
23
|
+
} | Promise<string | null | undefined | {
|
|
24
|
+
id: string;
|
|
25
|
+
external?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
load?: (id: string) => string | null | undefined | {
|
|
28
|
+
code: string;
|
|
29
|
+
map?: unknown;
|
|
30
|
+
} | Promise<string | null | undefined | {
|
|
31
|
+
code: string;
|
|
32
|
+
map?: unknown;
|
|
33
|
+
}>;
|
|
34
|
+
transform?: (code: string, id: string) => string | null | undefined | {
|
|
35
|
+
code: string;
|
|
36
|
+
map?: unknown;
|
|
37
|
+
} | Promise<string | null | undefined | {
|
|
38
|
+
code: string;
|
|
39
|
+
map?: unknown;
|
|
40
|
+
}>;
|
|
41
|
+
generateBundle?: (options: unknown, bundle: Record<string, unknown>) => void | Promise<void>;
|
|
42
|
+
buildEnd?: (error?: Error) => void | Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
interface RollupPluginContext {
|
|
45
|
+
emitFile: (file: {
|
|
46
|
+
type: 'asset' | 'chunk';
|
|
47
|
+
fileName?: string;
|
|
48
|
+
source?: string;
|
|
49
|
+
id?: string;
|
|
50
|
+
}) => string;
|
|
51
|
+
warn: (message: string) => void;
|
|
52
|
+
error: (message: string) => never;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Plugin configuration
|
|
56
|
+
*/
|
|
57
|
+
interface FlightRollupPluginOptions {
|
|
58
|
+
/** Include patterns (regex or function) */
|
|
59
|
+
include?: RegExp | ((id: string) => boolean);
|
|
60
|
+
/** Exclude patterns (regex or function) */
|
|
61
|
+
exclude?: RegExp | ((id: string) => boolean);
|
|
62
|
+
/** Server actions endpoint */
|
|
63
|
+
actionsEndpoint?: string;
|
|
64
|
+
/** Client manifest filename */
|
|
65
|
+
clientManifest?: string;
|
|
66
|
+
/** Server manifest filename */
|
|
67
|
+
serverManifest?: string;
|
|
68
|
+
/** Is this for SSR build? */
|
|
69
|
+
ssr?: boolean;
|
|
70
|
+
/** Dev mode */
|
|
71
|
+
dev?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Manifest entry
|
|
75
|
+
*/
|
|
76
|
+
interface ManifestEntry {
|
|
77
|
+
id: string;
|
|
78
|
+
file: string;
|
|
79
|
+
exports: string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Flight RSC Rollup Plugin
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // rollup.config.js
|
|
87
|
+
* import { flightRSCRollup } from '@flight-framework/core/rsc/plugins/rollup';
|
|
88
|
+
*
|
|
89
|
+
* export default {
|
|
90
|
+
* input: 'src/index.tsx',
|
|
91
|
+
* output: { dir: 'dist', format: 'esm' },
|
|
92
|
+
* plugins: [
|
|
93
|
+
* flightRSCRollup({
|
|
94
|
+
* ssr: true,
|
|
95
|
+
* actionsEndpoint: '/_flight/action',
|
|
96
|
+
* }),
|
|
97
|
+
* ],
|
|
98
|
+
* };
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function flightRSCRollup(options?: FlightRollupPluginOptions): RollupPlugin;
|
|
102
|
+
|
|
103
|
+
export { type FlightRollupPluginOptions, type ManifestEntry, type RollupPlugin, type RollupPluginContext, flightRSCRollup as default, flightRSCRollup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"rollup.js"}
|