lazy load templates

This commit is contained in:
Yanis Benson 2019-07-22 03:47:32 +03:00
parent 09e5a22cb7
commit b21018deae

View file

@ -1,7 +1,6 @@
'use strict'; 'use strict';
const ansiStyles = require('ansi-styles'); const ansiStyles = require('ansi-styles');
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color'); const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
const template = require('./templates');
const { const {
stringReplaceAll, stringReplaceAll,
stringEncaseCRLFWithFirstIndex stringEncaseCRLFWithFirstIndex
@ -185,6 +184,7 @@ const applyStyle = (self, string) => {
return openAll + string + closeAll; return openAll + string + closeAll;
}; };
let template;
const chalkTag = (chalk, ...strings) => { const chalkTag = (chalk, ...strings) => {
const [firstString] = strings; const [firstString] = strings;
@ -204,6 +204,9 @@ const chalkTag = (chalk, ...strings) => {
); );
} }
if (template === undefined) {
template = require('./templates');
}
return template(chalk, parts.join('')); return template(chalk, parts.join(''));
}; };