Ensure regex-dot-all runs before unicode-regex in preset-env (#8138)

<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | --
| Patch: Bug Fix?          |
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Good ol' plugin ordering 🙃

Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
This commit is contained in:
Brian Ng 2018-06-11 08:09:44 -05:00 committed by GitHub
parent 5bd79c70a5
commit cc4ee350e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 70 additions and 47 deletions

View File

@ -4,6 +4,8 @@
"firefox": "60",
"chrome": "61",
"safari": "10.1",
"ios_saf": "10.3"
"opera": "48",
"ios_saf": "10.3",
"and_ff": "60"
}
}

View File

@ -1,4 +1,4 @@
const es2015 = {
const es = {
"transform-template-literals": {
features: ["template literals"],
},
@ -38,6 +38,13 @@ const es2015 = {
'RegExp "y" and "u" flags / "y" flag',
],
},
// We want to apply this prior to unicode regex so that "." and "u"
// are properly handled.
//
// Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
"transform-dotall-regex": "s (dotAll) flag for regular expressions",
"transform-unicode-regex": {
features: [
'RegExp "y" and "u" flags / "u" flag, case folding',
@ -45,6 +52,7 @@ const es2015 = {
'RegExp "y" and "u" flags / "u" flag',
],
},
"transform-spread": {
features: ["spread (...) operator"],
},
@ -70,27 +78,20 @@ const es2015 = {
"transform-regenerator": {
features: ["generators"],
},
};
const es2016 = {
"transform-exponentiation-operator": {
features: ["exponentiation (**) operator"],
},
};
const es2017 = {
"transform-async-to-generator": {
features: ["async functions"],
},
};
const es2018 = {
"proposal-async-generator-functions": "Asynchronous Iterators",
"proposal-object-rest-spread": "object rest/spread properties",
"proposal-unicode-property-regex": "RegExp Unicode Property Escapes",
"transform-dotall-regex": "s (dotAll) flag for regular expressions",
};
const proposals = require("./shipped-proposals").features;
module.exports = Object.assign({}, es2015, es2016, es2017, es2018, proposals);
module.exports = Object.assign({}, es, proposals);

View File

@ -119,6 +119,13 @@
"opera": "36",
"electron": "1"
},
"transform-dotall-regex": {
"chrome": "62",
"safari": "11.1",
"node": "8.10",
"ios": "11.3",
"opera": "49"
},
"transform-unicode-regex": {
"chrome": "50",
"edge": "13",
@ -239,13 +246,6 @@
"ios": "11.3",
"opera": "51"
},
"transform-dotall-regex": {
"chrome": "62",
"safari": "11.1",
"node": "8.10",
"ios": "11.3",
"opera": "49"
},
"proposal-optional-catch-binding": {
"chrome": "66",
"firefox": "58",

View File

@ -20,6 +20,7 @@ Using plugins:
transform-computed-properties { "android":"4" }
transform-for-of { "android":"4" }
transform-sticky-regex { "android":"4" }
transform-dotall-regex { "android":"4" }
transform-unicode-regex { "android":"4" }
transform-spread { "android":"4" }
transform-parameters { "android":"4" }
@ -33,7 +34,6 @@ Using plugins:
proposal-async-generator-functions { "android":"4" }
proposal-object-rest-spread { "android":"4" }
proposal-unicode-property-regex { "android":"4" }
transform-dotall-regex { "android":"4" }
Using polyfills with `entry` option:

View File

@ -10,13 +10,13 @@ Using modules transform: commonjs
Using plugins:
transform-function-name { "node":"6" }
transform-for-of { "node":"6" }
transform-dotall-regex { "node":"6" }
transform-destructuring { "node":"6" }
transform-exponentiation-operator { "node":"6" }
transform-async-to-generator { "node":"6" }
proposal-async-generator-functions { "node":"6" }
proposal-object-rest-spread { "node":"6" }
proposal-unicode-property-regex { "node":"6" }
transform-dotall-regex { "node":"6" }
Using polyfills with `entry` option:

View File

@ -23,6 +23,7 @@ Using plugins:
transform-computed-properties {}
transform-for-of {}
transform-sticky-regex {}
transform-dotall-regex { "chrome":"55" }
transform-unicode-regex {}
transform-spread {}
transform-parameters {}
@ -36,7 +37,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"55" }
proposal-object-rest-spread { "chrome":"55" }
proposal-unicode-property-regex { "chrome":"55" }
transform-dotall-regex { "chrome":"55" }
Using polyfills with `entry` option:

View File

@ -22,6 +22,7 @@ Using plugins:
transform-computed-properties { "ie":"10" }
transform-for-of { "ie":"10", "node":"6" }
transform-sticky-regex { "ie":"10" }
transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" }
transform-unicode-regex { "ie":"10" }
transform-spread { "ie":"10" }
transform-parameters { "ie":"10" }
@ -35,7 +36,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" }
proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" }
proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" }
transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" }
Using polyfills with `entry` option:

View File

@ -18,6 +18,7 @@ Using plugins:
transform-function-name { "electron":"0.36" }
transform-for-of { "electron":"0.36" }
transform-sticky-regex { "electron":"0.36" }
transform-dotall-regex { "electron":"0.36" }
transform-unicode-regex { "electron":"0.36" }
transform-parameters { "electron":"0.36" }
transform-destructuring { "electron":"0.36" }
@ -28,7 +29,6 @@ Using plugins:
proposal-async-generator-functions { "electron":"0.36" }
proposal-object-rest-spread { "electron":"0.36" }
proposal-unicode-property-regex { "electron":"0.36" }
transform-dotall-regex { "electron":"0.36" }
Using polyfills with `entry` option:

View File

@ -20,6 +20,7 @@ Using plugins:
transform-computed-properties {}
transform-for-of {}
transform-sticky-regex {}
transform-dotall-regex { "chrome":"55" }
transform-unicode-regex {}
transform-spread {}
transform-parameters {}
@ -33,7 +34,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"55" }
proposal-object-rest-spread { "chrome":"55" }
proposal-unicode-property-regex { "chrome":"55" }
transform-dotall-regex { "chrome":"55" }
Using polyfills with `entry` option:

