Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add writeBundle hook #179

Merged
merged 9 commits into from Oct 22, 2022
Merged

feat: add writeBundle hook #179

merged 9 commits into from Oct 22, 2022

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Oct 19, 2022

This PR adds the most basic form of the writeBundle hook.

The reason for having it even in that form is that the buildEnd hook is called before any files have been written to disk and the added writeBundle hook could be used to have plugin code run after bundles have been written.

Also adds some tests to verify that the hook has run after assets have been written to disk.

@lforst
Copy link
Contributor Author

lforst commented Oct 19, 2022

I don't quite understand why the macos job is failing with:

  pnpm run build
  shell: /bin/bash -e {0}

> unplugin@0.10.0 build /Users/runner/work/unplugin/unplugin
> tsup

sh: tsup: command not found
 ELIFECYCLE  Command failed.
 WARN   Local package.json exists, but node_modules missing, did you mean to install?
Error: Process completed with exit code 1.

Maybe someone can help me out here? Ubuntu tests pass.

Edit: Nevermind, was just a flake 🤷

README.md Outdated
@@ -27,6 +27,7 @@ Currently supports:
| [`transform`](https://rollupjs.org/guide/en/#transformers) | ✅ | ✅ | ✅ | ✅ | ✅ <sup>3</sup> |
| [`watchChange`](https://rollupjs.org/guide/en/#watchchange) | ✅ | ✅ | ✅ | ✅ | ✅ |
| [`buildEnd`](https://rollupjs.org/guide/en/#buildend) | ✅ | ✅ | ✅ | ✅ | ✅ |
| [`writeBundle`](https://rollupjs.org/guide/en/#writebundle) | ✅ | ✅ | ✅ | ✅ | ✅ |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to have a note saying this hook does not pass any arguments.

Copy link
Contributor Author

@lforst lforst Oct 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I added a note in d1f9fd0.

Btw feel free to make any edits to this PR as you see fit!

@lforst lforst requested a review from antfu October 22, 2022 10:51
@antfu antfu merged commit 160ec72 into unjs:main Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants