garycourt / uri-js

An RFC 3986 compliant, scheme extendable URI parsing/validating/normalizing/resolving library for JavaScript
Other
305 stars 69 forks source link

Support for earlier versions of node by downgrading dependency on punycode #27

Open ethanherbertson opened 6 years ago

ethanherbertson commented 6 years ago

The punycode module has a branch (1.4) which supports many more versions of node than the 2.x branch does.

While this module does not claim to support any particular versions of node, it would help the community if this module could downgrade to the 1.4 branch so that projects that depend on this module could continue to (safely) support node 4.

I'm not a punycoder, so I can't say for sure how much of a bother this would be, or whether you are using features that punycode v1.4 does not support.

Failing that, it would be nice if your module declared that it does not support node 4 and below in your package.json file.

garycourt commented 6 years ago

Interesting. Do you happen to know what particular feature in punycode is causing the issue? Does the ES5 version in dist/es5/uri.all.js not work in Node 4?

ethanherbertson commented 6 years ago

I'm not. To be honest I'm not sure if there IS an incompatibility (yet) with node 4 in the 2.x branch; it's possible the punycode maintainers are just being proactive about dropping explicit support for older nodes.

I can try to figure it out though. Might be a bit of effort, since I've never used punycode. But maybe they've documented the incompatibilities somewhere.

(FYI I am running into this because I'm using Yarn to install serverless/serverless under node 4.8, and Yarn by default actually hardfails for incompatible engines, unlike npm. Serverless depends on json-refs, which depends on uri-js.)

On Fri, Apr 13, 2018, 11:08 AM Gary Court notifications@github.com wrote:

Interesting. Do you happen to know what particular feature in punycode is causing the issue? Does the ES5 version in dist/es5/uri.all.js not work in Node 4?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/garycourt/uri-js/issues/27#issuecomment-381184183, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGKTP9eGfLzxqodHInCJKsgU2eA7RyNks5toM1xgaJpZM4TTqGo .

garycourt commented 6 years ago

That sounds like an issue with punycode then. I would open an issue with them inquiring about their environment dependency.

ethanherbertson commented 6 years ago

I can try filing an issue there, but they seem pretty intentional about dropping Node 4 support in their version 2 branch. Their README says:

The current version supports recent versions of Node.js only. It provides a CommonJS module and an ES6 module. For the old version that offers the same functionality with broader support, including Rhino, Ringo, Narwhal, and web browsers, see v1.4.1.

Based on that, I don't think they're going to budge. So if you want uri-js to support Node 4 (and maybe you don't—It is rapidly approaching official end-of-life status) you should downgrade your dependency. If you'd rather not support Node 4, I'd recommend at least explicitly saying what versions you do support by adding an "engines" key to your package.json.

Thanks for your quick responses to this ticket! Responsive maintainers are my favorite people.

garycourt commented 6 years ago

I see. It appears that v2 is only to drop support for older Node versions. Alright, I'll look into this.