NullDependency.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const Dependency = require("../Dependency");
  7. const DependencyTemplate = require("../DependencyTemplate");
  8. /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
  9. /** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
  10. /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
  11. /** @typedef {string[]} RawRuntimeRequirements */
  12. class NullDependency extends Dependency {
  13. get type() {
  14. return "null";
  15. }
  16. /**
  17. * Could affect referencing module.
  18. * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module
  19. */
  20. couldAffectReferencingModule() {
  21. return false;
  22. }
  23. }
  24. NullDependency.Template = class NullDependencyTemplate extends (
  25. DependencyTemplate
  26. ) {
  27. /**
  28. * Applies the plugin by registering its hooks on the compiler.
  29. * @param {Dependency} dependency the dependency for which the template should be applied
  30. * @param {ReplaceSource} source the current replace source which can be modified
  31. * @param {DependencyTemplateContext} templateContext the context object
  32. * @returns {void}
  33. */
  34. apply(dependency, source, templateContext) {}
  35. };
  36. module.exports = NullDependency;