Skip to content

Commit f55547c

Browse files
committed
Merge branch 'master' into next
# Conflicts: # lib/Compiler.js
2 parents aee2cc6 + 885e9ee commit f55547c

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

lib/optimize/ConcatenatedModule.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
const Module = require("../Module");
88
const Template = require("../Template");
99
const Parser = require("../Parser");
10+
const crypto = require("crypto");
1011
const acorn = require("acorn");
1112
const escope = require("escope");
1213
const ReplaceSource = require("webpack-sources").ReplaceSource;
@@ -221,6 +222,7 @@ class ConcatenatedModule extends Module {
221222
}
222223
}
223224
}
225+
this._identifier = this._createIdentifier();
224226
}
225227

226228
get modules() {
@@ -230,12 +232,7 @@ class ConcatenatedModule extends Module {
230232
}
231233

232234
identifier() {
233-
return this._orderedConcatenationList.map(info => {
234-
switch(info.type) {
235-
case "concatenated":
236-
return info.module.identifier();
237-
}
238-
}).filter(Boolean).join(" ");
235+
return this._identifier;
239236
}
240237

241238
readableIdentifier(requestShortener) {
@@ -311,6 +308,18 @@ class ConcatenatedModule extends Module {
311308
return list;
312309
}
313310

311+
_createIdentifier() {
312+
const orderedConcatenationListIdentifiers = this._orderedConcatenationList.map(info => {
313+
switch(info.type) {
314+
case "concatenated":
315+
return info.module.identifier();
316+
}
317+
}).filter(Boolean).join(" ");
318+
const hash = crypto.createHash("md5");
319+
hash.update(orderedConcatenationListIdentifiers);
320+
return this.rootModule.identifier() + " " + hash.digest("hex");
321+
}
322+
314323
source(dependencyTemplates, outputOptions, requestShortener) {
315324
// Metainfo for each module
316325
const modulesWithInfo = this._orderedConcatenationList.map((info, idx) => {

test/Compiler.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ describe("Compiler", () => {
178178
});
179179
});
180180
describe("parser", () => {
181+
describe("plugin", () => {
182+
it("invokes sets a 'compilation' plugin", (done) => {
183+
compiler.plugin = sinon.spy();
184+
compiler.parser.plugin();
185+
compiler.plugin.callCount.should.be.exactly(1);
186+
done();
187+
});
188+
});
181189
describe("apply", () => {
182190
it("invokes sets a 'compilation' plugin", (done) => {
183191
compiler.plugin = sinon.spy();

0 commit comments

Comments
 (0)