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 transform to preset-env #15636

Merged
merged 10 commits into from May 24, 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
5 changes: 5 additions & 0 deletions lib/archived-libs.d.ts
Expand Up @@ -105,3 +105,8 @@ declare module "@babel/plugin-syntax-trailing-function-commas" {
let exports: {default: ReturnType<typeof declare>};
export = exports;
}
declare module "@babel/plugin-syntax-unicode-sets-regex" {
import { declare } from "@babel/helper-plugin-utils";
let exports: {default: ReturnType<typeof declare>};
export = exports;
}
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -93,6 +93,7 @@
"@types/babel__core": "link:./nope",
"@types/babel__traverse": "link:./nope",
"@babel/parser/@babel/types": "workspace:*",
"@babel/plugin-syntax-unicode-sets-regex/@babel/helper-create-regexp-features-plugin": "workspace:*",
"babel-plugin-polyfill-corejs2/@babel/compat-data": "workspace:*"
},
"engines": {
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-compat-data/data/plugins.json
@@ -1,4 +1,7 @@
{
"transform-unicode-sets-regex": {
"chrome": "112"
},
"transform-class-static-block": {
"chrome": "94",
"opera": "80",
Expand Down
5 changes: 5 additions & 0 deletions packages/babel-compat-data/scripts/data/plugin-features.js
Expand Up @@ -174,12 +174,17 @@ const es2022 = {
"transform-private-methods": "private class methods",
};

const es2024 = {
"transform-unicode-sets-regex": "RegExp `v` flag",
};

const shippedProposal = {};

// Run plugins for modern features first
module.exports = Object.assign(
{},
shippedProposal,
es2024,
es2022,
es2021,
es2020,
Expand Down
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

COMPAT_TABLE_COMMIT=09d24e559a39884eee5749e5a60c1e3cc859196b
COMPAT_TABLE_COMMIT=c04cfde56648d778a1da16de3ebf892dc09d95e7
GIT_HEAD=build/compat-table/.git/HEAD

if [ -d "build/compat-table" ]; then
Expand Down
Expand Up @@ -292,7 +292,7 @@ if (!process.env.BABEL_8_BREAKING) {
url: "https://github.com/babel/babel/blob/main/packages/babel-plugin-syntax-unicode-sets-regex/README.md",
},
transform: {
name: "@babel/plugin-proposal-unicode-sets-regex",
name: "@babel/plugin-transform-unicode-sets-regex",
url: "https://github.com/babel/babel/blob/main/packages/babel-plugin-proposalunicode-sets-regex/README.md",
},
},
Expand Down
19 changes: 0 additions & 19 deletions packages/babel-plugin-proposal-unicode-sets-regex/README.md

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 19 additions & 0 deletions packages/babel-plugin-transform-unicode-sets-regex/README.md
@@ -0,0 +1,19 @@
# @babel/plugin-transform-unicode-sets-regex

> Compile regular expressions' unicodeSets (v) flag.

See our website [@babel/plugin-transform-unicode-sets-regex](https://babeljs.io/docs/en/babel-plugin-transform-unicode-sets-regex) for more information.

## Install

Using npm:

```sh
npm install --save-dev @babel/plugin-transform-unicode-sets-regex
```

or using yarn:

```sh
yarn add @babel/plugin-transform-unicode-sets-regex --dev
```
@@ -1,8 +1,8 @@
{
"name": "@babel/plugin-proposal-unicode-sets-regex",
"name": "@babel/plugin-transform-unicode-sets-regex",
"version": "7.18.6",
"description": "Compile regular expressions' unicodeSets (v) flag.",
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-unicode-sets-regex",
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-unicode-sets-regex",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -23,7 +23,7 @@
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-plugin-proposal-unicode-sets-regex"
"directory": "packages/babel-plugin-transform-unicode-sets-regex"
},
"bugs": "https://github.com/babel/babel/issues",
"dependencies": {
Expand Down
@@ -0,0 +1,3 @@
{
"plugins": ["transform-unicode-sets-regex"]
}
@@ -0,0 +1,3 @@
{
"plugins": ["transform-unicode-sets-regex", "transform-unicode-regex"]
}
2 changes: 2 additions & 0 deletions packages/babel-preset-env/package.json
Expand Up @@ -39,6 +39,7 @@
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
"@babel/plugin-syntax-private-property-in-object": "^7.14.5",
"@babel/plugin-syntax-top-level-await": "^7.14.5",
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
"@babel/plugin-transform-arrow-functions": "workspace:^",
"@babel/plugin-transform-async-generator-functions": "workspace:^",
"@babel/plugin-transform-async-to-generator": "workspace:^",
Expand Down Expand Up @@ -86,6 +87,7 @@
"@babel/plugin-transform-unicode-escapes": "workspace:^",
"@babel/plugin-transform-unicode-property-regex": "workspace:^",
"@babel/plugin-transform-unicode-regex": "workspace:^",
"@babel/plugin-transform-unicode-sets-regex": "workspace:^",
"@babel/preset-modules": "^0.1.5",
"@babel/types": "workspace:^",
"babel-plugin-polyfill-corejs2": "^0.3.3",
Expand Down
11 changes: 11 additions & 0 deletions packages/babel-preset-env/src/available-plugins.ts
@@ -1,5 +1,7 @@
/* eslint sort-keys: "error" */

declare const USE_ESM: boolean;

import syntaxAsyncGenerators from "@babel/plugin-syntax-async-generators";
import syntaxClassProperties from "@babel/plugin-syntax-class-properties";
import syntaxClassStaticBlock from "@babel/plugin-syntax-class-static-block";
Expand Down Expand Up @@ -64,6 +66,7 @@ import transformTemplateLiterals from "@babel/plugin-transform-template-literals
import transformTypeofSymbol from "@babel/plugin-transform-typeof-symbol";
import transformUnicodeEscapes from "@babel/plugin-transform-unicode-escapes";
import transformUnicodeRegex from "@babel/plugin-transform-unicode-regex";
import transformUnicodeSetsRegex from "@babel/plugin-transform-unicode-sets-regex";

import bugfixAsyncArrowsInClass from "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class";
import bugfixEdgeDefaultParameters from "@babel/preset-modules/lib/plugins/transform-edge-default-parameters";
Expand Down Expand Up @@ -102,6 +105,13 @@ export default {
"syntax-optional-chaining": () => syntaxOptionalChaining,
"syntax-private-property-in-object": () => syntaxPrivatePropertyInObject,
"syntax-top-level-await": () => syntaxTopLevelAwait,
// This is a CJS plugin that depends on a package from the monorepo, so it
// breaks using ESM. Given that ESM builds are new enough to have this
// syntax enabled by default, we can safely skip enabling it.
"syntax-unicode-sets-regex": USE_ESM
? null
: // eslint-disable-next-line no-restricted-globals
() => require("@babel/plugin-syntax-unicode-sets-regex"),
"transform-arrow-functions": () => transformArrowFunctions,
"transform-async-generator-functions": () => proposalAsyncGeneratorFunctions,
"transform-async-to-generator": () => transformAsyncToGenerator,
Expand Down Expand Up @@ -153,6 +163,7 @@ export default {
"transform-unicode-escapes": () => transformUnicodeEscapes,
"transform-unicode-property-regex": () => proposalUnicodePropertyRegex,
"transform-unicode-regex": () => transformUnicodeRegex,
"transform-unicode-sets-regex": () => transformUnicodeSetsRegex,
};

export const minVersions = {
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { chrome < 112 }
transform-class-static-block { chrome < 94 }
transform-private-property-in-object { chrome < 91 }
transform-class-properties { chrome < 74 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { chrome < 112 }
transform-class-static-block { chrome < 94 }
transform-private-property-in-object { chrome < 91 }
transform-class-properties { chrome < 74 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { edge }
transform-class-static-block { edge < 94 }
transform-private-property-in-object { edge < 91 }
transform-class-properties { edge < 79 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { safari }
transform-class-static-block { safari }
transform-private-property-in-object { safari < 15 }
transform-class-properties { safari < 14.1 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { safari }
transform-class-static-block { safari }
transform-private-property-in-object { safari < 15 }
transform-class-properties { safari < 14.1 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { safari }
transform-class-static-block { safari }
transform-private-property-in-object { safari < 15 }
transform-class-properties { safari < 14.1 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { safari }
transform-class-static-block { safari }
transform-private-property-in-object { safari < 15 }
transform-class-properties { safari < 14.1 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { safari }
transform-class-static-block { safari }
syntax-private-property-in-object
syntax-class-properties
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { safari }
transform-class-static-block { safari }
syntax-private-property-in-object
syntax-class-properties
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { chrome < 112 }
transform-class-static-block { chrome < 94 }
transform-private-property-in-object { chrome < 91 }
syntax-class-properties
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { chrome < 112 }
transform-class-static-block { chrome < 94 }
transform-private-property-in-object { chrome < 91 }
syntax-class-properties
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: false

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: false

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: false

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: false

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge, firefox, ios, node, opera, safari, samsung }
transform-class-static-block { android, chrome < 94, edge < 94, firefox < 93, ios, node < 16.11, opera < 80, safari, samsung < 17 }
transform-private-property-in-object { android, chrome < 91, edge < 91, firefox < 90, ios < 15, node < 16.9, opera < 77, safari < 15, samsung < 16 }
transform-class-properties { android, chrome < 74, edge < 79, firefox < 90, ios < 15, opera < 62, safari < 14.1, samsung < 11 }
Expand Down