Skip to content

feat: support auto_parser #10664

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zoolsher
Copy link
Contributor

Summary

Support autoParser Option to solve this issue.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the release: feature release: feature related release(mr only) label Jun 13, 2025
@zoolsher zoolsher marked this pull request as draft June 13, 2025 10:10
Copy link

netlify bot commented Jun 13, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 3029e2f
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/684bfc7e5117cd000815ed5f
😎 Deploy Preview https://deploy-preview-10664--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

codspeed-hq bot commented Jun 13, 2025

CodSpeed Performance Report

Merging #10664 will not alter performance

Comparing zoolsher:feat/auto_parser (3029e2f) with main (61fd95a)

Summary

✅ 12 untouched benchmarks

.merge(Some(Syntax::Typescript(TsSyntax {
tsx: parser_type.is_jsx,
..Default::default()
})));
Copy link
Contributor

Choose a reason for hiding this comment

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

this not only override the tsx option but also override other option is TsSyntax like decorators dts and https://github.com/swc-project/swc/blob/b68f27b164bb43fff8f3a2fd9fa13d993181b539/crates/swc_ecma_parser/src/lib.rs#L311

pub(crate) is_jsx: bool,
}
// return the parser type of a file based on its extension name
// tsx -> typescript + jsx
Copy link
Contributor

@hardfist hardfist Jun 13, 2025

Choose a reason for hiding this comment

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

unfortunately we may also need to consider mjs mts cts cjs, I'm not sure whether there's mtsx ctsx stuff

@@ -10,6 +10,33 @@ Rspack 提供了一个内置的 `builtin:swc-loader`,它是 [swc-loader](https

如果需要在项目中使用 `builtin:swc-loader`,可以参考下面的示例进行配置。

### 根据文件后缀自动开启转译功能
Copy link
Contributor

Choose a reason for hiding this comment

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

基于文件后缀识别syntax更准确些,这个配置和是否开启转译没啥关系

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants