Commit 2cc19f7
committed
fix(rsc): prevent catastrophic backtracking in directive regex
The regular expression used to preserve "use client" and "use server" directives was flawed and could backtrack into single-line comments that contained string literal characters. This resulted in the virtual CSS import being injected inside comments or invalid positions, causing syntax errors in files with URL queries like `?url` or `?raw` (e.g. static-assets tests).
This fix changes the comment and string literal matching to prevent backtracking and ensures we only match true top-level string directives.1 parent 2947f81 commit 2cc19f7
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
0 commit comments