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

feat(transformer): support for transforming legacy decorator #8614

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Jan 20, 2025

related: #4047
related: rolldown/rolldown#2296

This is also known as "Experimental Decorator" in TypeScript by experimentalDecorators enabling.

Testing

  • Six tests fail due to emitDecoratorMetadata, as we haven't supported it yet. I found esbuild doesn't support it as well.
  • A few tests fail due to different unique binding generator
  • ...

Copy link
Member Author

Dunqing commented Jan 20, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request labels Jan 20, 2025
@Boshen
Copy link
Member

Boshen commented Jan 22, 2025

Can you make space for ecma decorators? i.e. name current decorator as LegacyDecorator.

Copy link

codspeed-hq bot commented Jan 22, 2025

CodSpeed Performance Report

Merging #8614 will not alter performance

Comparing 01-20-feat_transformer_support_typescript_experimental_decorator (f2d28f3) with main (5d508a4)

Summary

✅ 33 untouched benchmarks

@Dunqing Dunqing force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from 386e3d6 to 115bbda Compare January 22, 2025 14:23
@Dunqing Dunqing changed the base branch from main to 01-22-feat_ast_derive_clone_and_copy_for_templateelement_and_templateelementvalue January 22, 2025 14:24
overlookmotel pushed a commit that referenced this pull request Jan 22, 2025
@overlookmotel overlookmotel force-pushed the 01-22-feat_ast_derive_clone_and_copy_for_templateelement_and_templateelementvalue branch 2 times, most recently from e2bb198 to b73f8a8 Compare January 22, 2025 15:57
@overlookmotel overlookmotel force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from 97e7f9c to 4ac37a4 Compare January 22, 2025 15:57
@Dunqing Dunqing force-pushed the 01-22-feat_ast_derive_clone_and_copy_for_templateelement_and_templateelementvalue branch from b73f8a8 to f0ed208 Compare January 22, 2025 16:21
@Dunqing Dunqing force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from 4ac37a4 to 318f4bc Compare January 22, 2025 16:22
@Dunqing Dunqing force-pushed the 01-22-feat_ast_derive_clone_and_copy_for_templateelement_and_templateelementvalue branch from f0ed208 to d287a61 Compare January 23, 2025 03:08
@Dunqing Dunqing force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from 318f4bc to 69ed340 Compare January 23, 2025 03:08
@Boshen Boshen changed the base branch from 01-22-feat_ast_derive_clone_and_copy_for_templateelement_and_templateelementvalue to graphite-base/8614 January 24, 2025 03:53
Boshen pushed a commit that referenced this pull request Jan 24, 2025
…alue` (#8658)

In #8614, we need to duplicate the same template literal, and derive `Copy` and `Clone` to avoid using `CloneIn`.
@github-actions github-actions bot added the A-ast Area - AST label Jan 24, 2025
Boshen pushed a commit that referenced this pull request Jan 24, 2025
…alue` (#8658)

In #8614, we need to duplicate the same template literal, and derive `Copy` and `Clone` to avoid using `CloneIn`.
@Boshen Boshen force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from 9efa0dc to e37cb67 Compare January 24, 2025 04:04
@Boshen Boshen force-pushed the graphite-base/8614 branch from d287a61 to 233dc07 Compare January 24, 2025 04:04
@Boshen Boshen changed the base branch from graphite-base/8614 to main January 24, 2025 04:05
@Boshen Boshen force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from e37cb67 to 013ddd8 Compare January 24, 2025 04:05
@Dunqing Dunqing force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch 2 times, most recently from 1104e05 to ae9612b Compare January 24, 2025 13:22
@Dunqing Dunqing force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from ae9612b to 99f6608 Compare February 5, 2025 07:10
@github-actions github-actions bot added A-codegen Area - Code Generation A-prettier Area - Prettier A-cfg Area - Control Flow Graph A-isolated-declarations Isolated Declarations A-ast-tools Area - AST tools A-editor Area - Editor and Language Server labels Feb 8, 2025
@Dunqing Dunqing changed the base branch from graphite-base/8614 to main February 8, 2025 13:34
@Dunqing Dunqing added A-ast Area - AST and removed C-enhancement Category - New feature or request A-linter Area - Linter A-parser Area - Parser A-semantic Area - Semantic A-cli Area - CLI A-minifier Area - Minifier A-ast Area - AST A-codegen Area - Code Generation A-prettier Area - Prettier A-cfg Area - Control Flow Graph A-isolated-declarations Isolated Declarations A-ast-tools Area - AST tools A-editor Area - Editor and Language Server labels Feb 8, 2025
@github-actions github-actions bot added the C-enhancement Category - New feature or request label Feb 8, 2025
@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Feb 9, 2025
Copy link
Member Author

Dunqing commented Feb 9, 2025

Merge activity

  • Feb 9, 9:51 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Feb 9, 9:51 AM EST: A user added this pull request to the Graphite merge queue.
  • Feb 9, 9:56 AM EST: A user merged this pull request with the Graphite merge queue.

related: #4047
related: rolldown/rolldown#2296

This is also known as "Experimental Decorator" in `TypeScript` by [experimentalDecorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) enabling.

### Testing

- Six tests fail due to [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata), as we haven't supported it yet. I found `esbuild` doesn't support it as well.
- A few tests fail due to different unique binding generator
- ...
@graphite-app graphite-app bot force-pushed the 01-20-feat_transformer_support_typescript_experimental_decorator branch from 85b6679 to f2d28f3 Compare February 9, 2025 14:52
@graphite-app graphite-app bot merged commit f2d28f3 into main Feb 9, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 01-20-feat_transformer_support_typescript_experimental_decorator branch February 9, 2025 14:56
Dunqing added a commit that referenced this pull request Feb 10, 2025
…ript` (#8692)

Part of #8614

All tests copy over from https://github.com/microsoft/TypeScript/blob/8da951cbb629b648753454872df4e1754982aef1/tests/cases/conformance/decorators/class, in addition, several multi-file tests were also adjusted.

The output is generated by
```ts
transpileModule(
  source,
  {
    compilerOptions: {
      target: 'esnext',
      experimentalDecorators: true,
      noEmitHelpers: true
    },
  }
)
```
and replace all `__decorate` with `babelHelpers.decorate` and `__param` with `babelHelpers.decorateParam`
Dunqing added a commit that referenced this pull request Feb 10, 2025
related: #4047
related: rolldown/rolldown#2296

This is also known as "Experimental Decorator" in `TypeScript` by [experimentalDecorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) enabling.

### Testing

- Six tests fail due to [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata), as we haven't supported it yet. I found `esbuild` doesn't support it as well.
- A few tests fail due to different unique binding generator
- ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-ast Area - AST A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants