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:
becarta
2025-05-23 12:43:00 +02:00
parent f40db0f5c9
commit a544759a3b
11127 changed files with 1647032 additions and 0 deletions

30
node_modules/astro/dist/events/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import type { ZodError } from 'zod';
import { type ErrorWithMetadata } from '../core/errors/index.js';
interface ErrorEventPayload {
name: string;
isFatal: boolean;
plugin?: string | undefined;
cliCommand: string;
anonymousMessageHint?: string | undefined;
}
interface ConfigErrorEventPayload extends ErrorEventPayload {
isConfig: true;
configErrorPaths: string[];
}
export declare function eventConfigError({ err, cmd, isFatal, }: {
err: ZodError;
cmd: string;
isFatal: boolean;
}): {
eventName: string;
payload: ConfigErrorEventPayload;
}[];
export declare function eventError({ cmd, err, isFatal, }: {
err: ErrorWithMetadata;
cmd: string;
isFatal: boolean;
}): {
eventName: string;
payload: ErrorEventPayload;
}[];
export {};

59
node_modules/astro/dist/events/error.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import { AstroError, AstroErrorData } from "../core/errors/index.js";
const EVENT_ERROR = "ASTRO_CLI_ERROR";
const ANONYMIZE_MESSAGE_REGEX = /^(?:\w| )+/;
function anonymizeErrorMessage(msg) {
const matchedMessage = ANONYMIZE_MESSAGE_REGEX.exec(msg);
if (!matchedMessage?.[0]) {
return void 0;
}
return matchedMessage[0].trim().substring(0, 20);
}
function eventConfigError({
err,
cmd,
isFatal
}) {
const payload = {
name: "ZodError",
isFatal,
isConfig: true,
cliCommand: cmd,
configErrorPaths: err.issues.map((issue) => issue.path.join("."))
};
return [{ eventName: EVENT_ERROR, payload }];
}
function eventError({
cmd,
err,
isFatal
}) {
const errorData = AstroError.is(err) && AstroErrorData[err.name];
const payload = {
name: err.name,
plugin: err.plugin,
cliCommand: cmd,
isFatal,
anonymousMessageHint: errorData && errorData.message ? getSafeErrorMessage(errorData.message) : anonymizeErrorMessage(err.message)
};
return [{ eventName: EVENT_ERROR, payload }];
}
function getSafeErrorMessage(message) {
if (typeof message === "string") {
return message;
} else {
return String.raw({
raw: extractStringFromFunction(message.toString())
});
}
function extractStringFromFunction(func) {
const arrowIndex = func.indexOf("=>") + "=>".length;
return func.slice(arrowIndex).trim().slice(1, -1).replace(
/\$\{([^}]+)\}/g,
(_str, match1) => `${match1.split(/\.?(?=[A-Z])/).join("_").toUpperCase()}`
).replace(/\\`/g, "`");
}
}
export {
eventConfigError,
eventError
};

4
node_modules/astro/dist/events/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { AstroTelemetry } from '@astrojs/telemetry';
export declare const telemetry: AstroTelemetry;
export * from './error.js';
export * from './session.js';

12
node_modules/astro/dist/events/index.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import { AstroTelemetry } from "@astrojs/telemetry";
import { version as viteVersion } from "vite";
import { ASTRO_VERSION } from "../core/constants.js";
const telemetry = new AstroTelemetry({
astroVersion: ASTRO_VERSION,
viteVersion
});
export * from "./error.js";
export * from "./session.js";
export {
telemetry
};

