File tree 3 files changed +21
-6
lines changed
3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 1
1
// TypeScript Version: 4.7
2
+ /* eslint-disable no-undef, no-unused-vars */
2
3
3
- import { ParserOptions } from 'htmlparser2' ;
4
4
import {
5
5
Comment ,
6
- DomHandlerOptions ,
7
6
Element ,
8
7
Node ,
9
8
ProcessingInstruction ,
10
- Text
9
+ Text ,
10
+ type DomHandlerOptions
11
11
} from 'domhandler' ;
12
12
import htmlToDOM from 'html-dom-parser' ;
13
+ import { ParserOptions } from 'htmlparser2' ;
13
14
14
15
import attributesToProps from './lib/attributes-to-props' ;
15
16
import 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' ) ;
3
2
var htmlToDOM = require ( 'html-dom-parser' ) ;
4
3
4
+ var attributesToProps = require ( './lib/attributes-to-props' ) ;
5
+ var domToReact = require ( './lib/dom-to-react' ) ;
6
+
5
7
// support backwards compatibility for ES Module
6
8
htmlToDOM =
7
9
/* istanbul ignore next */
@@ -36,7 +38,13 @@ function HTMLReactParser(html, options) {
36
38
HTMLReactParser . domToReact = domToReact ;
37
39
HTMLReactParser . htmlToDOM = htmlToDOM ;
38
40
HTMLReactParser . 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 ;
40
48
41
49
// support CommonJS and ES Modules
42
50
module . exports = HTMLReactParser ;
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ import HTMLReactParser from './index.js';
3
3
export var domToReact = HTMLReactParser . domToReact ;
4
4
export var htmlToDOM = HTMLReactParser . htmlToDOM ;
5
5
export var attributesToProps = HTMLReactParser . attributesToProps ;
6
+
7
+ // domhandler
8
+ export var Comment = HTMLReactParser . Comment ;
6
9
export var Element = HTMLReactParser . Element ;
10
+ export var Node = HTMLReactParser . Node ;
11
+ export var ProcessingInstruction = HTMLReactParser . ProcessingInstruction ;
12
+ export var Text = HTMLReactParser . Text ;
7
13
8
14
export default HTMLReactParser ;
You can’t perform that action at this time.
0 commit comments