-
Notifications
You must be signed in to change notification settings - Fork 8
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
Named group is not transformed #7
Comments
node -v |
Yeah, it depends on the runtime support from #3. We should build the runtime in this repo, and also in the generic Babel plugin @nicolo-ribaudo is working on in babel/babel#7105. |
After reading babel/babel#7105, I understand that babel doesn't support changing regExp In other words, babel-plugin-transform-modern-regexp doesn't work until #411 and #7105 land. Please update the README. |
Yeah, it's in the README. But we'll add the implementation to this plugin in parallel with the Babel plugin. A lightweight runtime already exists in the Alternatively we could embed the code of the runtime directly to a transforming file, but that would make the code bloated. Eventually, both The class itself should be defined as extending I'll appreciate a PR for any of these parts in case, or I'll try to reach it at some point. |
Fair enough. I will keep it in the back of my head ~ in case I get some
free time to help out.
…On Tue, Jul 3, 2018 at 7:22 AM Dmitry Soshnikov ***@***.***> wrote:
Yeah, it's in the README
<https://github.com/DmitrySoshnikov/babel-plugin-transform-modern-regexp#useruntime-option>
.
But we'll add the implementation to this plugin in parallel with the Babel
plugin. A lightweight runtime already exists
<https://github.com/DmitrySoshnikov/regexp-tree/blob/master/src/compat-transpiler/runtime/index.js>
in the regexp-tree, it just needs to be published as the
regexp-tree-runtime module (as written in #3
<#3>),
and added to the transform.
Alternatively we could embed the code of the runtime directly to a
transforming file, but that would make the code bloated.
Eventually, both new RegExp('/ .. named groups ... /'), and / .. named
groups ... / have to be translated into new RegExpTree( ... ), which will
have wrappers for the exec, and other methods.
The class itself should be defined as extending RegExp (to support
instanceof, etc).
I'll appreciate a PR for any of these parts in case, or I'll try to reach
it at some point.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACq82LjR_uwOBXVSWWw6OCSEcbL6GXiks5uCv-HgaJpZM4U9hMO>
.
|
I have the similar issue, I write my regexp and tested it ok on https://regex101.com, and the group info also exist on the console of devtools of Chrome, but in my script it always lost the group info. |
In my project, I could use However I could not find the key packages to fix this problem because so many packages updated. |
Yes, for named capturing groups we've been working on plugin-transform-named-capturing-groups-regex to make it standard Babel transform. For now you can apply that transform on top as a workaround, and we can probably port it into this repo as well. |
Code:
Result:
An example project for this issue is available here: https://github.com/dotnetCarpenter/bug-babel-plugin-transform-modern-regexp
The text was updated successfully, but these errors were encountered: