Skip to content

feat(core)!: routeService ignore "_" prefix files by default #2149

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

Merged
merged 4 commits into from
Jul 28, 2025

Conversation

SoonIter
Copy link
Member

@SoonIter SoonIter commented May 12, 2025

Summary

Docusaurus has a Partial mdx convention, starting with '_', mainly used to exclude document fragments in convention-based routing.

import PartialExample from './_partial.mdx'

to replace

// rspress.config.ts
route: {
   exclude: ['**/shared/**']
}

Related Issue

https://docusaurus.io/docs/markdown-features/react#importing-markdown

Checklist

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

Copy link

netlify bot commented May 12, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit f60f23b
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/68877919e0ede40008cc66cb
😎 Deploy Preview https://deploy-preview-2149--rspress-v2.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

netlify bot commented May 12, 2025

Deploy Preview for rspress ready!

Name Link
🔨 Latest commit f60f23b
🔍 Latest deploy log https://app.netlify.com/projects/rspress/deploys/688779199b257c0008d6b60b
😎 Deploy Preview https://deploy-preview-2149--rspress.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 63 (🔴 down 14 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (🟢 up 9 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@Timeless0911
Copy link
Contributor

We need to document it.

@JounQin
Copy link
Collaborator

JounQin commented May 12, 2025

Would !**/_* restore the previous behavior?

@SoonIter
Copy link
Member Author

Would !**/_* restore the previous behavior?

what previous behavior?

@JounQin
Copy link
Collaborator

JounQin commented May 13, 2025

what previous behavior?

_foo.mdx won't be ignored, it'll be used as _foo route.

@Copilot Copilot AI review requested due to automatic review settings July 28, 2025 09:39
@SoonIter SoonIter force-pushed the syt/prefix-fragments branch from 66d4ac3 to dff53ef Compare July 28, 2025 09:39
Copy link
Contributor

@Copilot 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 PR implements automatic exclusion of files with underscore prefix from route generation, following Docusaurus partial MDX conventions. This allows developers to create partial/shared MDX components without needing to manually configure exclusion patterns.

  • Adds **/_* pattern to default route exclusions to automatically ignore underscore-prefixed files
  • Adds test fixture for partial MDX file to validate the exclusion behavior

Reviewed Changes

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

File Description
packages/core/src/node/route/RouteService.ts Adds default exclusion pattern for underscore-prefixed files
packages/core/src/node/route/fixtures/basic/guide/_d.mdx Test fixture for partial MDX file to verify exclusion works

@SoonIter SoonIter force-pushed the syt/prefix-fragments branch from dff53ef to d8f1c7a Compare July 28, 2025 12:47
@SoonIter SoonIter requested a review from JounQin July 28, 2025 13:20
@SoonIter SoonIter enabled auto-merge (squash) July 28, 2025 13:33
@SoonIter SoonIter merged commit bd66a12 into main Jul 28, 2025
11 checks passed
@SoonIter SoonIter deleted the syt/prefix-fragments branch July 28, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants