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

Function buildBrowser

tools/build_browser.js:57–89  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

55}
56
57async function buildBrowser(options) {
58 let languages = await getLanguages();
59 // filter languages for inclusion in the highlight.js bundle
60 languages = filter(languages, options.languages);
61
62 await installDocs();
63 await installDemo(languages, { minify: options.minify });
64
65 log("Preparing languages.");
66 await Promise.all(
67 languages.map(async(lang) => {
68 // await lang.compile({ terser: config.terser });
69 process.stdout.write(".");
70 })
71 );
72 log("");
73
74 detailedGrammarSizes(languages);
75
76 const size = await buildCore("highlight", languages, { minify: options.minify, format: "cjs" });
77
78 log("-----");
79 log("Languages (raw) :",
80 languages.map((el) => el.data.length).reduce((acc, curr) => acc + curr, 0), "bytes");
81 log("highlight.js :", size.fullSize, "bytes");
82 if (options.minify) {
83 log("highlight.min.js :", size.minified, "bytes");
84 log("highlight.min.js.gz :", zlib.gzipSync(size.minifiedSrc).length, "bytes");
85 } else {
86 log("highlight.js.gz :", zlib.gzipSync(size.fullSrc).length, "bytes");
87 }
88 log("-----");
89}
90
91async function installDemo(languages, { minify }) {
92 log("Writing demo files.");

Callers

nothing calls this directly

Calls 7

getLanguagesFunction · 0.85
filterFunction · 0.85
installDocsFunction · 0.85
installDemoFunction · 0.85
detailedGrammarSizesFunction · 0.85
buildCoreFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…