mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 21:46:48 +00:00
Split the diffs viewer Shiki language pack into an external publishable plugin. The diffs plugin keeps the default curated syntax set, while the new @openclaw/diffs-language-pack package carries the extended Shiki languages for npm and ClawHub distribution. The install metadata includes the external ClawHub spec, and the curated C# alias set keeps both c# and cs supported without the language pack. Co-authored-by: Dallin Romney <dallinromney@gmail.com>
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import {
|
|
createBundledHighlighter,
|
|
createCssVariablesTheme,
|
|
createSingletonShorthands,
|
|
getTokenStyleObject,
|
|
guessEmbeddedLanguages,
|
|
normalizeTheme,
|
|
stringifyTokenStyle,
|
|
} from "@shikijs/core";
|
|
import {
|
|
createJavaScriptRegexEngine,
|
|
defaultJavaScriptRegexConstructor,
|
|
} from "@shikijs/engine-javascript";
|
|
import { createOnigurumaEngine, loadWasm } from "@shikijs/engine-oniguruma";
|
|
import { bundledLanguages } from "../extensions/diffs/src/shiki-curated-languages.js";
|
|
export * from "@shikijs/core";
|
|
export {
|
|
bundledLanguages,
|
|
bundledLanguagesAlias,
|
|
bundledLanguagesBase,
|
|
bundledLanguagesInfo,
|
|
} from "../extensions/diffs/src/shiki-curated-languages.js";
|
|
export { bundledThemes, bundledThemesInfo } from "shiki/themes";
|
|
import { bundledThemes } from "shiki/themes";
|
|
|
|
export type BundledLanguage = keyof typeof bundledLanguages;
|
|
export type BundledTheme = keyof typeof bundledThemes;
|
|
|
|
export const createHighlighter = createBundledHighlighter({
|
|
langs: bundledLanguages,
|
|
themes: bundledThemes,
|
|
engine: () => createOnigurumaEngine(import("shiki/wasm")),
|
|
});
|
|
|
|
const shorthands = createSingletonShorthands(createHighlighter, { guessEmbeddedLanguages });
|
|
|
|
export const codeToHtml = shorthands.codeToHtml;
|
|
export const codeToHast = shorthands.codeToHast;
|
|
export const codeToTokens = shorthands.codeToTokens;
|
|
export const codeToTokensBase = shorthands.codeToTokensBase;
|
|
export const codeToTokensWithThemes = shorthands.codeToTokensWithThemes;
|
|
export const getSingletonHighlighter = shorthands.getSingletonHighlighter;
|
|
export const getLastGrammarState = shorthands.getLastGrammarState;
|
|
export {
|
|
createCssVariablesTheme,
|
|
createJavaScriptRegexEngine,
|
|
createOnigurumaEngine,
|
|
defaultJavaScriptRegexConstructor,
|
|
getTokenStyleObject,
|
|
loadWasm,
|
|
normalizeTheme,
|
|
stringifyTokenStyle,
|
|
};
|