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

74
node_modules/find-up-simple/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
export type Options = {
/**
The directory to start from.
@default process.cwd()
*/
readonly cwd?: URL | string;
/**
The type of path to match.
@default 'file'
*/
readonly type?: 'file' | 'directory';
/**
A directory path where the search halts if no matches are found before reaching this point.
Default: Root directory
*/
readonly stopAt?: URL | string;
};
/**
Find a file or directory by walking up parent directories.
@param name - The name of the file or directory to find.
@returns The found path or `undefined` if it could not be found.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import {findUp} from 'find-up-simple';
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
```
*/
export function findUp(name: string, options?: Options): Promise<string | undefined>;
/**
Find a file or directory by walking up parent directories.
@param name - The name of the file or directory to find.
@returns The found path or `undefined` if it could not be found.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import {findUpSync} from 'find-up-simple';
console.log(findUpSync('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
```
*/
export function findUpSync(name: string, options?: Options): string | undefined;

62
node_modules/find-up-simple/index.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import process from 'node:process';
import fsPromises from 'node:fs/promises';
import {fileURLToPath} from 'node:url';
import fs from 'node:fs';
import path from 'node:path';
const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
export async function findUp(name, {
cwd = process.cwd(),
type = 'file',
stopAt,
} = {}) {
let directory = path.resolve(toPath(cwd) ?? '');
const {root} = path.parse(directory);
stopAt = path.resolve(directory, toPath(stopAt ?? root));
const isAbsoluteName = path.isAbsolute(name);
while (directory) {
const filePath = isAbsoluteName ? name : path.join(directory, name);
try {
const stats = await fsPromises.stat(filePath); // eslint-disable-line no-await-in-loop
if ((type === 'file' && stats.isFile()) || (type === 'directory' && stats.isDirectory())) {
return filePath;
}
} catch {}
if (directory === stopAt || directory === root) {
break;
}
directory = path.dirname(directory);
}
}
export function findUpSync(name, {
cwd = process.cwd(),
type = 'file',
stopAt,
} = {}) {
let directory = path.resolve(toPath(cwd) ?? '');
const {root} = path.parse(directory);
stopAt = path.resolve(directory, toPath(stopAt) ?? root);
const isAbsoluteName = path.isAbsolute(name);
while (directory) {
const filePath = isAbsoluteName ? name : path.join(directory, name);
try {
const stats = fs.statSync(filePath, {throwIfNoEntry: false});
if ((type === 'file' && stats?.isFile()) || (type === 'directory' && stats?.isDirectory())) {
return filePath;
}
} catch {}
if (directory === stopAt || directory === root) {
break;
}
directory = path.dirname(directory);
}
}

9
node_modules/find-up-simple/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

54
node_modules/find-up-simple/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "find-up-simple",
"version": "1.0.1",
"description": "Find a file or directory by walking up parent directories — Zero dependencies",
"license": "MIT",
"repository": "sindresorhus/find-up-simple",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=18"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"walk",
"walking",
"path"
],
"devDependencies": {
"ava": "^5.3.1",
"tempy": "^3.1.0",
"xo": "^0.56.0"
}
}

92
node_modules/find-up-simple/readme.md generated vendored Normal file
View File

@@ -0,0 +1,92 @@
# find-up-simple
> Find a file or directory by walking up parent directories
This is a simpler version of my [`find-up`](https://github.com/sindresorhus/find-up) package, now with zero dependencies.
## Install
```sh
npm install find-up-simple
```
## Usage
```
/
└── Users
└── sindresorhus
├── unicorn.png
└── foo
└── bar
├── baz
└── example.js
```
`example.js`
```js
import {findUp} from 'find-up-simple';
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
```
## API
### findUp(name, options?)
Returns a `Promise` for the found path or `undefined` if it could not be found.
### findUpSync(name, options?)
Returns the found path or `undefined` if it could not be found.
#### name
Type: `string`
The name of the file or directory to find.
#### options
Type: `object`
##### cwd
Type: `URL | string`\
Default: `process.cwd()`
The directory to start from.
##### type
Type: `string`\
Default: `'file'`\
Values: `'file' | 'directory'`
The type of path to match.
##### stopAt
Type: `URL | string`\
Default: Root directory
The last directory to search before stopping.
## FAQ
### How is it different from [`find-up`](https://github.com/sindresorhus/find-up)?
- No support for multiple input names
- No support for finding multiple paths
- No custom matching
- No symlink option
- Zero dependencies
## Related
- [find-up](https://github.com/sindresorhus/find-up) - A more advanced version of this package
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
- [package-up](https://github.com/sindresorhus/package-up) - Find the closest package.json file
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package