@flight-framework/bundler-flightpack 0.1.3 → 0.1.4

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/index.d.ts CHANGED
@@ -3,11 +3,247 @@ import { CSSOptions, BundlerAdapter } from '@flight-framework/bundler';
3
3
  /**
4
4
  * @flight-framework/bundler-flightpack - Types
5
5
  *
6
- * Type definitions for the FlightPack bundler adapter.
6
+ * Comprehensive type definitions for the FlightPack bundler adapter.
7
+ * Exposes ALL native Rust capabilities via TypeScript interfaces.
8
+ *
9
+ * @packageDocumentation
7
10
  */
8
11
 
9
12
  /**
10
- * Options for the FlightPack bundler adapter
13
+ * Build platform target
14
+ * Determines externals handling and resolve conditions
15
+ */
16
+ type Platform = 'browser' | 'node' | 'edge' | 'neutral';
17
+ /**
18
+ * Environment-specific build configuration
19
+ * Follows Turbopack's unified graph approach
20
+ */
21
+ interface EnvironmentConfig {
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
+ }
41
+ /**
42
+ * Cache configuration for incremental builds
43
+ * Mirrors Turbopack's filesystem cache functionality
44
+ */
45
+ interface CacheConfig {
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
+ }
158
+ /**
159
+ * Static page configuration for SSG
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
11
247
  */
12
248
  interface FlightPackAdapterOptions {
13
249
  /**
@@ -17,38 +253,97 @@ interface FlightPackAdapterOptions {
17
253
  minify?: boolean;
18
254
  /**
19
255
  * Generate source maps
256
+ * Uses native VLQ concatenation for multi-module maps
20
257
  * @default true
21
258
  */
22
259
  sourcemap?: boolean | 'inline' | 'hidden';
23
260
  /**
24
- * Target environment
261
+ * Target environment for transpilation
25
262
  * @default 'es2022'
26
263
  */
27
- target?: 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'esnext';
264
+ target?: 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'esnext';
28
265
  /**
29
- * Enable tree shaking
266
+ * Enable React Server Components support
267
+ * Generates client/server manifests for 'use client'/'use server' directives
30
268
  * @default true
31
269
  */
32
- treeshake?: boolean;
270
+ rsc?: boolean;
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;
33
283
  /**
34
284
  * Maximum chunk size in KB before warning
35
285
  * @default 500
36
286
  */
37
287
  chunkSizeLimit?: number;
38
288
  /**
39
- * Enable React Server Components support
289
+ * Enable build caching for incremental builds
290
+ * Uses TurboCache (function-level memoization) + ArtifactStore
40
291
  * @default true
41
292
  */
42
- rsc?: boolean;
293
+ cache?: boolean | CacheConfig;
294
+ /**
295
+ * Cache directory for persistent builds
296
+ * @default '.flightpack_cache'
297
+ */
298
+ cacheDir?: string;
299
+ /**
300
+ * Primary build platform
301
+ * @default 'browser' for client, 'node' for server
302
+ */
303
+ platform?: Platform;
304
+ /**
305
+ * Multi-environment build configuration
306
+ * Following Turbopack's unified graph approach
307
+ */
308
+ environments?: {
309
+ client?: EnvironmentConfig;
310
+ server?: EnvironmentConfig;
311
+ edge?: EnvironmentConfig;
312
+ };
313
+ /**
314
+ * External packages (not bundled)
315
+ * Automatically includes Node.js builtins for server builds
316
+ */
317
+ external?: string[];
318
+ /**
319
+ * Force bundle packages (override auto-external)
320
+ */
321
+ noExternal?: string[];
322
+ /**
323
+ * Module Federation configuration
324
+ * Rspack-compatible micro-frontend support
325
+ */
326
+ federation?: FederationConfig;
327
+ /**
328
+ * Static Site Generation configuration
329
+ * With ISR (Incremental Static Regeneration) support
330
+ */
331
+ ssg?: SSGConfig;
332
+ /**
333
+ * CSS processing configuration
334
+ * Uses Lightning CSS for high-performance transforms
335
+ */
336
+ css?: CSSOptions | CssTransformConfig;
43
337
  /**
44
338
  * Enable Hot Module Replacement in dev mode
339
+ * Uses native Axum WebSocket server
45
340
  * @default true
46
341
  */
47
- hmr?: boolean;
342
+ hmr?: boolean | HmrConfig;
48
343
  /**
49
- * CSS configuration
344
+ * File watcher configuration
50
345
  */
51
- css?: CSSOptions;
346
+ watcher?: WatcherConfig;
52
347
  /**
53
348
  * Resolve aliases (similar to webpack resolve.alias)
54
349
  */
@@ -59,9 +354,9 @@ interface FlightPackAdapterOptions {
59
354
  */
60
355
  resolveExtensions?: string[];
61
356
  /**
62
- * External packages (not bundled)
357
+ * Resolve conditions for package.json exports
63
358
  */
64
- external?: string[];
359
+ conditions?: string[];
65
360
  /**
66
361
  * Define global constants (replaced at compile time)
67
362
  */
@@ -72,7 +367,7 @@ interface FlightPackAdapterOptions {
72
367
  */
73
368
  autoRegister?: boolean;
74
369
  /**
75
- * Additional options passed directly to FlightPack
370
+ * Additional options passed directly to FlightPack native
76
371
  */
77
372
  [key: string]: unknown;
78
373
  }
@@ -111,6 +406,14 @@ interface FlightPackDevServerOptions {
111
406
  changeOrigin?: boolean;
112
407
  rewrite?: (path: string) => string;
113
408
  }>;
409
+ /**
410
+ * HMR configuration
411
+ */
412
+ hmr?: boolean | HmrConfig;
413
+ /**
414
+ * Cache configuration for dev builds
415
+ */
416
+ cache?: boolean | CacheConfig;
114
417
  }
115
418
  /**
116
419
  * Result from FlightPack native build
@@ -124,6 +427,27 @@ interface FlightPackBuildResult {
124
427
  totalSize: number;
125
428
  /** Information about each generated chunk */
126
429
  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;
127
451
  }
