Skip to content

Commit 57b6e52

Browse files
Add babel-plugin-transform-modern-regexp to README
1 parent bee66f2 commit 57b6e52

File tree

3 files changed

+21
-59
lines changed

3 files changed

+21
-59
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ You can get an overview of the tool in [this article](https://medium.com/@Dmitry
1919
- [Using optimizer API](#using-optimizer-api)
2020
- [Optimizer ESLint plugin](#optimizer-eslint-plugin)
2121
- [Using compat-transpiler API](#using-compat-transpiler-api)
22+
- [Compat-transpiler Babel plugin](#compat-transpiler-babel-plugin)
2223
- [Creating RegExp objects](#creating-regexp-objects)
2324
- [Executing regexes](#executing-regexes)
2425
- [RegExp extensions](#regexp-extensions)
26+
- [RegExp extensions Babel plugin](#regexp-extensions-babel-plugin)
2527
- [AST nodes specification](#ast-nodes-specification)
2628

2729
### Installation
@@ -387,6 +389,12 @@ Result:
387389
Compat: /([\0-\uFFFF])\1/
388390
```
389391

392+
#### Compat-transpiler Babel plugin
393+
394+
The [compat-transpiler](https://github.com/DmitrySoshnikov/regexp-tree/tree/master/src/compat-transpiler) module is also available as a _Babel plugin_, which can be installed at: [babel-plugin-transform-modern-regexp](https://www.npmjs.com/package/babel-plugin-transform-modern-regexp).
395+
396+
Note, the plugin also includes [extended regexp](#regexp-extensions) features.
397+
390398
### Creating RegExp objects
391399

392400
To create an actual `RegExp` JavaScript object, we can use `regexpTree.toRegExp` method:
@@ -444,6 +452,12 @@ This is normally parsed by the _regexp-tree_ parser, and [compat-transpiler](#us
444452
/(\d{4})-(\d{2})-(\d{2})/
445453
```
446454

455+
#### RegExp extensions Babel plugin
456+
457+
The regexp extensions are also available as a _Babel plugin_, which can be installed at: [babel-plugin-transform-modern-regexp](https://www.npmjs.com/package/babel-plugin-transform-modern-regexp).
458+
459+
Note, the plugin also includes [compat-transpiler](#using-compat-transpiler-api) features.
460+
447461
### AST nodes specification
448462

449463
Below are the AST node types for different regular expressions patterns:

src/compat-transpiler/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@ If whitelist is not passed, all transforms are applied.
4242
Available transforms are:
4343

4444
* `dotAll` - translates `/./s` into `/[\0-\uFFFF]/`
45-
* `namedCapturingGroups` - transforms `/(?<name>a)\k<name>/` into `/(a)\1/`
45+
* `namedCapturingGroups` - transforms `/(?<name>a)\k<name>/` into `/(a)\1/`
46+
47+
## Babel plugin
48+
49+
The _compat-transpiler_ module is also available as a _Babel plugin_, which can be installed at: [babel-plugin-transform-modern-regexp](https://www.npmjs.com/package/babel-plugin-transform-modern-regexp).
50+
51+
Note, the plugin also includes [extended regexp](https://github.com/dmitrysoshnikov/regexp-tree#regexp-extensions) features.

src/compat-transpiler/babel/README.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)