js-loaders icon indicating copy to clipboard operation
js-loaders copied to clipboard

Module tracing

Open guybedford opened this issue 11 years ago • 3 comments

It seems the loader still doesn't expose an internal "link" method extracting the effective execute function and dependency list for an es6 source file.

If the loader does expose an internal "link" method, then it would be possible to easily write a tracer (eg https://github.com/guybedford/es6-tracer/blob/master/tracer.js#L16)

Otherwise any tracer needs to re-implement the parsing code.

Not a big deal, but making the dependency tree easily transparent allows for nicer build tool internals etc. running on a NodeJS server.

If there was anyway to expose the $GetDependencies function or something like that it would make things easier when we get there. I know it seems an edge case now, but would be useful.

guybedford avatar Nov 21 '13 15:11 guybedford

Exposing the execution of ES6 modules would also allow easy creation of post-execution hooks, which could be useful as well in future.

guybedford avatar Nov 21 '13 15:11 guybedford

Just chiming in here. This is a pretty big scenario for me and my community. I'd really love to see something like this added to the spec.

EisenbergEffect avatar Nov 21 '13 15:11 EisenbergEffect

An alternative approach would be to add a new hook here for post-instantiation.

Example:

post_instantiate_hook: function(name, imports, module) {

}

It should be trivial to add, and would allow full dependency traces, as well as module adjustments for module meta.

guybedford avatar Dec 03 '13 13:12 guybedford