RequireResolveContextDependency.js 1.1 KB

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