Skip to content

BREAKING: Make module ESM only#2381

Merged
fb55 merged 2 commits intomasterfrom
esm
Mar 18, 2026
Merged

BREAKING: Make module ESM only#2381
fb55 merged 2 commits intomasterfrom
esm

Conversation

@fb55
Copy link
Copy Markdown
Owner

@fb55 fb55 commented Mar 18, 2026

  • Drop tshy, use plain tsc build
  • Simplify exports to ESM-only (keep ./WritableStream subpath)
  • Remove pre-ESM CJS placeholder file (WritableStream.js)
  • Remove deprecated: parseDOM, createDomStream, parseChunk, done
  • Replace entities fromCodePoint import with String.fromCodePoint
  • Bump domelementtype to ^3, domhandler to ^6, domutils to ^4, entities to ^8
  • Add engines >= 20.19.0
  • Add publish workflow (npm + JSR)

BREAKING CHANGE: This package is now ESM-only.

Copilot AI review requested due to automatic review settings March 18, 2026 00:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the migration of htmlparser2 to an ESM-only package by simplifying build/output configuration, removing deprecated CJS/back-compat APIs, and updating dependency/tooling to modern Node/DOM packages.

Changes:

  • Switch build from tshy to plain tsc and update TS/ESLint config for NodeNext + dist/ output.
  • Make package exports ESM-only (retaining ./WritableStream subpath) and remove deprecated APIs (parseDOM, createDomStream, parseChunk, done).
  • Update dependencies (dom* packages + entities) and CI/workflows, including adding a publish workflow.

Reviewed changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.json Align TS build for NodeNext ESM and emit to dist/, with explicit include/exclude.
tsconfig.eslint.json Separate TS config for ESLint type-aware linting without emitting.
src/index.ts Removes deprecated exports and updates parseFeed to rely on parseDocument.
src/index.spec.ts Updates tests to stop using removed deprecated APIs.
src/__snapshots__/index.spec.ts.snap Updates snapshots to reflect dependency/type changes.
src/Parser.ts Replaces entities/decode import with String.fromCodePoint; removes deprecated Parser aliases.
src/Parser.spec.ts Updates tests to use write/end after removing deprecated methods.
package.json Simplifies exports for ESM-only, switches build to tsc, updates deps/engines, adjusts published files list.
package-lock.json Locks updated dependency graph after version bumps/removals.
eslint.config.mjs Points ESLint at the new tsconfig.eslint.json.
biome.json Updates Biome schema reference.
WritableStream.js Removes CJS placeholder file.
.gitignore Stops ignoring .tshy/ and adds jsr.json.
.github/workflows/publish.yml Adds tag-triggered publish workflow for JSR + npm.
.github/workflows/nodejs-test.yml Updates Node test matrix and removes coverage/Coveralls steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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