View File

@ -19,11 +19,11 @@ Using plugins:
transform-literals { "firefox":"52" }
transform-function-name { "firefox":"52" }
transform-for-of { "firefox":"52" }
transform-dotall-regex { "firefox":"52", "node":"7.4" }
transform-destructuring { "firefox":"52" }
proposal-async-generator-functions { "firefox":"52", "node":"7.4" }
proposal-object-rest-spread { "firefox":"52", "node":"7.4" }
proposal-unicode-property-regex { "firefox":"52", "node":"7.4" }
transform-dotall-regex { "firefox":"52", "node":"7.4" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
🎉 Successfully compiled 1 file with Babel.

View File

@ -8,10 +8,10 @@ Using targets:
Using modules transform: commonjs
Using plugins:
transform-dotall-regex { "chrome":"60" }
proposal-async-generator-functions { "chrome":"60" }
syntax-object-rest-spread { "chrome":"60" }
proposal-unicode-property-regex { "chrome":"60" }
transform-dotall-regex { "chrome":"60" }
proposal-optional-catch-binding { "chrome":"60" }
Using polyfills with `entry` option:

View File

@ -18,6 +18,7 @@ Using plugins:
transform-computed-properties {}
transform-for-of {}
transform-sticky-regex {}
transform-dotall-regex {}
transform-unicode-regex {}
transform-spread {}
transform-parameters {}
@ -31,7 +32,6 @@ Using plugins:
proposal-async-generator-functions {}
proposal-object-rest-spread {}
proposal-unicode-property-regex {}
transform-dotall-regex {}
proposal-optional-catch-binding {}
Using polyfills with `entry` option:

View File

@ -25,6 +25,7 @@ Using plugins:
transform-computed-properties { "ie":"10", "safari":"7" }
transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" }
transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" }
transform-spread { "ie":"10", "ios":"9", "safari":"7" }
transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
@ -38,7 +39,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
Using polyfills with `entry` option:

View File

@ -21,6 +21,7 @@ Using plugins:
transform-computed-properties { "ie":"11" }
transform-for-of { "firefox":"50", "ie":"11" }
transform-sticky-regex { "ie":"11" }
transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" }
transform-unicode-regex { "ie":"11" }
transform-spread { "ie":"11" }
transform-parameters { "firefox":"50", "ie":"11" }
@ -34,7 +35,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" }
proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" }
proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" }
transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" }
Using polyfills with `usage` option:

View File

@ -8,10 +8,10 @@ Using targets:
Using modules transform: commonjs
Using plugins:
transform-dotall-regex { "chrome":"55" }
proposal-async-generator-functions { "chrome":"55" }
proposal-object-rest-spread { "chrome":"55" }
proposal-unicode-property-regex { "chrome":"55" }
transform-dotall-regex { "chrome":"55" }
Using polyfills with `usage` option:

View File

@ -21,6 +21,7 @@ Using plugins:
transform-computed-properties { "ie":"11" }
transform-for-of { "firefox":"50", "ie":"11" }
transform-sticky-regex { "ie":"11" }
transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" }
transform-unicode-regex { "ie":"11" }
transform-spread { "ie":"11" }
transform-parameters { "firefox":"50", "ie":"11" }
@ -34,7 +35,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" }
proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" }
proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" }
transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" }
Using polyfills with `usage` option:

View File

@ -31,6 +31,7 @@ Using plugins:
transform-computed-properties { "ie":"10" }
transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" }
transform-sticky-regex { "electron":"0.36", "ie":"10" }
transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
transform-unicode-regex { "electron":"0.36", "ie":"10" }
transform-spread { "ie":"10" }
transform-parameters { "electron":"0.36", "ie":"10" }
@ -44,7 +45,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
Using polyfills with `entry` option:

View File

@ -22,6 +22,7 @@ Using plugins:
transform-computed-properties { "ie":"10" }
transform-for-of { "ie":"10" }
transform-sticky-regex { "ie":"10" }
transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" }
transform-unicode-regex { "ie":"10" }
transform-spread { "ie":"10" }
transform-parameters { "ie":"10" }
@ -35,7 +36,6 @@ Using plugins:
proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" }
transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" }
Using polyfills with `entry` option:

View File

@ -0,0 +1,9 @@
const input = `
Lorem ipsum dolor sit amet, consectetur adipiscing hello
world elit. Nam sit amet elit id risus aliquam porta.
`;
expect(/hello.world/.test(input)).toBe(false);
expect(/hello.world/u.test(input)).toBe(false);
expect(/hello.world/s.test(input)).toBe(true);
expect(/hello.world/su.test(input)).toBe(true);

View File

@ -0,0 +1,2 @@
/./s;
/./su;

View File

@ -0,0 +1,7 @@
{
"presets": [
["../../../../lib", {
"modules": false
}]
]
}

View File

@ -0,0 +1,2 @@
/[\0-\uFFFF]/;
/(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;