feat(node-resolve): expose plugin version #1050
Merged
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.
Rollup Plugin Name:
node-resolve
This PR contains:
Are tests included?
Breaking Changes?
If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers:
#1038
Description
In the course of #1038, we discovered that we actually can have a peer-dependency-like situation between the commonjs plugin and the node-resolve plugin: If the new commonjs version is used together with a node-resolve version older than 13.0.6, then we would like to throw an error.
Unfortunately while it is easy to discover that the node-resolve plugin is used by inspecting build options, it is close to impossible to discover its actual version.
This PR does something very simple: It fetches the plugin version from the package.json file and attaches it as a
version
property to the plugin so that other plugins can inspect it.This could serve as a pattern for other plugins as well. E.g. I am also attaching a version property to the commonjs plugin in #1038.
To ease the release of #1038, I would see having something like this in node-resolve as blocking for the release of #1038. If we want to recommend this pattern to others, I am also considering to include a recommendation in the "plugin communication" section of the official Rollup docs.