DllEntryDependency.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. * Creates an instance of DllEntryDependency.
  14. * @param {EntryDependency[]} dependencies dependencies
  15. * @param {string} name name
  16. */
  17. constructor(dependencies, name) {
  18. super();
  19. this.dependencies = dependencies;
  20. this.name = name;
  21. }
  22. get type() {
  23. return "dll entry";
  24. }
  25. /**
  26. * Serializes this instance into the provided serializer context.
  27. * @param {ObjectSerializerContext} context context
  28. */
  29. serialize(context) {
  30. const { write } = context;
  31. write(this.dependencies);
  32. write(this.name);
  33. super.serialize(context);
  34. }
  35. /**
  36. * Restores this instance from the provided deserializer context.
  37. * @param {ObjectDeserializerContext} context context
  38. */
  39. deserialize(context) {
  40. const { read } = context;
  41. this.dependencies = read();
  42. this.name = read();
  43. super.deserialize(context);
  44. }
  45. }
  46. makeSerializable(
  47. DllEntryDependency,
  48. "webpack/lib/dependencies/DllEntryDependency"
  49. );
  50. module.exports = DllEntryDependency;