-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Framework: Use WHATWG URL in place of legacy url module #19823
Conversation
packages/block-editor/src/utils/transform-styles/transforms/url-rewrite.js
Show resolved
Hide resolved
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.
Great to see Gutenberg moving away from node's url
! Great work, @aduth!
I left some comments that may or may not be relevant, depending on what you expect the passed in URLs to be. The URL
constructor can only produce absolute URLs, so if you're passing in a non-absolute URL you need to specify a base URL to fill in the gaps, just like you did in getResourcePath
. I left comments in other parts of the code, where no base URL was provided.
Edit: This branch has been rebased to remove the polyfill code. Related Core Trac ticket for upstream polyfill patch: https://core.trac.wordpress.org/ticket/49360 |
c8c0d0a
to
bdddf00
Compare
bdddf00
to
8a6acba
Compare
Size Change: -8.78 kB (1%) Total Size: 856 kB
ℹ️ View Unchanged
|
8a6acba
to
26a0dbc
Compare
Partially addresses: #13386
Unblocks (maybe): #19816
Closes #19629
This pull request seeks to remove usage of the Node legacy
url
module in favor of the WHATWGURL
constructor which is native to both Node.js and modern browsers. A polyfill has been included for unsupported browsers.The proposed advantages here are:
The following bundle size changes have been observed:
block-editor
block-library
Testing Instructions:
Verify tests pass:
For good measure, verify affected behaviors: