Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
8
node_modules/astro/dist/vite-plugin-integrations-container/index.d.ts
generated
vendored
Normal file
8
node_modules/astro/dist/vite-plugin-integrations-container/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
/** Connect Astro integrations into Vite, as needed. */
|
||||
export default function astroIntegrationsContainerPlugin({ settings, logger, }: {
|
||||
settings: AstroSettings;
|
||||
logger: Logger;
|
||||
}): VitePlugin;
|
29
node_modules/astro/dist/vite-plugin-integrations-container/index.js
generated
vendored
Normal file
29
node_modules/astro/dist/vite-plugin-integrations-container/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { normalizePath } from "vite";
|
||||
import { runHookServerSetup } from "../integrations/hooks.js";
|
||||
function astroIntegrationsContainerPlugin({
|
||||
settings,
|
||||
logger
|
||||
}) {
|
||||
return {
|
||||
name: "astro:integration-container",
|
||||
async configureServer(server) {
|
||||
if (server.config.isProduction) return;
|
||||
await runHookServerSetup({ config: settings.config, server, logger });
|
||||
},
|
||||
async buildStart() {
|
||||
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length) return;
|
||||
settings.resolvedInjectedRoutes = await Promise.all(
|
||||
settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route))
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
async function resolveEntryPoint(route) {
|
||||
const resolvedId = await this.resolve(route.entrypoint).then((res) => res?.id).catch(() => void 0);
|
||||
if (!resolvedId) return route;
|
||||
const resolvedEntryPoint = new URL(`file://${normalizePath(resolvedId)}`);
|
||||
return { ...route, resolvedEntryPoint };
|
||||
}
|
||||
export {
|
||||
astroIntegrationsContainerPlugin as default
|
||||
};
|
Reference in New Issue
Block a user