feat(core): Integrate Rolldown as optional bundler, migrate filesystem to smartfs, and update bundler/tooling

This commit is contained in:
2025-11-23 13:12:17 +00:00
parent 1bb05bfd2e
commit cd53bdb6f4
32 changed files with 3152 additions and 5142 deletions

View File

@@ -1,19 +1,31 @@
# tsbundle Hints and Findings
## Recent Updates (2025-11-23)
- Migrated from @push.rocks/smartfile v11 to @push.rocks/smartfs v1.1.0
- All filesystem operations now use async smartfs API
- Removed @push.rocks/tapbundle (now imported from @git.zone/tstest/tapbundle)
- All bundlers (esbuild, rolldown, rspack) updated to latest versions
- Removed deprecated rolldown experimental.enableComposingJsPlugins option
## Bundler Architecture
- tsbundle uses a child process architecture where each bundler runs in a separate process
- Configuration is passed via environment variables as JSON (IEnvTransportOptions)
- The main class `TsBundle` spawns child processes using `smartspawn.ThreadSimple`
## Bundler Implementations
- **esbuild** (default): Fully implemented, production ready, 2.2K minified
- **rolldown**: Implemented and working (beta), produces smallest bundles (1.5K minified)
- **rspack**: Implemented and working, webpack-compatible API, 6.1K minified
- **esbuild** (default): Fully implemented, production ready, 3.9K minified
- **rolldown**: Implemented and working (beta v1.0.0-beta.51), produces smallest bundles (1.0K minified)
- **rspack**: Implemented and working (v1.6.4), webpack-compatible API, 6.3K minified
- **rollup**: Removed (was never implemented)
- **parcel**: Removed (was never implemented)
## Adding New Bundlers
To add a new bundler, you need:
1. Update `ICliOptions` interface to include the bundler name
2. Add case in `getBundlerPath()` switch statement
3. Create `mod_<bundler>/` directory with:
@@ -22,6 +34,7 @@ To add a new bundler, you need:
4. Add bundler to package.json dependencies
## Rolldown Specific Notes
- Rolldown is in beta (v1.0.0-beta.18) but working well
- API: Use `rolldown()` function directly, not `rolldown.rolldown()`
- Output options go in the `write()` method, not the initial config
@@ -31,6 +44,7 @@ To add a new bundler, you need:
- Supports TypeScript via `resolve.tsconfigFilename`
## Rspack Specific Notes
- Rspack v1.3.15 - stable and production ready
- Uses webpack-compatible API (callback-based)
- Built-in SWC loader for TypeScript transpilation
@@ -39,11 +53,13 @@ To add a new bundler, you need:
- Supports ES modules output via `experiments.outputModule: true`
## CLI Usage
- Default bundler: `tsbundle` (uses esbuild)
- Specify bundler: `tsbundle --bundler=rolldown` or `tsbundle --bundler=rspack`
- Production mode: `tsbundle --production`
- Combined: `tsbundle --bundler=rolldown --production`
## Known Issues
- esbuild recently had splitting and tree-shaking disabled due to issues
- The README still mentions "a bundler using rollup" but uses esbuild by default
- The README still mentions "a bundler using rollup" but uses esbuild by default