Skip to content

build(bindx-compiler): publish the compiler as compiled JS - #157

Merged
matej21 merged 1 commit into
mainfrom
feat/publish-bindx-compiler
Nov 3, 2026
Merged

matej21 merged 1 commit into
mainfrom
feat/publish-bindx-compiler

Conversation

@matej21

@matej21 matej21 commented Nov 3, 2026

Copy link
Copy Markdown
Member

Makes @contember/bindx-compiler publishable, so the next release ships it next to the runtime packages.

Why compiled JS

The runtime packages ship TypeScript source (exports: ./src/index.ts), which consumer bundlers compile. The compiler is different: a consumer imports it from vite.config.ts, and Node runs that config. Node does not strip types from files under node_modules, so importing .ts source from there fails.

Changes

  • packages/bindx-compiler/package.json:
    • no longer private; version aligned with the other packages
    • exports/main/types point at dist/
    • build:js bundles src/index.ts with bun build --target=node --packages=external
    • @contember/bindx-react is a workspace:* peer, so bun pm pack pins it to the exact release version
  • The root build (which the publish workflow runs) also runs build:js. Declarations still come from tsc --build.
  • New README.md: installation, Vite setup, the runtime killswitch and validate mode, and numbers from a trial.

Trial on a large production app

  • 614 chains and roots compiled, 23 bailed.
  • The browser end-to-end suite gave the same pass and fail set with and without the compiler. In validate mode, no under-fetch warnings and no unfetched-field errors.
  • The production build took about 60 % longer (20 s → 32 s). The bundle grew by 0.3 %.
  • Page load times showed no measurable difference.

Verification

  • bun run typecheck: clean.
  • bun run test: 2523 pass. Compiler suite: 242 pass.
  • Packed the package with bun pm pack and installed the tarball in an empty Node project. import { bindxCompiler } from '@contember/bindx-compiler' works, and the transform compiles a sample component.

Status

🤖 Generated with Claude Code

The Vite and Babel plugins run in Node from a consumer's build config,
and Node does not strip types from files under node_modules, so the
package cannot ship TypeScript source like the runtime packages do. The
root build now bundles dist/index.js next to the declarations, and the
package is no longer private, so the release publishes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matej21
matej21 merged commit 0543317 into main Nov 3, 2026
4 checks passed
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