Files
agentic-studio/network-poc/frontend/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
Jaakko Vanhala a8c4af0975 Frontend uudelleenrakennettu: Astro-komponentit, Wasm pääsäikeessä, ei Workeria
Vanha frontend siirretty temp/. Uusi rakenne:
- StatusBar.astro, Terminal.astro, Editor.astro, Guide.astro
- global.css erillinen
- Wasm pääsäikeessä (ei Worker — yksinkertainen, debugattava)
- Tab-completion, dropdown, projektikortti, Monaco, GUIDE.md
- Ei tokenisointia eikä koodilaboratoriota

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 20:17:39 +03:00

48 lines
1.5 KiB
JavaScript

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 };