Fix broken module paths, remove helpers from published packages#308
Fix broken module paths, remove helpers from published packages#308brianmhunt merged 6 commits intomainfrom
Conversation
The module field in 22 package.json files pointed to non-existent files (e.g. dist/bind.js). esbuild outputs dist/index.js. Bundlers using the module field would get resolution errors. Also remove helpers/ from files and exports — test helpers shouldn't ship to npm consumers. Based on phillipc's work in PR #295, applied cleanly to current main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 21 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe PR removes Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Without this, make repackage would re-add helpers/ to every package.json. Now only includes helpers in exports/files if the helpers directory actually exists. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR standardizes package ESM entrypoints and tightens the npm publish surface across the monorepo by correcting incorrect module paths and removing test helpers from exports/published files.
Changes:
- Update
modulein multiplepackages/*/package.jsonfiles todist/index.jsto avoid broken ESM resolution. - Remove
helpers/fromfilesand remove./helpers/*fromexportsacross packages/builds so test helpers aren’t shipped to npm consumers.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/utils/package.json | Stop publishing helpers/ and remove ./helpers/* export. |
| packages/utils.parser/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/utils.jsx/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/utils.functionrewrite/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/utils.component/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.virtual/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.native/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.mustache/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.multi/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.databind/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.component/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.bindingstring/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/provider.attr/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/observable/package.json | Stop publishing helpers/ and remove ./helpers/* export. |
| packages/lifecycle/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/filter.punches/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/computed/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/builder/package.json | Stop publishing helpers/ and remove ./helpers/* export. |
| packages/binding.template/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/binding.if/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/binding.foreach/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/binding.core/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/binding.component/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| packages/bind/package.json | Fix module to dist/index.js; stop publishing/exporting helpers. |
| builds/reference/package.json | Stop publishing helpers/ and remove ./helpers/* export. |
| builds/knockout/package.json | Stop publishing helpers/ and remove ./helpers/* export. |
| "name": "@tko/bind", | ||
| "description": "TKO DOM-Observable Binding", | ||
| "module": "dist/bind.js", | ||
| "module": "dist/index.js", |
| "exports": { | ||
| ".": { | ||
| "require": "./dist/index.cjs", | ||
| "import": "./dist/index.mjs" | ||
| }, | ||
| "./helpers/*": "./helpers/*" | ||
| } |
| "exports": { | ||
| ".": { | ||
| "require": "./dist/index.cjs", | ||
| "import": "./dist/index.js" | ||
| }, | ||
| "./helpers/*": "./helpers/*" | ||
| } |
- Add module: dist/index.js to @tko/observable, @tko/utils, @tko/builder - Preserve existing exports.".".import extension in repackage.mjs (builds use .mjs, packages use .js — don't overwrite) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
binding.template has a legitimate test consumer (crossWindowBehaviors.ts imports dummyTemplateEngine). Keep ./helpers/* in its exports. Add changeset for the module path fix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dummyTemplateEngine is a test helper that should never ship to npm. Change crossWindowBehaviors.ts to use a relative workspace path instead of the package specifier. Remove the tsconfig path alias since it's no longer needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
repackage.mjs overwrites per-package package.json with a template, clobbering package-specific config and fighting against intentional changes. Versioning is handled by Changesets, metadata consistency can be validated by a lint rule if needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| * the package.json files are consistent and it is | ||
| * easy to distribute changes. | ||
| */ | ||
| import fs from 'fs/promises' |
There was a problem hiding this comment.
I corrected the repackage.mjs file instead of deleting it.
That works too. Instead of a script, AI will automate this for us in 2026.
|
@brianmhunt Good restoration of my changes. In https://github.com/knockout/tko/pull/289/changes#diff-32b7e790f9dfc6997466222d294b0bed74fc6ae2346a88d9e990a27f337fcd7cR1 - I have also fixed up the DTS generation for each package, but I had needed Knip before to correct the cycles in the type imports. I had obtained external confirmation of the "Knip" merger, if one look closely. Unfortunately, you left me hanging for four months. |
|
Thanks @phillipc -- appreciate your patience here. |
Summary
The
modulefield in 22 package.json files pointed to non-existent files (e.g.,dist/bind.jsinstead ofdist/index.js). Any bundler using themodulefield for ESM resolution would get errors.Also removes
helpers/fromfilesand./helpers/*fromexports— test helpers shouldn't ship to npm consumers.Based on @phillipc's work in PR #295, applied cleanly to current main (his branch was stale). PR #295 can be closed.
Changes
modulefield →dist/index.jshelpers/fromfilesarray./helpers/*fromexportsTest plan
make— 27 packages buildbunx vitest run— 2679 passed🤖 Generated with Claude Code
Summary by CodeRabbit