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:
13
node_modules/stdin-discarder/index.d.ts
generated
vendored
Normal file
13
node_modules/stdin-discarder/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
declare const stdinDiscarder: {
|
||||
/**
|
||||
Start discarding stdin.
|
||||
*/
|
||||
start(): void;
|
||||
|
||||
/**
|
||||
Stop discarding stdin.
|
||||
*/
|
||||
stop(): void;
|
||||
};
|
||||
|
||||
export default stdinDiscarder;
|
59
node_modules/stdin-discarder/index.js
generated
vendored
Normal file
59
node_modules/stdin-discarder/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import process from 'node:process';
|
||||
|
||||
const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code
|
||||
|
||||
class StdinDiscarder {
|
||||
#activeCount = 0;
|
||||
|
||||
start() {
|
||||
this.#activeCount++;
|
||||
|
||||
if (this.#activeCount === 1) {
|
||||
this.#realStart();
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (this.#activeCount <= 0) {
|
||||
throw new Error('`stop` called more times than `start`');
|
||||
}
|
||||
|
||||
this.#activeCount--;
|
||||
|
||||
if (this.#activeCount === 0) {
|
||||
this.#realStop();
|
||||
}
|
||||
}
|
||||
|
||||
#realStart() {
|
||||
// No known way to make it work reliably on Windows.
|
||||
if (process.platform === 'win32' || !process.stdin.isTTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.on('data', this.#handleInput);
|
||||
process.stdin.resume();
|
||||
}
|
||||
|
||||
#realStop() {
|
||||
if (!process.stdin.isTTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
process.stdin.off('data', this.#handleInput);
|
||||
process.stdin.pause();
|
||||
process.stdin.setRawMode(false);
|
||||
}
|
||||
|
||||
#handleInput(chunk) {
|
||||
// Allow Ctrl+C to gracefully exit.
|
||||
if (chunk[0] === ASCII_ETX_CODE) {
|
||||
process.emit('SIGINT');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const stdinDiscarder = new StdinDiscarder();
|
||||
|
||||
export default stdinDiscarder;
|
9
node_modules/stdin-discarder/license
generated
vendored
Normal file
9
node_modules/stdin-discarder/license
generated
vendored
Normal 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.
|
42
node_modules/stdin-discarder/package.json
generated
vendored
Normal file
42
node_modules/stdin-discarder/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "stdin-discarder",
|
||||
"version": "0.2.2",
|
||||
"description": "Discard stdin input except for Ctrl+C",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/stdin-discarder",
|
||||
"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 && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"stdin",
|
||||
"process",
|
||||
"standard",
|
||||
"discard",
|
||||
"ignore",
|
||||
"input"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^6.0.1",
|
||||
"tsd": "^0.29.0",
|
||||
"xo": "^0.56.0"
|
||||
}
|
||||
}
|
37
node_modules/stdin-discarder/readme.md
generated
vendored
Normal file
37
node_modules/stdin-discarder/readme.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# stdin-discarder
|
||||
|
||||
> Discard stdin input except for Ctrl+C
|
||||
|
||||
This can be useful to prevent stdin input from interfering with stdout output. For example, you are showing a spinner, and if the user presses a key, it would interfere with the spinner, causing visual glitches. This package prevents such problems.
|
||||
|
||||
This has no effect on Windows as there is no good way to implement discarding stdin properly there.
|
||||
|
||||
This package is used by [`ora`](https://github.com/sindresorhus/ora) for its [`discardStdin`](https://github.com/sindresorhus/ora#discardstdin) option.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install stdin-discarder
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import stdinDiscarder from 'stdin-discarder';
|
||||
|
||||
stdinDiscarder.start();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### stdinDiscarder.start()
|
||||
|
||||
Start discarding stdin.
|
||||
|
||||
### stdinDiscarder.stop()
|
||||
|
||||
Stop discarding stdin.
|
||||
|
||||
## Related
|
||||
|
||||
- [hook-std](https://github.com/sindresorhus/hook-std) - Hook and modify stdout and stderr
|
Reference in New Issue
Block a user