Commit 0998c93
fix(es/codegen): Restore missing top-level comments (#11302)
This fixes an issue where top-level comments (like copyright headers)
were being lost after PR #11199 changed Module/Script spans to start at
position 0.
The fix skips emitting leading comments at Module/Script level when the
body is non-empty. Instead, comments are emitted by the first body item
with a real source span. Injected imports have DUMMY_SP, so they skip
comment emission, and original source items emit their comments
correctly after the imports.
Closes #11167
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Donny/강동윤 <[email protected]>1 parent 0fc7496 commit 0998c93
File tree
3,460 files changed
+3587
-3540
lines changed- .changeset
- crates
- swc_ecma_codegen/src
- swc_ecma_minifier
- src
- tests
- benches-full
- fixture
- issues
- 10054
- for
- if
- 10539
- 3256/2
- emotion/react/2
- member_expr
- array_side_effects
- array
- object_side_effects
- swc_ecma_parser
- src/parser
- tests
- comments
- exprs/paren-pure
- 1
- 2
- 3
- issue-4876
- js
- issue-10724
- source-phase-imports
- dynamic-import-comments
- dynamic-import-options-comments
- import-source-comments
- span
- js/srcmap/2
- ts/decl
- tsc
- swc/tests/tsc-references
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
3,460 files changed
+3587
-3540
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
0 commit comments