(language, options)
| 35 | } |
| 36 | |
| 37 | async function buildNodeLanguage(language, options) { |
| 38 | const EMIT = `function emitWarning() { |
| 39 | if (!emitWarning.warned) { |
| 40 | emitWarning.warned = true; |
| 41 | console.log( |
| 42 | 'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/%%%%" instead of "highlight.js/lib/languages/%%%%.js"' |
| 43 | ); |
| 44 | } |
| 45 | } |
| 46 | emitWarning();`; |
| 47 | const CJS_STUB = `${EMIT} |
| 48 | module.exports = require('./%%%%.js');`; |
| 49 | const ES_STUB = `${EMIT} |
| 50 | import lang from './%%%%.js'; |
| 51 | export default lang;`; |
| 52 | const input = { ...config.rollup.core.input, input: language.path }; |
| 53 | const output = { ...config.rollup.node.output, file: `${process.env.BUILD_DIR}/lib/languages/${language.name}.js` }; |
| 54 | await rollupWrite(input, output); |
| 55 | await fs.writeFile(`${process.env.BUILD_DIR}/lib/languages/${language.name}.js.js`, |
| 56 | CJS_STUB.replace(/%%%%/g, language.name)); |
| 57 | if (options.esm) { |
| 58 | await fs.writeFile(`${process.env.BUILD_DIR}/es/languages/${language.name}.js.js`, |
| 59 | ES_STUB.replace(/%%%%/g, language.name)); |
| 60 | await rollupWrite(input, { |
| 61 | ...output, |
| 62 | format: "es", |
| 63 | file: output.file.replace("/lib/", "/es/") |
| 64 | }); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | const EXCLUDE = ["join"]; |
| 69 |
no test coverage detected
searching dependent graphs…