Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@joplin/fork-htmlparser2

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@joplin/fork-htmlparser2 - npm Package Compare versions

Comparing version 4.1.41 to 4.1.42

21

lib/CollectingHandler.js

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,8 +18,10 @@ function __() { this.constructor = d; }

})();
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -28,2 +32,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.CollectingHandler = void 0;
var MultiplexHandler_1 = __importDefault(require("./MultiplexHandler"));

@@ -40,3 +45,3 @@ var CollectingHandler = /** @class */ (function (_super) {

}
_this.events.push(__spreadArrays([name], args));
_this.events.push(__spreadArray([name], args, true));
// @ts-ignore

@@ -43,0 +48,0 @@ if (_this._cbs[name])

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,13 +18,30 @@ function __() { this.constructor = d; }

})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseFeed = exports.FeedHandler = void 0;
var domhandler_1 = __importDefault(require("domhandler"));

@@ -40,3 +59,2 @@ var DomUtils = __importStar(require("domutils"));

function FeedHandler(callback, options) {
var _this = this;
if (typeof callback === "object" && callback !== null) {

@@ -46,4 +64,3 @@ callback = undefined;

}
_this = _super.call(this, callback, options) || this;
return _this;
return _super.call(this, callback, options) || this;
}

@@ -50,0 +67,0 @@ FeedHandler.prototype.onend = function () {

@@ -5,3 +5,3 @@ import { Parser, ParserOptions } from "./Parser";

export { DomHandler, DomHandlerOptions };
declare type Options = ParserOptions & DomHandlerOptions;
type Options = ParserOptions & DomHandlerOptions;
/**

@@ -8,0 +8,0 @@ * Parses data, returns the resulting DOM.

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RssHandler = exports.DefaultHandler = exports.DomUtils = exports.EVENTS = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.DomHandler = exports.Parser = void 0;
var Parser_1 = require("./Parser");
exports.Parser = Parser_1.Parser;
Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_1.Parser; } });
var domhandler_1 = require("domhandler");
exports.DomHandler = domhandler_1.DomHandler;
exports.DefaultHandler = domhandler_1.DomHandler;
Object.defineProperty(exports, "DomHandler", { enumerable: true, get: function () { return domhandler_1.DomHandler; } });
Object.defineProperty(exports, "DefaultHandler", { enumerable: true, get: function () { return domhandler_1.DomHandler; } });
// Helper methods

@@ -44,3 +64,3 @@ /**

var Tokenizer_1 = require("./Tokenizer");
exports.Tokenizer = Tokenizer_1.default;
Object.defineProperty(exports, "Tokenizer", { enumerable: true, get: function () { return __importDefault(Tokenizer_1).default; } });
var ElementType = __importStar(require("domelementtype"));

@@ -71,8 +91,8 @@ exports.ElementType = ElementType;

*/
__export(require("./FeedHandler"));
__export(require("./WritableStream"));
__export(require("./CollectingHandler"));
__exportStar(require("./FeedHandler"), exports);
__exportStar(require("./WritableStream"), exports);
__exportStar(require("./CollectingHandler"), exports);
var DomUtils = __importStar(require("domutils"));
exports.DomUtils = DomUtils;
var FeedHandler_1 = require("./FeedHandler");
exports.RssHandler = FeedHandler_1.FeedHandler;
Object.defineProperty(exports, "RssHandler", { enumerable: true, get: function () { return FeedHandler_1.FeedHandler; } });

@@ -104,4 +104,4 @@ /// <reference types="node" />

parseChunk: (chunk: string) => void;
done: (chunk?: string | undefined) => void;
done: (chunk?: string) => void;
}
//# sourceMappingURL=Parser.d.ts.map

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -20,2 +22,3 @@ function __() { this.constructor = d; }

Object.defineProperty(exports, "__esModule", { value: true });
exports.Parser = void 0;
var Tokenizer_1 = __importDefault(require("./Tokenizer"));

@@ -314,3 +317,3 @@ var events_1 = require("events");

var name_1 = this._getInstructionName(value);
this._cbs.onprocessinginstruction("!" + name_1, "!" + value);
this._cbs.onprocessinginstruction("!".concat(name_1), "!".concat(value));
}

@@ -321,3 +324,3 @@ };

var name_2 = this._getInstructionName(value);
this._cbs.onprocessinginstruction("?" + name_2, "?" + value);
this._cbs.onprocessinginstruction("?".concat(name_2), "?".concat(value));
}

@@ -343,3 +346,3 @@ };

else {
this.oncomment("[CDATA[" + value + "]]");
this.oncomment("[CDATA[".concat(value, "]]"));
}

@@ -346,0 +349,0 @@ };

@@ -45,3 +45,3 @@ "use strict";

