/* MIT License http://www.opensource.org/licenses/mit-license.php */ "use strict"; const { HTML_TYPE } = require("../ModuleSourceTypeConstants"); const makeSerializable = require("../util/makeSerializable"); const ModuleDependency = require("./ModuleDependency"); /** @import { ReplaceSource } from "webpack-sources" */ /** @import CodeGenerationResults from "../CodeGenerationResults" */ /** @import Dependency, { UpdateHashContext } from "../Dependency" */ /** @import { DependencyTemplateContext } from "../DependencyTemplate" */ /** @import Module from "../Module" */ /** @import { Range } from "../javascript/JavascriptParser" */ /** @import Hash from "../util/Hash" */ // One pass over the source: each char is replaced once and replacements aren't // re-scanned, so this matches the `&`-first sequential escape chain exactly. const ATTR_ESCAPE_REGEXP = /[&"']/g; /** @type {Record} */ const ATTR_ESCAPES = { "&": "&", '"': """, "'": "'" }; /** * @param {string} c matched character * @returns {string} the HTML-attribute-escaped entity */ const escapeAttrChar = (c) => ATTR_ESCAPES[c]; /** * Represents an `