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

22
node_modules/@shikijs/engine-javascript/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2021 Pine Wu
Copyright (c) 2023 Anthony Fu <https://github.com/antfu>
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.

9
node_modules/@shikijs/engine-javascript/README.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
# @shikijs/engine-javascript
Engine for Shiki using JavaScript's native RegExp. Uses [Oniguruma-To-ES](https://github.com/slevithan/oniguruma-to-es) to transpile regex syntax and behavior.
[Documentation](https://shiki.style/guide/regex-engines)
## License
MIT

View File

@@ -0,0 +1,4 @@
import '@shikijs/types';
import 'oniguruma-to-es';
export { J as JavaScriptRegexEngineOptions, c as createJavaScriptRegexEngine, d as defaultJavaScriptRegexConstructor } from './shared/engine-javascript.DoNZS58X.mjs';
import '@shikijs/vscode-textmate';

View File

@@ -0,0 +1,4 @@
import '@shikijs/types';
import 'oniguruma-to-es';
export { J as JavaScriptRegexEngineOptions, c as createJavaScriptRegexEngine, d as defaultJavaScriptRegexConstructor } from './shared/engine-javascript.DoNZS58X.js';
import '@shikijs/vscode-textmate';

View File

@@ -0,0 +1,49 @@
import { toRegExp } from 'oniguruma-to-es';
import { J as JavaScriptScanner } from './shared/engine-javascript.hzpS1_41.mjs';
function defaultJavaScriptRegexConstructor(pattern, options) {
return toRegExp(
pattern,
{
global: true,
hasIndices: true,
rules: {
// Needed since TextMate grammars merge backrefs across patterns
allowOrphanBackrefs: true,
// Improves search performance for generated regexes
asciiWordBoundaries: true,
// Follow `vscode-oniguruma` which enables this Oniguruma option by default
captureGroup: true,
// Oniguruma uses depth limit `20`; lowered here to keep regexes shorter and maybe
// sometimes faster, but can be increased if issues reported due to low limit
recursionLimit: 5,
// Oniguruma option for `^`->`\A`, `$`->`\Z`; improves search performance without any
// change in meaning since TM grammars search line by line
singleline: true
},
...options
}
);
}
function createJavaScriptRegexEngine(options = {}) {
const _options = Object.assign(
{
target: "auto",
cache: /* @__PURE__ */ new Map()
},
options
);
_options.regexConstructor ||= (pattern) => defaultJavaScriptRegexConstructor(pattern, { target: _options.target });
return {
createScanner(patterns) {
return new JavaScriptScanner(patterns, _options);
},
createString(s) {
return {
content: s
};
}
};
}
export { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };

View File

@@ -0,0 +1,12 @@
import { RegexEngine } from '@shikijs/types';
/**
* Raw JavaScript regex engine that only supports precompiled grammars.
*
* This further simplifies the engine by excluding the regex compilation step.
*
* Zero dependencies.
*/
declare function createJavaScriptRawEngine(): RegexEngine;
export { createJavaScriptRawEngine };

View File

@@ -0,0 +1,12 @@
import { RegexEngine } from '@shikijs/types';
/**
* Raw JavaScript regex engine that only supports precompiled grammars.
*
* This further simplifies the engine by excluding the regex compilation step.
*
* Zero dependencies.
*/
declare function createJavaScriptRawEngine(): RegexEngine;
export { createJavaScriptRawEngine };

View File

@@ -0,0 +1,22 @@
import { J as JavaScriptScanner } from './shared/engine-javascript.hzpS1_41.mjs';
function createJavaScriptRawEngine() {
const options = {
cache: /* @__PURE__ */ new Map(),
regexConstructor: () => {
throw new Error("JavaScriptRawEngine: only support precompiled grammar");
}
};
return {
createScanner(patterns) {
return new JavaScriptScanner(patterns, options);
},
createString(s) {
return {
content: s
};
}
};
}
export { createJavaScriptRawEngine };

View File

@@ -0,0 +1,5 @@
export { J as JavaScriptRegexEngineOptions, a as JavaScriptRegexScannerOptions, b as JavaScriptScanner, c as createJavaScriptRegexEngine, d as defaultJavaScriptRegexConstructor } from './shared/engine-javascript.DoNZS58X.mjs';
export { createJavaScriptRawEngine } from './engine-raw.mjs';
import '@shikijs/types';
import 'oniguruma-to-es';
import '@shikijs/vscode-textmate';

View File

@@ -0,0 +1,5 @@
export { J as JavaScriptRegexEngineOptions, a as JavaScriptRegexScannerOptions, b as JavaScriptScanner, c as createJavaScriptRegexEngine, d as defaultJavaScriptRegexConstructor } from './shared/engine-javascript.DoNZS58X.js';
export { createJavaScriptRawEngine } from './engine-raw.js';
import '@shikijs/types';
import 'oniguruma-to-es';
import '@shikijs/vscode-textmate';

View File

@@ -0,0 +1,4 @@
export { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor } from './engine-compile.mjs';
export { createJavaScriptRawEngine } from './engine-raw.mjs';
export { J as JavaScriptScanner } from './shared/engine-javascript.hzpS1_41.mjs';
import 'oniguruma-to-es';

View File

@@ -0,0 +1,62 @@
import { PatternScanner, RegexEngineString, RegexEngine } from '@shikijs/types';
import { OnigurumaToEsOptions } from 'oniguruma-to-es';
import { IOnigMatch } from '@shikijs/vscode-textmate';
interface JavaScriptRegexScannerOptions {
/**
* Whether to allow invalid regex patterns.
*
* @default false
*/
forgiving?: boolean;
/**
* Cache for regex patterns.
*/
cache?: Map<string, RegExp | Error> | null;
/**
* Custom pattern to RegExp constructor.
*
* By default `oniguruma-to-es` is used.
*/
regexConstructor?: (pattern: string) => RegExp;
}
declare class JavaScriptScanner implements PatternScanner {
patterns: (string | RegExp)[];
options: JavaScriptRegexScannerOptions;
regexps: (RegExp | null)[];
constructor(patterns: (string | RegExp)[], options?: JavaScriptRegexScannerOptions);
findNextMatchSync(string: string | RegexEngineString, startPosition: number, _options: number): IOnigMatch | null;
}
interface JavaScriptRegexEngineOptions extends JavaScriptRegexScannerOptions {
/**
* The target ECMAScript version.
*
* Oniguruma-To-ES uses RegExp features from later versions of ECMAScript to add support for a
* few more grammars. If using target `ES2024` or later, the RegExp `v` flag is used which
* requires Node.js 20+ or Chrome 112+.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets
*
* For maximum compatibility, you can set it to `ES2018` which uses the RegExp `u` flag.
*
* Set to `auto` to automatically detect the latest version supported by the environment.
*
* @default 'auto'
*/
target?: 'auto' | 'ES2025' | 'ES2024' | 'ES2018';
}
/**
* The default regex constructor for the JavaScript RegExp engine.
*/
declare function defaultJavaScriptRegexConstructor(pattern: string, options?: OnigurumaToEsOptions): RegExp;
/**
* Use the modern JavaScript RegExp engine to implement the OnigScanner.
*
* As Oniguruma supports some features that can't be emulated using native JavaScript regexes, some
* patterns are not supported. Errors will be thrown when parsing TextMate grammars with
* unsupported patterns, and when the grammar includes patterns that use invalid Oniguruma syntax.
* Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
*/
declare function createJavaScriptRegexEngine(options?: JavaScriptRegexEngineOptions): RegexEngine;
export { type JavaScriptRegexEngineOptions as J, type JavaScriptRegexScannerOptions as a, JavaScriptScanner as b, createJavaScriptRegexEngine as c, defaultJavaScriptRegexConstructor as d };

View File

@@ -0,0 +1,62 @@
import { PatternScanner, RegexEngineString, RegexEngine } from '@shikijs/types';
import { OnigurumaToEsOptions } from 'oniguruma-to-es';
import { IOnigMatch } from '@shikijs/vscode-textmate';
interface JavaScriptRegexScannerOptions {
/**
* Whether to allow invalid regex patterns.
*
* @default false
*/
forgiving?: boolean;
/**
* Cache for regex patterns.
*/
cache?: Map<string, RegExp | Error> | null;
/**
* Custom pattern to RegExp constructor.
*
* By default `oniguruma-to-es` is used.
*/
regexConstructor?: (pattern: string) => RegExp;
}
declare class JavaScriptScanner implements PatternScanner {
patterns: (string | RegExp)[];
options: JavaScriptRegexScannerOptions;
regexps: (RegExp | null)[];
constructor(patterns: (string | RegExp)[], options?: JavaScriptRegexScannerOptions);
findNextMatchSync(string: string | RegexEngineString, startPosition: number, _options: number): IOnigMatch | null;
}
interface JavaScriptRegexEngineOptions extends JavaScriptRegexScannerOptions {
/**
* The target ECMAScript version.
*
* Oniguruma-To-ES uses RegExp features from later versions of ECMAScript to add support for a
* few more grammars. If using target `ES2024` or later, the RegExp `v` flag is used which
* requires Node.js 20+ or Chrome 112+.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets
*
* For maximum compatibility, you can set it to `ES2018` which uses the RegExp `u` flag.
*
* Set to `auto` to automatically detect the latest version supported by the environment.
*
* @default 'auto'
*/
target?: 'auto' | 'ES2025' | 'ES2024' | 'ES2018';
}
/**
* The default regex constructor for the JavaScript RegExp engine.
*/
declare function defaultJavaScriptRegexConstructor(pattern: string, options?: OnigurumaToEsOptions): RegExp;
/**
* Use the modern JavaScript RegExp engine to implement the OnigScanner.
*
* As Oniguruma supports some features that can't be emulated using native JavaScript regexes, some
* patterns are not supported. Errors will be thrown when parsing TextMate grammars with
* unsupported patterns, and when the grammar includes patterns that use invalid Oniguruma syntax.
* Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
*/
declare function createJavaScriptRegexEngine(options?: JavaScriptRegexEngineOptions): RegexEngine;
export { type JavaScriptRegexEngineOptions as J, type JavaScriptRegexScannerOptions as a, JavaScriptScanner as b, createJavaScriptRegexEngine as c, defaultJavaScriptRegexConstructor as d };

View File

@@ -0,0 +1,93 @@
const MAX = 4294967295;
class JavaScriptScanner {
constructor(patterns, options = {}) {
this.patterns = patterns;
this.options = options;
const {
forgiving = false,
cache,
regexConstructor
} = options;
if (!regexConstructor) {
throw new Error("Option `regexConstructor` is not provided");
}
this.regexps = patterns.map((p) => {
if (typeof p !== "string") {
return p;
}
const cached = cache?.get(p);
if (cached) {
if (cached instanceof RegExp) {
return cached;
}
if (forgiving)
return null;
throw cached;
}
try {
const regex = regexConstructor(p);
cache?.set(p, regex);
return regex;
} catch (e) {
cache?.set(p, e);
if (forgiving)
return null;
throw e;
}
});
}
regexps;
findNextMatchSync(string, startPosition, _options) {
const str = typeof string === "string" ? string : string.content;
const pending = [];
function toResult(index, match, offset = 0) {
return {
index,
captureIndices: match.indices.map((indice) => {
if (indice == null) {
return {
start: MAX,
end: MAX,
length: 0
};
}
return {
start: indice[0] + offset,
end: indice[1] + offset,
length: indice[1] - indice[0]
};
})
};
}
for (let i = 0; i < this.regexps.length; i++) {
const regexp = this.regexps[i];
if (!regexp)
continue;
try {
regexp.lastIndex = startPosition;
const match = regexp.exec(str);
if (!match)
continue;
if (match.index === startPosition) {
return toResult(i, match, 0);
}
pending.push([i, match, 0]);
} catch (e) {
if (this.options.forgiving)
continue;
throw e;
}
}
if (pending.length) {
const minIndex = Math.min(...pending.map((m) => m[1].index));
for (const [i, match, offset] of pending) {
if (match.index === minIndex) {
return toResult(i, match, offset);
}
}
}
return null;
}
}
export { JavaScriptScanner as J };

45
node_modules/@shikijs/engine-javascript/package.json generated vendored Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "@shikijs/engine-javascript",
"type": "module",
"version": "1.29.2",
"description": "Engine for Shiki using JavaScript's native RegExp",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"homepage": "https://github.com/shikijs/shiki#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/shikijs/shiki.git",
"directory": "packages/engine-javascript"
},
"bugs": "https://github.com/shikijs/shiki/issues",
"keywords": [
"shiki",
"shiki-engine"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"./raw": {
"types": "./dist/engine-raw.d.mts",
"default": "./dist/engine-raw.mjs"
}
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"files": [
"dist"
],
"dependencies": {
"@shikijs/vscode-textmate": "^10.0.1",
"oniguruma-to-es": "^2.2.0",
"@shikijs/types": "1.29.2"
},
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub"
}
}