Comments (8)
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.
from babel-plugin-transform-modern-regexp.
node -v v8.11.3
yarn -v 1.7.0
babel -v 6.26.0 (babel-core 6.26.3)
from babel-plugin-transform-modern-regexp.
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.
from babel-plugin-transform-modern-regexp.
After reading babel/babel#7105, I understand that babel doesn't support changing regExp.exec
, which there is a patch for in zloirock/core-js/#411.
In other words, babel-plugin-transform-modern-regexp doesn't work until #411 and #7105 land.
Please update the README.
from babel-plugin-transform-modern-regexp.
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 regexp-tree
, it just needs to be published as the regexp-tree-runtime
module (as written in #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.
from babel-plugin-transform-modern-regexp.
from babel-plugin-transform-modern-regexp.
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 the end, I found that my project used babel, and the babel-plugin-transform-named-capturing-groups-regex
which is some similar to this plugin is used, and the regexp is not the original native one.
Hope it could be fixed soon.
from babel-plugin-transform-modern-regexp.
In my project, I could use yarn upgrade
or ncu -u && yarn
to update the dependences and then fixed this problem.
However I could not find the key packages to fix this problem because so many packages updated.
from babel-plugin-transform-modern-regexp.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-transform-modern-regexp.