UNPKG

852 BJavaScriptView Raw
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8/** @typedef {import("../Compiler")} Compiler */
9
10class AddManagedPathsPlugin {
11 /**
12 * @param {Iterable<string>} managedPaths list of managed paths
13 * @param {Iterable<string>} immutablePaths list of immutable paths
14 */
15 constructor(managedPaths, immutablePaths) {
16 this.managedPaths = new Set(managedPaths);
17 this.immutablePaths = new Set(immutablePaths);
18 }
19
20 /**
21 * Apply the plugin
22 * @param {Compiler} compiler the compiler instance
23 * @returns {void}
24 */
25 apply(compiler) {
26 for (const managedPath of this.managedPaths) {
27 compiler.managedPaths.add(managedPath);
28 }
29 for (const immutablePath of this.immutablePaths) {
30 compiler.immutablePaths.add(immutablePath);
31 }
32 }
33}
34
35module.exports = AddManagedPathsPlugin;