From 91686731d45031d15f71b1f97e7bd47a3c45b2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=B6hm?= <188768+fb55@users.noreply.github.com> Date: Tue, 29 Mar 2022 10:14:38 +0100 Subject: [PATCH] Remove serializer-stream package (#481) --- docs/list-of-packages.md | 1 - package-lock.json | 20 ---------- packages/parse5-serializer-stream/LICENSE | 19 --------- packages/parse5-serializer-stream/README.md | 34 ---------------- .../parse5-serializer-stream/lib/index.ts | 40 ------------------- .../parse5-serializer-stream/package.json | 30 -------------- .../test/serializer-stream.test.ts | 15 ------- .../parse5-serializer-stream/tsconfig.json | 9 ----- 8 files changed, 168 deletions(-) delete mode 100644 packages/parse5-serializer-stream/LICENSE delete mode 100644 packages/parse5-serializer-stream/README.md delete mode 100644 packages/parse5-serializer-stream/lib/index.ts delete mode 100644 packages/parse5-serializer-stream/package.json delete mode 100644 packages/parse5-serializer-stream/test/serializer-stream.test.ts delete mode 100644 packages/parse5-serializer-stream/tsconfig.json diff --git a/docs/list-of-packages.md b/docs/list-of-packages.md index e5fd8d37e..9c5f9070d 100644 --- a/docs/list-of-packages.md +++ b/docs/list-of-packages.md @@ -5,5 +5,4 @@ - [parse5-parser-stream](https://github.com/inikulin/parse5/tree/master/packages/parse5-parser-stream) - streaming HTML parser with scripting support. - [parse5-plain-text-conversion-stream](https://github.com/inikulin/parse5/tree/master/packages/parse5-plain-text-conversion-stream) - stream that converts plain text files into HTML documents. - [parse5-sax-parser](https://github.com/inikulin/parse5/tree/master/packages/parse5-sax-parser) - streaming SAX-style HTML parser. -- [parse5-serializer-stream](https://github.com/inikulin/parse5/tree/master/packages/parse5-serializer-stream) - streaming HTML serializer. - [parse5-html-rewriting-stream](https://github.com/inikulin/parse5/tree/master/packages/parse5-html-rewriting-stream) - streaming HTML rewriter. diff --git a/package-lock.json b/package-lock.json index 9f9fdfa34..792582f5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4804,10 +4804,6 @@ "resolved": "packages/parse5-sax-parser", "link": true }, - "node_modules/parse5-serializer-stream": { - "resolved": "packages/parse5-serializer-stream", - "link": true - }, "node_modules/parse5-test-utils": { "resolved": "test", "link": true @@ -6342,16 +6338,6 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "packages/parse5-serializer-stream": { - "version": "6.0.1", - "license": "MIT", - "dependencies": { - "parse5": "^6.0.1" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, "test": { "name": "parse5-test-utils", "version": "1.0.0" @@ -10012,12 +9998,6 @@ "parse5": "^6.0.1" } }, - "parse5-serializer-stream": { - "version": "file:packages/parse5-serializer-stream", - "requires": { - "parse5": "^6.0.1" - } - }, "parse5-test-utils": { "version": "file:test" }, diff --git a/packages/parse5-serializer-stream/LICENSE b/packages/parse5-serializer-stream/LICENSE deleted file mode 100644 index f3265d4b8..000000000 --- a/packages/parse5-serializer-stream/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/parse5-serializer-stream/README.md b/packages/parse5-serializer-stream/README.md deleted file mode 100644 index 47ce65787..000000000 --- a/packages/parse5-serializer-stream/README.md +++ /dev/null @@ -1,34 +0,0 @@ -

- - parse5 - -

- -
-

parse5-serializer-stream

-Streaming HTML serializer. -
-
- -
-npm install --save parse5-serializer-stream -
-
- -

- 📖 Documentation 📖 -

- ---- - -

- List of parse5 toolset packages -

- -

- GitHub -

- -

- Changelog -

diff --git a/packages/parse5-serializer-stream/lib/index.ts b/packages/parse5-serializer-stream/lib/index.ts deleted file mode 100644 index 98b01c5f8..000000000 --- a/packages/parse5-serializer-stream/lib/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Readable } from 'node:stream'; -import { serialize, type SerializerOptions } from 'parse5/dist/serializer/index.js'; -import type { TreeAdapterTypeMap } from 'parse5/dist/tree-adapters/interface.js'; - -/** - * Streaming AST node to HTML serializer. A [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). - * - * @example - * - * ```js - * const parse5 = require('parse5'); - * const SerializerStream = require('parse5-serializer-stream'); - * const fs = require('fs'); - * - * const file = fs.createWriteStream('/home/index.html'); - * - * // Serializes the parsed document to HTML and writes it to the file. - * const document = parse5.parse('Who is John Galt?'); - * const serializer = new SerializerStream(document); - * - * serializer.pipe(file); - * ``` - */ -export class SerializerStream extends Readable { - /** - * Streaming AST node to HTML serializer. A readable stream. - * - * @param node Node to serialize. - * @param options Serialization options. - */ - constructor(private node: T['parentNode'], private options: SerializerOptions) { - super({ encoding: 'utf8' }); - } - - //Readable stream implementation - override _read(): void { - this.push(serialize(this.node, this.options)); - this.push(null); - } -} diff --git a/packages/parse5-serializer-stream/package.json b/packages/parse5-serializer-stream/package.json deleted file mode 100644 index 8d8a993f9..000000000 --- a/packages/parse5-serializer-stream/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "parse5-serializer-stream", - "type": "module", - "description": "Streaming HTML serializer.", - "version": "6.0.1", - "author": "Ivan Nikulin (https://github.com/inikulin)", - "contributors": "https://github.com/inikulin/parse5/graphs/contributors", - "homepage": "https://github.com/inikulin/parse5", - "funding": "https://github.com/inikulin/parse5?sponsor=1", - "keywords": [ - "parse5", - "parser", - "stream", - "streaming", - "serializer", - "serialiser" - ], - "license": "MIT", - "main": "dist/index.js", - "dependencies": { - "parse5": "^6.0.1" - }, - "repository": { - "type": "git", - "url": "git://github.com/inikulin/parse5.git" - }, - "files": [ - "dist" - ] -} diff --git a/packages/parse5-serializer-stream/test/serializer-stream.test.ts b/packages/parse5-serializer-stream/test/serializer-stream.test.ts deleted file mode 100644 index 0231b0716..000000000 --- a/packages/parse5-serializer-stream/test/serializer-stream.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { SerializerStream } from '../lib/index.js'; -import { generateSerializerTests } from 'parse5-test-utils/utils/generate-serializer-tests.js'; -import { WritableStreamStub } from 'parse5-test-utils/utils/common.js'; -import { finished } from 'parse5-test-utils/utils/common.js'; - -generateSerializerTests('SerializerStream', 'SerializerStream', async (document, opts) => { - const stream = new SerializerStream(document, opts); - const writable = new WritableStreamStub(); - - stream.pipe(writable); - - await finished(writable); - - return writable.writtenData; -}); diff --git a/packages/parse5-serializer-stream/tsconfig.json b/packages/parse5-serializer-stream/tsconfig.json deleted file mode 100644 index ebf4d81b6..000000000 --- a/packages/parse5-serializer-stream/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "lib", - "outDir": "dist" - }, - "include": ["**/*.ts"], - "exclude": ["**/*.test.ts", "dist", "test"] -}