-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(next): astro:routes:resolved #12329
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
621d2d2
feat: work on astro:routes:resolved
florian-lefebvre fbb04e9
feat: work on jsdoc
florian-lefebvre 98e77c9
feat: support origin
florian-lefebvre 96f560b
misc
florian-lefebvre 65f5b60
feat: add test
florian-lefebvre 75a84dc
feat: add changeset
florian-lefebvre 3a3b083
Update packages/astro/src/types/public/integrations.ts
florian-lefebvre ec16abf
feat: rename property
florian-lefebvre ce0fc54
Merge branch 'next' into feat/routes-resolved
florian-lefebvre 7e26fa4
feat: handle partial manifest updates in dev
florian-lefebvre 319b405
Merge branch 'next' into feat/routes-resolved
florian-lefebvre db92a98
feat: include more properties and rename origin things
florian-lefebvre fc4e42c
feat: update origin
florian-lefebvre ebb12f9
feat: deprecate properties instead of whole object
florian-lefebvre b377e0f
Update packages/astro/src/types/public/internal.ts
florian-lefebvre 33b1165
feat: update test
florian-lefebvre 5576af9
feat: work on test
florian-lefebvre 46be686
feat: new assets
florian-lefebvre c9dcd7c
fix: test
florian-lefebvre 24600f0
fix: take dev routes into account
florian-lefebvre ea9abf4
Merge branch 'next' into feat/routes-resolved
florian-lefebvre 93a69e2
Update packages/astro/src/vite-plugin-astro-server/plugin.ts
florian-lefebvre e837aff
feat: address review
florian-lefebvre 7db88f9
Merge branch 'next' into feat/routes-resolved
florian-lefebvre 12088d0
fix: check and calls
florian-lefebvre e1f53d5
feat: address reviews
florian-lefebvre 539d40f
Apply suggestions from code review
florian-lefebvre 846c3a7
fix: normalize paths
florian-lefebvre cd62268
Merge branch 'next' into feat/routes-resolved
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 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Adds a new `astro:routes:resolved` hook to the Integration API. Also update the `astro:build:done` hook by deprecating `routes` and adding a new `assets` map. | ||
|
||
When building an integration, you can now get access to routes inside the `astro:routes:resolved` hook: | ||
|
||
```js | ||
const integration = () => { | ||
return { | ||
name: 'my-integration', | ||
hooks: { | ||
'astro:routes:resolved': ({ routes }) => { | ||
console.log(routes) | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
This hook runs before `astro:config:done`, and whenever a route changes in development. | ||
|
||
The `routes` array from `astro:build:done` is now deprecated, and exposed properties are now available on `astro:routes:resolved`, except for `distURL`. For this, you can use the newly exposed `assets` map: | ||
|
||
```diff | ||
const integration = () => { | ||
+ let routes | ||
return { | ||
name: 'my-integration', | ||
hooks: { | ||
+ 'astro:routes:resolved': (params) => { | ||
+ routes = params.routes | ||
+ }, | ||
'astro:build:done': ({ | ||
- routes | ||
+ assets | ||
}) => { | ||
+ for (const route of routes) { | ||
+ const distURL = assets.get(route.pattern) | ||
+ if (distURL) { | ||
+ Object.assign(route, { distURL }) | ||
+ } | ||
+ } | ||
console.log(routes) | ||
} | ||
} | ||
} | ||
} | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The discussion was marked as resolved because of commits, but we need to figure out the renaming of some fields