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

@types/parse5

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/parse5 - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

240

parse5/index.d.ts

@@ -8,3 +8,4 @@ // Type definitions for parse5 6.0

export interface Location {
export {};
interface EndLocationBase {
/**

@@ -24,3 +25,5 @@ * One-based column index of the last character

endLine: number;
}
export interface Location extends EndLocationBase {
/**

@@ -42,2 +45,4 @@ * One-based column index of the first character

export interface EndLocation extends EndLocationBase, Partial<ElementLocationBase> {}
export interface AttributesLocation {

@@ -54,3 +59,3 @@ [attributeName: string]: Location;

export interface ElementLocation extends StartTagLocation {
export interface ElementLocation extends ElementLocationBase, StartTagLocation {
/**

@@ -60,3 +65,5 @@ * Element's start tag location info.

startTag: StartTagLocation;
}
interface ElementLocationBase {
/**

@@ -70,6 +77,6 @@ * Element's end tag location info.

/**
* The [scripting flag](https://html.spec.whatwg.org/multipage/parsing.html#scripting-flag). If set
* to `true`, `noscript` element content will be parsed as text.
* The [scripting flag](https://html.spec.whatwg.org/multipage/parsing.html#scripting-flag).
* If set to `true`, `<noscript>` element content will be parsed as text.
*
* **Default:** `true`
* @default true
*/

@@ -86,3 +93,3 @@ scriptingEnabled?: boolean | undefined;

*
* **Default:** `false`
* @default false
*/

@@ -94,3 +101,3 @@ sourceCodeLocationInfo?: boolean | undefined;

*
* **Default:** `treeAdapters.default`
* @default require("./lib/tree-adapters/default")
*/

@@ -104,3 +111,3 @@ treeAdapter?: T | undefined;

*
* **Default:** `treeAdapters.default`
* @default require("./lib/tree-adapters/default")
*/

@@ -113,3 +120,3 @@ treeAdapter?: T | undefined;

*/
export type DocumentMode = "no-quirks" | "quirks" | "limited-quirks";
export type DocumentMode = 'no-quirks' | 'quirks' | 'limited-quirks';

@@ -150,3 +157,3 @@ // Default tree adapter

*/
nodeName: "#documentType";
nodeName: '#documentType';

@@ -176,3 +183,3 @@ /**

*/
nodeName: "#document";
nodeName: '#document';

@@ -197,3 +204,3 @@ /**

*/
nodeName: "#document-fragment";
nodeName: '#document-fragment';

@@ -253,3 +260,3 @@ /**

*/
nodeName: "#comment";
nodeName: '#comment';

@@ -279,3 +286,3 @@ /**

*/
nodeName: "#text";
nodeName: '#text';

@@ -326,57 +333,2 @@ /**

export interface TreeAdapter {
adoptAttributes(recipient: unknown, attrs: unknown[]): void;
appendChild(parentNode: unknown, newNode: unknown): void;
createCommentNode(data: string): unknown;
createDocument(): unknown;
createDocumentFragment(): unknown;
createElement(
tagName: string,
namespaceURI: string,
attrs: unknown[]
): unknown;
detachNode(node: unknown): void;
getAttrList(element: unknown): unknown[];
getChildNodes(node: unknown): unknown[];
getCommentNodeContent(commentNode: unknown): string;
getDocumentMode(document: unknown): unknown;
getDocumentTypeNodeName(doctypeNode: unknown): string;
getDocumentTypeNodePublicId(doctypeNode: unknown): string;
getDocumentTypeNodeSystemId(doctypeNode: unknown): string;
getFirstChild(node: unknown): unknown;
getNamespaceURI(element: unknown): string;
getNodeSourceCodeLocation(node: unknown): Location | StartTagLocation | ElementLocation;
getParentNode(node: unknown): unknown;
getTagName(element: unknown): string;
getTextNodeContent(textNode: unknown): string;
getTemplateContent(templateElement: unknown): unknown;
insertBefore(
parentNode: unknown,
newNode: unknown,
referenceNode: unknown
): void;
insertText(parentNode: unknown, text: string): void;
insertTextBefore(
parentNode: unknown,
text: string,
referenceNode: unknown
): void;
isCommentNode(node: unknown): boolean;
isDocumentTypeNode(node: unknown): boolean;
isElementNode(node: unknown): boolean;
isTextNode(node: unknown): boolean;
setDocumentMode(document: unknown, mode: DocumentMode): void;
setDocumentType(
document: unknown,
name: string,
publicId: string,
systemId: string
): void;
setNodeSourceCodeLocation(node: unknown, location: Location | StartTagLocation | ElementLocation): void;
setTemplateContent(
templateElement: unknown,
contentElement: unknown
): void;
}
/**

@@ -389,3 +341,3 @@ * Tree adapter is a set of utility functions that provides minimal required abstraction layer beetween parser and a specific AST format.

*/
export interface TypedTreeAdapter<T extends TreeAdapterTypeMap> extends TreeAdapter {
export interface TreeAdapter {
/**

@@ -397,3 +349,3 @@ * Copies attributes to the given element. Only attributes that are not yet present in the element are copied.

*/
adoptAttributes(recipient: T['element'], attrs: Array<T['attribute']>): void;
adoptAttributes(recipient: unknown, attrs: unknown[]): void;

@@ -406,3 +358,3 @@ /**

*/
appendChild(parentNode: T['parentNode'], newNode: T['node']): void;
appendChild(parentNode: unknown, newNode: unknown): void;

@@ -414,3 +366,3 @@ /**

*/
createCommentNode(data: string): T['commentNode'];
createCommentNode(data: string): unknown;

@@ -420,3 +372,3 @@ /**

*/
createDocument(): T['document'];
createDocument(): unknown;

@@ -426,3 +378,3 @@ /**

*/
createDocumentFragment(): T['documentFragment'];
createDocumentFragment(): unknown;

@@ -436,7 +388,3 @@ /**

*/
createElement(
tagName: string,
namespaceURI: string,
attrs: Array<T['attribute']>
): T['element'];
createElement(tagName: string, namespaceURI: string, attrs: unknown[]): unknown;

@@ -448,4 +396,3 @@ /**

*/
detachNode(node: T['node']): void;
detachNode(node: unknown): void;
/**

@@ -457,3 +404,3 @@ * Returns the given element's attributes in an array, in the form of name-value pairs.

*/
getAttrList(element: T['element']): Array<T['attribute']>;
getAttrList(element: unknown): unknown[];

@@ -465,3 +412,3 @@ /**

*/
getChildNodes(node: T['parentNode']): Array<T['childNode']>;
getChildNodes(node: unknown): unknown[];

@@ -473,3 +420,3 @@ /**

*/
getCommentNodeContent(commentNode: T['commentNode']): string;
getCommentNodeContent(commentNode: unknown): string;

@@ -481,3 +428,3 @@ /**

*/
getDocumentMode(document: T['document']): DocumentMode;
getDocumentMode(document: unknown): unknown;

@@ -489,3 +436,3 @@ /**

*/
getDocumentTypeNodeName(doctypeNode: T['documentType']): string;
getDocumentTypeNodeName(doctypeNode: unknown): string;

@@ -497,3 +444,3 @@ /**

*/
getDocumentTypeNodePublicId(doctypeNode: T['documentType']): string;
getDocumentTypeNodePublicId(doctypeNode: unknown): string;

@@ -505,3 +452,3 @@ /**

*/
getDocumentTypeNodeSystemId(doctypeNode: T['documentType']): string;
getDocumentTypeNodeSystemId(doctypeNode: unknown): string;

@@ -513,3 +460,3 @@ /**

*/
getFirstChild(node: T['parentNode']): T['childNode']|undefined;
getFirstChild(node: unknown): unknown;

@@ -521,3 +468,3 @@ /**

*/
getNamespaceURI(element: T['element']): string;
getNamespaceURI(element: unknown): string;

@@ -529,3 +476,3 @@ /**

*/
getNodeSourceCodeLocation(node: T['node']): Location | StartTagLocation | ElementLocation;
getNodeSourceCodeLocation(node: unknown): Location | ElementLocation | null;

@@ -537,3 +484,3 @@ /**

*/
getParentNode(node: T['childNode']): T['parentNode'];
getParentNode(node: unknown): unknown;

@@ -545,3 +492,3 @@ /**

*/
getTagName(element: T['element']): string;
getTagName(element: unknown): string;

@@ -553,3 +500,3 @@ /**

*/
getTextNodeContent(textNode: T['textNode']): string;
getTextNodeContent(textNode: unknown): string;

@@ -561,3 +508,3 @@ /**

*/
getTemplateContent(templateElement: T['element']): T['documentFragment'];
getTemplateContent(templateElement: unknown): unknown;

@@ -571,7 +518,3 @@ /**

*/
insertBefore(
parentNode: T['parentNode'],
newNode: T['node'],
referenceNode: T['node']
): void;
insertBefore(parentNode: unknown, newNode: unknown, referenceNode: unknown): void;

@@ -585,3 +528,3 @@ /**

*/
insertText(parentNode: T['parentNode'], text: string): void;
insertText(parentNode: unknown, text: string): void;

@@ -597,7 +540,3 @@ /**

*/
insertTextBefore(
parentNode: T['parentNode'],
text: string,
referenceNode: T['node']
): void;
insertTextBefore(parentNode: unknown, text: string, referenceNode: unknown): void;

@@ -609,3 +548,3 @@ /**

*/
isCommentNode(node: T['node']): node is T['commentNode'];
isCommentNode(node: unknown): boolean;

@@ -617,3 +556,3 @@ /**

*/
isDocumentTypeNode(node: T['node']): node is T['documentType'];
isDocumentTypeNode(node: unknown): boolean;

@@ -625,3 +564,3 @@ /**

*/
isElementNode(node: T['node']): node is T['element'];
isElementNode(node: unknown): boolean;

@@ -633,3 +572,3 @@ /**

*/
isTextNode(node: T['node']): node is T['textNode'];
isTextNode(node: unknown): boolean;

@@ -642,3 +581,3 @@ /**

*/
setDocumentMode(document: T['document'], mode: DocumentMode): void;
setDocumentMode(document: unknown, mode: DocumentMode): void;

@@ -655,8 +594,3 @@ /**

*/
setDocumentType(
document: T['document'],
name: string,
publicId: string,
systemId: string
): void;
setDocumentType(document: unknown, name: string, publicId: string, systemId: string): void;

@@ -667,4 +601,5 @@ /**

* @param node - Node.
* @param location - The node location.
*/
setNodeSourceCodeLocation(node: T['node'], location: Location | StartTagLocation | ElementLocation): void;
setNodeSourceCodeLocation(node: unknown, location: Location | ElementLocation | null): void;

@@ -677,9 +612,57 @@ /**

*/
setTemplateContent(
templateElement: T['element'],
contentElement: T['documentFragment']
): void;
setTemplateContent(templateElement: unknown, contentElement: unknown): void;
/**
* Updates source code location information of the node.
*
* @param node - Node.
* @param location - The updated node end location.
*/
updateNodeSourceCodeLocation(node: unknown, location: EndLocation): void;
}
/**
* Tree adapter is a set of utility functions that provides minimal required abstraction layer beetween parser and a specific AST format.
* Note that `TreeAdapter` is not designed to be a general purpose AST manipulation library. You can build such library
* on top of existing `TreeAdapter` or use one of the existing libraries from npm.
*
* @see [default implementation](https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tree-adapters/default.js)
*/
export interface TypedTreeAdapter<T extends TreeAdapterTypeMap> extends TreeAdapter {
adoptAttributes(recipient: T['element'], attrs: Array<T['attribute']>): void;
appendChild(parentNode: T['parentNode'], newNode: T['node']): void;
createCommentNode(data: string): T['commentNode'];
createDocument(): T['document'];
createDocumentFragment(): T['documentFragment'];
createElement(tagName: string, namespaceURI: string, attrs: Array<T['attribute']>): T['element'];
detachNode(node: T['node']): void;
getAttrList(element: T['element']): Array<T['attribute']>;
getChildNodes(node: T['parentNode']): Array<T['childNode']>;
getCommentNodeContent(commentNode: T['commentNode']): string;
getDocumentMode(document: T['document']): DocumentMode;
getDocumentTypeNodeName(doctypeNode: T['documentType']): string;
getDocumentTypeNodePublicId(doctypeNode: T['documentType']): string;
getDocumentTypeNodeSystemId(doctypeNode: T['documentType']): string;
getFirstChild(node: T['parentNode']): T['childNode'] | undefined;
getNamespaceURI(element: T['element']): string;
getNodeSourceCodeLocation(node: T['node']): Location | ElementLocation | null;
getParentNode(node: T['childNode']): T['parentNode'];
getTagName(element: T['element']): string;
getTextNodeContent(textNode: T['textNode']): string;
getTemplateContent(templateElement: T['element']): T['documentFragment'];
insertBefore(parentNode: T['parentNode'], newNode: T['node'], referenceNode: T['node']): void;
insertText(parentNode: T['parentNode'], text: string): void;
insertTextBefore(parentNode: T['parentNode'], text: string, referenceNode: T['node']): void;
isCommentNode(node: T['node']): node is T['commentNode'];
isDocumentTypeNode(node: T['node']): node is T['documentType'];
isElementNode(node: T['node']): node is T['element'];
isTextNode(node: T['node']): node is T['textNode'];
setDocumentMode(document: T['document'], mode: DocumentMode): void;
setDocumentType(document: T['document'], name: string, publicId: string, systemId: string): void;
setNodeSourceCodeLocation(node: T['node'], location: Location | ElementLocation | null): void;
setTemplateContent(templateElement: T['element'], contentElement: T['documentFragment']): void;
updateNodeSourceCodeLocation(node: T['node'], location: EndLocation): void;
}
/**
* Parses an HTML string.

@@ -702,3 +685,4 @@ *

html: string,
options?: ParserOptions<T>): T extends TypedTreeAdapter<infer TMap> ? TMap['document'] : Document;
options?: ParserOptions<T>,
): T extends TypedTreeAdapter<infer TMap> ? TMap['document'] : Document;

@@ -729,3 +713,3 @@ /**

html: string,
options?: ParserOptions<T>
options?: ParserOptions<T>,
): T extends TypedTreeAdapter<infer TMap> ? TMap['documentFragment'] : DocumentFragment;

@@ -735,3 +719,4 @@ export function parseFragment<T extends TreeAdapter = typeof import('./lib/tree-adapters/default')>(

html: string,
options?: ParserOptions<T>): T extends TypedTreeAdapter<infer TMap> ? TMap['documentFragment'] : DocumentFragment;
options?: ParserOptions<T>,
): T extends TypedTreeAdapter<infer TMap> ? TMap['documentFragment'] : DocumentFragment;

@@ -762,2 +747,3 @@ /**

node: T extends TypedTreeAdapter<infer TMap> ? TMap['node'] : Node,
options?: SerializerOptions<T>): string;
options?: SerializerOptions<T>,
): string;
{
"name": "@types/parse5",
"version": "6.0.2",
"version": "6.0.3",
"description": "TypeScript definitions for parse5",

@@ -33,4 +33,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse5",

"dependencies": {},
"typesPublisherContentHash": "b41620812153a16652ae5d4324d682632c08e86eac8880ee0a2c0725072f6a9e",
"typeScriptVersion": "3.7"
"typesPublisherContentHash": "afe9711bf778002b8f18879cff27ed27d44e045475d0dbf3e40366b0cdfe80bf",
"typeScriptVersion": "3.8"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Sun, 24 Oct 2021 11:31:18 GMT
* Last updated: Tue, 30 Nov 2021 01:01:05 GMT
* Dependencies: none

@@ -14,0 +14,0 @@ * Global values: none

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