Skip to content

Comments

feat: update edgeMiddleware references to middlewareMode#13277

Open
leekeh wants to merge 14 commits intowithastro:v6from
leekeh:v6
Open

feat: update edgeMiddleware references to middlewareMode#13277
leekeh wants to merge 14 commits intowithastro:v6from
leekeh:v6

Conversation

@leekeh
Copy link

@leekeh leekeh commented Feb 17, 2026

Description (required)

Update documentation to use middlewareMode instead of edgeMiddleware. Context is in linked PR.

For Astro version: 6.x. See astro PR #15495.

@netlify
Copy link

netlify bot commented Feb 17, 2026

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6526628
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/699c67540b2f770008c281f3
😎 Deploy Preview https://deploy-preview-13277--astro-docs-2.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.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented Feb 17, 2026

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

File Note
en/guides/integrations-guide/netlify.mdx Source changed, localizations will be marked as outdated.
en/guides/integrations-guide/vercel.mdx Source changed, localizations will be marked as outdated.
en/reference/adapter-reference.mdx Source changed, localizations will be marked as outdated.
ja/guides/integrations-guide/netlify.mdx Localization changed, will be marked as complete.
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.

@sarah11918 sarah11918 added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) 6.0 labels Feb 17, 2026
@sarah11918 sarah11918 added this to the v6.0.0 docs milestone Feb 17, 2026
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Thank you for the helpful docs contribution @leekeh ! Just some comments/questions below to help us start to wrangle this into our existing docs style, and I will ask for @ArmandPhilippot 's help too!

Please note that YOU are the expert in your feature, not me... I'm just trying to make the words fit. So I'll need your help to do that, and it's totally expected that you may have to correct me as we work this out! 😄

}
```

### `MiddlewareMode`
Copy link
Member

Choose a reason for hiding this comment

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

@ArmandPhilippot I'll ask for your guidance here. Somehow it feels less helpful to have such a short entry here that actually tells people which values they can set as a middleware mode? I would think that that it's more valuable that in the entry above for the config option, people can very quickly see "oh, it's classic or edge!" rather than see "Oh, middleware mode is a middleware mode" then need to follow a trail to get here?

But, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

My take would be: Is this type useful so that the user can use it elsewhere (for example, a helper function) or is it only useful in this specific case? I would say the second one here, but I'm not an adapter builder so I could be wrong.

If there are use cases for the type, while I agree with Sarah, I think this can helpful to have an entry for it (so people know they can import it). Otherwise, yes, we probably don't need this and we can replace MiddlewareMode with "classic" | "edge" in the property type!

Copy link
Author

Choose a reason for hiding this comment

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

Use case would mainly be for adapter developers, to expose this as a property on the adapter. I'd recommend using the type over hardcoding it, since it is going to change in the (near) future.

</p>

Defines whether any on-demand rendering middleware code will be bundled when built.
Defines in which way middleware is run.
Copy link
Member

Choose a reason for hiding this comment

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

This is a little vague, and maybe leads to explaining more about what's going on in each option below than might be necessary?

If there does happen to be a defining axis/split on which these two options are clearly different, it would be nice to get that upfront HERE.

(e.g., -- and this is just words as examples for adding more detail, not meant to be accurate -- "Defines when and how middleware is run" at least gives a hint that middleware might run at different times, so people are primed for thinking about choosing options below based on WHEN they'd like their middleware to run. That's still pretty general, so if there is any more precise difference, I'd gladly take something even more informative here!)

Copy link
Author

Choose a reason for hiding this comment

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

Fair point, I improved it with this:
Determines at which stage of the page lifecycle the middleware is executed, and how the middleware code is emitted in the build output.
Let me know if it suffices.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I think that's so much more helpful to the reader! I appreciate you digging a little deeper.

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution and the implementation! 🙌🏽 I left a few comments, feel free to ask if something is not clear.
This is mostly to answer Sarah's question and to try to keep some consistency so that visitors see a similar pattern and are not confused when moving from one section/page to another!

}
```

### `MiddlewareMode`
Copy link
Member

Choose a reason for hiding this comment

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

