One very useful feature in RequireJS is the ability to hook into the
dependency tree through the onResourceLoad API.
Currently, the way the link function is designed for ES6 modules, there is
no way for a loader to discover the imports for a given module.
If there was some way to allow some insight into the link output (since
internally the link object with the import list is constructed anyway),
this would be incredibly useful for using the loader to construct
dependency graphs.
Perhaps, simply allow the custom loader to call the native link function
with something like the following:
where Loader.link is the native linking function exposed through the Loader
global. This way the link output can be intercepted and used to create a
dependency tree.
Hi,
One very useful feature in RequireJS is the ability to hook into the
dependency tree through the onResourceLoad API.
Currently, the way the link function is designed for ES6 modules, there is
no way for a loader to discover the imports for a given module.
If there was some way to allow some insight into the link output (since
internally the link object with the import list is constructed anyway),
this would be incredibly useful for using the loader to construct
dependency graphs.
Perhaps, simply allow the custom loader to call the native link function
with something like the following:
new Loader({
link: function(name, source) {
return Loader.link(name, source);
}
});
where Loader.link is the native linking function exposed through the Loader
global. This way the link output can be intercepted and used to create a
dependency tree.
Guy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130626/521458aa/attachment.html>
One very useful feature in RequireJS is the ability to hook into the dependency tree through the onResourceLoad API.
Currently, the way the link function is designed for ES6 modules, there is no way for a loader to discover the imports for a given module.
If there was some way to allow some insight into the link output (since internally the link object with the import list is constructed anyway), this would be incredibly useful for using the loader to construct dependency graphs.
Perhaps, simply allow the custom loader to call the native link function with something like the following:
new Loader({ link: function(name, source) { return Loader.link(name, source); } });
where Loader.link is the native linking function exposed through the Loader global. This way the link output can be intercepted and used to create a dependency tree.