Skip to content

Commit 5c3034e

Browse files
Add an explicit dependency on a node engine version to match webpack v4's similar dependency
1 parent 54d71d2 commit 5c3034e

4 files changed

Lines changed: 27 additions & 31 deletions

File tree

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
**_(this plugin is not yet stable, and not safe for production)_**
44

5-
**_(so far tested only with webpack@3.10.0, node@8.9.4)_**
6-
75
This plugin measures your webpack build speed, giving an output like this:
86

97
```

index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ module.exports = class SpeedMeasurePlugin {
2424

2525
if (Array.isArray(plugins)) {
2626
let i = 1;
27-
plugins = plugins.reduce((acc, p) => ({
28-
...acc,
29-
["plugin " + i++]: p,
30-
}));
27+
plugins = plugins.reduce((acc, p) => {
28+
acc["plugin " + i++] = p;
29+
return acc;
30+
});
3131
}
3232
plugins = plugins || {};
3333

@@ -60,10 +60,8 @@ module.exports = class SpeedMeasurePlugin {
6060
const curTime = new Date().getTime();
6161

6262
if (eventType === "start") {
63-
eventList.push({
64-
start: curTime,
65-
...data,
66-
});
63+
data.start = curTime;
64+
eventList.push(data);
6765
} else if (eventType === "end") {
6866
const matchingEvent = eventList.find(
6967
e => !e.end && (e.id === data.id || e.name === data.name)

output.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,31 @@ module.exports.getMiscOutput = data => ({
6565
});
6666

6767
module.exports.getPluginsOutput = data =>
68-
Object.values(data).reduce((acc, inData) => {
68+
Object.keys(data).reduce((acc, key) => {
69+
const inData = data[key];
6970
const startEndsByName = groupBy("name", inData);
7071

71-
return startEndsByName.reduce(
72-
(innerAcc, startEnds) => ({
73-
...innerAcc,
74-
[startEnds[0].name]:
75-
(innerAcc[startEnds[0].name] || 0) + getTotalActiveTime(startEnds),
76-
}),
77-
acc
78-
);
72+
return startEndsByName.reduce((innerAcc, startEnds) => {
73+
innerAcc[startEnds[0].name] =
74+
(innerAcc[startEnds[0].name] || 0) + getTotalActiveTime(startEnds);
75+
return innerAcc;
76+
}, acc);
7977
}, {});
8078

8179
module.exports.getLoadersOutput = data =>
8280
Object.keys(data).reduce((acc, key) => {
8381
const startEndsByLoader = groupBy("loaders", data[key]);
8482

85-
return {
86-
...acc,
87-
[key]: startEndsByLoader.map(startEnds => {
88-
const averages = getAverages(startEnds);
89-
const activeTime = getTotalActiveTime(startEnds);
83+
acc[key] = startEndsByLoader.map(startEnds => {
84+
const averages = getAverages(startEnds);
85+
const activeTime = getTotalActiveTime(startEnds);
86+
87+
return {
88+
averages,
89+
activeTime,
90+
loaders: startEnds[0].loaders,
91+
};
92+
});
9093

91-
return {
92-
averages,
93-
activeTime,
94-
loaders: startEnds[0].loaders,
95-
};
96-
}),
97-
};
94+
return acc;
9895
}, {});

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"url": "https://github.com/stephencookdev/speed-measure-webpack-plugin/issues"
1717
},
1818
"homepage": "https://github.com/stephencookdev/speed-measure-webpack-plugin#readme",
19+
"engines": {
20+
"node": ">=6.11.5"
21+
},
1922
"peerDependencies": {
2023
"webpack": "^3"
2124
},

0 commit comments

Comments
 (0)