fix(css): inject inlined CSS after the shebang line - #22717
Merged
sapphi-red merged 2 commits intoJul 2, 2026
Merged
Conversation
shulaoda
marked this pull request as draft
June 19, 2026 12:28
shulaoda
marked this pull request as ready for review
June 19, 2026 13:00
bluwy
approved these changes
Jun 30, 2026
…ter_the_shebang_line
sapphi-red
approved these changes
Jul 2, 2026
For
es-format chunks that start with a shebang,injectInlinedCSSinserted the CSS-injection code into the shebang line instead of after it.Problem
\n, ands.appendRight(index, ...)inserts before that character — i.e. at the end of the shebang line.#!/usr/bin/env node\n<body>:#!/usr/bin/env nodeinjectCSS();\n<body>.#!...line as a hashbang comment, so the appended injection code is dropped — the inlined CSS is never injected.= 0) was also wrong: it prepended the code before the shebang.Fix
newlinePos + 1), matching howimportAnalysisBuild.tshandles the same case (indexOf('\n') + 1).\n+ the injection so the shebang stays on its own line.Tests
es-format cases for: shebang, no shebang (regression guard), and shebang without a trailing newline. The shebang cases fail without this change and pass with it.