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

Function buildCDNLanguage

tools/build_cdn.js:165–178  ·  view source on GitHub ↗
(language, options)

Source from the content-addressed store, hash-verified

163}
164
165async function buildCDNLanguage(language, options) {
166 const name = `languages/${language.name}${options.minify ? '.min' : ''}.js`;
167 await language.compile({ terser: config.terser });
168
169 const source = options.minify ? language.minified : language.module;
170 shas[name] = bundling.sha384(source);
171 await fs.writeFile(`${process.env.BUILD_DIR}/${name}`, source);
172
173 if (options.esm) {
174 const sourceESM = options.minify ? language.minifiedESM : language.esm;
175 shas[`es/${name}`] = bundling.sha384(sourceESM);
176 await fs.writeFile(`${process.env.BUILD_DIR}/es/${name}`, sourceESM);
177 }
178}
179
180module.exports.build = buildCDN;
181

Callers 1

installLanguagesFunction · 0.85

Calls 1

compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…