-
Notifications
You must be signed in to change notification settings - Fork 2
feat!: migrate to rspress v2 #28
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
Conversation
🦋 Changeset detectedLatest commit: c64dcf4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
WalkthroughThis update migrates the project to use Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant ConfigLoader
participant Builder
User->>CLI: Run build command
CLI->>ConfigLoader: Load config (no explicit Shiki plugin)
ConfigLoader->>Builder: Pass config with pluginSass, built-in Shiki transformers
Builder-->>CLI: Build process completes
CLI-->>User: Output build result
Assessment against linked issues
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 PR migrates the project to rspress v2, removing shiki integrations and updating dependencies to align with the new version. Key changes include:
- Removal of shiki-related CSS, types, and plugin files.
- Updates to markdown configuration and build tooling (including the addition of sass support).
- Bump and adjustment of several dependency versions.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| styles/shiki.css | Removed custom shiki theme styles. |
| styles/global.scss | Removed import of the shiki.css file. |
| src/types.ts | Eliminated obsolete shiki types from module declarations. |
| src/runtime/components/JsonViewer.tsx | Removed the codeHighlighter prop from code components. |
| src/plugins/shiki/rehypePlugin.ts | Removed the rehype plugin for shiki. |
| src/plugins/shiki/index.ts | Removed shiki plugin implementation and related exports. |
| src/plugins/shiki/highlighter.ts | Removed highlighter creation logic. |
| src/plugins/replace/utils.ts | Updated mdast type import from YAML to Yaml. |
| src/plugins/replace/index.ts | Added module declarations for unified and mdast. |
| src/plugins/auto-toc/remark-auto-toc.ts | Updated class attribute to exclude toc in auto-generated content. |
| src/cli/load-config.ts | Removed shikiPlugin configuration and added pluginSass to builders. |
| src/cli/index.ts | Removed the appDirectory parameter from the build configuration. |
| patches/unist-util-visit-parents+5.1.3.patch | Removed obsolete patch for unist-util-visit-parents. |
| package.json | Updated multiple dependency versions reflecting migration changes. |
| .changeset/pre.json | Added new changeset file for pre-release version management. |
Comments suppressed due to low confidence (3)
src/plugins/shiki/rehypePlugin.ts:1
- The complete removal of the shiki rehype plugin indicates a breaking change; please verify that no other modules depend on this integration.
import { logger } from '@rspress/shared/logger'
src/cli/load-config.ts:225
- The removal of the shikiPlugin configuration alters markdown highlighting behavior; update the migration guide and documentation to reflect these changes.
shikiPlugin({ ... })
src/cli/index.ts:222
- The removal of the appDirectory parameter from the build configuration is a breaking change; ensure that related documentation is updated accordingly.
appDirectory: CWD,
commit: |
Signed-off-by: JounQin <admin@1stg.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
🛑 Comments failed to post (1)
src/cli/load-config.ts (1)
5-5: 💡 Verification agent
🧩 Analysis chain
Make sure the new dependency is properly installed.
The added import for
pluginSassmatches the new dependency in package.json, but static analysis indicates it can't resolve the module path. Verify the installation is complete and correctly configured.
🏁 Script executed:
#!/bin/bash # Check if @rsbuild/plugin-sass is properly installed and can be resolved # Look for the package in node_modules if [ -d "node_modules/@rsbuild/plugin-sass" ]; then echo "✅ @rsbuild/plugin-sass is installed in node_modules" else echo "❌ @rsbuild/plugin-sass is not found in node_modules" fi # Check if it can be resolved through Node.js node -e "try { require.resolve('@rsbuild/plugin-sass'); console.log('✅ Module can be resolved'); } catch(e) { console.log('❌ Module cannot be resolved:', e.message); }"Length of output: 462
Install @rsbuild/plugin-sass and verify resolution
The import in src/cli/load-config.ts (line 5) is failing because the package isn’t installed. To fix:
Add
@rsbuild/plugin-sassto your dependencies in package.json, for example:"dependencies": { + "@rsbuild/plugin-sass": "^<latest-version>", … }Run your package manager (e.g.
npm installoryarn add @rsbuild/plugin-sass).Confirm
node_modules/@rsbuild/plugin-sassnow exists.Re-run
node -e "require.resolve('@rsbuild/plugin-sass')"to ensure the module can be resolved.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.// package.json { "dependencies": { "@rsbuild/plugin-sass": "^<latest-version>", … } }🧰 Tools
🪛 ESLint
[error] 5-5: Unable to resolve path to module '@rsbuild/plugin-sass'.
(import-x/no-unresolved)
🤖 Prompt for AI Agents
In src/cli/load-config.ts at line 5, the import of pluginSass from '@rsbuild/plugin-sass' fails because the package is not installed. To fix this, add '@rsbuild/plugin-sass' to your package.json dependencies and run your package manager (npm or yarn) to install it. After installation, verify that node_modules/@rsbuild/plugin-sass exists and that Node.js can resolve the module by running require.resolve('@rsbuild/plugin-sass').
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (21)
.changeset/pre.json(1 hunks).changeset/rotten-cows-cough.md(1 hunks)package.json(3 hunks)patches/unist-util-visit-parents+5.1.3.patch(0 hunks)src/cli/index.ts(0 hunks)src/cli/load-config.ts(3 hunks)src/plugins/auto-toc/remark-auto-toc.ts(1 hunks)src/plugins/replace/index.ts(1 hunks)src/plugins/replace/normalize-img-src.ts(2 hunks)src/plugins/replace/rehype-normalize-link.ts(1 hunks)src/plugins/replace/remark-replace.ts(3 hunks)src/plugins/replace/resolve-reference.ts(3 hunks)src/plugins/replace/resolve-release.ts(2 hunks)src/plugins/replace/utils.ts(2 hunks)src/plugins/shiki/highlighter.ts(0 hunks)src/plugins/shiki/index.ts(0 hunks)src/plugins/shiki/rehypePlugin.ts(0 hunks)src/runtime/components/JsonViewer.tsx(1 hunks)src/types.ts(0 hunks)styles/global.scss(0 hunks)styles/shiki.css(0 hunks)
💤 Files with no reviewable changes (8)
- src/cli/index.ts
- styles/global.scss
- src/types.ts
- src/plugins/shiki/rehypePlugin.ts
- src/plugins/shiki/highlighter.ts
- styles/shiki.css
- src/plugins/shiki/index.ts
- patches/unist-util-visit-parents+5.1.3.patch
✅ Files skipped from review due to trivial changes (5)
- .changeset/rotten-cows-cough.md
- src/plugins/replace/normalize-img-src.ts
- src/plugins/replace/resolve-reference.ts
- src/plugins/replace/resolve-release.ts
- src/plugins/replace/remark-replace.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- .changeset/pre.json
- src/runtime/components/JsonViewer.tsx
- src/plugins/replace/utils.ts
- src/plugins/auto-toc/remark-auto-toc.ts
- src/plugins/replace/index.ts
- package.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/cli/load-config.ts (1)
src/plugins/shiki/transformers/callouts.ts (1)
createTransformerCallouts(9-24)
🪛 ESLint
src/cli/load-config.ts
[error] 5-5: Unable to resolve path to module '@rsbuild/plugin-sass'.
(import-x/no-unresolved)
🔇 Additional comments (3)
src/cli/load-config.ts (2)
229-244: Well-structured Shiki configuration for rspress v2This configuration properly implements the Shiki syntax highlighting system for rspress v2, replacing the previous custom implementation. The combination of built-in transformers and the custom callouts transformer provides comprehensive syntax highlighting capabilities.
The configuration includes essential transformers for code highlighting features like:
- Word and line highlighting
- Diff notation
- Error level indication
- Focus highlighting
- And the custom callouts implementation
This aligns well with the migration to rspress v2 mentioned in the PR objectives.
282-282: Plugin configuration updated for rspress v2The builder configuration has been updated to use
pluginSass()instead of the previousshikiPlugin, aligning with the PR's objective to migrate to rspress v2 and remove the custom Shiki integration.This change complements the removal of Shiki CSS styles mentioned in the AI summary and follows the architectural recommendations for rspress v2.
src/plugins/replace/rehype-normalize-link.ts (1)
51-51:Details
❓ Verification inconclusive
Potential runtime error from removal of fallback object assignment
The code now directly destructures
altandsrcfromnode.propertieswithout a fallback empty object. This change could potentially lead to TypeErrors ifnode.propertiesis ever undefined or null.Consider verifying if
node.propertiesis guaranteed to be defined in all cases, or restore the fallback for safer operation:- const { alt, src } = node.properties + const { alt, src } = node.properties || {}
🏁 Script executed:
#!/bin/bash # Check if there are any similar destructuring patterns in the codebase and how they're handled # First look for other occurrences of destructuring from node.properties echo "Checking for other node.properties destructuring patterns:" rg "const .* = node\.properties" -A 1 -B 1 # Check the unist/hast documentation in node_modules echo "Checking if node.properties is documented as potentially undefined:" fd -t f "README.md" node_modules/hastLength of output: 639
To verify whether
node.propertiescan ever be undefined in this plugin, let’s inspect the full contents of the file and see hownodeis typed and used throughout:
🏁 Script executed:
#!/bin/bash # Locate and print the plugin file for review set -eux file=$(fd -t f "rehype-normalize-link.ts" src) echo "=== $file ===" cat "$file"Length of output: 2179
Let’s verify the HAST
Elementtype to see ifpropertiesis always defined:
🏁 Script executed:
#!/bin/bash set -eux # Find and inspect the HAST type definitions for Element file=$(fd -t f "index.d.ts" node_modules/hast | head -n1) echo "=== $file ===" grep -R "interface Element" -n "$file" grep -R "properties" -n "$file" | sed -n '1,20p'Length of output: 272
I wasn’t able to locate the HAST
Elementtype definitions to confirm whetherpropertiesis always present. Could you please check your project’s HAST interfaces (e.g. innode_modules/hast/index.d.tsor@types/hast) and verify if thepropertiesfield onElementis defined as optional? If it is, restoring the fallback is safest:- const { alt, src } = node.properties + const { alt, src } = node.properties || {}
close #27
Summary by CodeRabbit
rspressversion 2, introducing compatibility with the latest major release.