From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/webpackbar/CHANGELOG.md | 282 +++++++++++++++++++++ node_modules/webpackbar/LICENSE | 20 ++ node_modules/webpackbar/README.md | 147 +++++++++++ node_modules/webpackbar/dist/cjs.js | 3 + node_modules/webpackbar/dist/description.js | 42 +++ node_modules/webpackbar/dist/index.js | 189 ++++++++++++++ node_modules/webpackbar/dist/options.json | 9 + node_modules/webpackbar/dist/profile.js | 77 ++++++ node_modules/webpackbar/dist/utils.js | 144 +++++++++++ node_modules/webpackbar/node_modules/.bin/webpack | 1 + .../node_modules/schema-utils/CHANGELOG.md | 134 ++++++++++ .../webpackbar/node_modules/schema-utils/LICENSE | 20 ++ .../webpackbar/node_modules/schema-utils/README.md | 149 +++++++++++ .../node_modules/schema-utils/package.json | 41 +++ .../schema-utils/src/ValidationError.js | 30 +++ .../node_modules/schema-utils/src/index.js | 9 + .../schema-utils/src/validateOptions.js | 38 +++ node_modules/webpackbar/package.json | 94 +++++++ 18 files changed, 1429 insertions(+) create mode 100644 node_modules/webpackbar/CHANGELOG.md create mode 100644 node_modules/webpackbar/LICENSE create mode 100644 node_modules/webpackbar/README.md create mode 100644 node_modules/webpackbar/dist/cjs.js create mode 100644 node_modules/webpackbar/dist/description.js create mode 100644 node_modules/webpackbar/dist/index.js create mode 100644 node_modules/webpackbar/dist/options.json create mode 100644 node_modules/webpackbar/dist/profile.js create mode 100644 node_modules/webpackbar/dist/utils.js create mode 120000 node_modules/webpackbar/node_modules/.bin/webpack create mode 100644 node_modules/webpackbar/node_modules/schema-utils/CHANGELOG.md create mode 100644 node_modules/webpackbar/node_modules/schema-utils/LICENSE create mode 100644 node_modules/webpackbar/node_modules/schema-utils/README.md create mode 100644 node_modules/webpackbar/node_modules/schema-utils/package.json create mode 100644 node_modules/webpackbar/node_modules/schema-utils/src/ValidationError.js create mode 100644 node_modules/webpackbar/node_modules/schema-utils/src/index.js create mode 100644 node_modules/webpackbar/node_modules/schema-utils/src/validateOptions.js create mode 100644 node_modules/webpackbar/package.json (limited to 'node_modules/webpackbar') diff --git a/node_modules/webpackbar/CHANGELOG.md b/node_modules/webpackbar/CHANGELOG.md new file mode 100644 index 00000000..f5225c0e --- /dev/null +++ b/node_modules/webpackbar/CHANGELOG.md @@ -0,0 +1,282 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [2.6.3](https://github.com/nuxt/webpackbar/compare/v2.6.2...v2.6.3) (2018-08-18) + + + + +## [2.6.2](https://github.com/nuxt/webpackbar/compare/v2.6.1...v2.6.2) (2018-08-12) + + +### Bug Fixes + +* ESLint is broken when using eslint-plugin-import ([783f243](https://github.com/nuxt/webpackbar/commit/783f243)) + + + + +## [2.6.1](https://github.com/nuxt/webpackbar/compare/v2.6.0...v2.6.1) (2018-04-04) + + +### Bug Fixes + +* fix elipses logic ([0fdb30f](https://github.com/nuxt/webpackbar/commit/0fdb30f)) + + + + +# [2.6.0](https://github.com/nuxt/webpackbar/compare/v2.5.0...v2.6.0) (2018-04-04) + + +### Features + +* cli improvements ([76d7306](https://github.com/nuxt/webpackbar/commit/76d7306)) + + + + +# [2.5.0](https://github.com/nuxt/webpackbar/compare/v2.4.0...v2.5.0) (2018-04-04) + + +### Features + +* windows visual improvements ([2ae8339](https://github.com/nuxt/webpackbar/commit/2ae8339)) + + + + +# [2.4.0](https://github.com/nuxt/webpackbar/compare/v2.3.2...v2.4.0) (2018-04-01) + + +### Features + +* add compile stats to the sharedState ([3973f6b](https://github.com/nuxt/webpackbar/commit/3973f6b)) + + + + +## [2.3.2](https://github.com/nuxt/webpackbar/compare/v2.3.1...v2.3.2) (2018-03-31) + + +### Bug Fixes + +* hot update for consola ([1d13980](https://github.com/nuxt/webpackbar/commit/1d13980)) + + + + +## [2.3.1](https://github.com/nuxt/webpackbar/compare/v2.3.0...v2.3.1) (2018-03-31) + + +### Bug Fixes + +* consola 1.1.1 ([b44fd11](https://github.com/nuxt/webpackbar/commit/b44fd11)) + + + + +# [2.3.0](https://github.com/nuxt/webpackbar/compare/v2.2.1...v2.3.0) (2018-03-31) + + +### Features + +* **colorize:** try chalk built-in colors first ([73fd89e](https://github.com/nuxt/webpackbar/commit/73fd89e)) + + + + +## [2.2.1](https://github.com/nuxt/webpackbar/compare/v2.2.0...v2.2.1) (2018-03-31) + + + + +# [2.2.0](https://github.com/nuxt/webpackbar/compare/v2.1.0...v2.2.0) (2018-03-31) + + +### Features + +* consola integration ([d99f254](https://github.com/nuxt/webpackbar/commit/d99f254)) + + + + +# [2.1.0](https://github.com/nuxt/webpackbar/compare/v2.0.3...v2.1.0) (2018-03-31) + + +### Features + +* show inactive parallel tasks ([2862002](https://github.com/nuxt/webpackbar/commit/2862002)) + + + + +## [2.0.3](https://github.com/nuxt/webpackbar/compare/v2.0.2...v2.0.3) (2018-03-31) + + +### Bug Fixes + +* honor options.stream everywhere ([34733b7](https://github.com/nuxt/webpackbar/commit/34733b7)) + + + + +## [2.0.2](https://github.com/nuxt/webpackbar/compare/v2.0.1...v2.0.2) (2018-03-31) + + +### Bug Fixes + +* fix compiled message in minimal mode ([80f7ac2](https://github.com/nuxt/webpackbar/commit/80f7ac2)) + + + + +## [2.0.1](https://github.com/nuxt/webpackbar/compare/v2.0.0...v2.0.1) (2018-03-31) + + +### Bug Fixes + +* fix cannot read property 'write' of undefined ([ccb1d65](https://github.com/nuxt/webpackbar/commit/ccb1d65)) + + + + +# [2.0.0](https://github.com/nuxt/webpackbar/compare/v1.5.1...v2.0.0) (2018-03-31) + + +### Features + +* v2 rewrite ([5151960](https://github.com/nuxt/webpackbar/commit/5151960)) + + +### BREAKING CHANGES + +* behaviour and options changed. Refer to the new docs + + + + +## [1.5.1](https://github.com/nuxt/webpackbar/compare/v1.5.0...v1.5.1) (2018-03-28) + + +### Bug Fixes + +* call done hook last ([642a9ef](https://github.com/nuxt/webpackbar/commit/642a9ef)) + + + + +# [1.5.0](https://github.com/nuxt/webpackbar/compare/v1.4.0...v1.5.0) (2018-03-28) + + +### Features + +* options.buildTitle & consistent number of output lines ([1263fc1](https://github.com/nuxt/webpackbar/commit/1263fc1)) + + + + +# [1.4.0](https://github.com/nuxt/webpackbar/compare/v1.3.0...v1.4.0) (2018-03-28) + + +### Features + +* accept done callback as an option ([30bfd1e](https://github.com/nuxt/webpackbar/commit/30bfd1e)) +* better handling for 100% state and clear: false ([a2c823f](https://github.com/nuxt/webpackbar/commit/a2c823f)) + + + + +# [1.3.0](https://github.com/nuxt/webpackbar/compare/v1.2.1...v1.3.0) (2018-03-27) + + +### Features + +* enabled option with smart defaults. ([0d22e4c](https://github.com/nuxt/webpackbar/commit/0d22e4c)) + + + + +## [1.2.1](https://github.com/nuxt/webpackbar/compare/v1.2.0...v1.2.1) (2018-03-27) + + +### Bug Fixes + +* default clear to true ([528b769](https://github.com/nuxt/webpackbar/commit/528b769)) + + + + +# [1.2.0](https://github.com/nuxt/webpackbar/compare/v1.1.4...v1.2.0) (2018-03-27) + + +### Features + +* new options: stream, profile, clear and showCursor. ([#3](https://github.com/nuxt/webpackbar/issues/3)) ([80f5f17](https://github.com/nuxt/webpackbar/commit/80f5f17)) +* support hex colors. ([#2](https://github.com/nuxt/webpackbar/issues/2)) ([1c7cc0b](https://github.com/nuxt/webpackbar/commit/1c7cc0b)) + + + + +## [1.1.4](https://github.com/nuxt/webpackbar/compare/v1.1.3...v1.1.4) (2018-03-26) + + +### Bug Fixes + +* webpack 3 compability ([#1](https://github.com/nuxt/webpackbar/issues/1)) ([ff24c14](https://github.com/nuxt/webpackbar/commit/ff24c14)) + + + + +## [1.1.3](https://github.com/nuxt/webpackbar/compare/v1.1.2...v1.1.3) (2018-03-24) + + +### Bug Fixes + +* remove debug ([a27a83c](https://github.com/nuxt/webpackbar/commit/a27a83c)) + + + + +## [1.1.2](https://github.com/nuxt/webpackbar/compare/v1.1.1...v1.1.2) (2018-03-24) + + +### Bug Fixes + +* **profile:** ignore requests without any file or loaders ([d3eb446](https://github.com/nuxt/webpackbar/commit/d3eb446)) + + + + +## [1.1.1](https://github.com/nuxt/webpackbar/compare/v1.1.0...v1.1.1) (2018-03-24) + + + + +# [1.1.0](https://github.com/nuxt/webpackbar/compare/v1.0.0...v1.1.0) (2018-03-24) + + +### Features + +* build profiler ([0c05d65](https://github.com/nuxt/webpackbar/commit/0c05d65)) + + + + +# 1.0.0 (2018-03-24) + + + +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +x.x.x / -- +================== + + * Bug fix - + * Feature - + * Chore - + * Docs - diff --git a/node_modules/webpackbar/LICENSE b/node_modules/webpackbar/LICENSE new file mode 100644 index 00000000..8c11fc72 --- /dev/null +++ b/node_modules/webpackbar/LICENSE @@ -0,0 +1,20 @@ +Copyright JS Foundation and other contributors + +Permission 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: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE 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. diff --git a/node_modules/webpackbar/README.md b/node_modules/webpackbar/README.md new file mode 100644 index 00000000..e0bcc24c --- /dev/null +++ b/node_modules/webpackbar/README.md @@ -0,0 +1,147 @@ +[![npm][npm]][npm-url] +[![deps][deps]][deps-url] +[![test][test]][test-url] +[![test-windows][test-win]][test-win-url] +[![coverage][cover]][cover-url] + +
+ + + + + +

Elegant ProgressBar and Profiler for Webpack

+
+ +✔ Display elegant progress bar while building or watch + +✔ Support of multiple concurrent builds (useful for SSR) + +✔ Pretty print filename and loaders + +✔ Windows compatible + +✔ Customizable + +✔ Advanced build profiler + +
+
+ +

Multi progress bars

+
+
+ +
+
+ +

Build Profiler

+
+
+ +

Getting Started

+ +To begin, you'll need to install `webpackbar`: + +Using npm: + +```bash +npm install webpackbar -D +``` + +Using yarn: + +```bash +yarn add webpackbar -D +``` + +Then add the reporter as a plugin to your webpack config. + +**webpack.config.js** + +```js +const webpack = require('webpack'); +const WebpackBar = require('webpackbar'); + +module.exports = { + context: path.resolve(__dirname), + devtool: 'source-map', + entry: './entry.js', + output: { + filename: './output.js', + path: path.resolve(__dirname) + }, + plugins: [ + new WebpackBar() + ] +}; +``` + +

Options

+ +### `name` + - Default: `webpack` + +Display name + +### `color` + - Default: `green` + +Display color (can be HEX like `#xxyyzz` or a web color like `green`). + +### `profile` + - Default: `false` + +Enable profiler. + +### `stream` + - Default: `process.stderr` + +Output stream. + + +### `minimal` + - Default: Auto enabled on CI, non-TTY and test environments + +Hide progress bar and only show Compiling/Compiled messages. + +### `compiledIn` + - Default: `true` + +Show `Compiled in ` message after build. + +### `done` + - Type: `Function(sharedState, ctx)` + +A function that will be called when **all** builds are finished. + +

Maintainers

+ + + + + + + +
+ + +
+ Pooya Parsa +
+
+ +[npm]: https://img.shields.io/npm/v/webpackbar.svg?style=flat-square +[npm-url]: https://npmjs.com/package/webpackbar + +[deps]: https://david-dm.org/nuxt/webpackbar.svg?style=flat-square +[deps-url]: https://david-dm.org/nuxt/webpackbar + +[test]: https://img.shields.io/circleci/project/github/nuxt/webpackbar/master.svg?style=flat-square +[test-url]: https://circleci.com/gh/nuxt/webpackbar + +[test-win]: https://img.shields.io/appveyor/ci/nuxt/webpackbar.svg?logo=appveyor&style=flat-square +[test-win-url]: https://ci.appveyor.com/project/nuxt/webpackbar + +[cover]: https://codecov.io/gh/nuxt/webpackbar/branch/master/graph/badge.svg?style=flat-square +[cover-url]: https://codecov.io/gh/nuxt/webpackbar diff --git a/node_modules/webpackbar/dist/cjs.js b/node_modules/webpackbar/dist/cjs.js new file mode 100644 index 00000000..61cc3574 --- /dev/null +++ b/node_modules/webpackbar/dist/cjs.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./index').default; \ No newline at end of file diff --git a/node_modules/webpackbar/dist/description.js b/node_modules/webpackbar/dist/description.js new file mode 100644 index 00000000..c56f1503 --- /dev/null +++ b/node_modules/webpackbar/dist/description.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = getDescription; + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const DB = { + loader: { + get: loader => _lodash2.default.startCase(loader) + }, + ext: { + get: ext => `${ext} files`, + vue: 'Vue Single File components', + js: 'JavaScript files', + sass: 'SASS files', + scss: 'SASS files', + unknown: 'Unknown files' + } +}; + +function getDescription(category, keyword) { + if (!DB[category]) { + return _lodash2.default.startCase(keyword); + } + + if (DB[category][keyword]) { + return DB[category][keyword]; + } + + if (DB[category].get) { + return DB[category].get(keyword); + } + + return '-'; +} \ No newline at end of file diff --git a/node_modules/webpackbar/dist/index.js b/node_modules/webpackbar/dist/index.js new file mode 100644 index 00000000..6c834442 --- /dev/null +++ b/node_modules/webpackbar/dist/index.js @@ -0,0 +1,189 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _webpack = require('webpack'); + +var _webpack2 = _interopRequireDefault(_webpack); + +var _chalk = require('chalk'); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _logUpdate = require('log-update'); + +var _logUpdate2 = _interopRequireDefault(_logUpdate); + +var _stdEnv = require('std-env'); + +var _stdEnv2 = _interopRequireDefault(_stdEnv); + +var _consola = require('consola'); + +var _consola2 = _interopRequireDefault(_consola); + +var _prettyTime = require('pretty-time'); + +var _prettyTime2 = _interopRequireDefault(_prettyTime); + +var _profile = require('./profile'); + +var _profile2 = _interopRequireDefault(_profile); + +var _utils = require('./utils'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const sharedState = {}; + +const defaults = { + name: 'webpack', + color: 'green', + profile: false, + compiledIn: true, + done: null, + minimal: _stdEnv2.default.minimalCLI, + stream: null +}; + +const hasRunning = () => Object.values(sharedState).find(s => s.isRunning); + +const $logUpdate = _logUpdate2.default.create(process.stderr, { + showCursor: false +}); + +class WebpackBarPlugin extends _webpack2.default.ProgressPlugin { + constructor(options) { + super(); + + this.options = Object.assign({}, defaults, options); + + // this.handler will be called by webpack.ProgressPlugin + this.handler = (percent, msg, ...details) => this.updateProgress(percent, msg, details); + + this._render = _lodash2.default.throttle(this.render, 100); + + this.logUpdate = this.options.logUpdate || $logUpdate; + + if (!this.state) { + sharedState[this.options.name] = { + isRunning: false, + color: this.options.color, + profile: this.options.profile ? new _profile2.default(this.options.name) : null + }; + } + } + + get state() { + return sharedState[this.options.name]; + } + + get stream() { + return this.options.stream || process.stderr; + } + + apply(compiler) { + super.apply(compiler); + + const hook = stats => { + this.state.stats = stats; + if (!hasRunning()) { + this.logUpdate.clear(); + this.done(); + } + }; + + if (compiler.hooks) { + compiler.hooks.done.tap('WebpackBar', hook); + } else { + compiler.plugin('done', hook); + } + } + + done() { + if (this.options.profile) { + const stats = this.state.profile.getStats(); + const statsStr = (0, _utils.formatStats)(stats); + this.stream.write(`\n${statsStr}\n`); + } + + if (typeof this.options.done === 'function') { + this.options.done(sharedState, this); + } + } + + updateProgress(percent, msg, details) { + const progress = Math.floor(percent * 100); + const isRunning = progress < 100; + + const wasRunning = this.state.isRunning; + + Object.assign(this.state, { + progress, + msg: isRunning && msg ? msg : '', + details: details || [], + request: (0, _utils.parseRequst)(details[2]), + isRunning + }); + + if (!wasRunning && isRunning) { + // Started + delete this.state.stats; + this.state.start = process.hrtime(); + if (this.options.minimal) { + _consola2.default.info(`Compiling ${this.options.name}`); + } + } else if (wasRunning && !isRunning) { + // Finished + const time = process.hrtime(this.state.start); + if (this.options.minimal) { + _consola2.default.success(`Compiled ${this.options.name} in ${(0, _prettyTime2.default)(time)}`); + } else { + this.logUpdate.clear(); + if (this.options.compiledIn) { + _consola2.default.success(`${this.options.name} compiled in ${(0, _prettyTime2.default)(time, 'ms')}`); + } + } + delete this.state.start; + } + + if (this.options.profile) { + this.state.profile.onRequest(this.state.request); + } + + this._render(); + } + + render() { + if (this.options.minimal) { + return; + } + + const columns = this.stream.columns || 80; + + const stateLines = _lodash2.default.sortBy(Object.keys(sharedState), n => n).map(name => { + const state = sharedState[name]; + const color = (0, _utils.colorize)(state.color); + + if (!state.isRunning) { + const color2 = state.progress === 100 ? color : _chalk2.default.grey; + return color2(`${_utils.BULLET} ${name}\n`); + } + + return `${[color(_utils.BULLET), color(name), (0, _utils.renderBar)(state.progress, state.color), state.msg, `(${state.progress || 0}%)`, _chalk2.default.grey(state.details && state.details[0] || ''), _chalk2.default.grey(state.details && state.details[1] || '')].join(' ')}\n ${state.request ? _chalk2.default.grey((0, _utils.elipsesLeft)((0, _utils.formatRequest)(state.request), columns - 2)) : ''}\n`; + }); + + if (hasRunning()) { + const title = _chalk2.default.underline.blue('Compiling'); + const log = `\n${title}\n\n${stateLines.join('\n')}`; + this.logUpdate(log); + } + } +} +exports.default = WebpackBarPlugin; \ No newline at end of file diff --git a/node_modules/webpackbar/dist/options.json b/node_modules/webpackbar/dist/options.json new file mode 100644 index 00000000..066dc78c --- /dev/null +++ b/node_modules/webpackbar/dist/options.json @@ -0,0 +1,9 @@ +{ + "type": "object", + "properties": { + "name": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/node_modules/webpackbar/dist/profile.js b/node_modules/webpackbar/dist/profile.js new file mode 100644 index 00000000..15825568 --- /dev/null +++ b/node_modules/webpackbar/dist/profile.js @@ -0,0 +1,77 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +class Profile { + constructor(name) { + this.name = name; + this.requests = []; + } + + onRequest(request) { + // Measure time for last request + if (this.requests.length) { + const lastReq = this.requests[this.requests.length - 1]; + if (lastReq.start) { + lastReq.time = process.hrtime(lastReq.start); + delete lastReq.start; + } + } + + // Ignore requests without any file or loaders + if (!request.file || !request.loaders.length) { + return; + } + + this.requests.push({ + request, + start: process.hrtime() + }); + } + + getStats() { + const loaderStats = {}; + const extStats = {}; + + const getStat = (stats, name) => { + if (!stats[name]) { + // eslint-disable-next-line no-param-reassign + stats[name] = { + count: 0, + time: [0, 0] + }; + } + return stats[name]; + }; + + const addToStat = (stats, name, count, time) => { + const stat = getStat(stats, name); + stat.count += count; + stat.time[0] += time[0]; + stat.time[1] += time[1]; + }; + + this.requests.forEach(({ request, time = [0, 0] }) => { + request.loaders.forEach(loader => { + addToStat(loaderStats, loader, 1, time); + }); + + const ext = request.file && _path2.default.extname(request.file).substr(1); + addToStat(extStats, ext && ext.length ? ext : 'unknown', 1, time); + }); + + return { + ext: extStats, + loader: loaderStats + }; + } +} +exports.default = Profile; \ No newline at end of file diff --git a/node_modules/webpackbar/dist/utils.js b/node_modules/webpackbar/dist/utils.js new file mode 100644 index 00000000..fbf23762 --- /dev/null +++ b/node_modules/webpackbar/dist/utils.js @@ -0,0 +1,144 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.formatStats = exports.formatRequest = exports.parseRequst = exports.renderBar = exports.colorize = exports.TICK = exports.BULLET = undefined; +exports.elipses = elipses; +exports.elipsesLeft = elipsesLeft; + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _chalk = require('chalk'); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _lodash = require('lodash'); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _figures = require('figures'); + +var _figures2 = _interopRequireDefault(_figures); + +var _table = require('table'); + +var _prettyTime = require('pretty-time'); + +var _prettyTime2 = _interopRequireDefault(_prettyTime); + +var _description = require('./description'); + +var _description2 = _interopRequireDefault(_description); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const BAR_LENGTH = 25; +const BLOCK_CHAR = '█'; +const BLOCK_CHAR2 = '█'; +const NEXT = _chalk2.default.blue((0, _figures2.default)(' › ')); + +const BULLET = exports.BULLET = (0, _figures2.default)('●'); +const TICK = exports.TICK = _chalk2.default.green((0, _figures2.default)('✔')); + +const colorize = exports.colorize = color => { + if (color[0] === '#') { + return _chalk2.default.hex(color); + } + + return _chalk2.default[color] || _chalk2.default.keyword(color); +}; + +const renderBar = exports.renderBar = (progress, color) => { + const w = progress * (BAR_LENGTH / 100); + const bg = _chalk2.default.white(BLOCK_CHAR); + const fg = colorize(color)(BLOCK_CHAR2); + + return _lodash2.default.range(BAR_LENGTH).map(i => i < w ? fg : bg).join(''); +}; + +const hasValue = s => s && s.length; + +const nodeModules = `${_path2.default.delimiter}node_modules${_path2.default.delimiter}`; +const removeAfter = (delimiter, str) => _lodash2.default.first(str.split(delimiter)); +const removeBefore = (delimiter, str) => _lodash2.default.last(str.split(delimiter)); + +const firstMatch = (regex, str) => { + const m = regex.exec(str); + return m ? m[0] : null; +}; + +const parseRequst = exports.parseRequst = requestStr => { + const parts = (requestStr || '').split('!'); + + const file = _path2.default.relative(process.cwd(), removeAfter('?', removeBefore(nodeModules, parts.pop()))); + + const loaders = parts.map(part => firstMatch(/[a-z0-9-@]+-loader/, part)).filter(hasValue); + + return { + file: hasValue(file) ? file : null, + loaders + }; +}; + +const formatRequest = exports.formatRequest = request => { + const loaders = request.loaders.join(NEXT); + + if (!loaders.length) { + return request.file || ''; + } + + return `${loaders}${NEXT}${request.file}`; +}; + +const formatStats = exports.formatStats = allStats => { + const lines = []; + + Object.keys(allStats).forEach(category => { + const stats = allStats[category]; + + lines.push(`Stats by ${_chalk2.default.bold(_lodash2.default.startCase(category))}`); + + let totalRequests = 0; + const totalTime = [0, 0]; + + const data = [[_lodash2.default.startCase(category), 'Requests', 'Time', 'Time/Request', 'Description']]; + + Object.keys(stats).forEach(item => { + const stat = stats[item]; + + totalRequests += stat.count || 0; + + const description = (0, _description2.default)(category, item); + + totalTime[0] += stat.time[0]; + totalTime[1] += stat.time[1]; + + const avgTime = [stat.time[0] / stat.count, stat.time[1] / stat.count]; + + data.push([item, stat.count || '-', (0, _prettyTime2.default)(stat.time), (0, _prettyTime2.default)(avgTime), description]); + }); + + data.push(['Total', totalRequests, (0, _prettyTime2.default)(totalTime), '', '']); + + lines.push((0, _table.table)(data)); + }); + + return lines.join('\n\n'); +}; + +function elipses(str, n) { + if (str.length <= n - 3) { + return str; + } + return `${str.substr(0, n - 1)}...`; +} + +function elipsesLeft(str, n) { + if (str.length <= n - 3) { + return str; + } + return `...${str.substr(str.length - n - 1)}`; +} \ No newline at end of file diff --git a/node_modules/webpackbar/node_modules/.bin/webpack b/node_modules/webpackbar/node_modules/.bin/webpack new file mode 120000 index 00000000..8a1900f6 --- /dev/null +++ b/node_modules/webpackbar/node_modules/.bin/webpack @@ -0,0 +1 @@ +../../../webpack/bin/webpack.js \ No newline at end of file diff --git a/node_modules/webpackbar/node_modules/schema-utils/CHANGELOG.md b/node_modules/webpackbar/node_modules/schema-utils/CHANGELOG.md new file mode 100644 index 00000000..a5f2834c --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/CHANGELOG.md @@ -0,0 +1,134 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07) + + +### Features + +* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef)) + + + + +## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07) + + +### Bug Fixes + +* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4)) + + + + +## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06) + + +### Bug Fixes + +* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81)) +* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5)) + + + + +## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13) + + +### Bug Fixes + +* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f)) +* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba)) + + + + +## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13) + + +### Bug Fixes + +* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6)) + + + + +## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14) + + +### Bug Fixes + +* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda)) +* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791)) + + + + +## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09) + + +### Bug Fixes + +* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e)) + + + + +## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03) + + +### Bug Fixes + +* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974)) + + + + +# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28) + + +### Features + +* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816)) + + + + +# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29) + + +### Features + +* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb)) + + + + +## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13) + + +### Bug Fixes + +* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363)) +* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f)) + + + + +# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12) + + +# 0.1.0 (2017-03-07) + + +### Features + +* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b)) + + + +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. diff --git a/node_modules/webpackbar/node_modules/schema-utils/LICENSE b/node_modules/webpackbar/node_modules/schema-utils/LICENSE new file mode 100644 index 00000000..8c11fc72 --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/LICENSE @@ -0,0 +1,20 @@ +Copyright JS Foundation and other contributors + +Permission 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: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE 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. diff --git a/node_modules/webpackbar/node_modules/schema-utils/README.md b/node_modules/webpackbar/node_modules/schema-utils/README.md new file mode 100644 index 00000000..7b75d549 --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/README.md @@ -0,0 +1,149 @@ +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![test][test]][test-url] +[![coverage][cover]][cover-url] +[![chat][chat]][chat-url] + +
+ + + + + + +

Schema Utils

+
+ +

Install

+ +```bash +npm i schema-utils +``` + +

Usage

+ +### `validateOptions` + +**`schema.json`** +```js +{ + "type": "object", + "properties": { + // Options... + }, + "additionalProperties": false +} +``` + +#### Error Messages (Custom) + +**`schema.json`** +```js +{ + "type": "object", + "properties": { + "option": { + "type": [ "boolean" ] + } + }, + // Overrides the default err.message for option + "errorMessage": { + "option": "should be {Boolean} (https:/github.com/org/repo#anchor)" + } + "additionalProperties": false +} +``` + +```js +import schema from 'path/to/schema.json' +import validateOptions from 'schema-utils' + +validateOptions(schema, options, 'Loader/Plugin Name') +``` + +

Examples

+ +**schema.json** +```json +{ + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "test": { + "anyOf": [ + { "type": "array" }, + { "type": "string" }, + { "instanceof": "RegExp" } + ] + }, + "transform": { + "instanceof": "Function" + }, + "sourceMap": { + "type": "boolean" + } + }, + "additionalProperties": false +} +``` + +### `Loader` + +```js +import { getOptions } from 'loader-utils' +import validateOptions from 'schema-utils' + +import schema from 'path/to/schema.json' + +function loader (src, map) { + const options = getOptions(this) || {} + + validateOptions(schema, options, 'Loader Name') + + // Code... +} +``` + +### `Plugin` + +```js +import validateOptions from 'schema-utils' + +import schema from 'path/to/schema.json' + +class Plugin { + constructor (options) { + validateOptions(schema, options, 'Plugin Name') + + this.options = options + } + + apply (compiler) { + // Code... + } +} +``` + + +[npm]: https://img.shields.io/npm/v/schema-utils.svg +[npm-url]: https://npmjs.com/package/schema-utils + +[node]: https://img.shields.io/node/v/schema-utils.svg +[node-url]: https://nodejs.org + +[deps]: https://david-dm.org/webpack-contrib/schema-utils.svg +[deps-url]: https://david-dm.org/webpack-contrib/schema-utils + +[test]: http://img.shields.io/travis/webpack-contrib/schema-utils.svg +[test-url]: https://travis-ci.org/webpack-contrib/schema-utils + +[cover]: https://codecov.io/gh/webpack-contrib/schema-utils/branch/master/graph/badge.svg +[cover-url]: https://codecov.io/gh/webpack-contrib/schema-utils + +[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg +[chat-url]: https://gitter.im/webpack/webpack diff --git a/node_modules/webpackbar/node_modules/schema-utils/package.json b/node_modules/webpackbar/node_modules/schema-utils/package.json new file mode 100644 index 00000000..621da697 --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/package.json @@ -0,0 +1,41 @@ +{ + "name": "schema-utils", + "version": "1.0.0", + "description": "webpack Validation Utils", + "main": "src/index.js", + "files": [ + "src" + ], + "engines": { + "node": ">= 4" + }, + "scripts": { + "lint": "eslint --cache src test", + "test": "jest --env node --verbose --coverage", + "clean": "del-cli coverage", + "commits": "commitlint --from $(git rev-list --tags --max-count=1)", + "release": "npm run commits && standard-version" + }, + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "devDependencies": { + "@commitlint/cli": "^7.0.0", + "@commitlint/config-conventional": "^7.0.0", + "@webpack-contrib/eslint-config-webpack": "^2.0.0", + "del-cli": "^1.0.0", + "eslint": "^5.0.0", + "eslint-plugin-import": "^2.0.0", + "eslint-plugin-prettier": "^2.0.0", + "jest": "^21.0.0", + "prettier": "^1.0.0", + "standard-version": "^4.0.0" + }, + "author": "webpack Contrib (https://github.com/webpack-contrib)", + "bugs": "https://github.com/webpack-contrib/schema-utils/issues", + "homepage": "https://github.com/webpack-contrib/schema-utils", + "repository": "https://github.com/webpack-contrib/schema-utils", + "license": "MIT" +} diff --git a/node_modules/webpackbar/node_modules/schema-utils/src/ValidationError.js b/node_modules/webpackbar/node_modules/schema-utils/src/ValidationError.js new file mode 100644 index 00000000..0589bf85 --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/src/ValidationError.js @@ -0,0 +1,30 @@ +/* eslint-disable + strict, + no-param-reassign +*/ + +'use strict'; + +class ValidationError extends Error { + constructor(errors, name) { + super(); + + this.name = 'ValidationError'; + + this.message = `${name || ''} Invalid Options\n\n`; + + this.errors = errors.map((err) => { + err.dataPath = err.dataPath.replace(/\//g, '.'); + + return err; + }); + + this.errors.forEach((err) => { + this.message += `options${err.dataPath} ${err.message}\n`; + }); + + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = ValidationError; diff --git a/node_modules/webpackbar/node_modules/schema-utils/src/index.js b/node_modules/webpackbar/node_modules/schema-utils/src/index.js new file mode 100644 index 00000000..13108c21 --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/src/index.js @@ -0,0 +1,9 @@ +/* eslint-disable + strict +*/ + +'use strict'; + +const validateOptions = require('./validateOptions'); + +module.exports = validateOptions; diff --git a/node_modules/webpackbar/node_modules/schema-utils/src/validateOptions.js b/node_modules/webpackbar/node_modules/schema-utils/src/validateOptions.js new file mode 100644 index 00000000..363af447 --- /dev/null +++ b/node_modules/webpackbar/node_modules/schema-utils/src/validateOptions.js @@ -0,0 +1,38 @@ +/* eslint-disable + strict, + no-param-reassign +*/ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +const Ajv = require('ajv'); +const errors = require('ajv-errors'); +const keywords = require('ajv-keywords'); + +const ValidationError = require('./ValidationError'); + +const ajv = new Ajv({ + allErrors: true, + jsonPointers: true, +}); + +errors(ajv); +keywords(ajv, ['instanceof', 'typeof']); + +const validateOptions = (schema, options, name) => { + if (typeof schema === 'string') { + schema = fs.readFileSync(path.resolve(schema), 'utf8'); + schema = JSON.parse(schema); + } + + if (!ajv.validate(schema, options)) { + throw new ValidationError(ajv.errors, name); + } + + return true; +}; + +module.exports = validateOptions; diff --git a/node_modules/webpackbar/package.json b/node_modules/webpackbar/package.json new file mode 100644 index 00000000..407c7c00 --- /dev/null +++ b/node_modules/webpackbar/package.json @@ -0,0 +1,94 @@ +{ + "name": "webpackbar", + "version": "2.6.3", + "description": "Elegant ProgressBar and Profiler for Webpack", + "license": "MIT", + "repository": "nuxt/webpackbar", + "author": "Pooya Parsa ", + "homepage": "https://github.com/nuxt/webpackbar", + "bugs": "https://github.com/nuxt/webpackbar/issues", + "main": "dist/cjs.js", + "engines": { + "node": ">= 6.9.0" + }, + "scripts": { + "start": "npm run build -- -w", + "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js' --copy-files", + "clean": "del-cli dist", + "commitlint": "commitlint", + "commitmsg": "commitlint -e $GIT_PARAMS", + "lint": "eslint --cache src test", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "lint-staged": "lint-staged", + "prebuild": "npm run clean", + "prepublish": "npm run build", + "release": "standard-version", + "release:ci": "conventional-github-releaser -p angular", + "release:validate": "commitlint --from=$(git describe --tags --abbrev=0) --to=$(git rev-parse HEAD)", + "security": "nsp check", + "test": "jest", + "test:watch": "jest --watch", + "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage", + "ci:lint": "npm run lint && npm run security", + "ci:test": "npm run test -- --runInBand", + "ci:coverage": "npm run test:coverage -- --runInBand", + "defaults": "webpack-defaults", + "kitchen-sync": "webpack-cli --config kitchen-sync/webpack.config.js" + }, + "files": [ + "dist" + ], + "peerDependencies": { + "webpack": "^3.0.0 || ^4.0.0" + }, + "dependencies": { + "chalk": "^2.4.1", + "consola": "^1.4.3", + "figures": "^2.0.0", + "loader-utils": "^1.1.0", + "lodash": "^4.17.10", + "log-update": "^2.3.0", + "pretty-time": "^1.1.0", + "schema-utils": "^1.0.0", + "std-env": "^1.3.1", + "table": "^4.0.3" + }, + "devDependencies": { + "@commitlint/cli": "^7.0.0", + "@commitlint/config-angular": "^7.0.1", + "@webpack-contrib/eslint-config-webpack": "^2.0.4", + "babel-cli": "^6.26.0", + "babel-jest": "^23.4.2", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.7.0", + "codecov": "^3.0.4", + "conventional-github-releaser": "^3.1.2", + "cross-env": "^5.2.0", + "del": "^3.0.0", + "del-cli": "^1.1.0", + "eslint": "^5.3.0", + "eslint-config-webpack": "^1.2.5", + "eslint-plugin-import": "^2.13.0", + "eslint-plugin-prettier": "^2.6.2", + "esm": "^3.0.74", + "husky": "^0.14.3", + "jest": "^23.5.0", + "lint-staged": "^7.2.0", + "memory-fs": "^0.4.1", + "nsp": "^3.2.1", + "pre-commit": "^1.2.2", + "prettier": "^1.14.2", + "standard-version": "^4.4.0", + "webpack": "^4.16.5", + "webpack-cli": "^3.1.0", + "webpack-defaults": "^2.3.0" + }, + "pre-commit": "lint-staged", + "lint-staged": { + "*.js": [ + "eslint --fix", + "git add" + ] + } +} -- cgit v1.2.3