Skip to content
This repository

Implement Traceur compilation for modules/ES.Next #214

Closed
paulirish opened this Issue · 20 comments

6 participants

Paul Irish Addy Osmani Sindre Sorhus Ryan Seddon Aaron Frost Pascal Hartig
Paul Irish
Owner

RIght now we're using require-hm for our ES6 Modules support. It looks like Traceur covers the complete scope of what require-hm does, plus can transpile down to ES5 a whole lot fo goodness from ES6 and Beyond.

On it's modules support, from primary developer Erik Arvidsson:

Actually I don't see anything in require-hm that traceur does not support. The major thing that is not supported in Traceur is mutually recursive modules and RequireJS does not support those either.

If we can get all modules and the ES Next goodness for free for all users, it'd be excellent. First-class support for Coffeescript & ES6 transpilation. \o/

Addy Osmani
Owner

I can take another look at this tomorrow. I probably have some rough work with integration lying around from the first time we looked at it. Was also thinking how hot it would be to get all the ES Next support Traceur offers out of the box, so like minds there :D

Sindre Sorhus
Owner

++++ \o/ ++++

Ryan Seddon

Regardless of how much ES6 you use doesn't traceur include the whole ~200kb lib it requires once you've compiled to ES5?

Addy Osmani
Owner

I'll double check with the Traceur team that it doesn't but if it does, I think its acceptable given it would still live under 'experimental support for ES6' and not recommended for prod :)

Addy Osmani
Owner

Boom: https://github.com/addyosmani/traceur - Traceur support via node that we can go and create a task with (I'll do that next week).

@ryanseddon with respect to your question:

There is currently a "runtime.js" which is small but needed. I'm (Alex Russell) working on removing Tue need for this so that the generated code is standalone. In neither case, though, is all of traceur needed at runtime

I just added support to inline modules at compile time. This allows you to compile one es6 with external dependencies into a single file. This is just a command line tool at this point but I don't see why the same code could not be used on a node web server.

Ryan Seddon

Nice thanks @addyosmani

Addy Osmani
Owner

Moving to 1.1

Sindre Sorhus
Owner

ping @addyosmani ref grunt task

Aaron Frost

I am gonna take a look at this also. I need a grunt task for Traceur.

Addy Osmani
Owner

Feel free to build on the node traceur work previously started for this. Would love to see it implemented as a grunt task.

Aaron Frost

Close. Maybe tonight I will be done. When I am done I will want your feedback.

Addy Osmani
Owner

sgtm.

Aaron Frost

So far. I just barely got it working. I need to see about getting sourcemaps included, and need to do some testing to make sure it is good. Also need to add documentation about including the runtime.js file into their code.

To answer a previous question, it doesn't force you to include the entire 200kb traceur.js file. HOWEVER, you have to include the runtime.js file though (~13kb), which helps shim some final functionality into your environment.

Will post once I have something more final. I am very excited about this!

Addy Osmani
Owner

@sindresorhus @paul_Irish as there are now quite a few grunt tasks that solve this problem for us shall we make a call on whether we want Traceur support in our webapp generator or not? If not we can close this issue otherwise I can put together a PR post I/O.

Sindre Sorhus
Owner

I'd say yes; though as long as it works perfectly.

But not until the open issues on grunt-traceur are fixed, @passy's concerns about it are resolved and the author confirms willingness to keep the task up to date. I've been burned by hit&run grunt tasks too many times.

Pascal Hartig
Owner
passy commented

One of the problems with grunt-traceur is that it ships with a bundled version of traceuer instead of depending on the npm module. It also implements the grunt file expansion incorrectly. Given the fairly small amount of code I suggest we should consider writing our own from scratch with the goal of merging it with grunt-traceur eventually.

Aaron Frost

@sindresorhus I will take a look at the sourcemaps issue this week. I just merged in a PR that took care of improving some testing and fixed the external dependency issue. It now relies on the npm traceur package.

Once sourcemaps are working (or sooner), I would love to get @passy's input on where I went wrong with the implementing the file expansion stuff.

Additionally, I think that it would be wise to add some people as collaborators so that we don't risk having a "hit&run" scenario, as @sindresorhus mentioned. Let me know who I should add and I will add them as collaborators on the repo.

Sindre Sorhus
Owner

@aaronfrost you could add me, Addy, and passy.

Aaron Frost

Done

Addy Osmani
Owner

We've started prototyping how this might look as part of a separate generator but won't be bringing it to generator-webapp until we feel the solution is stable enough. We'll track progress on this upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.