-
Notifications
You must be signed in to change notification settings - Fork 2
chore: bump @rspress/core to v2.0.0-beta.7
#30
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: dd0dd41 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 refactors multiple React components to replace dynamic state-based initialization of a custom MDX component with a direct static import. Several dependencies are updated, configuration files are adjusted for Node.js and formatting, and a new utility file is introduced to centralize the MDX component logic. Minor metadata and configuration changes are also included. Changes
Sequence Diagram(s)sequenceDiagram
participant Component as Any Component (e.g., TermsTable)
participant X as _X.js (Custom MDX Component)
Note over Component,X: Before: Component initializes X via useState(getCustomMDXComponent)
Component->>X: import { X } from './_X.js'
Component->>Component: Use <X.*> elements directly in render
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (1)src/runtime/components/K8sCrd.tsx (3)🪛 ESLintsrc/runtime/components/_HeadingTitle.tsx[error] 2-2: Unable to resolve path to module 'react'. (import-x/no-unresolved) src/runtime/components/OpenAPIRef.tsx[error] 4-4: Unable to resolve path to module 'react'. (import-x/no-unresolved) src/runtime/components/_Markdown.tsx[error] 1-1: Unable to resolve path to module 'react'. (import-x/no-unresolved) [error] 2-2: Unable to resolve path to module 'react-markdown'. (import-x/no-unresolved) [error] 3-3: Unable to resolve path to module 'remark-gfm'. (import-x/no-unresolved) src/runtime/components/K8sPermissionTable.tsx[error] 5-5: Unable to resolve path to module 'react'. (import-x/no-unresolved) src/runtime/components/K8sCrd.tsx[error] 5-5: Unable to resolve path to module '@rspress/core/theme'. (import-x/no-unresolved) src/runtime/components/JsonViewer.tsx[error] 1-1: Unable to resolve path to module '@rspress/core/theme'. (import-x/no-unresolved) src/runtime/components/OpenAPIPath.tsx[error] 2-2: Unable to resolve path to module '@rspress/core/theme'. (import-x/no-unresolved) [error] 5-5: Unable to resolve path to module 'github-slugger'. (import-x/no-unresolved) [error] 6-6: Unable to resolve path to module 'openapi-types'. (import-x/no-unresolved) [error] 7-7: Unable to resolve path to module 'react'. (import-x/no-unresolved) src/runtime/components/_X.tsx[error] 1-1: Unable to resolve path to module '@rspress/core/theme'. (import-x/no-unresolved) 🔇 Additional comments (19)
✨ Finishing Touches
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. 🪧 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 bumps @rspress/core to v2.0.0-beta.7 and refactors how MDX components are initialized and consumed across runtime components.
- Introduce a shared
Xobject fromgetCustomMDXComponent()in a new_X.tsx - Replace local
useState(getCustomMDXComponent)hooks with imports ofXin all relevant components - Swap out custom
<X.pre>/<X.code>blocks inJsonViewerforCodeBlockRuntimeand bump various dependencies
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/runtime/components/_X.tsx | New file exporting X via getCustomMDXComponent() |
| src/runtime/components/_RefLink.tsx | Import X instead of using state hook for MDX components |
| src/runtime/components/_Markdown.tsx | Use X for ReactMarkdown components prop |
| src/runtime/components/_HeadingTitle.tsx | Remove state hook; use X.h1–X.h6 for heading elements |
| src/runtime/components/TermsTable.tsx | Import X and drop local MDX state hook |
| src/runtime/components/OpenAPIRef.tsx | Swap out MDX state hook for X |
| src/runtime/components/OpenAPIPath.tsx | Replace MDX state hook with X |
| src/runtime/components/K8sPermissionTable.tsx | Use shared X, remove state hook |
| src/runtime/components/K8sCrd.tsx | Import X in place of per-component MDX hook |
| src/runtime/components/JsonViewer.tsx | Replace <X.pre>/<X.code> with CodeBlockRuntime |
| package.json | Bumped @rspress/core and other dependencies |
| .prettierignore | Removed redundant ignore entries |
| .codesandbox/ci.json | Updated Node version from 18 to 20 |
| .changeset/config.json | Reformatted changelog entry and set access to public |
Comments suppressed due to low confidence (2)
src/runtime/components/_HeadingTitle.tsx:21
- The dependency array for useMemo includes
X, which is a static import and will never change. Consider using an empty array[]to avoid unnecessary re-computations.
}, [X])
src/runtime/components/_X.tsx:3
- [nitpick] The name
Xis very generic and may reduce readability. Consider renaming it to something more descriptive, such asMDXComponentsorCustomComponents.
export const X = getCustomMDXComponent()
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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (15)
.changeset/config.json(1 hunks).changeset/eight-cougars-agree.md(1 hunks).codesandbox/ci.json(1 hunks).prettierignore(0 hunks)package.json(3 hunks)src/runtime/components/JsonViewer.tsx(2 hunks)src/runtime/components/K8sCrd.tsx(2 hunks)src/runtime/components/K8sPermissionTable.tsx(2 hunks)src/runtime/components/OpenAPIPath.tsx(1 hunks)src/runtime/components/OpenAPIRef.tsx(1 hunks)src/runtime/components/TermsTable.tsx(1 hunks)src/runtime/components/_HeadingTitle.tsx(1 hunks)src/runtime/components/_Markdown.tsx(1 hunks)src/runtime/components/_RefLink.tsx(1 hunks)src/runtime/components/_X.tsx(1 hunks)
💤 Files with no reviewable changes (1)
- .prettierignore
🧰 Additional context used
🪛 ESLint
src/runtime/components/_Markdown.tsx
[error] 1-1: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
[error] 2-2: Unable to resolve path to module 'react-markdown'.
(import-x/no-unresolved)
[error] 3-3: Unable to resolve path to module 'remark-gfm'.
(import-x/no-unresolved)
src/runtime/components/_X.tsx
[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
src/runtime/components/JsonViewer.tsx
[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
src/runtime/components/K8sCrd.tsx
[error] 5-5: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
src/runtime/components/_HeadingTitle.tsx
[error] 2-2: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/OpenAPIPath.tsx
[error] 2-2: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
[error] 5-5: Unable to resolve path to module 'github-slugger'.
(import-x/no-unresolved)
[error] 6-6: Unable to resolve path to module 'openapi-types'.
(import-x/no-unresolved)
[error] 7-7: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/OpenAPIRef.tsx
[error] 4-4: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/K8sPermissionTable.tsx
[error] 5-5: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
🔇 Additional comments (19)
.codesandbox/ci.json (1)
2-2: LGTM! Node.js version update aligns with project requirements.The update from Node.js 18 to 20 is consistent with the
enginesfield inpackage.jsonwhich supports">=18.17.0 <20 || >=20.1.0". This ensures the CodeSandbox environment uses a supported Node.js version.src/runtime/components/_X.tsx (1)
1-3: Excellent refactoring to centralize MDX component logic.This utility file follows the DRY principle by centralizing the
getCustomMDXComponentlogic, allowing other components to importXstatically instead of managing it as state. This approach improves performance by eliminating unnecessary re-renders and simplifies component logic across the codebase.The static analysis warning about the unresolved import path is likely a false positive, as
@rspress/core/themeis a valid import from the updated@rspress/core@2.0.0-beta.7dependency.🧰 Tools
🪛 ESLint
[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
.changeset/config.json (2)
3-8: Good formatting improvement for readability.The multi-line formatting of the changelog array enhances readability and maintainability of the configuration.
12-12: Access change aligns with publishing configuration updates.Changing access from "restricted" to "public" is consistent with the removal of the
accessproperty frompackage.json'spublishConfig, indicating a coordinated move towards public package publishing.package.json (3)
60-61: Dependency updates look good and support the MDX refactoring.The key update to
@rspress/core@2.0.0-beta.7enables the new MDX component pattern seen in_X.tsxand other components. The other dependency updates appear to be minor version bumps with bug fixes and improvements.Also applies to: 66-66, 97-97
109-109: Dev dependency updates are appropriate.The updates to development dependencies like
@swc/core,@types/react, and ESLint plugins maintain compatibility with the latest tooling and type definitions.Also applies to: 115-115, 120-124
132-134: PublishConfig simplification aligns with changeset configuration.Removing the
access: "public"property frompublishConfigis consistent with the access change in.changeset/config.json, indicating a coordinated approach to publishing configuration..changeset/eight-cougars-agree.md (1)
1-6: LGTM! Standard changeset documentation.The changeset follows the proper format and clearly documents the purpose of bumping
@rspress/coreto v2.0.0-beta.7.src/runtime/components/K8sCrd.tsx (1)
14-14: LGTM! Consistent refactoring to static import pattern.The change from
useState(getCustomMDXComponent)to direct import ofXfrom./_X.jsis well-executed. This eliminates unnecessary React state management and should improve performance by avoiding re-renders when the component doesn't actually change.Also applies to: 184-187
src/runtime/components/TermsTable.tsx (2)
4-4: LGTM! Consistent static import pattern.The refactoring follows the same pattern as other components, replacing dynamic component resolution with a clean static import from
./_X.js.
19-26: LGTM! All X. component usages are preserved correctly.*The extensive use of X-prefixed components (X.ul, X.li, X.table, X.tr, X.th, X.td) throughout the terms table rendering logic remains consistent and functional. The refactoring doesn't affect the component's ability to render tables with conditional columns and bad case lists.
Also applies to: 29-53
src/runtime/components/_RefLink.tsx (1)
3-3: LGTM! Clean and consistent refactoring.The static import of
Xand its usage in<X.a>follows the established pattern perfectly. The component's core functionality for processing OpenAPI$reflinks remains intact while benefiting from the simplified import structure.Also applies to: 16-16
src/runtime/components/_Markdown.tsx (1)
1-1: Good refactoring to static imports.The change from dynamic state-based component initialization to static imports simplifies the component logic and eliminates unnecessary state management.
Also applies to: 5-5
🧰 Tools
🪛 ESLint
[error] 1-1: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/_HeadingTitle.tsx (1)
2-2: Excellent refactoring that improves performance.Replacing the
useState(getCustomMDXComponent)with a direct static import eliminates unnecessary state management and potential re-renders. TheuseMemodependency on[X]remains appropriate for the static import.Also applies to: 4-4
🧰 Tools
🪛 ESLint
[error] 2-2: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/OpenAPIRef.tsx (1)
4-4: Consistent refactoring approach.The removal of
useState(getCustomMDXComponent)and replacement with static import ofXis consistent with the broader refactoring pattern. This simplifies theOpenAPIPropertiescomponent logic.Also applies to: 11-11
🧰 Tools
🪛 ESLint
[error] 4-4: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/JsonViewer.tsx (2)
1-1: Good simplification of imports.The removal of unused
getCustomMDXComponentanduseStateimports streamlines the component dependencies.🧰 Tools
🪛 ESLint
[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
13-14: Appropriate use of TypeScript suppress comments.The
@ts-expect-errorcomments reference a specific GitHub issue (web-infra-dev/rspress/pull/2205), indicating that the typing issues are known and being addressed. This is a proper way to handle temporary type incompatibilities during the transition period.Also applies to: 17-18
src/runtime/components/K8sPermissionTable.tsx (1)
5-5: Good refactoring to static imports!The removal of
useStateand migration to a static import of theXcomponent from./_X.jsis a solid improvement. This eliminates unnecessary re-renders and state management overhead.Also applies to: 14-14
🧰 Tools
🪛 ESLint
[error] 5-5: Unable to resolve path to module 'react'.
(import-x/no-unresolved)
src/runtime/components/OpenAPIPath.tsx (1)
2-2: Consistent refactoring pattern applied!The changes here follow the same pattern as in
K8sPermissionTable.tsx:
- Removed
getCustomMDXComponentimport- Removed
useStatefrom React imports- Added static import of
Xfrom./_X.jsThis maintains consistency across the codebase and provides the same performance benefits.
Also applies to: 7-7, 15-15
🧰 Tools
🪛 ESLint
[error] 2-2: Unable to resolve path to module '@rspress/core/theme'.
(import-x/no-unresolved)
commit: |
Summary by CodeRabbit
package.jsonpublish configuration..changeset/config.jsonfor better clarity and changed "access" to "public".JsonViewer,K8sCrd,K8sPermissionTable,OpenAPIPath,OpenAPIRef,TermsTable,_HeadingTitle,_Markdown,_RefLink), removing use ofgetCustomMDXComponentanduseState.X) from local modules instead of managing them via state.