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

fix: decorator visitor should run before preset env #1176

Merged
merged 3 commits into from
May 20, 2024

Conversation

stormslowly
Copy link
Member

@stormslowly stormslowly commented May 20, 2024

if compile down to es5, class become functions, then the decorator on the function will be removed silently

ref: #1172

Summary by CodeRabbit

  • 新功能
    • Transform实现中更改了添加文件夹到folders向量的顺序,现在在swc_preset_env::preset_env之前添加了decorators文件夹。
    • expect.js中的injectSimpleJest()函数调用和新的require("./dist/index.js")语句的添加。
    • mako.config.json文件中为Chrome 40版本添加了新的目标规范。
    • src/index.ts中为Foo类添加了装饰器@bar(),设置了类的属性bar,并添加了用于验证装饰器功能的测试。

Copy link
Contributor

coderabbitai bot commented May 20, 2024

Walkthrough

总体变更概述:对构建过程、测试设置、优化配置和装饰器功能进行了调整和扩展。

Changes

文件 变更摘要
crates/mako/src/build/transform.rs 调整了Transform实现中文件夹添加的顺序,将decorators文件夹添加到folders向量之前。
e2e/fixtures/javascript.legacy-decorator/expect.js
e2e/fixtures/javascript.legacy-decorator/src/index.ts
expect.js中添加了injectSimpleJest()函数调用和require("./dist/index.js")语句;在src/index.ts中为Foo类添加了装饰器@bar()和相应测试。
e2e/fixtures/javascript.legacy-decorator/mako.config.json mako.config.json文件中为Chrome 40版本添加了目标规范,影响了优化设置。

Poem

编译优化增新谋,测试脚本添新愁,

装饰器点缀类,兔子欢乐跳。 🐇🎩

Note

Pull Request Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@stormslowly stormslowly requested a review from sorrycc May 20, 2024 07:06
@stormslowly stormslowly changed the title fix: decorator visitor should run after preset env fix: decorator visitor should run before preset env May 20, 2024
@sorrycc sorrycc merged commit 1848c4f into master May 20, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/decorator_order branch May 20, 2024 09:01
stormslowly added a commit that referenced this pull request May 20, 2024
* test: ✅ add runtime assert in decorator and target to chrome 40

* fix: 🐛 move decorator before preset_env

* add comment on decorators
sorrycc added a commit that referenced this pull request May 27, 2024
* feat: ✨ add [d]ynamic [r]equire runtime function

* refactor: 🎨 dynamic import require process with interop

* test: ✅ add test case

* test: ✅ import context module adjust to dynamic import

* release: @umijs/mako@0.4.18-canary.20240517.1

* chore: ⬆️ mako 0.4.18-canary.20240517.1

* chore: ⬆️ update pnpm-lock

* typo

* fix: fix "too many files open" error when watching with-antd example (#1022)

* fix: fix "too many files open" error when watching with-antd example

* fix: include dist dictionary of root's parent dictionary when watching

---------

Co-authored-by: zp365238 <zp365238@antgroup.com>
Co-authored-by: pshu <pishu.spf@antfin.com>

* chore: 🔧 adjust puffin for easy profile for both long time compiling and watch mode (#1168)

* chore: 🔧 adjust puffin for easy profile for long time compiling

* refactor: 🎨 move profile logic to profile app

* fix: decorator visitor should run before preset env (#1176)

* test: ✅ add runtime assert in decorator and target to chrome 40

* fix: 🐛 move decorator before preset_env

* add comment on decorators

* feat: add watch.ignorePaths config (#1179)

* release: @umijs/mako@0.4.18-canary.20240520.1

* chore: ⬆️ v0.4.18-canary.20240520.1

* chore: ⬆️ update pnpm-lock

---------

Co-authored-by: zhangpanweb <37805064+zhangpanweb@users.noreply.github.com>
Co-authored-by: zp365238 <zp365238@antgroup.com>
Co-authored-by: chencheng (云谦) <sorrycc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants