Skip to content
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

URLPattern #2286

Open
vamsaya opened this issue Mar 3, 2023 · 13 comments
Open

URLPattern #2286

vamsaya opened this issue Mar 3, 2023 · 13 comments
Labels
enhancement New feature or request web-api Something that relates to a standard Web API wintercg Web-interoperable Runtimes Community Group compatiblity

Comments

@vamsaya
Copy link

vamsaya commented Mar 3, 2023

What is the problem this feature would solve?

https://developer.mozilla.org/en-US/docs/Web/API/URLPattern

What is the feature you are proposing to solve the problem?

Although this is an experimental function, it is undoubtedly very practical for bun routing, and deno has already implemented it, so we can't live without it.

What alternatives have you considered?

No response

@vamsaya vamsaya added the enhancement New feature or request label Mar 3, 2023
@Electroid Electroid added the web-api Something that relates to a standard Web API label Mar 3, 2023
@Jarred-Sumner
Copy link
Collaborator

URLPattern is designed to be slow, so we aren't going to support this officially unless it becomes a web standard (WICG != W3C). You can use JS polyfills until then

@PodaruDragos
Copy link

is it not a web standard ? link

@nektro nektro added the wintercg Web-interoperable Runtimes Community Group compatiblity label Jun 6, 2024
@ghost
Copy link

ghost commented Jun 21, 2024

URLPattern is designed to be slow, so we aren't going to support this officially unless it becomes a web standard (WICG != W3C). You can use JS polyfills until then

Please reconsider this. Make it an optional import and allow us to opt into using it if we are willing to accept the performance hit.

@michaldo
Copy link

I would like to make http server with bun. Here: https://bun.sh/guides/http/server only trivial path matching is demonstrated.
I need match segments, for example /foo/{bar}/baz
I don't want use regexp because they are too complex for simple segment matching.
Bun does not implement URLPattern

Then what is bun proposal for that?

@kravetsone
Copy link

What is the problem this feature would solve?

https://developer.mozilla.org/en-US/docs/Web/API/URLPattern

What is the feature you are proposing to solve the problem?

Although this is an experimental function, it is undoubtedly very practical for bun routing, and deno has already implemented it, so we can't live without it.

What alternatives have you considered?

No response

Routing with regexp is painful and should be abandoned

@kravetsone
Copy link

What is the problem this feature would solve?

https://developer.mozilla.org/en-US/docs/Web/API/URLPattern

What is the feature you are proposing to solve the problem?

Although this is an experimental function, it is undoubtedly very practical for bun routing, and deno has already implemented it, so we can't live without it.

What alternatives have you considered?

No response

Routing with regexp is painful and should be abandoned

It is great feature for web but not so for server-side

@TiBianMod
Copy link

nice to have!!!

@juriadams
Copy link

Currently blocking the use of cross-runtime fetch mocks like @c4spar/mock-fetch.

@samuelstroschein
Copy link

NodeJS just merged support for URLPattern nodejs/node#40844.

If Bun wants full Node compatibility, implementing URLPattern seems unavoidable now.

@samuelstroschein
Copy link

Safari shipped URLPattern this week as well, and URLPattern made it on the Interop 2025 list.

@kravetsone
Copy link

Safari shipped URLPattern this week as well, and URLPattern made it on the Interop 2025 list.

nodejs ship it too

but i guess this feature not so important because it slow by design and etc

@ivan-kleshnin
Copy link

ivan-kleshnin commented Feb 15, 2025

but i guess this feature not so important because it slow by design and etc

We use it for routing, as a polyfill (which is 1000 times slower). I personally don't get how you people call some implementation "slow" without even asking how much calls to that function will be made. In my view LLMs are slow. And all pattern matching algorithms, even the most ineffecient, are super fast 😅

@kravetsone
Copy link

but i guess this feature not so important because it slow by design and etc

We use it for routing, as a polyfill (which is 1000 times slower). I personally don't get how you people call some implementation "slow" without even asking how much calls to that function will be made. In my view LLMs are slow. And all pattern matching algorithms, even the most ineffecient, are super fast 😅

Why u need this?
Routing with regexps is strange thing

Also https://en.m.wikipedia.org/wiki/ReDoS

Radix-tree based routers is more fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web-api Something that relates to a standard Web API wintercg Web-interoperable Runtimes Community Group compatiblity
Projects
None yet
Development

No branches or pull requests