@giuseppegurgone@jkup@rauchg What's an example of a transform you would want to implement in Sucrase? Keep in mind you're still able (and even encouraged) to use Babel for production builds.
@brwnll@fabiosussetto@TheLarkInn@rauchg The idea is that you aren't the one maintaining it, so you probably don't care about that part. More work for me, but in exchange, it's faster for everyone else. 🙂
(Extensibility is a more significant tradeoff, but I bet you don't actually need it for development.)
@giuseppegurgone@jkup@rauchg If you do want to write a custom transform that's as fast as Sucrase, I'd recommend forking Sucrase and modifying the parser to give you what you need for the transform to work. Or you could always use Babel, which is slower but designed to make transforms easy to write. 🙂
@giuseppegurgone@jkup@rauchg Sucrase is a focused solution, not a framework, so I'm certainly not planning on ever having a plugin system. The parser only handles what's needed for Sucrase's transforms (that's what makes it fast), and likely wouldn't be useful for other transforms anyway.
@drosenwasser@robpalmer2@rauchg Thanks! 😀 And yep, I tried to be fair in the perf comparison by using transpileModule with similar config. Of course, typechecking is way, way out of scope for Sucrase.
@vitalii_akimov@rauchg The parser actually does emit scopes (just not an AST), which is needed to detect some variable shadowing cases. But yeah, it certainly tries to get away with a parser that's as minimal as possible.
@thetombell@rauchg Yep! I'd recommend separating typecheck and transpile in any TypeScript dev environment. ts-loader recommends that, for example: https://t.co/rU7P1cvq2I
@TheLarkInn@rauchg That 20% is all I really need for development. Sucrase, Babel, and tsc are all compiling the same thing in this perf comparison. The reason Babel is slow isn't because it's compiling more, it's because it's architected for extensibility and flexibility that it isn't using here.
@trevorbrindlejs@TheLarkInn@rauchg Those performance numbers are for when Babel and TypeScript are configured to only transpile typescript, JSX, and imports (what Sucrase supports). Babel and TypeScript don't get much faster when disabling transforms, which was one motivation for writing Sucrase.