Allow media queries nested in pseudo element selectors
Fixes: https://github.com/evanw/esbuild/issues/4164
Please note that I used AI to create the solution. From what I can tell from my limited understanding of Go this solution makes sense. What I can not determine:
- Is the function I added the best way of achieving this result?
- Is this in line with your style of writing Go?
- Should the function be in that specific file?
- Did I miss any test cases for subtle interaction with other features?
This change fixes the following use case:
input
a {
&::before {
@media screen {
...
}
}
}
before
@media screen {
{
...
}
}
after
@media screen {
&::before {
...
}
}
@evanw Any chance you can review this?
Annoying bug, I also have the same problem in my project, so it would be great to see a fix finally implemented. Thanks @EECOLOR for explaining the source of the problem.
I'm closing this because I believe it was fixed by the fix for #4265, which was released in version 0.25.10.
@evanw Thanks! As soon as I have time I will verify it. https://github.com/evanw/esbuild/issues/4164 has a more complete test case, so if it indeed fixes that problem I will close that ticket as well.
I will let you know if it does not solve the problem.