Loader Hooks

John Barton johnjbarton at google.com
Tue Jun 24 07:52:25 PDT 2014

Guy Bedford's es6-module-loader follows the Loader spec closely. I just
refactored it to create a function call `parse(load) -> deps`:


This location in the pipeline is pretty much where you suggest. I think
I've convinced Guy to let me add it as a hook. Maybe your request will push
him over the edge ;-)

Note that as far as I can tell, this function call provides a neat
interface between the Loader and parser.


On Tue, Jun 24, 2014 at 7:17 AM, Calvin Metcalf <calvin.metcalf at gmail.com>

> I've been doing work with the loader hooks and one gap that stands out is
> that there is no hook to let you manipulate the exports and imports of an
> module without parsing it yourself, in other words if you want to add,
> remove, or modify exports or imports of a module you have to write your own
> parsing function because the default instantiate function returns undefined.
> Ideas:
> - There is a way of doing what I need to do that I am missing.
> - Add a post instantiate hook between (InstantiateSucceeded)
> and (ProcessLoadDependencies)
> - The steps in could be moved to the default instantiate
> function so that when overriding it you can still call it to get the parsed
> module object.
> ---
> -Calvin W. Metcalf
> _______________________________________________
> 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/20140624/90c2f1ef/attachment.html>

More information about the es-discuss mailing list