UNPKG

mc-benchmark

Version:

Build charts about load time of Minecraft modpack.

18 lines 791 B
import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import Handlebars from 'handlebars'; import helpers from './helpers.hbs.js'; export async function compose(data, log, nondefaultTemplate) { await log.begin('Loading Handlebars template'); const templatePath = nondefaultTemplate || path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'template.hbs'); const templateRaw = fs.readFileSync(templatePath, 'utf-8'); await log.info('Compiling template'); const template = Handlebars.compile(templateRaw); for (const [name, fnc] of Object.entries(helpers)) { Handlebars.registerHelper(name, fnc); } await log.info('Applying data to template'); return template(data); } //# sourceMappingURL=hbs.js.map