26
node_modules/astro/dist/events/session.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import type { AstroUserConfig } from '../@types/astro.js';
interface EventPayload {
cliCommand: string;
config?: ConfigInfo;
configKeys?: string[];
flags?: string[];
optionalIntegrations?: number;
}
type ConfigInfoValue = string | boolean | string[] | undefined;
type ConfigInfoRecord = Record<string, ConfigInfoValue>;
type ConfigInfoBase = {
[alias in keyof AstroUserConfig]: ConfigInfoValue | ConfigInfoRecord;
};
export interface ConfigInfo extends ConfigInfoBase {
build: ConfigInfoRecord;
image: ConfigInfoRecord;
markdown: ConfigInfoRecord;
experimental: ConfigInfoRecord;
legacy: ConfigInfoRecord;
vite: ConfigInfoRecord | undefined;
}
export declare function eventCliSession(cliCommand: string, userConfig: AstroUserConfig, flags?: Record<string, any>): {
eventName: string;
payload: EventPayload;
}[];
export {};

75
node_modules/astro/dist/events/session.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
import { AstroConfigSchema } from "../core/config/schema.js";
const EVENT_SESSION = "ASTRO_CLI_SESSION_STARTED";
function measureIsDefined(val) {
if (val === void 0) {
return void 0;
}
return Boolean(val);
}
function measureStringLiteral(val) {
return val;
}
function measureIntegration(val) {
if (!val || !val.name) {
return void 0;
}
return val.name;
}
function sanitizeConfigInfo(obj, validKeys) {
if (!obj || validKeys.length === 0) {
return {};
}
return validKeys.reduce(
(result, key) => {
result[key] = measureIsDefined(obj[key]);
return result;
},
{}
);
}
function createAnonymousConfigInfo(userConfig) {
const configInfo = {
...sanitizeConfigInfo(userConfig, Object.keys(AstroConfigSchema.shape)),
build: sanitizeConfigInfo(
userConfig.build,
Object.keys(AstroConfigSchema.shape.build._def.innerType.shape)
),
image: sanitizeConfigInfo(
userConfig.image,
Object.keys(AstroConfigSchema.shape.image._def.innerType.shape)
),
markdown: sanitizeConfigInfo(
userConfig.markdown,
Object.keys(AstroConfigSchema.shape.markdown._def.innerType.shape)
),
experimental: sanitizeConfigInfo(
userConfig.experimental,
Object.keys(AstroConfigSchema.shape.experimental._def.innerType.shape)
),
legacy: sanitizeConfigInfo(
userConfig.legacy,
Object.keys(AstroConfigSchema.shape.legacy._def.innerType.shape)
),
vite: userConfig.vite ? sanitizeConfigInfo(userConfig.vite, Object.keys(userConfig.vite)) : void 0
};
configInfo.build.format = measureStringLiteral(userConfig.build?.format);
configInfo.markdown.syntaxHighlight = measureStringLiteral(userConfig.markdown?.syntaxHighlight);
configInfo.output = measureStringLiteral(userConfig.output);
configInfo.scopedStyleStrategy = measureStringLiteral(userConfig.scopedStyleStrategy);
configInfo.trailingSlash = measureStringLiteral(userConfig.trailingSlash);
configInfo.adapter = measureIntegration(userConfig.adapter);
configInfo.integrations = userConfig.integrations?.flat(100).map(measureIntegration).filter(Boolean);
return configInfo;
}
function eventCliSession(cliCommand, userConfig, flags) {
const cliFlags = flags ? Object.keys(flags).filter((name) => name != "_") : void 0;
const payload = {
cliCommand,
config: createAnonymousConfigInfo(userConfig),
flags: cliFlags
};
return [{ eventName: EVENT_SESSION, payload }];
}
export {
eventCliSession
};

10
node_modules/astro/dist/events/toolbar.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
interface AppToggledEventPayload {
app: string;
}
export declare function eventAppToggled(options: {
appName: 'other' | (string & {});
}): {
eventName: string;
payload: AppToggledEventPayload;
}[];
export {};

10
node_modules/astro/dist/events/toolbar.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
const EVENT_TOOLBAR_APP_TOGGLED = "ASTRO_TOOLBAR_APP_TOGGLED";
function eventAppToggled(options) {
const payload = {
app: options.appName
};
return [{ eventName: EVENT_TOOLBAR_APP_TOGGLED, payload }];
}
export {
eventAppToggled
};