Skip to content

Modernize TypeScript toolchain: NodeNext, tsdown, oxfmt#4

Merged
gadenbuie merged 6 commits intomainfrom
refactor/typescript-cleanup
Mar 20, 2026
Merged

Modernize TypeScript toolchain: NodeNext, tsdown, oxfmt#4
gadenbuie merged 6 commits intomainfrom
refactor/typescript-cleanup

Conversation

@gadenbuie
Copy link
Collaborator

Summary

Modernize the TypeScript build and developer toolchain:

  • tsconfig: Switch to NodeNext module resolution with erasableSyntaxOnly, verbatimModuleSyntax, and moduleDetection: force
  • Enums → as const: Convert LogLevel and ServerType enums to as const objects with derived type unions (required for erasableSyntaxOnly)
  • tsup → tsdown: Replace tsup (esbuild) with tsdown (Rolldown/Oxc) for bundling. Net reduction of ~80 npm dependencies.
  • Prettier → oxfmt: Replace Prettier with oxfmt (Rust-based, Prettier-compatible). Zero formatting diff on all source files.
  • package.json: Add exports map, sideEffects: false, fix repo URL format

Verification

npm run build       # vite report build + tsdown CLI bundling
npm run typecheck   # strict NodeNext + erasableSyntaxOnly
npm test            # 356 tests pass
npx oxfmt --check src/  # formatting check
npx publint         # package validation

Convert LogLevel and ServerType enums to `as const` object + derived
type union pattern. Add LOG_LEVEL_NAMES reverse map for LogLevel.
Convert constructor parameter property to explicit field assignment
in MockShinyServer. These changes prepare the codebase for enabling
erasableSyntaxOnly in tsconfig.
- module: ESNext → NodeNext
- moduleResolution: bundler → nodenext
- Add moduleDetection: force, verbatimModuleSyntax, erasableSyntaxOnly
- Simplify include from src/**/* to src
- Replace legacy main field with exports map
- Add sideEffects: false
- Fix repository URL to use git+https:// prefix
Replace tsup (esbuild) with tsdown (Rolldown/Oxc) for bundling.
Output extension changes from .js to .mjs (tsdown default for ESM).
Update bin entries, exports map, and test paths accordingly.
Net reduction of 83 npm dependencies.
Replace Prettier with oxfmt (Rust-based, Prettier-compatible formatter).
Migrate config via `oxfmt --migrate=prettier`, add ignore pattern for
generated report HTML. Update format and pre-push scripts.
Zero formatting diff on all 47 source files.
The report template imports index.html as a raw string asset.
With NodeNext module resolution, Vite's import analysis tries to
parse the HTML as JS. Adding assetsInclude tells Vite to treat
HTML files as assets instead.
@gadenbuie gadenbuie marked this pull request as ready for review March 20, 2026 20:40
@gadenbuie gadenbuie merged commit b78009f into main Mar 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant