-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: deprecate NodeApp #13271
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
+78
−90
Merged
feat: deprecate NodeApp #13271
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9de696b
deprecate nodeapp
florian-lefebvre e9c5dda
deprecate old stuff
florian-lefebvre 2abde36
adapter reference
florian-lefebvre 05473e3
Apply suggestions from code review
florian-lefebvre 1746d29
Apply suggestions from code review
florian-lefebvre 34ab153
Merge branch 'v6' into feat/deprecate-node-app
florian-lefebvre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,8 @@ | |
| - [generating routes with `RouteData`](#removed-routedatagenerate-adapter-api) | ||
| - [routes with percent-encoded percent signs (e.g. `%25`)](#removed-percent-encoding-in-routes) | ||
| - [`astro:ssr-manifest` virtual module](#removed-astrossr-manifest-virtual-module-integration-api) | ||
| - [`NodeApp` from `astro/app/node`](#deprecated-nodeapp-from-astroappnode-adapter-api) | ||
| - [`loadManifest()` and `loadApp()` from `astro/app/node`](#deprecated-loadmanifest-and-loadapp-from-astroappnode-adapter-api) | ||
|
|
||
| ### Zod 4 | ||
|
|
||
|
|
@@ -374,6 +376,70 @@ | |
|
|
||
| <ReadMore>Learn more about [available session drivers](/en/reference/session-driver-reference/#building-a-session-driver).</ReadMore> | ||
|
|
||
| ### Deprecated: `NodeApp` from `astro/app/node` (Adapter API) | ||
|
|
||
| <SourcePR number="15535" title="feat: deprecate NodeApp" /> | ||
|
|
||
| In Astro 5.x, adapters could implement their server entrypoint using `App` for standard web requests/responses, or `NodeApp` for node requests/responses. | ||
|
|
||
| Astro 6.0 deprecates `NodeApp` in favor of `createApp()` and new utilities: `createRequest()` and `writeResponse()`. This allows to have a more consistent API while preserving the same features as before. It also deprecates the `NodeAppHeadersJson` type. | ||
|
|
||
| #### What should I do? | ||
|
|
||
| If you have built an adapter, update any usage of `NodeApp` with `createApp()`: | ||
|
|
||
| ```js title="my-adapter/server.js" del={1-12} ins={13-22} | ||
| import { NodeApp } from 'astro/app/node'; | ||
|
|
||
| export function createExports(manifest) { | ||
| const app = new NodeApp(manifest); | ||
|
|
||
| const handler = async (req, res) => { | ||
| const response = await app.render(req); | ||
| await NodeApp.writeResponse(response, res); | ||
| }; | ||
|
|
||
| return { handler }; | ||
| } | ||
| import { createApp } from 'astro/app/entrypoint'; | ||
| import { createRequest, writeResponse } from 'astro/app/node'; | ||
|
|
||
| const app = createApp(); | ||
|
|
||
| export const handler = async (req, res) => { | ||
| const request = createRequest(req); | ||
| const response = await app.render(request); | ||
| await writeResponse(response, res); | ||
| } | ||
| ``` | ||
|
|
||
| <ReadMore>Learn more about [the `astro/app/node` module](/en/reference/adapter-reference/#astroappnode).</ReadMore> | ||
|
|
||
| ### Deprecated: `loadManifest()` and `loadApp()` from `astro/app/node` (Adapter API) | ||
|
|
||
| <SourcePR number="15535" title="feat: deprecate NodeApp" /> | ||
|
|
||
| In Astro 5.x, the `astro/app/node` exposed `loadManifest()` and `loadApp()` utilities to allow loading the SSR manifest or a `NodeApp` instance from a `URL` instance. However, this was not documented and not recommended for use anymore. | ||
florian-lefebvre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Astro 6.0 deprecates both functions. | ||
|
|
||
| #### What should I do? | ||
|
|
||
| If you have built an adapter, remove `loadManifest()` and replace `loadApp()` by `createApp()`: | ||
|
|
||
| ```js title="my-adapter/server.js" del={1-5} ins={6-8} | ||
| import { loadManifest, loadApp, NodeApp } from 'astro/app/node'; | ||
|
|
||
| const manifest = await loadManifest(new URL(import.meta.url)); | ||
| const app1 = new NodeApp(loadManifest); | ||
| const app2 = await loadApp(new URL(import.meta.url)); | ||
| import { createApp } from 'astro/app/entrypoint'; | ||
|
|
||
| const app = createApp(); | ||
| ``` | ||
|
|
||
| <ReadMore>Learn more about [the `astro/app/entrypoint` module](/en/reference/adapter-reference/#astroappentrypoint).</ReadMore> | ||
|
Check failure on line 441 in src/content/docs/en/guides/upgrade-to/v6.mdx
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depends on #13253 |
||
|
|
||
| ## Removed | ||
|
|
||
| The following features have now been entirely removed from the code base and can no longer be used. Some of these features may have continued to work in your project even after deprecation. Others may have silently had no effect. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.