Skip to content

Commit f107249

Browse files
Merge branch 'release/1.3.2'
2 parents 7212dca + 478171f commit f107249

4 files changed

Lines changed: 32 additions & 8 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ This flag is _experimental_. Some loaders will have inaccurate results:
141141

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

144+
## FAQ
145+
146+
### What does general output time mean?
147+
148+
This tends to be down to webpack reading in from the file-system, but in general it's anything outside of what SMP can actually measure.
149+
150+
### What does modules without loaders mean?
151+
152+
It means vanilla JS files, which webpack can handle out of the box.
153+
144154
## Contributing
145155

146156
Contributors are welcome! 😊

WrappedPlugin/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,16 @@ const construcNamesToWrap = [
164164
];
165165

166166
const wrappedObjs = [];
167-
const wrap = (orig, pluginName, smp, addEndEvent) => {
168-
if (!orig) return orig;
167+
const findWrappedObj = (orig, pluginName) => {
169168
const prevWrapped = wrappedObjs.find(
170169
w => w.pluginName === pluginName && (w.orig === orig || w.wrapped === orig)
171170
);
172171
if (prevWrapped) return prevWrapped.wrapped;
172+
};
173+
const wrap = (orig, pluginName, smp, addEndEvent) => {
174+
if (!orig) return orig;
175+
const prevWrapped = findWrappedObj(orig, pluginName);
176+
if (prevWrapped) return prevWrapped;
173177

174178
const getOrigConstrucName = target =>
175179
target && target.constructor && target.constructor.name;
@@ -217,6 +221,13 @@ const wrap = (orig, pluginName, smp, addEndEvent) => {
217221
getOrigConstrucName(target)
218222
);
219223

224+
if (shouldWrap && property === "compiler") {
225+
const prevWrapped = findWrappedObj(raw, pluginName);
226+
if (prevWrapped) {
227+
return prevWrapped;
228+
}
229+
}
230+
220231
if (typeof raw === "function") {
221232
const ret = raw.bind(proxy);
222233
if (property === "constructor")

loader.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ let id = 0;
77
const NS = path.dirname(fs.realpathSync(__filename));
88

99
const getLoaderName = path => {
10-
const nodeModuleName = /\/node_modules\/([^\/]+)/.exec(path);
10+
const standardPath = path.replace(/\\/g, "/");
11+
const nodeModuleName = /\/node_modules\/([^\/]+)/.exec(standardPath);
1112
return (nodeModuleName && nodeModuleName[1]) || "";
1213
};
1314

@@ -36,7 +37,7 @@ module.exports.pitch = function() {
3637
});
3738
return asyncCallback.apply(this, arguments);
3839
};
39-
}.bind(this)
40+
}.bind(this),
4041
});
4142

4243
callback({

utils.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ module.exports.getLoaderNames = loaders =>
5151
? loaders
5252
.map(l => l.loader || l)
5353
.map(l =>
54-
l.replace(
55-
/^.*\/node_modules\/(@[a-z0-9][\w-.]+\/[a-z0-9][\w-.]*|[^\/]+).*$/,
56-
(_, m) => m
57-
)
54+
l
55+
.replace(/\\/g, "/")
56+
.replace(
57+
/^.*\/node_modules\/(@[a-z0-9][\w-.]+\/[a-z0-9][\w-.]*|[^\/]+).*$/,
58+
(_, m) => m
59+
)
5860
)
5961
.filter(l => !l.includes("speed-measure-webpack-plugin"))
6062
: ["modules with no loaders"];

0 commit comments

Comments
 (0)