else {
t._state = 3 /* InTagName */;
t._state = 3 /* State.InTagName */;
t._index--; //consume the token again

@@ -51,27 +51,27 @@ }

}
var stateBeforeCdata1 = ifElseState("C", 23 /* BeforeCdata2 */, 16 /* InDeclaration */);
var stateBeforeCdata2 = ifElseState("D", 24 /* BeforeCdata3 */, 16 /* InDeclaration */);
var stateBeforeCdata3 = ifElseState("A", 25 /* BeforeCdata4 */, 16 /* InDeclaration */);
var stateBeforeCdata4 = ifElseState("T", 26 /* BeforeCdata5 */, 16 /* InDeclaration */);
var stateBeforeCdata5 = ifElseState("A", 27 /* BeforeCdata6 */, 16 /* InDeclaration */);
var stateBeforeScript1 = consumeSpecialNameChar("R", 34 /* BeforeScript2 */);
var stateBeforeScript2 = consumeSpecialNameChar("I", 35 /* BeforeScript3 */);
var stateBeforeScript3 = consumeSpecialNameChar("P", 36 /* BeforeScript4 */);
var stateBeforeScript4 = consumeSpecialNameChar("T", 37 /* BeforeScript5 */);
var stateAfterScript1 = ifElseState("R", 39 /* AfterScript2 */, 1 /* Text */);
var stateAfterScript2 = ifElseState("I", 40 /* AfterScript3 */, 1 /* Text */);
var stateAfterScript3 = ifElseState("P", 41 /* AfterScript4 */, 1 /* Text */);
var stateAfterScript4 = ifElseState("T", 42 /* AfterScript5 */, 1 /* Text */);
var stateBeforeStyle1 = consumeSpecialNameChar("Y", 44 /* BeforeStyle2 */);
var stateBeforeStyle2 = consumeSpecialNameChar("L", 45 /* BeforeStyle3 */);
var stateBeforeStyle3 = consumeSpecialNameChar("E", 46 /* BeforeStyle4 */);
var stateAfterStyle1 = ifElseState("Y", 48 /* AfterStyle2 */, 1 /* Text */);
var stateAfterStyle2 = ifElseState("L", 49 /* AfterStyle3 */, 1 /* Text */);
var stateAfterStyle3 = ifElseState("E", 50 /* AfterStyle4 */, 1 /* Text */);
var stateBeforeEntity = ifElseState("#", 52 /* BeforeNumericEntity */, 53 /* InNamedEntity */);
var stateBeforeNumericEntity = ifElseState("X", 55 /* InHexEntity */, 54 /* InNumericEntity */);
var stateBeforeCdata1 = ifElseState("C", 23 /* State.BeforeCdata2 */, 16 /* State.InDeclaration */);
var stateBeforeCdata2 = ifElseState("D", 24 /* State.BeforeCdata3 */, 16 /* State.InDeclaration */);
var stateBeforeCdata3 = ifElseState("A", 25 /* State.BeforeCdata4 */, 16 /* State.InDeclaration */);
var stateBeforeCdata4 = ifElseState("T", 26 /* State.BeforeCdata5 */, 16 /* State.InDeclaration */);
var stateBeforeCdata5 = ifElseState("A", 27 /* State.BeforeCdata6 */, 16 /* State.InDeclaration */);
var stateBeforeScript1 = consumeSpecialNameChar("R", 34 /* State.BeforeScript2 */);
var stateBeforeScript2 = consumeSpecialNameChar("I", 35 /* State.BeforeScript3 */);
var stateBeforeScript3 = consumeSpecialNameChar("P", 36 /* State.BeforeScript4 */);
var stateBeforeScript4 = consumeSpecialNameChar("T", 37 /* State.BeforeScript5 */);
var stateAfterScript1 = ifElseState("R", 39 /* State.AfterScript2 */, 1 /* State.Text */);
var stateAfterScript2 = ifElseState("I", 40 /* State.AfterScript3 */, 1 /* State.Text */);
var stateAfterScript3 = ifElseState("P", 41 /* State.AfterScript4 */, 1 /* State.Text */);
var stateAfterScript4 = ifElseState("T", 42 /* State.AfterScript5 */, 1 /* State.Text */);
var stateBeforeStyle1 = consumeSpecialNameChar("Y", 44 /* State.BeforeStyle2 */);
var stateBeforeStyle2 = consumeSpecialNameChar("L", 45 /* State.BeforeStyle3 */);
var stateBeforeStyle3 = consumeSpecialNameChar("E", 46 /* State.BeforeStyle4 */);
var stateAfterStyle1 = ifElseState("Y", 48 /* State.AfterStyle2 */, 1 /* State.Text */);
var stateAfterStyle2 = ifElseState("L", 49 /* State.AfterStyle3 */, 1 /* State.Text */);
var stateAfterStyle3 = ifElseState("E", 50 /* State.AfterStyle4 */, 1 /* State.Text */);
var stateBeforeEntity = ifElseState("#", 52 /* State.BeforeNumericEntity */, 53 /* State.InNamedEntity */);
var stateBeforeNumericEntity = ifElseState("X", 55 /* State.InHexEntity */, 54 /* State.InNumericEntity */);
var Tokenizer = /** @class */ (function () {
function Tokenizer(options, cbs) {
/** The current state the tokenizer is in. */
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
/** The read buffer. */

@@ -89,5 +89,5 @@ this._buffer = "";

/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
this._baseState = 1 /* Text */;
this._baseState = 1 /* State.Text */;
/** For special parsing behavior inside of script and style tags. */
this._special = 1 /* None */;
this._special = 1 /* Special.None */;
/** Indicates whether the tokenizer has been paused. */

@@ -102,3 +102,3 @@ this._running = true;

Tokenizer.prototype.reset = function () {
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._buffer = "";

@@ -108,4 +108,4 @@ this._sectionStart = 0;

this._bufferOffset = 0;
this._baseState = 1 /* Text */;
this._special = 1 /* None */;
this._baseState = 1 /* State.Text */;
this._special = 1 /* Special.None */;
this._running = true;

@@ -119,7 +119,7 @@ this._ended = false;

}
this._state = 2 /* BeforeTagName */;
this._state = 2 /* State.BeforeTagName */;
this._sectionStart = this._index;
}
else if (this._decodeEntities &&
this._special === 1 /* None */ &&
this._special === 1 /* Special.None */ &&
c === "&") {

@@ -129,4 +129,4 @@ if (this._index > this._sectionStart) {

}
this._baseState = 1 /* Text */;
this._state = 51 /* BeforeEntity */;
this._baseState = 1 /* State.Text */;
this._state = 51 /* State.BeforeEntity */;
this._sectionStart = this._index;

@@ -137,3 +137,3 @@ }

if (c === "/") {
this._state = 5 /* BeforeClosingTagName */;
this._state = 5 /* State.BeforeClosingTagName */;
}

@@ -145,12 +145,12 @@ else if (c === "<") {

else if (c === ">" ||
this._special !== 1 /* None */ ||
this._special !== 1 /* Special.None */ ||
whitespace(c)) {
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
}
else if (c === "!") {
this._state = 15 /* BeforeDeclaration */;
this._state = 15 /* State.BeforeDeclaration */;
this._sectionStart = this._index + 1;
}
else if (c === "?") {
this._state = 17 /* InProcessingInstruction */;
this._state = 17 /* State.InProcessingInstruction */;
this._sectionStart = this._index + 1;

@@ -161,4 +161,4 @@ }

!this._xmlMode && (c === "s" || c === "S")
? 31 /* BeforeSpecial */
: 3 /* InTagName */;
? 31 /* State.BeforeSpecial */
: 3 /* State.InTagName */;
this._sectionStart = this._index;

@@ -170,3 +170,3 @@ }

this._emitToken("onopentagname");
this._state = 8 /* BeforeAttributeName */;
this._state = 8 /* State.BeforeAttributeName */;
this._index--;

@@ -180,10 +180,10 @@ }

else if (c === ">") {
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
}
else if (this._special !== 1 /* None */) {
else if (this._special !== 1 /* Special.None */) {
if (c === "s" || c === "S") {
this._state = 32 /* BeforeSpecialEnd */;
this._state = 32 /* State.BeforeSpecialEnd */;
}
else {
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._index--;

@@ -193,3 +193,3 @@ }

else {
this._state = 6 /* InClosingTagName */;
this._state = 6 /* State.InClosingTagName */;
this._sectionStart = this._index;

@@ -201,3 +201,3 @@ }

this._emitToken("onclosetag");
this._state = 7 /* AfterClosingTagName */;
this._state = 7 /* State.AfterClosingTagName */;
this._index--;

@@ -209,3 +209,3 @@ }

if (c === ">") {
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;

@@ -217,10 +217,10 @@ }

this._cbs.onopentagend();
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;
}
else if (c === "/") {
this._state = 4 /* InSelfClosingTag */;
this._state = 4 /* State.InSelfClosingTag */;
}
else if (!whitespace(c)) {
this._state = 9 /* InAttributeName */;
this._state = 9 /* State.InAttributeName */;
this._sectionStart = this._index;

@@ -232,7 +232,7 @@ }

this._cbs.onselfclosingtag();
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;
}
else if (!whitespace(c)) {
this._state = 8 /* BeforeAttributeName */;
this._state = 8 /* State.BeforeAttributeName */;
this._index--;

@@ -245,3 +245,3 @@ }

