File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 11// TypeScript Version: 4.7
2+ /* eslint-disable no-undef, no-unused-vars */
23
3- import { ParserOptions } from 'htmlparser2' ;
44import {
55 Comment ,
6- DomHandlerOptions ,
76 Element ,
87 Node ,
98 ProcessingInstruction ,
10- Text
9+ Text ,
10+ type DomHandlerOptions
1111} from 'domhandler' ;
1212import htmlToDOM from 'html-dom-parser' ;
13+ import { ParserOptions } from 'htmlparser2' ;
1314
1415import attributesToProps from './lib/attributes-to-props' ;
1516import domToReact from './lib/dom-to-react' ;
Original file line number Diff line number Diff line change 1- var domToReact = require ( './lib/dom-to-react' ) ;
2- var attributesToProps = require ( './lib/attributes-to-props' ) ;
1+ var domhandler = require ( 'domhandler' ) ;
32var htmlToDOM = require ( 'html-dom-parser' ) ;
43
4+ var attributesToProps = require ( './lib/attributes-to-props' ) ;
5+ var domToReact = require ( './lib/dom-to-react' ) ;
6+
57// support backwards compatibility for ES Module
68htmlToDOM =
79 /* istanbul ignore next */
@@ -36,7 +38,13 @@ function HTMLReactParser(html, options) {
3638HTMLReactParser . domToReact = domToReact ;
3739HTMLReactParser . htmlToDOM = htmlToDOM ;
3840HTMLReactParser . attributesToProps = attributesToProps ;
39- HTMLReactParser . Element = require ( 'domhandler' ) . Element ;
41+
42+ // domhandler
43+ HTMLReactParser . Comment = domhandler . Comment ;
44+ HTMLReactParser . Element = domhandler . Element ;
45+ HTMLReactParser . Node = domhandler . Node ;
46+ HTMLReactParser . ProcessingInstruction = domhandler . ProcessingInstruction ;
47+ HTMLReactParser . Text = domhandler . Text ;
4048
4149// support CommonJS and ES Modules
4250module . exports = HTMLReactParser ;
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ import HTMLReactParser from './index.js';
33export var domToReact = HTMLReactParser . domToReact ;
44export var htmlToDOM = HTMLReactParser . htmlToDOM ;
55export var attributesToProps = HTMLReactParser . attributesToProps ;
6+
7+ // domhandler
8+ export var Comment = HTMLReactParser . Comment ;
69export var Element = HTMLReactParser . Element ;
10+ export var Node = HTMLReactParser . Node ;
11+ export var ProcessingInstruction = HTMLReactParser . ProcessingInstruction ;
12+ export var Text = HTMLReactParser . Text ;
713
814export default HTMLReactParser ;
You can’t perform that action at this time.
0 commit comments