Skip to content

Atom: Custom Transpilers

smhxx edited this page Apr 3, 2018 · 2 revisions

Custom transpiler packages function essentially as compatibility shims that allow Atom core to require() source files written in languages other than JavaScript (or in unsupported versions of JavaScript, in the case of atom-babel6-transpiler.) The API is simple and currently defines only two methods:

  • getCacheKeyData() allows the transpiler to provide information which affects the validity of the compile cache. This method is called internally by require(), and if the returned value changes, the cache will be invalidated. More information on cache keys can be found at Atom: Compile Cache.
  • transpile() actually performs the transpilation and returns the JavaScript output, which is then cached by Atom until the cache key changes.

The implementations of these methods in atom-ts-transpiler can be found in src/index.ts

Clone this wiki locally