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:
62
node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.DoNZS58X.d.mts
generated
vendored
Normal file
62
node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.DoNZS58X.d.mts
generated
vendored
Normal 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 };
|
62
node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.DoNZS58X.d.ts
generated
vendored
Normal file
62
node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.DoNZS58X.d.ts
generated
vendored
Normal 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 };
|
93
node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.hzpS1_41.mjs
generated
vendored
Normal file
93
node_modules/@shikijs/engine-javascript/dist/shared/engine-javascript.hzpS1_41.mjs
generated
vendored
Normal 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 };
|
Reference in New Issue
Block a user