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:
1
node_modules/unist-util-find-after/index.d.ts
generated
vendored
Normal file
1
node_modules/unist-util-find-after/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {findAfter} from './lib/index.js'
|
1
node_modules/unist-util-find-after/index.js
generated
vendored
Normal file
1
node_modules/unist-util-find-after/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {findAfter} from './lib/index.js'
|
74
node_modules/unist-util-find-after/lib/index.d.ts
generated
vendored
Normal file
74
node_modules/unist-util-find-after/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Find the first node in `parent` after another `node` or after an index,
|
||||
* that passes `test`.
|
||||
*
|
||||
* @param parent
|
||||
* Parent node.
|
||||
* @param index
|
||||
* Child node or index.
|
||||
* @param [test=undefined]
|
||||
* Test for child to look for (optional).
|
||||
* @returns
|
||||
* A child (matching `test`, if given) or `undefined`.
|
||||
*/
|
||||
export const findAfter: (<
|
||||
Kind extends import('unist').Parent,
|
||||
Check extends Test
|
||||
>(
|
||||
parent: Kind,
|
||||
index: number | Child<Kind>,
|
||||
test: Check
|
||||
) => Matches<Child<Kind>, Check> | undefined) &
|
||||
(<Kind_1 extends import('unist').Parent>(
|
||||
parent: Kind_1,
|
||||
index: number | Child<Kind_1>,
|
||||
test?: null | undefined
|
||||
) => Child<Kind_1> | undefined)
|
||||
export type UnistNode = import('unist').Node
|
||||
export type UnistParent = import('unist').Parent
|
||||
/**
|
||||
* Test from `unist-util-is`.
|
||||
*
|
||||
* Note: we have remove and add `undefined`, because otherwise when generating
|
||||
* automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
|
||||
* which doesn’t work when publishing on npm.
|
||||
*/
|
||||
export type Test = Exclude<import('unist-util-is').Test, undefined> | undefined
|
||||
/**
|
||||
* Get the value of a type guard `Fn`.
|
||||
*/
|
||||
export type Predicate<Fn, Fallback> = Fn extends (
|
||||
value: any
|
||||
) => value is infer Thing
|
||||
? Thing
|
||||
: Fallback
|
||||
/**
|
||||
* Check whether a node matches a primitive check in the type system.
|
||||
*/
|
||||
export type MatchesOne<Value, Check> = Check extends null | undefined
|
||||
? Value
|
||||
: Value extends {
|
||||
type: Check
|
||||
}
|
||||
? Value
|
||||
: Value extends Check
|
||||
? Value
|
||||
: Check extends Function
|
||||
? Predicate<Check, Value> extends Value
|
||||
? Predicate<Check, Value>
|
||||
: never
|
||||
: never
|
||||
/**
|
||||
* Check whether a node matches a check in the type system.
|
||||
*/
|
||||
export type Matches<Value, Check> = Check extends Array<any>
|
||||
? MatchesOne<Value, Check[keyof Check]>
|
||||
: MatchesOne<Value, Check>
|
||||
/**
|
||||
* Collect nodes that can be parents of `Child`.
|
||||
*/
|
||||
export type Child<Kind extends import('unist').Node> = Kind extends {
|
||||
children: (infer Child_1)[]
|
||||
}
|
||||
? Child_1
|
||||
: never
|
130
node_modules/unist-util-find-after/lib/index.js
generated
vendored
Normal file
130
node_modules/unist-util-find-after/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* @typedef {import('unist').Node} UnistNode
|
||||
* @typedef {import('unist').Parent} UnistParent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
|
||||
* Test from `unist-util-is`.
|
||||
*
|
||||
* Note: we have remove and add `undefined`, because otherwise when generating
|
||||
* automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
|
||||
* which doesn’t work when publishing on npm.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {(
|
||||
* Fn extends (value: any) => value is infer Thing
|
||||
* ? Thing
|
||||
* : Fallback
|
||||
* )} Predicate
|
||||
* Get the value of a type guard `Fn`.
|
||||
* @template Fn
|
||||
* Value; typically function that is a type guard (such as `(x): x is Y`).
|
||||
* @template Fallback
|
||||
* Value to yield if `Fn` is not a type guard.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {(
|
||||
* Check extends null | undefined // No test.
|
||||
* ? Value
|
||||
* : Value extends {type: Check} // String (type) test.
|
||||
* ? Value
|
||||
* : Value extends Check // Partial test.
|
||||
* ? Value
|
||||
* : Check extends Function // Function test.
|
||||
* ? Predicate<Check, Value> extends Value
|
||||
* ? Predicate<Check, Value>
|
||||
* : never
|
||||
* : never // Some other test?
|
||||
* )} MatchesOne
|
||||
* Check whether a node matches a primitive check in the type system.
|
||||
* @template Value
|
||||
* Value; typically unist `Node`.
|
||||
* @template Check
|
||||
* Value; typically `unist-util-is`-compatible test, but not arrays.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {(
|
||||
* Check extends Array<any>
|
||||
* ? MatchesOne<Value, Check[keyof Check]>
|
||||
* : MatchesOne<Value, Check>
|
||||
* )} Matches
|
||||
* Check whether a node matches a check in the type system.
|
||||
* @template Value
|
||||
* Value; typically unist `Node`.
|
||||
* @template Check
|
||||
* Value; typically `unist-util-is`-compatible test.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {(
|
||||
* Kind extends {children: Array<infer Child>}
|
||||
* ? Child
|
||||
* : never
|
||||
* )} Child
|
||||
* Collect nodes that can be parents of `Child`.
|
||||
* @template {UnistNode} Kind
|
||||
* All node types.
|
||||
*/
|
||||
|
||||
import {convert} from 'unist-util-is'
|
||||
|
||||
/**
|
||||
* Find the first node in `parent` after another `node` or after an index,
|
||||
* that passes `test`.
|
||||
*
|
||||
* @param parent
|
||||
* Parent node.
|
||||
* @param index
|
||||
* Child node or index.
|
||||
* @param [test=undefined]
|
||||
* Test for child to look for (optional).
|
||||
* @returns
|
||||
* A child (matching `test`, if given) or `undefined`.
|
||||
*/
|
||||
export const findAfter =
|
||||
// Note: overloads like this are needed to support optional generics.
|
||||
/**
|
||||
* @type {(
|
||||
* (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) &
|
||||
* (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined)
|
||||
* )}
|
||||
*/
|
||||
(
|
||||
/**
|
||||
* @param {UnistParent} parent
|
||||
* @param {UnistNode | number} index
|
||||
* @param {Test} [test]
|
||||
* @returns {UnistNode | undefined}
|
||||
*/
|
||||
function (parent, index, test) {
|
||||
const is = convert(test)
|
||||
|
||||
if (!parent || !parent.type || !parent.children) {
|
||||
throw new Error('Expected parent node')
|
||||
}
|
||||
|
||||
if (typeof index === 'number') {
|
||||
if (index < 0 || index === Number.POSITIVE_INFINITY) {
|
||||
throw new Error('Expected positive finite number as index')
|
||||
}
|
||||
} else {
|
||||
index = parent.children.indexOf(index)
|
||||
|
||||
if (index < 0) {
|
||||
throw new Error('Expected child node or index')
|
||||
}
|
||||
}
|
||||
|
||||
while (++index < parent.children.length) {
|
||||
if (is(parent.children[index], index, parent)) {
|
||||
return parent.children[index]
|
||||
}
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
)
|
22
node_modules/unist-util-find-after/license
generated
vendored
Normal file
22
node_modules/unist-util-find-after/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.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.
|
84
node_modules/unist-util-find-after/package.json
generated
vendored
Normal file
84
node_modules/unist-util-find-after/package.json
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"name": "unist-util-find-after",
|
||||
"version": "5.0.0",
|
||||
"description": "unist utility to find a node after another node",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"node",
|
||||
"find",
|
||||
"after"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-find-after",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-find-after/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/unist": "^3.0.0",
|
||||
"unist-util-is": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mdast": "^4.0.0",
|
||||
"@types/node": "^20.0.0",
|
||||
"c8": "^8.0.0",
|
||||
"mdast-util-from-markdown": "^1.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^11.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"tsd": "^0.28.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"xo": "^0.54.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build": "tsc --build --clean && tsc --build && tsd && type-coverage",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node --conditions development test.js",
|
||||
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "none",
|
||||
"useTabs": false
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"remark-preset-wooorm"
|
||||
]
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"ignoreCatch": true,
|
||||
"#": "needed `any`s",
|
||||
"ignoreFiles": [
|
||||
"lib/index.d.ts"
|
||||
],
|
||||
"strict": true
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true
|
||||
}
|
||||
}
|
220
node_modules/unist-util-find-after/readme.md
generated
vendored
Normal file
220
node_modules/unist-util-find-after/readme.md
generated
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
# unist-util-find-after
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
[![Sponsors][sponsors-badge]][collective]
|
||||
[![Backers][backers-badge]][collective]
|
||||
[![Chat][chat-badge]][chat]
|
||||
|
||||
[unist][] utility to find a node after another node.
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When should I use this?](#when-should-i-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`findAfter(parent, node|index[, test])`](#findafterparent-nodeindex-test)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Related](#related)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This is a tiny utility that you can use to find a node after another node or
|
||||
after an index in a parent.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
This is super tiny.
|
||||
You can of course do it yourself.
|
||||
But this helps when integrating with the rest of unified and unist.
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 16+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-find-after
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import {findAfter} from 'https://esm.sh/unist-util-find-after@5'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {findAfter} from 'https://esm.sh/unist-util-find-after@5?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {u} from 'unist-builder'
|
||||
import {findAfter} from 'unist-util-find-after'
|
||||
|
||||
const tree = u('tree', [
|
||||
u('leaf', 'leaf 1'),
|
||||
u('parent', [u('leaf', 'leaf 2'), u('leaf', 'leaf 3')]),
|
||||
u('leaf', 'leaf 4'),
|
||||
u('parent', [u('leaf', 'leaf 5')]),
|
||||
u('leaf', 'leaf 6'),
|
||||
u('empty'),
|
||||
u('leaf', 'leaf 7')
|
||||
])
|
||||
|
||||
console.log(findAfter(tree, 1, 'parent'))
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{type: 'parent', children: [{ type: 'leaf', value: 'leaf 5'}]}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the identifier [`findAfter`][api-findafter].
|
||||
There is no default export.
|
||||
|
||||
### `findAfter(parent, node|index[, test])`
|
||||
|
||||
Find the first node in `parent` after another `node` or after an index,
|
||||
that passes `test`.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `parent` ([`Node`][node])
|
||||
— parent node
|
||||
* `index` (`number`)
|
||||
— index of child in `parent`
|
||||
* `child` ([`Node`][node])
|
||||
— child in `parent`
|
||||
* `test` ([`Test`][test])
|
||||
— `unist-util-is`-compatible test
|
||||
|
||||
###### Returns
|
||||
|
||||
Child of `parent` ([`Node`][node]) or `undefined`.
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports no additional types (types for the test are in `unist-util-is`).
|
||||
|
||||
## Compatibility
|
||||
|
||||
Projects maintained by the unified collective are compatible with maintained
|
||||
versions of Node.js.
|
||||
|
||||
When we cut a new major release, we drop support for unmaintained versions of
|
||||
Node.
|
||||
This means we try to keep the current release line, `unist-util-find-after@^5`,
|
||||
compatible with Node.js 16.
|
||||
|
||||
## Related
|
||||
|
||||
* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit)
|
||||
— walk the tree
|
||||
* [`unist-util-visit-parents`](https://github.com/syntax-tree/unist-util-visit-parents)
|
||||
— walk the tree with a stack of parents
|
||||
* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)
|
||||
— create a new tree with all nodes that pass a test
|
||||
* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map)
|
||||
— create a new tree with all nodes mapped by a given function
|
||||
* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap)
|
||||
— create a new tree by mapping (to an array) with the provided function and
|
||||
then flattening
|
||||
* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before)
|
||||
— find a node before another node
|
||||
* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after)
|
||||
— find all nodes after another node
|
||||
* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before)
|
||||
— find all nodes before another node
|
||||
* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between)
|
||||
— find all nodes between two nodes
|
||||
* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)
|
||||
— remove nodes from a tree that pass a test
|
||||
* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select)
|
||||
— select nodes with CSS-like selectors
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
|
||||
ways to get started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [Code of Conduct][coc].
|
||||
By interacting with this repository, organisation, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/syntax-tree/unist-util-find-after/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/syntax-tree/unist-util-find-after/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-find-after.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-find-after
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-find-after.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-util-find-after
|
||||
|
||||
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-find-after
|
||||
|
||||
[size]: https://bundlejs.com/?q=unist-util-find-after
|
||||
|
||||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
||||
|
||||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
||||
|
||||
[collective]: https://opencollective.com/unified
|
||||
|
||||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
||||
|
||||
[chat]: https://github.com/syntax-tree/unist/discussions
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[esmsh]: https://esm.sh
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[health]: https://github.com/syntax-tree/.github
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
|
||||
|
||||
[unist]: https://github.com/syntax-tree/unist
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
|
||||
[test]: https://github.com/syntax-tree/unist-util-is#test
|
||||
|
||||
[api-findafter]: #findafterparent-nodeindex-test
|
Reference in New Issue
Block a user