-
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
[RNMobile] Enable new block in Gutenberg Mobile #47836
Conversation
Flaky tests detected in 33864d0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4125839606
|
As per this issue, Hermes doesn't currently support named capturing groups: facebook/hermes#696 This commit addresses that by using the 'plugin-transform-named-capturing-groups-regex' plugin.
Size Change: +614 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
@@ -13,6 +13,7 @@ module.exports = function ( api ) { | |||
'../../node_modules/@babel/plugin-proposal-async-generator-functions' | |||
), | |||
'@babel/plugin-transform-runtime', | |||
'@babel/plugin-transform-named-capturing-groups-regex', |
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.
The new block makes use of regex named capture groups, which is only supported in the version of Hermes available in RN 0.71 (see facebook/hermes#696 for more details). This resulted in the following error:
bundle/android/App.text.js:3647:961: error: Invalid regular expression: Quantifier has nothing to repeat
...atch(/^https?:\/\/(?<host>video(?:\.word|s\.files\.word)?press\.com)(?:\/v|\/embed)?\/(?<guid>[a-zA-Z\d]{8})/);ret...
The use of @babel/plugin-transform-named-capturing-groups-regex
is a workaround to that error.
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.
Good catch! I was wondering if we'd need to add this package as a dependency but noticed in the documentation that is already included when using @babel/preset-env
, which is a dependency in Gutenberg (reference).
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.
LGTM 🎊 !
@@ -13,6 +13,7 @@ module.exports = function ( api ) { | |||
'../../node_modules/@babel/plugin-proposal-async-generator-functions' | |||
), | |||
'@babel/plugin-transform-runtime', | |||
'@babel/plugin-transform-named-capturing-groups-regex', |
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.
Good catch! I was wondering if we'd need to add this package as a dependency but noticed in the documentation that is already included when using @babel/preset-env
, which is a dependency in Gutenberg (reference).
What?
This PR introduces a new block to the Gutenberg editor.
Why?
It's currently necessary to register all new blocks via the Gutenberg repository, but there is an open issue at wordpress-mobile/gutenberg-mobile#3911 for changing this in the future.
How?
The pattern for registering previous blocks has been followed.
Testing Instructions
Please refer to wordpress-mobile/gutenberg-mobile#5459 for specific testing steps and more information related to the block.