this._sectionStart = -1;
this._state = 10 /* AfterAttributeName */;
this._state = 10 /* State.AfterAttributeName */;
this._index--;

@@ -252,7 +252,7 @@ }

if (c === "=") {
this._state = 11 /* BeforeAttributeValue */;
this._state = 11 /* State.BeforeAttributeValue */;
}
else if (c === "/" || c === ">") {
this._cbs.onattribend();
this._state = 8 /* BeforeAttributeName */;
this._state = 8 /* State.BeforeAttributeName */;
this._index--;

@@ -262,3 +262,3 @@ }

this._cbs.onattribend();
this._state = 9 /* InAttributeName */;
this._state = 9 /* State.InAttributeName */;
this._sectionStart = this._index;

@@ -269,11 +269,11 @@ }

if (c === '"') {
this._state = 12 /* InAttributeValueDq */;
this._state = 12 /* State.InAttributeValueDq */;
this._sectionStart = this._index + 1;
}
else if (c === "'") {
this._state = 13 /* InAttributeValueSq */;
this._state = 13 /* State.InAttributeValueSq */;
this._sectionStart = this._index + 1;
}
else if (!whitespace(c)) {
this._state = 14 /* InAttributeValueNq */;
this._state = 14 /* State.InAttributeValueNq */;
this._sectionStart = this._index;

@@ -287,3 +287,3 @@ this._index--; //reconsume token

this._cbs.onattribend();
this._state = 8 /* BeforeAttributeName */;
this._state = 8 /* State.BeforeAttributeName */;
}

