first
This commit is contained in:
9
node_modules/progress-webpack-plugin/.editorconfig
generated
vendored
Normal file
9
node_modules/progress-webpack-plugin/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# editorconfig.org
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
14
node_modules/progress-webpack-plugin/.eslintrc
generated
vendored
Normal file
14
node_modules/progress-webpack-plugin/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"extends": "standard",
|
||||
"rules": {
|
||||
"eol-last": "off",
|
||||
"import/no-dynamic-require": "off",
|
||||
"space-before-function-paren":"off"
|
||||
}
|
||||
}
|
5
node_modules/progress-webpack-plugin/.travis.yml
generated
vendored
Normal file
5
node_modules/progress-webpack-plugin/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "8.10.0"
|
||||
env:
|
||||
- NODE_ENV:test
|
43
node_modules/progress-webpack-plugin/README.md
generated
vendored
Normal file
43
node_modules/progress-webpack-plugin/README.md
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
progress-webpack-plugin [](https://badge.fury.io/js/progress-webpack-plugin)
|
||||
===
|
||||
[](https://nodei.co/npm/progress-webpack-plugin/)
|
||||
|
||||
inspired by [progress-bar-webpack-plugin](https://github.com/clessg/progress-bar-webpack-plugin),simple Webpack plugin that display nice progress when build
|
||||
|
||||
Install
|
||||
===
|
||||
|
||||
```javascript
|
||||
npm install progress-webpack-plugin --save--dev
|
||||
```
|
||||
|
||||
Usage
|
||||
===
|
||||
|
||||
add plugin in your webpack.config.js
|
||||
|
||||
```javascript
|
||||
var ProgressPlugin = require('progress-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
...
|
||||
plugins:[
|
||||
new ProgressPlugin(true)
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Plugin Options
|
||||
===
|
||||
|
||||
- **minimal**: enable minimal mode or not,default value is false
|
||||
- **identifier**: identifier of webpack bundle
|
||||
- **onStart**: callback function when webpack bundler started
|
||||
- **onFinish**: callback function when webpack bundler finished
|
||||
- **onProgress**: callback function when webpack bundler running
|
||||
- **clear**: whether clear console when webpack bundler finished
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
|
139
node_modules/progress-webpack-plugin/index.js
generated
vendored
Normal file
139
node_modules/progress-webpack-plugin/index.js
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
let chalk = require('chalk')
|
||||
let ProgressPlugin = require('webpack/lib/ProgressPlugin')
|
||||
let log = require('log-update')
|
||||
let path = require('path')
|
||||
|
||||
const thresholder = 0.99
|
||||
|
||||
function now() {
|
||||
return new Date().toTimeString().split(' ')[0]
|
||||
}
|
||||
|
||||
function isEqual(arr1, arr2) {
|
||||
let equal = arr1.length === arr2.length
|
||||
for (let i = 0; i < arr1.length; i++) {
|
||||
if (arr1[i] !== arr2[i]) {
|
||||
equal = false
|
||||
break
|
||||
}
|
||||
}
|
||||
return equal
|
||||
}
|
||||
|
||||
class Progress {
|
||||
constructor(options) {
|
||||
this.delegate = new ProgressPlugin(options)
|
||||
}
|
||||
apply(compiler) {
|
||||
this.delegate.apply(compiler)
|
||||
let invalid = () => {
|
||||
console.log(chalk.white('Compiling...'))
|
||||
}
|
||||
if (compiler.hooks) {
|
||||
compiler.hooks.invalid.tap('ProgressWebpckPlugin', invalid)
|
||||
} else {
|
||||
compiler.plugin('invalid', invalid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function progressPlugin(options = {}) {
|
||||
let identifier = options.identifier || ''
|
||||
let id = identifier && identifier + ' '
|
||||
let onStart = options.onStart || (() => {})
|
||||
let onFinish = options.onFinish
|
||||
let onProgress = options.onProgress
|
||||
let coloring = onProgress === undefined
|
||||
let clear = typeof options.clear === 'boolean' ? options.clear : true
|
||||
let startTime
|
||||
let finishTime
|
||||
let duration
|
||||
|
||||
let prev = {}
|
||||
const handler = (percentage, message, ...args) => {
|
||||
startTime = Date.now()
|
||||
let output = []
|
||||
if (percentage > thresholder) {
|
||||
return
|
||||
}
|
||||
if (percentage === 0) onStart()
|
||||
if (percentage > 0 && percentage < thresholder) {
|
||||
if (message === '') return
|
||||
if (
|
||||
prev.percentage === percentage &&
|
||||
prev.message === message &&
|
||||
isEqual(prev.args, args)
|
||||
) {
|
||||
return
|
||||
}
|
||||
prev = { percentage, message, args }
|
||||
const banner = `[${Math.round(percentage * 100)}%] `
|
||||
output.push(coloring ? chalk.yellow(banner) : banner)
|
||||
output.push(
|
||||
coloring ? chalk.white(`${message} ${id}`) : `${message} ${id}`
|
||||
)
|
||||
if (args.length > 0) {
|
||||
let details = args.join(' ')
|
||||
if (
|
||||
/^\d+\/\d+\s{1}modules/.test(args[0]) === true &&
|
||||
args.length === 2
|
||||
) {
|
||||
const rootPath = path.resolve('.')
|
||||
details = [args[0]].concat([args[1].replace(rootPath, '')]).join(' ')
|
||||
}
|
||||
if (/^import\s{1}loader/.test(args[0]) === true && args.length === 1) {
|
||||
const matches = args[0].match(
|
||||
/^import\s{1}loader\s{1}(.+\/node_modules\/)/
|
||||
)
|
||||
if (matches) {
|
||||
details = args[0].replace(matches[1], '')
|
||||
}
|
||||
}
|
||||
output.push(coloring ? chalk.grey(`(${details})`) : `(${details})`)
|
||||
}
|
||||
}
|
||||
|
||||
// // 5. finished
|
||||
if (percentage === thresholder) {
|
||||
finishTime = Date.now()
|
||||
duration = (finishTime - startTime) / 1000
|
||||
duration = duration.toFixed(3)
|
||||
|
||||
if (typeof onFinish === 'function') {
|
||||
onFinish(id, now(), duration)
|
||||
} else {
|
||||
output.push(
|
||||
coloring
|
||||
? chalk.white(`Build ${id}finished at ${now()} by ${duration}s`)
|
||||
: `Build ${id}finished at ${now()} by ${duration}s`
|
||||
)
|
||||
}
|
||||
}
|
||||
if (onProgress) {
|
||||
if (percentage > 0 && percentage < thresholder) {
|
||||
onProgress(output, percentage)
|
||||
}
|
||||
} else {
|
||||
log(output.join(''))
|
||||
if (percentage === thresholder) {
|
||||
if (clear) {
|
||||
log.clear()
|
||||
} else {
|
||||
log.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Progress({
|
||||
handler,
|
||||
entries: false,
|
||||
activeModules: false,
|
||||
modules: true,
|
||||
modulesCount: 5000,
|
||||
dependencies: false,
|
||||
dependenciesCount: 10000,
|
||||
percentBy: 'entries'
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = progressPlugin
|
15
node_modules/progress-webpack-plugin/node_modules/.bin/webpack
generated
vendored
Normal file
15
node_modules/progress-webpack-plugin/node_modules/.bin/webpack
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../../../webpack/bin/webpack.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../../../webpack/bin/webpack.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/progress-webpack-plugin/node_modules/.bin/webpack.cmd
generated
vendored
Normal file
7
node_modules/progress-webpack-plugin/node_modules/.bin/webpack.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\..\..\webpack\bin\webpack.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\..\..\webpack\bin\webpack.js" %*
|
||||
)
|
70
node_modules/progress-webpack-plugin/package.json
generated
vendored
Normal file
70
node_modules/progress-webpack-plugin/package.json
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "progress-webpack-plugin@^1.0.12",
|
||||
"_id": "progress-webpack-plugin@1.0.16",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-sdiHuuKOzELcBANHfrupYo+r99iPRyOnw15qX+rNlVUqXGfjXdH4IgxriKwG1kNJwVswKQHMdj1hYZMcb9jFaA==",
|
||||
"_location": "/progress-webpack-plugin",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "progress-webpack-plugin@^1.0.12",
|
||||
"name": "progress-webpack-plugin",
|
||||
"escapedName": "progress-webpack-plugin",
|
||||
"rawSpec": "^1.0.12",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.12"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/cli-service"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/progress-webpack-plugin/-/progress-webpack-plugin-1.0.16.tgz",
|
||||
"_shasum": "278f5c1afd21af783aad72c5ec95241520230fe5",
|
||||
"_spec": "progress-webpack-plugin@^1.0.12",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\@vue\\cli-service",
|
||||
"author": {
|
||||
"name": "alichen"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ali322/progress-webpack-plugin/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"chalk": "^2.1.0",
|
||||
"figures": "^2.0.0",
|
||||
"log-update": "^2.3.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "progress webpack plugin",
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
"eslint": "^8.12.0",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-node": "^6.0.1",
|
||||
"eslint-plugin-promise": "^3.7.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"mocha": "^9.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"homepage": "https://github.com/ali322/progress-webpack-plugin#readme",
|
||||
"keywords": [
|
||||
"progress"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "progress-webpack-plugin",
|
||||
"peerDependencies": {
|
||||
"webpack": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ali322/progress-webpack-plugin.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test"
|
||||
},
|
||||
"version": "1.0.16"
|
||||
}
|
1
node_modules/progress-webpack-plugin/test/dist/main.min.js
generated
vendored
Normal file
1
node_modules/progress-webpack-plugin/test/dist/main.min.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
console.log("hello world");
|
1
node_modules/progress-webpack-plugin/test/fixture/entry.js
generated
vendored
Normal file
1
node_modules/progress-webpack-plugin/test/fixture/entry.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
console.log('hello world')
|
32
node_modules/progress-webpack-plugin/test/index.spec.js
generated
vendored
Normal file
32
node_modules/progress-webpack-plugin/test/index.spec.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
let webpack = require('webpack')
|
||||
let expect = require('chai').expect
|
||||
let path = require('path')
|
||||
let ProgressPlugin = require('../')
|
||||
|
||||
const OUTPUT_PATH = path.join(__dirname, 'dist')
|
||||
|
||||
describe('Progress Plugin', () => {
|
||||
it('should output correctly', done => {
|
||||
let compiler = webpack(
|
||||
{
|
||||
entry: {
|
||||
main: path.join(__dirname, 'fixture', 'entry.js')
|
||||
},
|
||||
mode: 'production',
|
||||
output: {
|
||||
path: OUTPUT_PATH,
|
||||
filename: '[name].min.js'
|
||||
},
|
||||
plugins: [
|
||||
new ProgressPlugin({
|
||||
identifier: 'test'
|
||||
})
|
||||
]
|
||||
},
|
||||
(err, stats) => {
|
||||
expect(err).to.equal(null)
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user