Repository navigation
Commit d5a9ea8
committed
fix(javascript): read a comment's line break as terser's tokenizer does
terser steps over a comment's own characters before it makes the token, so a
block comment holding a line break reads as having one before it; webpack's
parse read only the gap ahead of it, and wrote `!/*!…` where terser puts the
`!` on a line of its own. A parenthesis hands its break to the first comment
inside it only where it holds no comment of its own, as terser's parser has
it, and a block comment is read with its breaks spelled `\n`.
The swc corpus differed over `projects/files` and `benches-full`, where each
library's banner comment is followed by `(function (…) {`; all nine print
byte for byte terser's again.1 parent 5f281e9 commit d5a9ea8
2 files changed
Lines changed: 62 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14668 | 14668 | | |
14669 | 14669 | | |
14670 | 14670 | | |
14671 | | - | |
| 14671 | + | |
| 14672 | + | |
| 14673 | + | |
14672 | 14674 | | |
14673 | 14675 | | |
14674 | 14676 | | |
| |||
16725 | 16727 | | |
16726 | 16728 | | |
16727 | 16729 | | |
| 16730 | + | |
| 16731 | + | |
| 16732 | + | |
| 16733 | + | |
| 16734 | + | |
| 16735 | + | |
| 16736 | + | |
| 16737 | + | |
| 16738 | + | |
16728 | 16739 | | |
16729 | 16740 | | |
16730 | 16741 | | |
16731 | | - | |
| 16742 | + | |
16732 | 16743 | | |
16733 | | - | |
| 16744 | + | |
16734 | 16745 | | |
16735 | 16746 | | |
16736 | | - | |
16737 | | - | |
16738 | | - | |
16739 | 16747 | | |
16740 | 16748 | | |
16741 | 16749 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1680 | 1680 | | |
1681 | 1681 | | |
1682 | 1682 | | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
1683 | 1731 | | |
1684 | 1732 | | |
1685 | 1733 | | |
| |||
0 commit comments