Skip to content

Starlight Route Data Middleware must not conflict with Astro's middleware#3018

Merged
delucis merged 19 commits intowithastro:mainfrom
trueberryless:conflicting-middleware
Apr 5, 2025
Merged

Starlight Route Data Middleware must not conflict with Astro's middleware#3018
delucis merged 19 commits intowithastro:mainfrom
trueberryless:conflicting-middleware

Conversation

@trueberryless
Copy link
Copy Markdown
Contributor

Description

As I noticed myself, the current documentation does not point out that Starlight's custom middleware may or may not conflict with Astro's middleware.

Related discussion: #3017 (pls comment your thoughts there, this PR is just an example)

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2025

🦋 Changeset detected

Latest commit: 7830d9d

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

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

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

@github-actions github-actions bot added the 📚 docs Documentation website changes label Mar 25, 2025
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 25, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 48a4e41
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/67f1440d8fe7e800080e9bbf
😎 Deploy Preview https://deploy-preview-3018--astro-starlight.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: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change 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 site configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Mar 25, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en reference/configuration.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Mar 26, 2025
@trueberryless trueberryless marked this pull request as ready for review March 27, 2025 17:19
@trueberryless trueberryless changed the title [WIP] Starlight Route Data Middleware must not conflict with Astro's middleware Starlight Route Data Middleware must not conflict with Astro's middleware Mar 27, 2025
@trueberryless
Copy link
Copy Markdown
Contributor Author

Shall we include in the changelog that setting srcDir bypasses the validation?

(change link to updated regex101)
Copy link
Copy Markdown
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Nice work @trueberryless and @HiDeoo getting testing set up as well 🙌

Suggesting some further details.

Copy link
Copy Markdown
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

🙌

trueberryless and others added 3 commits April 2, 2025 19:08
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
@trueberryless
Copy link
Copy Markdown
Contributor Author

I just realized that the routeMiddleware configuration option is currently missing in the configuration reference docs. I added it in the latest commit, maybe double check the wording as I'm no docs expert, but I think we can add this in this PR as well...

@trueberryless trueberryless marked this pull request as draft April 2, 2025 17:11
Copy link
Copy Markdown
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Great work here @trueberryless — I think it’s ready to go!

Made a couple of tiny final tweaks:

  • Now we have the config reference (well spotted that it was missing!) I removed the note from the route data guide about not conflicting with Astro’s middleware. My rationale for this is that in the context of a guide the focus is on accomplishing a task and these steps already suggest a specific non-conflicting file name for the middleware module. With the great new error message plus the note in config reference, I think it’s OK not to add this extra information in the middle of the goal-oriented guide.

  • Tweaked some config reference wording just slightly to remove “custom” from “custom route middleware” as all route middleware is technically “custom”, so I think we could simplify there.

  • Fixed a typo in a test name.

Thanks for the thoughtful way you went from experiencing issues yourself with the clash between middleware paths to thinking of this solution to providing clear errors to Starlight users. Lovely work!

@delucis delucis marked this pull request as ready for review April 5, 2025 14:58
@delucis delucis added the 🌟 patch Change that triggers a patch release label Apr 5, 2025
@delucis delucis merged commit 188b8cf into withastro:main Apr 5, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Apr 5, 2025
@trueberryless trueberryless deleted the conflicting-middleware branch April 5, 2025 15:15
Yoxnear pushed a commit to Yoxnear/starlight-custom that referenced this pull request Jul 23, 2025
…ware (withastro#3018)

Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
Co-authored-by: delucis <357379+delucis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes 🌟 patch Change that triggers a patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants