ractivejs/ractive — pull request #1485 by Rich-Harris (2014-11-14 23:06:45+00:00)
Title: Esperanto

**not ready for merge**

I've released a new version of [esperanto](https://github.com/Rich-Harris/esperanto), a tool for converting ES6 modules (such as Ractive's source code) to AMD/CommonJS/UMD.

The change is that whereas the previous version would only do one-to-one conversions of files, the new version can trace a module's dependencies and create a bundle, a bit like RequireJS or Browserify. (It has some important differences from the [es6-module-transpiler](https://github.com/esnext/es6-module-transpiler) project, in case anyone's wondering why I didn't just use that.)

There are a few consequences of this:

* Bundling is much faster with Esperanto than with the combination of RequireJS+AMDClean, because of the techniques it uses - eventually* this will mean faster builds
* The resulting code is slimmer
* We no longer need to use the ugly `circular.js` hack to handle cyclical dependencies, which are fairly prevalent in Ractive due to the fact that it's modelling recursive structures
* We can have multiple imports/exports per file with no penalties, unlike before - e.g. `isObject`, `isArray`, `isNumeric` etc could all go in a single `types.js` file. So we can make the codebase a bit easier to navigate

At the moment all this PR does is remove the circular references - the build process (and tests) need updating as well, and I haven't got that far yet, as there are some nuances* I need to deal with.

*because there are multiple bundles (`ractive.js`, `ractive-legacy.js`, `ractive-runtime.js` and so on), and for the sake of fast incremental rebuilds during development, it makes sense to do the transpilation of ES6 language features (e.g. arrow functions) on a file-by-file basis *before* the bundling. Unfortunately the transpiler we're using, [es6-transpiler](https://github.com/termi/es6-transpiler), doesn't currently support the final module syntax. Have played about with [6to5](https://github.com/6to5/6to5) but es6-transpiler is a good deal faster.