mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 20:30:04 +02:00
update packages to latest version
This commit is contained in:
33
node_modules/saxes/saxes.js
generated
vendored
33
node_modules/saxes/saxes.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SaxesParser = exports.EVENTS = void 0;
|
||||
const ed5 = require("xmlchars/xml/1.0/ed5");
|
||||
const ed2 = require("xmlchars/xml/1.1/ed2");
|
||||
const NSed3 = require("xmlchars/xmlns/1.0/ed3");
|
||||
@@ -16,13 +17,13 @@ var NC_NAME_RE = NSed3.NC_NAME_RE;
|
||||
const XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
|
||||
const XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
|
||||
const rootNS = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
|
||||
__proto__: null,
|
||||
xml: XML_NAMESPACE,
|
||||
xmlns: XMLNS_NAMESPACE,
|
||||
};
|
||||
const XML_ENTITIES = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
|
||||
__proto__: null,
|
||||
amp: "&",
|
||||
gt: ">",
|
||||
@@ -182,6 +183,7 @@ const EVENT_NAME_TO_HANDLER_NAME = {
|
||||
end: "endHandler",
|
||||
ready: "readyHandler",
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
class SaxesParser {
|
||||
/**
|
||||
* @param opt The parser options.
|
||||
@@ -207,7 +209,7 @@ class SaxesParser {
|
||||
this.processAttribs = this.processAttribsNS;
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
this.pushAttrib = this.pushAttribNS;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
|
||||
this.ns = Object.assign({ __proto__: null }, rootNS);
|
||||
const additional = this.opt.additionalNamespaces;
|
||||
if (additional != null) {
|
||||
@@ -276,6 +278,7 @@ class SaxesParser {
|
||||
this.sAttribValueUnquoted,
|
||||
this.sCloseTag,
|
||||
this.sCloseTagSawWhite,
|
||||
/* eslint-enable @typescript-eslint/unbound-method */
|
||||
];
|
||||
this._init();
|
||||
}
|
||||
@@ -335,7 +338,6 @@ class SaxesParser {
|
||||
this.line = 1;
|
||||
this.column = 0;
|
||||
this.ENTITIES = Object.create(XML_ENTITIES);
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.readyHandler) === null || _a === void 0 ? void 0 : _a.call(this);
|
||||
}
|
||||
/**
|
||||
@@ -373,7 +375,7 @@ class SaxesParser {
|
||||
* @param handler The handler to set.
|
||||
*/
|
||||
on(name, handler) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
this[EVENT_NAME_TO_HANDLER_NAME[name]] = handler;
|
||||
}
|
||||
/**
|
||||
@@ -382,7 +384,7 @@ class SaxesParser {
|
||||
* @parma name The event to stop listening to.
|
||||
*/
|
||||
off(name) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
this[EVENT_NAME_TO_HANDLER_NAME[name]] = undefined;
|
||||
}
|
||||
/**
|
||||
@@ -436,6 +438,8 @@ class SaxesParser {
|
||||
*
|
||||
* @returns this
|
||||
*/
|
||||
// We do need object for the type here. Yes, it often causes problems
|
||||
// but not in this case.
|
||||
write(chunk) {
|
||||
if (this.closed) {
|
||||
return this.fail("cannot write after close; assign an onready handler.");
|
||||
@@ -477,7 +481,7 @@ class SaxesParser {
|
||||
this.chunk = chunk;
|
||||
this.i = 0;
|
||||
while (this.i < limit) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
||||
stateTable[this.state].call(this);
|
||||
}
|
||||
this.chunkPosition += limit;
|
||||
@@ -811,7 +815,6 @@ class SaxesParser {
|
||||
const c = this.captureTo(DOCTYPE_TERMINATOR);
|
||||
switch (c) {
|
||||
case GREATER: {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.doctypeHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.text);
|
||||
this.text = "";
|
||||
this.state = S_TEXT;
|
||||
@@ -1063,7 +1066,6 @@ class SaxesParser {
|
||||
const c = this.getCodeNorm();
|
||||
if (c === MINUS) {
|
||||
this.state = S_COMMENT_ENDED;
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.commentHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.text);
|
||||
this.text = "";
|
||||
}
|
||||
@@ -1105,7 +1107,6 @@ class SaxesParser {
|
||||
const c = this.getCodeNorm();
|
||||
switch (c) {
|
||||
case GREATER: {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.cdataHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.text);
|
||||
this.text = "";
|
||||
this.state = S_TEXT;
|
||||
@@ -1198,7 +1199,6 @@ class SaxesParser {
|
||||
if (piTarget.toLowerCase() === "xml") {
|
||||
this.fail("the XML declaration must appear at the start of the document.");
|
||||
}
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.piHandler) === null || _a === void 0 ? void 0 : _a.call(this, {
|
||||
target: piTarget,
|
||||
body: this.text,
|
||||
@@ -1379,7 +1379,6 @@ class SaxesParser {
|
||||
this.xmlDeclExpects.includes("version")) {
|
||||
this.fail("XML declaration must contain a version.");
|
||||
}
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.xmldeclHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.xmlDecl);
|
||||
this.name = "";
|
||||
this.piTarget = this.text = "";
|
||||
@@ -1407,7 +1406,6 @@ class SaxesParser {
|
||||
if (this.xmlnsOpt) {
|
||||
this.topNS = tag.ns = Object.create(null);
|
||||
}
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.openTagStartHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag);
|
||||
this.sawRoot = true;
|
||||
if (!this.fragmentOpt && this.closedRoot) {
|
||||
@@ -1781,7 +1779,6 @@ class SaxesParser {
|
||||
const { prefix, local } = this.qname(name);
|
||||
const attr = { name, prefix, local, value };
|
||||
this.attribList.push(attr);
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr);
|
||||
if (prefix === "xmlns") {
|
||||
const trimmed = value.trim();
|
||||
@@ -1801,7 +1798,6 @@ class SaxesParser {
|
||||
var _a;
|
||||
const attr = { name, value };
|
||||
this.attribList.push(attr);
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr);
|
||||
}
|
||||
/**
|
||||
@@ -1825,12 +1821,10 @@ class SaxesParser {
|
||||
}
|
||||
const { text } = this;
|
||||
if (text.length !== 0) {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.textHandler) === null || _a === void 0 ? void 0 : _a.call(this, text);
|
||||
this.text = "";
|
||||
}
|
||||
this._closed = true;
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_b = this.endHandler) === null || _b === void 0 ? void 0 : _b.call(this);
|
||||
this._init();
|
||||
return this;
|
||||
@@ -1960,7 +1954,6 @@ class SaxesParser {
|
||||
tag.isSelfClosing = false;
|
||||
// There cannot be any pending text here due to the onopentagstart that was
|
||||
// necessarily emitted before we get here. So we do not check text.
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.openTagHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag);
|
||||
tags.push(tag);
|
||||
this.state = S_TEXT;
|
||||
@@ -1979,9 +1972,7 @@ class SaxesParser {
|
||||
tag.isSelfClosing = true;
|
||||
// There cannot be any pending text here due to the onopentagstart that was
|
||||
// necessarily emitted before we get here. So we do not check text.
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_a = this.openTagHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag);
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(_b = this.closeTagHandler) === null || _b === void 0 ? void 0 : _b.call(this, tag);
|
||||
const top = this.tag = (_c = tags[tags.length - 1]) !== null && _c !== void 0 ? _c : null;
|
||||
if (top === null) {
|
||||
@@ -2011,7 +2002,6 @@ class SaxesParser {
|
||||
while (l-- > 0) {
|
||||
const tag = this.tag = tags.pop();
|
||||
this.topNS = tag.ns;
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
handler === null || handler === void 0 ? void 0 : handler(tag);
|
||||
if (tag.name === name) {
|
||||
break;
|
||||
@@ -2035,7 +2025,6 @@ class SaxesParser {
|
||||
*/
|
||||
parseEntity(entity) {
|
||||
// startsWith would be significantly slower for this test.
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
||||
if (entity[0] !== "#") {
|
||||
const defined = this.ENTITIES[entity];
|
||||
if (defined !== undefined) {
|
||||
|
Reference in New Issue
Block a user