Skip to content

Commit ab9c484

Browse files
Bump prettier
1 parent 502488b commit ab9c484

File tree

13 files changed

+107
-107
lines changed

13 files changed

+107
-107
lines changed

README.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
<div><sup><em>(for webpack)</em></sup></div>
66
</h1>
77

8-
<a href="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin"><img src="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin.svg?branch=master" /></a>
9-
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/npm/dw/speed-measure-webpack-plugin.svg" /></a>
10-
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/node/v/speed-measure-webpack-plugin.svg" /></a>
11-
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg" /></a>
8+
<a href="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin"><img src="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin.svg?branch=master" /></a>
9+
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/npm/dw/speed-measure-webpack-plugin.svg" /></a>
10+
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/node/v/speed-measure-webpack-plugin.svg" /></a>
11+
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg" /></a>
12+
1213
</div>
1314
<br>
1415

@@ -40,11 +41,8 @@ Change your webpack config from
4041

4142
```javascript
4243
const webpackConfig = {
43-
plugins: [
44-
new MyPlugin(),
45-
new MyOtherPlugin()
46-
]
47-
}
44+
plugins: [new MyPlugin(), new MyOtherPlugin()],
45+
};
4846
```
4947

5048
to
@@ -55,10 +53,7 @@ const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
5553
const smp = new SpeedMeasurePlugin();
5654

5755
const webpackConfig = smp.wrap({
58-
plugins: [
59-
new MyPlugin(),
60-
new MyOtherPlugin()
61-
]
56+
plugins: [new MyPlugin(), new MyOtherPlugin()],
6257
});
6358
```
6459

@@ -90,18 +85,18 @@ Default: `"human"`
9085

9186
Determines in what format this plugin prints its measurements
9287

93-
* `"json"` - produces a JSON blob
94-
* `"human"` - produces a human readable output
95-
* `"humanVerbose"` - produces a more verbose version of the human readable output
96-
* If a function, it will call the function with the JSON blob, and output the response
88+
- `"json"` - produces a JSON blob
89+
- `"human"` - produces a human readable output
90+
- `"humanVerbose"` - produces a more verbose version of the human readable output
91+
- If a function, it will call the function with the JSON blob, and output the response
9792

9893
### `options.outputTarget`
9994

10095
Type: `String|Function`<br>
10196
Default: `console.log`
10297

103-
* If a string, it specifies the path to a file to output to.
104-
* If a function, it will call the function with the output as the first parameter
98+
- If a string, it specifies the path to a file to output to.
99+
- If a function, it will call the function with the output as the first parameter
105100

106101
### `options.pluginNames`
107102

@@ -116,14 +111,12 @@ takes an object of `pluginName: PluginConstructor`, e.g.
116111
const uglify = new UglifyJSPlugin();
117112
const smp = new SpeedMeasurePlugin({
118113
pluginNames: {
119-
customUglifyName: uglify
120-
}
114+
customUglifyName: uglify,
115+
},
121116
});
122117

123118
const webpackConfig = smp.wrap({
124-
plugins: [
125-
uglify
126-
]
119+
plugins: [uglify],
127120
});
128121
```
129122

@@ -136,12 +129,11 @@ You can configure SMP to include the files that take the most time per loader, w
136129

137130
```javascript
138131
const smp = new SpeedMeasurePlugin({
139-
outputFormat: 'humanVerbose',
140-
loaderTopFiles: 10
132+
outputFormat: "humanVerbose",
133+
loaderTopFiles: 10,
141134
});
142135
```
143136

144-
145137
### `options.granularLoaderData` _(experimental)_
146138

147139
Type: `Boolean`<br>
@@ -151,8 +143,8 @@ By default, SMP measures loaders in groups. If truthy, this plugin will give per
151143

152144
This flag is _experimental_. Some loaders will have inaccurate results:
153145

154-
* loaders using separate processes (e.g. `thread-loader`)
155-
* loaders emitting file output (e.g. `file-loader`)
146+
- loaders using separate processes (e.g. `thread-loader`)
147+
- loaders emitting file output (e.g. `file-loader`)
156148

157149
We will find solutions to these issues before removing the _(experimental)_ flag on this option.
158150

