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

59
node_modules/@astrojs/telemetry/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,59 @@
MIT License
Copyright (c) 2021 Fred K. Schott
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/sveltejs/kit repository:
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
"""
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/vitejs/vite repository:
MIT License
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

17
node_modules/@astrojs/telemetry/README.md generated vendored Normal file
View File

@@ -0,0 +1,17 @@
# Astro Telemetry
This package is used to collect anonymous telemetry data within the Astro CLI.
It can be disabled in Astro using either method documented below:
```shell
# Option 1: Run this to disable telemetry globally across your entire machine.
astro telemetry disable
```
```shell
# Option 2: The ASTRO_TELEMETRY_DISABLED environment variable disables telemetry when set.
ASTRO_TELEMETRY_DISABLED=1 astro dev
```
Visit https://astro.build/telemetry/ for more information about our approach to anonymous telemetry in Astro.

View File

@@ -0,0 +1,6 @@
/** Specifies whether or not telemetry is enabled or disabled. */
export declare const TELEMETRY_ENABLED = "telemetry.enabled";
/** Specifies when the user was informed of anonymous telemetry. */
export declare const TELEMETRY_NOTIFY_DATE = "telemetry.notifiedAt";
/** Specifies an anonymous identifier used to dedupe events for a user. */
export declare const TELEMETRY_ID = "telemetry.anonymousId";

8
node_modules/@astrojs/telemetry/dist/config-keys.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
const TELEMETRY_ENABLED = "telemetry.enabled";
const TELEMETRY_NOTIFY_DATE = "telemetry.notifiedAt";
const TELEMETRY_ID = `telemetry.anonymousId`;
export {
TELEMETRY_ENABLED,
TELEMETRY_ID,
TELEMETRY_NOTIFY_DATE
};

19
node_modules/@astrojs/telemetry/dist/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
export interface ConfigOptions {
name: string;
}
export declare class GlobalConfig {
private project;
private dir;
private file;
constructor(project: ConfigOptions);
private _store?;
private get store();
private set store(value);
private ensureDir;
write(): void;
clear(): void;
delete(key: string): boolean;
get(key: string): any;
has(key: string): boolean;
set(key: string, value: any): void;
}

84
node_modules/@astrojs/telemetry/dist/config.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import process from "node:process";
import dget from "dlv";
import { dset } from "dset";
function getConfigDir(name) {
const homedir = os.homedir();
const macos = () => path.join(homedir, "Library", "Preferences", name);
const win = () => {
const { APPDATA = path.join(homedir, "AppData", "Roaming") } = process.env;
return path.join(APPDATA, name, "Config");
};
const linux = () => {
const { XDG_CONFIG_HOME = path.join(homedir, ".config") } = process.env;
return path.join(XDG_CONFIG_HOME, name);
};
switch (process.platform) {
case "darwin":
return macos();
case "win32":
return win();
default:
return linux();
}
}
class GlobalConfig {
constructor(project) {
this.project = project;
this.dir = getConfigDir(this.project.name);
this.file = path.join(this.dir, "config.json");
}
dir;
file;
_store;
get store() {
if (this._store)
return this._store;
this.ensureDir();
if (fs.existsSync(this.file)) {
try {
this._store = JSON.parse(fs.readFileSync(this.file).toString());
} catch {
}
}
if (!this._store) {
this._store = {};
this.write();
}
return this._store;
}
set store(value) {
this._store = value;
this.write();
}
ensureDir() {
fs.mkdirSync(this.dir, { recursive: true });
}
write() {
fs.writeFileSync(this.file, JSON.stringify(this.store, null, " "));
}
clear() {
this.store = {};
fs.rmSync(this.file, { recursive: true });
}
delete(key) {
dset(this.store, key, void 0);
this.write();
return true;
}
get(key) {
return dget(this.store, key);
}
has(key) {
return typeof this.get(key) !== "undefined";
}
set(key, value) {
dset(this.store, key, value);
this.write();
}
}
export {
GlobalConfig
};

39
node_modules/@astrojs/telemetry/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,39 @@
export type AstroTelemetryOptions = {
astroVersion: string;
viteVersion: string;
};
export type TelemetryEvent = {
eventName: string;
payload: Record<string, any>;
};
export declare class AstroTelemetry {
private opts;
private _anonymousSessionId;
private _anonymousProjectInfo;
private config;
private debug;
private isCI;
private env;
private get astroVersion();
private get viteVersion();
private get ASTRO_TELEMETRY_DISABLED();
private get TELEMETRY_DISABLED();
constructor(opts: AstroTelemetryOptions);
/**
* Get value from either the global config or the provided fallback.
* If value is not set, the fallback is saved to the global config,
* persisted for later sessions.
*/
private getConfigWithFallback;
private get enabled();
private get notifyDate();
private get anonymousId();
private get anonymousSessionId();
private get anonymousProjectInfo();
private get isDisabled();
setEnabled(value: boolean): void;
clear(): void;
isValidNotice(): boolean;
notify(callback: () => boolean | Promise<boolean>): Promise<void>;
record(event?: TelemetryEvent | TelemetryEvent[]): Promise<any>;
}

132
node_modules/@astrojs/telemetry/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
import { randomBytes } from "node:crypto";
import { isCI } from "ci-info";
import debug from "debug";
import * as KEY from "./config-keys.js";
import { GlobalConfig } from "./config.js";
import { post } from "./post.js";
import { getProjectInfo } from "./project-info.js";
import { getSystemInfo } from "./system-info.js";
const VALID_TELEMETRY_NOTICE_DATE = "2023-08-25";
class AstroTelemetry {
constructor(opts) {
this.opts = opts;
}
_anonymousSessionId;
_anonymousProjectInfo;
config = new GlobalConfig({ name: "astro" });
debug = debug("astro:telemetry");
isCI = isCI;
env = process.env;
get astroVersion() {
return this.opts.astroVersion;
}
get viteVersion() {
return this.opts.viteVersion;
}
get ASTRO_TELEMETRY_DISABLED() {
return this.env.ASTRO_TELEMETRY_DISABLED;
}
get TELEMETRY_DISABLED() {
return this.env.TELEMETRY_DISABLED;
}
/**
* Get value from either the global config or the provided fallback.
* If value is not set, the fallback is saved to the global config,
* persisted for later sessions.
*/
getConfigWithFallback(key, getValue) {
const currentValue = this.config.get(key);
if (currentValue !== void 0) {
return currentValue;
}
const newValue = getValue();
this.config.set(key, newValue);
return newValue;
}
get enabled() {
return this.getConfigWithFallback(KEY.TELEMETRY_ENABLED, () => true);
}
get notifyDate() {
return this.getConfigWithFallback(KEY.TELEMETRY_NOTIFY_DATE, () => "");
}
get anonymousId() {
return this.getConfigWithFallback(KEY.TELEMETRY_ID, () => randomBytes(32).toString("hex"));
}
get anonymousSessionId() {
this._anonymousSessionId = this._anonymousSessionId || randomBytes(32).toString("hex");
return this._anonymousSessionId;
}
get anonymousProjectInfo() {
this._anonymousProjectInfo = this._anonymousProjectInfo || getProjectInfo(this.isCI);
return this._anonymousProjectInfo;
}
get isDisabled() {
if (Boolean(this.ASTRO_TELEMETRY_DISABLED || this.TELEMETRY_DISABLED)) {
return true;
}
return this.enabled === false;
}
setEnabled(value) {
this.config.set(KEY.TELEMETRY_ENABLED, value);
}
clear() {
return this.config.clear();
}
isValidNotice() {
if (!this.notifyDate)
return false;
const current = Number(this.notifyDate);
const valid = new Date(VALID_TELEMETRY_NOTICE_DATE).valueOf();
return current > valid;
}
async notify(callback) {
if (this.isDisabled || this.isCI) {
this.debug(`[notify] telemetry has been disabled`);
return;
}
if (this.isValidNotice()) {
this.debug(`[notify] last notified on ${this.notifyDate}`);
return;
}
const enabled = await callback();
this.config.set(KEY.TELEMETRY_NOTIFY_DATE, (/* @__PURE__ */ new Date()).valueOf().toString());
this.config.set(KEY.TELEMETRY_ENABLED, enabled);
this.debug(`[notify] telemetry has been ${enabled ? "enabled" : "disabled"}`);
}
async record(event = []) {
const events = Array.isArray(event) ? event : [event];
if (events.length < 1) {
return Promise.resolve();
}
if (this.isDisabled) {
this.debug("[record] telemetry has been disabled");
return Promise.resolve();
}
const meta = {
...getSystemInfo({ astroVersion: this.astroVersion, viteVersion: this.viteVersion })
};
const context = {
...this.anonymousProjectInfo,
anonymousId: this.anonymousId,
anonymousSessionId: this.anonymousSessionId
};
if (meta.isCI) {
context.anonymousId = `CI.${meta.ciName || "UNKNOWN"}`;
}
if (this.debug.enabled) {
this.debug({ context, meta });
this.debug(JSON.stringify(events, null, 2));
return Promise.resolve();
}
return post({
context,
meta,
events
}).catch((err) => {
this.debug(`Error sending event: ${err.message}`);
});
}
}
export {
AstroTelemetry
};

1
node_modules/@astrojs/telemetry/dist/post.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function post(body: Record<string, any>): Promise<any>;

11
node_modules/@astrojs/telemetry/dist/post.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
const ASTRO_TELEMETRY_ENDPOINT = `https://telemetry.astro.build/api/v1/record`;
function post(body) {
return fetch(ASTRO_TELEMETRY_ENDPOINT, {
method: "POST",
body: JSON.stringify(body),
headers: { "content-type": "application/json" }
});
}
export {
post
};

48
node_modules/@astrojs/telemetry/dist/project-info.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
/**
* Astro Telemetry -- Project Info
*
* To better understand our telemetry insights, Astro attempts to create an anonymous identifier
* for each Astro project. This value is meant to be unique to each project but common across
* multiple different users on the same project.
*
* To do this, we generate a unique, anonymous hash from your working git repository data. This is
* ideal because git data is shared across all users on the same repository, but the data itself
* that we generate our hash from does not contain any personal or otherwise identifying information.
*
* We do not use your repository's remote URL, GitHub URL, or any other personally identifying
* information to generate the project identifier hash. In this way it is almost completely anonymous.
*
* If you are running Astro outside of a git repository, then we will generate a unique, anonymous project
* identifier by hashing your project's file path on your machine.
*
* ~~~
*
* Q: Can this project identifier be traced back to me?
*
* A: If your repository is private, there is no way for anyone to trace your unique
* project identifier back to you, your organization, or your project. This is because it is itself
* a hash of a commit hash, and a commit hash does not include any identifying information.
*
* If your repository is publicly available, then it is possible for someone to generate this unique
* project identifier themselves by cloning your repo. Specifically, someone would need access to run
* the `git rev-list` command below to generate this hash. Without this access, it is impossible to
* trace the project identifier back to you or your project.
*
* If you are running Astro outside of a git repository, then the project identifier could be matched
* back to the exact file path on your machine. It is unlikely (but still possible) for this to happen
* without access to your machine or knowledge of your machine's file system.
*
* ~~~
*
* Q: I don't want Astro to collect a project identifier. How can I disable it?
*
* A: You can disable telemetry completely at any time by running `astro telemetry disable`. There is
* currently no way to disable just this identifier while keeping the rest of telemetry enabled.
*/
export interface ProjectInfo {
anonymousProjectId: string | undefined;
isGit: boolean;
packageManager: string | undefined;
packageManagerVersion: string | undefined;
}
export declare function getProjectInfo(isCI: boolean): ProjectInfo;

55
node_modules/@astrojs/telemetry/dist/project-info.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
import { execSync } from "node:child_process";
import { createHash } from "node:crypto";
import detectPackageManager from "which-pm-runs";
function createAnonymousValue(payload) {
if (payload === "") {
return payload;
}
const hash = createHash("sha256");
hash.update(payload);
return hash.digest("hex");
}
function getProjectIdFromGit() {
try {
const originBuffer = execSync(`git rev-list --max-parents=0 HEAD`, {
timeout: 500,
stdio: ["ignore", "pipe", "ignore"]
});
return String(originBuffer).trim();
} catch (_) {
return null;
}
}
function getProjectId(isCI) {
const projectIdFromGit = getProjectIdFromGit();
if (projectIdFromGit) {
return {
isGit: true,
anonymousProjectId: createAnonymousValue(projectIdFromGit)
};
}
const cwd = process.cwd();
const isCwdGeneric = (cwd.match(/[/|\\]/g) || []).length === 1;
if (isCI || isCwdGeneric) {
return {
isGit: false,
anonymousProjectId: void 0
};
}
return {
isGit: false,
anonymousProjectId: createAnonymousValue(cwd)
};
}
function getProjectInfo(isCI) {
const projectId = getProjectId(isCI);
const packageManager = detectPackageManager();
return {
...projectId,
packageManager: packageManager?.name,
packageManagerVersion: packageManager?.version
};
}
export {
getProjectInfo
};

45
node_modules/@astrojs/telemetry/dist/system-info.d.ts generated vendored Normal file
View File

@@ -0,0 +1,45 @@
/// <reference types="node" resolution-mode="require"/>
/**
* Astro Telemetry -- System Info
*
* To better understand our telemetry insights, Astro collects the following anonymous information
* about the system that it runs on. This helps us prioritize fixes and new features based on a
* better understanding of our real-world system requirements.
*
* ~~~
*
* Q: Can this system info be traced back to me?
*
* A: No personally identifiable information is contained in the system info that we collect. It could
* be possible for someone with direct access to your machine to collect this information themselves
* and then attempt to match it all together with our collected telemetry data, however most users'
* systems are probably not uniquely identifiable via their system info alone.
*
* ~~~
*
* Q: I don't want Astro to collect system info. How can I disable it?
*
* A: You can disable telemetry completely at any time by running `astro telemetry disable`. There is
* currently no way to disable this otherwise while keeping the rest of telemetry enabled.
*/
export type SystemInfo = {
systemPlatform: NodeJS.Platform;
systemRelease: string;
systemArchitecture: string;
astroVersion: string;
nodeVersion: string;
viteVersion: string;
cpuCount: number;
cpuModel: string | null;
cpuSpeed: number | null;
memoryInMb: number;
isDocker: boolean;
isTTY: boolean;
isWSL: boolean;
isCI: boolean;
ciName: string | null;
};
export declare function getSystemInfo(versions: {
viteVersion: string;
astroVersion: string;
}): SystemInfo;

35
node_modules/@astrojs/telemetry/dist/system-info.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import os from "node:os";
import { isCI, name as ciName } from "ci-info";
import isDocker from "is-docker";
import isWSL from "is-wsl";
let meta;
function getSystemInfo(versions) {
if (meta) {
return meta;
}
const cpus = os.cpus() || [];
return {
// Version information
nodeVersion: process.version.replace(/^v?/, ""),
viteVersion: versions.viteVersion,
astroVersion: versions.astroVersion,
// Software information
systemPlatform: os.platform(),
systemRelease: os.release(),
systemArchitecture: os.arch(),
// Machine information
cpuCount: cpus.length,
cpuModel: cpus.length ? cpus[0].model : null,
cpuSpeed: cpus.length ? cpus[0].speed : null,
memoryInMb: Math.trunc(os.totalmem() / Math.pow(1024, 2)),
// Environment information
isDocker: isDocker(),
isTTY: process.stdout.isTTY,
isWSL,
isCI,
ciName
};
}
export {
getSystemInfo
};

53
node_modules/@astrojs/telemetry/package.json generated vendored Normal file
View File

@@ -0,0 +1,53 @@
{
"name": "@astrojs/telemetry",
"version": "3.1.0",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/withastro/astro.git",
"directory": "packages/telemetry"
},
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"dependencies": {
"ci-info": "^4.0.0",
"debug": "^4.3.4",
"dlv": "^1.1.3",
"dset": "^3.1.3",
"is-docker": "^3.0.0",
"is-wsl": "^3.0.0",
"which-pm-runs": "^1.1.0"
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/dlv": "^1.1.4",
"@types/node": "^18.17.8",
"@types/which-pm-runs": "^1.0.2",
"astro-scripts": "0.0.14"
},
"engines": {
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"
},
"publishConfig": {
"provenance": true
},
"scripts": {
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"build:ci": "astro-scripts build \"src/**/*.ts\"",
"dev": "astro-scripts dev \"src/**/*.ts\"",
"test": "astro-scripts test \"test/**/*.test.js\""
}
}