egoist/tsup
6 articles
Prerequisites
- ›Basic familiarity with TypeScript and Node.js module systems
- ›High-level understanding of what a bundler does (entry points, output formats, externals)
tsup Architecture Overview: Navigating the Codebase
A bird's-eye tour of the tsup repository covering directory layout, entry points, the build() orchestrator, and the dual-layer plugin architecture.
Configuration Loading: From CLI Flags to NormalizedOptions
How tsup discovers config files, executes TypeScript configs with bundle-require, and normalizes options through a layered resolution pipeline.
The esbuild Build Pipeline: Orchestration, Plugins, and Output Processing
A deep dive into runEsbuild() — auto-externalization, bundled esbuild plugins, the write:false pattern, and the PluginContainer output pipeline.
tsup's Plugin System: Post-Build Transformations and Built-in Plugins
An in-depth look at the tsup Plugin API, lifecycle hooks, and every built-in plugin — from shebang handling to Rollup tree-shaking and Terser minification.
TypeScript Declaration Files: Two Strategies for DTS Generation
A comprehensive comparison of tsup's --dts and --experimental-dts paths — Worker threads, rollup-plugin-dts, the TypeScript compiler API, and API Extractor.
Watch Mode, onSuccess Hooks, and the Development Feedback Loop
How tsup achieves fast, intelligent rebuilds with chokidar, esbuild metafiles, debounced builds, and cross-platform process management.