| 1 |
// WARNING: Plugin ordering is important. Don't reorder this file |
| 2 |
// without checking that it doesn't break anything. |
| 3 |
|
| 4 |
const es5 = { |
| 5 |
"transform-member-expression-literals": |
| 6 |
"Object/array literal extensions / Reserved words as property names", |
| 7 |
"transform-property-literals": |
| 8 |
"Object/array literal extensions / Reserved words as property names", |
| 9 |
"transform-reserved-words": "Miscellaneous / Unreserved words", |
| 10 |
}; |
| 11 |
|
| 12 |
// https://github.com/babel/babel/issues/11278 |
| 13 |
// transform-parameters should run before object-rest-spread |
| 14 |
const es2015Parameter = { |
| 15 |
"transform-parameters": { |
| 16 |
features: [ |
| 17 |
"default function parameters", |
| 18 |
"rest parameters", |
| 19 |
"destructuring, parameters / aliased defaults, arrow function", |
| 20 |
"destructuring, parameters / shorthand defaults, arrow function", |
| 21 |
"destructuring, parameters / duplicate identifier", |
| 22 |
], |
| 23 |
}, |
| 24 |
}; |
| 25 |
|
| 26 |
const es2015 = { |
| 27 |
"transform-template-literals": { |
| 28 |
features: ["template literals"], |
| 29 |
}, |
| 30 |
"transform-literals": { |
| 31 |
features: ["Unicode code point escapes"], |
| 32 |
}, |
| 33 |
"transform-function-name": { |
| 34 |
features: ['function "name" property'], |
| 35 |
}, |
| 36 |
"transform-arrow-functions": { |
| 37 |
features: [ |
| 38 |
"arrow functions / 0 parameters", |
| 39 |
"arrow functions / 1 parameter, no brackets", |
| 40 |
"arrow functions / multiple parameters", |
| 41 |
'arrow functions / lexical "this" binding', |
| 42 |
'arrow functions / "this" unchanged by call or apply', |
| 43 |
"arrow functions / can't be bound, can be curried", |
| 44 |
'arrow functions / lexical "arguments" binding', |
| 45 |
"arrow functions / no line break between params and <code>=></code>", |
| 46 |
"arrow functions / correct precedence", |
| 47 |
'arrow functions / no "prototype" property', |
| 48 |
], |
| 49 |
}, |
| 50 |
"transform-block-scoped-functions": { |
| 51 |
features: ["block-level function declaration"], |
| 52 |
}, |
| 53 |
"transform-classes": { |
| 54 |
features: [ |
| 55 |
"class", |
| 56 |
"super", |
| 57 |
'arrow functions / lexical "super" binding in constructors', |
| 58 |
'arrow functions / lexical "super" binding in methods', |
| 59 |
], |
| 60 |
}, |
| 61 |
"transform-object-super": { |
| 62 |
features: ["super"], |
| 63 |
}, |
| 64 |
"transform-shorthand-properties": { |
| 65 |
features: ["object literal extensions / shorthand properties"], |
| 66 |
}, |
| 67 |
"transform-duplicate-keys": { |
| 68 |
features: ["miscellaneous / duplicate property names in strict mode"], |
| 69 |
}, |
| 70 |
"transform-computed-properties": { |
| 71 |
features: ["object literal extensions / computed properties"], |
| 72 |
}, |
| 73 |
"transform-for-of": { |
| 74 |
features: ["for..of loops"], |
| 75 |
}, |
| 76 |
"transform-sticky-regex": { |
| 77 |
features: [ |
| 78 |
'RegExp "y" and "u" flags / "y" flag, lastIndex', |
| 79 |
'RegExp "y" and "u" flags / "y" flag', |
| 80 |
], |
| 81 |
}, |
| 82 |
"transform-unicode-escapes": "Unicode code point escapes", |
| 83 |
"transform-unicode-regex": { |
| 84 |
features: [ |
| 85 |
'RegExp "y" and "u" flags / "u" flag, case folding', |
| 86 |
'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes', |
| 87 |
'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters', |
| 88 |
'RegExp "y" and "u" flags / "u" flag', |
| 89 |
], |
| 90 |
}, |
| 91 |
"transform-spread": { |
| 92 |
features: [ |
| 93 |
"spread syntax for iterable objects", |
| 94 |
// We need to compile classes when spread is not supported, because |
| 95 |
// we cannot compile super(...args) without also rewriting the |
| 96 |
// "super" handling. There is a bugfix that makes it better. |
| 97 |
"class", |
| 98 |
"super", |
| 99 |
], |
| 100 |
}, |
| 101 |
"transform-destructuring": { |
| 102 |
features: ["destructuring, assignment", "destructuring, declarations"], |
| 103 |
}, |
| 104 |
"transform-block-scoping": { |
| 105 |
features: ["const", "let"], |
| 106 |
}, |
| 107 |
"transform-typeof-symbol": { |
| 108 |
features: ["Symbol / typeof support"], |
| 109 |
}, |
| 110 |
"transform-new-target": { |
| 111 |
features: ["new.target", 'arrow functions / lexical "new.target" binding'], |
| 112 |
}, |
| 113 |
"transform-regenerator": { |
| 114 |
features: ["generators"], |
| 115 |
}, |
| 116 |
}; |
| 117 |
|
| 118 |
const es2016 = { |
| 119 |
"transform-exponentiation-operator": { |
| 120 |
features: ["exponentiation (**) operator"], |
| 121 |
}, |
| 122 |
}; |
| 123 |
|
| 124 |
const es2017 = { |
| 125 |
"transform-async-to-generator": { |
| 126 |
features: ["async functions"], |
| 127 |
}, |
| 128 |
}; |
| 129 |
|
| 130 |
const es2018 = { |
| 131 |
"transform-async-generator-functions": "Asynchronous Iterators", |
| 132 |
"transform-object-rest-spread": "object rest/spread properties", |
| 133 |
|
| 134 |
"transform-dotall-regex": "s (dotAll) flag for regular expressions", |
| 135 |
"transform-unicode-property-regex": "RegExp Unicode Property Escapes", |
| 136 |
"transform-named-capturing-groups-regex": "RegExp named capture groups", |
| 137 |
}; |
| 138 |
|
| 139 |
const es2019 = { |
| 140 |
"transform-json-strings": "JSON superset", |
| 141 |
"transform-optional-catch-binding": "optional catch binding", |
| 142 |
}; |
| 143 |
|
| 144 |
const es2020 = { |
| 145 |
"transform-nullish-coalescing-operator": "nullish coalescing operator (??)", |
| 146 |
"transform-optional-chaining": "optional chaining operator (?.)", |
| 147 |
}; |
| 148 |
|
| 149 |
const es2021 = { |
| 150 |
"transform-numeric-separator": "numeric separators", |
| 151 |
"transform-logical-assignment-operators": "Logical Assignment", |
| 152 |
}; |
| 153 |
|
| 154 |
const es2022 = { |
| 155 |
"transform-class-static-block": "Class static initialization blocks", |
| 156 |
"transform-private-property-in-object": |
| 157 |
"Ergonomic brand checks for private fields", |
| 158 |
"transform-class-properties": { |
| 159 |
features: [ |
| 160 |
"static class fields / public static class fields", |
| 161 |
"static class fields / private static class fields", |
| 162 |
"static class fields / computed static class fields", |
| 163 |
"instance class fields / public instance class fields", |
| 164 |
"instance class fields / private instance class fields basic support", |
| 165 |
"instance class fields / computed instance class fields", |
| 166 |
], |
| 167 |
}, |
| 168 |
"transform-private-methods": "private class methods", |
| 169 |
}; |
| 170 |
|
| 171 |
const shippedProposal = {}; |
| 172 |
|
| 173 |
// Run plugins for modern features first |
| 174 |
module.exports = Object.assign( |
| 175 |
{}, |
| 176 |
shippedProposal, |
| 177 |
es2022, |
| 178 |
es2021, |
| 179 |
es2020, |
| 180 |
es2019, |
| 181 |
es2015Parameter, |
| 182 |
es2018, |
| 183 |
es2017, |
| 184 |
es2016, |
| 185 |
es2015, |
| 186 |
es5 |
| 187 |
); |