Skip to content

build(deps): upgrade htmlparser2 to v12 - #109

Merged
voischev merged 2 commits into
masterfrom
build/update-htmlparser2
Oct 28, 2026
Merged

voischev merged 2 commits into
masterfrom
build/update-htmlparser2

Conversation

@voischev

@voischev voischev commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Upgrade htmlparser2 from 9 to 12 and update its transitive runtime dependencies.
  • Adapt the new HTML comment/processing-instruction callbacks to preserve PHP directives, custom declarations and custom directive delimiters.
  • Preserve XML processing-instruction delimiters, source locations after instructions and lowerCaseTags behavior for SVG elements.
  • Update the compiler/build dependencies needed for the ESM backend. Generate declarations with tsc so type-only imports retain their resolution mode.
  • Add regression tests, CommonJS/native ESM package checks and consumer type fixtures.
  • Test the supported runtime versions in CI, including both minimum versions, and document Node.js 24 as the development environment.

Breaking changes

  • Node.js support becomes ^20.19.0 || >=22.12.0. These versions can synchronously load the ESM-only backend through the existing CommonJS API. Earlier Node.js 22 releases cannot do so.
  • Published declarations require TypeScript 5.3 or later.
  • With decodeEntities: true, entities in <textarea> content are now decoded. For example, &amp; becomes &; the previous backend left it encoded in this case.

Verification

  • Fresh npm ci, build, lint and typecheck in the new working copy.
  • Verify clean installs with both npm 10.8.2 and 11.19.1; explicitly record the optional YAML peer dependency needed by npm 10 lockfile validation.
  • Parser tests: 39 passed, with two existing skipped tests (previously 28 passed).
  • Tests and CommonJS/native ESM checks on Node.js 20.19.0, 22.12.0, 24.22.1 and 26.12.1.
  • Build, lint and typecheck on both minimum runtime versions.
  • Consumer declarations checked with TypeScript 5.3.3 and 5.9.3.
  • Install the generated tarball without development dependencies and verify CommonJS/native ESM loading.
  • PostHTML integration: 58 existing tests passed, with one existing skipped test, using the locally built parser package.
  • Differential corpus against published posthtml-parser@0.12.1: 175 of 176 cases unchanged, with the one documented textarea decoding correction.
  • Production dependency audit: 0 vulnerabilities.
  • Validate the workflow with actionlint and run repository commit hooks.

Coverage: 99.37% statements/lines, 98.55% branches and 100% functions; src/index.ts has 100% coverage.

BREAKING CHANGE: require Node.js ^20.19.0 || >=22.12.0 and TypeScript >=5.3.
@coveralls

coveralls commented Oct 28, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 99.371% — build/update-htmlparser2 into master. No base build found for master.

@voischev
voischev merged commit a37f3f7 into master Oct 28, 2026
6 checks passed
@voischev
voischev deleted the build/update-htmlparser2 branch October 28, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants