summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar JuanM04 <me@juanm04.com> 2022-03-29 19:02:56 -0300
committerGravatar JuanM04 <me@juanm04.com> 2022-03-29 19:02:56 -0300
commit1278d39b8694aa76598428014ee59b16e1338246 (patch)
treea0f3a8ea540af50582bb8098e4da154064c0d308
parent7e5f6f1cbb2c4dd3eb9f3a1188cc44e3d8d63b37 (diff)
downloadastro-1278d39b8694aa76598428014ee59b16e1338246.tar.gz
astro-1278d39b8694aa76598428014ee59b16e1338246.tar.zst
astro-1278d39b8694aa76598428014ee59b16e1338246.zip
Added readonly config to more hooks
-rw-r--r--packages/astro/src/@types/astro.ts10
-rw-r--r--packages/astro/src/integrations/index.ts10
2 files changed, 10 insertions, 10 deletions
diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts
index 47c783e0d..489a5ee38 100644
--- a/packages/astro/src/@types/astro.ts
+++ b/packages/astro/src/@types/astro.ts
@@ -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>;
};
}
diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts
index 580552775..85d117986 100644
--- a/packages/astro/src/integrations/index.ts
+++ b/packages/astro/src/integrations/index.ts
@@ -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 });
}
}
}