Repository: withastro/astro
File: packages/astro/src/types/public/integrations.ts (TypeScript)

Code before:
		 * This maps a {@link RouteData} to an {@link URL}, this URL represents
		 * the physical file you should import.
		 */
		entryPoints: Map<IntegrationRouteData, URL>;
		/**
		 * File path of the emitted middleware
		 */
		middlewareEntryPoint: URL | undefined;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:build:start': (options: { logger: AstroIntegrationLogger }) => void | Promise<void>;
	'astro:build:setup': (options: {
		vite: ViteInlineConfig;
		pages: Map<string, PageBuildData>;
		target: 'client' | 'server';
		updateConfig: (newConfig: ViteInlineConfig) => void;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:build:generated': (options: {
		dir: URL;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:build:done': (options: {
		pages: { pathname: string }[];
		dir: URL;
		/** @deprecated Use `routes` from `astro:routes:resolved` instead */
		routes: IntegrationRouteData[];
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:route:setup': (options: {
		route: RouteOptions;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:routes:resolved': (options: {
		routes: Array<IntegrationResolvedRoute>;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
}

export interface AstroIntegration {
	/** The name of the integration. */
	name: string;
	/** The different hooks available to extend. */
	hooks: {
		[K in keyof Astro.IntegrationHooks]?: Astro.IntegrationHooks[K];
	} & Partial<Record<string, unknown>>;
}

/**
 * A smaller version of the {@link RouteData} that is used in the integrations.
 */

Review comment (performance):
If we intend to remove this, we'll need to think more about how to provide the existing functionality elsewhere. Fields not exposed on the new hook are relied upon by integrations and adapters, including official ones:
- Sitemap [relies on `type`, `pathname`, and `generate`](https://github.com/withastro/astro/blob/75a84dce5533ceb9bc9792d462272c453c0890d8/packages/integrations/sitemap/src/index.ts#L106-L119)
- Most adapters [rely](https://github.com/withastro/adapters/blob/73cba1db1794e9079edaec00950d6d71ecc0f116/packages/cloudflare/src/index.ts#L359-L368) on [`type`](https://github.com/withastro/adapters/blob/73cba1db1794e9079edaec00950d6d71ecc0f116/packages/vercel/src/lib/redirects.ts#L129-L134) to [emit redirects](https://github.com/withastro/adapters/blob/73cba1db1794e9079edaec00950d6d71ecc0f116/packages/netlify/src/index.ts#L217-L237) efficiently in their specific format
- The Cloudflare adapter [relies on the `segments`](https://github.com/withastro/adapters/blob/73cba1db1794e9079edaec00950d6d71ecc0f116/packages/cloudflare/src/utils/generate-routes-json.ts#L225-L226)

Code after:
		 * This maps a {@link RouteData} to an {@link URL}, this URL represents
		 * the physical file you should import.
		 */
		entryPoints: Map<IntegrationRouteData, URL>;
		/**
		 * File path of the emitted middleware
		 */
		middlewareEntryPoint: URL | undefined;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:build:start': (options: { logger: AstroIntegrationLogger }) => void | Promise<void>;
	'astro:build:setup': (options: {
		vite: ViteInlineConfig;
		pages: Map<string, PageBuildData>;
		target: 'client' | 'server';
		updateConfig: (newConfig: ViteInlineConfig) => void;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:build:generated': (options: {
		dir: URL;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:build:done': (options: {
		pages: { pathname: string }[];
		dir: URL;
		/** @deprecated Use the `assets` map and the new `astro:routes:resolved` hook */
		routes: IntegrationRouteData[];
		assets: Map<string, URL[]>;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:route:setup': (options: {
		route: RouteOptions;
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
	'astro:routes:resolved': (options: {
		routes: IntegrationResolvedRoute[];
		logger: AstroIntegrationLogger;
	}) => void | Promise<void>;
}

export interface AstroIntegration {
	/** The name of the integration. */
	name: string;
	/** The different hooks available to extend. */
	hooks: {
		[K in keyof Astro.IntegrationHooks]?: Astro.IntegrationHooks[K];
	} & Partial<Record<string, unknown>>;
}

/**
 * A smaller version of the {@link RouteData} that is used in the integrations.