From d30ea25629a787c010401d07a646d124e91ecd7e Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Mon, 16 Nov 2020 09:55:24 -0700 Subject: [PATCH] feat(deps): benchpressjs@2.2.1 (#8887) Better warnings, faster template compiles --- install/web.js | 2 +- src/emailer.js | 4 +--- src/meta/templates.js | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/install/web.js b/install/web.js index 715b90a766..6589d8bc5a 100644 --- a/install/web.js +++ b/install/web.js @@ -240,7 +240,7 @@ async function compileTemplate() { const source = await fs.promises.readFile(sourceFile, 'utf8'); const [compiled] = await Promise.all([ - Benchpress.precompile(source), + Benchpress.precompile(source, { filename: 'install/index.tpl' }), mkdirp(path.dirname(destJs)), ]); diff --git a/src/emailer.js b/src/emailer.js index ac8abc9a14..9a5d67e07d 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -81,9 +81,7 @@ const buildCustomTemplates = async (config) => { await Promise.all(templatesToBuild.map(async (template) => { const source = await meta.templates.processImports(paths, template.path, template.text); - const compiled = await Benchpress.precompile(source, { - minify: global.env !== 'development', - }); + const compiled = await Benchpress.precompile(source, { filename: template.path }); await fs.promises.writeFile(template.fullpath.replace(/\.tpl$/, '.js'), compiled); })); diff --git a/src/meta/templates.js b/src/meta/templates.js index 16f7f23119..3ec9e03930 100644 --- a/src/meta/templates.js +++ b/src/meta/templates.js @@ -111,9 +111,7 @@ async function compileTemplate(filename, source) { })); source = await processImports(paths, filename, source); - const compiled = await Benchpress.precompile(source, { - minify: process.env.NODE_ENV !== 'development', - }); + const compiled = await Benchpress.precompile(source, { filename }); return await fs.promises.writeFile(path.join(viewsPath, filename.replace(/\.tpl$/, '.js')), compiled); } Templates.compileTemplate = compileTemplate; @@ -136,7 +134,7 @@ async function compile() { await mkdirp(path.join(viewsPath, path.dirname(name))); await fs.promises.writeFile(path.join(viewsPath, name), imported); - const compiled = await Benchpress.precompile(imported, { minify: process.env.NODE_ENV !== 'development' }); + const compiled = await Benchpress.precompile(imported, { filename: name }); await fs.promises.writeFile(path.join(viewsPath, name.replace(/\.tpl$/, '.js')), compiled); }));