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

Function buildCJSIndex

tools/build_node.js:21–35  ·  view source on GitHub ↗
(name, languages)

Source from the content-addressed store, hash-verified

19}
20
21async function buildCJSIndex(name, languages) {
22 const header = "var hljs = require('./core');";
23 const footer =
24 `hljs.HighlightJS = hljs\n`
25 + `hljs.default = hljs\n`
26 + `module.exports = hljs;`;
27
28 const registration = languages.map((lang) => {
29 const require = `require('./languages/${lang.name}')`;
30 return `hljs.registerLanguage('${lang.name}', ${require});`;
31 });
32
33 const index = `${header}\n\n${registration.join("\n")}\n\n${footer}`;
34 await fs.writeFile(`${process.env.BUILD_DIR}/lib/${name}.js`, index);
35}
36
37async function buildNodeLanguage(language, options) {
38 const EMIT = `function emitWarning() {

Callers 1

buildNodeFunction · 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…