You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 rivejä
773 B

  1. 'use strict';
  2. module.exports = function reporter(middlewareOptions, options) {
  3. const { log, state, stats } = options;
  4. if (state) {
  5. const displayStats = (middlewareOptions.stats !== false);
  6. if (displayStats) {
  7. if (stats.hasErrors()) {
  8. log.error(stats.toString(middlewareOptions.stats));
  9. } else if (stats.hasWarnings()) {
  10. log.warn(stats.toString(middlewareOptions.stats));
  11. } else {
  12. log.info(stats.toString(middlewareOptions.stats));
  13. }
  14. }
  15. let message = 'Compiled successfully.';
  16. if (stats.hasErrors()) {
  17. message = 'Failed to compile.';
  18. } else if (stats.hasWarnings()) {
  19. message = 'Compiled with warnings.';
  20. }
  21. log.info(message);
  22. } else {
  23. log.info('Compiling...');
  24. }
  25. };