DllEntryDependency.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. /** @import EntryDependency from "./EntryDependency" */
  9. /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext<[EntryDependency[], string]>} ObjectDeserializerContext */
  10. /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext<[EntryDependency[], string]>} ObjectSerializerContext */
  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. /** @type {EntryDependency[]} */
  20. this.dependencies = dependencies;
  21. /** @type {string} */
  22. this.name = name;
  23. }
  24. get type() {
  25. return "dll entry";
  26. }
  27. /**
  28. * Serializes this instance into the provided serializer context.
  29. * @param {ObjectSerializerContext} context context
  30. */
  31. serialize(context) {
  32. context.write(this.dependencies).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. this.dependencies = context.read();
  41. const c1 = context.rest;
  42. this.name = c1.read();
  43. super.deserialize(c1.rest);
  44. }
  45. }
  46. makeSerializable(
  47. DllEntryDependency,
  48. "webpack/lib/dependencies/DllEntryDependency"
  49. );
  50. module.exports = DllEntryDependency;