-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Rename wp-polyfill-ecmascript #11216
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d4a1326
Rename wp-polyfill-ecmascript
earnjam 4fd3335
Make babel polyfill be script file for wp-polyfill
earnjam 98454ff
Fix suffix error
earnjam 13b2a68
Stop using CDN directly
earnjam ed37225
Register wp-polyfill-ecmascript to null for back compat
earnjam d859566
Ensure we use some grammar in our comments
earnjam fc297b1
Remove extraneous wp-polyfill-ecmascript include
earnjam 3fc153f
Framework: Log deprecation notice for wp-polyfill-ecmascript
aduth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,13 +144,6 @@ function gutenberg_register_scripts_and_styles() { | |
|
||
register_tinymce_scripts(); | ||
|
||
gutenberg_override_script( | ||
'wp-polyfill', | ||
null, | ||
array( | ||
'wp-polyfill-ecmascript', | ||
) | ||
); | ||
wp_script_add_data( | ||
'wp-polyfill', | ||
'data', | ||
|
@@ -485,7 +478,7 @@ function gutenberg_register_scripts_and_styles() { | |
'lodash', | ||
'wp-a11y', | ||
'wp-data', | ||
'wp-polyfill-ecmascript', | ||
'wp-polyfill', | ||
), | ||
filemtime( gutenberg_dir_path() . 'build/notices/index.js' ), | ||
true | ||
|
@@ -751,7 +744,7 @@ function gutenberg_register_scripts_and_styles() { | |
'wp-compose', | ||
'wp-element', | ||
'wp-i18n', | ||
'wp-polyfill-ecmascript', | ||
'wp-polyfill', | ||
), | ||
filemtime( gutenberg_dir_path() . 'build/list-reusable-blocks/index.js' ), | ||
true | ||
|
@@ -979,9 +972,23 @@ function gutenberg_register_vendor_scripts() { | |
'https://unpkg.com/[email protected]/element-closest.js' | ||
); | ||
gutenberg_register_vendor_script( | ||
'wp-polyfill-ecmascript', | ||
'wp-polyfill', | ||
'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill' . $suffix . '.js' | ||
); | ||
// Ensure backwards compatibility after renaming to wp-polyfill. | ||
gutenberg_override_script( | ||
'wp-polyfill-ecmascript', | ||
null, | ||
array( | ||
'wp-polyfill', | ||
'wp-deprecated', | ||
) | ||
); | ||
wp_script_add_data( | ||
'wp-polyfill-ecmascript', | ||
'data', | ||
'wp.deprecated( "wp-polyfill-ecmascript script handle", { plugin: "Gutenberg", version: "4.5" } );' | ||
); | ||
} | ||
|
||
/** | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this something we want to do away with eventually? Should we make that clearer in the comment? How can we plan to follow-up?
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.
I'm honestly not sure best course of action here. Realistically, what is the likelihood that plugins are counting on this script handle? If we plan to eventually remove it, how long should we wait?
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.
We could follow the standard deprecation workflow:
https://wordpress.org/gutenberg/handbook/reference/deprecated/
We've done similar before for server-side features in either (a) enqueuing an inline script to run
wp.deprecated( '...' )
messaging or (b)_doing_it_wrong
. The former seems easiest, since the second would be difficult in determining whether there are scripts which define a dependency on the script.Examples:
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.
wp-polyfill-promise
looks like a good example of prior art. What version should we set for removal?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.
Two versions out, 4.5, which may or may not actually happen.