(options)
| 148 | ]; |
| 149 | |
| 150 | async function buildNode(options) { |
| 151 | mkdir("lib/languages"); |
| 152 | mkdir("scss/base16"); |
| 153 | mkdir("styles/base16"); |
| 154 | mkdir("types"); |
| 155 | |
| 156 | |
| 157 | CORE_FILES.forEach(file => { |
| 158 | install(`./${file}`, file); |
| 159 | }); |
| 160 | install("./src/core.d.ts", "lib/core.d.ts"); |
| 161 | install("./src/core.d.ts", "lib/common.d.ts"); |
| 162 | |
| 163 | if (options.esm) { |
| 164 | mkdir("es/languages"); |
| 165 | install("./src/core.d.ts", "es/core.d.ts"); |
| 166 | install("./src/core.d.ts", "es/common.d.ts"); |
| 167 | } |
| 168 | |
| 169 | log("Writing styles."); |
| 170 | // const styles = await fs.readdir("./src/styles/"); |
| 171 | glob.sync("**", { cwd: "./src/styles" }).forEach((file) => { |
| 172 | const stat = fss.statSync(`./src/styles/${file}`); |
| 173 | if (stat.isDirectory()) return; |
| 174 | |
| 175 | if (file.endsWith(".css")) { |
| 176 | installCleanCSS(`./src/styles/${file}`, `styles/${file}`, { minify: false }); |
| 177 | installCleanCSS(`./src/styles/${file}`, `styles/${file.replace(".css", ".min.css")}`, { minify: true }); |
| 178 | installCleanCSS(`./src/styles/${file}`, `scss/${file.replace(".css", ".scss")}`, { minify: false }); |
| 179 | } else { |
| 180 | // images, etc. |
| 181 | install(`./src/styles/${file}`, `styles/${file}`); |
| 182 | } |
| 183 | }); |
| 184 | |
| 185 | let languages = await getLanguages(); |
| 186 | // filter languages for inclusion in the highlight.js bundle |
| 187 | languages = filter(languages, options.languages); |
| 188 | const common = languages.filter(l => l.categories.includes("common")); |
| 189 | |
| 190 | log("Writing package.json."); |
| 191 | await writePackageJSON(buildPackageJSON(options)); |
| 192 | |
| 193 | if (options.esm) { |
| 194 | await fs.writeFile(`${process.env.BUILD_DIR}/es/package.json`, `{ "type": "module" }`); |
| 195 | await buildESMStub("index"); |
| 196 | await buildESMStub("common"); |
| 197 | await buildESMUtils(); |
| 198 | } |
| 199 | await buildCJSIndex("index", languages); |
| 200 | await buildCJSIndex("common", common); |
| 201 | await buildLanguages(languages, options); |
| 202 | |
| 203 | log("Writing highlight.js"); |
| 204 | await buildNodeHighlightJS(options); |
| 205 | } |
| 206 | |
| 207 | module.exports.build = buildNode; |
nothing calls this directly
no test coverage detected
searching dependent graphs…