MCPcopy
hub / github.com/highlightjs/highlight.js / builtInLanguagesPlugin

Function builtInLanguagesPlugin

tools/build_browser.js:183–200  ·  view source on GitHub ↗
(languages)

Source from the content-addressed store, hash-verified

181}
182
183const builtInLanguagesPlugin = (languages) => ({
184 name: "hljs-index",
185 resolveId(source) {
186 if (source === "builtInLanguages") {
187 return source; // this signals that rollup should not ask other plugins or check the file system to find this id
188 }
189 return null; // other ids should be handled as usually
190 },
191 load(id) {
192 const escape = (s) => "grmr_" + s.replace("-", "_");
193 if (id === "builtInLanguages") {
194 return languages.map((lang) =>
195 `export { default as ${escape(lang.name)} } from ${JSON.stringify(lang.path)};`
196 ).join("\n");
197 }
198 return null;
199 }
200});
201
202async function buildCore(name, languages, options) {
203 const header = buildHeader();

Callers 1

buildCoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…