ufo
ufo copied to clipboard
Migrate to native `URL`
Historically ufo was started as a polyfill for URL when there were no enough browser coverage and also due to behavior variations. Now that URL is an standard de-facto, we can migrate to it for all (for parse/stringify) or at least for resolve/normalize Utils.
One of the biggest breaking change side-effects of this is that we will encode more characters even then they not not necessary and parsable. The initial behavior was taken from vue-router that preferred to keep URL readability and encode in must-have situations only. (one example: https://github.com/unjs/ufo/pull/164)
Second thing to consider is the performance part which probably worth a decent benchmark against URL implementation of major JS runtimes (Browsers, Node, Bun, Deno, Cloudflare workers) comparing to current regex based parseURL.
--
Update: I am thinking if we could ship it even faster with ufo/url or ufo/web to allow progressive opt-in and later in v2, have backward compact with ufo/compat. Only have to figure out a way to make bundling work to switch impl of encoding utils.
I get it from the Mulesoft - https://help.mulesoft.com/s/article/java-lang-IllegalArgumentException-Malformed-URI-while-migrating-to-Mule-4 Mulesoft still supports RFC 1738 where "{", "}", "|", "", "^", "~", "[", "]", and "`" are unsafe characters.
Originally posted by @enkot in https://github.com/unjs/ufo/issues/165#issuecomment-1933938777
+1 on ufo/url, that'd be great.