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/internal-helpers/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.
"""

15
node_modules/@astrojs/internal-helpers/dist/fs.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import type { PathLike } from 'node:fs';
export declare function writeJson<T>(path: PathLike, data: T): Promise<void>;
export declare function removeDir(dir: PathLike): Promise<void>;
export declare function emptyDir(dir: PathLike): Promise<void>;
export declare function getFilesFromFolder(dir: URL): Promise<URL[]>;
/**
* Copies files into a folder keeping the folder structure intact.
* The resulting file tree will start at the common ancestor.
*
* @param {URL[]} files A list of files to copy (absolute path).
* @param {URL} outDir Destination folder where to copy the files to (absolute path).
* @param {URL[]} [exclude] A list of files to exclude (absolute path).
* @returns {Promise<string>} The common ancestor of the copied files.
*/
export declare function copyFilesToFolder(files: URL[], outDir: URL, exclude?: URL[]): Promise<string>;

66
node_modules/@astrojs/internal-helpers/dist/fs.js generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import { existsSync } from "node:fs";
import * as fs from "node:fs/promises";
import nodePath from "node:path";
import { fileURLToPath } from "node:url";
async function writeJson(path, data) {
await fs.writeFile(path, JSON.stringify(data, null, " "), { encoding: "utf-8" });
}
async function removeDir(dir) {
await fs.rm(dir, { recursive: true, force: true, maxRetries: 3 });
}
async function emptyDir(dir) {
await removeDir(dir);
await fs.mkdir(dir, { recursive: true });
}
async function getFilesFromFolder(dir) {
const data = await fs.readdir(dir, { withFileTypes: true });
let files = [];
for (const item of data) {
if (item.isDirectory()) {
const moreFiles = await getFilesFromFolder(new URL(`./${item.name}/`, dir));
files = files.concat(moreFiles);
} else {
files.push(new URL(`./${item.name}`, dir));
}
}
return files;
}
async function copyFilesToFolder(files, outDir, exclude = []) {
const excludeList = exclude.map(fileURLToPath);
const fileList = files.map(fileURLToPath).filter((f) => !excludeList.includes(f));
if (files.length === 0) throw new Error("No files found to copy");
let commonAncestor = nodePath.dirname(fileList[0]);
for (const file of fileList.slice(1)) {
while (!file.startsWith(commonAncestor)) {
commonAncestor = nodePath.dirname(commonAncestor);
}
}
for (const origin of fileList) {
const dest = new URL(nodePath.relative(commonAncestor, origin), outDir);
const realpath = await fs.realpath(origin);
const isSymlink = realpath !== origin;
const isDir = (await fs.stat(origin)).isDirectory();
if (isDir && !isSymlink) {
await fs.mkdir(new URL("..", dest), { recursive: true });
} else {
await fs.mkdir(new URL(".", dest), { recursive: true });
}
if (isSymlink) {
const realdest = fileURLToPath(new URL(nodePath.relative(commonAncestor, realpath), outDir));
const target = nodePath.relative(fileURLToPath(new URL(".", dest)), realdest);
if (!existsSync(dest)) {
await fs.symlink(target, dest, isDir ? "dir" : "file");
}
} else if (!isDir) {
await fs.copyFile(origin, dest);
}
}
return commonAncestor;
}
export {
copyFilesToFolder,
emptyDir,
getFilesFromFolder,
removeDir,
writeJson
};

23
node_modules/@astrojs/internal-helpers/dist/path.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/**
* A set of common path utilities commonly used through the Astro core and integration
* projects. These do things like ensure a forward slash prepends paths.
*/
export declare function appendExtension(path: string, extension: string): string;
export declare function appendForwardSlash(path: string): string;
export declare function prependForwardSlash(path: string): string;
export declare function collapseDuplicateSlashes(path: string): string;
export declare function removeTrailingForwardSlash(path: string): string;
export declare function removeLeadingForwardSlash(path: string): string;
export declare function removeLeadingForwardSlashWindows(path: string): string;
export declare function trimSlashes(path: string): string;
export declare function startsWithForwardSlash(path: string): boolean;
export declare function startsWithDotDotSlash(path: string): boolean;
export declare function startsWithDotSlash(path: string): boolean;
export declare function isRelativePath(path: string): boolean;
export declare function joinPaths(...paths: (string | undefined)[]): string;
export declare function removeFileExtension(path: string): string;
export declare function removeQueryString(path: string): string;
export declare function isRemotePath(src: string): boolean;
export declare function slash(path: string): string;
export declare function fileExtension(path: string): string;
export declare function removeBase(path: string, base: string): string;

100
node_modules/@astrojs/internal-helpers/dist/path.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
function appendExtension(path, extension) {
return path + "." + extension;
}
function appendForwardSlash(path) {
return path.endsWith("/") ? path : path + "/";
}
function prependForwardSlash(path) {
return path[0] === "/" ? path : "/" + path;
}
function collapseDuplicateSlashes(path) {
return path.replace(/(?<!:)\/{2,}/g, "/");
}
function removeTrailingForwardSlash(path) {
return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
}
function removeLeadingForwardSlash(path) {
return path.startsWith("/") ? path.substring(1) : path;
}
function removeLeadingForwardSlashWindows(path) {
return path.startsWith("/") && path[2] === ":" ? path.substring(1) : path;
}
function trimSlashes(path) {
return path.replace(/^\/|\/$/g, "");
}
function startsWithForwardSlash(path) {
return path[0] === "/";
}
function startsWithDotDotSlash(path) {
const c1 = path[0];
const c2 = path[1];
const c3 = path[2];
return c1 === "." && c2 === "." && c3 === "/";
}
function startsWithDotSlash(path) {
const c1 = path[0];
const c2 = path[1];
return c1 === "." && c2 === "/";
}
function isRelativePath(path) {
return startsWithDotDotSlash(path) || startsWithDotSlash(path);
}
function isString(path) {
return typeof path === "string" || path instanceof String;
}
function joinPaths(...paths) {
return paths.filter(isString).map((path, i) => {
if (i === 0) {
return removeTrailingForwardSlash(path);
} else if (i === paths.length - 1) {
return removeLeadingForwardSlash(path);
} else {
return trimSlashes(path);
}
}).join("/");
}
function removeFileExtension(path) {
let idx = path.lastIndexOf(".");
return idx === -1 ? path : path.slice(0, idx);
}
function removeQueryString(path) {
const index = path.lastIndexOf("?");
return index > 0 ? path.substring(0, index) : path;
}
function isRemotePath(src) {
return /^(?:http|ftp|https|ws):?\/\//.test(src) || src.startsWith("data:");
}
function slash(path) {
return path.replace(/\\/g, "/");
}
function fileExtension(path) {
const ext = path.split(".").pop();
return ext !== path ? `.${ext}` : "";
}
function removeBase(path, base) {
if (path.startsWith(base)) {
return path.slice(removeTrailingForwardSlash(base).length);
}
return path;
}
export {
appendExtension,
appendForwardSlash,
collapseDuplicateSlashes,
fileExtension,
isRelativePath,
isRemotePath,
joinPaths,
prependForwardSlash,
removeBase,
removeFileExtension,
removeLeadingForwardSlash,
removeLeadingForwardSlashWindows,
removeQueryString,
removeTrailingForwardSlash,
slash,
startsWithDotDotSlash,
startsWithDotSlash,
startsWithForwardSlash,
trimSlashes
};

48
node_modules/@astrojs/internal-helpers/package.json generated vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "@astrojs/internal-helpers",
"description": "Internal helpers used by core Astro packages.",
"version": "0.4.1",
"type": "module",
"author": "withastro",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/withastro/astro.git",
"directory": "packages/internal-helpers"
},
"bugs": "https://github.com/withastro/astro/issues",
"exports": {
"./path": "./dist/path.js",
"./fs": "./dist/fs.js"
},
"typesVersions": {
"*": {
"path": [
"./dist/path.d.ts"
],
"fs": [
"./dist/fs.d.ts"
]
}
},
"files": [
"dist"
],
"devDependencies": {
"astro-scripts": "0.0.14"
},
"keywords": [
"astro",
"astro-component"
],
"publishConfig": {
"provenance": true
},
"scripts": {
"prepublish": "pnpm build",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
"build:ci": "astro-scripts build \"src/**/*.ts\"",
"postbuild": "astro-scripts copy \"src/**/*.js\"",
"dev": "astro-scripts dev \"src/**/*.ts\""
}
}

3
node_modules/@astrojs/internal-helpers/readme.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# @astrojs/internal-helpers
These are internal helpers used by core Astro packages. This package does not follow semver and should not be used externally.