@@ -293,3 +293,3 @@ else if (this._decodeEntities && c === "&") {

this._baseState = this._state;
this._state = 51 /* BeforeEntity */;
this._state = 51 /* State.BeforeEntity */;
this._sectionStart = this._index;

@@ -302,3 +302,3 @@ }

this._cbs.onattribend();
this._state = 8 /* BeforeAttributeName */;
this._state = 8 /* State.BeforeAttributeName */;
}

@@ -308,3 +308,3 @@ else if (this._decodeEntities && c === "&") {

this._baseState = this._state;
this._state = 51 /* BeforeEntity */;
this._state = 51 /* State.BeforeEntity */;
this._sectionStart = this._index;

@@ -317,3 +317,3 @@ }

this._cbs.onattribend();
this._state = 8 /* BeforeAttributeName */;
this._state = 8 /* State.BeforeAttributeName */;
this._index--;

@@ -324,3 +324,3 @@ }

this._baseState = this._state;
this._state = 51 /* BeforeEntity */;
this._state = 51 /* State.BeforeEntity */;
this._sectionStart = this._index;

@@ -332,6 +332,6 @@ }

c === "["
? 22 /* BeforeCdata1 */
? 22 /* State.BeforeCdata1 */
: c === "-"
? 18 /* BeforeComment */
: 16 /* InDeclaration */;
? 18 /* State.BeforeComment */
: 16 /* State.InDeclaration */;
};

@@ -341,3 +341,3 @@ Tokenizer.prototype._stateInDeclaration = function (c) {

this._cbs.ondeclaration(this._getSection());
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;

@@ -349,3 +349,3 @@ }

this._cbs.onprocessinginstruction(this._getSection());
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;

@@ -356,7 +356,7 @@ }

if (c === "-") {
this._state = 19 /* InComment */;
this._state = 19 /* State.InComment */;
this._sectionStart = this._index + 1;
}
else {
this._state = 16 /* InDeclaration */;
this._state = 16 /* State.InDeclaration */;
}

@@ -366,10 +366,10 @@ };

if (c === "-")
this._state = 20 /* AfterComment1 */;
this._state = 20 /* State.AfterComment1 */;
};
Tokenizer.prototype._stateAfterComment1 = function (c) {
if (c === "-") {
this._state = 21 /* AfterComment2 */;
this._state = 21 /* State.AfterComment2 */;
}
else {
this._state = 19 /* InComment */;
this._state = 19 /* State.InComment */;
}

@@ -381,7 +381,7 @@ };

this._cbs.oncomment(this._buffer.substring(this._sectionStart, this._index - 2));
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;
}
else if (c !== "-") {
this._state = 19 /* InComment */;
this._state = 19 /* State.InComment */;
}

@@ -392,7 +392,7 @@ // else: stay in AFTER_COMMENT_2 (`--->`)

if (c === "[") {
this._state = 28 /* InCdata */;
this._state = 28 /* State.InCdata */;
this._sectionStart = this._index + 1;
}
else {
this._state = 16 /* InDeclaration */;
this._state = 16 /* State.InDeclaration */;
this._index--;

@@ -403,9 +403,9 @@ }

