Read OSS

egoist/tsup

6 articles

Prerequisites

01

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.

02

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.

03

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.

04

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.

05

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.

06

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.