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