Ensure styles tree has been processed before checking its outputPath#239
Ensure styles tree has been processed before checking its outputPath#239rwjblue wants to merge 1 commit intosalsify:masterfrom
Conversation
dfreeman
left a comment
There was a problem hiding this comment.
Thanks @rwjblue! There are any number of questionable reaching-across-boundaries situations like this in ECM, so it's nice to at least have this one shored up 🙂
I may be mis-diagnosing, but with your change in broccolijs/broccoli-funnel#146 it looks like passing additional trees to Funnel's constructor may have more of an impact than just affecting the shape of the node graph, since this.input in the plugin now contains additional files. Any thoughts there?
| constructor(input, stylesTree, options) { | ||
| super(input, options); | ||
| this.stylesTree = stylesTree; | ||
| super([input, stylesTree], options); |
There was a problem hiding this comment.
Just based on my own understanding, I would have expected the change you made to Funnel to work exactly how you described, but it looks like this does end up having an effect on the base class's behavior.
I haven't dived super deep, but I'm seeing contents from both trees show up in this.input.entries(...), which seems to cause the funnel to try and lstat an ultimately nonexistent file from the second input tree.
There was a problem hiding this comment.
Ya, this is definitely true. I replicated that specific error and fixed it over in broccolijs/broccoli-funnel#147.
There was a problem hiding this comment.
I've updated this PR with that change, which should avoid the error we see in CI.
| "broccoli-concat": "^3.2.2", | ||
| "broccoli-css-modules": "^0.7.0 || ^0.8.0", | ||
| "broccoli-funnel": "^2.0.1", | ||
| "broccoli-funnel": "^3.0.7", |
There was a problem hiding this comment.
Will need to ponder a bit what this means for semver, since ECM hasn't cut a major since Node 6 was still supported. Pragmatically Node 6 and 8 are both more than a year out of maintenance support themselves and I hope no one is using them, but letter of the law dropping support for them should probably mean a major bump here, which would be a bit of a pain.
There was a problem hiding this comment.
Ya, sorry about that. I might be able to backport these changes to the 2.x branch of broccoli-funnel, but I don't even know if our CI works that far back at this point.
Prior to this change, the `ModuleSourceFunnel` would assume that the passed in `stylesTree` has been processed when its `build` hook was called. This _happened_ to work in some cases, but since Broccoli builder uses a DAG to decide what order to build trees in it absolutely could find a different sort order that causes `ModuleSourceFunnel` to run before that styles tree. As part of this, I updated broccoli-funnel to allow `super`ing with either a single node (prior behavior) or an array. broccoli-funnel itself will never look at ainputs other than `inputPath[0]` but this is useful to ensure the broccoli node graph indicates the required ordering.
acf0182 to
9f135e9
Compare
Prior to this change, the
ModuleSourceFunnelwould assume that the passed instylesTreehas been processed when itsbuildhook was called. This happened to work in some cases, but since Broccoli builder uses a DAG to decide what order to build trees in it absolutely could find a different sort order that causesModuleSourceFunnelto run before that styles tree.As part of this, I updated broccoli-funnel to allow
supering with either a single node (prior behavior) or an array (broccolijs/broccoli-funnel#146). broccoli-funnel itself will never look at ainputs other thaninputPath[0]but this is useful to ensure the broccoli node graph indicates the required ordering.This fixes an error in Embroider builds where ember-css-modules is a child of an engine. The error you might get in that scenario is: