`data-style-src` does not respect `inputSourceMap`
Describe the issue
Hi,
When a file that already has been preprocessed is fed to the StyleX babel plugin, the plugin emits data-style-src with the file and line from the already processed file.
Expected behavior
The plugin should look a the source map and provide the file and line from the original source code in data-style-src, not some intermediary state.
Steps to reproduce
Create a file using StyleX and something requiring rewrite of the source code, such as react.
Process the JSX using babel, get a source map out of it.
Call babel a second time, this time to process StyleX, pass the source map generated in the first call as inputSourceMap when calling babel's transformAsync.
Source and line number emitted for data-style-src correspond to the one in the intermediate state of the file, not it's original state.
Test case
No response
Additional comments
No response
While this is a valid feature request, can I ask what your build setup is?
Generally, it should not be necessary to compile StyleX in a separate Babel pass than the rest of your transforms which would make this a non-issue for most use-cases.
And when used as a separate Babel pass, it's usually best practice to run StyleX before other transforms that could simplify the output from the StyleX compiler.
I'm using StyleX within a Vite project. Vite does not handle babel directly and won't use it if not necessary. Transforms involving babel are down through rollup plugins.
Note that the rollup example in this very repo has the same issue where it'll emit erroneous line numbers if there is a previous rollup plugin doing another transform.
We’ve also got the same problem :( @nmn would be open to accepting a PR if I can get the team here to fix it?