broccolijs / broccoli-plugin

Base class for Broccoli plugins
MIT License
25 stars 25 forks source link

How do we handle dependencies that are not within the input tree? #12

Closed elldritch closed 4 years ago

elldritch commented 8 years ago

Let's say I'm writing a plugin for a preprocessor language of my choice which can import files by relative file path. My directory layout looks like:

root/
  lib/
    other.file
  src/
    main.file

and main.file imports other.file and I need to compile the tree rooted at root/src. What is the recommended behaviour in this case?

My plugin doesn't know what the original path of main.file is -- it only knows the path to its input nodes (which are in tmp). In this case, it can't find other.file (which is being imported as e.g. ../lib/other.file). Is the intended behaviour for the compilation to fail? Is there a way we can get the original file paths, or annotate the input nodes with those paths?

stefanpenner commented 4 years ago

For now, we recommend only consuming files from an input tree.