import fs from "node:fs/promises"; import { createRequire } from "node:module"; import type { ThemeRegistrationResolved } from "@pierre/diffs"; import { RegisteredCustomThemes, ResolvedThemes, ResolvingThemes } from "@pierre/diffs";
export function ensurePierreThemesRegistered(): void {
let replacedThemeLoader = false;
for (const [themeName, loader] of PIERRE_THEME_LOADERS) { if (RegisteredCustomThemes.get(themeName) !== loader) {
RegisteredCustomThemes.set(themeName, loader);
replacedThemeLoader = true;
}
}
if (!replacedThemeLoader) { return;
}
// If another path swapped these loaders, clear the resolver caches so the // next render rehydrates the highlighter with the Node-safe theme source. for (const [themeName] of PIERRE_THEME_LOADERS) {
ResolvedThemes.delete(themeName);
ResolvingThemes.delete(themeName);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.