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:
7
node_modules/astro/dist/config/index.d.ts
generated
vendored
Normal file
7
node_modules/astro/dist/config/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { UserConfig as ViteUserConfig } from 'vite';
|
||||
import type { AstroInlineConfig, AstroUserConfig } from '../@types/astro.js';
|
||||
export declare function defineConfig(config: AstroUserConfig): AstroUserConfig;
|
||||
export declare function getViteConfig(userViteConfig: ViteUserConfig, inlineAstroConfig?: AstroInlineConfig): ({ mode, command }: {
|
||||
mode: string;
|
||||
command: "serve" | "build";
|
||||
}) => Promise<Record<string, any>>;
|
45
node_modules/astro/dist/config/index.js
generated
vendored
Normal file
45
node_modules/astro/dist/config/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
function defineConfig(config) {
|
||||
return config;
|
||||
}
|
||||
function getViteConfig(userViteConfig, inlineAstroConfig = {}) {
|
||||
return async ({ mode, command }) => {
|
||||
const cmd = command === "serve" ? "dev" : command;
|
||||
const [
|
||||
fs,
|
||||
{ mergeConfig },
|
||||
{ createNodeLogger },
|
||||
{ resolveConfig, createSettings },
|
||||
{ createVite },
|
||||
{ runHookConfigSetup, runHookConfigDone },
|
||||
{ astroContentListenPlugin }
|
||||
] = await Promise.all([
|
||||
import("node:fs"),
|
||||
import("vite"),
|
||||
import("../core/config/logging.js"),
|
||||
import("../core/config/index.js"),
|
||||
import("../core/create-vite.js"),
|
||||
import("../integrations/hooks.js"),
|
||||
import("./vite-plugin-content-listen.js")
|
||||
]);
|
||||
const logger = createNodeLogger(inlineAstroConfig);
|
||||
const { astroConfig: config } = await resolveConfig(inlineAstroConfig, cmd);
|
||||
let settings = await createSettings(config, userViteConfig.root);
|
||||
settings = await runHookConfigSetup({ settings, command: cmd, logger });
|
||||
const viteConfig = await createVite(
|
||||
{
|
||||
mode,
|
||||
plugins: [
|
||||
// Initialize the content listener
|
||||
astroContentListenPlugin({ settings, logger, fs })
|
||||
]
|
||||
},
|
||||
{ settings, logger, mode, sync: false }
|
||||
);
|
||||
await runHookConfigDone({ settings, logger });
|
||||
return mergeConfig(viteConfig, userViteConfig);
|
||||
};
|
||||
}
|
||||
export {
|
||||
defineConfig,
|
||||
getViteConfig
|
||||
};
|
17
node_modules/astro/dist/config/vite-plugin-content-listen.d.ts
generated
vendored
Normal file
17
node_modules/astro/dist/config/vite-plugin-content-listen.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type fsMod from 'node:fs';
|
||||
import type { Plugin } from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
/**
|
||||
* Listen for Astro content directory changes and generate types.
|
||||
*
|
||||
* This is a separate plugin for `getViteConfig` as the `attachContentServerListeners` API
|
||||
* needs to be called at different times in `astro dev` and `getViteConfig`. For `astro dev`,
|
||||
* it needs to be called after the Astro server is started (packages/astro/src/core/dev/dev.ts).
|
||||
* For `getViteConfig`, it needs to be called after the Vite server is started.
|
||||
*/
|
||||
export declare function astroContentListenPlugin({ settings, logger, fs, }: {
|
||||
settings: AstroSettings;
|
||||
logger: Logger;
|
||||
fs: typeof fsMod;
|
||||
}): Plugin;
|
26
node_modules/astro/dist/config/vite-plugin-content-listen.js
generated
vendored
Normal file
26
node_modules/astro/dist/config/vite-plugin-content-listen.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { attachContentServerListeners } from "../content/server-listeners.js";
|
||||
function astroContentListenPlugin({
|
||||
settings,
|
||||
logger,
|
||||
fs
|
||||
}) {
|
||||
let server;
|
||||
return {
|
||||
name: "astro:content-listen",
|
||||
apply: "serve",
|
||||
configureServer(_server) {
|
||||
server = _server;
|
||||
},
|
||||
async buildStart() {
|
||||
await attachContentServerListeners({
|
||||
fs,
|
||||
settings,
|
||||
logger,
|
||||
viteServer: server
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
astroContentListenPlugin
|
||||
};
|
Reference in New Issue
Block a user