gulpjs / interpret

A dictionary of file extensions and associated module loaders.
MIT License
259 stars 47 forks source link

Add Sucrase support #66

Closed flipsasser closed 4 years ago

flipsasser commented 4 years ago

I added support for Sucrase to the TypeScript extensions. Sucrase is a fast subset of Babel that is super helpful for development-time recompilation.

flipsasser commented 4 years ago

Womp womp! Sucrase doesn't support Node that far back. From their README: "Sucrase assumes that you're developing with a recent browser or recent Node.js version"

I do still think this would be a useful addition for Gulp - Sucrase is screaming fast. Can someone recommend a way forward, or should I just close this?

phated commented 4 years ago

Since this project is just a lookup of loaders, we list a bunch of libraries that don't support older node versions. I'm on my phone, but if you look in the test runner, there's actually a way to specify which nodes the library works on.

phated commented 4 years ago

@flipsasser would it be likely for someone to have Sucrase and ts-node (or one of the other registers) installed in their project?

flipsasser commented 4 years ago

@phated got it, thanks for the tip! I set the min Node.js version and it looks like CI ran successfully.

I wasn't sure if I should bump the patch version in package.json or add a note to the CHANGELOG but I have a commit ready to go if you'd like me to push it up.

Thanks again!

flipsasser commented 4 years ago

@phated oh I apologize - I just now saw your earlier question.

would it be likely for someone to have Sucrase and ts-node (or one of the other registers) installed in their project?

I can't speak for anyone else, but our primary use case for ts-node (and/or Sucrase) is as a register prior to interpreting various TypeScript configuration files.

Since Sucrase is much, much faster (and since our production build includes thorough type checking), we're interested in replacing ts-node with Sucrase across the board in the interest of quicker startup times for Gulp, Rollup, and a few other bits and pieces.

TLDR: I can't speak broadly, but we currently have both Sucrase and ts-node installed - but Interpret (via Gulp) is the only component using ts-node. This pull request would allow us to remove ts-node entirely and just use Sucrase.

phated commented 4 years ago

Thanks @flipsasser! I'm going to get this backported to the 1.x release line too so you can start using it in gulp right away

phated commented 4 years ago

Thanks again. I just published v1.3.0 with this backported.

flipsasser commented 4 years ago

Oh right on! Thank you for everything.