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(alias): customResolver instead of built-in resolving algorithm #21

Merged
merged 6 commits into from
Nov 5, 2019

Conversation

Acionyx
Copy link
Contributor

@Acionyx Acionyx commented Oct 30, 2019

  • Rollup Plugin Name: alias

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
#14

Description

New feature related to my discussion with @lukastaegert.
customResolver option allows to pass plugin or function to be used instead of built-in algorithm for files resolving. Most common expected usage - together with node-resolve plugin.

According to pnpm actual version and included packages
Allow to use customResolver instead of built-in resolving algorithm in
}
]
},
customResolver
Copy link
Collaborator

Choose a reason for hiding this comment

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

this needs to be added to the ##Options and documented in the same fashion as the other options. you can then link to an expanded section like we did for the regular expressions. This section of the readme needs some error correction as well. Please give it another read through.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shellscape, please find changes in latest commit. Thanks for pointing on mistakes.

@lukastaegert
Copy link
Member

How about the suggestion to always use this.resolve instead of the new option? Sorry for not getting back to you but Twitter DMs are a BAD channel to get responses. I was on a trip and also have family. An issue or PR is ALWAYS much better as more people can have a look.

The advantage of directly using this.resolve would be that we might be able to get rid of a lot of other stuff–index.js resolution, custom extension resolution etc.

@Acionyx
Copy link
Contributor Author

Acionyx commented Oct 31, 2019

Sorry for not getting back to you but Twitter DMs are a BAD channel to get responses. I was on a trip and also have family. An issue or PR is ALWAYS much better as more people can have a look.

No worries, that's why PR was created before you have replied :) Hope you have had a nice trip.

How about the suggestion to always use this.resolve instead of the new option? The advantage of directly using this.resolve would be that we might be able to get rid of a lot of other stuff–index.js resolution, custom extension resolution etc.

It is a good idea to use this.resolve instead of built-in plugin resolving. I had no time to implement and test it accordingly yet, but i hope to do it soon. If this PR will be not merged yet, i will push changes here.

I still think that customResolver option and this.resolve using should both be presented in plugin, because using this.resolve only doesn't cover all possible use cases, e.g. when you need to make specific resolving ONLY for specific aliases. At least, it is not a synthetic situation, i have such need in my own project.

@shellscape
Copy link
Collaborator

If this PR will be not merged yet, i will push changes here.

We'll leave this open until you are ready to merge

@shellscape shellscape changed the title @rollup/plugin-alias: Allow to use customResolver instead of built-in resolving algorithm feat: customResolver instead of built-in resolving algorithm Oct 31, 2019
@shellscape shellscape changed the title feat: customResolver instead of built-in resolving algorithm feat(alias): customResolver instead of built-in resolving algorithm Oct 31, 2019
@lukastaegert
Copy link
Member

I still think that customResolver option and this.resolve using should both be presented in plugin, because using this.resolve only doesn't cover all possible use cases, e.g. when you need to make specific resolving ONLY for specific aliases. At least, it is not a synthetic situation, i have such need in my own project.

Agreed, I see there might be further use for this. In that case, I guess it makes more sense to merge this as it is and switch to using this.resolve in another PR because switching the default resolution would probably be a breaking change while the customResolve option is not.

@lukastaegert
Copy link
Member

Note that @shellscape's review comment is still valid and should be addressed before this is merged.

customResolver description
@Acionyx
Copy link
Contributor Author

Acionyx commented Nov 5, 2019

Hi, @shellscape, i've made changes according your comment.

@shellscape shellscape merged commit 9ea434d into rollup:master Nov 5, 2019
@shellscape
Copy link
Collaborator

Thanks for your work on this. We'll release this soon. We don't have automation setup for this as yet so it will require a manual publish.

@Acionyx Acionyx mentioned this pull request Nov 5, 2019
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants