-
Notifications
You must be signed in to change notification settings - Fork 914
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(load): resolve plugins correctly if provided as relative or absolute path #2401
Conversation
633953e
to
1a982fa
Compare
let normalizedName = name; | ||
|
||
if ( | ||
path.isAbsolute(name) || |
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.
https://nodejs.org/api/path.html#path_path_isabsolute_path
For example, on POSIX:
path.isAbsolute('/foo/bar'); // true path.isAbsolute('/baz/..'); // true path.isAbsolute('qux/'); // false path.isAbsolute('.'); // falseOn Windows:
path.isAbsolute('//server'); // true path.isAbsolute('\\\\server'); // true path.isAbsolute('C:/foo/..'); // true path.isAbsolute('C:\\foo\\..'); // true path.isAbsolute('bar\\baz'); // false path.isAbsolute('bar/baz'); // false path.isAbsolute('.'); // false
name.startsWith('./') || | ||
name.startsWith('../') || | ||
name.startsWith('.\\') || | ||
name.startsWith('..\\') |
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.
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.
True, personally I like the readability of the current code as long as won't grow to more cases.
5d6dc4f
to
0803cf6
Compare
0803cf6
to
012121f
Compare
I'm no longer sure about this change, user should just |
Hm, as you mentioned this works:
I think it's fine to point out in the docs to use this and not paths directly in the array. Seems cleaner to me. |
ok, than i'm going to close this PR, as those changes seem less stable compared to providing functions dirrectly |
Description
fixes #932
Motivation and Context
Usage examples
How Has This Been Tested?
Unit tests
Types of changes
Checklist: