@flight-framework/bundler-flightpack 0.1.3 → 0.1.5

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\r\n * @flight-framework/bundler-flightpack\r\n * \r\n * FlightPack native Rust bundler adapter for Flight Framework.\r\n * Wraps the native Rust bundler for maximum performance.\r\n * \r\n * @example\r\n * ```typescript\r\n * // In flight.config.ts\r\n * import { defineConfig } from '@flight-framework/core';\r\n * import { flightpack } from '@flight-framework/bundler-flightpack';\r\n * \r\n * export default defineConfig({\r\n * bundler: flightpack(),\r\n * });\r\n * ```\r\n * \r\n * @packageDocumentation\r\n */\r\n\r\nimport type {\r\n BundlerAdapter,\r\n DevServer,\r\n BuildResult,\r\n PreviewServer,\r\n OutputFile,\r\n TransformOptions,\r\n TransformResult as BundlerTransformResult,\r\n} from '@flight-framework/bundler';\r\nimport {\r\n registerAdapter,\r\n setDefaultAdapter,\r\n createTimer,\r\n createBuildError,\r\n logDevServerStarted,\r\n logBuildSuccess,\r\n logBuildError,\r\n resolvePath,\r\n cleanDirectory,\r\n} from '@flight-framework/bundler';\r\nimport type { FlightConfig } from '@flight-framework/core/config';\r\nimport type {\r\n FlightPackAdapterOptions,\r\n} from './types.js';\r\n\r\n// Re-export types\r\nexport * from './types.js';\r\n\r\n// ============================================================================\r\n// Constants\r\n// ============================================================================\r\n\r\nconst ADAPTER_NAME = 'flight-flightpack';\r\nconst BUNDLER_NAME = 'flightpack';\r\n\r\n// ============================================================================\r\n// Native Binding Loader\r\n// ============================================================================\r\n\r\n/**\r\n * Native binding interface matching the NAPI exports\r\n */\r\ninterface NativeBinding {\r\n FlightPack: new (options?: FlightPackNativeOptions | undefined | null) => {\r\n build(): Promise<NativeBuildResult>;\r\n };\r\n build: (options: FlightPackNativeOptions) => Promise<NativeBuildResult>;\r\n transform: (code: string, filename: string, options?: NativeTransformOptions | undefined | null) => Promise<NativeTransformResult>;\r\n version: () => string;\r\n // Dev Server\r\n startDevServer: (options?: NativeDevServerOptions | undefined | null) => Promise<NativeDevServerResult>;\r\n stopDevServer: () => Promise<boolean>;\r\n isDevServerRunning: () => boolean;\r\n // HMR\r\n sendHmrUpdate: (modules: NativeHMRModuleUpdate[]) => boolean;\r\n sendHmrError: (message: string) => boolean;\r\n // File Watcher\r\n watchFiles: (options: NativeWatcherOptions, callback: (event: NativeWatchEvent) => void) => NativeWatchHandle;\r\n // CSS Processing\r\n transformCss: (code: string, filename: string, options?: NativeCssTransformOptions | undefined | null) => NativeCssTransformResult;\r\n minifyCss: (code: string, filename: string) => string;\r\n transformCssModule: (code: string, filename: string) => NativeCssModuleResult;\r\n}\r\n\r\n/**\r\n * Native CSS transform options\r\n */\r\ninterface NativeCssTransformOptions {\r\n minify?: boolean;\r\n cssModules?: boolean;\r\n cssModulesPattern?: string;\r\n dashedIdents?: boolean;\r\n sourcemap?: boolean;\r\n browserTargets?: {\r\n chrome?: number;\r\n firefox?: number;\r\n safari?: number;\r\n edge?: number;\r\n };\r\n}\r\n\r\n/**\r\n * Native CSS transform result\r\n */\r\ninterface NativeCssTransformResult {\r\n code: string;\r\n map?: string | null;\r\n exports: Array<{\r\n original: string;\r\n hashed: string;\r\n isReferenced: boolean;\r\n composes: string[];\r\n }>;\r\n success: boolean;\r\n}\r\n\r\n/**\r\n * Native CSS module result\r\n */\r\ninterface NativeCssModuleResult {\r\n code: string;\r\n classMap: Array<{\r\n original: string;\r\n hashed: string;\r\n }>;\r\n}\r\n\r\n/**\r\n * Platform type\r\n */\r\ntype NativePlatform = 'browser' | 'node' | 'edge' | 'neutral';\r\n\r\n/**\r\n * Extended NativeBinding interface with universal support\r\n */\r\ninterface NativeBindingExtended extends NativeBinding {\r\n // Externals Detection\r\n isNodeBuiltin: (moduleId: string) => boolean;\r\n getNodeBuiltins: () => string[];\r\n getNodeBuiltinsPrefixed: () => string[];\r\n isBareImport: (moduleId: string) => boolean;\r\n isEdgeCompatible: (moduleId: string) => boolean;\r\n getEdgeIncompatibleModules: () => string[];\r\n getPlatformConditions: (platform: string) => string[];\r\n}\r\n\r\n\r\n/**\r\n * Native dev server options\r\n */\r\ninterface NativeDevServerOptions {\r\n port?: number;\r\n publicDir?: string;\r\n outDir?: string;\r\n hmr?: boolean;\r\n root?: string;\r\n}\r\n\r\n/**\r\n * Native dev server result\r\n */\r\ninterface NativeDevServerResult {\r\n url: string;\r\n port: number;\r\n hmr: boolean;\r\n}\r\n\r\n/**\r\n * Native HMR module update\r\n */\r\ninterface NativeHMRModuleUpdate {\r\n id: string;\r\n path: string;\r\n code: string;\r\n deps?: string[] | null;\r\n accept: boolean;\r\n}\r\n\r\n/**\r\n * Native watcher options\r\n */\r\ninterface NativeWatcherOptions {\r\n paths: string[];\r\n extensions?: string[] | null;\r\n debounceMs?: number | null;\r\n}\r\n\r\n/**\r\n * Native watch event\r\n */\r\ninterface NativeWatchEvent {\r\n paths: string[];\r\n eventType: string;\r\n}\r\n\r\n/**\r\n * Native watch handle\r\n */\r\ninterface NativeWatchHandle {\r\n stop(): boolean;\r\n}\r\n\r\n/**\r\n * Native options matching Rust struct\r\n */\r\ninterface FlightPackNativeOptions {\r\n entry: string[];\r\n outDir: string;\r\n root?: string;\r\n minify?: boolean;\r\n sourcemap?: boolean;\r\n rsc?: boolean;\r\n}\r\n\r\n/**\r\n * Native build result matching Rust struct\r\n */\r\ninterface NativeBuildResult {\r\n outputDir: string;\r\n durationMs: number;\r\n totalSize: number;\r\n chunks: NativeChunkInfo[];\r\n}\r\n\r\n/**\r\n * Native chunk info matching Rust struct\r\n */\r\ninterface NativeChunkInfo {\r\n fileName: string;\r\n chunkType: string;\r\n size: number;\r\n}\r\n\r\n/**\r\n * Native transform options matching Rust struct\r\n */\r\ninterface NativeTransformOptions {\r\n sourcemap?: boolean;\r\n minify?: boolean;\r\n target?: string;\r\n jsxFactory?: string;\r\n jsxFragment?: string;\r\n}\r\n\r\n/**\r\n * Native transform result matching Rust struct\r\n */\r\ninterface NativeTransformResult {\r\n code: string;\r\n map?: string | null;\r\n success: boolean;\r\n}\r\n\r\n/**\r\n * Lazy-loaded native FlightPack binding\r\n * This defers loading until actually needed, improving startup time\r\n */\r\nlet nativeBinding: NativeBinding | null = null;\r\n\r\nasync function loadNativeBinding(): Promise<NativeBinding> {\r\n if (nativeBinding) return nativeBinding;\r\n\r\n try {\r\n // Use createRequire for ESM compatibility with native modules\r\n // Native .node files require \"require()\" which isn't available in ESM\r\n const { createRequire } = await import('node:module');\r\n const require = createRequire(import.meta.url);\r\n const native = require('@flight-framework/flightpack') as NativeBinding;\r\n nativeBinding = native;\r\n return native;\r\n } catch (error) {\r\n throw new Error(\r\n `Failed to load FlightPack native binding. ` +\r\n `Make sure @flight-framework/flightpack is installed.\\n` +\r\n `Original error: ${error}`\r\n );\r\n }\r\n}\r\n\r\n// ============================================================================\r\n// Adapter Implementation\r\n// ============================================================================\r\n\r\n/**\r\n * Create a FlightPack bundler adapter\r\n * \r\n * FlightPack is a native Rust bundler that provides:\r\n * - 1,874+ files/second processing speed\r\n * - Zero-config TypeScript/TSX support via Oxc\r\n * - React Server Components (RSC) support\r\n * - Tree shaking and code splitting\r\n * - Hot Module Replacement (HMR)\r\n * \r\n * @param options - FlightPack adapter options\r\n * @returns A BundlerAdapter instance\r\n * \r\n * @example\r\n * ```typescript\r\n * import { flightpack } from '@flight-framework/bundler-flightpack';\r\n * \r\n * const adapter = flightpack({\r\n * minify: true,\r\n * sourcemap: true,\r\n * rsc: true,\r\n * });\r\n * ```\r\n */\r\nexport function flightpack(options: FlightPackAdapterOptions = {}): BundlerAdapter {\r\n const adapter: BundlerAdapter = {\r\n name: ADAPTER_NAME,\r\n bundler: BUNDLER_NAME,\r\n options,\r\n\r\n async createDevServer(config: FlightConfig): Promise<DevServer> {\r\n const native = await loadNativeBinding();\r\n\r\n const port = config.dev.port ?? 5173;\r\n const host = config.dev.host ?? 'localhost';\r\n const https = config.dev.https === true;\r\n\r\n // Use native Rust dev server with Axum and WebSocket HMR\r\n const result = await native.startDevServer({\r\n port,\r\n publicDir: resolvePath(config.root, 'public'),\r\n outDir: resolvePath(config.root, config.build.outDir),\r\n hmr: options.hmr ?? true,\r\n root: config.root,\r\n });\r\n\r\n logDevServerStarted(result.url, 'FlightPack');\r\n\r\n // Set up file watcher for HMR updates\r\n let watchHandle: NativeWatchHandle | undefined;\r\n if (result.hmr) {\r\n try {\r\n watchHandle = native.watchFiles(\r\n {\r\n paths: [resolvePath(config.root, 'src')],\r\n extensions: ['ts', 'tsx', 'js', 'jsx', 'css'],\r\n debounceMs: 100,\r\n },\r\n async (event: NativeWatchEvent) => {\r\n // Transform changed files and send HMR updates\r\n const updates: NativeHMRModuleUpdate[] = [];\r\n\r\n for (const filePath of event.paths) {\r\n try {\r\n const { readFile } = await import('node:fs/promises');\r\n const source = await readFile(filePath, 'utf-8');\r\n const transformed = await native.transform(source, filePath);\r\n\r\n if (transformed.success) {\r\n updates.push({\r\n id: filePath,\r\n path: filePath,\r\n code: transformed.code,\r\n accept: true,\r\n deps: null,\r\n });\r\n }\r\n } catch (error) {\r\n native.sendHmrError(`Failed to transform ${filePath}: ${error}`);\r\n }\r\n }\r\n\r\n if (updates.length > 0) {\r\n native.sendHmrUpdate(updates);\r\n }\r\n }\r\n );\r\n } catch (error) {\r\n console.warn('[FlightPack] File watcher failed to start:', error);\r\n }\r\n }\r\n\r\n return {\r\n url: result.url,\r\n port: result.port,\r\n host: host as string,\r\n https,\r\n async close() {\r\n // Stop file watcher\r\n if (watchHandle) {\r\n watchHandle.stop();\r\n }\r\n // Stop native dev server\r\n await native.stopDevServer();\r\n },\r\n restart: undefined,\r\n reload: undefined,\r\n hmrUpdate: undefined,\r\n printUrls() {\r\n console.log(` ⚡ FlightPack Dev Server`);\r\n console.log(` ➜ Local: ${result.url}`);\r\n if (result.hmr) {\r\n console.log(` ➜ HMR: enabled (WebSocket)`);\r\n }\r\n },\r\n };\r\n },\r\n\r\n async build(config: FlightConfig): Promise<BuildResult> {\r\n const native = await loadNativeBinding();\r\n const timer = createTimer();\r\n\r\n try {\r\n // Build FlightPack options from config\r\n const minifyOption = typeof options.minify === 'boolean'\r\n ? options.minify\r\n : typeof config.build.minify === 'boolean'\r\n ? config.build.minify\r\n : true;\r\n\r\n const flightpackOptions: FlightPackNativeOptions = {\r\n entry: await getEntryPoints(config),\r\n outDir: resolvePath(config.root, config.build.outDir),\r\n root: config.root,\r\n minify: minifyOption,\r\n sourcemap: typeof options.sourcemap === 'boolean'\r\n ? options.sourcemap\r\n : typeof config.build.sourcemap === 'boolean'\r\n ? config.build.sourcemap\r\n : true,\r\n rsc: options.rsc ?? true,\r\n };\r\n\r\n // Run the native build\r\n const result = await native.build(flightpackOptions);\r\n\r\n // Convert to BundlerAdapter result format\r\n const files: OutputFile[] = result.chunks.map((chunk: NativeChunkInfo) => ({\r\n path: chunk.fileName,\r\n size: chunk.size,\r\n type: chunk.chunkType as 'entry' | 'chunk' | 'asset',\r\n isDynamicEntry: false,\r\n }));\r\n\r\n const buildResult: BuildResult = {\r\n outDir: result.outputDir,\r\n duration: timer.stop(),\r\n files,\r\n totalSize: result.totalSize,\r\n errors: [],\r\n warnings: [],\r\n success: true,\r\n };\r\n\r\n logBuildSuccess(buildResult);\r\n return buildResult;\r\n\r\n } catch (error) {\r\n const buildResult: BuildResult = {\r\n outDir: resolvePath(config.root, config.build.outDir),\r\n duration: timer.stop(),\r\n files: [],\r\n totalSize: 0,\r\n errors: [createBuildError(error)],\r\n warnings: [],\r\n success: false,\r\n };\r\n\r\n logBuildError(buildResult);\r\n return buildResult;\r\n }\r\n },\r\n\r\n async preview(config: FlightConfig): Promise<PreviewServer> {\r\n const { createServer } = await import('node:http');\r\n const { readFile, stat } = await import('node:fs/promises');\r\n const { join, extname } = await import('node:path');\r\n\r\n const outDir = resolvePath(config.root, config.build.outDir);\r\n const port = 4173;\r\n const host = 'localhost';\r\n const url = `http://${host}:${port}`;\r\n\r\n const mimeTypes: Record<string, string> = {\r\n '.html': 'text/html',\r\n '.js': 'text/javascript',\r\n '.css': 'text/css',\r\n '.json': 'application/json',\r\n };\r\n\r\n const server = createServer(async (req, res) => {\r\n let urlPath = req.url === '/' ? '/index.html' : req.url!;\r\n const filePath = join(outDir, urlPath);\r\n\r\n try {\r\n const content = await readFile(filePath);\r\n const ext = extname(filePath);\r\n res.setHeader('Content-Type', mimeTypes[ext] || 'application/octet-stream');\r\n res.writeHead(200);\r\n res.end(content);\r\n } catch {\r\n // Try with .html extension\r\n try {\r\n const htmlPath = filePath.endsWith('.html') ? filePath : `${filePath}.html`;\r\n const content = await readFile(htmlPath);\r\n res.setHeader('Content-Type', 'text/html');\r\n res.writeHead(200);\r\n res.end(content);\r\n } catch {\r\n res.writeHead(404);\r\n res.end('Not Found');\r\n }\r\n }\r\n });\r\n\r\n server.listen(port, host);\r\n\r\n return {\r\n url,\r\n port,\r\n async close() {\r\n return new Promise((resolve) => {\r\n server.close(() => resolve());\r\n });\r\n },\r\n printUrls() {\r\n console.log(` ➜ Preview: ${url}`);\r\n },\r\n };\r\n },\r\n\r\n async clean(config: FlightConfig): Promise<void> {\r\n const outDir = resolvePath(config.root, config.build.outDir);\r\n await cleanDirectory(outDir);\r\n },\r\n\r\n async version(): Promise<string> {\r\n const native = await loadNativeBinding();\r\n return native.version();\r\n },\r\n\r\n async transform(\r\n code: string,\r\n id: string,\r\n transformOptions?: TransformOptions\r\n ): Promise<BundlerTransformResult> {\r\n const native = await loadNativeBinding();\r\n\r\n // Handle CSS files with native CSS processor\r\n if (id.endsWith('.css')) {\r\n const isCssModule = id.includes('.module.');\r\n\r\n if (isCssModule) {\r\n // CSS Modules: transform and generate class mappings\r\n const result = native.transformCssModule(code, id);\r\n\r\n // Generate JS export for CSS modules\r\n const classMapObject = Object.fromEntries(\r\n result.classMap.map(c => [c.original, c.hashed])\r\n );\r\n\r\n const jsCode = [\r\n `// CSS Module: ${id}`,\r\n `const styles = ${JSON.stringify(classMapObject)};`,\r\n `export default styles;`,\r\n ``,\r\n `// Inject CSS`,\r\n `if (typeof document !== 'undefined') {`,\r\n ` const style = document.createElement('style');`,\r\n ` style.textContent = ${JSON.stringify(result.code)};`,\r\n ` document.head.appendChild(style);`,\r\n `}`,\r\n ].join('\\n');\r\n\r\n return {\r\n code: jsCode,\r\n map: null,\r\n };\r\n } else {\r\n // Regular CSS: just minify and inject\r\n const minified = native.minifyCss(code, id);\r\n\r\n const jsCode = [\r\n `// CSS: ${id}`,\r\n `if (typeof document !== 'undefined') {`,\r\n ` const style = document.createElement('style');`,\r\n ` style.textContent = ${JSON.stringify(minified)};`,\r\n ` document.head.appendChild(style);`,\r\n `}`,\r\n ].join('\\n');\r\n\r\n return {\r\n code: jsCode,\r\n map: null,\r\n };\r\n }\r\n }\r\n\r\n // Handle TypeScript/JavaScript files\r\n const sourcemapOption = typeof transformOptions?.sourcemap === 'boolean'\r\n ? transformOptions.sourcemap\r\n : true;\r\n\r\n const result = await native.transform(code, id, {\r\n sourcemap: sourcemapOption,\r\n target: transformOptions?.target ?? 'es2022',\r\n });\r\n\r\n return {\r\n code: result.code,\r\n map: result.map,\r\n };\r\n },\r\n };\r\n\r\n // Auto-register as default if specified\r\n if (options.autoRegister !== false) {\r\n registerAdapter(adapter);\r\n\r\n // Set as default bundler\r\n setDefaultAdapter(ADAPTER_NAME);\r\n }\r\n\r\n return adapter;\r\n}\r\n\r\n// ============================================================================\r\n// Helper Functions\r\n// ============================================================================\r\n\r\n/**\r\n * Get entry points from Flight configuration\r\n */\r\nasync function getEntryPoints(config: FlightConfig): Promise<string[]> {\r\n const entries: string[] = [];\r\n const { existsSync } = await import('node:fs');\r\n const { join } = await import('node:path');\r\n\r\n // Look for common entry patterns in priority order\r\n const possibleEntries = [\r\n // Standard Flight entries\r\n 'src/entry-client.tsx',\r\n 'src/entry-client.ts',\r\n // Vite-style entries\r\n 'src/main.tsx',\r\n 'src/main.ts',\r\n // App-style entries\r\n 'src/App.tsx',\r\n 'src/App.ts',\r\n 'src/app.tsx',\r\n 'src/app.ts',\r\n // Index-style entries\r\n 'src/index.tsx',\r\n 'src/index.ts',\r\n ];\r\n\r\n // Find existing entries\r\n for (const entry of possibleEntries) {\r\n const fullPath = join(config.root, entry);\r\n if (existsSync(fullPath)) {\r\n entries.push(entry);\r\n break; // Only need one primary entry\r\n }\r\n }\r\n\r\n // Fallback if nothing found\r\n if (entries.length === 0) {\r\n entries.push('src/index.tsx');\r\n }\r\n\r\n return entries;\r\n}\r\n\r\n// ============================================================================\r\n// Exports\r\n// ============================================================================\r\n\r\nexport default flightpack;\r\nexport { flightpack as createFlightPackAdapter };\r\n\r\n/**\r\n * Package version\r\n */\r\nexport const VERSION = '0.0.1';\r\n"],"mappings":";AA6BA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAaP,IAAM,eAAe;AACrB,IAAM,eAAe;AA4MrB,IAAI,gBAAsC;AAE1C,eAAe,oBAA4C;AACvD,MAAI,cAAe,QAAO;AAE1B,MAAI;AAGA,UAAM,EAAE,cAAc,IAAI,MAAM,OAAO,QAAa;AACpD,UAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,UAAM,SAASA,SAAQ,8BAA8B;AACrD,oBAAgB;AAChB,WAAO;AAAA,EACX,SAAS,OAAO;AACZ,UAAM,IAAI;AAAA,MACN;AAAA,kBAEmB,KAAK;AAAA,IAC5B;AAAA,EACJ;AACJ;AA8BO,SAAS,WAAW,UAAoC,CAAC,GAAmB;AAC/E,QAAM,UAA0B;AAAA,IAC5B,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IAEA,MAAM,gBAAgB,QAA0C;AAC5D,YAAM,SAAS,MAAM,kBAAkB;AAEvC,YAAM,OAAO,OAAO,IAAI,QAAQ;AAChC,YAAM,OAAO,OAAO,IAAI,QAAQ;AAChC,YAAM,QAAQ,OAAO,I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,QAAI,WAAW,QAAQ,GAAG;AACtB,cAAQ,KAAK,KAAK;AAClB;AAAA,IACJ;AAAA,EACJ;AAGA,MAAI,QAAQ,WAAW,GAAG;AACtB,YAAQ,KAAK,eAAe;AAAA,EAChC;AAEA,SAAO;AACX;AAMA,IAAO,gBAAQ;AAMR,IAAM,UAAU;","names":["require","result"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\r\n * @flight-framework/bundler-flightpack\r\n * \r\n * FlightPack native Rust bundler adapter for Flight Framework.\r\n * Wraps the native Rust bundler for maximum performance.\r\n * \r\n * @example\r\n * ```typescript\r\n * // In flight.config.ts\r\n * import { defineConfig } from '@flight-framework/core';\r\n * import { flightpack } from '@flight-framework/bundler-flightpack';\r\n * \r\n * export default defineConfig({\r\n * bundler: flightpack(),\r\n * });\r\n * ```\r\n * \r\n * @packageDocumentation\r\n */\r\n\r\nimport type {\r\n BundlerAdapter,\r\n DevServer,\r\n BuildResult,\r\n PreviewServer,\r\n OutputFile,\r\n TransformOptions,\r\n TransformResult as BundlerTransformResult,\r\n} from '@flight-framework/bundler';\r\nimport {\r\n registerAdapter,\r\n setDefaultAdapter,\r\n createTimer,\r\n createBuildError,\r\n logDevServerStarted,\r\n logBuildSuccess,\r\n logBuildError,\r\n resolvePath,\r\n cleanDirectory,\r\n} from '@flight-framework/bundler';\r\nimport type { FlightConfig } from '@flight-framework/core/config';\r\nimport type {\r\n FlightPackAdapterOptions,\r\n} from './types.js';\r\n\r\n// Re-export types\r\nexport * from './types.js';\r\n\r\n// ============================================================================\r\n// Constants\r\n// ============================================================================\r\n\r\nconst ADAPTER_NAME = 'flight-flightpack';\r\nconst BUNDLER_NAME = 'flightpack';\r\n\r\n// ============================================================================\r\n// Native Binding Loader\r\n// ============================================================================\r\n\r\n/**\r\n * Native binding interface matching the NAPI exports\r\n */\r\ninterface NativeBinding {\r\n FlightPack: new (options?: FlightPackNativeOptions | undefined | null) => {\r\n build(): Promise<NativeBuildResult>;\r\n };\r\n build: (options: FlightPackNativeOptions) => Promise<NativeBuildResult>;\r\n transform: (code: string, filename: string, options?: NativeTransformOptions | undefined | null) => Promise<NativeTransformResult>;\r\n version: () => string;\r\n // Dev Server\r\n startDevServer: (options?: NativeDevServerOptions | undefined | null) => Promise<NativeDevServerResult>;\r\n stopDevServer: () => Promise<boolean>;\r\n isDevServerRunning: () => boolean;\r\n // HMR\r\n sendHmrUpdate: (modules: NativeHMRModuleUpdate[]) => boolean;\r\n sendHmrError: (message: string) => boolean;\r\n // File Watcher\r\n watchFiles: (options: NativeWatcherOptions, callback: (event: NativeWatchEvent) => void) => NativeWatchHandle;\r\n // CSS Processing\r\n transformCss: (code: string, filename: string, options?: NativeCssTransformOptions | undefined | null) => NativeCssTransformResult;\r\n minifyCss: (code: string, filename: string) => string;\r\n transformCssModule: (code: string, filename: string) => NativeCssModuleResult;\r\n}\r\n\r\n/**\r\n * Native CSS transform options\r\n */\r\ninterface NativeCssTransformOptions {\r\n minify?: boolean;\r\n cssModules?: boolean;\r\n cssModulesPattern?: string;\r\n dashedIdents?: boolean;\r\n sourcemap?: boolean;\r\n browserTargets?: {\r\n chrome?: number;\r\n firefox?: number;\r\n safari?: number;\r\n edge?: number;\r\n };\r\n}\r\n\r\n/**\r\n * Native CSS transform result\r\n */\r\ninterface NativeCssTransformResult {\r\n code: string;\r\n map?: string | null;\r\n exports: Array<{\r\n original: string;\r\n hashed: string;\r\n isReferenced: boolean;\r\n composes: string[];\r\n }>;\r\n success: boolean;\r\n}\r\n\r\n/**\r\n * Native CSS module result\r\n */\r\ninterface NativeCssModuleResult {\r\n code: string;\r\n classMap: Array<{\r\n original: string;\r\n hashed: string;\r\n }>;\r\n}\r\n\r\n/**\r\n * Platform type\r\n */\r\ntype NativePlatform = 'browser' | 'node' | 'edge' | 'neutral';\r\n\r\n/**\r\n * Extended NativeBinding interface with universal support\r\n */\r\ninterface NativeBindingExtended extends NativeBinding {\r\n // Externals Detection\r\n isNodeBuiltin: (moduleId: string) => boolean;\r\n getNodeBuiltins: () => string[];\r\n getNodeBuiltinsPrefixed: () => string[];\r\n isBareImport: (moduleId: string) => boolean;\r\n isEdgeCompatible: (moduleId: string) => boolean;\r\n getEdgeIncompatibleModules: () => string[];\r\n getPlatformConditions: (platform: string) => string[];\r\n}\r\n\r\n\r\n/**\r\n * Native dev server options\r\n */\r\ninterface NativeDevServerOptions {\r\n port?: number;\r\n publicDir?: string;\r\n outDir?: string;\r\n hmr?: boolean;\r\n root?: string;\r\n}\r\n\r\n/**\r\n * Native dev server result\r\n */\r\ninterface NativeDevServerResult {\r\n url: string;\r\n port: number;\r\n hmr: boolean;\r\n}\r\n\r\n/**\r\n * Native HMR module update\r\n */\r\ninterface NativeHMRModuleUpdate {\r\n id: string;\r\n path: string;\r\n code: string;\r\n deps?: string[] | null;\r\n accept: boolean;\r\n}\r\n\r\n/**\r\n * Native watcher options\r\n */\r\ninterface NativeWatcherOptions {\r\n paths: string[];\r\n extensions?: string[] | null;\r\n debounceMs?: number | null;\r\n}\r\n\r\n/**\r\n * Native watch event\r\n */\r\ninterface NativeWatchEvent {\r\n paths: string[];\r\n eventType: string;\r\n}\r\n\r\n/**\r\n * Native watch handle\r\n */\r\ninterface NativeWatchHandle {\r\n stop(): boolean;\r\n}\r\n\r\n/**\r\n * Native options matching Rust struct with FULL capability exposure\r\n * Maps to flightpack-napi FlightPackOptions\r\n */\r\ninterface FlightPackNativeOptions {\r\n /** Entry points */\r\n entry: string[];\r\n /** Output directory */\r\n outDir: string;\r\n /** Root directory */\r\n root?: string;\r\n /** Enable minification */\r\n minify?: boolean;\r\n /** Generate source maps */\r\n sourcemap?: boolean;\r\n /** Enable RSC support */\r\n rsc?: boolean;\r\n // ========== Extended Capabilities ==========\r\n /** Enable tree shaking with InnerGraph (statement-level DCE) */\r\n treeshake?: boolean;\r\n /** Enable code splitting (ChunkSplitter) */\r\n splitting?: boolean;\r\n /** Enable incremental build caching (TurboCache + ArtifactStore) */\r\n cache?: boolean;\r\n /** Persistent cache directory */\r\n cacheDir?: string;\r\n /** Platform target for externals and conditions */\r\n platform?: 'browser' | 'node' | 'edge' | 'neutral';\r\n /** External packages (not bundled) */\r\n external?: string[];\r\n /** Force bundle packages (override auto-external) */\r\n noExternal?: string[];\r\n /** Target ES version */\r\n target?: string;\r\n}\r\n\r\n/**\r\n * Native build result matching Rust struct\r\n */\r\ninterface NativeBuildResult {\r\n outputDir: string;\r\n durationMs: number;\r\n totalSize: number;\r\n chunks: NativeChunkInfo[];\r\n}\r\n\r\n/**\r\n * Native chunk info matching Rust struct\r\n */\r\ninterface NativeChunkInfo {\r\n fileName: string;\r\n chunkType: string;\r\n size: number;\r\n}\r\n\r\n/**\r\n * Native transform options matching Rust struct\r\n */\r\ninterface NativeTransformOptions {\r\n sourcemap?: boolean;\r\n minify?: boolean;\r\n target?: string;\r\n jsxFactory?: string;\r\n jsxFragment?: string;\r\n}\r\n\r\n/**\r\n * Native transform result matching Rust struct\r\n */\r\ninterface NativeTransformResult {\r\n code: string;\r\n map?: string | null;\r\n success: boolean;\r\n}\r\n\r\n/**\r\n * Lazy-loaded native FlightPack binding\r\n * This defers loading until actually needed, improving startup time\r\n */\r\nlet nativeBinding: NativeBinding | null = null;\r\n\r\nasync function loadNativeBinding(): Promise<NativeBinding> {\r\n if (nativeBinding) return nativeBinding;\r\n\r\n try {\r\n // Use createRequire for ESM compatibility with native modules\r\n // Native .node files require \"require()\" which isn't available in ESM\r\n const { createRequire } = await import('node:module');\r\n const require = createRequire(import.meta.url);\r\n const native = require('@flight-framework/flightpack') as NativeBinding;\r\n nativeBinding = native;\r\n return native;\r\n } catch (error) {\r\n throw new Error(\r\n `Failed to load FlightPack native binding. ` +\r\n `Make sure @flight-framework/flightpack is installed.\\n` +\r\n `Original error: ${error}`\r\n );\r\n }\r\n}\r\n\r\n// ============================================================================\r\n// Adapter Implementation\r\n// ============================================================================\r\n\r\n/**\r\n * Create a FlightPack bundler adapter\r\n * \r\n * FlightPack is a native Rust bundler that provides:\r\n * - 1,874+ files/second processing speed\r\n * - Zero-config TypeScript/TSX support via Oxc\r\n * - React Server Components (RSC) support\r\n * - Tree shaking and code splitting\r\n * - Hot Module Replacement (HMR)\r\n * \r\n * @param options - FlightPack adapter options\r\n * @returns A BundlerAdapter instance\r\n * \r\n * @example\r\n * ```typescript\r\n * import { flightpack } from '@flight-framework/bundler-flightpack';\r\n * \r\n * const adapter = flightpack({\r\n * minify: true,\r\n * sourcemap: true,\r\n * rsc: true,\r\n * });\r\n * ```\r\n */\r\nexport function flightpack(options: FlightPackAdapterOptions = {}): BundlerAdapter {\r\n const adapter: BundlerAdapter = {\r\n name: ADAPTER_NAME,\r\n bundler: BUNDLER_NAME,\r\n options,\r\n\r\n async createDevServer(config: FlightConfig): Promise<DevServer> {\r\n const native = await loadNativeBinding();\r\n\r\n const port = config.dev.port ?? 5173;\r\n const host = config.dev.host ?? 'localhost';\r\n const https = config.dev.https === true;\r\n\r\n // Use native Rust dev server with Axum and WebSocket HMR\r\n const result = await native.startDevServer({\r\n port,\r\n publicDir: resolvePath(config.root, 'public'),\r\n outDir: resolvePath(config.root, config.build.outDir),\r\n hmr: typeof options.hmr === 'boolean' ? options.hmr : (options.hmr !== undefined ? true : true),\r\n root: config.root,\r\n });\r\n\r\n logDevServerStarted(result.url, 'FlightPack');\r\n\r\n // Set up file watcher for HMR updates\r\n let watchHandle: NativeWatchHandle | undefined;\r\n if (result.hmr) {\r\n try {\r\n watchHandle = native.watchFiles(\r\n {\r\n paths: [resolvePath(config.root, 'src')],\r\n extensions: ['ts', 'tsx', 'js', 'jsx', 'css'],\r\n debounceMs: 100,\r\n },\r\n async (event: NativeWatchEvent) => {\r\n // Transform changed files and send HMR updates\r\n const updates: NativeHMRModuleUpdate[] = [];\r\n\r\n for (const filePath of event.paths) {\r\n try {\r\n const { readFile } = await import('node:fs/promises');\r\n const source = await readFile(filePath, 'utf-8');\r\n const transformed = await native.transform(source, filePath);\r\n\r\n if (transformed.success) {\r\n updates.push({\r\n id: filePath,\r\n path: filePath,\r\n code: transformed.code,\r\n accept: true,\r\n deps: null,\r\n });\r\n }\r\n } catch (error) {\r\n native.sendHmrError(`Failed to transform ${filePath}: ${error}`);\r\n }\r\n }\r\n\r\n if (updates.length > 0) {\r\n native.sendHmrUpdate(updates);\r\n }\r\n }\r\n );\r\n } catch (error) {\r\n console.warn('[FlightPack] File watcher failed to start:', error);\r\n }\r\n }\r\n\r\n return {\r\n url: result.url,\r\n port: result.port,\r\n host: host as string,\r\n https,\r\n async close() {\r\n // Stop file watcher\r\n if (watchHandle) {\r\n watchHandle.stop();\r\n }\r\n // Stop native dev server\r\n await native.stopDevServer();\r\n },\r\n restart: undefined,\r\n reload: undefined,\r\n hmrUpdate: undefined,\r\n printUrls() {\r\n console.log(` ⚡ FlightPack Dev Server`);\r\n console.log(` ➜ Local: ${result.url}`);\r\n if (result.hmr) {\r\n console.log(` ➜ HMR: enabled (WebSocket)`);\r\n }\r\n },\r\n };\r\n },\r\n\r\n async build(config: FlightConfig): Promise<BuildResult> {\r\n const native = await loadNativeBinding() as NativeBindingExtended;\r\n const timer = createTimer();\r\n const { existsSync } = await import('node:fs');\r\n const { mkdir, copyFile, writeFile, readFile } = await import('node:fs/promises');\r\n const { join, basename, relative } = await import('node:path');\r\n\r\n // ================================================================\r\n // Build Configuration Resolution\r\n // ================================================================\r\n\r\n // Resolve all options with proper defaults\r\n // Note: FlightPack native only accepts boolean, not 'inline'/'hidden' for sourcemap\r\n // or 'esbuild'/'terser' for minify - we coerce to boolean\r\n const resolvedOptions = {\r\n minify: typeof options.minify === 'boolean'\r\n ? options.minify\r\n : (config.build.minify !== false && config.build.minify !== undefined),\r\n sourcemap: typeof options.sourcemap === 'boolean'\r\n ? options.sourcemap\r\n : (config.build.sourcemap !== false && config.build.sourcemap !== undefined),\r\n treeshake: typeof options.treeshake === 'boolean'\r\n ? options.treeshake\r\n : (typeof options.treeshake === 'object' ? options.treeshake.enabled : true),\r\n splitting: typeof options.splitting === 'boolean'\r\n ? options.splitting\r\n : (typeof options.splitting === 'object' ? options.splitting.enabled : true),\r\n cache: typeof options.cache === 'boolean'\r\n ? options.cache\r\n : (typeof options.cache === 'object' ? options.cache.enabled : true),\r\n cacheDir: options.cacheDir ??\r\n (typeof options.cache === 'object' ? options.cache.directory : undefined) ??\r\n '.flightpack_cache',\r\n rsc: options.rsc ?? true,\r\n target: options.target ?? 'es2022',\r\n external: options.external ?? [],\r\n noExternal: options.noExternal ?? [],\r\n };\r\n\r\n const baseOutDir = resolvePath(config.root, config.build.outDir);\r\n const cacheDir = resolvePath(config.root, resolvedOptions.cacheDir);\r\n const allFiles: OutputFile[] = [];\r\n let totalSize = 0;\r\n let cacheHits = 0;\r\n let cacheMisses = 0;\r\n\r\n try {\r\n // Clean output directory\r\n await cleanDirectory(baseOutDir);\r\n\r\n console.log('\\n┌─────────────────────────────────────────────────────┐');\r\n console.log('│ ⚡ FlightPack Production Build │');\r\n console.log('├─────────────────────────────────────────────────────┤');\r\n console.log(`│ Tree Shaking: ${resolvedOptions.treeshake ? '✓ InnerGraph (statement-level)' : '✗ disabled'} `);\r\n console.log(`│ Code Splitting: ${resolvedOptions.splitting ? '✓ ChunkSplitter' : '✗ disabled'} `);\r\n console.log(`│ Caching: ${resolvedOptions.cache ? '✓ TurboCache + ArtifactStore' : '✗ disabled'} `);\r\n console.log(`│ Target: ${resolvedOptions.target} `);\r\n console.log('└─────────────────────────────────────────────────────┘\\n');\r\n\r\n // ================================================================\r\n // Phase 1: Client Build (Browser Platform)\r\n // ================================================================\r\n console.log('⚡ Phase 1/6: Building client bundle...');\r\n\r\n const clientEntries = await getEntryPoints(config, 'client');\r\n const clientOutDir = join(baseOutDir, 'client', 'assets');\r\n await mkdir(clientOutDir, { recursive: true });\r\n\r\n // Get platform-specific conditions\r\n const browserConditions = native.getPlatformConditions('browser');\r\n\r\n const clientOptions: FlightPackNativeOptions = {\r\n entry: clientEntries,\r\n outDir: clientOutDir,\r\n root: config.root,\r\n minify: resolvedOptions.minify,\r\n sourcemap: resolvedOptions.sourcemap,\r\n rsc: resolvedOptions.rsc,\r\n // Full capabilities\r\n treeshake: resolvedOptions.treeshake,\r\n splitting: resolvedOptions.splitting,\r\n cache: resolvedOptions.cache,\r\n cacheDir: cacheDir,\r\n platform: 'browser',\r\n external: [], // Browser bundles include everything\r\n target: resolvedOptions.target,\r\n };\r\n\r\n const clientResult = await native.build(clientOptions);\r\n\r\n for (const chunk of clientResult.chunks) {\r\n allFiles.push({\r\n path: `client/assets/${chunk.fileName}`,\r\n size: chunk.size,\r\n type: chunk.chunkType as 'entry' | 'chunk' | 'asset',\r\n isDynamicEntry: false,\r\n });\r\n totalSize += chunk.size;\r\n }\r\n console.log(` ✓ Client: ${clientResult.chunks.length} chunks (${formatBytes(clientResult.totalSize)})`);\r\n\r\n // ================================================================\r\n // Phase 2: Server/SSR Build (Node Platform)\r\n // ================================================================\r\n const isSSR = config.rendering?.default !== 'csr';\r\n\r\n if (isSSR) {\r\n console.log('⚡ Phase 2/6: Building server bundle (SSR)...');\r\n\r\n const serverEntries = await getEntryPoints(config, 'server');\r\n const serverOutDir = join(baseOutDir, 'server');\r\n await mkdir(serverOutDir, { recursive: true });\r\n\r\n // Get Node.js builtins for auto-external\r\n const nodeBuiltins = native.getNodeBuiltins();\r\n const serverExternals = [\r\n ...nodeBuiltins,\r\n ...resolvedOptions.external,\r\n ].filter(ext => !resolvedOptions.noExternal.includes(ext));\r\n\r\n const serverOptions: FlightPackNativeOptions = {\r\n entry: serverEntries,\r\n outDir: serverOutDir,\r\n root: config.root,\r\n minify: false, // Server bundles: keep readable for debugging\r\n sourcemap: resolvedOptions.sourcemap,\r\n rsc: resolvedOptions.rsc,\r\n treeshake: resolvedOptions.treeshake,\r\n splitting: false, // Single SSR bundle recommended\r\n cache: resolvedOptions.cache,\r\n cacheDir: cacheDir,\r\n platform: 'node',\r\n external: serverExternals,\r\n target: 'es2022', // Node 18+ supports ES2022\r\n };\r\n\r\n const serverResult = await native.build(serverOptions);\r\n\r\n for (const chunk of serverResult.chunks) {\r\n allFiles.push({\r\n path: `server/${chunk.fileName}`,\r\n size: chunk.size,\r\n type: chunk.chunkType as 'entry' | 'chunk' | 'asset',\r\n isDynamicEntry: false,\r\n });\r\n totalSize += chunk.size;\r\n }\r\n console.log(` ✓ Server: ${serverResult.chunks.length} chunks (${formatBytes(serverResult.totalSize)})`);\r\n } else {\r\n console.log('⚡ Phase 2/6: Skipped (CSR mode)');\r\n }\r\n\r\n // ================================================================\r\n // Phase 3: Edge Build (if configured)\r\n // ================================================================\r\n const hasEdgeConfig = options.environments?.edge;\r\n\r\n if (hasEdgeConfig) {\r\n console.log('⚡ Phase 3/6: Building edge bundle...');\r\n\r\n const edgeOutDir = join(baseOutDir, 'edge');\r\n await mkdir(edgeOutDir, { recursive: true });\r\n\r\n // Get edge-incompatible modules for auto-external\r\n const edgeIncompatible = native.getEdgeIncompatibleModules();\r\n\r\n const edgeOptions: FlightPackNativeOptions = {\r\n entry: hasEdgeConfig.entry ?? await getEntryPoints(config, 'server'),\r\n outDir: edgeOutDir,\r\n root: config.root,\r\n minify: true,\r\n sourcemap: resolvedOptions.sourcemap,\r\n rsc: resolvedOptions.rsc,\r\n treeshake: true, // Always tree shake edge bundles\r\n splitting: false,\r\n cache: resolvedOptions.cache,\r\n cacheDir: cacheDir,\r\n platform: 'edge',\r\n external: edgeIncompatible,\r\n target: 'es2022',\r\n };\r\n\r\n const edgeResult = await native.build(edgeOptions);\r\n\r\n for (const chunk of edgeResult.chunks) {\r\n allFiles.push({\r\n path: `edge/${chunk.fileName}`,\r\n size: chunk.size,\r\n type: chunk.chunkType as 'entry' | 'chunk' | 'asset',\r\n isDynamicEntry: false,\r\n });\r\n totalSize += chunk.size;\r\n }\r\n console.log(` ✓ Edge: ${edgeResult.chunks.length} chunks (${formatBytes(edgeResult.totalSize)})`);\r\n } else {\r\n console.log('⚡ Phase 3/6: Skipped (no edge config)');\r\n }\r\n\r\n // ================================================================\r\n // Phase 4: Process CSS with Lightning CSS\r\n // ================================================================\r\n console.log('⚡ Phase 4/6: Processing CSS...');\r\n\r\n const cssFiles = await findCssFiles(config.root);\r\n let cssProcessed = 0;\r\n\r\n if (cssFiles.length > 0) {\r\n const cssOutDir = join(baseOutDir, 'client', 'assets');\r\n await mkdir(cssOutDir, { recursive: true });\r\n\r\n // Resolve CSS options\r\n const cssOptions = typeof options.css === 'object' ? options.css : {};\r\n const cssTargets = 'targets' in cssOptions ? cssOptions.targets : undefined;\r\n\r\n for (const cssFile of cssFiles) {\r\n try {\r\n const cssContent = await readFile(cssFile, 'utf-8');\r\n const isCssModule = cssFile.includes('.module.');\r\n\r\n let processedCss: string;\r\n let classMap: { original: string; hashed: string }[] = [];\r\n\r\n if (isCssModule) {\r\n const result = native.transformCssModule(cssContent, cssFile);\r\n processedCss = result.code;\r\n classMap = result.classMap;\r\n } else {\r\n // Use full CSS transform with options\r\n const result = native.transformCss(cssContent, cssFile, {\r\n minify: resolvedOptions.minify,\r\n cssModules: false,\r\n sourcemap: resolvedOptions.sourcemap,\r\n browserTargets: cssTargets,\r\n });\r\n processedCss = result.code;\r\n }\r\n\r\n const outFileName = basename(cssFile);\r\n const outPath = join(cssOutDir, outFileName);\r\n await writeFile(outPath, processedCss);\r\n\r\n // Write source map if generated\r\n if (resolvedOptions.sourcemap) {\r\n // Source map would be in result.map if available\r\n }\r\n\r\n allFiles.push({\r\n path: `client/assets/${outFileName}`,\r\n size: processedCss.length,\r\n type: 'asset',\r\n isDynamicEntry: false,\r\n });\r\n totalSize += processedCss.length;\r\n cssProcessed++;\r\n } catch (e) {\r\n console.warn(` ⚠ Warning: CSS processing failed for ${basename(cssFile)}`);\r\n }\r\n }\r\n }\r\n console.log(` ✓ CSS: ${cssProcessed} files processed`);\r\n\r\n // ================================================================\r\n // Phase 5: Copy Static Assets\r\n // ================================================================\r\n console.log('⚡ Phase 5/6: Copying static assets...');\r\n\r\n let assetsCount = 0;\r\n\r\n // Copy index.html\r\n const htmlSource = join(config.root, 'index.html');\r\n const htmlDest = join(baseOutDir, 'client', 'index.html');\r\n if (existsSync(htmlSource)) {\r\n await mkdir(join(baseOutDir, 'client'), { recursive: true });\r\n\r\n // Read and process HTML to inject asset references\r\n let htmlContent = await readFile(htmlSource, 'utf-8');\r\n\r\n // Find client entry chunk for script injection\r\n const clientEntry = clientResult.chunks.find(c => c.chunkType === 'entry');\r\n if (clientEntry) {\r\n // Inject bundled script reference\r\n htmlContent = htmlContent.replace(\r\n '</body>',\r\n ` <script type=\"module\" src=\"/assets/${clientEntry.fileName}\"></script>\\n</body>`\r\n );\r\n }\r\n\r\n await writeFile(htmlDest, htmlContent);\r\n allFiles.push({\r\n path: 'client/index.html',\r\n size: htmlContent.length,\r\n type: 'asset',\r\n isDynamicEntry: false,\r\n });\r\n assetsCount++;\r\n }\r\n\r\n // Copy public directory\r\n const publicDir = join(config.root, 'public');\r\n if (existsSync(publicDir)) {\r\n const copied = await copyDirectoryRecursive(publicDir, join(baseOutDir, 'client'));\r\n assetsCount += copied;\r\n }\r\n\r\n console.log(` ✓ Assets: ${assetsCount} files copied`);\r\n\r\n // ================================================================\r\n // Phase 6: Generate RSC Manifests (if RSC enabled)\r\n // ================================================================\r\n if (resolvedOptions.rsc && isSSR) {\r\n console.log('⚡ Phase 6/6: Generating RSC manifests...');\r\n\r\n // Generate client reference manifest\r\n const clientManifest = {\r\n ssrModuleMapping: {},\r\n edgeSSRModuleMapping: {},\r\n clientModules: {},\r\n entryCSSFiles: {},\r\n };\r\n\r\n // Generate server reference manifest\r\n const serverManifest = {\r\n node: {},\r\n edge: {},\r\n };\r\n\r\n await writeFile(\r\n join(baseOutDir, 'client', 'react-client-manifest.json'),\r\n JSON.stringify(clientManifest, null, 2)\r\n );\r\n\r\n await writeFile(\r\n join(baseOutDir, 'server', 'react-server-manifest.json'),\r\n JSON.stringify(serverManifest, null, 2)\r\n );\r\n\r\n console.log(' ✓ RSC manifests generated');\r\n } else {\r\n console.log('⚡ Phase 6/6: Skipped (RSC disabled or CSR mode)');\r\n }\r\n\r\n // ================================================================\r\n // Build Summary\r\n // ================================================================\r\n const duration = timer.stop();\r\n\r\n console.log('\\n┌─────────────────────────────────────────────────────┐');\r\n console.log('│ Build Summary │');\r\n console.log('├─────────────────────────────────────────────────────┤');\r\n console.log(`│ Duration: ${duration}ms `);\r\n console.log(`│ Total Size: ${formatBytes(totalSize)} `);\r\n console.log(`│ Files: ${allFiles.length} `);\r\n if (resolvedOptions.cache) {\r\n console.log(`│ Cache: ${cacheDir} `);\r\n }\r\n console.log('└─────────────────────────────────────────────────────┘\\n');\r\n\r\n const buildResult: BuildResult = {\r\n outDir: baseOutDir,\r\n duration,\r\n files: allFiles,\r\n totalSize,\r\n errors: [],\r\n warnings: [],\r\n success: true,\r\n };\r\n\r\n logBuildSuccess(buildResult);\r\n return buildResult;\r\n\r\n } catch (error) {\r\n const buildResult: BuildResult = {\r\n outDir: baseOutDir,\r\n duration: timer.stop(),\r\n files: [],\r\n totalSize: 0,\r\n errors: [createBuildError(error)],\r\n warnings: [],\r\n success: false,\r\n };\r\n\r\n logBuildError(buildResult);\r\n return buildResult;\r\n }\r\n },\r\n\r\n async preview(config: FlightConfig): Promise<PreviewServer> {\r\n const { createServer } = await import('node:http');\r\n const { readFile, stat } = await import('node:fs/promises');\r\n const { join, extname } = await import('node:path');\r\n\r\n const outDir = resolvePath(config.root, config.build.outDir);\r\n const port = 4173;\r\n const host = 'localhost';\r\n const url = `http://${host}:${port}`;\r\n\r\n const mimeTypes: Record<string, string> = {\r\n '.html': 'text/html',\r\n '.js': 'text/javascript',\r\n '.css': 'text/css',\r\n '.json': 'application/json',\r\n };\r\n\r\n const server = createServer(async (req, res) => {\r\n let urlPath = req.url === '/' ? '/index.html' : req.url!;\r\n const filePath = join(outDir, urlPath);\r\n\r\n try {\r\n const content = await readFile(filePath);\r\n const ext = extname(filePath);\r\n res.setHeader('Content-Type', mimeTypes[ext] || 'application/octet-stream');\r\n res.writeHead(200);\r\n res.end(content);\r\n } catch {\r\n // Try with .html extension\r\n try {\r\n const htmlPath = filePath.endsWith('.html') ? filePath : `${filePath}.html`;\r\n const content = await readFile(htmlPath);\r\n res.setHeader('Content-Type', 'text/html');\r\n res.writeHead(200);\r\n res.end(content);\r\n } catch {\r\n res.writeHead(404);\r\n res.end('Not Found');\r\n }\r\n }\r\n });\r\n\r\n server.listen(port, host);\r\n\r\n return {\r\n url,\r\n port,\r\n async close() {\r\n return new Promise((resolve) => {\r\n server.close(() => resolve());\r\n });\r\n },\r\n printUrls() {\r\n console.log(` ➜ Preview: ${url}`);\r\n },\r\n };\r\n },\r\n\r\n async clean(config: FlightConfig): Promise<void> {\r\n const outDir = resolvePath(config.root, config.build.outDir);\r\n await cleanDirectory(outDir);\r\n },\r\n\r\n async version(): Promise<string> {\r\n const native = await loadNativeBinding();\r\n return native.version();\r\n },\r\n\r\n async transform(\r\n code: string,\r\n id: string,\r\n transformOptions?: TransformOptions\r\n ): Promise<BundlerTransformResult> {\r\n const native = await loadNativeBinding();\r\n\r\n // Handle CSS files with native CSS processor\r\n if (id.endsWith('.css')) {\r\n const isCssModule = id.includes('.module.');\r\n\r\n if (isCssModule) {\r\n // CSS Modules: transform and generate class mappings\r\n const result = native.transformCssModule(code, id);\r\n\r\n // Generate JS export for CSS modules\r\n const classMapObject = Object.fromEntries(\r\n result.classMap.map(c => [c.original, c.hashed])\r\n );\r\n\r\n const jsCode = [\r\n `// CSS Module: ${id}`,\r\n `const styles = ${JSON.stringify(classMapObject)};`,\r\n `export default styles;`,\r\n ``,\r\n `// Inject CSS`,\r\n `if (typeof document !== 'undefined') {`,\r\n ` const style = document.createElement('style');`,\r\n ` style.textContent = ${JSON.stringify(result.code)};`,\r\n ` document.head.appendChild(style);`,\r\n `}`,\r\n ].join('\\n');\r\n\r\n return {\r\n code: jsCode,\r\n map: null,\r\n };\r\n } else {\r\n // Regular CSS: just minify and inject\r\n const minified = native.minifyCss(code, id);\r\n\r\n const jsCode = [\r\n `// CSS: ${id}`,\r\n `if (typeof document !== 'undefined') {`,\r\n ` const style = document.createElement('style');`,\r\n ` style.textContent = ${JSON.stringify(minified)};`,\r\n ` document.head.appendChild(style);`,\r\n `}`,\r\n ].join('\\n');\r\n\r\n return {\r\n code: jsCode,\r\n map: null,\r\n };\r\n }\r\n }\r\n\r\n // Handle TypeScript/JavaScript files\r\n const sourcemapOption = typeof transformOptions?.sourcemap === 'boolean'\r\n ? transformOptions.sourcemap\r\n : true;\r\n\r\n const result = await native.transform(code, id, {\r\n sourcemap: sourcemapOption,\r\n target: transformOptions?.target ?? 'es2022',\r\n });\r\n\r\n return {\r\n code: result.code,\r\n map: result.map,\r\n };\r\n },\r\n };\r\n\r\n // Auto-register as default if specified\r\n if (options.autoRegister !== false) {\r\n registerAdapter(adapter);\r\n\r\n // Set as default bundler\r\n setDefaultAdapter(ADAPTER_NAME);\r\n }\r\n\r\n return adapter;\r\n}\r\n\r\n// ============================================================================\r\n// Helper Functions\r\n// ============================================================================\r\n\r\n/**\r\n * Get entry points from Flight configuration\r\n * @param type - 'client' or 'server' to determine which entry to look for\r\n */\r\nasync function getEntryPoints(config: FlightConfig, type: 'client' | 'server' = 'client'): Promise<string[]> {\r\n const entries: string[] = [];\r\n const { existsSync } = await import('node:fs');\r\n const { join } = await import('node:path');\r\n\r\n if (type === 'server') {\r\n // Server/SSR entry points\r\n const serverEntries = [\r\n 'src/entry-server.tsx',\r\n 'src/entry-server.ts',\r\n 'src/server.tsx',\r\n 'src/server.ts',\r\n ];\r\n\r\n for (const entry of serverEntries) {\r\n const fullPath = join(config.root, entry);\r\n if (existsSync(fullPath)) {\r\n entries.push(entry);\r\n break;\r\n }\r\n }\r\n\r\n // Fallback\r\n if (entries.length === 0) {\r\n entries.push('src/entry-server.tsx');\r\n }\r\n } else {\r\n // Client entry points\r\n const clientEntries = [\r\n 'src/entry-client.tsx',\r\n 'src/entry-client.ts',\r\n 'src/main.tsx',\r\n 'src/main.ts',\r\n 'src/App.tsx',\r\n 'src/App.ts',\r\n 'src/app.tsx',\r\n 'src/app.ts',\r\n 'src/index.tsx',\r\n 'src/index.ts',\r\n ];\r\n\r\n for (const entry of clientEntries) {\r\n const fullPath = join(config.root, entry);\r\n if (existsSync(fullPath)) {\r\n entries.push(entry);\r\n break;\r\n }\r\n }\r\n\r\n // Fallback\r\n if (entries.length === 0) {\r\n entries.push('src/index.tsx');\r\n }\r\n }\r\n\r\n return entries;\r\n}\r\n\r\n/**\r\n * Find CSS files in the source directory\r\n */\r\nasync function findCssFiles(root: string): Promise<string[]> {\r\n const { readdir, stat } = await import('node:fs/promises');\r\n const { join } = await import('node:path');\r\n const cssFiles: string[] = [];\r\n\r\n async function walkDir(dir: string): Promise<void> {\r\n try {\r\n const items = await readdir(dir);\r\n for (const item of items) {\r\n // Skip node_modules and hidden directories\r\n if (item === 'node_modules' || item.startsWith('.')) continue;\r\n\r\n const itemPath = join(dir, item);\r\n const itemStat = await stat(itemPath);\r\n\r\n if (itemStat.isDirectory()) {\r\n await walkDir(itemPath);\r\n } else if (item.endsWith('.css')) {\r\n cssFiles.push(itemPath);\r\n }\r\n }\r\n } catch {\r\n // Ignore errors (permission issues, etc.)\r\n }\r\n }\r\n\r\n await walkDir(join(root, 'src'));\r\n return cssFiles;\r\n}\r\n\r\n/**\r\n * Recursively copy a directory and return file count\r\n */\r\nasync function copyDirectoryRecursive(src: string, dest: string): Promise<number> {\r\n const { mkdir, readdir, copyFile, stat } = await import('node:fs/promises');\r\n const { join } = await import('node:path');\r\n\r\n await mkdir(dest, { recursive: true });\r\n let count = 0;\r\n\r\n const items = await readdir(src);\r\n for (const item of items) {\r\n const srcPath = join(src, item);\r\n const destPath = join(dest, item);\r\n const itemStat = await stat(srcPath);\r\n\r\n if (itemStat.isDirectory()) {\r\n count += await copyDirectoryRecursive(srcPath, destPath);\r\n } else {\r\n await copyFile(srcPath, destPath);\r\n count++;\r\n }\r\n }\r\n return count;\r\n}\r\n\r\n/**\r\n * Format bytes to human-readable string\r\n */\r\nfunction formatBytes(bytes: number): string {\r\n if (bytes === 0) return '0 B';\r\n const k = 1024;\r\n const sizes = ['B', 'KB', 'MB', 'GB'];\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;\r\n}\r\n\r\n// ============================================================================\r\n// Exports\r\n// ============================================================================\r\n\r\nexport default flightpack;\r\nexport { flightpack as createFlightPackAdapter };\r\n\r\n/**\r\n * Package version\r\n */\r\nexport const VERSION = '0.1.4';\r\n\r\n"],"mappings":";AA6BA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAaP,IAAM,eAAe;AACrB,IAAM,eAAe;AAoOrB,IAAI,gBAAsC;AAE1C,eAAe,oBAA4C;AACvD,MAAI,cAAe,QAAO;AAE1B,MAAI;AAGA,UAAM,EAAE,cAAc,IAAI,MAAM,OAAO,QAAa;AACpD,UAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,UAAM,SAASA,SAAQ,8BAA8B;AACrD,oBAAgB;AAChB,WAAO;AAAA,EACX,SAAS,OAAO;AACZ,UAAM,IAAI;AAAA,MACN;AAAA,kBAEmB,KAAK;AAAA,IAC5B;AAAA,EACJ;AACJ;AA8BO,SAAS,WAAW,UAAoC,CAAC,GAAmB;AAC/E,QAAM,UAA0B;AAAA,IAC5B,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IAEA,MAAM,gBAAgB,QAA0C;AAC5D,YAAM,SAAS,MAAM,kBAAkB;AAEvC,YAAM,OAAO,OAAO,IAAI,QAAQ;AAChC,YAAM,OAAO,OAAO,IAAI,QAAQ;AAChC,YAAM,QAAQ,OAAO,IAAI,UAAU;AAGnC,YAAM,SAAS,MAAM,OAAO,eAAe;AAAA,QACvC;AAAA,QACA,WAAW,YAAY,OAAO,MAAM,QAAQ;AAAA,QAC5C,QAAQ,YAAY,OAAO,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C,CAAC;AAClD,SAAO,GAAG,YAAY,QAAQ,KAAK,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AACzE;AAMA,IAAO,gBAAQ;AAMR,IAAM,UAAU;","names":["require","result"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flight-framework/bundler-flightpack",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "FlightPack native Rust bundler adapter for Flight Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "@flight-framework/core": "^0.6.7"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@flight-framework/flightpack": "^0.1.1"
45
+ "@flight-framework/flightpack": "^0.4.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "tsup": "^8.5.1",