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

Proposed: Switch from path-to-regex to urlpattern-polyfill #1954

Closed
zachleat opened this issue Sep 2, 2021 · 9 comments
Closed

Proposed: Switch from path-to-regex to urlpattern-polyfill #1954

zachleat opened this issue Sep 2, 2021 · 9 comments
Labels
enhancement feature: 🏙 serverless Eleventy Serverless needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.

Comments

@zachleat
Copy link
Member

zachleat commented Sep 2, 2021

Pre-1.0 status it might be awesome to attempt to switch the serverless URL matching code from https://www.npmjs.com/package/url-pattern to the future standard https://www.npmjs.com/package/urlpattern-polyfill

Documented at https://web.dev/urlpattern/

This will likely pay dividends later and keep us on the standards track for this feature.

Inspired by https://twitter.com/wanderview/status/1433535232268017665

@zachleat zachleat added this to the Eleventy 1.0.0 milestone Sep 2, 2021
@zachleat zachleat changed the title Switch from url-pattern to urlpattern-polyfill Proposed: Switch from url-pattern to urlpattern-polyfill Sep 2, 2021
@zachleat zachleat added the needs-discussion Please leave your opinion! This request is open for feedback from devs. label Sep 2, 2021
@Snapstromegon
Copy link
Member

I think this is a great idea, since 11ty is still at a stage where such a switch is the least painful to adopt.
The next point after 1.0 would be 2.0 IMO and that is probably some time away.

Also I think that URLPattern is stable enough so we don't need to fear that it will change in the future in any significant way.

I think 11ty should try to make as many open/upcoming breaking changes while upgrading to 1.0 as it can, so that 11ty can be stable after that.

@zachleat
Copy link
Member Author

zachleat commented Sep 3, 2021

Blocked upstream by kenchris/urlpattern-polyfill#38 (local branch zl/issue-1954)

@zachleat
Copy link
Member Author

Alternatively, switch to https://github.com/pillarjs/path-to-regexp as a smoother transition step if urlpattern-polyfill isn’t gonna fit the timeline

Reasoning here is that path-to-regexp is the basis for the URLPattern syntax https://github.com/WICG/urlpattern/blob/main/explainer.md#urlpattern

@zachleat
Copy link
Member Author

Filed the above comment at #1988 and moved this one out of the 1.0 milestone.

@zachleat zachleat changed the title Proposed: Switch from url-pattern to urlpattern-polyfill Proposed: Switch from path-to-regex to urlpattern-polyfill Jan 3, 2022
@zachleat
Copy link
Member Author

zachleat commented Jan 3, 2022

Officially, path-to-regexp shipped with 1.0.0 Canary 45 and Beta 1.

This issue is now for a migration from path-to-regexp to urlpattern-polyfill

@zachleat zachleat added needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. and removed on-hold needs-discussion Please leave your opinion! This request is open for feedback from devs. labels Jan 3, 2022
@zachleat
Copy link
Member Author

zachleat commented Jan 3, 2022

This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open.

View the enhancement backlog here. Don’t forget to upvote the top comment with 👍!

@zachleat zachleat closed this as completed Jan 3, 2022
@zachleat zachleat added needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. and removed needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. labels Aug 15, 2022
@zachleat zachleat removed this from the Eleventy 2.0.0 milestone Aug 15, 2022
@zachleat zachleat added this to the Eleventy 2.0.0 milestone Dec 14, 2022
@zachleat zachleat removed the needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. label Dec 14, 2022
@zachleat zachleat reopened this Dec 14, 2022
@zachleat
Copy link
Member Author

Milestoning this to 2.0

@zachleat
Copy link
Member Author

After further research I’m not sure URLPattern can quite get us there. It can’t generate URLs quite yet!

Related:
whatwg/urlpattern#41
whatwg/urlpattern#73

We currently rely on this from path-to-regexp for the serverlessUrl filter

let fn = compile(url, {

Related:
https://www.npmjs.com/package/path-to-regexp#user-content-compile-reverse-path-to-regexp

@zachleat zachleat added the needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. label Dec 15, 2022
@zachleat zachleat removed this from the Eleventy 2.0.0 milestone Dec 15, 2022
@zachleat
Copy link
Member Author

De-milestoning from 2.0, sorry y’all! Re-adding to the enhancement queue.

This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open.

View the enhancement backlog here. Don’t forget to upvote the top comment with 👍!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature: 🏙 serverless Eleventy Serverless needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.
Projects
None yet
Development

No branches or pull requests

2 participants