Publish internal/babel as ESM, matching what it ships - #3586
Conversation
`exports["./internal/babel"].types` points at `internal/babel/index.ts`, and that directory ships nothing else executable — `index.ts`, `modules.d.ts` and its `package.json`. The runtime entry resolves to `dist/babel.js`, which sits under the package root and takes its module type from there, so the CommonJS marker never governed it. It did govern TypeScript, which reads the nearest `package.json` to decide the module kind of `index.ts`. Declaring `commonjs` over an ESM file makes every import in it an error under `verbatimModuleSyntax`: error TS1295: ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax' That takes out `tsc -b` for consumers such as marko-js/language-server. 5.41.4 published no `type` field and was unaffected; dropping the override restores a correct `"type": "module"`.
🦋 Changeset detectedLatest commit: a56b418 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3586 +/- ##
=======================================
Coverage 94.70% 94.70%
=======================================
Files 420 420
Lines 54737 54737
Branches 4585 4585
=======================================
Hits 51841 51841
Misses 2861 2861
Partials 35 35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
@marko/compiler@5.41.5and5.41.6publishinternal/babel/package.jsonwith"type": "commonjs", which breakstscfor consumers:That directory ships nothing executable — only
index.ts,modules.d.tsand itspackage.json— andexports["./internal/babel"].typespoints straight at the ESMindex.ts. The runtime entry resolves todist/babel.js, which sits under the package root and takes its module type from there, so the CommonJS marker never governed it. The only thing that reads it is TypeScript, deciding the module kind ofindex.ts.5.41.4 published no
typefield and was unaffected; thetype:overridewas added alongside the native type-stripping work. Dropping it restores a correct"type": "module", matching the file it describes.Verified: a simulated
pkg-overridepublish ships"type": "module";require("@marko/compiler/internal/babel")still resolves todist/babel.jsand returns the babel namespace; suite 9683 passing. Against a packed tarball the fullmarko-js/language-serverbuild goes from failing to 0 TypeScript errors across all five packages — that repo's CI is currently red on 5.41.6 (marko-js/language-server#577).