From bb9eedb8e2f41f2edb0ac9f977f3e73864113322 Mon Sep 17 00:00:00 2001 From: Bojiang Date: Thu, 8 May 2025 10:01:16 +0800 Subject: [PATCH 1/2] jiangbo91@huawei.com parse5 update 7.2.1 Signed-off-by: Bojiang --- .gitattributes | 2 +- .gitignore | 2 - README.md | 8 +- bench/memory/sax-parser.js | 2 + bench/memory/sax-parser.js:Zone.Identifier | 4 + bench/package.json | 2 +- bench/perf/index.js | 4 +- bench/perf/index.js:Zone.Identifier | 4 + eslint.config.js | 89 + eslint.config.js:Zone.Identifier | 4 + package-lock.json | 5707 +++++++++-------- package.json | 38 +- .../parse5-html-rewriting-stream/lib/index.ts | 2 +- .../parse5-html-rewriting-stream/package.json | 4 +- .../test/rewriting-stream.test.ts | 26 +- .../parse5-html-rewriting-stream/typedoc.json | 4 + .../lib/index.ts | 16 +- .../package.json | 6 +- .../typedoc.json | 4 + packages/parse5-parser-stream/lib/index.ts | 11 +- packages/parse5-parser-stream/package.json | 4 +- .../test/location-info.test.ts | 2 +- .../test/parser-stream.test.ts | 2 +- .../test/scripting.test.ts | 2 +- .../test/utils/parse-chunked.ts | 2 +- packages/parse5-parser-stream/typedoc.json | 4 + .../package.json | 2 +- .../test/plain-text-conversion-stream.test.ts | 2 +- .../typedoc.json | 4 + packages/parse5-sax-parser/lib/index.ts | 3 +- .../lib/parser-feedback-simulator.ts | 20 +- packages/parse5-sax-parser/package.json | 2 +- .../test/parser-feedback-simulator.test.ts | 2 +- packages/parse5-sax-parser/typedoc.json | 4 + packages/parse5/lib/common/foreign-content.ts | 5 +- packages/parse5/lib/common/html.ts | 80 +- packages/parse5/lib/common/token.ts | 2 - packages/parse5/lib/common/unicode.ts | 6 - packages/parse5/lib/index.ts | 27 +- .../lib/parser/formatting-element-list.ts | 6 +- packages/parse5/lib/parser/index.test.ts | 41 +- packages/parse5/lib/parser/index.ts | 169 +- .../lib/parser/open-element-stack.test.ts | 2 +- .../parse5/lib/parser/open-element-stack.ts | 202 +- .../lib/parser/parser-location-info.test.ts | 2 +- packages/parse5/lib/serializer/index.ts | 21 +- packages/parse5/lib/tokenizer/index.test.ts | 2 +- packages/parse5/lib/tokenizer/index.ts | 702 +- packages/parse5/lib/tokenizer/preprocessor.ts | 18 +- packages/parse5/lib/tree-adapters/default.ts | 20 +- .../parse5/lib/tree-adapters/interface.ts | 11 +- packages/parse5/package.json | 10 +- packages/parse5/tsconfig.json | 8 +- packages/parse5/typedoc.json | 4 + .../generate-parser-feedback-test/index.ts | 20 +- test/docs/list-of-packages.md | 8 + test/docs/version-history.md | 3 + test/utils/common.ts | 12 +- .../generate-location-info-parser-tests.ts | 18 +- test/utils/generate-parsing-tests.ts | 12 +- test/utils/generate-serializer-tests.ts | 4 +- test/utils/generate-tokenization-tests.ts | 8 +- test/utils/load-sax-parser-test-data.ts | 2 +- test/utils/parse-dat-file.ts | 2 +- test/utils/serialize-to-dat-file-format.ts | 6 +- tsconfig.json | 17 +- typedoc.base.json | 6 + typedoc.json | 9 + 68 files changed, 3977 insertions(+), 3482 deletions(-) create mode 100644 bench/memory/sax-parser.js:Zone.Identifier create mode 100644 bench/perf/index.js:Zone.Identifier create mode 100644 eslint.config.js create mode 100644 eslint.config.js:Zone.Identifier create mode 100644 packages/parse5-html-rewriting-stream/typedoc.json create mode 100644 packages/parse5-htmlparser2-tree-adapter/typedoc.json create mode 100644 packages/parse5-parser-stream/typedoc.json create mode 100644 packages/parse5-plain-text-conversion-stream/typedoc.json create mode 100644 packages/parse5-sax-parser/typedoc.json create mode 100644 packages/parse5/typedoc.json create mode 100644 test/docs/list-of-packages.md create mode 100644 test/docs/version-history.md create mode 100644 typedoc.base.json create mode 100644 typedoc.json diff --git a/.gitattributes b/.gitattributes index 09948ef..bcbf545 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ # Exclude the HTML files from GitHub's language statistics # https://github.com/github/linguist#using-gitattributes -test/data/* linguist-vendored +test/data/** linguist-vendored diff --git a/.gitignore b/.gitignore index 8c7a05a..44961c3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,7 @@ .vscode node_modules docs/build -docs/05_api_reference.md packages/*/dist/ test/dist/ -.DS_Store tsconfig.tsbuildinfo coverage/ diff --git a/README.md b/README.md index 6226d60..ca63213 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@

- Build Status + Build Status NPM Version - Downloads - Downloads total + Downloads + Downloads total Coverage

@@ -31,7 +31,7 @@ as jsdom, - Online playground + Online playground

diff --git a/bench/memory/sax-parser.js b/bench/memory/sax-parser.js index 0bc2280..50ee769 100644 --- a/bench/memory/sax-parser.js +++ b/bench/memory/sax-parser.js @@ -1,3 +1,5 @@ +/* eslint-disable no-console */ + import { readFile } from 'node:fs/promises'; import format from 'human-format'; import memwatch from '@airbnb/node-memwatch'; diff --git a/bench/memory/sax-parser.js:Zone.Identifier b/bench/memory/sax-parser.js:Zone.Identifier new file mode 100644 index 0000000..34207a4 --- /dev/null +++ b/bench/memory/sax-parser.js:Zone.Identifier @@ -0,0 +1,4 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=https://github.com/inikulin/parse5/releases +HostUrl=https://codeload.github.com/inikulin/parse5/zip/refs/tags/v7.2.1 diff --git a/bench/package.json b/bench/package.json index cd8b234..9e5bf82 100644 --- a/bench/package.json +++ b/bench/package.json @@ -8,7 +8,7 @@ "license": "MIT", "dependencies": { "benchmark": "^2.1.4", - "human-format": "^1.0.0", + "human-format": "^1.2.0", "@airbnb/node-memwatch": "^2.0.0", "parse5": "npm:parse5" } diff --git a/bench/perf/index.js b/bench/perf/index.js index 2306eab..2d2521b 100644 --- a/bench/perf/index.js +++ b/bench/perf/index.js @@ -1,3 +1,5 @@ +/* eslint-disable no-console */ + import { readFileSync, createReadStream, readdirSync } from 'node:fs'; import Benchmark from 'benchmark'; import { loadTreeConstructionTestData } from 'parse5-test-utils/dist/generate-parsing-tests.js'; @@ -25,7 +27,7 @@ global.microTests = loadTreeConstructionTestData(treeConstructionPath, treeAdapt .filter( (test) => //NOTE: this test caused a stack overflow in parse5 v1.x - test.input !== '