My take would be: Is this type useful so that the user can use it elsewhere (for example, a helper function) or is it only useful in this specific case? I would say the second one here, but I'm not an adapter builder so I could be wrong.

If there are use cases for the type, while I agree with Sarah, I think this can helpful to have an entry for it (so people know they can import it). Otherwise, yes, we probably don't need this and we can replace MiddlewareMode with "classic" | "edge" in the property type!

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, I personally think this looks better now! I left a few suggestions to fix the code snippets/links.

leekeh and others added 2 commits February 19, 2026 14:58
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Checked the deploy preview and that looks good to me! Thanks for your help writing great docs, @leekeh ! 💪

@ArmandPhilippot
Copy link
Member

Ah, it seems we have a broken link because of a translation. Adapter reference is not yet translated in Japanese, so /ja/guides/integrations-guide/netlify is using the English anchor.

If you're able to update:

事前レンダリングされたページのリダイレクト、アクセス制御、またはカスタムレスポンスヘッダーを実装するには、[`edgeMiddleware`オプション](/ja/reference/adapter-reference/#edgemiddleware)を有効にして、Netlify Edge Functionsでミドルウェアを実行します。

with the following replacement:

-[`edgeMiddleware`オプション](/ja/reference/adapter-reference/#edgemiddleware)
+[`middlewareMode`オプション](/ja/reference/adapter-reference/#middlewareMode)

The tests should pass!

But, if you prefer we can also push a fix to your branch!

A set of features that changes the output of the emitted files. When an adapter opts in to these features, they will get additional information inside specific hooks and must implement the proper logic to handle the different output.

### `edgeMiddleware`
### `middlewareMode`
Copy link
Member

Choose a reason for hiding this comment

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

Noting that this is causing a link failure in /ja/ where this is translated and the Netlify guide is linking here.

Would be great if @jp-knj or @morinokami could jump in here! We can translate just the heading, then use that as the anchor link on the Netlify page (but still mark this as [i18nIgnore] so that it's clear the pages do still need the regular updates.

One thing we could do that doesn't have to include any translations yet, since the Netlify guide will need to update anyway is that this PR could temporarily just update the ja adapter page to say (in English) "middlewareMode", and then we hard code the English slug in the broken link. When the translators go to update the Netlify page, they can also change the English heading and slug to translations. (note this would still require [i18nIgnore] in the subject because we would have touched those /ja/ files)

@sarah11918
Copy link
Member

Armand and I have to stop meeting like this! 😄

Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

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

Thanks @leekeh, I have a few nits 🙌

leekeh and others added 2 commits February 20, 2026 07:42
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
@leekeh leekeh changed the title feat: update edgeMiddleware references to middlewareMode feat: update edgeMiddleware references to middlewareMode Feb 20, 2026
@sarah11918
Copy link
Member

Hi @leekeh ! Just a reminder that we can't merge this PR with a broken link. I think Armand's solution is simpler than mine, so please just update the link anchor as described in his earlier comment here: #13277 (comment)

@github-actions github-actions bot added the i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help! label Feb 23, 2026
Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

Thank you for fixing that link! 🙌🏽 LGTM! Now, we just need to wait for the implementation to be released before merging the docs!

@leekeh
Copy link
Author

leekeh commented Feb 23, 2026

Thank you for fixing that link! 🙌🏽 LGTM! Now, we just need to wait for the implementation to be released before merging the docs!

Thanks 😄 Thanks also for your patience with me, I will try to stick to the rules better in my next contribution 🙂 This was my first one, it's really inspiring to see the level of quality you guys push and the clear guidelines that exist.

@sarah11918
Copy link
Member

(Also updated branch to include the most recent Lunaria fixes)

@sarah11918
Copy link
Member

Thank you so much for your patience with us, @leekeh ! I think updating the URL and the branch should make all the tests pass here.

In any case, it's now OUR responsibility to get this into a merge-able shape and out whenever the feature is released. You've done your job, and we appreciate it! 🫡

Welcome to Team Docs! 🥳

@sarah11918 sarah11918 added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label Feb 23, 2026
Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

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

Looking good! Great work here! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.0 add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help! Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants