AMDRequireContextDependency.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 ContextDependency = require("./ContextDependency");
  8. class AMDRequireContextDependency extends ContextDependency {
  9. constructor(options, range, valueRange) {
  10. super(options);
  11. this.range = range;
  12. this.valueRange = valueRange;
  13. }
  14. get type() {
  15. return "amd require context";
  16. }
  17. get category() {
  18. return "amd";
  19. }
  20. serialize(context) {
  21. const { write } = context;
  22. write(this.range);
  23. write(this.valueRange);
  24. super.serialize(context);
  25. }
  26. deserialize(context) {
  27. const { read } = context;
  28. this.range = read();
  29. this.valueRange = read();
  30. super.deserialize(context);
  31. }
  32. }
  33. makeSerializable(
  34. AMDRequireContextDependency,
  35. "webpack/lib/dependencies/AMDRequireContextDependency"
  36. );
  37. AMDRequireContextDependency.Template = require("./ContextDependencyTemplateAsRequireCall");
  38. module.exports = AMDRequireContextDependency;