refactor!: publish ESM only with vp pack - #904
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (33)
💤 Files with no reviewable changes (13)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe package migrated from tshy to Vite Plus and now publishes ESM-only output. Runtime version data comes from ChangesESM and Vite Plus migration
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to No concrete merge-blocking issue remains in the ESM migration. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #904 +/- ##
=======================================
Coverage 94.24% 94.24%
=======================================
Files 10 10
Lines 747 747
Branches 235 235
=======================================
Hits 704 704
Misses 40 40
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
JSON imports currently cause TypeScript typechecking to fail because resolveJsonModule is not enabled.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Refactors urllib to publish a single ESM package using vp pack, replacing the dual CJS/ESM build.
Changes:
- Adds ESM bundling, declarations, sourcemaps, and updated exports.
- Updates tests, fixtures, examples, and documentation.
- Removes
tshy, CommonJS tooling, and version-replacement logic.
File summaries
| File | Summary |
|---|---|
vite.config.ts |
Configures ESM packaging and declarations. |
tsconfig.json |
Updates excluded test paths. |
test/user-agent.test.ts |
Validates the package-derived user agent. |
test/options.headers.test.ts |
Uses the exported user-agent constant. |
test/options.files.test.ts |
References the ESM fixture. |
test/mts/tsconfig.json |
Configures strict ESM type checking. |
test/mts/src/index.mts |
Tests generated ESM declarations. |
test/mts/package.json |
Removes redundant metadata. |
test/fixtures/ts/tsconfig.json |
Removes obsolete CommonJS fixture configuration. |
test/fixtures/ts/package.json |
Removes obsolete fixture metadata. |
test/fixtures/ts/hello.ts |
Removes the obsolete CommonJS fixture. |
test/fixtures/ts-esm/tsconfig.json |
Updates ESM compiler settings. |
test/fixtures/ts-esm/package.json |
Removes redundant metadata. |
test/fixtures/ts-esm/hello.ts |
Updates ESM type-only imports. |
test/fixtures/ts-cjs-es2021/tsconfig.json |
Removes obsolete CommonJS fixture configuration. |
test/fixtures/ts-cjs-es2021/package.json |
Removes obsolete fixture metadata. |
test/fixtures/ts-cjs-es2021/hello.ts |
Removes the obsolete CommonJS fixture. |
test/esm/package.json |
Removes redundant ESM metadata. |
test/esm/index.js |
Tests built ESM integration. |
test/cjs/package.json |
Removes obsolete CommonJS metadata. |
test/cjs/index.js |
Removes obsolete CommonJS integration coverage. |
src/HttpClient.ts |
Reads the package version directly. |
scripts/replace_urllib_version.js |
Removes obsolete version replacement logic. |
README.md |
Documents ESM-only usage. |
pnpm-lock.yaml |
Removes obsolete tshy dependencies. |
package.json |
Defines ESM exports and build scripts. |
examples/timing.mjs |
Migrates the example to ESM imports. |
examples/search_github.mjs |
Migrates the example to ESM imports. |
examples/longruning.mjs |
Migrates the example to ESM imports. |
examples/httpclient.mjs |
Migrates the example to ESM imports. |
examples/h2-other-side-closed-exit-0.mjs |
Migrates the example to ESM imports. |
examples/h2-other-side-closed-exit-0-fetch.mjs |
Migrates the example to ESM imports. |
CLAUDE.md |
Documents the updated build model. |
.gitignore |
Removes obsolete fixture and build entries. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
- Files reviewed: 31/34 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // @ts-ignore | ||
| import undiciSymbols from 'undici/lib/core/symbols.js'; | ||
|
|
||
| import pkg from '../package.json' with { type: 'json' }; |
|
|
||
| import { describe, it, beforeAll, afterAll } from 'vite-plus/test'; | ||
|
|
||
| import pkg from '../package.json' with { type: 'json' }; |
Replace
tshywithvp packto remove the separate ESM and CommonJS builds. The package now provides one ESM entry point with TypeScript declarations.The build reads the version from
package.json. This removes the need for a separate replacement script. Package exports, examples, and documentation now use ESM.Summary by CodeRabbit
New Features
Documentation
import.meta.filename.Bug Fixes