128
452
  /**
129
453
  * Information about a generated chunk
@@ -135,6 +459,10 @@ interface FlightPackChunkInfo {
135
459
  chunkType: 'entry' | 'chunk' | 'asset';
136
460
  /** Size in bytes */
137
461
  size: number;
462
+ /** Modules included in this chunk */
463
+ modules?: string[];
464
+ /** Whether this chunk was loaded from cache */
465
+ fromCache?: boolean;
138
466
  }
139
467
  /**
140
468
  * Result from single file transformation
@@ -146,6 +474,10 @@ interface FlightPackTransformResult {
146
474
  map: string | null;
147
475
  /** Whether transformation succeeded */
148
476
  success: boolean;
477
+ /** Dependencies detected */
478
+ dependencies?: string[];
479
+ /** Exports detected */
480
+ exports?: string[];
149
481
  }
150
482
  /**
151
483
  * Options for single file transformation
@@ -161,6 +493,79 @@ interface FlightPackTransformOptions {
161
493
  jsxFactory?: string;
162
494
  /** JSX fragment function */
163
495
  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;
164
569
  }
165
570
 
166
571
  /**
@@ -212,6 +617,6 @@ declare function flightpack(options?: FlightPackAdapterOptions): BundlerAdapter;
212
617
  /**
213
618
  * Package version
214
619
  */
215
- declare const VERSION = "0.0.1";
620
+ declare const VERSION = "0.1.4";
216
621
 
217
- export { type FlightPackAdapterOptions, type FlightPackBuildResult, type FlightPackChunkInfo, type FlightPackDevServerOptions, type FlightPackTransformOptions, type FlightPackTransformResult, VERSION, flightpack as createFlightPackAdapter, flightpack as default, flightpack };
622
+ export { type CacheConfig, type CacheStats, type CssBrowserTargets, type CssTransformConfig, type EnvironmentConfig, type ExposeConfig, type FederationConfig, type FlightPackAdapterOptions, type FlightPackBuildResult, type FlightPackChunkInfo, type FlightPackDevServerOptions, type FlightPackNativeOptions, type FlightPackTransformOptions, type FlightPackTransformResult, type HmrConfig, type MultiEnvironmentBuildResult, type NativeCssTransformOptions, type NativeDevServerOptions, type NativeHMRModuleUpdate, type NativeWatcherOptions, type Platform, type RemoteConfig, type SSGConfig, type SSGPageConfig, type SharedConfig, type SplittingConfig, type TreeShakeConfig, VERSION, type WatcherConfig, flightpack as createFlightPackAdapter, flightpack as default, flightpack };