Skip to content

BREAKING: Make module ESM only#1208

Open
fb55 wants to merge 2 commits intomasterfrom
esm
Open

BREAKING: Make module ESM only#1208
fb55 wants to merge 2 commits intomasterfrom
esm

Conversation

@fb55
Copy link
Copy Markdown
Member

@fb55 fb55 commented Mar 23, 2026

  • Set type: module, update tsconfig to es2022/nodenext
  • Output to dist/ instead of lib/, remove dual CJS/ESM build
  • Simplify exports to ESM-only
  • Migrate Jest to Vitest
  • Bump all deps to latest majors (boolbase ^2, css-select ^7, css-what ^8, domelementtype ^3, domhandler ^6, domutils ^4)
  • Import isTag from domhandler (no longer re-exported by domutils)
  • Use _compileUnsafe instead of removed _compileToken from css-select
  • Remove re-export of removed aliases/filters/pseudos from css-select
  • Add engines >= 20.19.0
  • Add publish workflow (npm + JSR), SECURITY.md

BREAKING CHANGE: This package is now ESM-only.

Copilot AI review requested due to automatic review settings March 23, 2026 00:06
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 migrates the package to an ESM-only distribution, modernizes the TypeScript build output (to dist/ with nodenext), upgrades major dependencies, and switches the test runner from Jest to Vitest while updating CI/publish automation accordingly.

Changes:

  • Convert build/packaging to ESM-only (type: module, exports updated, dist/ output, remove dual CJS/ESM build).
  • Upgrade selector/DOM dependency majors and adjust code to updated APIs (domhandler isTag, css-select _compileUnsafe, etc.).
  • Migrate tests and CI from Jest to Vitest; add publish workflow + SECURITY.md.

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.json Switch TS output/targets to ESM (es2022, nodenext) and emit to dist/.
package.json Mark package ESM-only, simplify exports, update scripts to Vitest, bump major deps, add Node engine.
src/index.ts Update css-select compilation API and isTag usage; introduce adapter passed to prepareContext.
src/index.spec.ts Update test imports for ESM (.js specifiers) and Vitest.
src/helpers.spec.ts Update test runner imports and ESM .js specifier.
test/tools/sizzle-testinit.ts Update htmlparser2 API usage and isTag import; migrate assertions to Vitest.
test/sizzle.spec.ts Migrate to Vitest, update htmlparser2 API, and swap to domhandler isTag.
test/advanced-selectors.spec.ts Migrate to Vitest and update ESM import path for select.
.github/workflows/nodejs-test.yml Run Vitest instead of Jest; update Node matrix.
.github/workflows/publish.yml Add tag-based publish workflow for npm + JSR with generated jsr.json.
SECURITY.md Add security reporting policy document.
.gitignore Ignore dist/ output and generated jsr.json.
biome.json Bump Biome schema reference.

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

@fb55 fb55 force-pushed the esm branch 3 times, most recently from bee0f69 to 16aff7a Compare March 23, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants