Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the package for an ESM-only distribution, aligning the TypeScript build and package metadata with Node’s ESM resolution, updating dependencies to newer major versions, and migrating the test suite from Jest to Vitest while updating CI/publish workflows accordingly.
Changes:
- Switch TypeScript compilation to
nodenextand emit build artifacts todist/(removing the dual CJS/ESM setup). - Update package exports to ESM-only and remove deprecated/legacy exports and APIs.
- Migrate tests from Jest to Vitest and adjust GitHub Actions workflows for testing and publishing (npm + JSR).
Reviewed changes
Copilot reviewed 14 out of 17 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
tsconfig.json |
Moves to nodenext module settings and changes build output to dist/. |
package.json |
Declares ESM-only (type: module), updates exports/build scripts, switches to Vitest, bumps dependencies, adds Node engine floor. |
biome.json |
Updates Biome schema reference. |
.gitignore |
Replaces lib/ with dist/ and ignores jsr.json. |
src/index.ts |
Removes deprecated domhandler re-exports; continues ESM-style .js specifiers for internal exports. |
src/querying.ts |
Removes deprecated findOneChild. |
src/*.spec.ts |
Migrates tests to Vitest and updates imports/ESM patterns. |
src/__snapshots__/feeds.spec.ts.snap |
Updates snapshot header/keys for Vitest. |
.github/workflows/nodejs-test.yml |
Updates CI test execution to Vitest and adjusts Node matrix. |
.github/workflows/publish.yml |
Adds a publish workflow that generates jsr.json and publishes to JSR and npm. |
💡 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.
| fail-fast: false | ||
| matrix: | ||
| node: | ||
| - 20 |
| @@ -1,11 +1,12 @@ | |||
| import { describe, expect, it } from "vitest"; | |||
| import fixture from "./__fixtures__/fixture.js"; | |||
Comment on lines
+4
to
+11
| import fixture from "./__fixtures__/fixture.js"; | ||
| import { | ||
| getElementById, | ||
| getElements, | ||
| getElementsByClassName, | ||
| getElementsByTagName, | ||
| getElementsByTagType, | ||
| } from "./legacy"; | ||
| } from "./legacy.js"; |
| @@ -9,6 +10,10 @@ import { | |||
| replaceElement, | |||
| } from "./manipulation.js"; | |||
| findOneChild, | ||
| } from "./querying"; | ||
| import { describe, expect, it } from "vitest"; | ||
| import { existsOne, filter, find, findAll, findOne } from "./querying.js"; |
| "type": "commonjs", | ||
| "type": "module", | ||
| "name": "domutils", | ||
| "version": "3.2.2", |
|
|
||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: lts/* |
Comment on lines
+31
to
+39
| const jsrJson = { | ||
| name: `@cheerio/${p.name}`, | ||
| version: p.version, | ||
| exports: { ".": "./src/index.ts" }, | ||
| imports: { | ||
| "dom-serializer": `jsr:@cheerio/dom-serializer@${p.dependencies["dom-serializer"]}`, | ||
| "domelementtype": `jsr:@cheerio/domelementtype@${p.dependencies.domelementtype}`, | ||
| "domhandler": `jsr:@cheerio/domhandler@${p.dependencies.domhandler}`, | ||
| }, |
| compareDocumentPosition, | ||
| removeSubsets, | ||
| uniqueSort, | ||
| } from "./helpers.js"; |
| import { parseDocument } from "htmlparser2"; | ||
| import { getFeed } from "./feeds"; | ||
| import { describe, expect, test } from "vitest"; | ||
| import { getFeed } from "./feeds.js"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
findOneChild, deprecated domhandler re-exportsBREAKING CHANGE: This package is now ESM-only.