Add transformBundle plugin hook - #387
Conversation
|
Ah, good point. I think it's okay to expect bundle transformers to be synchronous, rather than changing the API to be async – after all, if someone really needs to do something asynchronously, this is the one place where they can do that, since it's the last stage in the process. |
|
@Rich-Harris Do you have any test suggestions? |
There was a problem hiding this comment.
Module transformers are called with the code from the previous step, rather than a {code, map} object – I think we should stick to that, because it makes transformers a lot more straightforward. Somehow we need to figure out how to compose all the sourcemaps together 😁
There was a problem hiding this comment.
I think composing sourcemaps should to transformer. Like with uglify we just pass previous map.
There was a problem hiding this comment.
Uglify is very rare in that it accepts an input sourcemap. Sourcemaps are bewildering; expecting people to manage that complexity creates a huge burden (worrying about the sourcemaps from your own transformation step is hard enough, let alone someone else's), and in practice would mean that this hook never got used for anything except Uglify.
|
@TrySound we should probably have some sourcemap tests. Maybe we should go the whole hog and try uglifying code to check the intended use case? |
|
Fix #381 |
e786b5b to
d16d8aa
Compare
|
@Rich-Harris Let's merge this and you can rebase your branch from master. |
|
@Rich-Harris Clean commits history is good advantage for me. |
Add transformBundle plugin hook
Need to decide what to do with promises. This does not seem like a good idea.