AddManagedPathsPlugin.js 1.1 KB

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