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(pluginutils): normalizePath #550

Merged
merged 4 commits into from
Sep 10, 2020
Merged

Conversation

eight04
Copy link
Contributor

@eight04 eight04 commented Aug 20, 2020

Rollup Plugin Name: pluginutils

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

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:

Description

This PR includes:

  1. A new utility normalizePath.
  2. Fixes a bug on Windows. On Windows 10, test failed because path.resolve creates patterns including backward slash \. This patch adds a normalization similar to createFilter:
    const basePath = resolve(resolutionBase || '')
    .split(sep)
    .join('/')
  3. Small quotes typo in README.

Copy link
Member

@NotWoods NotWoods left a comment

Choose a reason for hiding this comment

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

plugin-typescript has a similar function to normalize the path. Can we make that its own pluginUtil?

@shellscape
Copy link
Collaborator

@eight04 please take a look at the last comment

@eight04
Copy link
Contributor Author

eight04 commented Sep 8, 2020

How does typescript plugin use the normalization? If it also relates to picomatch then we can add a compilePicomatch function.

Or, do you want a small util like this:

export function normalizePathSep(path) {
  return path
    .split(sep)
    .join('/');
}

@NotWoods
Copy link
Member

NotWoods commented Sep 8, 2020

Just a small util like that, although I prefer the implementation in the typescript plugin as it uses constants from node.

@eight04 eight04 changed the title fix(pluginutils): normalize pattern sep feat(pluginutils): normalizePath Sep 10, 2020
@@ -88,9 +88,9 @@ export default function myPlugin(options = {}) {
},
leave(node) {
if (node.scope) scope = scope.parent;
}
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think these were added by prettier.

@shellscape shellscape merged commit 6cd15b9 into rollup:master Sep 10, 2020
@shellscape
Copy link
Collaborator

thanks!

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.

4 participants