Added readonly config to more hooks
This commit is contained in:
parent
7e5f6f1cbb
commit
1278d39b86
2 changed files with 10 additions and 10 deletions
|
@ -679,11 +679,11 @@ export interface AstroIntegration {
|
|||
// injectElement: (stage: vite.HtmlTagDescriptor, element: string) => void;
|
||||
}) => void;
|
||||
'astro:config:done'?: (options: { config: AstroConfig; setAdapter: (adapter: AstroAdapter) => void }) => void | Promise<void>;
|
||||
'astro:server:setup'?: (options: { server: vite.ViteDevServer }) => void | Promise<void>;
|
||||
'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise<void>;
|
||||
'astro:server:done'?: () => void | Promise<void>;
|
||||
'astro:build:start'?: (options: { buildConfig: BuildConfig }) => void | Promise<void>;
|
||||
'astro:build:done'?: (options: { pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise<void>;
|
||||
'astro:server:setup'?: (options: { config: Readonly<AstroConfig>; server: vite.ViteDevServer }) => void | Promise<void>;
|
||||
'astro:server:start'?: (options: { config: Readonly<AstroConfig>; address: AddressInfo }) => void | Promise<void>;
|
||||
'astro:server:done'?: (options: { config: Readonly<AstroConfig> }) => void | Promise<void>;
|
||||
'astro:build:start'?: (options: { config: Readonly<AstroConfig>; buildConfig: BuildConfig }) => void | Promise<void>;
|
||||
'astro:build:done'?: (options: { config: Readonly<AstroConfig>; pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise<void>;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ export async function runHookConfigDone({ config }: { config: AstroConfig }) {
|
|||
export async function runHookServerSetup({ config, server }: { config: AstroConfig; server: ViteDevServer }) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration.hooks['astro:server:setup']) {
|
||||
await integration.hooks['astro:server:setup']({ server });
|
||||
await integration.hooks['astro:server:setup']({ config, server });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export async function runHookServerSetup({ config, server }: { config: AstroConf
|
|||
export async function runHookServerStart({ config, address }: { config: AstroConfig; address: AddressInfo }) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration.hooks['astro:server:start']) {
|
||||
await integration.hooks['astro:server:start']({ address });
|
||||
await integration.hooks['astro:server:start']({ config, address });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ export async function runHookServerStart({ config, address }: { config: AstroCon
|
|||
export async function runHookServerDone({ config }: { config: AstroConfig }) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration.hooks['astro:server:done']) {
|
||||
await integration.hooks['astro:server:done']();
|
||||
await integration.hooks['astro:server:done']({ config });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ export async function runHookServerDone({ config }: { config: AstroConfig }) {
|
|||
export async function runHookBuildStart({ config, buildConfig }: { config: AstroConfig; buildConfig: BuildConfig }) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration.hooks['astro:build:start']) {
|
||||
await integration.hooks['astro:build:start']({ buildConfig });
|
||||
await integration.hooks['astro:build:start']({ config, buildConfig });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ export async function runHookBuildStart({ config, buildConfig }: { config: Astro
|
|||
export async function runHookBuildDone({ config, pages, routes }: { config: AstroConfig; pages: string[]; routes: RouteData[] }) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration.hooks['astro:build:done']) {
|
||||
await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes });
|
||||
await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes, config });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue