oxc icon indicating copy to clipboard operation
oxc copied to clipboard

☂️ transformer: ES2024 - ES2016

Open Boshen opened this issue 1 year ago • 6 comments

Need to implement babel plugins equivalent of

  • https://github.com/evanw/esbuild/blob/9c13ae1f06dfa909eb4a53882e3b7e4216a503fe/compat-table/src/index.ts#L350-L399
  • https://github.com/evanw/esbuild/blob/9c13ae1f06dfa909eb4a53882e3b7e4216a503fe/compat-table/src/kangax.ts#L20-L85

2024 features

  • [x] RegexpSetNotation (See "Regex Features" below) https://github.com/evanw/esbuild/commit/b5ec4057eb8e7897360c80011d5b2f46ddbb58ab

2023 features

  • [x] Hashbang (syntax)

2022 features

  • [ ] ClassField https://babel.dev/docs/babel-plugin-transform-class-properties
  • [ ] ClassPrivateAccessor https://babeljs.io/docs/babel-plugin-transform-private-methods
  • [ ] ClassPrivateBrandCheck https://babeljs.io/docs/babel-plugin-transform-private-methods
  • [ ] ClassPrivateField https://babel.dev/docs/babel-plugin-transform-private-property-in-object
  • [ ] ClassPrivateMethod https://babel.dev/docs/babel-plugin-transform-private-methods
  • [ ] ClassPrivateStaticAccessor https://babeljs.io/docs/babel-plugin-transform-private-methods
  • [ ] ClassPrivateStaticField https://babeljs.io/docs/babel-plugin-transform-private-methods
  • [ ] ClassPrivateStaticMethod https://babeljs.io/docs/babel-plugin-transform-private-methods
  • [x] ClassStaticBlocks https://babel.dev/docs/babel-plugin-transform-class-static-block
  • [ ] ClassStaticField https://babeljs.io/docs/babel-plugin-transform-class-properties
  • [x] TopLevelAwait (syntax)
  • [ ] ArbitraryModuleNamespaceNames https://github.com/evanw/esbuild/commit/d354bbb39d1ccf3774f5f810cc63d8a0171d3a0f
  • [x] RegexpMatchIndices (See "Regex Features" below)

2021 features

  • [x] LogicalAssignment https://babel.dev/docs/babel-plugin-transform-logical-assignment-operators @Dunqing #4890

2020 features

  • [x] Bigint (syntax)
  • [x] ExportStarAs (syntax)
  • [x] ImportMeta (syntax)
  • [x] NullishCoalescing https://babel.dev/docs/babel-plugin-transform-nullish-coalescing-operator #4884 @Dunqing
  • [ ] #6958
  • [ ] TypeofExoticObjectIsObject https://github.com/evanw/esbuild/commit/81215bcac4da6eba4e24cd62341553f0dc93a3c8

2019 features

  • [x] OptionalCatchBinding https://babel.dev/docs/babel-plugin-transform-optional-catch-binding @Dunqing #4885

2018 features

  • [ ] AsyncGenerator https://babeljs.io/docs/babel-plugin-transform-async-generator-functions
  • [ ] ForAwait https://babeljs.io/docs/babel-plugin-transform-async-generator-functions
  • [ ] #6959
    • #3133 covered spread, rest not done yet
  • [x] RegexpDotAllFlag (See "Regex Features" below)
  • [x] RegexpLookbehindAssertions (See "Regex Features" below)
  • [x] RegexpNamedCaptureGroups (See "Regex Features" below)
  • [x] RegexpUnicodePropertyEscapes (See "Regex Features" below)

2017 features

  • [ ] AsyncAwait https://babeljs.io/docs/babel-plugin-transform-async-to-generator

2016 features

  • [x] ExponentOperator https://babel.dev/docs/babel-plugin-transform-exponentiation-operator #4876 @Dunqing
  • [ ] NestedRestBinding throws an unsupported error? https://esbuild.github.io/try/#dAAwLjIzLjEALS10YXJnZXQ9ZXMyMDE1ACByZXR1cm4gIGZ1bmN0aW9uKFt4LCAuLi5beSwgLi4uel1dKSB7CiAgICAgcmV0dXJuIHggPT09IDEgJiYgeSA9PT0gMiAmJiB6ICsgJycgPT09ICczLDQnOwogICAgIH0oWzEsMiwzLDRdKTs

Regex Features

See https://esbuild.github.io/content-types/#javascript #5387

Unsupported regular expression literals are transformed into a new RegExp() constructor call so you can bring your own polyfill library to get them to work anyway.

Boshen avatar Aug 08 '24 08:08 Boshen

This is not a good first issue yet.

Boshen avatar Aug 11 '24 03:08 Boshen

Can we add CJS to this list too? I need this for oxc-jest.

DonIsaac avatar Aug 11 '24 21:08 DonIsaac

Can we add CJS to this list too? I need this for oxc-jest.

CJS is in the milestone https://github.com/oxc-project/oxc/milestone/6

Boshen avatar Aug 12 '24 01:08 Boshen

The list is not that bad actually, we end up with a few groups:

  • regex features - transform to regex constructor
  • class stuff - ClassXXX
  • syntax sugars
  • Async Generator
  • Async Await

Boshen avatar Aug 12 '24 15:08 Boshen

I want to handle the async/await in ES2017. Currently non-arrow function is well transformed in my codebase.

7086cmd avatar Sep 07 '24 09:09 7086cmd

We had OptionalChain ticked off the list as done. But actually it's not done yet!

ObjectRestSpread was also ticked off, but we've only done half of it.

😢

overlookmotel avatar Oct 16 '24 16:10 overlookmotel

All plugins have been supported in oxc, Let's pay attention to new transformer issues.

Dunqing avatar Jan 03 '25 09:01 Dunqing

🎉🎉🎉

DonIsaac avatar Jan 03 '25 14:01 DonIsaac