0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00
astro/.changeset/tiny-plums-crash.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.2 KiB
Markdown
Raw Normal View History

---
'@astrojs/underscore-redirects': minor
---
Updates the input requirements of `createRedirectsFromAstroRoutes`:
- `routeToDynamicTargetMap` keys are `IntegrationResolvedRoute` instead of `IntegrationRouteData` (obtained from the `astro:routes:resolved` hook)
- There's a new `assets` property, that can be obtained from the `astro:build:done` hook
```js
function myIntegration() {
let routes
let buildOutput
let config
return {
name: "my-integration",
hooks: {
"astro:routes:resolved": (params) => {
routes = params.routes
},
"astro:config:done": (params) => {
buildOutput = params.buildOutput
config = params.config
},
"astro:build:done": (params) => {
const redirects = createRedirectsFromAstroRoutes({
config,
buildOutput,
routeToDynamicTargetMap: new Map(
routes.map(route => [route, ''])
),
dir: params.dir,
assets: params.assets
})
}
}
}
}
```