-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 meta property and rollupVersion to plugin context #2394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look at this.
It might be more convenient to have this information available to all hooks through the plugin context - this.rollupVersion
or similar perhaps?
I can definitely take a look at going that route. I'm a big fan of the |
I'd be happy with that. |
@guybedford changes made, tests passed locally. ESLint was responsible for the whitespace changes in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
What else do you see this meta containing in future?
@@ -6,7 +6,7 @@ module.exports = { | |||
options: { | |||
plugins: [ | |||
{ | |||
options(options) { | |||
options(options, meta) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should no longer be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that sneaky bugger. Uno momento por favor.
Lot's of opportunity for hypotheticals, might include:
Mostly I've used |
Currently we have a Not at all debating - just trying to think about what info might be provided so that we can make sure the convention can scale well. |
No worries. We can let this marinate for a bit too. |
Very nice, this could really help in migrating plugins to new APIs by allowing them to support an old API in parallel. Some thoughts and questions:
|
I really hate that the plugin API lives in the wiki, because I always forget that the wiki even exists now that it's been 99% deprecated. |
@tivac I'm absolutely planning to merge that to the main docs repo this week. @lukastaegert I agree that it should only contain static data. That's always my intention when I use that moniker. And the ideas around perf data seem reasonable to me. I'll also update the wiki before this is merged. (and following, will be a PR on the docs site to move the plugin info) Can we get a second approval to knock this one home? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a second approval to knock this one home?
You totally got my approval, just wanted to clear this up before merging this. That being said, please merge at your own discretion 😉
Thanks @lukastaegert I'll work on the documentation later tonight or tomorrow. Keep an eye out for that one. |
This PR contains:
Breaking Changes?
If yes, please describe the breakage.
Please Describe Your Changes
This resolves #1374
by changing the signature of theby adding aoptions
hook to accept a second parameter namedmeta
which currently will contain{ version: string }
.meta
property to a plugin context (this
within hooks), which containsrollupVersion
as suggested.I ended up piggy backing on the test
that checks thewhich checks validity ofoptions
hook can effectinputOptions
. If there's a better place for that, I'm all for it.buildStart
andbuildEnd
hooks. The filename is just plain oldhooks
, so it seemed an apt place for them. (This is probably a case of the tests needing a bit of spring cleaning.)