mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
parent
9f5ae56810
commit
b57d00d6fb
5 changed files with 1112 additions and 1112 deletions
|
|
@ -176,14 +176,14 @@ impl From<EngineTargets> for EnvOptions {
|
||||||
async_generator_functions: o.has_feature(ES2018AsyncGeneratorFunctions),
|
async_generator_functions: o.has_feature(ES2018AsyncGeneratorFunctions),
|
||||||
},
|
},
|
||||||
es2019: ES2019Options {
|
es2019: ES2019Options {
|
||||||
optional_catch_binding: o.has_feature(ES2018OptionalCatchBinding),
|
optional_catch_binding: o.has_feature(ES2019OptionalCatchBinding),
|
||||||
},
|
},
|
||||||
es2020: ES2020Options {
|
es2020: ES2020Options {
|
||||||
nullish_coalescing_operator: o.has_feature(ES2020NullishCoalescingOperator),
|
nullish_coalescing_operator: o.has_feature(ES2020NullishCoalescingOperator),
|
||||||
big_int: o.has_feature(ES2020BigInt),
|
big_int: o.has_feature(ES2020BigInt),
|
||||||
},
|
},
|
||||||
es2021: ES2021Options {
|
es2021: ES2021Options {
|
||||||
logical_assignment_operators: o.has_feature(ES2020LogicalAssignmentOperators),
|
logical_assignment_operators: o.has_feature(ES2021LogicalAssignmentOperators),
|
||||||
},
|
},
|
||||||
es2022: ES2022Options {
|
es2022: ES2022Options {
|
||||||
class_static_block: o.has_feature(ES2022ClassStaticBlock),
|
class_static_block: o.has_feature(ES2022ClassStaticBlock),
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -56,7 +56,7 @@ fn target_list_pass() {
|
||||||
let result = TransformOptions::from_target(target).unwrap();
|
let result = TransformOptions::from_target(target).unwrap();
|
||||||
assert!(!result.env.es2019.optional_catch_binding);
|
assert!(!result.env.es2019.optional_catch_binding);
|
||||||
assert!(!result.env.es2020.nullish_coalescing_operator);
|
assert!(!result.env.es2020.nullish_coalescing_operator);
|
||||||
assert!(!result.env.es2021.logical_assignment_operators);
|
assert!(result.env.es2021.logical_assignment_operators);
|
||||||
assert!(result.env.es2022.class_static_block);
|
assert!(result.env.es2022.class_static_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -8,10 +8,12 @@ const f = (es) => (item) => {
|
||||||
|
|
||||||
const es5 = [
|
const es5 = [
|
||||||
{
|
{
|
||||||
name: 'ReservedWords',
|
name: 'MemberExpressionLiterals',
|
||||||
es: 'ES5',
|
es: 'ES5',
|
||||||
babel: 'transform-reserved-words',
|
babel: 'transform-member-expression-literals',
|
||||||
features: ['Miscellaneous / Unreserved words'],
|
features: [
|
||||||
|
'Object/array literal extensions / Reserved words as property names',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'PropertyLiterals',
|
name: 'PropertyLiterals',
|
||||||
|
|
@ -22,12 +24,10 @@ const es5 = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'MemberExpressionLiterals',
|
name: 'ReservedWords',
|
||||||
es: 'ES5',
|
es: 'ES5',
|
||||||
babel: 'transform-member-expression-literals',
|
babel: 'transform-reserved-words',
|
||||||
features: [
|
features: ['Miscellaneous / Unreserved words'],
|
||||||
'Object/array literal extensions / Reserved words as property names',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
].map(f('ES5'));
|
].map(f('ES5'));
|
||||||
|
|
||||||
|
|
@ -44,97 +44,19 @@ const es2015 = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Regenerator',
|
name: 'TemplateLiterals',
|
||||||
babel: 'transform-regenerator',
|
babel: 'transform-template-literals',
|
||||||
features: ['generators'],
|
features: ['template literals'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'NewTarget',
|
name: 'Literals',
|
||||||
babel: 'transform-new-target',
|
babel: 'transform-literals',
|
||||||
features: ['new.target', 'arrow functions / lexical "new.target" binding'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'TypeofSymbol',
|
|
||||||
babel: 'transform-typeof-symbol',
|
|
||||||
features: ['Symbol / typeof support'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'BlockScoping',
|
|
||||||
babel: 'transform-block-scoping',
|
|
||||||
features: ['const', 'let', 'generators'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Destructuring',
|
|
||||||
babel: 'transform-destructuring',
|
|
||||||
features: ['destructuring, assignment', 'destructuring, declarations'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Spread',
|
|
||||||
babel: 'transform-spread',
|
|
||||||
features: ['spread syntax for iterable objects', 'class', 'super'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'UnicodeRegex',
|
|
||||||
babel: 'transform-unicode-regex',
|
|
||||||
features: [
|
|
||||||
'RegExp "y" and "u" flags / "u" flag, case folding',
|
|
||||||
'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes',
|
|
||||||
'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters',
|
|
||||||
'RegExp "y" and "u" flags / "u" flag',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'UnicodeEscapes',
|
|
||||||
babel: 'transform-unicode-escapes',
|
|
||||||
features: ['Unicode code point escapes'],
|
features: ['Unicode code point escapes'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'StickyRegex',
|
name: 'FunctionName',
|
||||||
babel: 'transform-sticky-regex',
|
babel: 'transform-function-name',
|
||||||
features: [
|
features: ['function "name" property'],
|
||||||
'RegExp "y" and "u" flags / "y" flag, lastIndex',
|
|
||||||
'RegExp "y" and "u" flags / "y" flag',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ForOf',
|
|
||||||
babel: 'transform-for-of',
|
|
||||||
features: ['for..of loops'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ComputedProperties',
|
|
||||||
babel: 'transform-computed-properties',
|
|
||||||
features: ['object literal extensions / computed properties'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DuplicateKeys',
|
|
||||||
babel: 'transform-duplicate-keys',
|
|
||||||
features: ['miscellaneous / duplicate property names in strict mode'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ShorthandProperties',
|
|
||||||
babel: 'transform-shorthand-properties',
|
|
||||||
features: ['object literal extensions / shorthand properties'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ObjectSuper',
|
|
||||||
babel: 'transform-object-super',
|
|
||||||
features: ['super'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Classes',
|
|
||||||
babel: 'transform-classes',
|
|
||||||
features: [
|
|
||||||
'class',
|
|
||||||
'super',
|
|
||||||
'arrow functions / lexical "super" binding in constructors',
|
|
||||||
'arrow functions / lexical "super" binding in methods',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'BlockScopedFunctions',
|
|
||||||
babel: 'transform-block-scoped-functions',
|
|
||||||
features: ['block-level function declaration'],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ArrowFunctions',
|
name: 'ArrowFunctions',
|
||||||
|
|
@ -153,19 +75,97 @@ const es2015 = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'FunctionName',
|
name: 'BlockScopedFunctions',
|
||||||
babel: 'transform-function-name',
|
babel: 'transform-block-scoped-functions',
|
||||||
features: ['function "name" property'],
|
features: ['block-level function declaration'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Literals',
|
name: 'Classes',
|
||||||
babel: 'transform-literals',
|
babel: 'transform-classes',
|
||||||
|
features: [
|
||||||
|
'class',
|
||||||
|
'super',
|
||||||
|
'arrow functions / lexical "super" binding in constructors',
|
||||||
|
'arrow functions / lexical "super" binding in methods',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ObjectSuper',
|
||||||
|
babel: 'transform-object-super',
|
||||||
|
features: ['super'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ShorthandProperties',
|
||||||
|
babel: 'transform-shorthand-properties',
|
||||||
|
features: ['object literal extensions / shorthand properties'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'DuplicateKeys',
|
||||||
|
babel: 'transform-duplicate-keys',
|
||||||
|
features: ['miscellaneous / duplicate property names in strict mode'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ComputedProperties',
|
||||||
|
babel: 'transform-computed-properties',
|
||||||
|
features: ['object literal extensions / computed properties'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ForOf',
|
||||||
|
babel: 'transform-for-of',
|
||||||
|
features: ['for..of loops'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'StickyRegex',
|
||||||
|
babel: 'transform-sticky-regex',
|
||||||
|
features: [
|
||||||
|
'RegExp "y" and "u" flags / "y" flag, lastIndex',
|
||||||
|
'RegExp "y" and "u" flags / "y" flag',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'UnicodeEscapes',
|
||||||
|
babel: 'transform-unicode-escapes',
|
||||||
features: ['Unicode code point escapes'],
|
features: ['Unicode code point escapes'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'TemplateLiterals',
|
name: 'UnicodeRegex',
|
||||||
babel: 'transform-template-literals',
|
babel: 'transform-unicode-regex',
|
||||||
features: ['template literals'],
|
features: [
|
||||||
|
'RegExp "y" and "u" flags / "u" flag, case folding',
|
||||||
|
'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes',
|
||||||
|
'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters',
|
||||||
|
'RegExp "y" and "u" flags / "u" flag',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Spread',
|
||||||
|
babel: 'transform-spread',
|
||||||
|
features: ['spread syntax for iterable objects', 'class', 'super'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Destructuring',
|
||||||
|
babel: 'transform-destructuring',
|
||||||
|
features: ['destructuring, assignment', 'destructuring, declarations'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'BlockScoping',
|
||||||
|
babel: 'transform-block-scoping',
|
||||||
|
features: ['const', 'let', 'generators'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'TypeofSymbol',
|
||||||
|
babel: 'transform-typeof-symbol',
|
||||||
|
features: ['Symbol / typeof support'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'NewTarget',
|
||||||
|
babel: 'transform-new-target',
|
||||||
|
features: ['new.target', 'arrow functions / lexical "new.target" binding'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Regenerator',
|
||||||
|
babel: 'transform-regenerator',
|
||||||
|
features: ['generators'],
|
||||||
},
|
},
|
||||||
].map(f('ES2015'));
|
].map(f('ES2015'));
|
||||||
|
|
||||||
|
|
@ -187,24 +187,9 @@ const es2017 = [
|
||||||
|
|
||||||
const es2018 = [
|
const es2018 = [
|
||||||
{
|
{
|
||||||
name: 'NamedCapturingGroupsRegex',
|
name: 'AsyncGeneratorFunctions',
|
||||||
babel: 'transform-named-capturing-groups-regex',
|
babel: 'transform-async-generator-functions',
|
||||||
features: ['RegExp named capture groups'],
|
features: ['Asynchronous Iterators'],
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'UnicodePropertyRegex',
|
|
||||||
babel: 'transform-unicode-property-regex',
|
|
||||||
features: ['RegExp Unicode Property Escapes / basic'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DotallRegex',
|
|
||||||
babel: 'transform-dotall-regex',
|
|
||||||
features: ['s (dotAll) flag for regular expressions'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'LookbehindRegex',
|
|
||||||
babel: null,
|
|
||||||
features: ['RegExp Lookbehind Assertions'],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ObjectRestSpread',
|
name: 'ObjectRestSpread',
|
||||||
|
|
@ -212,14 +197,24 @@ const es2018 = [
|
||||||
features: ['object rest/spread properties'],
|
features: ['object rest/spread properties'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'AsyncGeneratorFunctions',
|
name: 'DotallRegex',
|
||||||
babel: 'transform-async-generator-functions',
|
babel: 'transform-dotall-regex',
|
||||||
features: ['Asynchronous Iterators'],
|
features: ['s (dotAll) flag for regular expressions'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'OptionalCatchBinding',
|
name: 'UnicodePropertyRegex',
|
||||||
babel: 'transform-optional-catch-binding',
|
babel: 'transform-unicode-property-regex',
|
||||||
features: ['optional catch binding'],
|
features: ['RegExp Unicode Property Escapes / basic'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'NamedCapturingGroupsRegex',
|
||||||
|
babel: 'transform-named-capturing-groups-regex',
|
||||||
|
features: ['RegExp named capture groups'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'LookbehindRegex',
|
||||||
|
babel: null,
|
||||||
|
features: ['RegExp Lookbehind Assertions'],
|
||||||
},
|
},
|
||||||
].map(f('ES2018'));
|
].map(f('ES2018'));
|
||||||
|
|
||||||
|
|
@ -230,9 +225,9 @@ const es2019 = [
|
||||||
features: ['JSON superset'],
|
features: ['JSON superset'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'OptionalChaining',
|
name: 'OptionalCatchBinding',
|
||||||
babel: 'transform-optional-chaining',
|
babel: 'transform-optional-catch-binding',
|
||||||
features: ['optional chaining operator (?.)'],
|
features: ['optional catch binding'],
|
||||||
},
|
},
|
||||||
].map(f('ES2019'));
|
].map(f('ES2019'));
|
||||||
|
|
||||||
|
|
@ -243,9 +238,9 @@ const es2020 = [
|
||||||
features: ['nullish coalescing operator (??)'],
|
features: ['nullish coalescing operator (??)'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'LogicalAssignmentOperators',
|
name: 'OptionalChaining',
|
||||||
babel: 'transform-logical-assignment-operators',
|
babel: 'transform-optional-chaining',
|
||||||
features: ['Logical Assignment'],
|
features: ['optional chaining operator (?.)'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'BigInt',
|
name: 'BigInt',
|
||||||
|
|
@ -260,13 +255,23 @@ const es2021 = [
|
||||||
babel: 'transform-numeric-separator',
|
babel: 'transform-numeric-separator',
|
||||||
features: ['numeric separators'],
|
features: ['numeric separators'],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'LogicalAssignmentOperators',
|
||||||
|
babel: 'transform-logical-assignment-operators',
|
||||||
|
features: ['Logical Assignment'],
|
||||||
|
},
|
||||||
].map(f('ES2021'));
|
].map(f('ES2021'));
|
||||||
|
|
||||||
const es2022 = [
|
const es2022 = [
|
||||||
{
|
{
|
||||||
name: 'PrivateMethods',
|
name: 'ClassStaticBlock',
|
||||||
babel: 'transform-private-methods',
|
babel: 'transform-class-static-block',
|
||||||
features: ['private class methods'],
|
features: ['Class static initialization blocks'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'PrivatePropertyInObject',
|
||||||
|
babel: 'transform-private-property-in-object',
|
||||||
|
features: ['Ergonomic brand checks for private fields'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ClassProperties',
|
name: 'ClassProperties',
|
||||||
|
|
@ -280,14 +285,9 @@ const es2022 = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'PrivatePropertyInObject',
|
name: 'PrivateMethods',
|
||||||
babel: 'transform-private-property-in-object',
|
babel: 'transform-private-methods',
|
||||||
features: ['Ergonomic brand checks for private fields'],
|
features: ['private class methods'],
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ClassStaticBlock',
|
|
||||||
babel: 'transform-class-static-block',
|
|
||||||
features: ['Class static initialization blocks'],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'MatchIndicesRegex',
|
name: 'MatchIndicesRegex',
|
||||||
|
|
@ -313,16 +313,16 @@ const es2024 = [
|
||||||
].map(f('ES2024'));
|
].map(f('ES2024'));
|
||||||
|
|
||||||
const es2025 = [
|
const es2025 = [
|
||||||
{
|
|
||||||
name: 'RegexpModifiers',
|
|
||||||
babel: 'transform-regexp-modifiers',
|
|
||||||
features: ['RegExp Pattern Modifiers'],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'DuplicateNamedCapturingGroupsRegex',
|
name: 'DuplicateNamedCapturingGroupsRegex',
|
||||||
babel: 'transform-duplicate-named-capturing-groups-regex',
|
babel: 'transform-duplicate-named-capturing-groups-regex',
|
||||||
features: ['Duplicate named capturing groups'],
|
features: ['Duplicate named capturing groups'],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'RegexpModifiers',
|
||||||
|
babel: 'transform-regexp-modifiers',
|
||||||
|
features: ['RegExp Pattern Modifiers'],
|
||||||
|
},
|
||||||
].map(f('ES2025'));
|
].map(f('ES2025'));
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue