defunctzombie / node-url

node.js core url module as a module
MIT License
375 stars 96 forks source link

WHATWG URL support #33

Open stevenvachon opened 7 years ago

stevenvachon commented 7 years ago

was added as an experimental feature in Node 7.0, which will become official in 8.x

I'm working on these to help: hasurl, isurl, universal-url

felixfbecker commented 7 years ago

https://github.com/jsdom/whatwg-url seems to be the most active

stevenvachon commented 7 years ago

That's what universal-url uses, and also provides universal-url-lite for file size control.

CMCDragonkai commented 6 years ago

Making the url name on npm use the latest node style URL or whatwg-url would make it much easier to do polyfills, since you can always just write import { URL } from 'url';, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this current url package does not expose the URL constructor in accordance to whatwg url and the browser's window.URL.

@stevenvachon Thanks for pointing out universal-url project to me, it looks like I can make do with this for now.

gwiron commented 6 years ago

thanks for your reply

On 09/13/2017 16:02, Roger Qiu wrote: Making the url name on npm use the latest node style URL or whatwg-url would make it much easier to do polyfills, since you can always just write import { URL } from 'url';, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this current url package does not expose the URL constructor in accordance to whatwg url and the browser's window.URL.

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/defunctzombie/node-url","title":"defunctzombie/node-url","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/defunctzombie/node-url"}},"updates":{"snippets":[{"icon":"PERSON","message":"@CMCDragonkai in #33: Making the url name on npm use the latest node style URL or whatwg-url would make it much easier to do polyfills, since you can always just write import { URL } from 'url';, and if it is node that will use the builtin version, while if it is in non-node environment, that will use the polyfill. I was hoping to be able to do this, but this current url package does not expose the URL constructor in accordance to whatwg url and the browser's window.URL."}],"action":{"name":"View Issue","url":"https://github.com/defunctzombie/node-url/issues/33#issuecomment-329090162"}}}

sheepsteak commented 6 years ago

Is it worth depending on url-polyfill and re-exporting URL and URLSearchParams?

It seems to be a small polyfill although it doesn't claim to have 100% support of the API.

stevenvachon commented 5 years ago

http in Node.js v11 uses URL under the hood by default.

ljharb commented 3 years ago

Does node's url module support this? If so, great! A PR would be appreciated. If not, we can't add this feature, and this should be closed, in favor of a feature request on node itself.

ljharb commented 3 years ago

Looks like the URL property was added sometime in node 6 (between v6.6, where it's absent, and v6.17, where it's present) so we'll add it as we catch up to that featureset.

stevenvachon commented 3 years ago

I remember it being added in v7, then back-ported to v6. I'm not sure if v6 has globalThis.URL or only has require('node').URL.