Shepherd.js - Implementing Harmony modules for today's browsers

Russell Leggett russell.leggett at gmail.com
Wed Apr 18 06:11:40 PDT 2012


This is great! I've been considering doing the same thing, but I haven't
found the time. When you say it is compatible with CommonJS modules, does
that mean that you can do an import using ES6 syntax and have the result do
a CommonJS require?

The big thing I'm noticing is that all of the examples are inside of
comments, and your module definitions including exports are all separate
from the actual code for those exports. I'm assuming that means somebody
couldn't actually take the ES6 module examples and make them work, for
example. I appreciate the difference in difficulty level. Parsing just the
module syntax vs being an ES5 compliant parser + modules is a much
different task. The problem is, I don't see myself using it unless it
actually used full module syntax. Do you plan on going in that direction?

- Russ

On Wed, Apr 18, 2012 at 8:20 AM, Xavier CAMBAR <xcambar at gmail.com> wrote:

> Hi,
> I wanted to announce that I've been working on a project called Shepherd (
> http://xcambar.github.com/shepherd-js), a pure Javascript implementation
> of Harmony modules.
>
> Why such a project ? Fun first. Second, I was really looking forward to
> use harmony modules. Third, I wanted an efficient way to use my modules on
> the server and the client. And it seems to me that current module loaders
> and APIs available will be, at the end, superseded by the module syntax
> being defined at ECMA for the future versions of ECMAScript.
>
> The syntax used is as of 2012-02-27 (
> http://wiki.ecmascript.org/doku.php?id=harmony:modules&rev=1330363672), I
> couldn't find the time to implement the latest proposal (besides I would
> have had to choose one of the two variants), but apart from the syntax, it
> is usable both on the client and the server, and tested.
>
> The parser/lexer has been developped using JISON (
> http://zaach.github.com/jison/) and is available as a separate project (
> https://github.com/xcambar/harmony-parser).
>
> For backward-compatibility, the module declarations have to be put into
> comments (which you will discover in the examples provided on the site), it
> is compatible with CommonJS modules (user-defined as well as native modules
> in Node.js), and, although not critical to the project, a compatibility
> wrapper for the AMD API is on its way.
> Regarding production-level requirements, an optimizer has been
> implemented, but it still requires testing before being released.
>
> I've had and I'm still having a really good time working on this project
> and I would really appreciate if I could have some feedback from the
> readers and contributors of the mailing-list.
> A mailing list has been created for the project, still empty of messages
> simply because it has been created yesterday ;)
>
> Regards,
>
> --
> Xavier CAMBAR
> @xcambar <https://twitter.com/#!/xcambar>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120418/dcedfe6e/attachment.html>


More information about the es-discuss mailing list