Skip to content

BREAKING: Make module ESM only#1746

Open
fb55 wants to merge 1 commit intomasterfrom
esm
Open

BREAKING: Make module ESM only#1746
fb55 wants to merge 1 commit intomasterfrom
esm

Conversation

@fb55
Copy link
Owner

@fb55 fb55 commented Mar 18, 2026

  • Drop tshy, use plain tsc build
  • Simplify exports to ESM-only
  • Bump boolbase to ^2, css-what to ^8, domhandler to ^6, domutils to ^4, nth-check to ^3
  • Fix boolbase import (named exports in v2)
  • Add isTag from domhandler (no longer re-exported by domutils)
  • Remove deprecated _compileToken, aliases/filters/pseudos exports
  • 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

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 migrates the package to an ESM-only distribution, switches the build pipeline to plain tsc, and updates dependencies + adapter wiring for the newer domhandler/domutils ecosystem.

Changes:

  • Convert package publishing/runtime to ESM-only (type: module, simplified exports, Node engine bump) and switch build output to dist/ via tsc.
  • Bump core DOM/CSS parsing dependencies and update code/tests to use domhandler.isTag (no longer re-exported by domutils) and htmlparser2.parseDocument.
  • Add a tag-based publish workflow (npm + JSR) and update CI matrix / remove coverage steps.

Reviewed changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.json Updates TS target/output directory and limits compilation to src/ (excludes specs/tests).
tsconfig.eslint.json Ensures ESLint TS project can include test/ without emit and with a root dir that won’t error.
src/index.ts Updates default adapter to include isTag and removes deprecated public exports / token compiler wrapper.
src/helpers/cache.spec.ts Updates test adapter to include isTag explicitly.
test/tools/helper.ts Switches tag checks to domhandler.isTag.
test/qwery.ts Migrates from parseDOM to parseDocument and switches tag checks to isTag.
test/api.ts Migrates from parseDOM to parseDocument and updates adapter construction for isTag.
package.json ESM-only packaging metadata, dependency bumps, build script switch to tsc, Node engine constraint, publish files tweaks.
package-lock.json Lockfile updates reflecting dependency/tooling changes and removals (eg tshy, coverage deps).
biome.json Bumps Biome schema reference.
.gitignore Removes lib/ + tshy artifacts, adds jsr.json.
.github/workflows/publish.yml Adds tag-triggered publish pipeline for JSR + npm.
.github/workflows/nodejs-test.yml Updates CI 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.

const finalOptions: Options<Node, ElementNode> = options ?? defaultOptions;
// @ts-expect-error Same as above.
finalOptions.adapter ??= DomUtils;
finalOptions.adapter ??= defaultOptions.adapter as typeof DomUtils;
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