Companion to #21301, #21302, #20549. Coverage pragmas placed inside a TemplateLiteral expression (${ /* … */ expr }) are dropped by codegen even when the expression itself is preserved. Common in styled-components / CSS-in-JS code where each interpolation is a function and the developer wants to ignore branches inside it.
Input
const HeaderTitle = styled(Text)`
color: ${
/* v8 ignore next -- @preserve */
({ theme }) => theme.header?.mobile?.textColor || theme.global?.colors?.text
};
`
Expected output
const HeaderTitle = styled(Text)`
color: ${
/* v8 ignore next -- @preserve */
({ theme }) => theme.header?.mobile?.textColor || theme.global?.colors?.text
};
`
Actual output
const HeaderTitle = styled(Text)`
color: ${({ theme }) => theme.header?.mobile?.textColor || theme.global?.colors?.text};
`
The pragma is silently dropped.
Reproduction
import { transformSync } from 'rolldown/experimental'
const code = `const x = styled\`color: \${
/* v8 ignore next -- @preserve */ ({ theme }) => theme.color || 'black'
};\``
const r = transformSync('x.ts', code, { sourcemap: false, lang: 'ts' })
console.log(r.code.includes('v8 ignore')) // false (expected: true)
Reproduces with rolldown 1.0.0-rc.17 / oxc 0.127.0.
Companion to #21301, #21302, #20549. Coverage pragmas placed inside a
TemplateLiteralexpression (${ /* … */ expr }) are dropped by codegen even when the expression itself is preserved. Common in styled-components / CSS-in-JS code where each interpolation is a function and the developer wants to ignore branches inside it.Input
Expected output
Actual output
The pragma is silently dropped.
Reproduction
Reproduces with rolldown
1.0.0-rc.17/ oxc0.127.0.