Skip to content

Commit 2dde005

Browse files
authored
Merge pull request webpack#7658 from mohsen1/ContextExclusionPlugin-types
Add JSDoc types for ContextExclusionPlugin
2 parents fa02f3d + b3a7c4d commit 2dde005

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/ContextExclusionPlugin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
"use strict";
22

3+
/** @typedef {import("./Compiler")} Compiler */
4+
/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */
5+
36
class ContextExclusionPlugin {
7+
/**
8+
* @param {RegExp} negativeMatcher Matcher regular expression
9+
*/
410
constructor(negativeMatcher) {
511
this.negativeMatcher = negativeMatcher;
612
}
713

14+
/**
15+
* Apply the plugin
16+
* @param {Compiler} compiler Webpack Compiler
17+
* @returns {void}
18+
*/
819
apply(compiler) {
920
compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => {
1021
cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => {

lib/ContextModuleFactory.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ const {
1515
const ContextModule = require("./ContextModule");
1616
const ContextElementDependency = require("./dependencies/ContextElementDependency");
1717

18+
/** @typedef {import("./Module")} Module */
19+
1820
const EMPTY_RESOLVE_OPTIONS = {};
1921

2022
module.exports = class ContextModuleFactory extends Tapable {
2123
constructor(resolverFactory) {
2224
super();
2325
this.hooks = {
26+
/** @type {AsyncSeriesWaterfallHook<TODO>} */
2427
beforeResolve: new AsyncSeriesWaterfallHook(["data"]),
28+
/** @type {AsyncSeriesWaterfallHook<TODO>} */
2529
afterResolve: new AsyncSeriesWaterfallHook(["data"]),
30+
/** @type {SyncWaterfallHook<string[]>} */
2631
contextModuleFiles: new SyncWaterfallHook(["files"]),
32+
/** @type {SyncWaterfallHook<TODO[]>} */
2733
alternatives: new AsyncSeriesWaterfallHook(["modules"])
2834
};
2935
this._pluginCompat.tap("ContextModuleFactory", options => {

0 commit comments

Comments
 (0)