Loader Hooks

Calvin Metcalf calvin.metcalf at gmail.com
Tue Jun 24 07:36:53 PDT 2014

Say you wanted to add a hook which automatically added an export named
filepath to a module is the path to the file, or add an import just for the
side effects (say a shim or something).  The relevant code in es6 module
loader is

On Tue, Jun 24, 2014 at 10:33 AM, caridy <caridy at gmail.com> wrote:

> Calvin, I don't fully understand what you mean by "manipulate the exports
> and imports". I assume you're talking about native modules since you
> already have full control over the dynamic modules workflow. Maybe Guy
> Bedford can provide more details on how he implemented this process in
> es6-module-loader.
> /caridy
> On Jun 24, 2014, at 10:17 AM, Calvin Metcalf <calvin.metcalf at gmail.com>
> wrote:
> > 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

-Calvin W. Metcalf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140624/520b1783/attachment.html>

More information about the es-discuss mailing list