@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.
Files changed (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +541 -0
  3. package/dist/actions/index.d.ts +743 -0
  4. package/dist/actions/index.js +3 -0
  5. package/dist/actions/index.js.map +1 -0
  6. package/dist/adapters/index.d.ts +502 -0
  7. package/dist/adapters/index.js +3 -0
  8. package/dist/adapters/index.js.map +1 -0
  9. package/dist/cache/index.d.ts +191 -0
  10. package/dist/cache/index.js +3 -0
  11. package/dist/cache/index.js.map +1 -0
  12. package/dist/chunk-62HISNA3.js +354 -0
  13. package/dist/chunk-62HISNA3.js.map +1 -0
  14. package/dist/chunk-63LWTEDQ.js +341 -0
  15. package/dist/chunk-63LWTEDQ.js.map +1 -0
  16. package/dist/chunk-63SCEXD7.js +3 -0
  17. package/dist/chunk-63SCEXD7.js.map +1 -0
  18. package/dist/chunk-72MYOTUB.js +667 -0
  19. package/dist/chunk-72MYOTUB.js.map +1 -0
  20. package/dist/chunk-7CNW24MQ.js +257 -0
  21. package/dist/chunk-7CNW24MQ.js.map +1 -0
  22. package/dist/chunk-7WIEAUJT.js +300 -0
  23. package/dist/chunk-7WIEAUJT.js.map +1 -0
  24. package/dist/chunk-7ZZF4ULK.js +259 -0
  25. package/dist/chunk-7ZZF4ULK.js.map +1 -0
  26. package/dist/chunk-AE3JTS73.js +222 -0
  27. package/dist/chunk-AE3JTS73.js.map +1 -0
  28. package/dist/chunk-AP5NLUSB.js +258 -0
  29. package/dist/chunk-AP5NLUSB.js.map +1 -0
  30. package/dist/chunk-C37YQQI7.js +221 -0
  31. package/dist/chunk-C37YQQI7.js.map +1 -0
  32. package/dist/chunk-DCLVXFVH.js +225 -0
  33. package/dist/chunk-DCLVXFVH.js.map +1 -0
  34. package/dist/chunk-DZMWWDFD.js +223 -0
  35. package/dist/chunk-DZMWWDFD.js.map +1 -0
  36. package/dist/chunk-GCQZ4FHI.js +245 -0
  37. package/dist/chunk-GCQZ4FHI.js.map +1 -0
  38. package/dist/chunk-IPP44XY6.js +47 -0
  39. package/dist/chunk-IPP44XY6.js.map +1 -0
  40. package/dist/chunk-IW7FTQQX.js +267 -0
  41. package/dist/chunk-IW7FTQQX.js.map +1 -0
  42. package/dist/chunk-JX4YSCBH.js +428 -0
  43. package/dist/chunk-JX4YSCBH.js.map +1 -0
  44. package/dist/chunk-KX6UYWWR.js +229 -0
  45. package/dist/chunk-KX6UYWWR.js.map +1 -0
  46. package/dist/chunk-LWVETFJV.js +46 -0
  47. package/dist/chunk-LWVETFJV.js.map +1 -0
  48. package/dist/chunk-MCL2MCA2.js +285 -0
  49. package/dist/chunk-MCL2MCA2.js.map +1 -0
  50. package/dist/chunk-MZXCF35B.js +205 -0
  51. package/dist/chunk-MZXCF35B.js.map +1 -0
  52. package/dist/chunk-NCGPUFWV.js +96 -0
  53. package/dist/chunk-NCGPUFWV.js.map +1 -0
  54. package/dist/chunk-OEJMIE2Q.js +351 -0
  55. package/dist/chunk-OEJMIE2Q.js.map +1 -0
  56. package/dist/chunk-OYF2OAKS.js +394 -0
  57. package/dist/chunk-OYF2OAKS.js.map +1 -0
  58. package/dist/chunk-P6S43FYZ.js +316 -0
  59. package/dist/chunk-P6S43FYZ.js.map +1 -0
  60. package/dist/chunk-PL37KFRJ.js +3 -0
  61. package/dist/chunk-PL37KFRJ.js.map +1 -0
  62. package/dist/chunk-Q7BS5QC5.js +197 -0
  63. package/dist/chunk-Q7BS5QC5.js.map +1 -0
  64. package/dist/chunk-SDYPG3JD.js +288 -0
  65. package/dist/chunk-SDYPG3JD.js.map +1 -0
  66. package/dist/chunk-SUG56SZO.js +256 -0
  67. package/dist/chunk-SUG56SZO.js.map +1 -0
  68. package/dist/chunk-UVH5XJRP.js +164 -0
  69. package/dist/chunk-UVH5XJRP.js.map +1 -0
  70. package/dist/chunk-WZIJKCL3.js +282 -0
  71. package/dist/chunk-WZIJKCL3.js.map +1 -0
  72. package/dist/chunk-Y22AMGTM.js +3 -0
  73. package/dist/chunk-Y22AMGTM.js.map +1 -0
  74. package/dist/chunk-Z7G23XWU.js +200 -0
  75. package/dist/chunk-Z7G23XWU.js.map +1 -0
  76. package/dist/chunk-ZJU5M4IB.js +125 -0
  77. package/dist/chunk-ZJU5M4IB.js.map +1 -0
  78. package/dist/chunk-ZVC3ZWLM.js +52 -0
  79. package/dist/chunk-ZVC3ZWLM.js.map +1 -0
  80. package/dist/chunk-ZZZML7Y3.js +310 -0
  81. package/dist/chunk-ZZZML7Y3.js.map +1 -0
  82. package/dist/client.d.ts +25 -0
  83. package/dist/client.js +16 -0
  84. package/dist/client.js.map +1 -0
  85. package/dist/config/index.d.ts +170 -0
  86. package/dist/config/index.js +3 -0
  87. package/dist/config/index.js.map +1 -0
  88. package/dist/errors/index.d.ts +267 -0
  89. package/dist/errors/index.js +4 -0
  90. package/dist/errors/index.js.map +1 -0
  91. package/dist/file-router/index.d.ts +184 -0
  92. package/dist/file-router/index.js +3 -0
  93. package/dist/file-router/index.js.map +1 -0
  94. package/dist/file-router/streaming-hints.d.ts +129 -0
  95. package/dist/file-router/streaming-hints.js +3 -0
  96. package/dist/file-router/streaming-hints.js.map +1 -0
  97. package/dist/handlers/index.d.ts +59 -0
  98. package/dist/handlers/index.js +3 -0
  99. package/dist/handlers/index.js.map +1 -0
  100. package/dist/index.d.ts +588 -0
  101. package/dist/index.js +886 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/islands/index.d.ts +234 -0
  104. package/dist/islands/index.js +3 -0
  105. package/dist/islands/index.js.map +1 -0
  106. package/dist/middleware/index.d.ts +305 -0
  107. package/dist/middleware/index.js +3 -0
  108. package/dist/middleware/index.js.map +1 -0
  109. package/dist/react/index.d.ts +73 -0
  110. package/dist/react/index.js +52 -0
  111. package/dist/react/index.js.map +1 -0
  112. package/dist/render/index.d.ts +131 -0
  113. package/dist/render/index.js +3 -0
  114. package/dist/render/index.js.map +1 -0
  115. package/dist/router/index.d.ts +65 -0
  116. package/dist/router/index.js +3 -0
  117. package/dist/router/index.js.map +1 -0
  118. package/dist/rsc/adapters/index.d.ts +8 -0
  119. package/dist/rsc/adapters/index.js +7 -0
  120. package/dist/rsc/adapters/index.js.map +1 -0
  121. package/dist/rsc/adapters/preact.d.ts +97 -0
  122. package/dist/rsc/adapters/preact.js +3 -0
  123. package/dist/rsc/adapters/preact.js.map +1 -0
  124. package/dist/rsc/adapters/react.d.ts +82 -0
  125. package/dist/rsc/adapters/react.js +3 -0
  126. package/dist/rsc/adapters/react.js.map +1 -0
  127. package/dist/rsc/adapters/solid.d.ts +84 -0
  128. package/dist/rsc/adapters/solid.js +3 -0
  129. package/dist/rsc/adapters/solid.js.map +1 -0
  130. package/dist/rsc/adapters/vue.d.ts +80 -0
  131. package/dist/rsc/adapters/vue.js +3 -0
  132. package/dist/rsc/adapters/vue.js.map +1 -0
  133. package/dist/rsc/boundaries.d.ts +182 -0
  134. package/dist/rsc/boundaries.js +3 -0
  135. package/dist/rsc/boundaries.js.map +1 -0
  136. package/dist/rsc/context.d.ts +201 -0
  137. package/dist/rsc/context.js +3 -0
  138. package/dist/rsc/context.js.map +1 -0
  139. package/dist/rsc/index.d.ts +232 -0
  140. package/dist/rsc/index.js +15 -0
  141. package/dist/rsc/index.js.map +1 -0
  142. package/dist/rsc/legacy.d.ts +155 -0
  143. package/dist/rsc/legacy.js +3 -0
  144. package/dist/rsc/legacy.js.map +1 -0
  145. package/dist/rsc/payload.d.ts +262 -0
  146. package/dist/rsc/payload.js +3 -0
  147. package/dist/rsc/payload.js.map +1 -0
  148. package/dist/rsc/plugins/esbuild.d.ts +124 -0
  149. package/dist/rsc/plugins/esbuild.js +4 -0
  150. package/dist/rsc/plugins/esbuild.js.map +1 -0
  151. package/dist/rsc/plugins/index.d.ts +4 -0
  152. package/dist/rsc/plugins/index.js +6 -0
  153. package/dist/rsc/plugins/index.js.map +1 -0
  154. package/dist/rsc/plugins/rollup.d.ts +103 -0
  155. package/dist/rsc/plugins/rollup.js +4 -0
  156. package/dist/rsc/plugins/rollup.js.map +1 -0
  157. package/dist/rsc/renderer.d.ts +162 -0
  158. package/dist/rsc/renderer.js +5 -0
  159. package/dist/rsc/renderer.js.map +1 -0
  160. package/dist/rsc/stream.d.ts +129 -0
  161. package/dist/rsc/stream.js +3 -0
  162. package/dist/rsc/stream.js.map +1 -0
  163. package/dist/rsc/vite-plugin.d.ts +78 -0
  164. package/dist/rsc/vite-plugin.js +4 -0
  165. package/dist/rsc/vite-plugin.js.map +1 -0
  166. package/dist/server/index.d.ts +135 -0
  167. package/dist/server/index.js +6 -0
  168. package/dist/server/index.js.map +1 -0
  169. package/dist/streaming/adapters/index.d.ts +223 -0
  170. package/dist/streaming/adapters/index.js +3 -0
  171. package/dist/streaming/adapters/index.js.map +1 -0
  172. package/dist/streaming/conditional.d.ts +130 -0
  173. package/dist/streaming/conditional.js +3 -0
  174. package/dist/streaming/conditional.js.map +1 -0
  175. package/dist/streaming/index.d.ts +177 -0
  176. package/dist/streaming/index.js +3 -0
  177. package/dist/streaming/index.js.map +1 -0
  178. package/dist/streaming/observability.d.ts +201 -0
  179. package/dist/streaming/observability.js +4 -0
  180. package/dist/streaming/observability.js.map +1 -0
  181. package/dist/streaming/priority.d.ts +103 -0
  182. package/dist/streaming/priority.js +3 -0
  183. package/dist/streaming/priority.js.map +1 -0
  184. package/dist/utils/index.d.ts +42 -0
  185. package/dist/utils/index.js +4 -0
  186. package/dist/utils/index.js.map +1 -0
  187. package/package.json +228 -0
@@ -0,0 +1,588 @@
1
+ export { FlightConfig, FlightUserConfig, defineConfig } from './config/index.js';
2
+ export { Route, RouteMatch, RouteParams, Router, createRouter } from './router/index.js';
3
+ export { FlightServer, RouteHandler, RouteHandlerContext, ServerOptions, ServerRoute, createServer } from './server/index.js';
4
+ export { RenderContext, RenderMode, RenderResult } from './render/index.js';
5
+ import { CacheOptions, Cache } from './cache/index.js';
6
+ export { CacheAdapter, CacheEntry, CacheStats, CreateCacheOptions, Serializer, cacheKey, cached, createCache, dedupe, jsonSerializer, memory } from './cache/index.js';
7
+ export { Middleware, MiddlewareContext, MiddlewareNext, createMiddlewareChain } from './middleware/index.js';
8
+ export { AdapterBuilder, FlightAdapter } from './adapters/index.js';
9
+ export { FileRoute, FileRouter, FileRouterOptions, ScanResult, createFileRouter, loadRoutes, scanRoutes } from './file-router/index.js';
10
+ export { HttpMethod as FileHttpMethod, RouteHandler as FileRouteHandler, RouteHandlerContext as FileRouteHandlerContext, createRouteContext, error, json, parseBody, redirect } from './handlers/index.js';
11
+ export { ActionResult, CookieOptions, RedirectError, ServerAction, redirect as actionRedirect, cookies, executeAction, executeFormAction, getAction, handleActionRequest, isRedirectError, parseFormData, registerAction } from './actions/index.js';
12
+ export { StreamingRenderOptions, StreamingRenderResult, SuspenseBoundaryConfig, createLazyContent, createStreamingResponse, createStreamingSSR, renderWithStreaming, streamParallel, streamSequential } from './streaming/index.js';
13
+ export { BoundaryResolution, PriorityBoundary, PriorityStreamConfig, PriorityStreamResult, StreamingStrategy, streamWithPriority, validateDependencies } from './streaming/priority.js';
14
+ export { BoundaryTiming, InstrumentedStreamConfig, InstrumentedStreamResult, MetricsAggregator, StreamingMetrics, StreamingObserver, createHttpObserver, createInstrumentedStream, createLoggerObserver } from './streaming/observability.js';
15
+ export { BuiltInCondition, DEFAULT_BOT_PATTERNS, StreamIfConfig, StreamingCondition, addStreamingHeaders, createConditionalStreamer, createStreamingResponse as createConditionalStreamingResponse, createStaticResponse, isBot, isSlowConnection, prefersNoStream, streamIf, supportsStreaming } from './streaming/conditional.js';
16
+ export { AdapterOptions, FrameworkType, HTMXAdapterOptions, ReactAdapterOptions, SolidAdapterOptions, StreamingAdapter, SvelteAdapterOptions, VueAdapterOptions, createHTMXStreamAdapter, createReactStreamAdapter, createSolidStreamAdapter, createStreamAdapter, createSvelteStreamAdapter, createVueStreamAdapter } from './streaming/adapters/index.js';
17
+ export { CustomHydrationTrigger, HydrateOptions, HydrationTrigger, Island, IslandConfig, IslandRegistry, IslandRenderAdapter, RenderedIsland, createIslandRegistry, createPreactIslandAdapter, createReactIslandAdapter, createSolidIslandAdapter, createVueIslandAdapter, defineIsland, hydrateIslands, registerFlightIslandElement, registerIsland, renderIsland, renderIslands, setIslandAdapter } from './islands/index.js';
18
+ export { DEFAULT_STREAMING_HINTS, GetStreamingConfig, ResolvedStreamingConfig, StreamingHints, StreamingRouteModule, createStreamingController, generateCacheKey, getStreamingCacheHeaders, hasStreamingConfig, isValidStreamingHints, loadRouteWithStreaming, resolveStreamingConfig, shouldStream } from './file-router/streaming-hints.js';
19
+ export { ServerContext as RSCServerContext, createServerContext, isNotFoundError, isRedirectError as isRscRedirectError, notFound, redirect as rscRedirect } from './rsc/context.js';
20
+ export { BoundaryType as RSCBoundaryType, detectBoundaryType, hasUseClientDirective, hasUseServerDirective } from './rsc/boundaries.js';
21
+ export { ClientComponent, ComponentType as RSCComponentType, RenderContext as RSCRenderContext, ServerComponent, composeComponents, createAsyncComponent, createClientBoundary, createRenderContext, deserializeProps, executeServerComponent, revalidatePath as rscRevalidatePath, revalidateTag as rscRevalidateTag, serializeProps, serverFetch, withErrorBoundary } from './rsc/legacy.js';
22
+ export { BadRequestError, ErrorBoundaryOptions, FlightError, FlightErrorOptions, FlightErrorProps, ForbiddenError, InternalError, NotFoundError, ResetDetails, UnauthorizedError, clearError, createError, createErrorResponse, forbidden as createForbidden, notFound as createNotFound, unauthorized as createUnauthorized, getError, getErrorStatusCode, isFlightError, isForbiddenError as isForbidden, isNotFoundError as isNotFound, isUnauthorizedError as isUnauthorized, showError, wrapWithDigest } from './errors/index.js';
23
+ export { getEnvironment, isBrowser, isDevelopment, isProduction, isServer, isTest } from './utils/index.js';
24
+
25
+ /**
26
+ * @flightdev/core - Route Rules Configuration
27
+ *
28
+ * Nuxt-inspired route rules for per-route rendering configuration.
29
+ * Define SSR, SSG, ISR, SWR, and caching strategies per route pattern.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const routeRules: RouteRules = {
34
+ * '/': { prerender: true },
35
+ * '/blog': { isr: 3600 },
36
+ * '/blog/**': { swr: 3600 },
37
+ * '/admin/**': { ssr: false },
38
+ * '/api/**': { cache: { ttl: 60 } }
39
+ * };
40
+ * ```
41
+ */
42
+
43
+ /**
44
+ * Route rule configuration
45
+ */
46
+ interface RouteRule {
47
+ /** Pre-render at build time (SSG) */
48
+ prerender?: boolean;
49
+ /**
50
+ * Stale-While-Revalidate caching
51
+ * - true: use default TTL
52
+ * - number: TTL in seconds
53
+ */
54
+ swr?: number | boolean;
55
+ /**
56
+ * Incremental Static Regeneration
57
+ * - true: regenerate on next deploy
58
+ * - number: revalidate every N seconds
59
+ */
60
+ isr?: number | boolean;
61
+ /**
62
+ * Enable/disable SSR for this route
63
+ * - false: client-side only rendering
64
+ */
65
+ ssr?: boolean;
66
+ /** Custom cache options */
67
+ cache?: CacheOptions;
68
+ /** Response headers to add */
69
+ headers?: Record<string, string>;
70
+ /** Redirect to another path */
71
+ redirect?: string | {
72
+ to: string;
73
+ statusCode?: 301 | 302 | 307 | 308;
74
+ };
75
+ /** CORS headers */
76
+ cors?: boolean | {
77
+ origin?: string | string[];
78
+ methods?: string[];
79
+ credentials?: boolean;
80
+ };
81
+ /** Cache tags for invalidation */
82
+ tags?: string[];
83
+ }
84
+ /**
85
+ * Route rules map - patterns to rules
86
+ * Supports glob patterns: **, *, [param]
87
+ */
88
+ type RouteRules = Record<string, RouteRule>;
89
+ /**
90
+ * Match a path against route rules and return the matching rule
91
+ */
92
+ declare function matchRouteRule(path: string, rules: RouteRules): RouteRule | undefined;
93
+ /**
94
+ * Merge multiple route rules (later rules override earlier)
95
+ */
96
+ declare function mergeRouteRules(...rules: (RouteRule | undefined)[]): RouteRule;
97
+ /**
98
+ * Get effective render mode from route rule
99
+ */
100
+ declare function getRenderModeFromRule(rule: RouteRule): 'ssr' | 'ssg' | 'isr' | 'csr';
101
+ /**
102
+ * Get revalidation time from rule (in seconds)
103
+ */
104
+ declare function getRevalidateTime(rule: RouteRule): number | false;
105
+ /**
106
+ * Get cache options from rule
107
+ */
108
+ declare function getCacheOptionsFromRule(rule: RouteRule): CacheOptions | undefined;
109
+ /**
110
+ * Build cache-control header from rule
111
+ */
112
+ declare function buildCacheControlHeader(rule: RouteRule): string | undefined;
113
+ /**
114
+ * Create default route rules
115
+ */
116
+ declare function createDefaultRouteRules(): RouteRules;
117
+
118
+ /**
119
+ * @flightdev/core - On-Demand Revalidation
120
+ *
121
+ * APIs for on-demand cache invalidation and page revalidation.
122
+ * Similar to Next.js revalidatePath() and revalidateTag().
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * // In an API route
127
+ * import { revalidatePath, revalidateTag } from '@flightdev/core';
128
+ *
129
+ * app.post('/api/revalidate', async (c) => {
130
+ * const { path, tag } = await c.req.json();
131
+ *
132
+ * if (path) await revalidatePath(path);
133
+ * if (tag) await revalidateTag(tag);
134
+ *
135
+ * return c.json({ revalidated: true });
136
+ * });
137
+ * ```
138
+ */
139
+
140
+ /**
141
+ * ISR Cache entry for rendered pages
142
+ */
143
+ interface ISRCacheEntry {
144
+ /** Rendered HTML content */
145
+ html: string;
146
+ /** HTTP status code */
147
+ status: number;
148
+ /** Response headers */
149
+ headers: Record<string, string>;
150
+ /** When this entry was generated */
151
+ generatedAt: number;
152
+ /** When this entry should be revalidated */
153
+ revalidateAfter?: number;
154
+ /** Cache tags for invalidation */
155
+ tags?: string[];
156
+ }
157
+ /**
158
+ * ISR Cache adapter interface
159
+ */
160
+ interface ISRCacheAdapter {
161
+ /** Get cached page */
162
+ get(path: string): Promise<ISRCacheEntry | undefined>;
163
+ /** Set cached page */
164
+ set(path: string, entry: ISRCacheEntry, options?: CacheOptions): Promise<void>;
165
+ /** Delete cached page */
166
+ delete(path: string): Promise<boolean>;
167
+ /** Invalidate by tag */
168
+ invalidateTag(tag: string): Promise<void>;
169
+ /** Get all cached paths */
170
+ keys?(): Promise<string[]>;
171
+ }
172
+ /**
173
+ * Revalidation result
174
+ */
175
+ interface RevalidationResult {
176
+ /** Whether revalidation was successful */
177
+ success: boolean;
178
+ /** Paths that were revalidated */
179
+ paths?: string[];
180
+ /** Error if failed */
181
+ error?: string;
182
+ /** Timestamp */
183
+ timestamp: number;
184
+ }
185
+ /**
186
+ * Set the global ISR cache adapter
187
+ */
188
+ declare function setISRCache(cache: ISRCacheAdapter): void;
189
+ /**
190
+ * Get the global ISR cache adapter
191
+ */
192
+ declare function getISRCache(): ISRCacheAdapter | null;
193
+ /**
194
+ * Create an in-memory ISR cache
195
+ */
196
+ declare function createMemoryISRCache(): ISRCacheAdapter;
197
+ /**
198
+ * Revalidate a specific path
199
+ * Removes the cached page so next request regenerates it
200
+ */
201
+ declare function revalidatePath(path: string): Promise<RevalidationResult>;
202
+ /**
203
+ * Revalidate all paths associated with a tag
204
+ */
205
+ declare function revalidateTag(tag: string): Promise<RevalidationResult>;
206
+ /**
207
+ * Revalidate multiple paths
208
+ */
209
+ declare function revalidatePaths(paths: string[]): Promise<RevalidationResult>;
210
+ interface RevalidateHandlerOptions {
211
+ /** Secret token for authentication */
212
+ secret?: string;
213
+ /** Header name for the secret */
214
+ headerName?: string;
215
+ }
216
+ /**
217
+ * Create a revalidation handler for API routes
218
+ *
219
+ * @example
220
+ * ```typescript
221
+ * import { createRevalidateHandler } from '@flightdev/core';
222
+ *
223
+ * const handler = createRevalidateHandler({
224
+ * secret: process.env.REVALIDATE_SECRET
225
+ * });
226
+ *
227
+ * app.post('/api/revalidate', handler);
228
+ * ```
229
+ */
230
+ declare function createRevalidateHandler(options?: RevalidateHandlerOptions): (request: Request) => Promise<Response>;
231
+ /**
232
+ * Create an ISR cache adapter from a Flight Cache instance
233
+ */
234
+ declare function createISRCacheFromFlightCache(cache: Cache): ISRCacheAdapter;
235
+
236
+ /**
237
+ * @flightdev/core - Build-Time Prerender
238
+ *
239
+ * Static site generation build utilities.
240
+ * Pre-renders routes to HTML files at build time.
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * import { prerenderRoutes } from '@flightdev/core';
245
+ *
246
+ * await prerenderRoutes({
247
+ * routes: ['/','blog/hello', '/about'],
248
+ * outDir: './dist',
249
+ * renderFn: async (path) => await renderPage(path),
250
+ * });
251
+ * ```
252
+ */
253
+ /**
254
+ * Options for prerendering routes
255
+ */
256
+ interface PrerenderOptions {
257
+ /** Routes to prerender */
258
+ routes: string[] | (() => Promise<string[]>);
259
+ /** Output directory */
260
+ outDir: string;
261
+ /** Render function that generates HTML for a path */
262
+ renderFn: (path: string) => Promise<PrerenderResult>;
263
+ /** Concurrency limit */
264
+ concurrency?: number;
265
+ /** Progress callback */
266
+ onProgress?: (progress: PrerenderProgress) => void;
267
+ /** Error callback */
268
+ onError?: (error: PrerenderError) => void;
269
+ /** Whether to crawl links from rendered pages */
270
+ crawlLinks?: boolean;
271
+ }
272
+ /**
273
+ * Result from rendering a single page
274
+ */
275
+ interface PrerenderResult {
276
+ /** HTML content */
277
+ html: string;
278
+ /** HTTP status code */
279
+ status?: number;
280
+ /** Response headers */
281
+ headers?: Record<string, string>;
282
+ /** Links found in the page (for crawling) */
283
+ links?: string[];
284
+ }
285
+ /**
286
+ * Progress callback data
287
+ */
288
+ interface PrerenderProgress {
289
+ /** Current route being processed */
290
+ currentRoute: string;
291
+ /** Number of routes completed */
292
+ completed: number;
293
+ /** Total number of routes */
294
+ total: number;
295
+ /** Percentage complete */
296
+ percentage: number;
297
+ }
298
+ /**
299
+ * Error callback data
300
+ */
301
+ interface PrerenderError {
302
+ /** Route that failed */
303
+ route: string;
304
+ /** Error message */
305
+ error: Error;
306
+ }
307
+ /**
308
+ * Summary of prerender operation
309
+ */
310
+ interface PrerenderSummary {
311
+ /** Total routes processed */
312
+ total: number;
313
+ /** Successfully rendered routes */
314
+ success: number;
315
+ /** Failed routes */
316
+ failed: number;
317
+ /** Routes that were discovered via crawling */
318
+ discovered?: number;
319
+ /** Time taken in milliseconds */
320
+ duration: number;
321
+ /** List of generated files */
322
+ files: string[];
323
+ /** List of errors */
324
+ errors: PrerenderError[];
325
+ }
326
+ /**
327
+ * Prerender multiple routes to static HTML files
328
+ */
329
+ declare function prerenderRoutes(options: PrerenderOptions): Promise<PrerenderSummary>;
330
+ /**
331
+ * Extract internal links from HTML
332
+ */
333
+ declare function extractLinks(html: string, baseUrl?: string): string[];
334
+ /**
335
+ * Expand dynamic routes with static params
336
+ */
337
+ declare function expandDynamicRoutes(routePattern: string, generateParams: () => Promise<Record<string, string | string[]>[]>): Promise<string[]>;
338
+
339
+ /**
340
+ * @flightdev/core - SSR/SSG/ISR Support
341
+ *
342
+ * Static site generation and incremental static regeneration.
343
+ * Similar to Next.js patterns.
344
+ */
345
+ /**
346
+ * Static params for dynamic routes
347
+ */
348
+ interface StaticParams {
349
+ [key: string]: string | string[];
350
+ }
351
+ /**
352
+ * Generate static params function signature
353
+ */
354
+ type GenerateStaticParamsFunction = () => Promise<StaticParams[]> | StaticParams[];
355
+ /**
356
+ * Page metadata
357
+ */
358
+ interface PageMetadata {
359
+ title?: string;
360
+ description?: string;
361
+ keywords?: string[];
362
+ openGraph?: {
363
+ title?: string;
364
+ description?: string;
365
+ images?: string[];
366
+ };
367
+ }
368
+ /**
369
+ * Generate metadata function
370
+ */
371
+ type GenerateMetadataFunction = (params: StaticParams) => Promise<PageMetadata> | PageMetadata;
372
+ /**
373
+ * Page module exports
374
+ */
375
+ interface PageModule {
376
+ default: (props: {
377
+ params: StaticParams;
378
+ }) => unknown;
379
+ generateStaticParams?: GenerateStaticParamsFunction;
380
+ generateMetadata?: GenerateMetadataFunction;
381
+ revalidate?: number | false;
382
+ dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static';
383
+ runtime?: 'nodejs' | 'edge';
384
+ }
385
+ /**
386
+ * Generate all static paths for a page
387
+ */
388
+ declare function generateAllStaticPaths(pageModules: Map<string, PageModule>): Promise<Map<string, StaticParams[]>>;
389
+ /**
390
+ * Get or generate a cached page
391
+ */
392
+ declare function getOrGeneratePage(path: string, generateFn: () => Promise<string>, revalidate?: number | false): Promise<{
393
+ html: string;
394
+ fromCache: boolean;
395
+ }>;
396
+ /**
397
+ * Purge cached page
398
+ */
399
+ declare function purgePage(path: string): boolean;
400
+ /**
401
+ * Purge all cached pages
402
+ */
403
+ declare function purgeAllPages(): void;
404
+ /**
405
+ * Check if a page should be dynamically rendered
406
+ */
407
+ declare function shouldDynamicallyRender(module: PageModule, hasParams: boolean): boolean;
408
+ /**
409
+ * Create a streaming response
410
+ */
411
+ declare function createStreamingResponse(stream: ReadableStream<Uint8Array>): Response;
412
+ /**
413
+ * Create a text encoder stream for HTML
414
+ */
415
+ declare function createHtmlStream(): {
416
+ readable: ReadableStream<Uint8Array>;
417
+ write: (html: string) => void;
418
+ close: () => void;
419
+ };
420
+
421
+ /**
422
+ * @flightdev/core - Metadata Rendering
423
+ *
424
+ * Utilities for rendering SEO metadata to HTML head tags.
425
+ * Following Next.js Metadata API patterns.
426
+ *
427
+ * @example
428
+ * ```typescript
429
+ * import { renderMetadataToHead } from '@flightdev/core';
430
+ *
431
+ * const meta = {
432
+ * title: 'My Page',
433
+ * description: 'Page description',
434
+ * openGraph: { title: 'OG Title', images: ['/og.jpg'] }
435
+ * };
436
+ *
437
+ * const headHtml = renderMetadataToHead(meta);
438
+ * ```
439
+ */
440
+ /**
441
+ * Complete metadata interface for SEO
442
+ */
443
+ interface Metadata {
444
+ /** Page title */
445
+ title?: string | {
446
+ default: string;
447
+ template?: string;
448
+ };
449
+ /** Meta description */
450
+ description?: string;
451
+ /** Keywords for SEO */
452
+ keywords?: string | string[];
453
+ /** Canonical URL */
454
+ canonical?: string;
455
+ /** Robots directives */
456
+ robots?: string | {
457
+ index?: boolean;
458
+ follow?: boolean;
459
+ nocache?: boolean;
460
+ googleBot?: {
461
+ index?: boolean;
462
+ follow?: boolean;
463
+ noimageindex?: boolean;
464
+ };
465
+ };
466
+ /** Open Graph metadata */
467
+ openGraph?: {
468
+ title?: string;
469
+ description?: string;
470
+ url?: string;
471
+ siteName?: string;
472
+ images?: string[] | Array<{
473
+ url: string;
474
+ width?: number;
475
+ height?: number;
476
+ alt?: string;
477
+ }>;
478
+ locale?: string;
479
+ type?: 'website' | 'article' | 'book' | 'profile';
480
+ };
481
+ /** Twitter Card metadata */
482
+ twitter?: {
483
+ card?: 'summary' | 'summary_large_image' | 'app' | 'player';
484
+ site?: string;
485
+ creator?: string;
486
+ title?: string;
487
+ description?: string;
488
+ images?: string[];
489
+ };
490
+ /** Favicon and icons */
491
+ icons?: {
492
+ icon?: string | string[];
493
+ apple?: string | string[];
494
+ shortcut?: string;
495
+ };
496
+ /** Alternate languages */
497
+ alternates?: {
498
+ canonical?: string;
499
+ languages?: Record<string, string>;
500
+ };
501
+ /** Verification tokens */
502
+ verification?: {
503
+ google?: string;
504
+ yandex?: string;
505
+ bing?: string;
506
+ };
507
+ /** Additional custom meta tags */
508
+ other?: Record<string, string>;
509
+ }
510
+ /**
511
+ * Render metadata to HTML head tags
512
+ */
513
+ declare function renderMetadataToHead(meta: Metadata): string;
514
+ /**
515
+ * Merge multiple metadata objects (later overrides earlier)
516
+ */
517
+ declare function mergeMetadata(...metadataList: (Metadata | undefined)[]): Metadata;
518
+ /**
519
+ * Type for generateMetadata function
520
+ */
521
+ type GenerateMetadataFn<Params = Record<string, string>> = (props: {
522
+ params: Params;
523
+ searchParams?: Record<string, string>;
524
+ }) => Metadata | Promise<Metadata>;
525
+ /**
526
+ * Resolve metadata from a page module
527
+ */
528
+ declare function resolveMetadata<Params = Record<string, string>>(pageModule: {
529
+ metadata?: Metadata;
530
+ generateMetadata?: GenerateMetadataFn<Params>;
531
+ }, props: {
532
+ params: Params;
533
+ searchParams?: Record<string, string>;
534
+ }): Promise<Metadata>;
535
+
536
+ /**
537
+ * @flightdev/core - Local DevTools
538
+ *
539
+ * Development-only debugging overlay.
540
+ * 100% LOCAL - NO telemetry, NO external requests, NO cloud.
541
+ *
542
+ * @example
543
+ * ```typescript
544
+ * import { injectDevTools } from '@flightdev/core';
545
+ *
546
+ * const html = renderPage() + injectDevTools({ routes, renderTime });
547
+ * ```
548
+ */
549
+ interface DevToolsOptions {
550
+ /** Current route path */
551
+ route?: string;
552
+ /** Render time in milliseconds */
553
+ renderTime?: number;
554
+ /** Rendering mode used */
555
+ renderMode?: 'ssr' | 'ssg' | 'isr' | 'csr';
556
+ /** Whether page is hydrated */
557
+ hydrated?: boolean;
558
+ /** Route params */
559
+ params?: Record<string, string>;
560
+ /** Cache status */
561
+ cacheStatus?: 'hit' | 'miss' | 'stale';
562
+ /** Custom data to display */
563
+ customData?: Record<string, unknown>;
564
+ }
565
+ /**
566
+ * Inject DevTools overlay into HTML
567
+ * Only works in development mode - returns empty string in production
568
+ */
569
+ declare function injectDevTools(options?: DevToolsOptions): string;
570
+ /**
571
+ * Check if DevTools should be enabled
572
+ */
573
+ declare function isDevToolsEnabled(): boolean;
574
+ /**
575
+ * Create DevTools data from request context
576
+ */
577
+ declare function createDevToolsData(startTime: number, options?: Partial<DevToolsOptions>): DevToolsOptions;
578
+
579
+ /**
580
+ * Flight Framework - Core
581
+ *
582
+ * The agnostic full-stack framework primitives.
583
+ * Maximum flexibility, zero lock-in.
584
+ */
585
+
586
+ declare const VERSION = "0.0.1";
587
+
588
+ export { Cache, CacheOptions, type DevToolsOptions, type GenerateMetadataFn, type GenerateMetadataFunction, type GenerateStaticParamsFunction, type ISRCacheAdapter, type ISRCacheEntry, type Metadata, type PageMetadata, type PageModule, type PrerenderError, type PrerenderOptions, type PrerenderProgress, type PrerenderResult, type PrerenderSummary, type RevalidateHandlerOptions, type RevalidationResult, type RouteRule, type RouteRules, type StaticParams, VERSION, buildCacheControlHeader, createDefaultRouteRules, createDevToolsData, createHtmlStream, createISRCacheFromFlightCache, createMemoryISRCache, createRevalidateHandler, createStreamingResponse as createStaticStreamingResponse, expandDynamicRoutes, extractLinks, generateAllStaticPaths, getCacheOptionsFromRule, getISRCache, getOrGeneratePage, getRenderModeFromRule, getRevalidateTime, injectDevTools, isDevToolsEnabled, matchRouteRule, mergeMetadata, mergeRouteRules, prerenderRoutes, purgeAllPages, purgePage, renderMetadataToHead, resolveMetadata, revalidatePath, revalidatePaths, revalidateTag, setISRCache, shouldDynamicallyRender };