accord icon indicating copy to clipboard operation
accord copied to clipboard

standardize interface for reporting dependencies of each file

Open notslang opened this issue 10 years ago • 4 comments

This will be useful in the future for telling what files affect the output of a given file. Jade already has some basic reporting for this that we could make available through an interface like this.

notslang avatar Jul 08 '14 05:07 notslang

In order to do this, I feel like the compile/render functions (in the adapters, not the base adapter) would need to return a promise for an object, rather than a promise for a string. And in that object we would have properties like deps (for the dependencies that are detected), and result (for the string that would normally be returned by the promise)

Thoughts on a better interface than this?

notslang avatar Jul 10 '14 18:07 notslang

Hmm, would it be possible to make a separate call to grab the dependencies? I feel like that would be a much better interface, but I am afraid that either not every compiler would support this and/or if they did it would mean a double compile...

jescalan avatar Jul 11 '14 06:07 jescalan

Nope - the dependencies are detected during the compilation. No compilers support getting deps through a separate method. However, I ended up putting the deps in the jobLog, so we don't need to change the return value of the promise. That way, we'd have something listening to the jobLog, and every time a new compile is done it would update the recorded deps with the value from the newest entry in the debug log.

notslang avatar Jul 11 '14 14:07 notslang

I think this can be merged with the logging?

jescalan avatar Jul 16 '14 04:07 jescalan