AddManagedPathsPlugin.js 870 B

1234567891011121314151617181920212223242526272829303132333435
  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. */
  12. constructor(managedPaths, immutablePaths) {
  13. this.managedPaths = new Set(managedPaths);
  14. this.immutablePaths = new Set(immutablePaths);
  15. }
  16. /**
  17. * Apply the plugin
  18. * @param {Compiler} compiler the compiler instance
  19. * @returns {void}
  20. */
  21. apply(compiler) {
  22. for (const managedPath of this.managedPaths) {
  23. compiler.managedPaths.add(managedPath);
  24. }
  25. for (const immutablePath of this.immutablePaths) {
  26. compiler.immutablePaths.add(immutablePath);
  27. }
  28. }
  29. }
  30. module.exports = AddManagedPathsPlugin;