feat(5858): make closeBundle hook receive the last error#5867
Merged
lukastaegert merged 11 commits intorollup:masterfrom Mar 7, 2025
Merged
feat(5858): make closeBundle hook receive the last error#5867lukastaegert merged 11 commits intorollup:masterfrom
lukastaegert merged 11 commits intorollup:masterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5867 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 269 269
Lines 8545 8550 +5
Branches 1467 1467
=======================================
+ Hits 8421 8426 +5
Misses 92 92
Partials 32 32 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
lukastaegert
reviewed
Mar 2, 2025
Member
lukastaegert
left a comment
There was a problem hiding this comment.
This is really nice, especially the tests. One question, what do you think?
9 tasks
7fe10cd to
6d8c2f0
Compare
lukastaegert
reviewed
Mar 4, 2025
GauBen
commented
Mar 4, 2025
GauBen
commented
Mar 4, 2025
lukastaegert
approved these changes
Mar 7, 2025
Contributor
Author
|
Thanks for the review! |
|
This PR has been released as part of rollup@4.35.0. You can test it via |
97 tasks
Copilot AI
added a commit
to rolldown/rolldown
that referenced
this pull request
Dec 1, 2025
Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
shulaoda
added a commit
to rolldown/rolldown
that referenced
this pull request
Dec 6, 2025
Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
shulaoda
added a commit
to rolldown/rolldown
that referenced
this pull request
Dec 30, 2025
Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
shulaoda
added a commit
to rolldown/rolldown
that referenced
this pull request
Jan 7, 2026
Implements rollup/rollup#5867 - the `closeBundle` hook now receives the error that caused the build to fail. ### Changes **Rust core (`rolldown_plugin`):** - Add `HookCloseBundleArgs` struct mirroring `HookBuildEndArgs` - Update `Plugin::close_bundle` and `Pluginable::call_close_bundle` signatures to accept optional error args **NAPI bindings:** - Update `JsPlugin` to convert errors to `BindingError[]` format - Update TypeScript type: `(ctx: BindingPluginContext, error?: BindingError[]) => MaybePromise<VoidNullable>` **Call sites:** - `bundle.rs`: Pass errors to `close_bundle` when scan stage fails - `classic_bundler.rs`, `bundler.rs`: Pass `None` on explicit close **TypeScript API:** - Update `FunctionPluginHooks.closeBundle` signature to `(this: PluginContext, error?: Error) => void` ### Usage ```js const plugin = { name: 'example', closeBundle(error) { if (error) console.warn('Build failed:', error.message); } } ``` <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[Feature Request]: make closeBundle hook receive the last error</issue_title> > <issue_description>### What problem does this feature solve? > > ref rollup/rollup#5867 > > ### What does the proposed API look like? > > -</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> - Fixes #4364 <!-- 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). Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello!
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
closeBundlehook, if any #5858Description
The
closeBundlehook now receives the last error:If an error is thrown in
buildEnd,closeBundlewill receive this error:In case the build fails and
buildEndalso fails,closeBundlewill receive a compound error created out of both previous errors.