parse5-parser-stream 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +12 -14
- package/package.json +11 -6
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Writable } from 'node:stream';
|
|
3
2
|
import { Parser, type ParserOptions, type TreeAdapterTypeMap, type DefaultTreeAdapterMap } from 'parse5';
|
|
4
3
|
/**
|
|
@@ -82,4 +81,3 @@ export interface ParserStream<T extends TreeAdapterTypeMap = DefaultTreeAdapterM
|
|
|
82
81
|
*/
|
|
83
82
|
on(event: string, handler: (...args: any[]) => void): this;
|
|
84
83
|
}
|
|
85
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Writable } from 'node:stream';
|
|
2
2
|
import { Parser } from 'parse5';
|
|
3
|
-
/* eslint-disable unicorn/consistent-function-scoping -- The rule seems to be broken here. */
|
|
4
3
|
/**
|
|
5
4
|
* Streaming HTML parser with scripting support.
|
|
6
5
|
* A [writable stream](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
|
@@ -26,6 +25,18 @@ import { Parser } from 'parse5';
|
|
|
26
25
|
*
|
|
27
26
|
*/
|
|
28
27
|
export class ParserStream extends Writable {
|
|
28
|
+
static getFragmentStream(fragmentContext, options) {
|
|
29
|
+
const parser = Parser.getFragmentParser(fragmentContext, options);
|
|
30
|
+
const stream = new ParserStream(options, parser);
|
|
31
|
+
return stream;
|
|
32
|
+
}
|
|
33
|
+
/** The resulting document node. */
|
|
34
|
+
get document() {
|
|
35
|
+
return this.parser.document;
|
|
36
|
+
}
|
|
37
|
+
getFragment() {
|
|
38
|
+
return this.parser.getFragment();
|
|
39
|
+
}
|
|
29
40
|
/**
|
|
30
41
|
* @param options Parsing options.
|
|
31
42
|
*/
|
|
@@ -56,18 +67,6 @@ export class ParserStream extends Writable {
|
|
|
56
67
|
};
|
|
57
68
|
this.parser.scriptHandler = scriptHandler;
|
|
58
69
|
}
|
|
59
|
-
static getFragmentStream(fragmentContext, options) {
|
|
60
|
-
const parser = Parser.getFragmentParser(fragmentContext, options);
|
|
61
|
-
const stream = new ParserStream(options, parser);
|
|
62
|
-
return stream;
|
|
63
|
-
}
|
|
64
|
-
/** The resulting document node. */
|
|
65
|
-
get document() {
|
|
66
|
-
return this.parser.document;
|
|
67
|
-
}
|
|
68
|
-
getFragment() {
|
|
69
|
-
return this.parser.getFragment();
|
|
70
|
-
}
|
|
71
70
|
//WritableStream implementation
|
|
72
71
|
_write(chunk, _encoding, callback) {
|
|
73
72
|
if (typeof chunk !== 'string') {
|
|
@@ -83,4 +82,3 @@ export class ParserStream extends Writable {
|
|
|
83
82
|
super.end(chunk || '', encoding, callback);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "parse5-parser-stream",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Streaming HTML parser with scripting support.",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "8.0.0",
|
|
6
6
|
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)",
|
|
7
7
|
"contributors": "https://github.com/inikulin/parse5/graphs/contributors",
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://parse5.js.org",
|
|
9
9
|
"funding": "https://github.com/inikulin/parse5?sponsor=1",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"parse5",
|
|
@@ -17,16 +17,21 @@
|
|
|
17
17
|
"main": "dist/index.js",
|
|
18
18
|
"module": "dist/index.js",
|
|
19
19
|
"types": "dist/index.d.ts",
|
|
20
|
-
"exports":
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
21
25
|
"dependencies": {
|
|
22
|
-
"parse5": "^
|
|
26
|
+
"parse5": "^8.0.0"
|
|
23
27
|
},
|
|
28
|
+
"scripts": {},
|
|
24
29
|
"repository": {
|
|
25
30
|
"type": "git",
|
|
26
31
|
"url": "git://github.com/inikulin/parse5.git"
|
|
27
32
|
},
|
|
28
33
|
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"
|
|
34
|
+
"dist/**/*.js",
|
|
35
|
+
"dist/**/*.d.ts"
|
|
31
36
|
]
|
|
32
37
|
}
|