HtmlModule.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. */
  4. "use strict";
  5. const NormalModule = require("../NormalModule");
  6. const makeSerializable = require("../util/makeSerializable");
  7. /**
  8. * @import {
  9. * NormalModuleBuildInfo,
  10. * NormalModuleCreateData
  11. * } from "../NormalModule"
  12. */
  13. /** @import { HtmlEntryInfo } from "./HtmlModulesPlugin" */
  14. /**
  15. * Defines the build info properties specific to html modules.
  16. * @typedef {object} KnownHtmlModuleBuildInfo
  17. * @property {Record<string, HtmlEntryInfo[]>=} htmlEntries entries collected from the document, grouped by kind
  18. * @property {string=} baseUrlPrefix `../` per `<base href>` path segment, prepended to the auto-public-path undo path so a relative base doesn't misdirect bundled URLs
  19. */
  20. /** @typedef {NormalModuleBuildInfo & KnownHtmlModuleBuildInfo} HtmlModuleBuildInfo */
  21. /**
  22. * Module class for `html` modules. HTML-specific properties should live here instead of `NormalModule`.
  23. */
  24. class HtmlModule extends NormalModule {
  25. /**
  26. * @param {NormalModuleCreateData} options options object
  27. */
  28. constructor(options) {
  29. super(options);
  30. // Redeclared with the html specific shape
  31. /** @type {HtmlModuleBuildInfo | undefined} */
  32. this.buildInfo = undefined;
  33. }
  34. }
  35. makeSerializable(HtmlModule, "webpack/lib/html/HtmlModule");
  36. module.exports = HtmlModule;