fix: postBanner content should be placed after shebang#7583
fix: postBanner content should be placed after shebang#7583hyf0 merged 6 commits intorolldown:mainfrom
postBanner content should be placed after shebang#7583Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical issue where postBanner content was being inserted before the shebang line in generated output files, which would cause execution errors since shebangs must be the first line in a file.
Key Changes:
- Modified the banner/footer insertion logic to detect and preserve shebang positioning
- Added shebang extraction logic that identifies
#!prefixed lines and ensures they remain first - Added test coverage for the shebang + postBanner scenario
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
crates/rolldown/src/stages/generate_stage/post_banner_footer.rs |
Implements shebang detection and ensures output order is: shebang → postBanner → content → postFooter |
packages/rolldown/tests/fixtures/function/post-banner/shebang/_config.ts |
Adds test case to verify postBanner is placed after shebang |
packages/rolldown/tests/fixtures/function/post-banner/shebang/main.js |
Test fixture file containing a shebang line |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/rolldown/src/stages/generate_stage/post_banner_footer.rs
Outdated
Show resolved
Hide resolved
crates/rolldown/src/stages/generate_stage/post_banner_footer.rs
Outdated
Show resolved
Hide resolved
packages/rolldown/tests/fixtures/function/post-banner/shebang/_config.ts
Outdated
Show resolved
Hide resolved
|
@sapphi-red Do you think this's reasonaoble? If it does, then we start to talk about the implementation. |
|
I think it's reasonable. Since it's not allowed to have any code/comments above the shebang, I think we should inject after the shebang. It also aligns with |
|
I was thinking if it breaks users' intuition here? So this feature is for cases like the orignal code contains shebang and you want to apply a postBanner without breaking it. @btea What's the real world situation will this feature apply to? |
For example, when building a project using the lib mode of the latest beta version of vite, there is a shebang message at the top of the entry file. If I add a version number comment at the top of the file using |
|
Let me try to clarify the expected behaviors:
I'm personally in favor of content of |
I would expect the content of |
With looking into esbuild's behavior, If the code and postBanner both contain shebang, we just place It's users' responsibility to remove |
I agree. I don't think it's necessary to make any further judgments. |
|
@btea Could you modify the PR following the above clarifictions? |
|
It's fine to keep the duplicate shebang, but I think we should have a warning. Since |
If I understand correctly, the current modifications should conform to the logic described above. 🤔 |
crates/rolldown/src/stages/generate_stage/post_banner_footer.rs
Outdated
Show resolved
Hide resolved
crates/rolldown/src/stages/generate_stage/post_banner_footer.rs
Outdated
Show resolved
Hide resolved
crates/rolldown/src/stages/generate_stage/post_banner_footer.rs
Outdated
Show resolved
Hide resolved
packages/rolldown/tests/fixtures/function/post-banner/shebang/_config.ts
Outdated
Show resolved
Hide resolved
|
Also leave the warning implemenntation in another PR if you want to do it. If not, I'm gonna just create an issue and leave it there. |
I don't want to deal with it in this PR; it seems more complicated than I expected. we could create an issue first. |
postBanner content should be after shebangpostBanner content should be placed after shebang
967615a to
2e9fc21
Compare
✅ Deploy Preview for rolldown-rs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Even I found #7608, I'm gonna merge the PR still, Because the issue will only happen when shebang exist and |
e172cdf to
2abdd8c
Compare
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
## [1.0.0-beta.56] - 2025-12-22 ### 💥 BREAKING CHANGES - rename `MIXED_EXPORT` error to `MIXED_EXPORTS` (#7565) by @sapphi-red ### 🚀 Features - rename `id` property to `exporter` in CIRCULAR_REEXPORT error (#7592) by @sapphi-red - add `ids` property to `CIRCULAR_DEPENDENCY` error (#7591) by @sapphi-red - node/dev: expose `devMode.lazy` (#7549) by @hyf0 - set log and pos properties for `parseAst` function errors (#7568) by @sapphi-red - set log and pos properties for logs (#7567) by @sapphi-red - test-dev-sever: support to manually configure port, run tests in concurrent (#7576) by @hyf0 - add `exporter` property to `MISSING_EXPORT` error (#7564) by @sapphi-red - add `id` property to `PARSE_ERROR` error (#7563) by @sapphi-red - support ImporterId hook filter (#7540) by @IWANABETHATGUY ### 🐛 Bug Fixes - types: better "go to definition" experience for interface `OutputPlugin` (#7610) by @KazariEX - `postBanner` content should be placed after shebang (#7583) by @btea - use sanitized filename for preserve modules chunk name (#7603) by @IWANABETHATGUY - correct filter out unused cjs namespace (#7602) by @IWANABETHATGUY - watch: property respect `notify.pollInternal` and `notify.compareContents` (#7595) by @sapphi-red - make `cleanDir` work with default output directory (#7579) by @shulaoda - merge `MISSING_NAME_OPTION_FOR_UMD_EXPORT` error to `MISSING_NAME_OPTION_FOR_IIFE_EXPORT` error (#7566) by @sapphi-red - dev/hmr: ensure cjs modules with no exports reference correct `module` identifier (#7544) by @leegeunhyeok ### 🚜 Refactor - remove `stable_id` field from `PARSE_ERROR` error (#7593) by @sapphi-red - make include_runtime_symbol reuseable after linking stage (#7580) by @IWANABETHATGUY - rust/dev: construct the bundler within itself (#7553) by @hyf0 - rust/watcher: polish API of `Watcher` struct (#7551) by @hyf0 - use `LinkingMetadata::stmt_info_included` to check if a stmt_info is included (#7572) by @IWANABETHATGUY - use `LinkingMetadata::is_included` to check if a module is included (#7571) by @IWANABETHATGUY - store module and stmt_info is included info to module meta (#7570) by @IWANABETHATGUY - make include_* method reunsable after linking stage (#7552) by @IWANABETHATGUY - rust/watcher: construct the bundler within watcher itself (#7550) by @hyf0 - extract make include_runtime_symbol reusable (#7546) by @IWANABETHATGUY ### ⚙️ Miscellaneous Tasks - renovate: add `kill-port` in `ignoreDeps` in renovate.json (#7619) by @sapphi-red - deps: update rust crates (#7617) by @renovate[bot] - deps: update npm packages (#7616) by @renovate[bot] - deps: update github-actions (#7615) by @renovate[bot] - ci: skip benchmark workflows on draft PRs (#7611) by @Copilot - deps: update dependency rolldown-plugin-dts to ^0.19.0 (#7607) by @renovate[bot] - deps: update dependency oxlint-tsgolint to v0.10.0 (#7601) by @renovate[bot] - deps: update dependency rolldown-plugin-dts to v0.18.4 (#7599) by @renovate[bot] - deps: update notify (#7594) by @sapphi-red - test-dev-server: add retry mechanism to hmr-full-bundle-mode tests (#7588) by @Copilot - deps: update napi to v3.7.1 (#7590) by @renovate[bot] - add JSDoc documentation for memfs type (#7587) by @Copilot - deps: update dependency oxlint to v1.34.0 (#7589) by @renovate[bot] - move some tests in ignored-by-unsupported-features that are passing (#7569) by @sapphi-red - deps: update dependency oxlint-tsgolint to v0.9.2 (#7582) by @renovate[bot] - deps: update oxc resolver to v11.16.0 (#7574) by @renovate[bot] - test/dev-server: don't run `pnpm install` during tests (#7560) by @hyf0 - test/dev-server: use `kill-port@1` to improve performance (#7575) by @hyf0 - normalize error object to make some Rollup tests pass (#7562) by @sapphi-red - ci: separate dev-server(hmr) tests and normal tests (#7558) by @hyf0 - ci: make native rolldown build reusable (#7557) by @hyf0 - resolve some TODOs (#7561) by @sapphi-red ### ❤️ New Contributors * @KazariEX made their first contribution in [#7610](#7610) * @leegeunhyeok made their first contribution in [#7544](#7544) Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [rolldown-plugin-dts](https://redirect.github.com/sxzz/rolldown-plugin-dts) | [`^0.18.0` -> `^0.19.0`](https://renovatebot.com/diffs/npm/rolldown-plugin-dts/0.18.4/0.19.1) |  |  |  |  | --- <details> <summary>sxzz/rolldown-plugin-dts (rolldown-plugin-dts)</summary> [`v0.19.1`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.1) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) - Remove unused dep - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(430a0)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/430a0b6) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.19.0...v0.19.1) [`v0.19.0`](https://redirect.github.com/sxzz/rolldown-plugin-dts/releases/tag/v0.19.0) [Compare Source](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) - Drop `banner` / `footer` - by [@​sxzz](https://redirect.github.com/sxzz) [<samp>(56403)</samp>](https://redirect.github.com/sxzz/rolldown-plugin-dts/commit/5640374) GitHub](https://redirect.github.com/sxzz/rolldown-plugin-dts/compare/v0.18.4...v0.19.0) </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rolldown/rolldown). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: `postBanner` content should be placed after shebang (#7583) The content generated by `postBanner` should be after the shebang; otherwise, it will cause file errors. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com> fix(types): better "go to definition" experience for interface `OutputPlugin` (#7610) Signed-off-by: Yunfei He <i.heyunfei@gmail.com> Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
## Summary Implements the feature requested in #7583 (comment) This PR adds a warning when both the source code and `postBanner` contain shebang lines. ## Changes - [x] Add `DuplicateShebang` event kind to `EventKind` enum - [x] Create new `duplicate_shebang.rs` event module - [x] Update `mod.rs` to export the new event - [x] Update `constructors.rs` to add constructor for DuplicateShebang - [x] Modify `post_banner_footer.rs` to detect duplicate shebangs and emit warning - [x] Add test case for duplicate shebang scenario - [x] Run tests to verify the implementation - ✅ All tests pass - [x] Run code review and address feedback - [x] Address PR review feedback - [x] Run format and generator - [x] Fix lint and update CLI snapshot - [x] Update JS snapshots - [x] Fix test to run sequentially ## Behavior When both source code and `postBanner` contain shebang: - ✅ Original shebang preserved as first line - ✅ postBanner placed after shebang (per PR #7583) - ✅ Warning emitted: `[DUPLICATE_SHEBANG] Warning: Both the code and postBanner contain shebang in "main.js". This will cause a syntax error.` ## Example **Input file:** ```javascript #!/usr/bin/env node console.log('hello'); ``` **postBanner:** ```javascript #!/usr/bin/env bun /* Version 1.0.0 */ ``` **Output:** ```javascript #!/usr/bin/env node #!/usr/bin/env bun /* Version 1.0.0 */ console.log('hello'); ``` **Warning:** ``` [DUPLICATE_SHEBANG] Warning: Both the code and postBanner contain shebang in "main.js". This will cause a syntax error. ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
## Summary Implements the feature requested in #7583 (comment) This PR adds a warning when both the source code and `postBanner` contain shebang lines. ## Changes - [x] Add `DuplicateShebang` event kind to `EventKind` enum - [x] Create new `duplicate_shebang.rs` event module - [x] Update `mod.rs` to export the new event - [x] Update `constructors.rs` to add constructor for DuplicateShebang - [x] Modify `post_banner_footer.rs` to detect duplicate shebangs and emit warning - [x] Add test case for duplicate shebang scenario - [x] Run tests to verify the implementation - ✅ All tests pass - [x] Run code review and address feedback - [x] Address PR review feedback - [x] Run format and generator - [x] Fix lint and update CLI snapshot - [x] Update JS snapshots - [x] Fix test to run sequentially ## Behavior When both source code and `postBanner` contain shebang: - ✅ Original shebang preserved as first line - ✅ postBanner placed after shebang (per PR #7583) - ✅ Warning emitted: `[DUPLICATE_SHEBANG] Warning: Both the code and postBanner contain shebang in "main.js". This will cause a syntax error.` ## Example **Input file:** ```javascript #!/usr/bin/env node console.log('hello'); ``` **postBanner:** ```javascript #!/usr/bin/env bun /* Version 1.0.0 */ ``` **Output:** ```javascript #!/usr/bin/env node #!/usr/bin/env bun /* Version 1.0.0 */ console.log('hello'); ``` **Warning:** ``` [DUPLICATE_SHEBANG] Warning: Both the code and postBanner contain shebang in "main.js". This will cause a syntax error. ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
…ang (#8459) When `postBanner`/`postFooter` is combined with a source file containing a shebang, the output sourcemap's generated line numbers are off by 1. **Root cause**: `post_banner_footer` splits chunk content into the shebang and `rest_content`, attaching the original sourcemap to `rest_content`. The sourcemap was generated for the full content (shebang at line 0), so all token `dst_line` values are 1-indexed relative to `rest_content`. `SourceJoiner`'s `line_offset` then compounds the error rather than correcting it. **Changes** - **`crates/rolldown_sourcemap/src/lib.rs`**: Add `adjust_sourcemap_dst_lines(sourcemap, subtract)` — creates an adjusted sourcemap with all token `dst_line` values decremented by `subtract`. - **`crates/rolldown/src/stages/generate_stage/post_banner_footer.rs`**: When a shebang is present and a sourcemap exists, call `adjust_sourcemap_dst_lines(source_map, 1)` before handing the map to `SourceJoiner`, so the map is correctly anchored to `rest_content`'s line 0. - **`packages/rolldown/tests/fixtures/function/post-banner/sourcemap-with-shebang/`**: New test fixture asserting correct sourcemap mappings when `postBanner` is used with a shebang-bearing entry. **Example** — with `postBanner: '/* banner */'` and entry `#!/usr/bin/env node\nconsole.log('hello');`: ``` Line 0: #!/usr/bin/env node ← shebang Line 1: /* banner */ ← postBanner Line 2: //#region ... Line 3: console.log("hello"); ← sourcemap must point here, not line 4 ``` Before the fix the sourcemap mapped `console.log` to line 4; after the fix it correctly maps to line 3. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Follow up issues of `postBanner/Footer`</issue_title> > <issue_description>Caused by #7583 > > - [ ] Incorrect sourcemap #7583 (comment) > - [x] Warning for duplicate shebang https://github.com/rolldown/rolldown/pull/7583#issuecomment-3674790202</issue_description> > > <agent_instructions>Correct the incorrect postBanner/Footer sourcemap</agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@hyf0</author><body> > > I tried the latest version and found that there were extra blank lines between `postBanner` and shebang in the output. [example](https://stackblitz.com/edit/vitejs-vite-zl8hy4bz?file=package.json) > > Feel free to open a PR to fix it.</body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #7608 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/rolldown/rolldown/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
The content generated by
postBannershould be after the shebang; otherwise, it will cause file errors.