@flight-framework/bundler-flightpack 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -135
- package/dist/index.d.ts +266 -409
- package/dist/index.js +216 -347
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,247 +3,23 @@ import { CSSOptions, BundlerAdapter } from '@flight-framework/bundler';
|
|
|
3
3
|
/**
|
|
4
4
|
* @flight-framework/bundler-flightpack - Types
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* Exposes ALL native Rust capabilities via TypeScript interfaces.
|
|
8
|
-
*
|
|
9
|
-
* @packageDocumentation
|
|
6
|
+
* Type definitions for the FlightPack bundler adapter.
|
|
10
7
|
*/
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Determines externals handling and resolve conditions
|
|
10
|
+
* Platform target for builds
|
|
15
11
|
*/
|
|
16
12
|
type Platform = 'browser' | 'node' | 'edge' | 'neutral';
|
|
17
13
|
/**
|
|
18
|
-
*
|
|
19
|
-
* Follows Turbopack's unified graph approach
|
|
14
|
+
* Output format for bundles
|
|
20
15
|
*/
|
|
21
|
-
|
|
22
|
-
/** Target platform for this environment */
|
|
23
|
-
platform: Platform;
|
|
24
|
-
/** Entry points for this environment */
|
|
25
|
-
entry?: string[];
|
|
26
|
-
/** Output directory (relative to base outDir) */
|
|
27
|
-
outDir?: string;
|
|
28
|
-
/** External packages (not bundled) */
|
|
29
|
-
external?: string[];
|
|
30
|
-
/** Force bundle packages (override auto-external) */
|
|
31
|
-
noExternal?: string[];
|
|
32
|
-
/** Enable minification for this environment */
|
|
33
|
-
minify?: boolean;
|
|
34
|
-
/** Generate source maps */
|
|
35
|
-
sourcemap?: boolean;
|
|
36
|
-
/** Resolve conditions (e.g., ['import', 'module', 'browser']) */
|
|
37
|
-
conditions?: string[];
|
|
38
|
-
/** Node.js target version for node platform (e.g., 'node22') */
|
|
39
|
-
nodeTarget?: string;
|
|
40
|
-
}
|
|
16
|
+
type OutputFormat = 'esm' | 'cjs' | 'iife';
|
|
41
17
|
/**
|
|
42
|
-
*
|
|
43
|
-
* Mirrors Turbopack's filesystem cache functionality
|
|
18
|
+
* Target environment for transpilation
|
|
44
19
|
*/
|
|
45
|
-
|
|
46
|
-
/** Enable build caching */
|
|
47
|
-
enabled: boolean;
|
|
48
|
-
/** Cache directory path (default: .flightpack_cache) */
|
|
49
|
-
directory?: string;
|
|
50
|
-
/** Enable disk persistence for cache */
|
|
51
|
-
persistent?: boolean;
|
|
52
|
-
/** Maximum cache size in MB before pruning */
|
|
53
|
-
maxSize?: number;
|
|
54
|
-
/** Cache TTL in seconds */
|
|
55
|
-
ttl?: number;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Cache statistics for monitoring
|
|
59
|
-
*/
|
|
60
|
-
interface CacheStats {
|
|
61
|
-
/** Number of cache hits */
|
|
62
|
-
hits: number;
|
|
63
|
-
/** Number of cache misses */
|
|
64
|
-
misses: number;
|
|
65
|
-
/** Cache hit ratio (0-1) */
|
|
66
|
-
hitRatio: number;
|
|
67
|
-
/** Total cached entries */
|
|
68
|
-
entries: number;
|
|
69
|
-
/** Cache size in bytes */
|
|
70
|
-
size: number;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Tree shaking configuration
|
|
74
|
-
* Uses InnerGraph for statement-level dead code elimination
|
|
75
|
-
*/
|
|
76
|
-
interface TreeShakeConfig {
|
|
77
|
-
/** Enable tree shaking */
|
|
78
|
-
enabled: boolean;
|
|
79
|
-
/** Enable statement-level DCE via InnerGraph */
|
|
80
|
-
innerGraph?: boolean;
|
|
81
|
-
/** Modules to preserve (no tree shaking) */
|
|
82
|
-
preserve?: string[];
|
|
83
|
-
/** Side effects configuration by package */
|
|
84
|
-
sideEffects?: Record<string, boolean | string[]>;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Code splitting configuration
|
|
88
|
-
* Controls chunk generation via ChunkSplitter
|
|
89
|
-
*/
|
|
90
|
-
interface SplittingConfig {
|
|
91
|
-
/** Enable code splitting */
|
|
92
|
-
enabled: boolean;
|
|
93
|
-
/** Minimum shared chunk size in bytes */
|
|
94
|
-
minSize?: number;
|
|
95
|
-
/** Maximum chunk size in bytes before warning */
|
|
96
|
-
maxSize?: number;
|
|
97
|
-
/** Minimum references for vendor chunk extraction */
|
|
98
|
-
minChunks?: number;
|
|
99
|
-
/** Manual chunk configuration */
|
|
100
|
-
manualChunks?: Record<string, string[]>;
|
|
101
|
-
/** Enable vendor chunk extraction */
|
|
102
|
-
vendorChunk?: boolean;
|
|
103
|
-
/** Enable common chunk optimization */
|
|
104
|
-
commonChunk?: boolean;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Shared dependency configuration for Module Federation
|
|
108
|
-
*/
|
|
109
|
-
interface SharedConfig {
|
|
110
|
-
/** Singleton instance across all remotes */
|
|
111
|
-
singleton?: boolean;
|
|
112
|
-
/** Required version constraint */
|
|
113
|
-
requiredVersion?: string;
|
|
114
|
-
/** Eagerly load shared module */
|
|
115
|
-
eager?: boolean;
|
|
116
|
-
/** Strict version matching */
|
|
117
|
-
strictVersion?: boolean;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Exposed module configuration for Module Federation container
|
|
121
|
-
*/
|
|
122
|
-
interface ExposeConfig {
|
|
123
|
-
/** Module path to expose */
|
|
124
|
-
import: string;
|
|
125
|
-
/** Export name (optional, defaults to import) */
|
|
126
|
-
name?: string;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Remote container configuration for Module Federation
|
|
130
|
-
*/
|
|
131
|
-
interface RemoteConfig {
|
|
132
|
-
/** Remote entry URL or path */
|
|
133
|
-
entry: string;
|
|
134
|
-
/** Remote type (default: 'script') */
|
|
135
|
-
type?: 'script' | 'module';
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Module Federation configuration
|
|
139
|
-
* Rspack-compatible federation setup
|
|
140
|
-
*/
|
|
141
|
-
interface FederationConfig {
|
|
142
|
-
/** Container name */
|
|
143
|
-
name: string;
|
|
144
|
-
/** Remote entry filename */
|
|
145
|
-
filename?: string;
|
|
146
|
-
/** Exposed modules */
|
|
147
|
-
exposes?: Record<string, string | ExposeConfig>;
|
|
148
|
-
/** Remote containers */
|
|
149
|
-
remotes?: Record<string, string | RemoteConfig>;
|
|
150
|
-
/** Shared dependencies */
|
|
151
|
-
shared?: Record<string, boolean | SharedConfig>;
|
|
152
|
-
/** Library configuration */
|
|
153
|
-
library?: {
|
|
154
|
-
type: 'var' | 'module' | 'system' | 'umd';
|
|
155
|
-
name?: string;
|
|
156
|
-
};
|
|
157
|
-
}
|
|
20
|
+
type TargetEnvironment = 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'esnext';
|
|
158
21
|
/**
|
|
159
|
-
*
|
|
160
|
-
*/
|
|
161
|
-
interface SSGPageConfig {
|
|
162
|
-
/** Route path pattern */
|
|
163
|
-
path: string;
|
|
164
|
-
/** Static params for dynamic routes */
|
|
165
|
-
params?: Record<string, string>[];
|
|
166
|
-
/** Fallback behavior */
|
|
167
|
-
fallback?: 'false' | 'true' | 'blocking';
|
|
168
|
-
/** Revalidation time in seconds (ISR) */
|
|
169
|
-
revalidate?: number;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* SSG (Static Site Generation) configuration
|
|
173
|
-
*/
|
|
174
|
-
interface SSGConfig {
|
|
175
|
-
/** Enable SSG */
|
|
176
|
-
enabled: boolean;
|
|
177
|
-
/** Pages to pre-render */
|
|
178
|
-
pages?: SSGPageConfig[];
|
|
179
|
-
/** Default revalidation time for ISR */
|
|
180
|
-
defaultRevalidate?: number;
|
|
181
|
-
/** Maximum concurrent page generation */
|
|
182
|
-
concurrency?: number;
|
|
183
|
-
/** Generate trailing slashes in URLs */
|
|
184
|
-
trailingSlash?: boolean;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Browser targets for CSS autoprefixer
|
|
188
|
-
*/
|
|
189
|
-
interface CssBrowserTargets {
|
|
190
|
-
chrome?: number;
|
|
191
|
-
firefox?: number;
|
|
192
|
-
safari?: number;
|
|
193
|
-
edge?: number;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* CSS transformation options
|
|
197
|
-
* Uses Lightning CSS for high-performance processing
|
|
198
|
-
*/
|
|
199
|
-
interface CssTransformConfig {
|
|
200
|
-
/** Enable CSS minification */
|
|
201
|
-
minify?: boolean;
|
|
202
|
-
/** Enable CSS modules */
|
|
203
|
-
modules?: boolean;
|
|
204
|
-
/** Custom pattern for CSS module class names ([name], [hash], [local]) */
|
|
205
|
-
modulesPattern?: string;
|
|
206
|
-
/** Enable dashed ident scoping (CSS variables) */
|
|
207
|
-
dashedIdents?: boolean;
|
|
208
|
-
/** Generate source maps */
|
|
209
|
-
sourcemap?: boolean;
|
|
210
|
-
/** Browser targets for autoprefixer */
|
|
211
|
-
targets?: CssBrowserTargets;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* HMR (Hot Module Replacement) configuration
|
|
215
|
-
*/
|
|
216
|
-
interface HmrConfig {
|
|
217
|
-
/** Enable HMR */
|
|
218
|
-
enabled: boolean;
|
|
219
|
-
/** WebSocket port (default: same as dev server) */
|
|
220
|
-
port?: number;
|
|
221
|
-
/** WebSocket host */
|
|
222
|
-
host?: string;
|
|
223
|
-
/** Full page reload fallback */
|
|
224
|
-
fullReloadFallback?: boolean;
|
|
225
|
-
/** Overlay for errors */
|
|
226
|
-
overlay?: boolean | {
|
|
227
|
-
errors?: boolean;
|
|
228
|
-
warnings?: boolean;
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* File watcher configuration
|
|
233
|
-
*/
|
|
234
|
-
interface WatcherConfig {
|
|
235
|
-
/** Paths to watch */
|
|
236
|
-
paths?: string[];
|
|
237
|
-
/** File extensions to watch */
|
|
238
|
-
extensions?: string[];
|
|
239
|
-
/** Debounce delay in milliseconds */
|
|
240
|
-
debounceMs?: number;
|
|
241
|
-
/** Ignore patterns (glob) */
|
|
242
|
-
ignore?: string[];
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Complete options for the FlightPack bundler adapter
|
|
246
|
-
* Exposes ALL native Rust capabilities
|
|
22
|
+
* Options for the FlightPack bundler adapter
|
|
247
23
|
*/
|
|
248
24
|
interface FlightPackAdapterOptions {
|
|
249
25
|
/**
|
|
@@ -253,124 +29,216 @@ interface FlightPackAdapterOptions {
|
|
|
253
29
|
minify?: boolean;
|
|
254
30
|
/**
|
|
255
31
|
* Generate source maps
|
|
256
|
-
* Uses native VLQ concatenation for multi-module maps
|
|
257
32
|
* @default true
|
|
258
33
|
*/
|
|
259
34
|
sourcemap?: boolean | 'inline' | 'hidden';
|
|
260
35
|
/**
|
|
261
|
-
* Target environment
|
|
262
|
-
* @default '
|
|
36
|
+
* Target environment
|
|
37
|
+
* @default 'es2024'
|
|
263
38
|
*/
|
|
264
|
-
target?:
|
|
39
|
+
target?: TargetEnvironment;
|
|
265
40
|
/**
|
|
266
|
-
* Enable
|
|
267
|
-
* Generates client/server manifests for 'use client'/'use server' directives
|
|
41
|
+
* Enable tree shaking
|
|
268
42
|
* @default true
|
|
269
43
|
*/
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Enable tree shaking with InnerGraph (statement-level DCE)
|
|
273
|
-
* More aggressive than module-level tree shaking
|
|
274
|
-
* @default true
|
|
275
|
-
*/
|
|
276
|
-
treeshake?: boolean | TreeShakeConfig;
|
|
277
|
-
/**
|
|
278
|
-
* Enable code splitting
|
|
279
|
-
* Uses ChunkSplitter for optimal chunking
|
|
280
|
-
* @default true
|
|
281
|
-
*/
|
|
282
|
-
splitting?: boolean | SplittingConfig;
|
|
44
|
+
treeshake?: boolean;
|
|
283
45
|
/**
|
|
284
46
|
* Maximum chunk size in KB before warning
|
|
285
47
|
* @default 500
|
|
286
48
|
*/
|
|
287
49
|
chunkSizeLimit?: number;
|
|
288
50
|
/**
|
|
289
|
-
* Enable
|
|
290
|
-
* Uses TurboCache (function-level memoization) + ArtifactStore
|
|
51
|
+
* Enable React Server Components support
|
|
291
52
|
* @default true
|
|
292
53
|
*/
|
|
293
|
-
|
|
54
|
+
rsc?: boolean;
|
|
294
55
|
/**
|
|
295
|
-
*
|
|
296
|
-
* @default
|
|
56
|
+
* Enable Hot Module Replacement in dev mode
|
|
57
|
+
* @default true
|
|
297
58
|
*/
|
|
298
|
-
|
|
59
|
+
hmr?: boolean;
|
|
299
60
|
/**
|
|
300
|
-
*
|
|
301
|
-
* @default 'browser' for client, 'node' for server
|
|
61
|
+
* CSS configuration
|
|
302
62
|
*/
|
|
303
|
-
|
|
63
|
+
css?: CSSOptions;
|
|
304
64
|
/**
|
|
305
|
-
*
|
|
306
|
-
* Following Turbopack's unified graph approach
|
|
65
|
+
* Resolve aliases (similar to webpack resolve.alias)
|
|
307
66
|
*/
|
|
308
|
-
|
|
309
|
-
client?: EnvironmentConfig;
|
|
310
|
-
server?: EnvironmentConfig;
|
|
311
|
-
edge?: EnvironmentConfig;
|
|
312
|
-
};
|
|
67
|
+
resolveAlias?: Record<string, string>;
|
|
313
68
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
69
|
+
* File extensions to resolve
|
|
70
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
316
71
|
*/
|
|
317
|
-
|
|
72
|
+
resolveExtensions?: string[];
|
|
318
73
|
/**
|
|
319
|
-
*
|
|
74
|
+
* External packages (not bundled)
|
|
320
75
|
*/
|
|
321
|
-
|
|
76
|
+
external?: string[];
|
|
322
77
|
/**
|
|
323
|
-
*
|
|
324
|
-
* Rspack-compatible micro-frontend support
|
|
78
|
+
* Define global constants (replaced at compile time)
|
|
325
79
|
*/
|
|
326
|
-
|
|
80
|
+
define?: Record<string, string>;
|
|
327
81
|
/**
|
|
328
|
-
*
|
|
329
|
-
*
|
|
82
|
+
* Auto-register adapter on import
|
|
83
|
+
* @default true
|
|
330
84
|
*/
|
|
331
|
-
|
|
85
|
+
autoRegister?: boolean;
|
|
332
86
|
/**
|
|
333
|
-
*
|
|
334
|
-
*
|
|
87
|
+
* Enable code splitting for dynamic imports
|
|
88
|
+
* @default true
|
|
335
89
|
*/
|
|
336
|
-
|
|
90
|
+
splitting?: boolean;
|
|
337
91
|
/**
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
* @default
|
|
92
|
+
* Platform target for the build
|
|
93
|
+
* Determines module resolution, externals behavior, and runtime features
|
|
94
|
+
* @default 'browser'
|
|
341
95
|
*/
|
|
342
|
-
|
|
96
|
+
platform?: Platform;
|
|
343
97
|
/**
|
|
344
|
-
*
|
|
98
|
+
* Output format
|
|
99
|
+
* @default 'esm'
|
|
345
100
|
*/
|
|
346
|
-
|
|
101
|
+
format?: OutputFormat;
|
|
347
102
|
/**
|
|
348
|
-
*
|
|
103
|
+
* Force bundle packages (override external/auto-external)
|
|
104
|
+
* Takes precedence over external
|
|
349
105
|
*/
|
|
350
|
-
|
|
106
|
+
noExternal?: string[];
|
|
351
107
|
/**
|
|
352
|
-
*
|
|
353
|
-
* @default
|
|
108
|
+
* Enable Server Actions support
|
|
109
|
+
* @default true
|
|
354
110
|
*/
|
|
355
|
-
|
|
111
|
+
serverActions?: boolean;
|
|
356
112
|
/**
|
|
357
113
|
* Resolve conditions for package.json exports
|
|
114
|
+
* Auto-set based on platform if not specified
|
|
358
115
|
*/
|
|
359
116
|
conditions?: string[];
|
|
360
117
|
/**
|
|
361
|
-
*
|
|
118
|
+
* Node.js target version (for Node platform)
|
|
119
|
+
* e.g., "node20", "node22"
|
|
362
120
|
*/
|
|
363
|
-
|
|
121
|
+
nodeTarget?: string;
|
|
364
122
|
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
123
|
+
* Multi-environment build configuration
|
|
124
|
+
* When set, builds for multiple platforms simultaneously
|
|
367
125
|
*/
|
|
368
|
-
|
|
126
|
+
environments?: EnvironmentsConfig;
|
|
369
127
|
/**
|
|
370
|
-
* Additional options passed directly to FlightPack
|
|
128
|
+
* Additional options passed directly to FlightPack
|
|
371
129
|
*/
|
|
372
130
|
[key: string]: unknown;
|
|
373
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Environment-specific build options
|
|
134
|
+
*/
|
|
135
|
+
interface EnvironmentOptions {
|
|
136
|
+
/** Platform target */
|
|
137
|
+
platform?: Platform;
|
|
138
|
+
/** Node.js target version (e.g., "node22") */
|
|
139
|
+
nodeTarget?: string;
|
|
140
|
+
/** Resolve conditions */
|
|
141
|
+
conditions?: string[];
|
|
142
|
+
/** External packages */
|
|
143
|
+
external?: string[];
|
|
144
|
+
/** Force bundle packages */
|
|
145
|
+
noExternal?: string[];
|
|
146
|
+
/** Output directory for this environment */
|
|
147
|
+
outDir?: string;
|
|
148
|
+
/** Entry points for this environment */
|
|
149
|
+
entry?: string[];
|
|
150
|
+
/** Enable minification */
|
|
151
|
+
minify?: boolean;
|
|
152
|
+
/** Generate source maps */
|
|
153
|
+
sourcemap?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Multi-environment configuration
|
|
157
|
+
* Based on Vite 7+ Environment API
|
|
158
|
+
*/
|
|
159
|
+
interface EnvironmentsConfig {
|
|
160
|
+
/** Client (browser) environment - always present */
|
|
161
|
+
client: EnvironmentOptions;
|
|
162
|
+
/** SSR (Node.js server) environment - optional */
|
|
163
|
+
ssr?: EnvironmentOptions;
|
|
164
|
+
/** Edge environment (Cloudflare Workers, etc.) - optional */
|
|
165
|
+
edge?: EnvironmentOptions;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Multi-environment build result
|
|
169
|
+
*/
|
|
170
|
+
interface MultiEnvironmentBuildResult {
|
|
171
|
+
/** Client build result */
|
|
172
|
+
client: FlightPackBuildResult;
|
|
173
|
+
/** SSR build result (if configured) */
|
|
174
|
+
ssr?: FlightPackBuildResult;
|
|
175
|
+
/** Edge build result (if configured) */
|
|
176
|
+
edge?: FlightPackBuildResult;
|
|
177
|
+
/** Total duration in milliseconds */
|
|
178
|
+
totalDurationMs: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Fallback behavior for dynamic routes
|
|
182
|
+
*/
|
|
183
|
+
type SSGFallback = 'false' | 'true' | 'blocking';
|
|
184
|
+
/**
|
|
185
|
+
* SSG page configuration
|
|
186
|
+
*/
|
|
187
|
+
interface SSGPageConfig {
|
|
188
|
+
/** Route path pattern (e.g., "/blog/[slug]") */
|
|
189
|
+
path: string;
|
|
190
|
+
/** Static params for dynamic routes */
|
|
191
|
+
params?: Record<string, string>[];
|
|
192
|
+
/** Fallback behavior for paths not generated at build time */
|
|
193
|
+
fallback?: SSGFallback;
|
|
194
|
+
/** Revalidation time in seconds (ISR) */
|
|
195
|
+
revalidate?: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* SSG generation options
|
|
199
|
+
*/
|
|
200
|
+
interface SSGOptions {
|
|
201
|
+
/** Pages to pre-render */
|
|
202
|
+
pages: SSGPageConfig[];
|
|
203
|
+
/** Output directory */
|
|
204
|
+
outDir?: string;
|
|
205
|
+
/** SSR bundle path (for rendering) */
|
|
206
|
+
ssrBundle?: string;
|
|
207
|
+
/** Default revalidation time in seconds */
|
|
208
|
+
defaultRevalidate?: number;
|
|
209
|
+
/** Maximum concurrent page generations */
|
|
210
|
+
concurrency?: number;
|
|
211
|
+
/** Generate trailing slashes in URLs */
|
|
212
|
+
trailingSlash?: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Generated page information
|
|
216
|
+
*/
|
|
217
|
+
interface SSGGeneratedPage {
|
|
218
|
+
/** Route path */
|
|
219
|
+
path: string;
|
|
220
|
+
/** Output file path */
|
|
221
|
+
filePath: string;
|
|
222
|
+
/** Revalidation time (for ISR) */
|
|
223
|
+
revalidate?: number;
|
|
224
|
+
/** Page size in bytes */
|
|
225
|
+
size: number;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* SSG generation result
|
|
229
|
+
*/
|
|
230
|
+
interface SSGResult {
|
|
231
|
+
/** All generated pages */
|
|
232
|
+
pages: SSGGeneratedPage[];
|
|
233
|
+
/** Total duration in milliseconds */
|
|
234
|
+
durationMs: number;
|
|
235
|
+
/** Total size of all pages */
|
|
236
|
+
totalSize: number;
|
|
237
|
+
/** Pages that require ISR */
|
|
238
|
+
isrPages: string[];
|
|
239
|
+
/** Errors encountered */
|
|
240
|
+
errors: string[];
|
|
241
|
+
}
|
|
374
242
|
/**
|
|
375
243
|
* Options for the FlightPack dev server
|
|
376
244
|
*/
|
|
@@ -406,14 +274,6 @@ interface FlightPackDevServerOptions {
|
|
|
406
274
|
changeOrigin?: boolean;
|
|
407
275
|
rewrite?: (path: string) => string;
|
|
408
276
|
}>;
|
|
409
|
-
/**
|
|
410
|
-
* HMR configuration
|
|
411
|
-
*/
|
|
412
|
-
hmr?: boolean | HmrConfig;
|
|
413
|
-
/**
|
|
414
|
-
* Cache configuration for dev builds
|
|
415
|
-
*/
|
|
416
|
-
cache?: boolean | CacheConfig;
|
|
417
277
|
}
|
|
418
278
|
/**
|
|
419
279
|
* Result from FlightPack native build
|
|
@@ -427,27 +287,6 @@ interface FlightPackBuildResult {
|
|
|
427
287
|
totalSize: number;
|
|
428
288
|
/** Information about each generated chunk */
|
|
429
289
|
chunks: FlightPackChunkInfo[];
|
|
430
|
-
/** Cache statistics (if caching enabled) */
|
|
431
|
-
cacheStats?: CacheStats;
|
|
432
|
-
/** Tree shaking statistics */
|
|
433
|
-
treeShakeStats?: {
|
|
434
|
-
modulesAnalyzed: number;
|
|
435
|
-
deadModulesRemoved: number;
|
|
436
|
-
unusedExportsRemoved: number;
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Multi-environment build result
|
|
441
|
-
*/
|
|
442
|
-
interface MultiEnvironmentBuildResult {
|
|
443
|
-
/** Client build result */
|
|
444
|
-
client: FlightPackBuildResult;
|
|
445
|
-
/** Server/SSR build result */
|
|
446
|
-
server?: FlightPackBuildResult;
|
|
447
|
-
/** Edge build result */
|
|
448
|
-
edge?: FlightPackBuildResult;
|
|
449
|
-
/** Total duration in milliseconds */
|
|
450
|
-
totalDurationMs: number;
|
|
451
290
|
}
|
|
452
291
|
/**
|
|
453
292
|
* Information about a generated chunk
|
|
@@ -459,10 +298,6 @@ interface FlightPackChunkInfo {
|
|
|
459
298
|
chunkType: 'entry' | 'chunk' | 'asset';
|
|
460
299
|
/** Size in bytes */
|
|
461
300
|
size: number;
|
|
462
|
-
/** Modules included in this chunk */
|
|
463
|
-
modules?: string[];
|
|
464
|
-
/** Whether this chunk was loaded from cache */
|
|
465
|
-
fromCache?: boolean;
|
|
466
301
|
}
|
|
467
302
|
/**
|
|
468
303
|
* Result from single file transformation
|
|
@@ -474,10 +309,6 @@ interface FlightPackTransformResult {
|
|
|
474
309
|
map: string | null;
|
|
475
310
|
/** Whether transformation succeeded */
|
|
476
311
|
success: boolean;
|
|
477
|
-
/** Dependencies detected */
|
|
478
|
-
dependencies?: string[];
|
|
479
|
-
/** Exports detected */
|
|
480
|
-
exports?: string[];
|
|
481
312
|
}
|
|
482
313
|
/**
|
|
483
314
|
* Options for single file transformation
|
|
@@ -493,79 +324,6 @@ interface FlightPackTransformOptions {
|
|
|
493
324
|
jsxFactory?: string;
|
|
494
325
|
/** JSX fragment function */
|
|
495
326
|
jsxFragment?: string;
|
|
496
|
-
/** Automatic JSX runtime */
|
|
497
|
-
jsxRuntime?: 'classic' | 'automatic';
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Native options passed to FlightPack Rust core
|
|
501
|
-
* Maps to Rust FlightPackOptions struct
|
|
502
|
-
*/
|
|
503
|
-
interface FlightPackNativeOptions {
|
|
504
|
-
/** Entry points */
|
|
505
|
-
entry: string[];
|
|
506
|
-
/** Output directory */
|
|
507
|
-
outDir: string;
|
|
508
|
-
/** Root directory */
|
|
509
|
-
root?: string;
|
|
510
|
-
/** Enable minification */
|
|
511
|
-
minify?: boolean;
|
|
512
|
-
/** Generate source maps */
|
|
513
|
-
sourcemap?: boolean;
|
|
514
|
-
/** Enable RSC support */
|
|
515
|
-
rsc?: boolean;
|
|
516
|
-
/** Enable tree shaking */
|
|
517
|
-
treeshake?: boolean;
|
|
518
|
-
/** Enable code splitting */
|
|
519
|
-
splitting?: boolean;
|
|
520
|
-
/** Platform target */
|
|
521
|
-
platform?: Platform;
|
|
522
|
-
/** Enable caching */
|
|
523
|
-
cache?: boolean;
|
|
524
|
-
/** Cache directory */
|
|
525
|
-
cacheDir?: string;
|
|
526
|
-
/** External packages */
|
|
527
|
-
external?: string[];
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Native CSS transform options
|
|
531
|
-
*/
|
|
532
|
-
interface NativeCssTransformOptions {
|
|
533
|
-
minify?: boolean;
|
|
534
|
-
cssModules?: boolean;
|
|
535
|
-
cssModulesPattern?: string;
|
|
536
|
-
dashedIdents?: boolean;
|
|
537
|
-
sourcemap?: boolean;
|
|
538
|
-
browserTargets?: CssBrowserTargets;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Native dev server options
|
|
542
|
-
*/
|
|
543
|
-
interface NativeDevServerOptions {
|
|
544
|
-
port?: number;
|
|
545
|
-
publicDir?: string;
|
|
546
|
-
outDir?: string;
|
|
547
|
-
hmr?: boolean;
|
|
548
|
-
root?: string;
|
|
549
|
-
cache?: boolean;
|
|
550
|
-
cacheDir?: string;
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Native watcher options
|
|
554
|
-
*/
|
|
555
|
-
interface NativeWatcherOptions {
|
|
556
|
-
paths: string[];
|
|
557
|
-
extensions?: string[];
|
|
558
|
-
debounceMs?: number;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Native HMR update
|
|
562
|
-
*/
|
|
563
|
-
interface NativeHMRModuleUpdate {
|
|
564
|
-
id: string;
|
|
565
|
-
path: string;
|
|
566
|
-
code: string;
|
|
567
|
-
deps?: string[];
|
|
568
|
-
accept: boolean;
|
|
569
327
|
}
|
|
570
328
|
|
|
571
329
|
/**
|
|
@@ -617,6 +375,105 @@ declare function flightpack(options?: FlightPackAdapterOptions): BundlerAdapter;
|
|
|
617
375
|
/**
|
|
618
376
|
* Package version
|
|
619
377
|
*/
|
|
620
|
-
declare const VERSION = "0.1
|
|
378
|
+
declare const VERSION = "0.0.1";
|
|
379
|
+
/**
|
|
380
|
+
* FlightPack utility functions for advanced usage
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* import { utils } from '@flight-framework/bundler-flightpack';
|
|
385
|
+
*
|
|
386
|
+
* utils.isNodeBuiltin('fs'); // true
|
|
387
|
+
* utils.isEdgeCompatible('fs'); // false
|
|
388
|
+
* utils.isBareImport('react'); // true
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
declare const utils: {
|
|
392
|
+
/**
|
|
393
|
+
* Check if a module is a Node.js builtin
|
|
394
|
+
* Handles both 'fs' and 'node:fs' formats
|
|
395
|
+
*/
|
|
396
|
+
isNodeBuiltin(moduleId: string): Promise<boolean>;
|
|
397
|
+
/**
|
|
398
|
+
* Get list of all Node.js builtin modules
|
|
399
|
+
*/
|
|
400
|
+
getNodeBuiltins(): Promise<string[]>;
|
|
401
|
+
/**
|
|
402
|
+
* Get list of all Node.js builtins with node: prefix
|
|
403
|
+
*/
|
|
404
|
+
getNodeBuiltinsPrefixed(): Promise<string[]>;
|
|
405
|
+
/**
|
|
406
|
+
* Check if a module is a bare import (from node_modules)
|
|
407
|
+
* Returns false for relative/absolute paths
|
|
408
|
+
*/
|
|
409
|
+
isBareImport(moduleId: string): Promise<boolean>;
|
|
410
|
+
/**
|
|
411
|
+
* Check if a module is compatible with Edge runtimes
|
|
412
|
+
* Returns false for modules like 'fs', 'child_process', etc.
|
|
413
|
+
*/
|
|
414
|
+
isEdgeCompatible(moduleId: string): Promise<boolean>;
|
|
415
|
+
/**
|
|
416
|
+
* Get list of Edge-incompatible modules
|
|
417
|
+
*/
|
|
418
|
+
getEdgeIncompatibleModules(): Promise<string[]>;
|
|
419
|
+
/**
|
|
420
|
+
* Get default resolve conditions for a platform
|
|
421
|
+
*/
|
|
422
|
+
getPlatformConditions(platform: "browser" | "node" | "edge" | "neutral"): Promise<string[]>;
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Generate static pages (SSG/ISR)
|
|
427
|
+
*
|
|
428
|
+
* Pre-renders pages at build time with optional Incremental Static Regeneration.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```typescript
|
|
432
|
+
* import { generateSSG } from '@flight-framework/bundler-flightpack';
|
|
433
|
+
*
|
|
434
|
+
* const result = await generateSSG({
|
|
435
|
+
* pages: [
|
|
436
|
+
* { path: '/' },
|
|
437
|
+
* { path: '/about' },
|
|
438
|
+
* { path: '/blog/[slug]', params: [{ slug: 'hello' }, { slug: 'world' }] },
|
|
439
|
+
* ],
|
|
440
|
+
* outDir: './dist',
|
|
441
|
+
* ssrBundle: './dist/server/entry-server.js',
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
declare function generateSSG(options: SSGOptions): Promise<SSGResult>;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Build for multiple environments simultaneously
|
|
449
|
+
*
|
|
450
|
+
* Builds client, SSR, and edge bundles in parallel for maximum performance.
|
|
451
|
+
* Follows Vite 7+ Environment API patterns.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* import { buildMultiEnvironment } from '@flight-framework/bundler-flightpack';
|
|
456
|
+
*
|
|
457
|
+
* const result = await buildMultiEnvironment({
|
|
458
|
+
* entry: ['src/index.tsx'],
|
|
459
|
+
* outDir: './dist',
|
|
460
|
+
* }, {
|
|
461
|
+
* client: { platform: 'browser', outDir: './dist/client' },
|
|
462
|
+
* ssr: { platform: 'node', outDir: './dist/server', external: ['express'] },
|
|
463
|
+
* edge: { platform: 'edge', outDir: './dist/edge' },
|
|
464
|
+
* });
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
declare function buildMultiEnvironment(baseOptions: {
|
|
468
|
+
entry: string[];
|
|
469
|
+
outDir: string;
|
|
470
|
+
root?: string;
|
|
471
|
+
minify?: boolean;
|
|
472
|
+
sourcemap?: boolean;
|
|
473
|
+
rsc?: boolean;
|
|
474
|
+
treeshake?: boolean;
|
|
475
|
+
target?: string;
|
|
476
|
+
define?: Record<string, string>;
|
|
477
|
+
}, environments: EnvironmentsConfig): Promise<MultiEnvironmentBuildResult>;
|
|
621
478
|
|
|
622
|
-
export { type
|
|
479
|
+
export { type EnvironmentOptions, type EnvironmentsConfig, type FlightPackAdapterOptions, type FlightPackBuildResult, type FlightPackChunkInfo, type FlightPackDevServerOptions, type FlightPackTransformOptions, type FlightPackTransformResult, type MultiEnvironmentBuildResult, type OutputFormat, type Platform, type SSGFallback, type SSGGeneratedPage, type SSGOptions, type SSGPageConfig, type SSGResult, type TargetEnvironment, VERSION, buildMultiEnvironment, flightpack as createFlightPackAdapter, flightpack as default, flightpack, generateSSG, utils };
|