Skip to content
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

Adding docs for the new astro:build:generated hook #1572

Merged
merged 6 commits into from
Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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