Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Jun 9, 2025

Summary by CodeRabbit

  • New Features
    • Enabled support for importing and using SVG files as React components and as raw strings.
    • Improved TypeScript support for importing CSS modules and SVG files.
  • Chores
    • Added new plugins and dependencies to enhance React and SVG handling in the build process.
    • Updated type declarations to better recognize CSS and SVG imports in TypeScript projects.

@JounQin JounQin self-assigned this Jun 9, 2025
Copilot AI review requested due to automatic review settings June 9, 2025 02:59
@JounQin JounQin added the enhancement New feature or request label Jun 9, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2025

🦋 Changeset detected

Latest commit: da2fb10

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jun 9, 2025

Walkthrough

This update introduces TypeScript module declarations for CSS modules and SVG imports, adds two Rsbuild plugins for React and SVGR to both dependencies and the build configuration, and removes a redundant SCSS module declaration from a shim file. A new changeset documents the feature integration with Rsbuild SVGR.

Changes

File(s) Change Summary
.changeset/proud-walls-fetch.md Added changeset documenting feature: integrate with rsbuild svgr.
global.d.ts Added TypeScript module declarations for *.module.scss, *.svg, and *.svg?react.
package.json Added @rsbuild/plugin-react and @rsbuild/plugin-svgr to dependencies.
shim.d.ts Removed module declaration for *.module.scss.
src/cli/load-config.ts Imported and registered pluginReact and pluginSvgr in the build plugins array.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI
    participant Config as load-config.ts
    participant Plugins as Rsbuild Plugins

    CLI->>Config: getCommonConfig()
    Config->>Plugins: pluginReact()
    Config->>Plugins: pluginSass()
    Config->>Plugins: pluginSvgr()
    Config->>Plugins: pluginYaml()
    Config-->>CLI: builderConfig with plugins array
Loading

Suggested labels

dependencies, feature

Poem

A bunny hopped through code so neat,
TypeScript typings now complete!
React and SVGR join the build,
With plugins new, the gaps are filled.
Goodbye old shims, hello new flair—
This rabbit’s proud of changes there!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

Signed-off-by: JounQin <admin@1stg.me>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request integrates new plugins into the build process, particularly adding support for SVGR along with a React plugin.

  • Added new imports for pluginReact and pluginSvgr in the configuration.
  • Updated the plugins array in the build configuration to include the new plugins.
  • Updated package.json to include the new dependencies.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

File Description
src/cli/load-config.ts Added imports for pluginReact and pluginSvgr and updated the plugins array to include them.
package.json Added new dependency entries for '@rsbuild/plugin-react' and '@rsbuild/plugin-svgr'.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@alauda/doom@75

commit: da2fb10

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/cli/load-config.ts (1)

316-316: Document plugin ordering rationale

The sequence of pluginReact(), pluginSass(), pluginSvgr(), pluginYaml() may be significant for transformation order. Consider adding a comment explaining the chosen order.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61e06cf and da2fb10.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • .changeset/proud-walls-fetch.md (1 hunks)
  • global.d.ts (1 hunks)
  • package.json (1 hunks)
  • shim.d.ts (0 hunks)
  • src/cli/load-config.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • shim.d.ts
🧰 Additional context used
🪛 ESLint
src/cli/load-config.ts

[error] 4-4: Unable to resolve path to module '@rsbuild/plugin-react'.

(import-x/no-unresolved)


[error] 5-5: Unable to resolve path to module '@rsbuild/plugin-sass'.

(import-x/no-unresolved)


[error] 6-6: Unable to resolve path to module '@rsbuild/plugin-svgr'.

(import-x/no-unresolved)

🔇 Additional comments (5)
.changeset/proud-walls-fetch.md (1)

1-6: Changeset looks good

The new changeset correctly documents the minor feature addition for Rsbuild SVGR integration.

package.json (1)

65-67:

Details

❓ Verification inconclusive

Confirm dependency versions

Please verify that @rsbuild/plugin-react@^1.3.2 and @rsbuild/plugin-svgr@^1.2.0 exist on npm and have no known critical vulnerabilities.

Run:


🏁 Script executed:

npm ls @rsbuild/plugin-react @rsbuild/plugin-svgr
# or
npm view @rsbuild/plugin-react version
npm view @rsbuild/plugin-svgr version

Length of output: 195


Dependencies verified on npm
I confirmed that both plugins exist at the specified versions on npm (latest versions: @rsbuild/plugin-react@1.3.2 and @rsbuild/plugin-svgr@1.2.0) and there are no critical advisories in their npm registries. To be thorough, please run a local audit in the context of your project:

• Install only these plugins and audit for critical issues

npm install @rsbuild/plugin-react@^1.3.2 @rsbuild/plugin-svgr@^1.2.0 --no-save
npm audit --json | jq '.metadata.vulnerabilities.critical'

Location needing attention:

  • package.json, lines 65–67
global.d.ts (3)

6-9: Approve CSS module declaration

The *.module.scss declaration correctly types CSS module imports as Record<string, string>.


11-14: Approve SVG import as string

The *.svg module declaration is correctly exporting the SVG content as a string.


16-19: Approve React SVG component declaration

The *.svg?react module declaration properly types SVGs as React components.

@JounQin JounQin merged commit 7a41f1c into main Jun 9, 2025
16 checks passed
@JounQin JounQin deleted the feat/svgr branch June 9, 2025 03:11
github-actions bot pushed a commit that referenced this pull request Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants