-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Plugins need access to rollup version and/or to plugin API version #1374
Comments
isn't this what peerDependencies are for? |
peerDependencies solve part of the problem (the biggest part) -- of requiring minimum or a range of versions. But it doesn't help with providing different functionality within that range. For example I had to do this to avoid keeling over on older rollup version: // this.context is set from transform's this
this.hasContext = _.isFunction(this.context.warn) && _.isFunction(this.context.error);
if (this.hasContext)
{
if (this.bail)
this.context.error(`${this.prefix}${message}`);
else
this.context.warn(`${this.prefix}${message}`);
}
else
console.log(`${this.prefix}${message}`); This works and is sufficient for this specific case. But there is no way to test for which plugin entry points would be called (I think intro/outro were introduced fairly recently for example). (I don't have an actual problem that would be solved btw, this is more of a nice to have for the future) |
This makes sense. Do you have a particular way of doing this in mind? One way you could presumably do it without any changes to Rollup is this: const resolved = require.resolve('rollup');
const { version } = require(`${resolved}/package.json`); |
Maybe rollup can add plugin API version (and own version) to config object it passes to |
Some plugin API changes break plugins when lower than expected rollup version is used.
For example warn()/error() on context given to transform() and any new entry point ever added.
A sane way of retrieving rollup version would help a lot. Having a plugin API version would be ideal.
The text was updated successfully, but these errors were encountered: