-
Notifications
You must be signed in to change notification settings - Fork 303
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
implement domainToASCII and domainToUnicode #2629
Conversation
c56f8ff
to
f4dea61
Compare
f4dea61
to
7035c6c
Compare
7035c6c
to
59c79e6
Compare
00b9b2e
to
6daf248
Compare
aaa3ae0
to
86803b0
Compare
64db339
to
5769495
Compare
5769495
to
2304cbb
Compare
@IgorMinar ... please take a look |
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.
LGTM
For those wondering how this PR relates to unjs/unenv#299, @anonrig clarified with me that these two methods are nearly impossible to implement in userland in a performant way. So we are implementing them natively, while other parts of node:url
could come in via unenv.
// fyi: @pi0
@pi0 ... so you know what to expect... these will be exported by the runtime as the |
Yes! except unenv will do exactly this in a new file we'll create under https://github.com/unjs/unenv/tree/main/src/runtime/node/url called Bundlers then pick up |
@anonrig ... as discussed in chat, let's make sure this is added to the test: diff --git a/src/workerd/api/node/tests/url-nodejs-test.js b/src/workerd/api/node/tests/url-nodejs-test.js
index ab683c9f..c75fbfad 100644
--- a/src/workerd/api/node/tests/url-nodejs-test.js
+++ b/src/workerd/api/node/tests/url-nodejs-test.js
@@ -77,3 +77,11 @@ export const urlAndSearchParams = {
);
},
};
+
+export const getBuiltinModule = {
+ async test() {
+ const bim = process.getBuiltinModule('node:url');
+ const url = await import('node:url');
+ strictEqual(bim, url.default);
+ }
+};
diff --git a/src/workerd/api/node/tests/url-nodejs-test.wd-test b/src/workerd/api/node/tests/url-nodejs-test.wd-test
index 1be17b89..92589f61 100644
--- a/src/workerd/api/node/tests/url-nodejs-test.wd-test
+++ b/src/workerd/api/node/tests/url-nodejs-test.wd-test
@@ -8,7 +8,7 @@ const unitTests :Workerd.Config = (
(name = "worker", esModule = embed "url-nodejs-test.js")
],
compatibilityDate = "2023-10-01",
- compatibilityFlags = ["nodejs_compat"],
+ compatibilityFlags = ["nodejs_compat_v2"],
)
),
], |
2304cbb
to
1501ac0
Compare
Implements domainToASCII and domainToUnicode and exports them under
node:url
whereURL
andURLSearchParams
also exist.