shiki hljs

This commit is contained in:
thororen1234 2026-04-24 13:21:42 -04:00
parent b5d0d81363
commit 8229b2c310
No known key found for this signature in database
3 changed files with 7 additions and 5 deletions

View file

@ -16,9 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { cl } from "@plugins/shikiCodeblocks.desktop/utils/misc";
import { cl, hljs } from "@plugins/shikiCodeblocks.desktop/utils/misc";
import type { IThemedToken } from "@vap/shiki";
import { hljs } from "@webpack/common";
import { JSX } from "react";
import { ThemeBase } from "./Highlighter";

View file

@ -20,10 +20,15 @@ import { resolveLang } from "@plugins/shikiCodeblocks.desktop/api/languages";
import { HighlighterProps } from "@plugins/shikiCodeblocks.desktop/components/Highlighter";
import { HljsSetting } from "@plugins/shikiCodeblocks.desktop/types";
import { classNameFactory } from "@utils/css";
import { hljs } from "@webpack/common";
import { DefaultExtractAndLoadChunksRegex, extractAndLoadChunks, findByPropsLazy, proxyLazyWebpack } from "@webpack";
export const cl = classNameFactory("vc-shiki-");
export const hljs: typeof import("highlight.js").default = proxyLazyWebpack(() => {
extractAndLoadChunks(["codeBlock:{react("], new RegExp(`*hljs*.+?${DefaultExtractAndLoadChunksRegex.source}`));
return findByPropsLazy("highlight", "registerLanguage");
});
export const shouldUseHljs = ({
lang,
tryHljs,

View file

@ -46,8 +46,6 @@ export const Constants: t.Constants = mapMangledModuleLazy('ME:"/users/@me"', {
export const RestAPI: t.RestAPI = findLazy(m => typeof m === "object" && m.del && m.put);
export const moment: typeof import("moment") = findByPropsLazy("parseTwoDigitYear");
export const hljs: typeof import("highlight.js").default = findLazy(m => m.default?.highlight && m.default?.registerLanguage)?.default;
export const useDrag = findByCodeLazy("useDrag::spec.begin was deprecated");
// you cant make a better finder i love that they remove display names sm
export const useDrop = findByCodeLazy(".disconnectDropTarget()", ".dropTargetOptions=");