Support URL as cwd#201
Conversation
|
I would prefer not to introduce a dependency for this. I have worked very hard in the past year to reduce the amount of dependencies I use. In this case, it's really just |
|
I think Node.js should expose a method for this. It's such a common need now that everything is starting to support |
|
|
|
Removed dependency, and added test for |
I think this is a temporary need. Once everything supports |
No, there will always be a need as your argument only works if you directly pass the input to a Node.js API. Many packages manipulate the paths somehow and dealing with path and not URL is much nicer then. |
|
|
||
| export interface GitignoreOptions { | ||
| readonly cwd?: string; | ||
| readonly cwd?: URL | string; |
There was a problem hiding this comment.
URL interface belongs to lib.dom.d.ts, so now we force TS users to inject compilerOptions.lib: ['dom'] to resolve URL as global. It breaks TS builds and formally this is a breaking change.
[build:es6 ] ../../node_modules/globby/index.d.ts(54,17): error TS2304: Cannot find name 'URL'.
[build:es6 ] ../../node_modules/globby/index.d.ts(58,17): error TS2304: Cannot find name 'URL'.
[build:es6 ] ../../node_modules/globby/index.d.ts(162,18): error TS2304: Cannot find name 'URL'.
There was a problem hiding this comment.
There was a problem hiding this comment.
Otherwise it should be explicitly imported in index.d.ts. It does not belong to global by default.
There was a problem hiding this comment.
@sindresorhus
I really don't want to fix hundreds of our globby@^12-dependant projects all night )). Could you plz roll the patch #206?
There was a problem hiding this comment.
I'm sorry for breaking your projects, but I know nothing about the typing, I can't help.
I build
url-or-pathfew months ago, it actually acceptpath,URLandURL.href, should we add test forURL.hreftoo?Fixes #176