Skip to content
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

add unicode-sets-regex to preset-env #2785

Merged
merged 3 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ require("@babel/parser").parse("code", {

| Version | Changes |
| --- | --- |
| `v7.22.0` | Enabled `regexpUnicodeSets` by default |
| `v7.20.0` | Added `explicitResourceManagement`, `importReflection` |
| `v7.17.0` | Added `regexpUnicodeSets`, `destructuringPrivate`, `decoratorAutoAccessors` |
| `v7.15.0` | Added `hack` to the `proposal` option of `pipelineOperator`. Moved `topLevelAwait`, `privateIn` to Latest ECMAScript features |
Expand Down Expand Up @@ -243,7 +244,6 @@ require("@babel/parser").parse("code", {
| `partialApplication` ([proposal](https://github.com/babel/proposals/issues/32)) | `f(?, a)` |
| `pipelineOperator` ([proposal](https://github.com/babel/proposals/issues/29)) | <code>a &#124;> b</code> |
| `recordAndTuple` ([proposal](https://github.com/tc39/proposal-record-tuple)) | `#{x: 1}`, `#[1, 2]` |
| `regexpUnicodeSets` ([proposal](https://github.com/tc39/proposal-regexp-set-notation)) | `/[\p{Decimal_Number}--[0-9]]/v;` |
| `throwExpressions` ([proposal](https://github.com/babel/proposals/issues/23)) | `() => throw new Error("")` |

#### Latest ECMAScript features
Expand All @@ -269,6 +269,7 @@ You should enable these features only if you are using an older version.
| `optionalCatchBinding` ([proposal](https://github.com/babel/proposals/issues/7)) | `try {throw 0;} catch{do();}` |
| `optionalChaining` ([proposal](https://github.com/tc39/proposal-optional-chaining)) | `a?.b` |
| `privateIn` ([proposal](https://github.com/tc39/proposal-private-fields-in-in)) | `#p in obj` |
| `regexpUnicodeSets` ([proposal](https://github.com/tc39/proposal-regexp-set-notation)) | `/[\p{Decimal_Number}--[0-9]]/v;` |
| `topLevelAwait` ([proposal](https://github.com/tc39/proposal-top-level-await/)) | `await promise` in modules |

#### Plugins options
Expand Down
2 changes: 2 additions & 0 deletions docs/plugin-proposal-unicode-sets-regex.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: "@babel/plugin-proposal-unicode-sets-regex"
sidebar_label: unicode-sets-regex
---

> **NOTE**: This plugin is included in `@babel/preset-env`, in [ES2024](https://github.com/tc39/proposals/blob/master/finished-proposals.md)

This plugin transforms regular expressions using the `v` flag, introduced by the [RegExp set notation + properties of strings](https://github.com/tc39/proposal-regexp-set-notation) proposal, to regular expressions that use the `u` flag.

## Example
Expand Down
6 changes: 5 additions & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ module.exports = {
id: "babel-preset-env",
},
items: [
{
type: "category",
label: "ES2024",
items: ["babel-plugin-proposal-unicode-sets-regex"],
},
{
type: "category",
label: "ES2022",
Expand Down Expand Up @@ -225,7 +230,6 @@ module.exports = {
"babel-plugin-proposal-record-and-tuple",
"babel-plugin-proposal-regexp-modifiers",
"babel-plugin-proposal-throw-expressions",
"babel-plugin-proposal-unicode-sets-regex",
],
},
};