[
  {
    "path": ".editorconfig",
    "content": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_size = 2\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.{json,yml,md}]\nindent_style = space\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\n.DS_Store\n*.lock\n*.log\n"
  },
  {
    "path": "index.js",
    "content": "const colors = require('kleur');\nconst cClear = require('console-clear');\nconst format = require('webpack-format-messages');\n\nconst NAME = 'webpack-messages';\nconst log = str => console.log(str);\nconst clear = _ => (cClear(true),true);\n\nclass WebpackMessages {\n\tconstructor(opts) {\n\t\topts = opts || {};\n\t\tthis.name = opts.name;\n\t\tthis.onDone = opts.onComplete;\n\t\tthis.logger = opts.logger || log;\n\t}\n\n\tprintError(str, arr) {\n\t\tarr && (str += '\\n\\n' + arr.join(''));\n\t\tclear() && this.logger(str);\n\t}\n\n\tapply(compiler) {\n\t\tconst name = this.name ? ` ${colors.cyan(this.name)} bundle` : '';\n\t\tconst onStart = _ => this.logger(`Building${name}...`);\n\n\t\tconst onComplete = stats => {\n\t\t\tconst messages = format(stats);\n\n\t\t\tif (messages.errors.length) {\n\t\t\t\treturn this.printError( colors.red(`Failed to compile${name}!`), messages.errors );\n\t\t\t}\n\n\t\t\tif (messages.warnings.length) {\n\t\t\t\treturn this.printError( colors.yellow(`Compiled${name} with warnings.`), messages.warnings );\n\t\t\t}\n\n\t\t\tif (this.onDone !== undefined) {\n\t\t\t\tthis.onDone(name, stats);\n\t\t\t} else {\n\t\t\t\tconst sec = (stats.endTime - stats.startTime) / 1e3;\n\t\t\t\tthis.logger( colors.green(`Completed${name} in ${sec}s!`) );\n\t\t\t}\n\t\t};\n\n\t\tif (compiler.hooks !== void 0) {\n\t\t\tcompiler.hooks.compile.tap(NAME, onStart);\n\t\t\tcompiler.hooks.invalid.tap(NAME, _ => clear() && onStart());\n\t\t\tcompiler.hooks.done.tap(NAME, onComplete);\n\t\t} else {\n\t\t\tcompiler.plugin('compile', onStart);\n\t\t\tcompiler.plugin('invalid', _ => clear() && onStart());\n\t\t\tcompiler.plugin('done', onComplete);\n\t\t}\n\t}\n}\n\nmodule.exports = WebpackMessages;\n"
  },
  {
    "path": "license",
    "content": "MIT License\n\nCopyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"webpack-messages\",\n  \"version\": \"2.0.4\",\n  \"description\": \"Beautifully format Webpack messages throughout your bundle lifecycle(s)!\",\n  \"repository\": \"lukeed/webpack-messages\",\n  \"license\": \"MIT\",\n  \"author\": {\n    \"name\": \"Luke Edwards\",\n    \"email\": \"luke.edwards05@gmail.com\",\n    \"url\": \"lukeed.com\"\n  },\n  \"engines\": {\n    \"node\": \">=6\"\n  },\n  \"files\": [\n    \"index.js\"\n  ],\n  \"keywords\": [\n    \"bundle\",\n    \"webpack\",\n    \"create-react-app\",\n    \"webpack-plugin\",\n    \"formatting\",\n    \"messages\",\n    \"console\",\n    \"pretty\",\n    \"format\",\n    \"output\",\n    \"stats\"\n  ],\n  \"dependencies\": {\n    \"console-clear\": \"^1.0.0\",\n    \"kleur\": \"^3.0.0\",\n    \"webpack-format-messages\": \"^2.0.0\"\n  }\n}\n"
  },
  {
    "path": "readme.md",
    "content": "# webpack-messages\n\n> Beautifully format Webpack messages throughout your bundle lifecycle(s)!\n\n\n***Default***\n\n<img src=\"shots/default.jpg\" width=\"300\" />\n\n***Default Error***\n\n<img src=\"shots/error_default.jpg\" width=\"300\" />\n\n***Named Bundles***\n\n<img src=\"shots/named.jpg\" width=\"300\" />\n\n***Named Bundle Error***\n\n<img src=\"shots/error_named.jpg\" width=\"300\" />\n\n***Custom Logger***\n\n<img src=\"shots/logger.jpg\" width=\"300\" />\n\n***Named Bundle Error w/ Custom Logger***\n\n<img src=\"shots/error_named_logger.jpg\" width=\"300\" />\n\n\n## Install\n\n```\n$ npm install webpack-messages --save-dev\n```\n\n\n## Usage\n\n```js\n// webpack.config.js\nconst WebpackMessages = require('webpack-messages');\n\nmodule.exports = {\n  // ...\n  plugins: [\n    new WebpackMessages({\n      name: 'client',\n      logger: str => console.log(`>> ${str}`)\n    })\n  ]\n}\n```\n\n\n## API\n\n### WebpackMessages(options)\n\n#### options.name\n\nType: `String`\n\nOptionally provide a name for your bundle. Strongly recommended when compiling multiple bundles!\n\n#### options.logger\n\nType: `Function`<br>\nDefault: `str => console.log(str)`\n\nReplace the default function -- ideal for prepending a symbol or namespace to your messages.\n\nFunction receives a (colorized) message `string` as its only parameter.\n\n#### options.onComplete\n\nType: `Function`\n\nRun a custom function once a bundle has been compiled successfully. If provided, the default success handler will not run.\n\nFunction receives a formatted `name` string (or `''`) and the Webpack [`stats`](https://github.com/webpack/docs/wiki/node.js-api#stats) object.\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n"
  }
]