if (c === "]")
this._state = 29 /* AfterCdata1 */;
this._state = 29 /* State.AfterCdata1 */;
};
Tokenizer.prototype._stateAfterCdata1 = function (c) {
if (c === "]")
this._state = 30 /* AfterCdata2 */;
this._state = 30 /* State.AfterCdata2 */;
else
this._state = 28 /* InCdata */;
this._state = 28 /* State.InCdata */;
};

@@ -416,7 +416,7 @@ Tokenizer.prototype._stateAfterCdata2 = function (c) {

this._cbs.oncdata(this._buffer.substring(this._sectionStart, this._index - 2));
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
this._sectionStart = this._index + 1;
}
else if (c !== "]") {
this._state = 28 /* InCdata */;
this._state = 28 /* State.InCdata */;
}

@@ -427,9 +427,9 @@ //else: stay in AFTER_CDATA_2 (`]]]>`)

if (c === "c" || c === "C") {
this._state = 33 /* BeforeScript1 */;
this._state = 33 /* State.BeforeScript1 */;
}
else if (c === "t" || c === "T") {
this._state = 43 /* BeforeStyle1 */;
this._state = 43 /* State.BeforeStyle1 */;
}
else {
this._state = 3 /* InTagName */;
this._state = 3 /* State.InTagName */;
this._index--; //consume the token again

@@ -439,17 +439,17 @@ }

