DllEntryDependency.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 makeSerializable = require("../util/makeSerializable");
  8. /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
  9. /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
  10. /** @typedef {import("./EntryDependency")} EntryDependency */
  11. class DllEntryDependency extends Dependency {
  12. /**
  13. * @param {EntryDependency[]} dependencies dependencies
  14. * @param {string} name name
  15. */
  16. constructor(dependencies, name) {
  17. super();
  18. this.dependencies = dependencies;
  19. this.name = name;
  20. }
  21. get type() {
  22. return "dll entry";
  23. }
  24. /**
  25. * @param {ObjectSerializerContext} context context
  26. */
  27. serialize(context) {
  28. const { write } = context;
  29. write(this.dependencies);
  30. write(this.name);
  31. super.serialize(context);
  32. }
  33. /**
  34. * @param {ObjectDeserializerContext} context context
  35. */
  36. deserialize(context) {
  37. const { read } = context;
  38. this.dependencies = read();
  39. this.name = read();
  40. super.deserialize(context);
  41. }
  42. }
  43. makeSerializable(
  44. DllEntryDependency,
  45. "webpack/lib/dependencies/DllEntryDependency"
  46. );
  47. module.exports = DllEntryDependency;