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:
5
node_modules/unist-util-modify-children/index.d.ts
generated
vendored
Normal file
5
node_modules/unist-util-modify-children/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export {modifyChildren} from './lib/index.js'
|
||||
export type Modifier<Kind extends import('unist').Parent> =
|
||||
import('./lib/index.js').Modifier<Kind>
|
||||
export type Modify<Kind extends import('unist').Parent> =
|
||||
import('./lib/index.js').Modify<Kind>
|
11
node_modules/unist-util-modify-children/index.js
generated
vendored
Normal file
11
node_modules/unist-util-modify-children/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @template {import('unist').Parent} Kind
|
||||
* @typedef {import('./lib/index.js').Modifier<Kind>} Modifier
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {import('unist').Parent} Kind
|
||||
* @typedef {import('./lib/index.js').Modify<Kind>} Modify
|
||||
*/
|
||||
|
||||
export {modifyChildren} from './lib/index.js'
|
30
node_modules/unist-util-modify-children/lib/index.d.ts
generated
vendored
Normal file
30
node_modules/unist-util-modify-children/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Wrap `modifier` to be called for each child in the nodes later given to
|
||||
* `modify`.
|
||||
*
|
||||
* @template {Parent} Kind
|
||||
* Node type.
|
||||
* @param {Modifier<Kind>} modifier
|
||||
* Callback called for each `child` in `parent` later given to `modify`.
|
||||
* @returns {Modify<Kind>}
|
||||
* Modify children of `parent`.
|
||||
*/
|
||||
export function modifyChildren<Kind extends import('unist').Parent>(
|
||||
modifier: Modifier<Kind>
|
||||
): Modify<Kind>
|
||||
export type Node = import('unist').Node
|
||||
export type Parent = import('unist').Parent
|
||||
/**
|
||||
* Callback called for each `child` in `parent` later given to `modify`.
|
||||
*/
|
||||
export type Modifier<Kind extends import('unist').Parent> = (
|
||||
child: Kind['children'][number],
|
||||
index: number,
|
||||
parent: Kind
|
||||
) => number | undefined | void
|
||||
/**
|
||||
* Modify children of `parent`.
|
||||
*/
|
||||
export type Modify<Kind extends import('unist').Parent> = (
|
||||
parent: Kind
|
||||
) => undefined
|
68
node_modules/unist-util-modify-children/lib/index.js
generated
vendored
Normal file
68
node_modules/unist-util-modify-children/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @typedef {import('unist').Node} Node
|
||||
* @typedef {import('unist').Parent} Parent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Parent} Kind
|
||||
* Node type.
|
||||
* @callback Modifier
|
||||
* Callback called for each `child` in `parent` later given to `modify`.
|
||||
* @param {Kind['children'][number]} child
|
||||
* Child of `parent`.
|
||||
* @param {number} index
|
||||
* Position of `child` in `parent`.
|
||||
* @param {Kind} parent
|
||||
* Parent node.
|
||||
* @returns {number | undefined | void}
|
||||
* Position to move to next (optional).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Parent} Kind
|
||||
* Node type.
|
||||
* @callback Modify
|
||||
* Modify children of `parent`.
|
||||
* @param {Kind} parent
|
||||
* Parent node.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
|
||||
import {arrayIterate} from 'array-iterate'
|
||||
|
||||
/**
|
||||
* Wrap `modifier` to be called for each child in the nodes later given to
|
||||
* `modify`.
|
||||
*
|
||||
* @template {Parent} Kind
|
||||
* Node type.
|
||||
* @param {Modifier<Kind>} modifier
|
||||
* Callback called for each `child` in `parent` later given to `modify`.
|
||||
* @returns {Modify<Kind>}
|
||||
* Modify children of `parent`.
|
||||
*/
|
||||
export function modifyChildren(modifier) {
|
||||
return modify
|
||||
|
||||
/** @type {Modify<Kind>} */
|
||||
function modify(parent) {
|
||||
if (!parent || !parent.children) {
|
||||
throw new Error('Missing children in `parent` for `modifier`')
|
||||
}
|
||||
|
||||
arrayIterate(parent.children, iteratee, parent)
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the context as the third argument to `modifier`.
|
||||
*
|
||||
* @this {Kind}
|
||||
* @param {Node} node
|
||||
* @param {number} index
|
||||
* @returns {number | undefined | void}
|
||||
*/
|
||||
function iteratee(node, index) {
|
||||
return modifier(node, index, this)
|
||||
}
|
||||
}
|
22
node_modules/unist-util-modify-children/license
generated
vendored
Normal file
22
node_modules/unist-util-modify-children/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.
|
91
node_modules/unist-util-modify-children/package.json
generated
vendored
Normal file
91
node_modules/unist-util-modify-children/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "unist-util-modify-children",
|
||||
"version": "4.0.0",
|
||||
"description": "unist utility to modify direct children of a parent",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"tree",
|
||||
"ast",
|
||||
"modify",
|
||||
"children"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-modify-children",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-modify-children/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)",
|
||||
"Merlijn Vos <merlijn@soverin.net>"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/unist": "^3.0.0",
|
||||
"array-iterate": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.0.0",
|
||||
"c8": "^8.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,
|
||||
"strict": true
|
||||
},
|
||||
"xo": {
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/*.ts"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-definitions": "off",
|
||||
"import/no-extraneous-dependencies": "off"
|
||||
}
|
||||
}
|
||||
],
|
||||
"prettier": true
|
||||
}
|
||||
}
|
263
node_modules/unist-util-modify-children/readme.md
generated
vendored
Normal file
263
node_modules/unist-util-modify-children/readme.md
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
# unist-util-modify-children
|
||||
|
||||
[![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 change children of a parent.
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When should I use this?](#when-should-i-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`modifyChildren(modifier)`](#modifychildrenmodifier)
|
||||
* [`Modifier`](#modifier)
|
||||
* [`Modify`](#modify)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Related](#related)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This is a tiny utility that you can use to create a reusable function that
|
||||
modifies children.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
Probably never!
|
||||
Use [`unist-util-visit`][unist-util-visit].
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 16+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-modify-children
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import {modifyChildren} from 'https://esm.sh/unist-util-modify-children@4'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {modifyChildren} from 'https://esm.sh/unist-util-modify-children@4?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import u from 'unist-builder'
|
||||
import {modifyChildren} from 'unist-util-modify-children'
|
||||
|
||||
const tree = u('root', [
|
||||
u('leaf', '1'),
|
||||
u('parent', [u('leaf', '2')]),
|
||||
u('leaf', '3')
|
||||
])
|
||||
const modify = modifyChildren(function (node, index, parent) {
|
||||
if (node.type === 'parent') {
|
||||
parent.children.splice(index, 1, {type: 'subtree', children: parent.children})
|
||||
return index + 1
|
||||
}
|
||||
})
|
||||
|
||||
modify(tree)
|
||||
|
||||
console.dir(tree, {depth: undefined})
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'root',
|
||||
children: [
|
||||
{type: 'leaf', value: '1'},
|
||||
{type: 'subtree', children: [{type: 'leaf', value: '2'}]},
|
||||
{type: 'leaf', value: '3'}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the identifier [`modifyChildren`][api-modifychildren].
|
||||
There is no default export.
|
||||
|
||||
### `modifyChildren(modifier)`
|
||||
|
||||
Wrap `modifier` to be called for each child in the nodes later given to
|
||||
`modify`.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `modifier` ([`Modifier`][api-modifier])
|
||||
— callback called for each `child` in `parent` later given to `modify`
|
||||
|
||||
###### Returns
|
||||
|
||||
Modify children of `parent` ([`Modify`][api-modify]).
|
||||
|
||||
### `Modifier`
|
||||
|
||||
Callback called for each `child` in `parent` later given to `modify`
|
||||
(TypeScript type).
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `child` ([`Node`][node])
|
||||
— child of `parent`
|
||||
* `index` (`number`)
|
||||
— position of `child` in `parent`
|
||||
* `parent` ([`Node`][node])
|
||||
— parent node
|
||||
|
||||
###### Returns
|
||||
|
||||
Position to move to next (optional) (`number` or `undefined`).
|
||||
|
||||
### `Modify`
|
||||
|
||||
Modify children of `parent` (TypeScript type).
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `parent` ([`Node`][node])
|
||||
— parent node
|
||||
|
||||
###### Returns
|
||||
|
||||
Nothing (`undefined`).
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports the additional types [`Modifier`][api-modifier] and
|
||||
[`Modify`][api-modify].
|
||||
|
||||
## 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-modify-children@^4`, 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 given function
|
||||
* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after)
|
||||
— find a node after another node
|
||||
* [`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, organization, 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-modify-children/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/syntax-tree/unist-util-modify-children/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-modify-children.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-modify-children
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-modify-children.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-util-modify-children
|
||||
|
||||
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-modify-children
|
||||
|
||||
[size]: https://bundlejs.com/?q=unist-util-modify-children
|
||||
|
||||
[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#nodes
|
||||
|
||||
[unist-util-visit]: https://github.com/syntax-tree/unist-util-visit
|
||||
|
||||
[api-modifychildren]: #modifychildrenmodifier
|
||||
|
||||
[api-modifier]: #modifier
|
||||
|
||||
[api-modify]: #modify
|
Reference in New Issue
Block a user