Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move fork back into main project #362

Merged
merged 180 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 157 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
d1c8a5b
chore(deps-dev): Upgrade all dev dependencies
fb55 Nov 1, 2021
c0b88ee
chore(bench): Fix imports in benchmarks
fb55 Nov 2, 2021
8cbe79f
fix(bench): correct some imports and URL paths
43081j Nov 2, 2021
75d2113
Fix generating tests
fb55 Nov 4, 2021
07a70d6
Add note to README
fb55 Nov 4, 2021
0a5bd39
Run both prettier & eslint in `lint` & `format` scripts
fb55 Nov 4, 2021
1dbb700
refactor: Use ES6 in many more places
fb55 Nov 7, 2021
0684dfe
refactor: Improve ESLint fix output
fb55 Nov 7, 2021
d51f6a3
refactor: Use String.fromCodePoint
fb55 Nov 7, 2021
b90fe6f
refactor: Remove `merge-options`
fb55 Nov 7, 2021
7c036c4
refactor: Replace some maps with `Set`
fb55 Nov 7, 2021
a39912f
refactor: Use `Map` for SVG & XML replacement maps
fb55 Nov 7, 2021
9f94715
refactor: Minor cleanup
fb55 Nov 7, 2021
cf10865
Bump eslint from 8.1.0 to 8.2.0 (#3)
dependabot[bot] Nov 7, 2021
167f4cb
chore: Fix scripts
fb55 Nov 8, 2021
ea18c5f
test: Add several feedback tests
fb55 Nov 8, 2021
71c0d8a
refactor: Make `C1_CONTROLS_REFERENCE_REPLACEMENTS` a `Map`
fb55 Nov 8, 2021
5d7a780
refactor: Use branches for tokenizer states for 25% speed gains
fb55 Nov 8, 2021
d57563e
refactor: Use `Map` for parser `TOKEN_HANDLERS`
fb55 Nov 8, 2021
dc4e269
fix: End tags in the 'in row' insertion mode were not properly ignored
fb55 Nov 8, 2021
c66c985
refactor: Introduce `Set`s in the serializer
fb55 Nov 8, 2021
818614e
refactor: Move more maps & lists to `Map` & `Set`
fb55 Nov 8, 2021
890e3a8
refactor: Drop length optimisation in favour of `Set`s in element stack
fb55 Nov 8, 2021
e1917dd
refactor: Simplify `FormattingElementList`
fb55 Nov 9, 2021
fa80d08
test: Switch to default mocha UI
fb55 Nov 9, 2021
66df66b
test: Switch from Mocha to Jest
fb55 Nov 9, 2021
dee793b
refactor: Port Tokenizer to TS
fb55 Nov 9, 2021
b4b5d4a
fix: Do namespace check for every numbered header / table cell
fb55 Nov 9, 2021
a18c22e
refactor: Continue porting to TS
fb55 Nov 9, 2021
31036f3
refactor: Introduce enums
fb55 Nov 12, 2021
d335656
refactor: Fix Mixin type, start converting them
fb55 Nov 12, 2021
4385fde
refactor: Introduce tree adapter type
fb55 Nov 13, 2021
347206c
refactor: Convert most of the parser to TS
fb55 Nov 13, 2021
a0aff95
fix: Properly handle end tags in table body
fb55 Nov 13, 2021
7170a4b
refactor: Finish porting parser
fb55 Nov 13, 2021
34d9e7a
refactor: All the TS
fb55 Nov 16, 2021
d3a1924
refactor: Remove most uses of `any`
fb55 Nov 16, 2021
c4416bb
refactor(parser): Move token handler maps to fns
fb55 Nov 16, 2021
586ad6d
refactor: Simplify `OpenElementStack`
fb55 Nov 17, 2021
a728cbb
refactor: Re-introduce open element stack `stackTop`
fb55 Nov 17, 2021
73ba3d3
refactor: Make `_findFosterParentingLocation` return definite types
fb55 Nov 17, 2021
339fb85
refactor: Simplify `tmplInsertionModeStack`
fb55 Nov 17, 2021
25d5331
fix: Use `node --loader` to run parser feedback gen
fb55 Nov 17, 2021
5655435
test: Co-locate tests & implementation files
fb55 Nov 18, 2021
73138c3
refactor: Use import aliases for HTML
fb55 Nov 18, 2021
7f841eb
fix: Fix exports of updated htmlparser2 interface
fb55 Nov 18, 2021
7b7be06
refactor: Remove `parse5-` prefix, use `@parse5` ns
fb55 Nov 18, 2021
fee564f
refactor: Convert htmlparser2 adapter to TS, improve adapters
fb55 Nov 18, 2021
6b6b419
test: Refactor tests to call `it` directly
fb55 Nov 18, 2021
3db2bb1
chore(build): Add build config for main pkg
fb55 Nov 19, 2021
386faa9
refactor: Switch FormattingElementList entries order, simplify
fb55 Nov 19, 2021
ebae166
refactor: Move more docs into JSDoc comments
fb55 Nov 19, 2021
8132b00
refactor: Re-enable eslint, --fix
fb55 Nov 19, 2021
08d3fab
refactor: Remove Tokenizer statics
fb55 Nov 22, 2021
44a8baa
refactor: Remove FormattingElemList statics
fb55 Nov 22, 2021
3ddad9e
refactor: Compute SVG adjusted names
fb55 Nov 23, 2021
1419546
refactor: Remove `PositionTrackingPreprocessorMixin`
fb55 Nov 24, 2021
82b643c
refactor: Simplify preprocessor
fb55 Nov 24, 2021
63b4680
refactor: Merge `LocationInfoTokenizerMixin` into Tokenizer
fb55 Nov 24, 2021
ce75f9d
refactor: Inline preprocessor & tokenizer error mixins
fb55 Nov 24, 2021
5e4e08d
refactor: Move `ErrorReportingParserMixin` into parser
fb55 Nov 24, 2021
b6b5be6
refactor: Start moving `LocationInfoParserMixin` into parser
fb55 Nov 24, 2021
19db1fb
refactor: Make `TokenType` a numeric enum
fb55 Nov 24, 2021
f39136e
refactor: Call states/modes directly
fb55 Nov 24, 2021
04616fa
refactor: Small fixes
fb55 Nov 24, 2021
0659cfa
refactor: Don't re-initialize `tempBuff`
fb55 Nov 24, 2021
c4ed435
refactor: Remove the last mixin
fb55 Nov 24, 2021
5dea37c
test: Move location info tests
fb55 Nov 24, 2021
5c3b003
refactor: Set tag end locations on EOF
fb55 Nov 25, 2021
490aef2
refactor: Add more types
fb55 Nov 25, 2021
2b92054
refactor: Use `entities` for decoding entities
fb55 Nov 25, 2021
655633f
refactor: Add more types
fb55 Nov 25, 2021
f00a97c
test: Add return types
fb55 Nov 25, 2021
3e0e0d3
refactor: Simplify some code
fb55 Nov 25, 2021
6170165
chore(package): Introduce npm workspaces
fb55 Nov 27, 2021
651d3dd
chore(lerna): Skip `lerna bootstrap`
fb55 Nov 27, 2021
ac61a2b
chore(ci): Bump npm client before installing deps
fb55 Nov 27, 2021
a24e91e
refactor: Use original `parse5` package name
fb55 Nov 27, 2021
fa58493
refactor: Add warnings on explicit `any`
fb55 Nov 27, 2021
6f8aa38
chore(ci): Test on lts/*
fb55 Nov 28, 2021
b9bca86
fix: Fix import in html-rewriting-stream
fb55 Nov 28, 2021
5ad3ab7
refactor: Move rewriting-stream.test to TS
fb55 Nov 28, 2021
be12796
refactor: Use `fs/promises` when already dealing with promises
fb55 Nov 28, 2021
7df6b6d
chore: Improve prettier & lint-staged config
fb55 Nov 29, 2021
e47e403
fix: Target es2019 for Node 12 support
fb55 Nov 29, 2021
e4d58c5
refactor: Move `test` to `packages/test-utils`
fb55 Nov 29, 2021
e81a14d
fix: Fix package name in `parser-stream` package.json
fb55 Nov 29, 2021
dd718fe
test: Simplify `moduleNameMapper`
fb55 Nov 29, 2021
4f2f19e
chore(pkg): Add `bench` as a workspace
fb55 Nov 29, 2021
8a03a32
feat: Make it possible to build all packages
fb55 Nov 29, 2021
79394ac
refactor: Remove many uses of any and non-null
fb55 Dec 2, 2021
2120bf7
chore: Move most sax-parser docs to TSDoc
fb55 Dec 2, 2021
84282ec
test: Don't hand-roll setTimeout promise
fb55 Dec 2, 2021
f066688
test: Make formatting-element-list test tokens match elements
fb55 Dec 3, 2021
b807842
test: Assert `entry` exists
fb55 Dec 3, 2021
aa66b91
chore: Fix ignores for html5lib path
fb55 Dec 3, 2021
4ad738f
fix: Overwrite stream `end` method instead of `_final`
fb55 Dec 4, 2021
5a27aef
Revert "test: Don't hand-roll setTimeout promise"
fb55 Dec 4, 2021
48433d6
refactor: Introduce tagIDs (#18)
fb55 Dec 4, 2021
bf4802e
Update .gitattributes
fb55 Dec 4, 2021
44913e7
refactor: Introduce eslint-plugin-unicorn
fb55 Dec 5, 2021
67096f7
refactor: Move special end tag handling to method
fb55 Dec 5, 2021
c8ce001
refactor: Output state name in `generateTokenizationTests`
fb55 Dec 5, 2021
70c1935
fix: Emit error on undefined named entity in attribute starting with …
fb55 Dec 5, 2021
b93ef2f
refactor: Simplify `_consumeSequenceIfMatch`
fb55 Dec 5, 2021
cc0218c
refactor: Read double escaped script as sequence
fb55 Dec 6, 2021
cf0a37a
refactor: Don't write to `tempBuff` when decoding entities
fb55 Dec 6, 2021
50a3b16
refactor: Add return types everywhere
fb55 Dec 6, 2021
06a9316
refactor: Combine loops for Noah's Ark condition
fb55 Dec 6, 2021
0af88be
refactor: Create tokens that don't change only once
fb55 Dec 6, 2021
2d2e0b4
refactor: Make sequences strings, handle special end tag as sequence
fb55 Dec 6, 2021
fbab2d2
refactor: Re-introduce `isWhitespace`
fb55 Dec 6, 2021
4e9041c
refactor: Pass count to `retreat`
fb55 Dec 6, 2021
25d5baa
refactor: Setup tokenizer CDATA mode on stack updates
fb55 Dec 7, 2021
d331397
test: Use `assert.ok` when a pretty printed message is available
fb55 Dec 8, 2021
e8ea78d
refactor: Use `.bind` to pass handlers to stack
fb55 Dec 8, 2021
8f76a0a
refactor: Only set source code location if that is enabled
fb55 Dec 9, 2021
b06b621
chore: Add some comments
fb55 Dec 14, 2021
4946405
refactor: Remove `_isSequenceMatch` method
fb55 Dec 14, 2021
7beef44
refactor: Use `switch` in more places
fb55 Dec 14, 2021
41daefc
refactor: Simplify code
fb55 Dec 17, 2021
9bd426e
refactor: Move <html> and <body> end tag location logic
fb55 Dec 18, 2021
98e211a
refactor: No more temp buffer
fb55 Dec 18, 2021
6ac7e5e
refactor: Simplify parser constructor
fb55 Dec 18, 2021
681915f
refactor: Use unions to describe DOM (#26)
fb55 Dec 27, 2021
2832779
refactor: Use old package names
fb55 Jan 3, 2022
cc78cd5
fix: Move html5lib-tests submodule to the expected place
fb55 Jan 6, 2022
87bbdc3
fix: Import files shipped in packages
fb55 Jan 6, 2022
7513864
chore(deps-dev): Upgrade dev dependencies
fb55 Jan 6, 2022
b554ddb
chore(deps): bump human-format from 0.7.0 to 0.11.0 (#48)
dependabot[bot] Jan 6, 2022
02db713
docs: Point links back at the original repo
fb55 Jan 6, 2022
b1de070
docs: Fix package links
fb55 Jan 6, 2022
35007d5
chore: Revert unnecessary changes
fb55 Jan 6, 2022
069852f
refactor: Improve error message
fb55 Jan 7, 2022
ef014f5
Set prettier log level to warn
fb55 Jan 8, 2022
dab5af7
Move test utils back to their original directory
fb55 Jan 8, 2022
195ef62
Fix builds for test utils
fb55 Jan 8, 2022
1a855b3
Use `tsc --build --clean` to clean build artifacts
fb55 Jan 9, 2022
5652651
fix: Have default adapter `getNamespaceURI` return a namespace
fb55 Jan 10, 2022
00bfa24
chore(deps-dev): bump @typescript-eslint/eslint-plugin (#50)
dependabot[bot] Jan 11, 2022
0482436
chore(deps-dev): bump @typescript-eslint/parser from 5.9.0 to 5.9.1 (…
dependabot[bot] Jan 11, 2022
e67175b
Merge branch 'master' of https://github.com/parse5/parse5-fork
fb55 Jan 11, 2022
0e62445
Remove lerna
fb55 Jan 11, 2022
9658d33
Revert parser feedback updates
fb55 Jan 11, 2022
fbababb
Improve `find`
fb55 Jan 11, 2022
eb0fcc1
Document events
fb55 Jan 11, 2022
31ca0a0
Update index.ts
fb55 Jan 11, 2022
c382a97
Update index.ts
fb55 Jan 11, 2022
aaa5de0
Replace `dedent` with `outdent`
fb55 Jan 11, 2022
7c3dcf4
Make `TOKEN_EMISSION_HELPERS` a switch
fb55 Jan 11, 2022
71f6c21
Added TODO comments
fb55 Jan 11, 2022
be83e40
Fix format of comment
fb55 Jan 13, 2022
651bb21
Use project references to build the project
fb55 Jan 13, 2022
af89d24
Import parser options from main export
fb55 Jan 13, 2022
fae4b14
Add `arrow-body-style` eslint rule
fb55 Jan 13, 2022
9c73b72
Update `generateImpliedEndTagsWithExclusion` to use tag ids
fb55 Jan 13, 2022
5ba2990
Make tokenizer state a const enum again
fb55 Jan 13, 2022
4126b91
chore(deps-dev): bump eslint-plugin-unicorn from 40.0.0 to 40.1.0 (#52)
dependabot[bot] Jan 17, 2022
f1d16d6
chore(deps-dev): bump eslint from 8.6.0 to 8.7.0 (#53)
dependabot[bot] Jan 17, 2022
c928df6
chore(deps-dev): bump ts-jest from 27.1.2 to 27.1.3 (#54)
dependabot[bot] Jan 17, 2022
413a4e3
chore(deps-dev): bump @typescript-eslint/eslint-plugin (#55)
dependabot[bot] Jan 18, 2022
20e2071
chore(deps-dev): bump @typescript-eslint/parser from 5.9.1 to 5.10.0 …
dependabot[bot] Jan 18, 2022
465d5cb
Merge remote-tracking branch 'upstream/master'
fb55 Jan 18, 2022
23eac84
chore(deps-dev): bump lint-staged from 12.1.7 to 12.2.0 (#57)
dependabot[bot] Jan 19, 2022
bcfe0eb
chore(deps-dev): bump lint-staged from 12.2.0 to 12.2.1 (#58)
dependabot[bot] Jan 20, 2022
38ede91
chore(deps-dev): bump lint-staged from 12.2.1 to 12.2.2 (#59)
dependabot[bot] Jan 21, 2022
6e0483e
chore(deps-dev): bump typescript from 4.5.4 to 4.5.5 (#60)
dependabot[bot] Jan 21, 2022
4882c17
chore(deps-dev): bump lint-staged from 12.2.2 to 12.3.1 (#61)
dependabot[bot] Jan 24, 2022
30e9e14
chore(deps-dev): bump @typescript-eslint/eslint-plugin (#62)
dependabot[bot] Jan 25, 2022
153505c
chore(deps-dev): bump @typescript-eslint/parser from 5.10.0 to 5.10.1…
dependabot[bot] Jan 25, 2022
b7e7857
chore(deps-dev): bump lint-staged from 12.3.1 to 12.3.2 (#64)
dependabot[bot] Jan 27, 2022
c303aec
chore(deps-dev): bump eslint from 8.7.0 to 8.8.0 (#65)
dependabot[bot] Jan 31, 2022
cd82916
chore(deps-dev): bump @typescript-eslint/eslint-plugin (#66)
dependabot[bot] Feb 1, 2022
e17472b
chore(deps-dev): bump lint-staged from 12.3.2 to 12.3.3 (#68)
dependabot[bot] Feb 2, 2022
802f805
chore(deps-dev): bump @typescript-eslint/parser from 5.10.1 to 5.10.2…
dependabot[bot] Feb 2, 2022
af21282
fix(package): Set `files` to `dist`
fb55 Feb 3, 2022
12b6cfd
Fix `TreeAdapter` types
fb55 Feb 5, 2022
57d0ccc
chore(deps-dev): bump jest from 27.4.7 to 27.5.0 (#69)
dependabot[bot] Feb 7, 2022
f374816
Avoid casts for `find`
fb55 Feb 7, 2022
1be2263
Merge remote-tracking branch 'upstream/master'
fb55 Feb 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages/parse5/lib/tokenizer/named-entity-data.js
test/benchmark/node_modules/**/*.js
test/memory_benchmark/node_modules/**/*.js
test/data/html5lib-tests
packages/*/dist/
test/dist/
node_modules
25 changes: 21 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"env": {
"es2020": true,
"node": true,
"mocha": true
"jest": true
fb55 marked this conversation as resolved.
Show resolved Hide resolved
},
"extends": ["eslint:recommended", "prettier", "plugin:unicorn/recommended"],
fb55 marked this conversation as resolved.
Show resolved Hide resolved
"rules": {
Expand All @@ -21,6 +21,7 @@
}
],
"prefer-template": "error",
"arrow-body-style": ["error", "as-needed"],

"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": "off",
Expand All @@ -30,10 +31,26 @@
"unicorn/no-array-reduce": "off",
"unicorn/no-for-loop": "off",
"unicorn/consistent-destructuring": "off",
"unicorn/prefer-switch": ["error", { "emptyDefaultCase": "do-nothing-comment" }],
"unicorn/number-literal-case": "off"
"unicorn/prefer-switch": ["error", { "emptyDefaultCase": "do-nothing-comment" }]
},
"parserOptions": {
"sourceType": "module"
}
},
"overrides": [
{
"files": "*.ts",
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/explicit-function-return-type": "error",

"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
}
}
]
}
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Exclude the HTML files from GitHub's language statistics
# https://github.com/github/linguist#using-gitattributes
test/data/* linguist-vendored
packages/test-utils/data/* linguist-vendored
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
node_modules
docs/build
docs/05_api_reference.md
package-lock.json
bench/package-lock.json
packages/*/dist/
test/dist/
.DS_Store
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "test/data/html5lib-tests"]
[submodule "html5lib-tests"]
path = test/data/html5lib-tests
url = https://github.com/HTMLParseErrorWG/html5lib-tests
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run pre-commit
fb55 marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
packages/parse5/lib/tokenizer/named-entity-data.js
packages/*/dist/
test/dist/
docs
test/data/html5lib-tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</p>

<p align="center">
<a href="https://travis-ci.org/inikulin/parse5"><img alt="Build Status" src="https://api.travis-ci.org/inikulin/parse5.svg"></a>
<a href="https://github.com/inikulin/parse5/actions/workflows/nodejs-test.yml"><img alt="Build Status" src="https://img.shields.io/github/workflow/status/inikulin/parse5/Node.js%20CI?label=tests&style=flat"></a>
<a href="https://www.npmjs.com/package/parse5"><img alt="NPM Version" src="https://img.shields.io/npm/v/parse5.svg"></a>
<a href="https://npmjs.org/package/parse5"><img alt="Downloads" src="http://img.shields.io/npm/dm/parse5.svg"></a>
<a href="https://npmjs.org/package/parse5"><img alt="Downloads total" src="http://img.shields.io/npm/dt/parse5.svg"></a>
Expand Down
13 changes: 0 additions & 13 deletions bench/memory/named-entity-data.js

This file was deleted.

8 changes: 4 additions & 4 deletions bench/memory/sax-parser.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as fs from 'node:fs';
import { readFile } from 'node:fs/promises';
import format from 'human-format';
import promisifyEvent from 'promisify-event';
import memwatch from '@airbnb/node-memwatch';
import SAXParser from '../../packages/parse5-sax-parser/lib/index.js';
import { SAXParser } from '../../packages/parse5-sax-parser/dist/index.js';

main();

Expand All @@ -15,7 +15,7 @@ async function main() {
let heapDiff = null;

memwatch.on('stats', (stats) => {
maxMemUsage = Math.max(maxMemUsage, stats['current_base']);
maxMemUsage = Math.max(maxMemUsage, stats.used_heap_size);
});

startDate = new Date();
Expand All @@ -35,7 +35,7 @@ async function main() {
}

async function parse() {
const data = fs.readFileSync('../test/data/huge-page/huge-page.html', 'utf8');
const data = await readFile(new URL('../../test/data/huge-page/huge-page.html', import.meta.url), 'utf8');
let parsedDataSize = 0;
const stream = new SAXParser();

Expand Down
5 changes: 3 additions & 2 deletions bench/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "parse5-benchmarks",
"private": "true",
"type": "module",
"version": "1.0.0",
"description": "parse5 regression benchmarks",
"author": "Ivan Nikulin <[email protected]>",
"license": "MIT",
"dependencies": {
"benchmark": "^2.1.4",
"human-format": "^0.7.0",
"human-format": "^0.11.0",
"@airbnb/node-memwatch": "^2.0.0",
"parse5": "*",
"parse5": "npm:parse5",
wooorm marked this conversation as resolved.
Show resolved Hide resolved
"promisify-event": "^1.0.0"
}
}
24 changes: 13 additions & 11 deletions bench/perf/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { readFileSync, createReadStream, readdirSync } from 'node:fs';
import Benchmark from 'benchmark';
import { loadTreeConstructionTestData } from '../../test/utils/generate-parsing-tests.js';
import { loadSAXParserTestData } from '../../test/utils/load-sax-parser-test-data.js';
import { treeAdapters, WritableStreamStub } from '../../test/utils/common.js';
import * as parse5 from '../../packages/parse5/lib/index.js';
import { ParserStream as parse5Stream } from '../../packages/parse5-parser-stream/lib/index.js';
import { loadTreeConstructionTestData } from 'parse5-test-utils/dist/generate-parsing-tests.js';
import { loadSAXParserTestData } from 'parse5-test-utils/dist/load-sax-parser-test-data.js';
import { treeAdapters, WritableStreamStub } from 'parse5-test-utils/dist/common.js';
import * as parse5 from '../../packages/parse5/dist/index.js';
import { ParserStream as parse5Stream } from '../../packages/parse5-parser-stream/dist/index.js';
import * as parse5Upstream from 'parse5';

const hugePagePath = new URL('../../test/data/huge-page/huge-page.html', import.meta.url);
Expand Down Expand Up @@ -46,19 +46,21 @@ global.runMicro = function (parser) {
const pages = loadSAXParserTestData().map((test) => test.src);

global.runPages = function (parser) {
for (let j = 0; j < pages.length; j++) {
parser.parse(pages[j]);
for (const page of pages) {
parser.parse(page);
}
};

// Stream data
global.files = readdirSync(saxPath).map((dirName) => {
return new URL(`${dirName}/src.html`, saxPath).pathname;
});
global.files = readdirSync(saxPath).map((dirName) => new URL(`${dirName}/src.html`, saxPath).pathname);

// Utils
function getHz(suite, testName) {
return suite.find((t) => t.name === testName).hz;
for (let i = 0; i < suite.length; i++) {
if (suite[i].name === testName) {
return suite[i].hz;
}
}
}

function runBench({ name, workingCopyFn, upstreamFn, defer = false }) {
Expand Down
5 changes: 0 additions & 5 deletions lerna.json

This file was deleted.

Loading