Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
22
node_modules/@shikijs/engine-javascript/LICENSE
generated
vendored
Normal file
22
node_modules/@shikijs/engine-javascript/LICENSE
generated
vendored
Normal 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
9
node_modules/@shikijs/engine-javascript/README.md
generated
vendored
Normal 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
|
||||
37
node_modules/@shikijs/engine-javascript/dist/engine-compile.d.mts
generated
vendored
Normal file
37
node_modules/@shikijs/engine-javascript/dist/engine-compile.d.mts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { t as JavaScriptRegexScannerOptions } from "./scanner-CFS1MV4a.mjs";
|
||||
import { ToRegExpOptions } from "oniguruma-to-es";
|
||||
import { RegexEngine } from "@shikijs/types";
|
||||
|
||||
//#region src/engine-compile.d.ts
|
||||
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?: ToRegExpOptions): 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;
|
||||
//#endregion
|
||||
export { JavaScriptRegexEngineOptions, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
||||
48
node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
generated
vendored
Normal file
48
node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { t as JavaScriptScanner } from "./scanner-BFcBmQR1.mjs";
|
||||
import { toRegExp } from "oniguruma-to-es";
|
||||
|
||||
//#region src/engine-compile.ts
|
||||
/**
|
||||
* The default regex constructor for the JavaScript RegExp engine.
|
||||
*/
|
||||
function defaultJavaScriptRegexConstructor(pattern, options) {
|
||||
return toRegExp(pattern, {
|
||||
global: true,
|
||||
hasIndices: true,
|
||||
lazyCompileLength: 3e3,
|
||||
rules: {
|
||||
allowOrphanBackrefs: true,
|
||||
asciiWordBoundaries: true,
|
||||
captureGroup: true,
|
||||
recursionLimit: 5,
|
||||
singleline: true
|
||||
},
|
||||
...options
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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 };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
||||
13
node_modules/@shikijs/engine-javascript/dist/engine-raw.d.mts
generated
vendored
Normal file
13
node_modules/@shikijs/engine-javascript/dist/engine-raw.d.mts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { RegexEngine } from "@shikijs/types";
|
||||
|
||||
//#region src/engine-raw.d.ts
|
||||
/**
|
||||
* 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;
|
||||
//#endregion
|
||||
export { createJavaScriptRawEngine };
|
||||
29
node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
generated
vendored
Normal file
29
node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { t as JavaScriptScanner } from "./scanner-BFcBmQR1.mjs";
|
||||
|
||||
//#region src/engine-raw.ts
|
||||
/**
|
||||
* Raw JavaScript regex engine that only supports precompiled grammars.
|
||||
*
|
||||
* This further simplifies the engine by excluding the regex compilation step.
|
||||
*
|
||||
* Zero dependencies.
|
||||
*/
|
||||
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 };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { createJavaScriptRawEngine };
|
||||
4
node_modules/@shikijs/engine-javascript/dist/index.d.mts
generated
vendored
Normal file
4
node_modules/@shikijs/engine-javascript/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { n as JavaScriptScanner, t as JavaScriptRegexScannerOptions } from "./scanner-CFS1MV4a.mjs";
|
||||
import { JavaScriptRegexEngineOptions, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor } from "./engine-compile.mjs";
|
||||
import { createJavaScriptRawEngine } from "./engine-raw.mjs";
|
||||
export { JavaScriptRegexEngineOptions, JavaScriptRegexScannerOptions, JavaScriptScanner, createJavaScriptRawEngine, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
||||
5
node_modules/@shikijs/engine-javascript/dist/index.mjs
generated
vendored
Normal file
5
node_modules/@shikijs/engine-javascript/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { t as JavaScriptScanner } from "./scanner-BFcBmQR1.mjs";
|
||||
import { createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor } from "./engine-compile.mjs";
|
||||
import { createJavaScriptRawEngine } from "./engine-raw.mjs";
|
||||
|
||||
export { JavaScriptScanner, createJavaScriptRawEngine, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
|
||||
76
node_modules/@shikijs/engine-javascript/dist/scanner-BFcBmQR1.mjs
generated
vendored
Normal file
76
node_modules/@shikijs/engine-javascript/dist/scanner-BFcBmQR1.mjs
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
//#region src/scanner.ts
|
||||
const MAX = 4294967295;
|
||||
var JavaScriptScanner = class {
|
||||
regexps;
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
//#endregion
|
||||
export { JavaScriptScanner as t };
|
||||
31
node_modules/@shikijs/engine-javascript/dist/scanner-CFS1MV4a.d.mts
generated
vendored
Normal file
31
node_modules/@shikijs/engine-javascript/dist/scanner-CFS1MV4a.d.mts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { PatternScanner, RegexEngineString } from "@shikijs/types";
|
||||
import { IOnigMatch } from "@shikijs/vscode-textmate";
|
||||
|
||||
//#region src/scanner.d.ts
|
||||
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;
|
||||
}
|
||||
//#endregion
|
||||
export { JavaScriptScanner as n, JavaScriptRegexScannerOptions as t };
|
||||
42
node_modules/@shikijs/engine-javascript/package.json
generated
vendored
Normal file
42
node_modules/@shikijs/engine-javascript/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@shikijs/engine-javascript",
|
||||
"type": "module",
|
||||
"version": "4.0.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": {
|
||||
".": "./dist/index.mjs",
|
||||
"./raw": "./dist/engine-raw.mjs"
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.mts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"dependencies": {
|
||||
"@shikijs/vscode-textmate": "^10.0.2",
|
||||
"oniguruma-to-es": "^4.3.4",
|
||||
"@shikijs/types": "4.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsdown",
|
||||
"dev": "tsdown --watch"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user