CommonJsRequireDependency.js 1001 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const makeSerializable = require("../util/makeSerializable");
  7. const ModuleDependency = require("./ModuleDependency");
  8. const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
  9. /** @typedef {import("../javascript/JavascriptParser").Range} Range */
  10. class CommonJsRequireDependency extends ModuleDependency {
  11. /**
  12. * @param {string} request request
  13. * @param {Range=} range location in source code
  14. * @param {string=} context request context
  15. */
  16. constructor(request, range, context) {
  17. super(request);
  18. this.range = range;
  19. this._context = context;
  20. }
  21. get type() {
  22. return "cjs require";
  23. }
  24. get category() {
  25. return "commonjs";
  26. }
  27. }
  28. CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId;
  29. makeSerializable(
  30. CommonJsRequireDependency,
  31. "webpack/lib/dependencies/CommonJsRequireDependency"
  32. );
  33. module.exports = CommonJsRequireDependency;