Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transform support for the "regexp unicode sets" proposal
- Loading branch information
1 parent
c3e2e4a
commit 82a69f2
Showing
31 changed files
with
273 additions
and
6 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src | ||
test | ||
*.log |
19 changes: 19 additions & 0 deletions
19
packages/babel-plugin-proposal-unicode-sets-regex/README.md
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# @babel/plugin-proposal-unicode-sets-regex | ||
|
||
> Compile regular expressions' unicodeSets (v) flag. | ||
See our website [@babel/plugin-proposal-unicode-sets-regex](https://babeljs.io/docs/en/babel-plugin-proposal-unicode-sets-regex) for more information. | ||
|
||
## Install | ||
|
||
Using npm: | ||
|
||
```sh | ||
npm install --save-dev @babel/plugin-proposal-unicode-sets-regex | ||
``` | ||
|
||
or using yarn: | ||
|
||
```sh | ||
yarn add @babel/plugin-proposal-unicode-sets-regex --dev | ||
``` |
48 changes: 48 additions & 0 deletions
48
packages/babel-plugin-proposal-unicode-sets-regex/package.json
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "@babel/plugin-proposal-unicode-sets-regex", | ||
"version": "7.16.7", | ||
"description": "Compile regular expressions' unicodeSets (v) flag.", | ||
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-unicode-sets-regex", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "./lib/index.js", | ||
"keywords": [ | ||
"babel-plugin", | ||
"regex", | ||
"regexp", | ||
"unicode", | ||
"sets", | ||
"properties", | ||
"property", | ||
"string", | ||
"strings", | ||
"regular expressions" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/babel/babel.git", | ||
"directory": "packages/babel-plugin-proposal-unicode-sets-regex" | ||
}, | ||
"bugs": "https://github.com/babel/babel/issues", | ||
"dependencies": { | ||
"@babel/helper-create-regexp-features-plugin": "workspace:^", | ||
"@babel/helper-plugin-utils": "workspace:^" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "workspace:^", | ||
"@babel/helper-plugin-test-runner": "workspace:^" | ||
}, | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"engines": { | ||
"node": ">=6.9.0" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-plugin-proposal-unicode-sets-regex/src/index.ts
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-disable @babel/development/plugin-name */ | ||
import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
|
||
export default declare(api => { | ||
api.assertVersion(7); | ||
|
||
return createRegExpFeaturePlugin({ | ||
name: "transform-unicode-sets-regex", | ||
feature: "unicodeSetsFlag", | ||
manipulateOptions(opts, parserOpts) { | ||
parserOpts.plugins.push("regexpUnicodeSets"); | ||
}, | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-unicode-sets-regex/test/fixtures/basic/basic/input.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[[0-7]&&[5-9]]\u{10FFFF}/v; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-proposal-unicode-sets-regex/test/fixtures/basic/basic/options.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["proposal-unicode-sets-regex"] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-unicode-sets-regex/test/fixtures/basic/basic/output.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[5-7]\u{10FFFF}/u; |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-unicode-sets-regex/test/fixtures/basic/transform-u/input.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[[0-7]&&[5-9]]\u{10FFFF}/v; |
3 changes: 3 additions & 0 deletions
3
...ges/babel-plugin-proposal-unicode-sets-regex/test/fixtures/basic/transform-u/options.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["proposal-unicode-sets-regex", "transform-unicode-regex"] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-unicode-sets-regex/test/fixtures/basic/transform-u/output.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[5-7](?:\uDBFF\uDFFF)/; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-proposal-unicode-sets-regex/test/index.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import runner from "@babel/helper-plugin-test-runner"; | ||
|
||
runner(import.meta.url); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-unicode-sets-regex/test/package.json
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "type": "module" } |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src | ||
test | ||
*.log |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# @babel/plugin-syntax-unicode-sets-regex | ||
|
||
> Parse regular expressions' unicodeSets (v) flag. | ||
See our website [@babel/plugin-syntax-unicode-sets-regex](https://babeljs.io/docs/en/babel-plugin-syntax-unicode-sets-regex) for more information. | ||
|
||
## Install | ||
|
||
Using npm: | ||
|
||
```sh | ||
npm install --save-dev @babel/plugin-syntax-unicode-sets-regex | ||
``` | ||
|
||
or using yarn: | ||
|
||
```sh | ||
yarn add @babel/plugin-syntax-unicode-sets-regex --dev | ||
``` |
48 changes: 48 additions & 0 deletions
48
packages/babel-plugin-syntax-unicode-sets-regex/package.json
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "@babel/plugin-syntax-unicode-sets-regex", | ||
"version": "7.16.7", | ||
"description": "Parse regular expressions' unicodeSets (v) flag.", | ||
"homepage": "https://babel.dev/docs/en/next/babel-plugin-syntax-unicode-sets-regex", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "./lib/index.js", | ||
"keywords": [ | ||
"babel-plugin", | ||
"regex", | ||
"regexp", | ||
"unicode", | ||
"sets", | ||
"properties", | ||
"property", | ||
"string", | ||
"strings", | ||
"regular expressions" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/babel/babel.git", | ||
"directory": "packages/babel-plugin-syntax-unicode-sets-regex" | ||
}, | ||
"bugs": "https://github.com/babel/babel/issues", | ||
"dependencies": { | ||
"@babel/helper-create-regexp-features-plugin": "workspace:^", | ||
"@babel/helper-plugin-utils": "workspace:^" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "workspace:^", | ||
"@babel/helper-plugin-test-runner": "workspace:^" | ||
}, | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"engines": { | ||
"node": ">=6.9.0" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-plugin-syntax-unicode-sets-regex/src/index.ts
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-disable @babel/development/plugin-name */ | ||
import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
|
||
export default declare(api => { | ||
api.assertVersion(7); | ||
|
||
return createRegExpFeaturePlugin({ | ||
name: "syntax-unicode-sets-regex", | ||
feature: "unicodeSetsFlag_syntax", | ||
manipulateOptions(opts, parserOpts) { | ||
parserOpts.plugins.push("regexpUnicodeSets"); | ||
}, | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-enabled/basic/input.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[[0-7]&&[5-9]]/v; |
3 changes: 3 additions & 0 deletions
3
...es/babel-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-enabled/basic/options.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["syntax-unicode-sets-regex"] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-enabled/basic/output.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[[0-7]&&[5-9]]/v; |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-missing/basic/input.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[[0-7]&&[5-9]]/v; |
3 changes: 3 additions & 0 deletions
3
...es/babel-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-missing/basic/options.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"throws": "Support for the experimental syntax 'regexpUnicodeSets' isn't currently enabled" | ||
} |
1 change: 1 addition & 0 deletions
1
...abel-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-missing/other-enabled/input.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/[[0-7]&&[5-9]](?<n>.)/v; |
4 changes: 4 additions & 0 deletions
4
...-plugin-syntax-unicode-sets-regex/test/fixtures/plugin-missing/other-enabled/options.json
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": ["transform-named-capturing-groups-regex"], | ||
"throws": "Support for the experimental syntax 'regexpUnicodeSets' isn't currently enabled" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-syntax-unicode-sets-regex/test/index.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import runner from "@babel/helper-plugin-test-runner"; | ||
|
||
runner(import.meta.url); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-syntax-unicode-sets-regex/test/package.json
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "type": "module" } |
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
Oops, something went wrong.