Skip to content

Commit

Permalink
Adding docs for the new astro:build:generated hook (withastro#1572)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
  • Loading branch information
3 people authored and nokazn committed Oct 2, 2022
1 parent c81430a commit 8db6fc9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/pages/en/reference/integrations-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface AstroIntegration {
pages: Map<string, PageBuildData>;
target: 'client' | 'server';
}) => void | Promise<void>;
'astro:build:generated'?: (options: { dir: URL }) => void | Promise<void>;
'astro:build:ssr'?: (options: { manifest: SerializedSSRManifest }) => void | Promise<void>;
'astro:build:done'?: (options: { pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise<void>;
};
Expand Down Expand Up @@ -273,11 +274,23 @@ The address, family and port number supplied by the [NodeJS Net module](https://
```
### `astro:build:generated`
**Previous hook:** [`astro:build:setup`](#astrobuildsetup)
**When:** After a static production build has finished generating routes and assets.
**Why:** To access generated routes and assets **before** build artifacts are cleaned up. This is a very uncommon use case. We recommend using [`astro:build:done`](#astrobuilddone) unless you really need to access the generated files before cleanup.
```js
'astro:build:generated'?: (options: { dir: URL }) => void | Promise<void>;
```
### `astro:build:ssr`
**Previous hook:** [`astro:build:setup`](#astrobuildsetup)
**When:** After a production build (SSG or SSR) has completed.
**When:** After a production SSR build has completed.
**Why:** To get access the SSR manifest, this is useful when creating custom SSR builds in plugins or integrations.
Expand Down

0 comments on commit 8db6fc9

Please sign in to comment.