-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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(std/node/url): add URL export #7132
Conversation
Compatibility with Node.js: ``` bash node --input-type=module -e "import { URL } from 'url'; console.log(new URL('https://deno.land'))" ``` Which Node.js outputs: ``` URL { href: 'https://deno.land/', origin: 'https://deno.land', protocol: 'https:', username: '', password: '', host: 'deno.land', hostname: 'deno.land', port: '', pathname: '/', search: '', searchParams: URLSearchParams {}, hash: '' } ```
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.
Could you add a tiny little test to std/node/url_test.ts ?
ok, give me a min |
Done. Question, do the tests load automatically, or do I need to import it somewhere? As I had to create the |
Seems I can't format it as I can't get the formater to run:
Can someone else alter the PR with the necessary changes. Update: Checked the CI logs instead, and submitted the fix. |
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.
Thanks for the test @balupton - LGTM
In Node.js,
URL
is not global, so TypeScript complains:Solution is to import
URL
from theurl
builtin module:Which can be seen to work with Node.js via:
node --input-type=module -e "import { URL } from 'url'; console.log(new URL('https://deno.land'))"
This PR adds compatibility to Deno:
Which before this PR would fail with the following:
All good for review & squash merge.