@flight-framework/core 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{chunk-5KF3QQWZ.js → chunk-3ZSSRE6M.js} +5 -19
  3. package/dist/chunk-3ZSSRE6M.js.map +1 -0
  4. package/dist/chunk-4S5JWTGN.js +218 -0
  5. package/dist/chunk-4S5JWTGN.js.map +1 -0
  6. package/dist/chunk-62C7LX2E.js +205 -0
  7. package/dist/chunk-62C7LX2E.js.map +1 -0
  8. package/dist/chunk-63SCEXD7.js +3 -0
  9. package/dist/chunk-63SCEXD7.js.map +1 -0
  10. package/dist/{chunk-YIOQC3DC.js → chunk-6BDCTUQY.js} +3 -3
  11. package/dist/{chunk-YIOQC3DC.js.map → chunk-6BDCTUQY.js.map} +1 -1
  12. package/dist/chunk-6Z2RYHEU.js +212 -0
  13. package/dist/chunk-6Z2RYHEU.js.map +1 -0
  14. package/dist/chunk-HAX5OAB6.js +324 -0
  15. package/dist/chunk-HAX5OAB6.js.map +1 -0
  16. package/dist/chunk-K2CQZPCG.js +257 -0
  17. package/dist/chunk-K2CQZPCG.js.map +1 -0
  18. package/dist/chunk-N3TUOEV4.js +213 -0
  19. package/dist/chunk-N3TUOEV4.js.map +1 -0
  20. package/dist/chunk-NWMJYTMB.js +300 -0
  21. package/dist/chunk-NWMJYTMB.js.map +1 -0
  22. package/dist/chunk-OCVLNLTI.js +252 -0
  23. package/dist/chunk-OCVLNLTI.js.map +1 -0
  24. package/dist/chunk-PDW5WCMW.js +258 -0
  25. package/dist/chunk-PDW5WCMW.js.map +1 -0
  26. package/dist/chunk-PVUMB632.js +256 -0
  27. package/dist/chunk-PVUMB632.js.map +1 -0
  28. package/dist/{chunk-6WSPUG5L.js → chunk-RSVA2EYO.js} +2 -2
  29. package/dist/chunk-RSVA2EYO.js.map +1 -0
  30. package/dist/chunk-T4Z4HM4W.js +285 -0
  31. package/dist/chunk-T4Z4HM4W.js.map +1 -0
  32. package/dist/{chunk-OBNYNJB5.js → chunk-WOEIJWGJ.js} +6 -8
  33. package/dist/chunk-WOEIJWGJ.js.map +1 -0
  34. package/dist/{chunk-I2B4WSHC.js → chunk-XSY5AAXT.js} +3 -4
  35. package/dist/chunk-XSY5AAXT.js.map +1 -0
  36. package/dist/chunk-Y22AMGTM.js +3 -0
  37. package/dist/chunk-Y22AMGTM.js.map +1 -0
  38. package/dist/chunk-ZIE56LCA.js +341 -0
  39. package/dist/chunk-ZIE56LCA.js.map +1 -0
  40. package/dist/file-router/streaming-hints.d.ts +1 -1
  41. package/dist/file-router/streaming-hints.js +1 -1
  42. package/dist/index.d.ts +3 -1
  43. package/dist/index.js +19 -7
  44. package/dist/index.js.map +1 -1
  45. package/dist/rsc/adapters/index.d.ts +8 -0
  46. package/dist/rsc/adapters/index.js +7 -0
  47. package/dist/rsc/adapters/index.js.map +1 -0
  48. package/dist/rsc/adapters/preact.d.ts +97 -0
  49. package/dist/rsc/adapters/preact.js +3 -0
  50. package/dist/rsc/adapters/preact.js.map +1 -0
  51. package/dist/rsc/adapters/react.d.ts +82 -0
  52. package/dist/rsc/adapters/react.js +3 -0
  53. package/dist/rsc/adapters/react.js.map +1 -0
  54. package/dist/rsc/adapters/solid.d.ts +84 -0
  55. package/dist/rsc/adapters/solid.js +3 -0
  56. package/dist/rsc/adapters/solid.js.map +1 -0
  57. package/dist/rsc/adapters/vue.d.ts +80 -0
  58. package/dist/rsc/adapters/vue.js +3 -0
  59. package/dist/rsc/adapters/vue.js.map +1 -0
  60. package/dist/rsc/boundaries.d.ts +182 -0
  61. package/dist/rsc/boundaries.js +3 -0
  62. package/dist/rsc/boundaries.js.map +1 -0
  63. package/dist/rsc/context.d.ts +201 -0
  64. package/dist/rsc/context.js +3 -0
  65. package/dist/rsc/context.js.map +1 -0
  66. package/dist/rsc/index.d.ts +20 -124
  67. package/dist/rsc/index.js +13 -1
  68. package/dist/rsc/legacy.d.ts +131 -0
  69. package/dist/rsc/legacy.js +3 -0
  70. package/dist/rsc/legacy.js.map +1 -0
  71. package/dist/rsc/payload.d.ts +262 -0
  72. package/dist/rsc/payload.js +3 -0
  73. package/dist/rsc/payload.js.map +1 -0
  74. package/dist/rsc/plugins/esbuild.d.ts +124 -0
  75. package/dist/rsc/plugins/esbuild.js +4 -0
  76. package/dist/rsc/plugins/esbuild.js.map +1 -0
  77. package/dist/rsc/plugins/index.d.ts +4 -0
  78. package/dist/rsc/plugins/index.js +6 -0
  79. package/dist/rsc/plugins/index.js.map +1 -0
  80. package/dist/rsc/plugins/rollup.d.ts +103 -0
  81. package/dist/rsc/plugins/rollup.js +4 -0
  82. package/dist/rsc/plugins/rollup.js.map +1 -0
  83. package/dist/rsc/renderer.d.ts +160 -0
  84. package/dist/rsc/renderer.js +5 -0
  85. package/dist/rsc/renderer.js.map +1 -0
  86. package/dist/rsc/stream.d.ts +129 -0
  87. package/dist/rsc/stream.js +3 -0
  88. package/dist/rsc/stream.js.map +1 -0
  89. package/dist/rsc/vite-plugin.d.ts +78 -0
  90. package/dist/rsc/vite-plugin.js +4 -0
  91. package/dist/rsc/vite-plugin.js.map +1 -0
  92. package/dist/streaming/index.js +1 -1
  93. package/dist/streaming/observability.js +2 -2
  94. package/dist/streaming/priority.js +1 -1
  95. package/package.json +180 -124
  96. package/dist/chunk-5KF3QQWZ.js.map +0 -1
  97. package/dist/chunk-6WSPUG5L.js.map +0 -1
  98. package/dist/chunk-I2B4WSHC.js.map +0 -1
  99. package/dist/chunk-OBNYNJB5.js.map +0 -1
@@ -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 '@flight-framework/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,3 @@
1
+ export { createReactAdapter, createReactConsumer, markAsClientComponent } from '../../chunk-6Z2RYHEU.js';
2
+ //# sourceMappingURL=react.js.map
3
+ //# sourceMappingURL=react.js.map
@@ -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 '@flight-framework/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,3 @@
1
+ export { createSolidAdapter, createSolidConsumer, isServer, markAsSolidClientComponent } from '../../chunk-OCVLNLTI.js';
2
+ //# sourceMappingURL=solid.js.map
3
+ //# sourceMappingURL=solid.js.map
@@ -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 '@flight-framework/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,3 @@
1
+ export { createVueAdapter, createVueConsumer, markAsVueClientComponent } from '../../chunk-N3TUOEV4.js';
2
+ //# sourceMappingURL=vue.js.map
3
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"vue.js"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * @flight-framework/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 @flight-framework/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-PDW5WCMW.js';
2
+ //# sourceMappingURL=boundaries.js.map
3
+ //# sourceMappingURL=boundaries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"boundaries.js"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * @flight-framework/core - Server Context
3
+ *
4
+ * API de contexto para Server Components.
5
+ * Provee acceso a datos del request de forma explícita y type-safe.
6
+ *
7
+ * Filosofía Flight:
8
+ * - Contexto EXPLÍCITO (no magia con AsyncLocalStorage)
9
+ * - Pasado como argumento (testeable, predecible)
10
+ * - Extensible con adapters custom
11
+ * - Inmutable por defecto
12
+ *
13
+ * @module @flight-framework/core/rsc/context
14
+ */
15
+ /**
16
+ * Contexto del servidor disponible en Server Components
17
+ */
18
+ interface ServerContext {
19
+ /** Request actual (Web API Request) */
20
+ readonly request: Request;
21
+ /** Parámetros de ruta */
22
+ readonly params: Readonly<Record<string, string>>;
23
+ /** Search params de la URL */
24
+ readonly searchParams: URLSearchParams;
25
+ /** Headers del request */
26
+ readonly headers: Headers;
27
+ /** Accessor de cookies */
28
+ readonly cookies: CookieAccessor;
29
+ /** Headers de respuesta (mutables) */
30
+ readonly responseHeaders: Headers;
31
+ /** Signal para cancelación */
32
+ readonly signal: AbortSignal;
33
+ /** URL parseada */
34
+ readonly url: URL;
35
+ /** Método HTTP */
36
+ readonly method: string;
37
+ /** Context extensions (para adapters) */
38
+ readonly extensions: ContextExtensions;
39
+ }
40
+ /**
41
+ * Accessor para cookies con lazy parsing
42
+ */
43
+ interface CookieAccessor {
44
+ /** Obtiene el valor de una cookie */
45
+ get(name: string): string | undefined;
46
+ /** Obtiene todas las cookies */
47
+ getAll(): Readonly<Record<string, string>>;
48
+ /** Verifica si existe una cookie */
49
+ has(name: string): boolean;
50
+ }
51
+ /**
52
+ * Extensiones del contexto para adapters
53
+ */
54
+ interface ContextExtensions {
55
+ /** Obtiene una extensión */
56
+ get<T>(key: string): T | undefined;
57
+ /** Verifica si existe una extensión */
58
+ has(key: string): boolean;
59
+ }
60
+ /**
61
+ * Opciones para crear ServerContext
62
+ */
63
+ interface ServerContextOptions {
64
+ /** Parámetros de ruta */
65
+ params?: Record<string, string>;
66
+ /** Extensiones custom */
67
+ extensions?: Record<string, unknown>;
68
+ /** Headers de respuesta iniciales */
69
+ responseHeaders?: HeadersInit;
70
+ }
71
+ /**
72
+ * Crea un ServerContext a partir de un Request
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const ctx = createServerContext(request, {
77
+ * params: { id: '123' }
78
+ * });
79
+ *
80
+ * // En un Server Component
81
+ * async function UserPage(props, ctx: ServerContext) {
82
+ * const userId = ctx.params.id;
83
+ * const user = await db.users.get(userId);
84
+ * return <UserProfile user={user} />;
85
+ * }
86
+ * ```
87
+ */
88
+ declare function createServerContext(request: Request, options?: ServerContextOptions): ServerContext;
89
+ /**
90
+ * Obtiene un header del request
91
+ */
92
+ declare function getHeader(ctx: ServerContext, name: string): string | null;
93
+ /**
94
+ * Obtiene todos los headers como objeto
95
+ */
96
+ declare function getHeaders(ctx: ServerContext): Record<string, string>;
97
+ /**
98
+ * Verifica si el request es un POST/PUT/PATCH/DELETE (mutation request)
99
+ */
100
+ declare function isMutationRequest(ctx: ServerContext): boolean;
101
+ /**
102
+ * Verifica si el request acepta JSON
103
+ */
104
+ declare function acceptsJson(ctx: ServerContext): boolean;
105
+ /**
106
+ * Verifica si el request es AJAX/fetch
107
+ */
108
+ declare function isAjaxRequest(ctx: ServerContext): boolean;
109
+ /**
110
+ * Verifica si el request viene de un bot
111
+ */
112
+ declare function isBotRequest(ctx: ServerContext): boolean;
113
+ /**
114
+ * Verifica si el cliente soporta streaming
115
+ */
116
+ declare function supportsStreaming(ctx: ServerContext): boolean;
117
+ /**
118
+ * Obtiene el idioma preferido del cliente
119
+ */
120
+ declare function getPreferredLanguage(ctx: ServerContext, available: string[]): string | undefined;
121
+ /**
122
+ * Sets a cookie in the response
123
+ */
124
+ declare function setCookie(ctx: ServerContext, name: string, value: string, options?: CookieOptions): void;
125
+ /**
126
+ * Deletes a cookie
127
+ */
128
+ declare function deleteCookie(ctx: ServerContext, name: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void;
129
+ /**
130
+ * Cookie options
131
+ */
132
+ interface CookieOptions {
133
+ /** Max age in seconds */
134
+ maxAge?: number;
135
+ /** Expiration date */
136
+ expires?: Date;
137
+ /** Cookie path */
138
+ path?: string;
139
+ /** Cookie domain */
140
+ domain?: string;
141
+ /** HTTPS only */
142
+ secure?: boolean;
143
+ /** Not accessible via JavaScript */
144
+ httpOnly?: boolean;
145
+ /** SameSite attribute */
146
+ sameSite?: 'Strict' | 'Lax' | 'None';
147
+ }
148
+ /**
149
+ * Sets cache control headers
150
+ */
151
+ declare function setCacheControl(ctx: ServerContext, options: CacheControlOptions): void;
152
+ /**
153
+ * Cache control options
154
+ */
155
+ interface CacheControlOptions {
156
+ public?: boolean;
157
+ private?: boolean;
158
+ noCache?: boolean;
159
+ noStore?: boolean;
160
+ maxAge?: number;
161
+ sMaxAge?: number;
162
+ staleWhileRevalidate?: number;
163
+ staleIfError?: number;
164
+ mustRevalidate?: boolean;
165
+ immutable?: boolean;
166
+ }
167
+ /**
168
+ * Not found error - triggers 404 handling
169
+ */
170
+ declare function notFound(message?: string): never;
171
+ /**
172
+ * Check if error is a not found error
173
+ */
174
+ declare function isNotFoundError(error: unknown): boolean;
175
+ /**
176
+ * Redirect error - triggers redirect handling
177
+ */
178
+ declare function redirect(url: string, status?: 301 | 302 | 303 | 307 | 308): never;
179
+ /**
180
+ * Check if error is a redirect error
181
+ */
182
+ declare function isRedirectError(error: unknown): error is Error & {
183
+ __flight_redirect: {
184
+ url: string;
185
+ status: number;
186
+ };
187
+ };
188
+ /**
189
+ * Get redirect info from error
190
+ */
191
+ declare function getRedirectInfo(error: Error & {
192
+ __flight_redirect: {
193
+ url: string;
194
+ status: number;
195
+ };
196
+ }): {
197
+ url: string;
198
+ status: number;
199
+ };
200
+
201
+ export { type CacheControlOptions, type ContextExtensions, type CookieAccessor, type CookieOptions, type ServerContext, type ServerContextOptions, acceptsJson, createServerContext, deleteCookie, getHeader, getHeaders, getPreferredLanguage, getRedirectInfo, isAjaxRequest, isBotRequest, isMutationRequest, isNotFoundError, isRedirectError, notFound, redirect, setCacheControl, setCookie, supportsStreaming };
@@ -0,0 +1,3 @@
1
+ export { acceptsJson, createServerContext, deleteCookie, getHeader, getHeaders, getPreferredLanguage, getRedirectInfo, isAjaxRequest, isBotRequest, isMutationRequest, isNotFoundError, isRedirectError, notFound, redirect, setCacheControl, setCookie, supportsStreaming } from '../chunk-62C7LX2E.js';
2
+ //# sourceMappingURL=context.js.map
3
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"context.js"}