This repository has been archived by the owner on Sep 11, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* refactor: moving around reporter * feat: add support for --progress * chore: update dependencies * test: update test snapshots * fix: fix typo in progress flag * docs: add documentation for reporter progress * feat: add progress to BasicReporter * test: update test snapshot * chore: add nsprc to bypass https://nodesecurity.io/advisories/612 * test: add Reporter class tests * test: add distill plugin tests * test: add more reporter tests * test: add progress util tests * test: temporarily ignore basic, stylish progress methods * test: update progress and reporter tests * test: improve command tests * fix: change grey to dim for chalk
- Loading branch information
1 parent
5c579ec
commit ca36c75
Showing
27 changed files
with
940 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"exceptions": ["https://nodesecurity.io/advisories/612"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const webpack = require('webpack'); | ||
|
||
const { ProgressPlugin } = webpack; | ||
|
||
function parseArgs(profile, ...args) { | ||
// args is an unorganized set of parameters. | ||
// e.g. building modules|5/6 modules|1 active|/node_modules/lodash/lodash.js | ||
// building modules|14/14 modules|0 active| | ||
// finish module graph | ||
// finish module graph|FlagDependencyExportsPlugin | ||
const [value, , counts, index, fileName] = args; | ||
const [, modulePos, totalModules] = ( | ||
(counts || '').match(/(\d+)\/(\d+)/) || [] | ||
).map((match) => parseInt(match, 10)); | ||
const [, indexNumber, indexState] = (index || '').match(/(\d+)\s(.+)/) || []; | ||
const percentage = parseFloat(value); | ||
const [, stepName] = args; | ||
let scope; | ||
let empty; | ||
|
||
// we've got a step with a scope on our hands | ||
// e.g. finish module graph|FlagDependencyExportsPlugin | ||
if (args.length === 3) { | ||
scope = counts; | ||
} | ||
|
||
const result = { | ||
profile, | ||
fileName, | ||
scope, | ||
step: { | ||
index: parseInt(indexNumber, 10) || empty, | ||
modulePosition: modulePos || empty, | ||
name: stepName, | ||
percentage: percentage || empty, | ||
state: indexState, | ||
totalModules: totalModules || empty, | ||
}, | ||
}; | ||
|
||
return result; | ||
} | ||
|
||
module.exports = { | ||
apply(config, compiler, reporter) { | ||
const { profile } = config; | ||
const opts = { profile }; | ||
|
||
if (reporter.progress) { | ||
opts.handler = (...args) => { | ||
const data = parseArgs(profile, ...args); | ||
reporter.progress(data); | ||
}; | ||
} | ||
|
||
const plugin = new ProgressPlugin(opts); | ||
plugin.apply(compiler); | ||
}, | ||
|
||
parseArgs, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.