Skip to content

Rewrite in TypeScript and modernize build system#135

Merged
EmilyRagan merged 1 commit intoace-diff:masterfrom
TrevorBurnham:typescript-rewrite
Feb 23, 2026
Merged

Rewrite in TypeScript and modernize build system#135
EmilyRagan merged 1 commit intoace-diff:masterfrom
TrevorBurnham:typescript-rewrite

Conversation

@TrevorBurnham
Copy link
Copy Markdown
Contributor

Resolves #125

This PR migrates ace-diff from vanilla JavaScript to TypeScript with ES Modules (ESM) as the primary module format, while dual-building as CJS. This is a major version upgrade (v4.0.0) that modernizes the codebase while maintaining API compatibility.

Changes

Package Configuration

  • Added "type": "module" to enable ESM by default
  • Implemented conditional exports for dual CJS/ESM support
  • Updated entry points with proper file extensions (.mjs for ESM, .cjs for CJS)
  • Added sideEffects field for better tree-shaking support
  • Configured ace-builds as a peer dependency

Build System

  • Replaced Parcel with tsdown (Rolldown-based bundler)
  • Configured Vite for development server
  • Outputs both ES and CJS formats with proper declaration files
  • SCSS compilation with source maps

TypeScript Configuration

  • Strict mode enabled with additional safety checks
  • Module system set to ESNext with bundler resolution
  • Full type definitions generated (.d.mts and .d.cts)

Source Code

  • Converted all source files to TypeScript
  • Added comprehensive type definitions for all public APIs
  • Organized types into modular structure (src/types/)

Documentation

  • Updated README with new import syntax
  • Added migration notes for v3.x users

Tooling

  • Renamed .prettierrc to .prettierrc.cjs for ESM compatibility
  • Configured ESLint for TypeScript
  • Added attw (Are The Types Wrong) checker to CI

Breaking Changes

See the README for details.

Testing

  • TypeScript compilation passes (pnpm typecheck)
  • ESLint passes (pnpm lint)
  • Build succeeds (pnpm build)
  • Type exports verified (pnpm attw)
  • Cypress e2e tests pass (pnpm test)
  • Demos look good (pnpm dev)

Checklist

  • Code follows project style guidelines
  • TypeScript strict mode enabled
  • Documentation updated
  • Build configuration tested
  • Dual CJS/ESM output verified
  • Type definitions correctly exported

Next steps

Once this is merged, we should update the documentation site: https://ace-diff.github.io/ace-diff/ That site corresponds to the gh-pages branch, which was last updated in 2018!

@TrevorBurnham TrevorBurnham mentioned this pull request Jan 18, 2026
@jmthomas jmthomas requested a review from EmilyRagan January 21, 2026 04:08
@jmthomas
Copy link
Copy Markdown
Collaborator

Looks great @TrevorBurnham! We will get reviewed and merged! Also I updated the gh-pages branch ... thanks for the heads up!

Copy link
Copy Markdown
Collaborator

@EmilyRagan EmilyRagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for contributing!

@jmthomas
Copy link
Copy Markdown
Collaborator

jmthomas commented Jan 24, 2026

@TrevorBurnham we just merged #136 to do the file renames. Hopefully this will help preserve file history. Please rebase on that. Thanks!

@TrevorBurnham TrevorBurnham force-pushed the typescript-rewrite branch 2 times, most recently from c61eff5 to 59f0c97 Compare January 24, 2026 21:09
@TrevorBurnham
Copy link
Copy Markdown
Contributor Author

Please rebase on that.

Done!

@EmilyRagan
Copy link
Copy Markdown
Collaborator

Sorry for the long delay between reviews!

Copy link
Copy Markdown
Collaborator

@EmilyRagan EmilyRagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks so much for doing this work

@EmilyRagan EmilyRagan merged commit ff90f10 into ace-diff:master Feb 23, 2026
1 check 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.

TypeScript

3 participants