Skip to content

fix(packages): publish Bun entrypoints from dist#6

Merged
glockyco merged 1 commit into
mainfrom
fix/bun-package-exports
Jun 5, 2026
Merged

fix(packages): publish Bun entrypoints from dist#6
glockyco merged 1 commit into
mainfrom
fix/bun-package-exports

Conversation

@glockyco

@glockyco glockyco commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Fixes the npm package export regression introduced in the 4.0.0/3.0.1 release.

Problem

The public package manifests declared:

"exports": {
  ".": {
    "bun": "./src/index.ts",
    "import": "./dist/index.js"
  }
}

but the published npm packages only include dist/ (plus schemas for protocol). Bun prefers the bun condition, so Bun consumers could not import @hotrepl/sdk from npm at all:

Cannot find module '@hotrepl/sdk'

Fix

  • Point public Bun entrypoints at ./dist/index.js for protocol, sdk, cli, and mcp.
  • Add a package-export regression test that asserts public export targets are included in package files and Bun entrypoints use built JS.
  • Run package tests after build so workspace tests exercise the same public entrypoint shape consumers receive.
  • Update SDK tests that compare SDK error classes to import @hotrepl/sdk, avoiding duplicate source-vs-dist constructors after build-before-test.

Release

Patch changeset:

  • @hotrepl/protocol 4.0.1
  • @hotrepl/sdk 4.0.1
  • @hotrepl/cli 3.0.2
  • @hotrepl/mcp 3.0.2

Verified locally:

  • bun test packages/sdk/test/package-exports.test.ts fails red before the metadata fix and passes after.
  • bun run test && bun run typecheck && dprint check && bun changeset status --verbose.
  • npm pack tarballs installed into a clean app with npm, then imported under Bun: sdk/protocol/cli/mcp all load.

The 4.0.0/3.0.1 packages declared a Bun-specific export target of
`./src/index.ts`, but the npm packages only include built artifacts. Bun
prefers the `bun` condition over `import`, so Bun consumers could not
import the SDK or sibling packages from npm.

Point public Bun entrypoints at `dist/index.js`, add a package-export
regression test, and run package tests after build so workspace imports
exercise the same public entrypoint shape consumers receive. This keeps
the local test path aligned with the published package contract.
@glockyco
glockyco merged commit 9199584 into main Jun 5, 2026
5 checks passed
@glockyco
glockyco deleted the fix/bun-package-exports branch June 5, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant