susee
v1.5.1
Published
Simple TypeScript Bundler
Readme
Overview
Susee is a TypeScript-first bundler for library packages.
It reads susee.config.{ts,js,mjs}, resolves the dependency graph for each entry,
bundles sources into a single unit, then compiles output for ESM and/or CommonJS with types.
Features
- Loads config from one of:
susee.config.tssusee.config.jssusee.config.mjs
- Supports multiple entry points with subpath exports (
.and./subpath). - Validates and type-checks dependency files before bundling.
- Runs dependency, pre-process, and post-process plugins (sync or async).
- Compiles to:
- ESM (
.mjs,.d.mts, source maps) - CommonJS (
.cjs,.d.cts, source maps)
- ESM (
- Can update
package.jsonfields (type,main,module,types,exports) whenallowUpdatePackageJsonis enabled.
Current Constraints
- CommonJS dependencies in the source graph are rejected by core (suggested workaround:
@suseejs/plugin-commonjs). - JSX/TSX dependencies are currently rejected.
- CLI supports only
suseeandsusee init.
Installation and Quick Start
Install
npm i -D suseeCreate a config file
npx susee initBuild your first project
Use the CLI:
npx suseeOr in package.json:
{
"scripts": {
"build": "susee"
}
}Config Reference
SuSeeConfig
interface SuSeeConfig {
entryPoints: EntryPoint[];
outDir?: string; // default: "dist"
plugins?: (SuseePlugin | SuseePluginFunction)[]; // default: []
allowUpdatePackageJson?: boolean; // default: false
}EntryPoint
type OutputFormat = ("commonjs" | "esm")[];
interface EntryPoint {
entry: string;
exportPath: "." | `./${string}`;
format?: OutputFormat; // default: ["esm"]
tsconfigFilePath?: string;
renameDuplicates?: boolean; // default: true
binary?: { name: string };
}Entry Validation Rules
- At least one
entryPointis required. - Duplicate
exportPathvalues are rejected. - Each
entryfile must exist.
TypeScript Options Behavior
For each entry point, Susee builds compiler options from:
tsconfigFilePath(if provided)- project
tsconfig.json - Susee defaults
Susee enforces/adjusts key options internally:
moduleResolution: "NodeNext"allowJs: trueoutDirset per entry output pathtypesincludesnodelibincludesESNext
Plugin Hooks
Susee supports these plugin stages:
dependency- receives resolved dependency files and compiler options
- transforms dependency metadata/content before bundling
pre-process- receives bundled code before compilation
post-process- receives emitted JS output content per file
Both sync and async plugins are supported.
Output Behavior
format: ["esm"]- emits
.mjsand.d.mts
- emits
format: ["commonjs"]- emits
.cjsand.d.cts
- emits
format: ["esm", "commonjs"]- emits both sets
When allowUpdatePackageJson is true, Susee can update:
type(forced tomodule)mainmoduletypesexports(including subpath exports fromexportPath)
CLI
susee
susee initAny other argument combination exits with an error.
Local Development
Common project scripts:
npm run build
npm run test
npm run lint
npm run fmt
npm run hooks:installNotes:
npm run testopens an interactive selector (scripts/susee-tests.ts).- Git hooks are tracked in
.githooksand installed vianpm run hooks:install.
Contributing
Contributions are welcome for bug fixes, features, documentation, and code quality improvements.
See detail in CONTRIBUTING.md
