Core Build Packages
These internal TypeScript modules make up the main Susee build pipeline inside this repository.
src/bundler.ts
- Purpose: bundling wrapper
- Description: delegates to
@suseejs/susee_bundler’ssuseeBundlerfunction. Exposes three functions:bundler(point)(internal, used by the Compiler),suseeBundle(entry, checkOptions?)(public API, returns the bundled source string), andsuseeCliBundle(opts)(used by the CLIbundlecommand to write the bundled source to disk without compilation) - Role in flow: bundles the entry’s local dependency tree into a single merged source string
src/compiler/index.ts
- Purpose: compilation orchestration
- Description: the
Compilerclass drives per-format (ESM/CommonJS) compilation of bundled source - Role in flow: for each entry and format, gets compiler options, detects JSX, compiles via
suseeCompiler, optionally minifies, writes output files, and optionally updatespackage.json
src/compiler/suseeCompiler.ts
- Purpose: in-memory TypeScript compilation
- Description: creates an in-memory
CompilerHostusing@suseejs/ts6, emits JavaScript, declarations, and source maps - Role in flow: compiles bundled source into
.mjs/.cjsoutput with.d.mts/.d.ctsdeclarations
src/compiler/tsoptions.ts
- Purpose: compiler option resolution
- Description: resolves TypeScript compiler options from custom
tsconfigFilePath, roottsconfig.json, or internal defaults - Role in flow: produces per-format (
commonjs/esm) compiler options consumed by theCompiler
src/config/index.ts
- Purpose: configuration parsing and validation
- Description: loads
susee.config.{ts,js,mjs}, validates entry points, and normalizes intoBuildOptions - Role in flow: produces
BuildOptionsconsumed by theCompiler
src/cli/index.ts
- Purpose: CLI dispatch
- Description: parses
process.argvand routes tobuild,bundle,init,check, version, or help - Role in flow: entry point for the
suseebin script
src/cli/parse_args.ts
- Purpose: CLI argument parsing
- Description: parses flags for
buildandbundlecommands, builds aSuSeeConfig(forbuild) orCliBundleOpts(forbundle) - Role in flow: feeds parsed options to
buildorsuseeCliBundle
src/cli/lint.ts
- Purpose: lint-only check command
- Description: the
suseeCheckfunction runssuseeLintfrom@suseejs/susee_bundleron every config entry point with all checks enabled, reporting errors and warnings - Role in flow: powers the
susee checkCLI command (no bundling or compilation)
src/cli/init.ts
- Purpose: config file scaffolding
- Description: interactively generates
susee.config.ts,susee.config.js, orsusee.config.mjsbased on project type - Role in flow: powers the
susee initCLI command
src/cli/print_help.ts
- Purpose: help text
- Description: prints CLI usage and available options
- Role in flow: powers
susee --help/susee -h
src/helpers/files.ts
- Purpose: file system operations
- Description: writes output files, clears output directory, and updates
package.jsonmetadata - Role in flow: handles all file I/O for build output
src/helpers/minify.ts
- Purpose: minification wrapper
- Description: wraps
oxc-minifyto minify emitted JavaScript - Role in flow: post-compile pass when the entry’s
minifyoption is enabled
When to work in these directly
Work in these modules directly when:
- You are changing a specific internal build stage.
- You need to debug bundling, compilation, compiler option resolution, or package metadata updates.
- You want to understand which source module owns a behavior before editing.
High-level flow
These modules are wired together in the current codebase like this:
-
src/config/index.tsloads config and generatesBuildOptions. -
src/bundler.tsbundles the dependency tree via@suseejs/susee_bundler. -
src/compiler/tsoptions.tsresolves compiler options. -
src/compiler/suseeCompiler.tscompiles the bundled source using@suseejs/ts6. -
src/helpers/minify.tsoptionally minifies the output. -
src/helpers/files.tswrites artifacts and updatespackage.json.
Public entry points into this pipeline
Most users should interact with the pipeline through the public susee package exports:
-
build(options?)— async config-driven build function -
suseeBundle(entry, checkOptions?)— synchronous lower-level bundling function returning the merged source string
Example:
ts
import { build } from "susee";
await build({
entryPoints: [
{
entry: "src/index.ts",
exportPath: ".",
format: ["esm", "commonjs"],
},
],
});