Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(stats, config, logger) => {
// config.stats contains our own stats settings, added during buildWebpackConfig().
const json = stats.toJson(config.stats);
if (verbose) {
logger.info(stats.toString(config.stats));
} else {
logger.info(statsToString(json, config.stats));
}
if (stats.hasWarnings()) {
logger.warn(statsWarningsToString(json, config.stats));
}
if (stats.hasErrors()) {
logger.error(statsErrorsToString(json, config.stats));
}
};
const statsConfig = getWebpackStatsConfig(verbose);
statsConfig.colors = supportsColor.stdout;
const statsTitle = 'Child: ' + stats.compilation.name + (verbose ? '\n' : '');
if (verbose) {
const jsonString = stats.toString(statsConfig)
.split('\n')
.map(line => ' ' + line)
.join('\n');
this.context.logger.info(statsTitle + jsonString);
} else {
const json = stats.toJson(statsConfig);
const jsonString = statsToString(json, statsConfig)
.split('\n')
.map(line => ' ' + line)
.join('\n');
this.context.logger.info(statsTitle + jsonString);
if (stats.hasWarnings()) {
this.context.logger.warn(statsWarningsToString(json, statsConfig));
}
if (stats.hasErrors()) {
this.context.logger.error(statsErrorsToString(json, statsConfig));
}
}
}
}
}
return statsJson;
};
const configName = stats.compilation.compiler.name;
let statsTitle = '';
if (configName) {
statsTitle = 'Name: '
+ (options.colors ? terminal.bold(configName) : configName)
+ (options.verbose ? '\n' : '');
}
const statsString = options.verbose
? stats.toString(statsToOptions)
: statsToString(getStatsJson(), statsToOptions);
logger.info(statsTitle + statsString);
if (!options.verbose) {
if (stats.hasWarnings()) {
logger.warn(statsWarningsToString(getStatsJson(), statsToOptions));
}
if (stats.hasErrors()) {
logger.error(statsErrorsToString(getStatsJson(), statsToOptions));
}
}
logger.info('');
};
}
return statsJson;
};
const configName = stats.compilation.compiler.name;
let statsTitle = '';
if (configName) {
statsTitle = 'Name: '
+ (options.colors ? terminal.bold(configName) : configName)
+ (options.verbose ? '\n' : '');
}
const statsString = options.verbose
? stats.toString(statsToOptions)
: statsToString(getStatsJson(), statsToOptions);
logger.info(statsTitle + statsString);
if (!options.verbose) {
if (stats.hasWarnings()) {
logger.warn(statsWarningsToString(getStatsJson(), statsToOptions));
}
if (stats.hasErrors()) {
logger.error(statsErrorsToString(getStatsJson(), statsToOptions));
}
}
logger.info('');
};