colours.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ module.exports.fg = (text, time) => {
99
return textModifier(text);
1010
};
1111

12-
module.exports.bg = text => chalk.bgBlack.green.bold(text);
12+
module.exports.bg = (text) => chalk.bgBlack.green.bold(text);

index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ module.exports = class SpeedMeasurePlugin {
3838
if (typeof config === "function")
3939
return (...args) => this.wrap(config(...args));
4040

41-
config.plugins = (config.plugins || []).map(plugin => {
41+
config.plugins = (config.plugins || []).map((plugin) => {
4242
const pluginName =
4343
Object.keys(this.options.pluginNames || {}).find(
44-
pluginName => plugin === this.options.pluginNames[pluginName]
44+
(pluginName) => plugin === this.options.pluginNames[pluginName]
4545
) ||
4646
(plugin.constructor && plugin.constructor.name) ||
4747
"(unable to deduce plugin name)";
@@ -50,7 +50,7 @@ module.exports = class SpeedMeasurePlugin {
5050

5151
if (config.optimization && config.optimization.minimizer) {
5252
config.optimization.minimizer = config.optimization.minimizer.map(
53-
plugin => {
53+
(plugin) => {
5454
return new WrappedPlugin(plugin, plugin.constructor.name, this);
5555
}
5656
);
@@ -101,15 +101,15 @@ module.exports = class SpeedMeasurePlugin {
101101
data.start = curTime;
102102
eventList.push(data);
103103
} else if (eventType === "end") {
104-
const matchingEvent = eventList.find(e => {
104+
const matchingEvent = eventList.find((e) => {
105105
const allowOverwrite = !e.end || !data.fillLast;
106106
const idMatch = e.id !== undefined && e.id === data.id;
107107
const nameMatch =
108108
!data.id && e.name !== undefined && e.name === data.name;
109109
return allowOverwrite && (idMatch || nameMatch);
110110
});
111111
const eventToModify =
112-
matchingEvent || (data.fillLast && eventList.find(e => !e.end));
112+
matchingEvent || (data.fillLast && eventList.find((e) => !e.end));
113113
if (!eventToModify) {
114114
console.error(
115115
"Could not find a matching event to end",
@@ -155,12 +155,12 @@ module.exports = class SpeedMeasurePlugin {
155155
this.timeEventData = {};
156156
});
157157

158-
tap(compiler, "compilation", compilation => {
159-
tap(compilation, "normal-module-loader", loaderContext => {
158+
tap(compiler, "compilation", (compilation) => {
159+
tap(compilation, "normal-module-loader", (loaderContext) => {
160160
loaderContext[NS] = this.provideLoaderTiming;
161161
});
162162

163-
tap(compilation, "build-module", module => {
163+
tap(compilation, "build-module", (module) => {
164164
const name = getModuleName(module);
165165
if (name) {
166166
this.addTimeEvent("loaders", "build", "start", {
@@ -171,7 +171,7 @@ module.exports = class SpeedMeasurePlugin {
171171
}
172172
});
173173

174-
tap(compilation, "succeed-module", module => {
174+
tap(compilation, "succeed-module", (module) => {
175175
const name = getModuleName(module);
176176
if (name) {
177177
this.addTimeEvent("loaders", "build", "end", {

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
testPathIgnorePatterns: ["__tests__"],
33
testURL: "http://localhost",
4-
}
4+
};

lerna.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"lerna": "2.9.0",
3-
"packages": [
4-
"__tests__/setups/*"
5-
],
3+
"packages": ["__tests__/setups/*"],
64
"version": "0.0.0"
75
}

loader.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ let id = 0;
66

77
const NS = path.dirname(fs.realpathSync(__filename));
88

9-
const getLoaderName = path => {
9+
const getLoaderName = (path) => {
1010
const standardPath = path.replace(/\\/g, "/");
1111
const nodeModuleName = /\/node_modules\/([^\/]+)/.exec(standardPath);
1212
return (nodeModuleName && nodeModuleName[1]) || "";
1313
};
1414

15-
module.exports.pitch = function() {
15+
module.exports.pitch = function () {
1616
const callback = this[NS];
1717
const module = this.resourcePath;
1818
const loaderPaths = this.loaders
19-
.map(l => l.path)
20-
.filter(l => !l.includes("speed-measure-webpack-plugin"));
19+
.map((l) => l.path)
20+
.filter((l) => !l.includes("speed-measure-webpack-plugin"));
2121

2222
// Hack ourselves to overwrite the `require` method so we can override the
2323
// loadLoaders
2424
hackWrapLoaders(loaderPaths, (loader, path) => {
2525
const loaderName = getLoaderName(path);
26-
const wrapFunc = func =>
27-
function() {
26+
const wrapFunc = (func) =>
27+
function () {
2828
const loaderId = id++;
2929
const almostThis = Object.assign({}, this, {
30-
async: function() {
30+
async: function () {
3131
const asyncCallback = this.async.apply(this, arguments);
3232

33-
return function() {
33+
return function () {
3434
callback({
3535
id: loaderId,
3636
type: "end",

migration.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,38 @@ SMP follows [semver](https://semver.org/). This guide should help with upgrading
66

77
### If Using Static Constructor
88

9-
If you're using the `SpeedMeasurePlugin.wrapPlugins(plugins, options)` static method, then
9+
If you're using the `SpeedMeasurePlugin.wrapPlugins(plugins, options)` static method, then
1010

11-
* remove all `.wrapPlugins` calls
12-
* instantiate an `smp`
13-
* call `smp.wrap` on your entire config
11+
- remove all `.wrapPlugins` calls
12+
- instantiate an `smp`
13+
- call `smp.wrap` on your entire config
1414

1515
e.g.
1616

1717
```javascript
1818
// v0
1919
const webpackConfig = {
20-
plugins: SpeedMeasurePlugin.wrapPlugins({
21-
FooPlugin: new FooPlugin()
22-
}, smpOptions)
20+
plugins: SpeedMeasurePlugin.wrapPlugins(
21+
{
22+
FooPlugin: new FooPlugin(),
23+
},
24+
smpOptions
25+
),
2326
};
2427

2528
// v1
2629
const smp = new SpeedMeasurePlugin(smpOptions);
2730
const webpackConfig = smp.wrap({
28-
plugins: [new FooPlugin()]
31+
plugins: [new FooPlugin()],
2932
});
3033
```
3134

3235
### If Using `smp` Instance
3336

3437
If you're using the `smp.wrapPlugins(plugins)` method, then
3538

36-
* remove all `.wrapPlugins` calls
37-
* call `smp.wrap` on your entire config
39+
- remove all `.wrapPlugins` calls
40+
- call `smp.wrap` on your entire config
3841

3942
e.g.
4043

@@ -43,14 +46,14 @@ e.g.
4346
const smp = new SpeedMeasurePlugin(smpOptions);
4447
const webpackConfig = {
4548
plugins: smp.wrapPlugins({
46-
FooPlugin: new FooPlugin()
47-
})
49+
FooPlugin: new FooPlugin(),
50+
}),
4851
};
4952

5053
// v1
5154
const smp = new SpeedMeasurePlugin(smpOptions);
5255
const webpackConfig = smp.wrap({
53-
plugins: [new FooPlugin()]
56+
plugins: [new FooPlugin()],
5457
});
5558
```
5659

@@ -62,10 +65,10 @@ v1 no longer requires you to manually enter each plugin name. If you want to kee
6265
const fooPlugin = new FooPlugin();
6366
const smp = new SpeedMeasurePlugin({
6467
pluginNames: {
65-
customFooPluginName: fooPlugin
66-
}
68+
customFooPluginName: fooPlugin,
69+
},
6770
});
6871
const webpackConfig = smp.wrap({
69-
plugins: [fooPlugin]
72+
plugins: [fooPlugin],
7073
});
7174
```

neutrino.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const SpeedMeasurePlugin = require(".");
22
const smp = new SpeedMeasurePlugin();
33

4-
module.exports = neutrino => {
4+
module.exports = (neutrino) => {
55
const origConfig = neutrino.config;
66
const wrappedConfig = smp.wrap(origConfig.toConfig());
77
neutrino.config = new Proxy(origConfig, {

0 commit comments

Comments
 (0)