Skip to content

Commit f63045c

Browse files
committed
Pass all attributes of old tap with only overidden fn
1 parent 2279c5a commit f63045c

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

lib/debug/ProfilingPlugin.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ const interceptAllJavascriptModulesPluginHooks = (compilation, tracer) => {
343343
};
344344

345345
const makeInterceptorFor = (instance, tracer) => hookName => ({
346-
register: ({ name, type, context, fn }) => {
346+
register: tapInfo => {
347+
const { name, type, fn } = tapInfo;
347348
const newFn =
348349
// Don't tap our own hooks to ensure stream can close cleanly
349350
name === pluginName
@@ -354,9 +355,7 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({
354355
fn
355356
});
356357
return {
357-
name,
358-
type,
359-
context,
358+
...tapInfo,
360359
fn: newFn
361360
};
362361
}

test/ProfilingPlugin.test.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe("Profiling Plugin", function () {
1313
const webpack = require("../");
1414
const outputPath = path.join(__dirname, "js/profilingPath");
1515
const finalPath = path.join(outputPath, "events.json");
16+
let counter = 0;
1617
rimraf(outputPath, () => {
1718
const startTime = process.hrtime();
1819
const compiler = webpack({
@@ -24,7 +25,27 @@ describe("Profiling Plugin", function () {
2425
plugins: [
2526
new webpack.debug.ProfilingPlugin({
2627
outputPath: finalPath
27-
})
28+
}),
29+
{
30+
apply(compiler) {
31+
const hook = compiler.hooks.make;
32+
[
33+
{ stage: 0, order: 1 },
34+
{ stage: 1, order: 2 },
35+
{ stage: -1, order: 0 }
36+
].forEach(({ stage, order }) => {
37+
hook.tap(
38+
{
39+
name: "RespectStageCheckerPlugin",
40+
stage
41+
},
42+
() => {
43+
expect(counter++).toBe(order);
44+
}
45+
);
46+
});
47+
}
48+
}
2849
],
2950
experiments: {
3051
backCompat: false

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy