| 369 | } |
| 370 | |
| 371 | async compileTypeScript(filepath) { |
| 372 | // For TypeScript files, use Bun.build for optimal performance |
| 373 | const result = await Bun.build({ |
| 374 | entrypoints: [filepath], |
| 375 | outdir: this.options.outdir, |
| 376 | target: 'bun', |
| 377 | format: 'esm', |
| 378 | splitting: false, |
| 379 | sourcemap: this.options.sourcemap ? 'external' : 'none', |
| 380 | minify: false, |
| 381 | naming: { |
| 382 | entry: '[dir]/[name].mjs', |
| 383 | }, |
| 384 | external: ['*'], |
| 385 | root: PROJECT_ROOT, |
| 386 | }) |
| 387 | |
| 388 | if (result.success) { |
| 389 | this.stats.files++ |
| 390 | // Get size from output |
| 391 | if (result.outputs.length > 0) { |
| 392 | const output = result.outputs[0] |
| 393 | this.stats.size += output.size || 0 |
| 394 | } |
| 395 | } else { |
| 396 | throw new Error(result.logs.join('\n')) |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | async copyJavaScript(filepath) { |
| 401 | // For JS files, just copy them |