Tokenizer.prototype._stateBeforeSpecialEnd = function (c) {
if (this._special === 2 /* Script */ && (c === "c" || c === "C")) {
this._state = 38 /* AfterScript1 */;
if (this._special === 2 /* Special.Script */ && (c === "c" || c === "C")) {
this._state = 38 /* State.AfterScript1 */;
}
else if (this._special === 3 /* Style */ &&
else if (this._special === 3 /* Special.Style */ &&
(c === "t" || c === "T")) {
this._state = 47 /* AfterStyle1 */;
this._state = 47 /* State.AfterStyle1 */;
}
else
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
};
Tokenizer.prototype._stateBeforeScript5 = function (c) {
if (c === "/" || c === ">" || whitespace(c)) {
this._special = 2 /* Script */;
this._special = 2 /* Special.Script */;
}
this._state = 3 /* InTagName */;
this._state = 3 /* State.InTagName */;
this._index--; //consume the token again

@@ -459,4 +459,4 @@ };

if (c === ">" || whitespace(c)) {
this._special = 1 /* None */;
this._state = 6 /* InClosingTagName */;
this._special = 1 /* Special.None */;
this._state = 6 /* State.InClosingTagName */;
this._sectionStart = this._index - 6;

@@ -466,9 +466,9 @@ this._index--; //reconsume the token

else
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
};
Tokenizer.prototype._stateBeforeStyle4 = function (c) {
if (c === "/" || c === ">" || whitespace(c)) {
this._special = 3 /* Style */;
this._special = 3 /* Special.Style */;
}
this._state = 3 /* InTagName */;
this._state = 3 /* State.InTagName */;
this._index--; //consume the token again

@@ -478,4 +478,4 @@ };

if (c === ">" || whitespace(c)) {
this._special = 1 /* None */;
this._state = 6 /* InClosingTagName */;
this._special = 1 /* Special.None */;
this._state = 6 /* State.InClosingTagName */;
this._sectionStart = this._index - 5;

@@ -485,3 +485,3 @@ this._index--; //reconsume the token

else
this._state = 1 /* Text */;
this._state = 1 /* State.Text */;
};

@@ -534,3 +534,3 @@ //for entities terminated with a semicolon

}
else if (this._baseState !== 1 /* Text */) {
else if (this._baseState !== 1 /* State.Text */) {
if (c !== "=") {

@@ -553,3 +553,3 @@ this._parseNamedEntityStrict();

var parsed = parseInt(entity, base);
this._emitPartial(decode_codepoint_1.default(parsed));
this._emitPartial((0, decode_codepoint_1.default)(parsed));
this._sectionStart = this._index;

@@ -601,3 +601,3 @@ }

else if (this._running) {
if (this._state === 1 /* Text */) {
if (this._state === 1 /* State.Text */) {
if (this._sectionStart !== this._index) {

@@ -637,165 +637,165 @@ this._cbs.ontext(this._buffer.substr(this._sectionStart));

var c = this._buffer.charAt(this._index);
if (this._state === 1 /* Text */) {
if (this._state === 1 /* State.Text */) {
this._stateText(c);
}
else if (this._state === 12 /* InAttributeValueDq */) {
else if (this._state === 12 /* State.InAttributeValueDq */) {
this._stateInAttributeValueDoubleQuotes(c);
}
else if (this._state === 9 /* InAttributeName */) {
else if (this._state === 9 /* State.InAttributeName */) {
this._stateInAttributeName(c);
}
else if (this._state === 19 /* InComment */) {
else if (this._state === 19 /* State.InComment */) {
this._stateInComment(c);
}
else if (this._state === 8 /* BeforeAttributeName */) {
else if (this._state === 8 /* State.BeforeAttributeName */) {
this._stateBeforeAttributeName(c);
}
else if (this._state === 3 /* InTagName */) {
else if (this._state === 3 /* State.InTagName */) {
this._stateInTagName(c);
}
else if (this._state === 6 /* InClosingTagName */) {
else if (this._state === 6 /* State.InClosingTagName */) {
this._stateInClosingTagName(c);
}
else if (this._state === 2 /* BeforeTagName */) {
else if (this._state === 2 /* State.BeforeTagName */) {
this._stateBeforeTagName(c);
}
else if (this._state === 10 /* AfterAttributeName */) {
else if (this._state === 10 /* State.AfterAttributeName */) {
this._stateAfterAttributeName(c);
}
else if (this._state === 13 /* InAttributeValueSq */) {
else if (this._state === 13 /* State.InAttributeValueSq */) {
this._stateInAttributeValueSingleQuotes(c);
}
else if (this._state === 11 /* BeforeAttributeValue */) {
else if (this._state === 11 /* State.BeforeAttributeValue */) {
this._stateBeforeAttributeValue(c);
}
else if (this._state === 5 /* BeforeClosingTagName */) {
else if (this._state === 5 /* State.BeforeClosingTagName */) {
this._stateBeforeClosingTagName(c);
}
else if (this._state === 7 /* AfterClosingTagName */) {
else if (this._state === 7 /* State.AfterClosingTagName */) {
this._stateAfterClosingTagName(c);
}
else if (this._state === 31 /* BeforeSpecial */) {
else if (this._state === 31 /* State.BeforeSpecial */) {
this._stateBeforeSpecial(c);
}
else if (this._state === 20 /* AfterComment1 */) {
else if (this._state === 20 /* State.AfterComment1 */) {
this._stateAfterComment1(c);
}
else if (this._state === 14 /* InAttributeValueNq */) {
else if (this._state === 14 /* State.InAttributeValueNq */) {
this._stateInAttributeValueNoQuotes(c);
}
else if (this._state === 4 /* InSelfClosingTag */) {
else if (this._state === 4 /* State.InSelfClosingTag */) {
this._stateInSelfClosingTag(c);
}
else if (this._state === 16 /* InDeclaration */) {
else if (this._state === 16 /* State.InDeclaration */) {
this._stateInDeclaration(c);
}
else if (this._state === 15 /* BeforeDeclaration */) {
else if (this._state === 15 /* State.BeforeDeclaration */) {
this._stateBeforeDeclaration(c);
}
else if (this._state === 21 /* AfterComment2 */) {
else if (this._state === 21 /* State.AfterComment2 */) {
this._stateAfterComment2(c);
}
else if (this._state === 18 /* BeforeComment */) {
else if (this._state === 18 /* State.BeforeComment */) {
this._stateBeforeComment(c);
}
else if (this._state === 32 /* BeforeSpecialEnd */) {
else if (this._state === 32 /* State.BeforeSpecialEnd */) {
this._stateBeforeSpecialEnd(c);
}
else if (this._state === 38 /* AfterScript1 */) {
else if (this._state === 38 /* State.AfterScript1 */) {
stateAfterScript1(this, c);
}
else if (this._state === 39 /* AfterScript2 */) {
else if (this._state === 39 /* State.AfterScript2 */) {
stateAfterScript2(this, c);
}
else if (this._state === 40 /* AfterScript3 */) {
else if (this._state === 40 /* State.AfterScript3 */) {
stateAfterScript3(this, c);
}
else if (this._state === 33 /* BeforeScript1 */) {
else if (this._state === 33 /* State.BeforeScript1 */) {
stateBeforeScript1(this, c);
}
else if (this._state === 34 /* BeforeScript2 */) {
else if (this._state === 34 /* State.BeforeScript2 */) {
stateBeforeScript2(this, c);
}
else if (this._state === 35 /* BeforeScript3 */) {
else if (this._state === 35 /* State.BeforeScript3 */) {
stateBeforeScript3(this, c);
}
else if (this._state === 36 /* BeforeScript4 */) {
else if (this._state === 36 /* State.BeforeScript4 */) {
stateBeforeScript4(this, c);
}
else if (this._state === 37 /* BeforeScript5 */) {
else if (this._state === 37 /* State.BeforeScript5 */) {
this._stateBeforeScript5(c);
}
else if (this._state === 41 /* AfterScript4 */) {
else if (this._state === 41 /* State.AfterScript4 */) {
stateAfterScript4(this, c);
}
else if (this._state === 42 /* AfterScript5 */) {
else if (this._state === 42 /* State.AfterScript5 */) {
this._stateAfterScript5(c);
}
else if (this._state === 43 /* BeforeStyle1 */) {
else if (this._state === 43 /* State.BeforeStyle1 */) {
stateBeforeStyle1(this, c);
}
else if (this._state === 28 /* InCdata */) {
else if (this._state === 28 /* State.InCdata */) {
this._stateInCdata(c);
}
else if (this._state === 44 /* BeforeStyle2 */) {
else if (this._state === 44 /* State.BeforeStyle2 */) {
stateBeforeStyle2(this, c);
}
else if (this._state === 45 /* BeforeStyle3 */) {
else if (this._state === 45 /* State.BeforeStyle3 */) {
stateBeforeStyle3(this, c);
}
else if (this._state === 46 /* BeforeStyle4 */) {
else if (this._state === 46 /* State.BeforeStyle4 */) {
this._stateBeforeStyle4(c);
}
else if (this._state === 47 /* AfterStyle1 */) {
else if (this._state === 47 /* State.AfterStyle1 */) {
stateAfterStyle1(this, c);
}
else if (this._state === 48 /* AfterStyle2 */) {
else if (this._state === 48 /* State.AfterStyle2 */) {
stateAfterStyle2(this, c);
}
else if (this._state === 49 /* AfterStyle3 */) {
else if (this._state === 49 /* State.AfterStyle3 */) {
stateAfterStyle3(this, c);
}
else if (this._state === 50 /* AfterStyle4 */) {
else if (this._state === 50 /* State.AfterStyle4 */) {
this._stateAfterStyle4(c);
}
else if (this._state === 17 /* InProcessingInstruction */) {
else if (this._state === 17 /* State.InProcessingInstruction */) {
this._stateInProcessingInstruction(c);
}
else if (this._state === 53 /* InNamedEntity */) {
else if (this._state === 53 /* State.InNamedEntity */) {
this._stateInNamedEntity(c);
}
else if (this._state === 22 /* BeforeCdata1 */) {
else if (this._state === 22 /* State.BeforeCdata1 */) {
stateBeforeCdata1(this, c);
}
else if (this._state === 51 /* BeforeEntity */) {
else if (this._state === 51 /* State.BeforeEntity */) {
stateBeforeEntity(this, c);
}
else if (this._state === 23 /* BeforeCdata2 */) {
else if (this._state === 23 /* State.BeforeCdata2 */) {
stateBeforeCdata2(this, c);
}
else if (this._state === 24 /* BeforeCdata3 */) {
else if (this._state === 24 /* State.BeforeCdata3 */) {
stateBeforeCdata3(this, c);
}
else if (this._state === 29 /* AfterCdata1 */) {
else if (this._state === 29 /* State.AfterCdata1 */) {
this._stateAfterCdata1(c);
}
else if (this._state === 30 /* AfterCdata2 */) {
else if (this._state === 30 /* State.AfterCdata2 */) {
this._stateAfterCdata2(c);
}
else if (this._state === 25 /* BeforeCdata4 */) {
else if (this._state === 25 /* State.BeforeCdata4 */) {
stateBeforeCdata4(this, c);
}
else if (this._state === 26 /* BeforeCdata5 */) {
else if (this._state === 26 /* State.BeforeCdata5 */) {
stateBeforeCdata5(this, c);
}
else if (this._state === 27 /* BeforeCdata6 */) {
else if (this._state === 27 /* State.BeforeCdata6 */) {
this._stateBeforeCdata6(c);
}
else if (this._state === 55 /* InHexEntity */) {
else if (this._state === 55 /* State.InHexEntity */) {
this._stateInHexEntity(c);
}
else if (this._state === 54 /* InNumericEntity */) {
else if (this._state === 54 /* State.InNumericEntity */) {
this._stateInNumericEntity(c);
}
else if (this._state === 52 /* BeforeNumericEntity */) {
else if (this._state === 52 /* State.BeforeNumericEntity */) {
stateBeforeNumericEntity(this, c);

@@ -840,13 +840,13 @@ }

var data = this._buffer.substr(this._sectionStart);
if (this._state === 28 /* InCdata */ ||
this._state === 29 /* AfterCdata1 */ ||
this._state === 30 /* AfterCdata2 */) {
if (this._state === 28 /* State.InCdata */ ||
this._state === 29 /* State.AfterCdata1 */ ||
this._state === 30 /* State.AfterCdata2 */) {
this._cbs.oncdata(data);
}
else if (this._state === 19 /* InComment */ ||
this._state === 20 /* AfterComment1 */ ||
this._state === 21 /* AfterComment2 */) {
else if (this._state === 19 /* State.InComment */ ||
this._state === 20 /* State.AfterComment1 */ ||
this._state === 21 /* State.AfterComment2 */) {
this._cbs.oncomment(data);
}
else if (this._state === 53 /* InNamedEntity */ && !this._xmlMode) {
else if (this._state === 53 /* State.InNamedEntity */ && !this._xmlMode) {
this._parseLegacyEntity();

@@ -858,3 +858,3 @@ if (this._sectionStart < this._index) {

}
else if (this._state === 54 /* InNumericEntity */ && !this._xmlMode) {
else if (this._state === 54 /* State.InNumericEntity */ && !this._xmlMode) {
this._decodeNumericEntity(2, 10);

@@ -866,3 +866,3 @@ if (this._sectionStart < this._index) {

}
else if (this._state === 55 /* InHexEntity */ && !this._xmlMode) {
else if (this._state === 55 /* State.InHexEntity */ && !this._xmlMode) {
this._decodeNumericEntity(3, 16);

@@ -874,11 +874,11 @@ if (this._sectionStart < this._index) {

}
else if (this._state !== 3 /* InTagName */ &&
this._state !== 8 /* BeforeAttributeName */ &&
this._state !== 11 /* BeforeAttributeValue */ &&
this._state !== 10 /* AfterAttributeName */ &&
this._state !== 9 /* InAttributeName */ &&
this._state !== 13 /* InAttributeValueSq */ &&
this._state !== 12 /* InAttributeValueDq */ &&
this._state !== 14 /* InAttributeValueNq */ &&
this._state !== 6 /* InClosingTagName */) {
else if (this._state !== 3 /* State.InTagName */ &&
this._state !== 8 /* State.BeforeAttributeName */ &&
this._state !== 11 /* State.BeforeAttributeValue */ &&
this._state !== 10 /* State.AfterAttributeName */ &&
this._state !== 9 /* State.InAttributeName */ &&
this._state !== 13 /* State.InAttributeValueSq */ &&
this._state !== 12 /* State.InAttributeValueDq */ &&
this._state !== 14 /* State.InAttributeValueNq */ &&
this._state !== 6 /* State.InClosingTagName */) {
this._cbs.ontext(data);

@@ -900,3 +900,3 @@ }

Tokenizer.prototype._emitPartial = function (value) {
if (this._baseState !== 1 /* Text */) {
if (this._baseState !== 1 /* State.Text */) {
this._cbs.onattribdata(value); //TODO implement the new event

@@ -903,0 +903,0 @@ }

/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import { Parser, Handler, ParserOptions } from "./Parser";

@@ -3,0 +5,0 @@ import { Writable } from "stream";

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -17,2 +19,3 @@ function __() { this.constructor = d; }

Object.defineProperty(exports, "__esModule", { value: true });
exports.WritableStream = void 0;
var Parser_1 = require("./Parser");

@@ -19,0 +22,0 @@ var stream_1 = require("stream");

{
"name": "@joplin/fork-htmlparser2",
"description": "Fast & forgiving HTML/XML/RSS parser",
"version": "4.1.41",
"version": "4.1.42",
"author": "Felix Boehm <me@feedic.com>",

@@ -42,19 +42,19 @@ "publishConfig": {

"dependencies": {
"domelementtype": "^2.0.1",
"domhandler": "3.0.0",
"domutils": "^2.0.0",
"entities": "^2.0.0"
"domelementtype": "2.3.0",
"domhandler": "3.3.0",
"domutils": "3.0.1",
"entities": "2.2.0"
},
"devDependencies": {
"@types/jest": "^25.1.3",
"@types/node": "^13.1.1",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"coveralls": "^3.0.1",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"jest": "^26.6.3",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"typescript": "3.8.2"
"@types/jest": "29.2.6",
"@types/node": "18.11.18",
"@typescript-eslint/eslint-plugin": "5.48.2",
"@typescript-eslint/parser": "5.48.2",
"coveralls": "3.1.1",
"eslint": "8.31.0",
"eslint-config-prettier": "8.6.0",
"jest": "29.4.2",
"prettier": "2.8.3",
"ts-jest": "29.0.5",
"typescript": "4.9.4"
},

@@ -69,3 +69,3 @@ "jest": {

},
"gitHead": "713c00053ecc2fcb0b371d05ba7e3796aed93006"
"gitHead": "1bbf065142563ced2631721e1c26213edae04fca"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc