turborepo
a6f92743 - Support NeedData responses in SourceMap/SourceMapTrace ContentSources (#3907)

Commit
3 years ago
Support NeedData responses in SourceMap/SourceMapTrace ContentSources (#3907) This implements a new `ContentSourceProcessor` trait and `WrappedContentSource` struct that allows our `ContentSource`s to register some processor to transform the eventual `ContentSourceContent` that an inner `ContentSource` returns. Yah, it's a bit of a mouthful with lots of very similar sounding names. Essentially, the old `SourceMapContentSource` and `NextSourceMapTraceContentSource` wrapped some inner `ContentSource`, and would request content from them, and process that content into a source map JSON or trace JSON. But, they didn't implement the `NeedData` response, so it only supported very primitive inner content sources. This PR extracts that knowledge into a single `WrappedContentSource`, which will recursively wrap every `ContentSourceResult` until we land on a fully resolved `ContentSourceResult::Result`. At that point, it hands off the work to a `WrappedGetContentSource`, which performs the processing on whatever content is returned by the inner `GetContentSourceContent`. If you can't tell yet, I'm making the description intentionally verbose to highlight just how similar our struct/trait names are. Fixes WEB-614
Author
Parents
Loading