[
  {
    "path": ".babelrc",
    "content": "{\r\n    \"presets\": [\"env\"],\r\n    \"plugins\": [\r\n        \"transform-runtime\"\r\n    ]\r\n}"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\r\nnode_modules\r\n*.log\r\nexample/dist"
  },
  {
    "path": ".npmignore",
    "content": "test\r\nexample\r\nyarn.lock\r\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\r\nnode_js:\r\n  - \"8\""
  },
  {
    "path": "CHANGELOG.md",
    "content": "<a name=\"0.9.0\"></a>\n# 0.9.0 (2018-05-09)\n\n\n### Bug Fixes\n\n* fix bug 'loaderContext is not defined' ([a03dacf](https://github.com/TaroXin/vue-pretty-logger/commit/a03dacf))\n* fix bug: Cannot read property 'content' of null. ([6956668](https://github.com/TaroXin/vue-pretty-logger/commit/6956668)), closes [#1](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add await statement comment compiler ([469294f](https://github.com/TaroXin/vue-pretty-logger/commit/469294f)), closes [#3](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add function callback and lambda callback comment compiler ([d8eaa9e](https://github.com/TaroXin/vue-pretty-logger/commit/d8eaa9e)), closes [#2](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n* add support for js files ([fe36184](https://github.com/TaroXin/vue-pretty-logger/commit/fe36184)), closes [#8](https://github.com/TaroXin/vue-pretty-logger/issues/8)\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -from command to output function call parameters ([851512e](https://github.com/TaroXin/vue-pretty-logger/commit/851512e)), closes [#5](https://github.com/TaroXin/vue-pretty-logger/issues/5)\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add support for js files\n* add function logger\n* add await statement comment compiler\n* add function callback and lambda callback comment compiler\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add the -from command to output function call parameters\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add -stop command to stop default actions\n\n\n\n<a name=\"0.9.0\"></a>\n# 0.9.0 (2018-05-09)\n\n\n### Bug Fixes\n\n* fix bug: Cannot read property 'content' of null. ([6956668](https://github.com/TaroXin/vue-pretty-logger/commit/6956668)), closes [#1](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add await statement comment compiler ([469294f](https://github.com/TaroXin/vue-pretty-logger/commit/469294f)), closes [#3](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add function callback and lambda callback comment compiler ([d8eaa9e](https://github.com/TaroXin/vue-pretty-logger/commit/d8eaa9e)), closes [#2](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n* add support for js files ([fe36184](https://github.com/TaroXin/vue-pretty-logger/commit/fe36184)), closes [#8](https://github.com/TaroXin/vue-pretty-logger/issues/8)\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -from command to output function call parameters ([851512e](https://github.com/TaroXin/vue-pretty-logger/commit/851512e)), closes [#5](https://github.com/TaroXin/vue-pretty-logger/issues/5)\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add support for js files\n* add function logger\n* add await statement comment compiler\n* add function callback and lambda callback comment compiler\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add the -from command to output function call parameters\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add -stop command to stop default actions\n\n\n\n<a name=\"0.8.9\"></a>\n## 0.8.9 (2018-05-09)\n\n\n### Bug Fixes\n\n* fix bug: Cannot read property 'content' of null. ([6956668](https://github.com/TaroXin/vue-pretty-logger/commit/6956668)), closes [#1](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add await statement comment compiler ([469294f](https://github.com/TaroXin/vue-pretty-logger/commit/469294f)), closes [#3](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add function callback and lambda callback comment compiler ([d8eaa9e](https://github.com/TaroXin/vue-pretty-logger/commit/d8eaa9e)), closes [#2](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n* add support for js files ([fe36184](https://github.com/TaroXin/vue-pretty-logger/commit/fe36184)), closes [#8](https://github.com/TaroXin/vue-pretty-logger/issues/8)\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -from command to output function call parameters ([851512e](https://github.com/TaroXin/vue-pretty-logger/commit/851512e)), closes [#5](https://github.com/TaroXin/vue-pretty-logger/issues/5)\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add support for js files\n* add function logger\n* add await statement comment compiler\n* add function callback and lambda callback comment compiler\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add the -from command to output function call parameters\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add -stop command to stop default actions\n\n\n\n<a name=\"0.8.9\"></a>\n## 0.8.9 (2018-05-09)\n\n\n### Bug Fixes\n\n* fix bug: Cannot read property 'content' of null. ([6956668](https://github.com/TaroXin/vue-pretty-logger/commit/6956668)), closes [#1](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add await statement comment compiler ([469294f](https://github.com/TaroXin/vue-pretty-logger/commit/469294f)), closes [#3](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add function callback and lambda callback comment compiler ([d8eaa9e](https://github.com/TaroXin/vue-pretty-logger/commit/d8eaa9e)), closes [#2](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -from command to output function call parameters ([851512e](https://github.com/TaroXin/vue-pretty-logger/commit/851512e)), closes [#5](https://github.com/TaroXin/vue-pretty-logger/issues/5)\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add the -from command to output function call parameters\n* add function logger\n* add function callback and lambda callback comment compiler\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add await statement comment compiler\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add -stop command to stop default actions\n\n\n\n<a name=\"0.8.7\"></a>\n## 0.8.7 (2018-05-09)\n\n\n### Bug Fixes\n\n* fix bug: Cannot read property 'content' of null. ([6956668](https://github.com/TaroXin/vue-pretty-logger/commit/6956668)), closes [#1](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add await statement comment compiler ([469294f](https://github.com/TaroXin/vue-pretty-logger/commit/469294f)), closes [#3](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add function callback and lambda callback comment compiler ([d8eaa9e](https://github.com/TaroXin/vue-pretty-logger/commit/d8eaa9e)), closes [#2](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add await statement comment compiler\n* add function callback and lambda callback comment compiler\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add -stop command to stop default actions\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.8.7\"></a>\n## 0.8.7 (2018-05-08)\n\n\n### Bug Fixes\n\n* fix bug: Cannot read property 'content' of null. ([6956668](https://github.com/TaroXin/vue-pretty-logger/commit/6956668)), closes [#1](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add await statement comment compiler ([469294f](https://github.com/TaroXin/vue-pretty-logger/commit/469294f)), closes [#3](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add function callback and lambda callback comment compiler ([d8eaa9e](https://github.com/TaroXin/vue-pretty-logger/commit/d8eaa9e)), closes [#2](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add await statement comment compiler\n* add function callback and lambda callback comment compiler\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add -stop command to stop default actions\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.8.3\"></a>\n## 0.8.3 (2018-05-06)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n* add the judgment of the NODE_ENV ([c61b081](https://github.com/TaroXin/vue-pretty-logger/commit/c61b081))\n* add the option of the log hook ([2914afc](https://github.com/TaroXin/vue-pretty-logger/commit/2914afc))\n\n\n### BREAKING CHANGES\n\n* add the option of the log hook\n* add the judgment of the NODE_ENV\n* add -stop command to stop default actions\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.8.0\"></a>\n# 0.8.0 (2018-05-06)\n\n\n### Features\n\n* add -stop to stop default actions ([230bfc1](https://github.com/TaroXin/vue-pretty-logger/commit/230bfc1))\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n\n\n### BREAKING CHANGES\n\n* add -stop command to stop default actions\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.7.0\"></a>\n# 0.7.0 (2018-05-06)\n\n\n### Features\n\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n\n\n### BREAKING CHANGES\n\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.7.0\"></a>\n# 0.7.0 (2018-05-06)\n\n\n### Features\n\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add the -count command to display the number of the function calls ([d659577](https://github.com/TaroXin/vue-pretty-logger/commit/d659577))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n* add the -time -profile command ([ef38e85](https://github.com/TaroXin/vue-pretty-logger/commit/ef38e85))\n\n\n### BREAKING CHANGES\n\n* add -time -profile command\n* add -count command\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.5.2\"></a>\n## 0.5.2 (2018-05-06)\n\n\n### Features\n\n* add command that control the currently displayed tag ([46dd72b](https://github.com/TaroXin/vue-pretty-logger/commit/46dd72b))\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n* add the -sign command to display the corresponding key value of the output value ([a3378a3](https://github.com/TaroXin/vue-pretty-logger/commit/a3378a3))\n\n\n### BREAKING CHANGES\n\n* add -sign command\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.4.0\"></a>\n# 0.4.0 (2018-05-05)\n\n\n### Features\n\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n\n\n### BREAKING CHANGES\n\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.3.0\"></a>\n# 0.3.0 (2018-05-05)\n\n\n### Features\n\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n* add control of the log output type ([509cea6](https://github.com/TaroXin/vue-pretty-logger/commit/509cea6))\n\n\n### BREAKING CHANGES\n\n* add control of the log output type\n* add function logger\n\n\n\n<a name=\"0.3.0\"></a>\n# 0.3.0 (2018-05-04)\n\n\n### Features\n\n* add console for function declarations and call ([d6905e1](https://github.com/TaroXin/vue-pretty-logger/commit/d6905e1))\n\n\n### BREAKING CHANGES\n\n* add function logger\n\n\n\n<a name=\"0.0.1\"></a>\n## 0.0.1 (2018-05-04)\n\n\n\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018 杨鑫\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# vue-pretty-logger\n\n[![Scrutinizer Build](https://img.shields.io/npm/v/vue-pretty-logger.svg?style=for-the-badge)](https://www.npmjs.com/package/vue-pretty-logger) [![Scrutinizer Build](https://img.shields.io/scrutinizer/build/g/filp/whoops.svg?style=for-the-badge)](https://travis-ci.org/TaroXin/vue-pretty-logger) [![npm](https://img.shields.io/npm/l/express.svg?style=for-the-badge)\n](https://opensource.org/licenses/mit-license.php)\n\n\n[README for Chinese](https://juejin.im/post/5aef271c51882506a36c69a7)\n### Table of content\n\n* [Introduce](#introduce)\n* [Install](#install)\n* [Usage](#usage)\n* [Example](#example)\n* [Options](#options)\n* [Commands](#commands)\n* [Change Log](#changeLog)\n\n<span id=\"introduce\"></span>\n### What is Vue pretty logger loader ?\n`vue-pretty-logger` is a loader for webpack, you can use it  in your .vue file\n\n``` vue\n<template>\n  <div>This is Test Message</div>\n</template>\n\n<script>\n  export default {\n    mounted () {\n      let a = 123 // {#}\n\n      let str = 'Test' // {#}\n    }\n  }\n</script>\n```\n\n### You don't know what to do?\n\n``` javascript\n/**\n * // {#} is hook\n * So the result is the console prints 123.\n * Did you feel cool?\n */\nlet a = 123 // {#}\n```\n\n<span id=\"install\"></span>\n### Install\n\n``` javascript\nnpm install vue-pretty-logger -D\n// or\nyarn add --dev vue-pretty-logger\n```\n **in your webpack config file** \n> **NOTE:** `vue-pretty-logger` must be executed prior to `vue-loader`, Putting it at the bottom of the list of loaders is the best choice\n``` javascript\n...\nmodule: {\n  rules: [\n    {\n      test: /\\.vue$/,\n      use: [\n        {\n          loader: 'vue-loader'\n        },\n        {\n          loader: 'vue-pretty-logger',\n          options: {\n            ...\n          }\n        }\n      ]\n    }\n  ]\n}\n...\n```\n\n<span id=\"usage\"></span>\n### Usage\n\n**in your vue file**\n``` vue\n<template>\n  <div>Cool console</div>\n</template>\n\n<script>\n  export default {\n    mounted () {\n      let a = 123 // {#}\n      // equals: console.log(a)\n\n      a = 456 // {#}\n      // equals: console.log(a)\n    \n      this.testFunc1()\n\n      this.testFunc2('test') // {#}\n      /**\n        * equals:\n        * const result = this.testFunc2('test')\n        * console.log(result)\n        */\n    },\n\n    methods: {\n      testFunc1 (a, b) { // {#}\n        // equals: console.log(a, b)\n      },\n\n      testFunc2 (a) {\n        return a\n      }\n    }\n  }\n</script>\n```\n\n<span id=\"example\"></span>\n### Example\nExample can be found in `example/`\n\n<span id=\"options\"></span>\n### Options\n\n* **tag**\n`Globally specified log display tag`\n`default: ''`\n* **hook**\n`Globally specified log Hook`\n`default: '#'`\n* **infoTag**\n`Globally specified log info tag`\n`default: 'INFO'`\n* **infoTagStyle**\n`Globally specified log info tag style`\n`default: ''`\n* **error, debug, warn are the same as info**\n \n<span id=\"commands\"></span>\n### Commands\n\n* **-e**\n`Output as error`\n* **-d**\n`Output as debug`\n* **-w**\n`Output as warn`\n* **-i**\n`Output as info`\n* **-t**\n`Specify local log comment tag`\n* **-sign**\n`The variable name corresponding to the output value when outputting the value`\n* **-count**\n`Number of times the output function was called`\n`Only valid at function declaration`\n* **-time**\n`Output function execution time-consunming`\n`Only valid at function call`\n* **-profile**\n`Create a profile for your function`\n`Only valid at function call`\n* **-stop**\n`Stop default actions`\n\n<span id=\"changeLog\"></span>\n### Change Log\n* `V0.9.0` [issues](https://github.com/TaroXin/vue-pretty-logger/issues/8)\n``` javascript\n// add support for js files\n\n{\n    test: /\\.js$/,\n    use: ['babel-loader', 'vue-pretty-logger/lib/in-js'],\n    exclude: /node_modules/\n}\n```\n\n* `V0.8.8` [issues](https://github.com/TaroXin/vue-pretty-logger/issues/5)\n``` javascript\n// add the -form command\n\nthis.testFuncCall(p1, p2) // {#} -sign -from\n\n// equals:\nconsole.log(`p1: ${p1}, p2: ${p2}`)\nconst result = this.testFuncCall(p1, p2)\nconsole.log(`result: ${result}`)\n```\n\n* `V0.8.7` [issues](https://github.com/TaroXin/vue-pretty-logger/issues/3)\n``` javascript\n// Add support for await statements, consistent with function call\n\nawait test() // {#} -e -sign -time\n// equals: const result = await test(); console.error(`result: ${result}`)\n```\n\n* `V0.8.6` [issues](https://github.com/TaroXin/vue-pretty-logger/issues/2)\n``` javascript\n// Support callback function use, output callback function parameters.\n\nthis.$bus.$on('gotData', (data) => { // {#} -i -sign\n    // equals: console.info(`data: ${data}`)\n})\n\nthis.$bus.$on('gotData', function (data) { // {#} -i -sign\n    // equals: console.info(`data: ${data}`)\n})\n\n```\n\n* `V0.8.5` [issues](https://github.com/TaroXin/vue-pretty-logger/issues/1)\n```\nfix bug: Can not read property 'content' of null\n```\n\n"
  },
  {
    "path": "example/example.js",
    "content": "function Example (test) { // {#} -sign -w -t Example\r\n    let a = 123\r\n\r\n    testFunc(a) // {#} -sign -i -from -time -profile\r\n\r\n    testFuncCallback((val) => { // {#} -sign -d\r\n        // do something\r\n    })\r\n}\r\n\r\nfunction testFunc (form) {\r\n    return 'Return me!'\r\n}\r\n\r\nfunction testFuncCallback (cb) {\r\n    cb && cb('Callback return me')\r\n}\r\n\r\nexport default Example"
  },
  {
    "path": "example/index.html",
    "content": "<style>\r\n    html, body {\r\n        margin: 0; padding: 0;\r\n    }\r\n</style>\r\n<div id=\"app\"></div>\r\n<script src=\"/dist/bundle.js\"></script>"
  },
  {
    "path": "example/main.js",
    "content": "import Vue from 'vue'\r\nimport Foo from './source.vue'\r\nimport Example from './example.js'\r\n\r\nExample('I\\' a test str')\r\n\r\nnew Vue({\r\n    el: '#app',\r\n    render: h => h(Foo)\r\n})"
  },
  {
    "path": "example/source.vue",
    "content": "<template>\r\n    <div class=\"container\">\r\n        <header class=\"header\">Vue-Pretty-Logger</header>\r\n        <section class=\"section\">\r\n            The console is more cool to use, easier to debug, and more fun log output. Enjoy the vue-pretty-logger in the vue project.\r\n        </section>\r\n        <section class=\"section\">\r\n            npm install vue-pretty-logger -D\r\n            <br><br>\r\n            yarn add --dev vue-pretty-logger\r\n        </section>\r\n        <section class=\"section\">\r\n           Please press F12 !!!\r\n        </section>\r\n    </div>\r\n</template>\r\n\r\n<script>\r\n    export default {\r\n        data () {\r\n            return {\r\n                tes$tObj: {\r\n                    test (str1, func2) {\r\n                        func2(str1)\r\n                    }\r\n                }\r\n            }\r\n        },\r\n        mounted () {\r\n            // /**\r\n            //  * test assignment\r\n            //  */\r\n            let a = 123 // {#} -sign\r\n\r\n            // let b\r\n            // b = 456 // {#} -i -t TEST -sign\r\n\r\n            // /**\r\n            //  * test function declaration\r\n            //  */\r\n            // this.testFunc1(\"This is testFunc1\")\r\n            // this.testFunc2(\"This is testFunc2\", {\r\n            //     name: 'Yangxin',\r\n            //     age: '15'\r\n            // })\r\n\r\n            // /**\r\n            //  * test function call\r\n            //  */\r\n            // this.testFunc3() // {#} -w -sign\r\n            \r\n            // // no support for the time being\r\n            // // this.testFunc4(1, { // {#}\r\n            // //     count: 1\r\n            // // }) \r\n            // // recommend to use this like this\r\n            // this.testFunc4(1, {count: 1}) // {#}\r\n\r\n            // this.testFunc5('with -time') // {LOG} -time -sign\r\n\r\n            // this.testFunc6('with -profile') // {#} -stop -profile\r\n\r\n            // let str1 = 'Hello World' // {#}\r\n\r\n\r\n\r\n            // let str2 = 'Hello World' // {#} -e\r\n            // let str3 = 'Hello World' // {#} -d\r\n            // let str4 = 'Hello World' // {#} -w\r\n            // let str5 = 'Hello World' // {#} -i\r\n\r\n            // this.testFunc('Hello', 'World') // {#} -time -stop\r\n\r\n            // this.tes$tObj.test('Return me!', (val) => { // {#} -e -sign\r\n\r\n            // })\r\n            // this.testLambda$().test((val) => { // {#} -e\r\n\r\n            // }) \r\n\r\n            // this.testAsync()\r\n            // this.testFunc(\"p1\", \"p2\") \r\n\r\n            // this.testForm(\"hello\", \"world\") // {#} -from -sign -e\r\n        },\r\n\r\n        methods: {\r\n            testForm (p1, p2) { // {#} -sign\r\n                \r\n            },\r\n            testFunc1 (testStr) { // {#} -e\r\n                // console.log(testStr)\r\n            },\r\n            testFunc2 (testSrt1, testObject2) { // {#} -w -sign -count\r\n                // console.count('test')\r\n            },\r\n\r\n            testFunc3 () {\r\n                return 'Hello, I\\'m return!'\r\n            },\r\n\r\n            testFunc4 (num, data) {\r\n                return num + data.count\r\n            },\r\n\r\n            testFunc5 (command) {\r\n                \r\n            },\r\n            \r\n            testFunc6 (command) {\r\n\r\n            },\r\n\r\n            testFunc (p1, p2) { // {#} -i -t TestFunc -sign -count\r\n\r\n            },\r\n\r\n            testLambda$() {\r\n                return {\r\n                    test (func2) {\r\n                        func2('Return Me!')\r\n                    }\r\n                }\r\n            },\r\n\r\n            async testAsync (p) { // {#} -sign\r\n                async function test () { \r\n                    await test2() \r\n                }\r\n\r\n                function test2 () {\r\n                    return new Promise((resolve, reject) => {\r\n                        resolve('I am return')\r\n                    })\r\n                }\r\n\r\n                test().then((val) => {\r\n                    console.log(val)\r\n                })\r\n            }\r\n        }\r\n    }\r\n</script>\r\n\r\n\r\n<style scoped>\r\n    .container {\r\n        width: 100%;\r\n        height: 100%;\r\n        background: #e9e9e9;\r\n        font-family: 'Source Code Pro', 'Courier New', Courier, monospace \r\n    }\r\n    .header {\r\n        position: relative;\r\n        height: 150px;\r\n        text-align: center;\r\n        top: 100px;\r\n        font-size: 80px;\r\n        font-weight: bold;\r\n        color: #41B883;\r\n        user-select: none;\r\n        -webkit-user-select: none;\r\n    }\r\n\r\n    .section {\r\n        position: relative;\r\n        top: 60px;\r\n        width: 700px;\r\n        padding: 15px 25px;\r\n        box-sizing: border-box;\r\n        margin: 0 auto;\r\n        background: #333;\r\n        color: #FFF;\r\n        margin-bottom: 15px;\r\n    }\r\n</style>\r\n"
  },
  {
    "path": "example/webpack.config.js",
    "content": "const path = require('path')\r\nconst VueLoaderPlugin = require('vue-loader/lib/plugin.js')\r\n\r\nmodule.exports = {\r\n    mode: 'development',\r\n    entry: path.join(__dirname, './main.js'),\r\n    output: {\r\n        path: path.join(__dirname, 'dist'),\r\n        filename: 'bundle.js',\r\n        publicPath: '/dist/'\r\n    },\r\n    devServer: {\r\n        stats: 'minimal',\r\n        contentBase: __dirname\r\n    },\r\n    module: {\r\n        rules: [\r\n            {\r\n                test: /\\.vue$/,\r\n                use: [\r\n                    {\r\n                        loader: 'vue-loader'\r\n                    },\r\n                    {\r\n                        loader: path.join(__dirname, '../lib/index.js'),\r\n                        options: {\r\n                            tag: 'Pretty_Logger',\r\n                            hook: '#'\r\n                        }\r\n                    }\r\n                ]\r\n            },\r\n            {\r\n                test: /\\.css$/,\r\n                use: ['style-loader', 'css-loader']\r\n            },\r\n            {\r\n                test: /\\.js$/,\r\n                use: ['babel-loader', path.join(__dirname, '../lib/in-js.js')],\r\n                exclude: /node_modules/\r\n            }\r\n        ]\r\n    },\r\n    plugins: [\r\n        new VueLoaderPlugin()\r\n    ]\r\n}"
  },
  {
    "path": "index.js",
    "content": "const loader = require('./loader')\n\nmodule.exports = loader\n"
  },
  {
    "path": "lib/constant/logger-types.js",
    "content": "module.exports = {\n    FUNCTION: 'FUNCTION',\n    FUNCTION_CALL: 'FUNCTION_CALL',\n    ASSIGNMENT: 'ASSIGNMENT',\n    FUNCTION_CALLBACK: 'FUNCTION_CALLBACK'\n}\n"
  },
  {
    "path": "lib/constant/options.js",
    "content": "module.exports = {\r\n    tag: '',\r\n    dev: true,\r\n    hook: '#',\r\n    tagStyle: '',\r\n\r\n    infoTag: 'INFO',\r\n    infoTagStyle: 'color: #3838AD; font-weight: bold;',\r\n    infoContentStyle: 'color: #333333, font-weight: bold;',\r\n\r\n    warnTag: 'WARN',\r\n    warnTagStyle: 'color: #DA9D32; font-weight: bold;',\r\n    warnContentStyle: 'color: #333333, font-weight: bold;',\r\n\r\n    debugTag: 'DEBUG',\r\n    debugTagStyle: 'color: #22D015; font-weight: bold;',\r\n    debugContentStyle: 'color: #333333, font-weight: bold;',\r\n\r\n    errorTag: 'ERROR',\r\n    errorTagStyle: 'color: #CD2931; font-weight: bold;',\r\n    errorContentStyle: 'color: #333333, font-weight: bold;',\r\n}"
  },
  {
    "path": "lib/in-js.js",
    "content": "// Vue-pretty-logger-loader\r\nconst loaderUtils = require('loader-utils')\r\nconst compiler = require('vue-template-compiler')\r\nconst loggerParser = require('./utils/logger-parser')\r\nconst defaultOptions = require('./constant/options')\r\n\r\nmodule.exports = function (source, map) {\r\n    const loaderContext = this\r\n    loaderContext.cacheable && loaderContext.cacheable()\r\n\r\n    const {\r\n        resourcePath\r\n    } = loaderContext\r\n    \r\n    const isJsFile = /\\.js$/.test(resourcePath)\r\n\r\n    // default options\r\n    const options = Object.assign(\r\n        defaultOptions,\r\n        loaderUtils.getOptions(this)\r\n    )\r\n\r\n    // script has logger note ?\r\n    let isScriptHasLoggerLine = false\r\n\r\n    // get scripts\r\n    let scripts = ''\r\n    if (isJsFile) {\r\n        scripts = source\r\n    } else {\r\n        return source\r\n    }\r\n\r\n    let scriptArray = scripts.split(/\\r?\\n/)\r\n    // parse logger\r\n    scriptArray = scriptArray.map(scriptLine => {\r\n        if (loggerParser.isLoggerLine(scriptLine, options)) {\r\n            // is logger line\r\n            isScriptHasLoggerLine = true\r\n            return loggerParser.parseLogger(scriptLine, options)\r\n        } else {\r\n            return scriptLine\r\n        }\r\n    })\r\n\r\n    // do replace\r\n    if (isScriptHasLoggerLine && scriptArray.length > 0) {\r\n        source = scriptArray.join('\\n')\r\n    }\r\n    \r\n    return source\r\n}\r\n"
  },
  {
    "path": "lib/index.js",
    "content": "// Vue-pretty-logger-loader\nconst loaderUtils = require('loader-utils')\nconst compiler = require('vue-template-compiler')\nconst loggerParser = require('./utils/logger-parser')\nconst defaultOptions = require('./constant/options')\n\nmodule.exports = function (source, map) {\n    this.cacheable && this.cacheable()\n\n    // default options\n    const options = Object.assign(\n        defaultOptions,\n        loaderUtils.getOptions(this)\n    )\n\n    // script has logger note ?\n    let isScriptHasLoggerLine = false\n\n    // get scripts\n    const { script } = compiler.parseComponent(source, { pad: 'line' })\n    if (script === null) {\n        return source\n    }\n\n    const scripts = script.content\n\n    let scriptArray = scripts.split(/\\r?\\n/)\n    // parse logger\n    scriptArray = scriptArray.map(scriptLine => {\n        if (loggerParser.isLoggerLine(scriptLine, options)) {\n            // is logger line\n            isScriptHasLoggerLine = true\n            return loggerParser.parseLogger(scriptLine, options)\n        } else {\n            return scriptLine\n        }\n    })\n\n    // do replace\n    if (isScriptHasLoggerLine && scriptArray.length > 0) {\n        source = source.replace(\n            /<script[^>]*?>[\\s\\S]*?<\\/script>/i,\n            '<script>' + scriptArray.join('\\n') + '</script>'\n        )\n    }\n    \n    return source\n}\n"
  },
  {
    "path": "lib/utils/logger-note-judge.js",
    "content": "// logger-note-judge\nconst loggerNoteJudge = {\n    tagCommand: '-t',\n    signCommand: '-sign',\n    countCommand: '-count',\n    timeCommand: '-time',\n    profileCommand: '-profile',\n    stopCommand: '-stop',\n    fromCommand: '-from',\n    loggerLevels: [\n        {\n            name: '-e',\n            value: 'error'\n        },\n        {\n            name: '-d',\n            value: 'debug'\n        },\n        {\n            name: '-w',\n            value: 'warn'\n        },\n        {\n            name: '-i',\n            value: 'info'\n        },\n    ]\n}\n\nloggerNoteJudge.generateNote = function(logger, options, ...consoleStrArr) {\n    // logger => // {#} -d\n    logger = logger.substring(`// {${options.hook}}`.length, logger.length).trim()\n    let loggerCommands = logger.split(/\\s+/)\n    let consoleLine = ''\n    \n    // check -t\n    let localTag = options.tag\n    let tagIndex = loggerCommands.findIndex(comm => comm === loggerNoteJudge.tagCommand)\n    if (tagIndex > -1) {\n        localTag = loggerCommands[tagIndex + 1]\n    }\n\n    // find logger levels\n    let currentLevel = loggerNoteJudge.loggerLevels.find(level => {\n        for (let i = 0; i < loggerCommands.length; i++) {\n            if (loggerCommands[i] === level.name) {\n                // get\n                return true\n            }\n        }\n        return false\n    })\n\n    if (currentLevel) {\n        let levelTag = `${currentLevel.value}Tag`\n        let levelTagStyle = `${currentLevel.value}TagStyle`\n        consoleLine += `console.${currentLevel.value}('%c[${options[levelTag]}][${localTag}]', '${options[levelTagStyle]}', `\n        for (let i = 0; i < consoleStrArr.length; i++) {\n            consoleLine += `${consoleStrArr[i]}`\n\n            if (i !== consoleStrArr.length - 1) {\n                consoleLine += ', '\n            }\n        }\n        consoleLine += `)`\n    } else {\n        consoleLine += `console.log(`\n        for (let i = 0; i < consoleStrArr.length; i++) {\n            consoleLine += `${consoleStrArr[i]}`\n            if (i !== consoleStrArr.length - 1) {\n                consoleLine += ', '\n            }\n        }\n        consoleLine += `)`\n    }\n\n    if (loggerCommands.indexOf(loggerNoteJudge.stopCommand) > -1) {\n        consoleLine = ''\n    }\n\n    return consoleLine\n}\n\n\nloggerNoteJudge.hasSignCommand = function (logger, options) {\n    logger = logger.substring(`// {${options.hook}}`.length, logger.length).trim()\n    let loggerCommands = logger.split(/\\s+/)\n    return loggerCommands.indexOf(loggerNoteJudge.signCommand) > -1\n}\n\nloggerNoteJudge.withAssignment = function (loggerType, options) {\n    let loggerLine = ''\n    loggerLine += loggerType.input\n    \n    let consoleStrArr = []\n    let hasSignCommand = loggerNoteJudge.hasSignCommand(loggerType.logger, options)\n    if (hasSignCommand) {\n        consoleStrArr.push(`'${loggerType.var}: '`)\n    }\n    consoleStrArr.push(loggerType.var)\n\n    let generateNote = loggerNoteJudge.generateNote(loggerType.logger, options, consoleStrArr)\n    loggerLine += '\\n' + generateNote\n    return loggerLine\n}\n\nloggerNoteJudge.withFunction = function (loggerType, options) {\n    let loggerLine = ''\n    loggerLine += loggerType.input\n    let consoleStrArr = []\n    let hasSignCommand = loggerNoteJudge.hasSignCommand(loggerType.logger, options)\n\n    for (let i = 0; i < loggerType.var.length; i++) {\n        if (hasSignCommand) {\n            consoleStrArr.push(`'${loggerType.var[i]}: '`)\n        }\n        consoleStrArr.push(`${loggerType.var[i]}`)\n    }\n    \n    if (loggerType.var.length > 0) {\n        loggerLine += `\\n` + loggerNoteJudge.generateNote(loggerType.logger, options, consoleStrArr)\n    }\n\n    // check -count\n    let logger = loggerType.logger.substring(`// {${options.hook}}`.length, loggerType.logger.length).trim()\n    let loggerCommands = logger.split(/\\s+/)\n    if (loggerCommands.indexOf(loggerNoteJudge.countCommand) > -1) {\n        // has -count\n        loggerLine += `\\nconsole.count('${loggerType.functionName}')`\n    }\n\n    return loggerLine\n}\n\nloggerNoteJudge.withFunctionCall = function (loggerType, options) {\n    let loggerLine = ''\n\n    // check -time -profile -from\n    let logger = loggerType.logger.substring(`// {${options.hook}}`.length, loggerType.logger.length).trim()\n    let loggerCommands = logger.split(/\\s+/)\n    let hasTimeCommand = false\n    let hasProfileCommand = false\n    let hasFromCommand = false\n\n    if (loggerCommands.indexOf(loggerNoteJudge.timeCommand) > -1) {\n        hasTimeCommand = true\n    }\n\n    if (loggerCommands.indexOf(loggerNoteJudge.profileCommand) > -1) {\n        hasProfileCommand = true\n    }\n\n    if (loggerCommands.indexOf(loggerNoteJudge.fromCommand) > -1) {\n        hasFromCommand = true\n    }\n\n    if (hasProfileCommand) {\n        loggerLine += `console.profile('${loggerType.functionName}')`\n    }\n\n    if (hasTimeCommand) {\n        loggerLine += `\\nconsole.time('${loggerType.functionName}')`\n    }\n\n    // check -from\n    let consoleStrArr = []\n    if (hasFromCommand) {\n        let hasSignCommand = loggerNoteJudge.hasSignCommand(loggerType.logger, options)\n\n        for (let i = 0; i < loggerType.var.length; i++) {\n            if (hasSignCommand) {\n                consoleStrArr.push(`'${loggerType.var[i]}: '`)\n            }\n            consoleStrArr.push(`${loggerType.var[i]}`)\n        }\n\n        if (loggerType.var.length > 0) {\n            loggerLine += `\\n` + loggerNoteJudge.generateNote(loggerType.logger, options, consoleStrArr)\n        }\n    }\n    // check -form end\n\n    let resultName = 'result_' + Math.floor(Math.random() * 100000000)\n    loggerLine += `\\nconst ${resultName} = ${loggerType.input}`\n\n    if (hasTimeCommand) {\n        loggerLine += `\\nconsole.timeEnd('${loggerType.functionName}')`\n    }\n\n    if (hasProfileCommand) {\n        loggerLine += `\\nconsole.profileEnd('${loggerType.functionName}')`\n    }\n\n\n    consoleStrArr = []\n    if (loggerNoteJudge.hasSignCommand(loggerType.logger, options)) {\n        consoleStrArr.push(`'result: '`)\n    }\n    consoleStrArr.push(resultName)\n    loggerLine += `\\n` + loggerNoteJudge.generateNote(loggerType.logger, options, consoleStrArr)\n    return loggerLine\n}\n\nloggerNoteJudge.withFunctionCallback = function (loggerType, options) {\n    let loggerLine = ''\n    loggerLine += loggerType.input\n    let consoleStrArr = []\n    let hasSignCommand = loggerNoteJudge.hasSignCommand(loggerType.logger, options)\n\n    for (let i = 0; i < loggerType.var.length; i++) {\n        if (hasSignCommand) {\n            consoleStrArr.push(`'${loggerType.var[i]}: '`)\n        }\n        consoleStrArr.push(`${loggerType.var[i]}`)\n    }\n    \n    if (loggerType.var.length > 0) {\n        loggerLine += `\\n` + loggerNoteJudge.generateNote(loggerType.logger, options, consoleStrArr)\n    }\n\n    return loggerLine\n}\n\nmodule.exports = loggerNoteJudge\n"
  },
  {
    "path": "lib/utils/logger-parser.js",
    "content": "// logger-parser\nconst typeJudge = require('./logger-type-judge')\nconst noteJudge = require('./logger-note-judge')\nconst loggerTypes = require('../constant/logger-types')\n\nconst isDevelopment = \n    process.env.NODE_ENV ? \n    (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') : \n    true\n\nconst loggerParser = {\n    constant: {\n        LOGGER_REG: /\\/\\/[^\\n]*/\n    }\n}\n\nloggerParser.isLoggerLine = function (line, options) {\n    return line.indexOf(`// {${options.hook}}`) > -1\n}\n\nloggerParser.getLoggerNote = function (loggerLine, options) {\n    const result = {}\n    try {\n        let contentArr = loggerParser.constant.LOGGER_REG.exec(loggerLine)\n        result.logger = contentArr ? contentArr[0] : ''\n        if (result.logger.indexOf(`// {${options.hook}}`) > -1) {\n            result.input = contentArr.input\n            result.index = contentArr.index\n            return result\n        } else {\n            return loggerLine\n        }\n    } catch (error) {\n        console.error('pretty-logger:', error)\n        return loggerLine\n    }\n}\n\nloggerParser.parseLogger = function (loggerLine, options) {\n    // replace the current line with the options\n\n    // get logger note\n    const result = loggerParser.getLoggerNote(loggerLine, options)\n\n    // judge the type of line that has logger\n    const loggerType =\n        typeJudge(result.logger, result.input, result.index) || {type: ''}\n\n    if (!isDevelopment) {\n        return loggerType.input\n    }\n\n    switch (loggerType.type) {\n        case loggerTypes.ASSIGNMENT:\n            loggerLine = noteJudge.withAssignment(loggerType, options)\n            break\n        case loggerTypes.FUNCTION:\n            loggerLine = noteJudge.withFunction(loggerType, options)\n            break\n        case loggerTypes.FUNCTION_CALL:\n            loggerLine = noteJudge.withFunctionCall(loggerType, options)\n            break\n        case loggerTypes.FUNCTION_CALLBACK:\n            loggerLine = noteJudge.withFunctionCallback(loggerType, options)\n        default:\n            break\n    }\n\n    return loggerLine\n}\n\nmodule.exports = loggerParser\n"
  },
  {
    "path": "lib/utils/logger-type-judge.js",
    "content": "const loggerTypes = require('../constant/logger-types')\n\nconst assignmentTag = ['let', 'const', 'var']\n\nmodule.exports = (logger, input, index) => {\n    // whether it is an assignment line\n    input = input.substring(0, index).trim()\n    const result = {\n        logger: logger,\n        input: input,\n        var: '',\n        type: '',\n        functionName: ''\n    }\n\n    // Assignment statement\n    let assignmentVar = ''\n    assignmentTag.forEach(tag => {\n        if (input.indexOf(tag) > -1 && input.indexOf('=') > -1) {\n            assignmentVar = input.substring(\n                input.indexOf(tag) + tag.length,\n                input.indexOf('=')\n            ).trim()\n        }\n    })\n\n    if (assignmentVar) {\n        result.type = loggerTypes.ASSIGNMENT\n        result.var = assignmentVar\n        return result\n    }\n\n    // judge like this: a = 123\n    if (input.indexOf('=') > -1 && input.indexOf('=>') === -1) {\n        let splitArrayWithEqualSign = input.split('=')\n        // result: \"a = 1\" => [\"a\",\"1\"]\n        if (splitArrayWithEqualSign.length === 2) {\n            result.type = loggerTypes.ASSIGNMENT\n            result.var = splitArrayWithEqualSign[0].trim()\n            return result\n        }\n    }\n\n    // Function declaration: function test (p1, p2, p3) { // {#}\n    // avoid: let a = 'test(p1, p2) { //{#}'\n    const isFuncReg = /^(function)?\\s*[a-zA-Z0-9_$]+\\s*\\(.*\\)\\s*{$/\n    if (isFuncReg.test(input)) {\n        let startIndex = 0\n        if (input.indexOf('function') > -1) {\n            startIndex = 'function'.length + 1\n        }\n        let endIndex = input.indexOf('(')\n        let functionName = input.substring(startIndex, endIndex).trim()\n\n        let paramsString = input.match(/\\(.+\\)/)\n        if (paramsString) {\n            paramsString = paramsString[0]\n            paramsString = paramsString.substring(1, paramsString.length - 1)\n            if (paramsString.trim()) {\n                result.type = loggerTypes.FUNCTION\n                result.var = paramsString.split(',')\n                result.functionName = functionName\n                return result\n            }\n        } else {\n            result.type = loggerTypes.FUNCTION\n            result.var = []\n            result.functionName = functionName\n            return result\n        }\n    }\n\n    // Function call: this.test() // {#}\n    const isFuncCallReg = /^[\\.a-zA-Z0-9_$]+\\(.*\\);?$/\n    if (isFuncCallReg.test(input)  || input.indexOf('await') === 0) {\n        let startIndex = 0\n        if (input.indexOf('.') > -1) {\n            startIndex = input.indexOf('.') + 1\n        }\n        let endIndex = input.indexOf('(')\n\n        if (input.indexOf('await') === 0) {\n            startIndex = 'await'.length + 1\n            let awaitFuncEnd = input.indexOf('(')\n            endIndex = awaitFuncEnd === -1 ? -1 : awaitFuncEnd\n        }\n        \n        let functionName\n        if (endIndex === -1) {\n            functionName = 'await statement'\n        } else {\n            functionName = input.substring(startIndex, endIndex).trim()\n        }\n\n        startIndex = input.lastIndexOf('(') + 1\n        endIndex = input.lastIndexOf(')')\n        let paramsString = input.substring(startIndex, endIndex).trim()\n        if (paramsString) {\n            result.var = paramsString.split(',')\n        } else {\n            result.var = []\n        }\n\n        result.type = loggerTypes.FUNCTION_CALL\n        result.functionName = functionName\n        return result\n    }\n\n    // Function callback: this.test(() => { // {#}\n    const isFuncCallbackReg = /^[\\.a-zA-Z0-9_$]+\\(.*(function)?\\(.*\\)\\s*(=>)?\\s*{$/\n    if (isFuncCallbackReg.test(input)) {\n        let startIndex = 0\n        if (input.indexOf('.') > -1) {\n            startIndex = input.indexOf('.') + 1\n        }\n        let endIndex = input.indexOf('(')\n        let functionName = input.substring(startIndex, endIndex).trim()\n\n        startIndex = input.lastIndexOf('(')\n        endIndex = input.lastIndexOf(')')\n        let paramsString = input.substring(startIndex + 1, endIndex).trim()\n        \n        result.type = loggerTypes.FUNCTION_CALLBACK\n        result.functionName = functionName\n        if (paramsString) {\n            result.var = paramsString.split(',')\n        } else {\n            result.var = []\n        }\n        return result\n    }\n\n    return null\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"vue-pretty-logger\",\n  \"version\": \"0.9.0\",\n  \"author\": \"YangXin\",\n  \"description\": \"Pretty logger for Vue\",\n  \"keywords\": [\n    \"logger\",\n    \"vue-pretty-logger\",\n    \"pretty-logger\",\n    \"pretty\",\n    \"pretty-logger-loader\",\n    \"logger-loader\"\n  ],\n  \"main\": \"lib/index.js\",\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"dev\": \"webpack-dev-server --config example/webpack.config.js --inline --hot\",\n    \"changelog\": \"conventional-changelog -p angular -i CHANGELOG.md -s\",\n    \"pregit\": \"yarn test && yarn changelog\",\n    \"git\": \"git add . && git cz\",\n    \"postgit\": \"git push origin master && yarn publish\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/TaroXin/vue-pretty-logger.git\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/TaroXin/vue-pretty-logger/issues\"\n  },\n  \"homepage\": \"https://github.com/TaroXin/vue-pretty-logger\",\n  \"license\": \"MIT\",\n  \"peerDependencies\": {\n    \"loader-utils\": \"^1.1.0\",\n    \"vue-template-compiler\": \"^2.5.16\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.3\",\n    \"babel-loader\": \"^7.1.4\",\n    \"babel-plugin-transform-runtime\": \"^6.23.0\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"css-loader\": \"^0.28.11\",\n    \"cz-conventional-changelog\": \"^2.1.0\",\n    \"jest\": \"^22.4.3\",\n    \"style-loader\": \"^0.21.0\",\n    \"vue\": \"^2.5.16\",\n    \"vue-loader\": \"^15.0.7\",\n    \"vue-template-compiler\": \"^2.5.16\",\n    \"webpack\": \"^4.7.0\",\n    \"webpack-cli\": \"^2.1.2\",\n    \"webpack-dev-server\": \"^3.1.4\"\n  },\n  \"config\": {\n    \"commitizen\": {\n      \"path\": \"./node_modules/cz-conventional-changelog\"\n    }\n  }\n}\n"
  },
  {
    "path": "test/loader-type-judge.test.js",
    "content": "const loggerTypeJudge = require('../lib/utils/logger-type-judge')\r\n\r\ntest('test loggerTypeJudge assignment', () => {\r\n    const input = {\r\n        logger: '// {#}',\r\n        input: 'let a = 0 // {#}',\r\n        index: 10\r\n    }\r\n\r\n    const output = {\r\n        logger: '// {#}',\r\n        input: 'let a = 0',\r\n        var: 'a',\r\n        type: 'ASSIGNMENT',\r\n        functionName: ''\r\n    }\r\n    \r\n    expect(JSON.stringify(loggerTypeJudge(input.logger, input.input, input.index))).toBe(JSON.stringify(output))\r\n})\r\n\r\ntest('test loggerTypeJudge function', () => {\r\n    const input = {\r\n        logger: '// {#}',\r\n        input: 'test (a, b) { // {#}',\r\n        index: 14\r\n    }\r\n\r\n    const output = {\r\n        logger: '// {#}',\r\n        input: 'test (a, b) {',\r\n        var: ['a', ' b'],\r\n        type: 'FUNCTION',\r\n        functionName: 'test'\r\n    }\r\n    \r\n    expect(JSON.stringify(loggerTypeJudge(input.logger, input.input, input.index))).toBe(JSON.stringify(output))\r\n})\r\n\r\ntest('test loggerTypeJudge function call', () => {\r\n    const input = {\r\n        logger: '// {#}',\r\n        input: 'this.test(p1, p2) // {#}',\r\n        index: 18\r\n    }\r\n\r\n    const output = {\r\n        logger: '// {#}',\r\n        input: 'this.test(p1, p2)',\r\n        var: ['p1', ' p2'],\r\n        type: 'FUNCTION_CALL',\r\n        functionName: 'test'\r\n    }\r\n    \r\n    expect(JSON.stringify(loggerTypeJudge(input.logger, input.input, input.index))).toBe(JSON.stringify(output))\r\n})\r\n\r\ntest('test loggerTypeJudge function call with await', () => {\r\n    const input = {\r\n        logger: '// {#}',\r\n        input: 'await test() // {#}',\r\n        index: 13\r\n    }\r\n\r\n    const output = {\r\n        logger: '// {#}',\r\n        input: 'await test()',\r\n        var: [],\r\n        type: 'FUNCTION_CALL',\r\n        functionName: 'test'\r\n    }\r\n    \r\n    expect(JSON.stringify(loggerTypeJudge(input.logger, input.input, input.index))).toBe(JSON.stringify(output))\r\n})\r\n\r\ntest('test loggerTypeJudge function callback', () => {\r\n    const input = {\r\n        logger: '// {#}',\r\n        input: 'this.test(\"test\", (result) => { // {#}',\r\n        index: 32\r\n    }\r\n\r\n    const output = {\r\n        logger: '// {#}',\r\n        input: 'this.test(\"test\", (result) => {',\r\n        var: ['result'],\r\n        type: 'FUNCTION_CALLBACK',\r\n        functionName: 'test'\r\n    }\r\n    \r\n    expect(JSON.stringify(loggerTypeJudge(input.logger, input.input, input.index))).toBe(JSON.stringify(output))\r\n})\r\n"
  },
  {
    "path": "test/logger-parser.test.js",
    "content": "const loggerParser = require('../lib/utils/logger-parser')\r\n\r\ntest('test parse logger with normal', () => {\r\n    let test = 'let a = 0 // {#}'\r\n    let testResult = 'let a = 0\\nconsole.log(a)'\r\n    expect(loggerParser.parseLogger(test, {hook: '#'})).toBe(testResult)\r\n})\r\n\r\ntest('test function declaration', () => {\r\n    let test = 'test () { // {#}'\r\n    let testResult = 'test () {'\r\n    expect(loggerParser.parseLogger(test, {hook: '#'})).toBe(testResult)\r\n})\r\n\r\ntest('test function declaration with params', () => {\r\n    let test = 'test (a, b) { // {#}'\r\n    let testResult = 'test (a, b) {\\nconsole.log(a, b)'\r\n    expect(loggerParser.parseLogger(test, {hook: '#'})).toBe(testResult)\r\n})\r\n"
  }
]