parse5-htmlparser2-tree-adapter
Advanced tools
Comparing version 7.0.0 to 7.1.0
import { type TreeAdapterTypeMap, type TreeAdapter } from 'parse5'; | ||
import { type AnyNode, type ParentNode, type ChildNode, Element, Document, ProcessingInstruction, Comment, Text } from 'domhandler'; | ||
export declare type Htmlparser2TreeAdapterMap = TreeAdapterTypeMap<AnyNode, ParentNode, ChildNode, Document, Document, Element, Comment, Text, Element, ProcessingInstruction>; | ||
export type Htmlparser2TreeAdapterMap = TreeAdapterTypeMap<AnyNode, ParentNode, ChildNode, Document, Document, Element, Comment, Text, Element, ProcessingInstruction>; | ||
/** @internal */ | ||
export declare function serializeDoctypeContent(name: string, publicId: string, systemId: string): string; | ||
export declare const adapter: TreeAdapter<Htmlparser2TreeAdapterMap>; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.adapter = exports.serializeDoctypeContent = void 0; | ||
exports.adapter = void 0; | ||
exports.serializeDoctypeContent = serializeDoctypeContent; | ||
const parse5_1 = require("parse5"); | ||
const domhandler_1 = require("domhandler"); | ||
function createTextNode(value) { | ||
return new domhandler_1.Text(value); | ||
} | ||
function enquoteDoctypeId(id) { | ||
@@ -30,3 +28,2 @@ const quote = id.includes('"') ? "'" : '"'; | ||
} | ||
exports.serializeDoctypeContent = serializeDoctypeContent; | ||
exports.adapter = { | ||
@@ -65,2 +62,5 @@ // Re-exports from domhandler | ||
}, | ||
createTextNode(value) { | ||
return new domhandler_1.Text(value); | ||
}, | ||
//Tree mutation | ||
@@ -104,5 +104,5 @@ appendChild(parentNode, newNode) { | ||
} | ||
doctypeNode['x-name'] = name !== null && name !== void 0 ? name : undefined; | ||
doctypeNode['x-publicId'] = publicId !== null && publicId !== void 0 ? publicId : undefined; | ||
doctypeNode['x-systemId'] = systemId !== null && systemId !== void 0 ? systemId : undefined; | ||
doctypeNode['x-name'] = name; | ||
doctypeNode['x-publicId'] = publicId; | ||
doctypeNode['x-systemId'] = systemId; | ||
}, | ||
@@ -137,3 +137,3 @@ setDocumentMode(document, mode) { | ||
else { | ||
exports.adapter.appendChild(parentNode, createTextNode(text)); | ||
exports.adapter.appendChild(parentNode, exports.adapter.createTextNode(text)); | ||
} | ||
@@ -147,3 +147,3 @@ }, | ||
else { | ||
exports.adapter.insertBefore(parentNode, createTextNode(text), referenceNode); | ||
exports.adapter.insertBefore(parentNode, exports.adapter.createTextNode(text), referenceNode); | ||
} | ||
@@ -154,3 +154,3 @@ }, | ||
const attrName = attrs[i].name; | ||
if (typeof recipient.attribs[attrName] === 'undefined') { | ||
if (recipient.attribs[attrName] === undefined) { | ||
recipient.attribs[attrName] = attrs[i].value; | ||
@@ -221,2 +221,1 @@ recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; | ||
}; | ||
//# sourceMappingURL=index.js.map |
import { type TreeAdapterTypeMap, type TreeAdapter } from 'parse5'; | ||
import { type AnyNode, type ParentNode, type ChildNode, Element, Document, ProcessingInstruction, Comment, Text } from 'domhandler'; | ||
export declare type Htmlparser2TreeAdapterMap = TreeAdapterTypeMap<AnyNode, ParentNode, ChildNode, Document, Document, Element, Comment, Text, Element, ProcessingInstruction>; | ||
export type Htmlparser2TreeAdapterMap = TreeAdapterTypeMap<AnyNode, ParentNode, ChildNode, Document, Document, Element, Comment, Text, Element, ProcessingInstruction>; | ||
/** @internal */ | ||
export declare function serializeDoctypeContent(name: string, publicId: string, systemId: string): string; | ||
export declare const adapter: TreeAdapter<Htmlparser2TreeAdapterMap>; | ||
//# sourceMappingURL=index.d.ts.map |
import { html } from 'parse5'; | ||
import { Element, Document, ProcessingInstruction, Comment, Text, isDirective, isText, isComment, isTag, } from 'domhandler'; | ||
function createTextNode(value) { | ||
return new Text(value); | ||
} | ||
function enquoteDoctypeId(id) { | ||
@@ -60,2 +57,5 @@ const quote = id.includes('"') ? "'" : '"'; | ||
}, | ||
createTextNode(value) { | ||
return new Text(value); | ||
}, | ||
//Tree mutation | ||
@@ -99,5 +99,5 @@ appendChild(parentNode, newNode) { | ||
} | ||
doctypeNode['x-name'] = name !== null && name !== void 0 ? name : undefined; | ||
doctypeNode['x-publicId'] = publicId !== null && publicId !== void 0 ? publicId : undefined; | ||
doctypeNode['x-systemId'] = systemId !== null && systemId !== void 0 ? systemId : undefined; | ||
doctypeNode['x-name'] = name; | ||
doctypeNode['x-publicId'] = publicId; | ||
doctypeNode['x-systemId'] = systemId; | ||
}, | ||
@@ -132,3 +132,3 @@ setDocumentMode(document, mode) { | ||
else { | ||
adapter.appendChild(parentNode, createTextNode(text)); | ||
adapter.appendChild(parentNode, adapter.createTextNode(text)); | ||
} | ||
@@ -142,3 +142,3 @@ }, | ||
else { | ||
adapter.insertBefore(parentNode, createTextNode(text), referenceNode); | ||
adapter.insertBefore(parentNode, adapter.createTextNode(text), referenceNode); | ||
} | ||
@@ -149,3 +149,3 @@ }, | ||
const attrName = attrs[i].name; | ||
if (typeof recipient.attribs[attrName] === 'undefined') { | ||
if (recipient.attribs[attrName] === undefined) { | ||
recipient.attribs[attrName] = attrs[i].value; | ||
@@ -219,2 +219,1 @@ recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -5,6 +5,6 @@ { | ||
"description": "htmlparser2 tree adapter for parse5.", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)", | ||
"contributors": "https://github.com/inikulin/parse5/graphs/contributors", | ||
"homepage": "https://github.com/inikulin/parse5", | ||
"homepage": "https://parse5.js.org", | ||
"funding": "https://github.com/inikulin/parse5?sponsor=1", | ||
@@ -26,7 +26,7 @@ "keywords": [ | ||
"dependencies": { | ||
"domhandler": "^5.0.2", | ||
"domhandler": "^5.0.3", | ||
"parse5": "^7.0.0" | ||
}, | ||
"scripts": { | ||
"build:cjs": "tsc --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json" | ||
"build:cjs": "tsc --moduleResolution node10 --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json" | ||
}, | ||
@@ -38,5 +38,6 @@ "repository": { | ||
"files": [ | ||
"dist", | ||
"!*.map" | ||
"dist/cjs/package.json", | ||
"dist/**/*.js", | ||
"dist/**/*.d.ts" | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unstable ownership
Supply chain riskA new collaborator has begun publishing package versions. Package stability and security risk may be elevated.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1
18745
1
Updateddomhandler@^5.0.3