Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ensure that URL constructor is globally available #18

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

Open
vladimyr wants to merge 2 commits into GoogleChromeLabs:master
base: master
Choose a base branch
Loading
from vladimyr:node-adapter

Conversation

@vladimyr
Copy link
Contributor

@vladimyr vladimyr commented Jan 29, 2020

WHATWG URL API has been implemented since v7 but global URL constructor was added later as part of v10 release.

  • Tests pass
  • Appropriate changes to README are included in PR

WHATWG URL API has been implemented since v7 but global URL
constructor was added later as part of v10 release.
Copy link
Collaborator

Hi @vladimyr . Thanks for the PR!

Just wondering if there is a need to export URL and URLSearchParams, since we are proving methods around it? Also URL and URLSearchParams will be available globally in all cases (with the new changes).

Copy link
Contributor Author

Strictly speaking, there is no need to export it but it is neat in case you have existing node codebase and you are trying to update it by swapping usages of node's builtin url module with native-url. Due to URL and URLSearchParams being first implemented as module exports of url module and later introduced as globals it is pretty common to find snippets like this one:

const { URL } = require('url');

I understand that the primary intention of this package is to implement legacy URL API on top of WHATWG's work and not producing a replacement for the node's builtin url module. That being said node's url is literally made of WHATWG API plus legacy one. First is now globally available, the latter is being phased out. So from a practical point of view, there is a strong incentive of supporting the seamless and backward compatible transition from url to native-url.

chrissantamaria reacted with thumbs up emoji

Copy link
Contributor Author

@janicklas-ralph What do you think?

Copy link
Collaborator

Sorry about the late response! Thats a very valid point. Let me check out and test the changes before merging this

vladimyr reacted with thumbs up emoji

Copy link

roderickhsiao commented Apr 25, 2022
edited
Loading

Hi, want to check if there is some update for the changes :) We tried to globally replace node url with native-url, but found out it's common for other libraries to import constructor from the module.
Thanks!

chrissantamaria reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@janicklas-ralph janicklas-ralph Awaiting requested review from janicklas-ralph

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /