Skip to content

Commit f737b26

Browse files
committed
Remove some plugin calls
1 parent 8bc82da commit f737b26

31 files changed

+95
-74
lines changed

lib/ContextExclusionPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ContextExclusionPlugin {
77

88
apply(compiler) {
99
compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", (cmf) => {
10-
cmf.plugin("context-module-files", (files) => {
10+
cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", (files) => {
1111
return files.filter(filePath => !this.negativeMatcher.test(filePath));
1212
});
1313
});

lib/ContextReplacementPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ContextReplacementPlugin {
4646
const newContentCreateContextMap = this.newContentCreateContextMap;
4747

4848
compiler.hooks.contextModuleFactory.tap("ContextReplacementPlugin", (cmf) => {
49-
cmf.plugin("before-resolve", (result, callback) => {
49+
cmf.hooks.beforeResolve.tapAsync("ContextReplacementPlugin", (result, callback) => {
5050
if(!result) return callback();
5151
if(resourceRegExp.test(result.request)) {
5252
if(typeof newContentResource !== "undefined")
@@ -66,7 +66,7 @@ class ContextReplacementPlugin {
6666
}
6767
return callback(null, result);
6868
});
69-
cmf.plugin("after-resolve", (result, callback) => {
69+
cmf.hooks.afterResolve.tapAsync("ContextReplacementPlugin", (result, callback) => {
7070
if(!result) return callback();
7171
if(resourceRegExp.test(result.resource)) {
7272
if(typeof newContentResource !== "undefined")

lib/DelegatedModuleFactoryPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DelegatedModuleFactoryPlugin {
2121
apply(normalModuleFactory) {
2222
const scope = this.options.scope;
2323
if(scope) {
24-
normalModuleFactory.plugin("factory", factory => (data, callback) => {
24+
normalModuleFactory.hooks.factory.tap("DelegatedModuleFactoryPlugin", factory => (data, callback) => {
2525
const dependency = data.dependencies[0];
2626
const request = dependency.request;
2727
if(request && request.indexOf(scope + "/") === 0) {
@@ -43,7 +43,7 @@ class DelegatedModuleFactoryPlugin {
4343
return factory(data, callback);
4444
});
4545
} else {
46-
normalModuleFactory.plugin("module", module => {
46+
normalModuleFactory.hooks.module.tap("DelegatedModuleFactoryPlugin", module => {
4747
if(module.libIdent) {
4848
const request = module.libIdent(this.options);
4949
if(request && request in this.options.content) {

lib/EvalDevToolModuleTemplatePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class EvalDevToolModuleTemplatePlugin {
1616
}
1717

1818
apply(moduleTemplate) {
19-
moduleTemplate.plugin("module", (source, module) => {
19+
moduleTemplate.hooks.module.tap("EvalDevToolModuleTemplatePlugin", (source, module) => {
2020
const cacheEntry = cache.get(source);
2121
if(cacheEntry !== undefined) return cacheEntry;
2222
const content = source.source();
@@ -32,7 +32,7 @@ class EvalDevToolModuleTemplatePlugin {
3232
cache.set(source, result);
3333
return result;
3434
});
35-
moduleTemplate.plugin("hash", hash => {
35+
moduleTemplate.hooks.hash.tap("EvalDevToolModuleTemplatePlugin", hash => {
3636
hash.update("EvalDevToolModuleTemplatePlugin");
3737
hash.update("2");
3838
});

lib/EvalSourceMapDevToolModuleTemplatePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class EvalSourceMapDevToolModuleTemplatePlugin {
1919
apply(moduleTemplate) {
2020
const self = this;
2121
const options = this.options;
22-
moduleTemplate.plugin("module", (source, module) => {
22+
moduleTemplate.hooks.module.tap("EvalSourceMapDevToolModuleTemplatePlugin", (source, module) => {
2323
if(source.__EvalSourceMapDevToolData)
2424
return source.__EvalSourceMapDevToolData;
2525
let sourceMap;
@@ -70,7 +70,7 @@ class EvalSourceMapDevToolModuleTemplatePlugin {
7070
source.__EvalSourceMapDevToolData = new RawSource(`eval(${JSON.stringify(content + footer)});`);
7171
return source.__EvalSourceMapDevToolData;
7272
});
73-
moduleTemplate.plugin("hash", hash => {
73+
moduleTemplate.hooks.hash.tap("EvalSourceMapDevToolModuleTemplatePlugin", hash => {
7474
hash.update("eval-source-map");
7575
hash.update("2");
7676
});

lib/ExportPropertyMainTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ExportPropertyMainTemplatePlugin {
2121
const postfix = `${accessorToObjectAccess([].concat(this.property))}`;
2222
return new ConcatSource(source, postfix);
2323
});
24-
mainTemplate.plugin("hash", hash => {
24+
mainTemplate.hooks.hash.tap("ExportPropertyMainTemplatePlugin", hash => {
2525
hash.update("export property");
2626
hash.update(`${this.property}`);
2727
});

lib/ExternalModuleFactoryPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ExternalModuleFactoryPlugin {
1414

1515
apply(normalModuleFactory) {
1616
const globalType = this.type;
17-
normalModuleFactory.plugin("factory", factory => (data, callback) => {
17+
normalModuleFactory.hooks.factory.tap("ExternalModuleFactoryPlugin", factory => (data, callback) => {
1818
const context = data.context;
1919
const dependency = data.dependencies[0];
2020

lib/FunctionModuleTemplatePlugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Template = require("./Template");
99

1010
class FunctionModuleTemplatePlugin {
1111
apply(moduleTemplate) {
12-
moduleTemplate.plugin("render", (moduleSource, module) => {
12+
moduleTemplate.hooks.render.tap("FunctionModuleTemplatePlugin", (moduleSource, module) => {
1313
const source = new ConcatSource();
1414
const args = [module.moduleArgument];
1515
// TODO remove HACK checking type for javascript
@@ -30,7 +30,7 @@ class FunctionModuleTemplatePlugin {
3030
return source;
3131
});
3232

33-
moduleTemplate.plugin("package", (moduleSource, module) => {
33+
moduleTemplate.hooks.package.tap("FunctionModuleTemplatePlugin", (moduleSource, module) => {
3434
if(moduleTemplate.runtimeTemplate.outputOptions.pathinfo) {
3535
const source = new ConcatSource();
3636
const req = module.readableIdentifier(moduleTemplate.runtimeTemplate.requestShortener);
@@ -61,7 +61,7 @@ class FunctionModuleTemplatePlugin {
6161
return moduleSource;
6262
});
6363

64-
moduleTemplate.plugin("hash", hash => {
64+
moduleTemplate.hooks.hash.tap("FunctionModuleTemplatePlugin", hash => {
6565
hash.update("FunctionModuleTemplatePlugin");
6666
hash.update("2");
6767
});

lib/IgnorePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ class IgnorePlugin {
5858

5959
apply(compiler) {
6060
compiler.hooks.normalModuleFactory.tap("IgnorePlugin", (nmf) => {
61-
nmf.plugin("before-resolve", this.checkIgnore);
61+
nmf.hooks.beforeResolve.tapAsync("IgnorePlugin", this.checkIgnore);
6262
});
6363
compiler.hooks.contextModuleFactory.tap("IgnorePlugin", (cmf) => {
64-
cmf.plugin("before-resolve", this.checkIgnore);
64+
cmf.hooks.beforeResolve.tapAsync("IgnorePlugin", this.checkIgnore);
6565
});
6666
}
6767
}

lib/MainTemplate.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ module.exports = class MainTemplate extends Tapable {
5757
// It's weird here
5858
hotBootstrap: new SyncWaterfallHook(["source", "chunk", "hash"])
5959
};
60-
this.plugin("startup", (source, chunk, hash) => {
60+
this.hooks.startup.tap("MainTemplate", (source, chunk, hash) => {
6161
const buf = [];
6262
if(chunk.entryModule) {
6363
buf.push("// Load entry module and return exports");
6464
buf.push(`return ${this.renderRequireFunctionForModule(hash, chunk, JSON.stringify(chunk.entryModule.id))}(${this.requireFn}.s = ${JSON.stringify(chunk.entryModule.id)});`);
6565
}
6666
return Template.asString(buf);
6767
});
68-
this.plugin("render", (bootstrapSource, chunk, hash, moduleTemplate, dependencyTemplates) => {
68+
this.hooks.render.tap("MainTemplate", (bootstrapSource, chunk, hash, moduleTemplate, dependencyTemplates) => {
6969
const source = new ConcatSource();
7070
source.add("/******/ (function(modules) { // webpackBootstrap\n");
7171
source.add(new PrefixSource("/******/", bootstrapSource));
@@ -77,14 +77,14 @@ module.exports = class MainTemplate extends Tapable {
7777
source.add(")");
7878
return source;
7979
});
80-
this.plugin("local-vars", (source, chunk, hash) => {
80+
this.hooks.localVars.tap("MainTemplate", (source, chunk, hash) => {
8181
return Template.asString([
8282
source,
8383
"// The module cache",
8484
"var installedModules = {};"
8585
]);
8686
});
87-
this.plugin("require", (source, chunk, hash) => {
87+
this.hooks.require.tap("MainTemplate", (source, chunk, hash) => {
8888
return Template.asString([
8989
source,
9090
"// Check if module is in cache",
@@ -121,14 +121,14 @@ module.exports = class MainTemplate extends Tapable {
121121
"return module.exports;"
122122
]);
123123
});
124-
this.plugin("module-obj", (source, chunk, hash, varModuleId) => {
124+
this.hooks.moduleObj.tap("MainTemplate", (source, chunk, hash, varModuleId) => {
125125
return Template.asString([
126126
"i: moduleId,",
127127
"l: false,",
128128
"exports: {}"
129129
]);
130130
});
131-
this.plugin("require-extensions", (source, chunk, hash) => {
131+
this.hooks.requireExtensions.tap("MainTemplate", (source, chunk, hash) => {
132132
const buf = [];
133133
if(chunk.getNumberOfChunks() > 0) {
134134
buf.push("// This file contains only the entry chunk.");

0 commit comments

Comments
 (0)