cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discussion: Rewrite and merge ttypescript and ts-patch

nonara opened this issue · comments

Hi all!

I've been thinking about this for awhile, and I thought I'd go ahead and gauge interest.

ttypescript and to a lesser extent, ts-patch, have been filling a void for awhile now. I know that they have been very helpful for many of us who needed to do more with the TS compiler. With that said, in hindsight—gauging from personal use and feature requests—I believe that there is room for improvement in our overall design which could make for a much more powerful and perhaps more complete plugin architecture.

Update

Given the issues with ttypescript and its unmaintained status and the current limitation with ts-patch, I think it's time to do the rewrite.

I've sketched out the design. Here are the highlights:

  • Will not directly modify ts files (better for yarn)
  • Will allow persistent alias overwriting (ie. can name the compiler tsc or something else, default is tspc)
  • Supports custom patches which allow actual AST transformation of typescript libraries themselves, opening the door for packaged middleware
  • Uses smart caching for core patch and custom patches applied to typescript modules (improves speed)
  • Single plugin package can contain multiple before, after, afterDeclarations transformers + patches
  • Will maintain support for current ttypescript style transformer packages

I've decided to keep the name for simplicity and visibility. So the rewrite will be housed in ts-patch v2.

You can follow nonara/ts-patch#40 for updates

Definitely in favor of having one tool for adding additional, pluggable features to TS. I started brainstorming in https://github.com/cspotcode/hookable-typescript but never had time to go anywhere with it.

I'd also like the option to avoid modifying typescript/tsc/tsserver in situations where other tools in the dependency tree should get access to unmodified copies of tsc. Like how ttsc and tsc can live side-by-side.

I'm also not sure how writing to the filesystem works with yarn2's PnP cache. I believe those zip files are mounted read-only.

Development is underway!

Discussion: nonara/ts-patch#40
Dev Branch: https://github.com/nonara/ts-patch/tree/v2