Conversation
Deploying rspress-v2 with
|
| Latest commit: |
2bad4c9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9d03acfd.rspress-v2.pages.dev |
| Branch Preview URL: | https://syt-vibe-kanban-752f-3161-84.rspress-v2.pages.dev |
Rsdoctor Bundle Diff AnalysisFound 3 projects in monorepo, 1 project with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 webPath:
📦 Download Diff Report: web Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
Pull request overview
Fixes issues where pages excluded by route.exclude / route.excludeConvention were still showing up in auto-generated (no-config) sidebars by filtering sidebar items against the actual route table (RouteService.isExistRoute).
Changes:
- Filter file-based sidebar items when the corresponding route does not exist, and prune empty directory groups / section headers.
- Add fixtures and tests to cover excluded-route filtering (both filesystem-discovered sidebars and
_meta.json-driven sidebars). - Add an implementation plan document describing the approach.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/node/auto-nav-sidebar/normalize.ts | Filters sidebar items via RouteService.isExistRoute, handles null items, and prunes empty groups/headers. |
| packages/core/src/node/auto-nav-sidebar/walk.test.ts | Adds tests for route.exclude filtering and _meta.json references to excluded pages; stabilizes RouteService mock resetting. |
| packages/core/src/node/auto-nav-sidebar/fixtures/docs-no-meta/api/_components/Button.mdx | New fixture to simulate an excluded page under an underscore directory. |
| packages/core/src/node/auto-nav-sidebar/fixtures/docs-exclude-meta/_nav.json | New fixture nav for excluded-meta test case. |
| packages/core/src/node/auto-nav-sidebar/fixtures/docs-exclude-meta/guide/_meta.json | New fixture _meta.json that references an excluded file. |
| packages/core/src/node/auto-nav-sidebar/fixtures/docs-exclude-meta/guide/a.md | New fixture page “a”. |
| packages/core/src/node/auto-nav-sidebar/fixtures/docs-exclude-meta/guide/b.mdx | New fixture page “b”. |
| packages/core/src/node/auto-nav-sidebar/fixtures/docs-exclude-meta/guide/excluded-file.md | New fixture page intended to be excluded by route existence filtering. |
| docs/plans/2026-02-27-exclude-routes-from-sidebar.md | Added implementation plan documentation for this feature/change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
https://github.com/smileluck/SmileX-Note-Repress/blob/main/plugins/auto-meta-plugin.ts Does it work if I generate the _meta.json file automatically by monitoring the file list? |
@smileluck Thanks for the suggestion 👍 From the perspective of _meta.json’s design goals, even if it is auto-generated based on the file list, it still typically requires manual intervention, for example:
If we rely entirely on auto-generation, the result is essentially “directory structure + lexicographical order.” and no-config pattern has implemented it, it's a supplement to _meta.json (only some cases) If the plugin you write meets your own needs, you can try using it yourself for some time, and then add it to Community plugins . |
7228ddf to
f7193a8
Compare
index.md at the top
Summary
Related Issue
route.excludeshould take effect in no-config route #3161Checklist
AI Summary
What
When
route.excludepatterns are configured (e.g.['_components/**']), excluded files no longer appear in auto-generated sidebar navigation.Previously,
route.excludeonly filtered files from route generation (RouteService), but the sidebar auto-generation (fsDirToMetaItems()innormalize.ts) scanned directories independently withfs.readdir()and had no knowledge of these exclude patterns. This caused excluded files to still show up in the sidebar.How
Reuses the existing
RouteService.isExistRoute(link)method in the sidebar generation code. When generating a sidebar file item, after computing its route path (link), we check whether that route actually exists. If it doesn't (because the file was excluded byroute.exclude), the sidebar item is skipped.Key changes in
packages/core/src/node/auto-nav-sidebar/normalize.ts:metaFileItemToSidebarItem()— After computinglink, checksRouteService.getInstance()?.isExistRoute(link). Returnsnullif the route doesn't exist.metaItemToSidebarItem()— Return type extended with| null. Emptydiranddir-section-headergroups are pruned when all children are excluded.metaDirItemToSidebarItem()—getItems()filters outnullresults. Same-name file and index file callers handlenullgracefully by falling back to non-clickable directory behavior.What this covers
route.excludeare filtered out during filesystem scanning_meta.jsonsidebars: Files explicitly listed in_meta.jsonbut excluded byroute.excludeare silently skippedRouteServicehas noisExistRoutemethod (e.g. in tests with partial mocks), no filtering occurs — existing behavior is preservedTests
route.exclude should filter sidebar items— no-config sidebar withisExistRoutemock excluding_componentspaths_meta.json referencing excluded file should skip it—_meta.jsonexplicitly references an excluded file, verifies it's silently skippedmdFileSetThis PR was written using Vibe Kanban