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: update swc from 83 to 86 #876

Merged
merged 5 commits into from
Jan 22, 2024
Merged

feat: update swc from 83 to 86 #876

merged 5 commits into from
Jan 22, 2024

Conversation

goo-yyh
Copy link
Contributor

@goo-yyh goo-yyh commented Jan 17, 2024

将swc升级到86版本,主要修改点:

  1. js_word! 不能用在模式匹配里
  2. tsc函数改版,需要 ast 使用 Program类型

部分测试用例修改:

  1. 修改原来 transform_try_resolve 中的 transform 函数
  2. Mark::new() 需要在 GLOBAL.set 的闭包里

遗留用例问题:
export const bar = {
中文: "xxx"
}

转 ascii 时,不会自动加上 "",导致有报错,所以先手动在用例上加上双引号了。

@sorrycc
Copy link
Member

sorrycc commented Jan 17, 2024

提 pr 前最好执行下 just ready 命令。

@afc163
Copy link
Contributor

afc163 commented Jan 17, 2024

图片

最好用 github 能识别的邮箱提交。

@afc163
Copy link
Contributor

afc163 commented Jan 17, 2024

建议 commit msg 用英文。

@goo-yyh goo-yyh changed the title feat: swc升级到86版本 feat: update swc from 83 to 86 Jan 17, 2024
@goo-yyh
Copy link
Contributor Author

goo-yyh commented Jan 17, 2024

提 pr 前最好执行下 just ready 命令。

本地执行过了,我看看是啥问题

@@ -13,7 +13,8 @@ pub use swc_core::css::{
pub use swc_core::ecma::transforms::{
base as swc_ecma_transforms, module as swc_ecma_transforms_modules,
optimization as swc_ecma_transforms_optimization, proposal as swc_ecma_transforms_proposals,
react as swc_ecma_transforms_react, typescript as swc_ecma_transforms_typescript,
react as swc_ecma_transforms_react, testing as swc_ecma_transforms_testing,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc_ecma_transforms_testing 是干啥的?好像没用到?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc_ecma_transforms_testing 是干啥的?好像没用到?

删掉了,原来好像有用到

@@ -83,12 +85,20 @@ fn transform_js(
// since when use this in js, it will remove all unused imports
// which is not expected as what webpack does
if is_ts {
ast.visit_mut_with(&mut strip_with_jsx(
let mut program = Program::Module(ast.clone());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这类看下能否用 take 避免 clone。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这类看下能否用 take 避免 clone。

done

@sorrycc sorrycc merged commit bf09763 into master Jan 22, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat/lyy_swc_upgrade_0116 branch January 22, 2024 01:38
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.

4 participants