Commit 3e82edc
authored
Keep non-annotation comments when the processor has no plugins (#2150)
clearAnnotation() has two implementations. The AST one removes only a
comment whose text starts with `# sourceMappingURL=`, and
PreviousMap#loadAnnotation finds annotations by the same marker. The
string one, which is the only path NoWorkResult can take, searched for
`/*#` and removed every comment that began with it.
So postcss().process(css) silently deleted `/*#region */` and
`/*#endregion */` folding markers, and any other comment starting with
`#`, while the same CSS through a processor with one no-op plugin kept
them. It happens with `map` unset too, because NoWorkResult calls
clearAnnotation() unconditionally.
Searching for the whole `/*# sourceMappingURL=` marker lines the string
path up with the other two and keeps the plain string scan.
Co-authored-by: Dylan Pulver <dylanpulver@users.noreply.github.com>1 parent 6d23bc3 commit 3e82edc
2 files changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | | - | |
80 | | - | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
696 | 710 | | |
697 | 711 | | |
698 | 712 | | |
| |||
0 commit comments