Skip to content

feat: publish executable CommonJS package conditions - #550

Merged
leonidaz merged 47 commits into
octanejs:mainfrom
jonkwheeler:jon/commonjs-package-condition
Aug 10, 2026
Merged

leonidaz merged 47 commits into
octanejs:mainfrom
jonkwheeler:jon/commonjs-package-condition

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Octane consumers can now use synchronous require() for core, Floating UI, Base UI, and Radix without React, a TypeScript loader, or an ESM fallback. The existing ESM and source-first contracts remain unchanged.

A shared fail-closed builder emits per-module .cjs graphs only for supported JavaScript and TypeScript sources. It rejects TSRX, unresolved or escaping paths, output/source overlap, top-level await, import.meta, collisions, and other lossy transforms before packaging. The release gate installs real tarballs outside the workspace, proves each require condition selects .cjs, verifies one Octane runtime and no React, and compares CommonJS exports and SSR output with the bundled ESM graph.

This is the package-condition prerequisite for the Headless UI React-parity port. Headless UI remains blocked separately on the Firefox browser-runner prerequisite.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • targeted tests:
    • node --test scripts/build-package-commonjs.test.mjs scripts/package-pack-canaries.test.mjs (22 tests passed after rebasing onto current main)
    • node packages/octane/scripts/build.mjs (ESM and CommonJS dist verification passed)
    • vitest run packages/octane/tests/public-exports.test.ts (2 files, 8 tests passed)
    • pnpm packages:pack:check (69 tarballs plus CommonJS, strict TSRX, Vite/SSR, Lynx, Pulseboard, and Wayfinder external consumers passed)
    • changed-file formatting and pnpm sync passed before the final rebase; the rebase applied without conflicts and the focused build/tests were rerun

Risk / follow-ups

  • CommonJS is intentionally limited to octane, octane/server, @octanejs/floating-ui, @octanejs/base-ui, and @octanejs/radix. Compiler, Vite, Volar, React-hosted, type-only, and other binding subpaths retain their current contracts.
  • Full-workspace format, typecheck, and test suites are left to draft CI; the release-shaped tarball gate and focused suites passed locally.
  • After this prerequisite merges, the Headless UI branch must rebase and rerun its exact-package feasibility audit. It must not treat this branch alone as satisfying that gate.

Provenance

  • An agent produced this diff (agent-authored)

Note

Medium Risk
Touches published export maps, prepack builds, and release gates for core runtime packages; mistakes could break installs or dual-format parity, but ESM contracts are preserved and tarball checks are extensive.

Overview
Adds honest Node require() support for octane, octane/server, @octanejs/floating-ui, @octanejs/base-ui, and @octanejs/radix while keeping existing ESM / source-first import paths unchanged.

A new shared build-package-commonjs prepack utility emits per-module .cjs graphs (dependencies stay external), rewrites relative require edges, and fails closed on .tsrx, path escape, unsupported syntax, and colliding outputs. Core wires this into build.mjs for root and server; the three bindings run it via prepack and expose ordered types / import / require export conditions (Base UI wildcards included).

verify-dist now smoke-executes published require targets and checks required public export subsets. check-package-packs installs real tarballs in an outside-workspace consumer, asserts .cjs resolution, a single Octane peer per graph, no React, and ESM vs CommonJS export/SSR parity. The Vite bundler still discovers source bindings when require points at a not-yet-built CJS artifact by walking to package.json.

Patch changesets cover the four packages; scope is explicitly not all bindings or compiler subpaths.

Reviewed by Cursor Bugbot for commit 32dc3a7. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Aug 4, 2026 1:06am
octane-website-mcp Ready Ready Preview Aug 4, 2026 1:06am

Request Review

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability labels Aug 3, 2026
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 3, 2026 19:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 19:15 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 4, 2026 00:04 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 4, 2026 00:06 Inactive
Comment thread scripts/build-package-commonjs.mjs Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 4, 2026 00:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 4, 2026 00:10 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 4, 2026 01:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 4, 2026 01:01 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 4, 2026 01:05 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 4, 2026 01:06 Inactive
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Currency pass complete: branch updated with latest main, merge state CLEAN, no unresolved threads, Cursor Bugbot success on current head. Draft left unchanged.

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Branch updated onto current main via update-branch (no conflicts). Unresolved review threads: none. Cursor Bugbot completed successfully on the current head.

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Currency re-pass: already current with main (no update needed). Merge state CLEAN, no unresolved threads, Cursor Bugbot succeeded on 66c4f6c with no findings. Draft unchanged.

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

Branch is behind main; updating to restore CLEAN before re-signaling ready.

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

@trueadm
trueadm marked this pull request as ready for review August 10, 2026 11:00
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

Branch updated onto current main via update-branch. Waiting for Cursor Bugbot and CI on the new head before re-signaling ready.

jonkwheeler and others added 2 commits August 10, 2026 10:12
require.resolve failed on prepack-only dist/cjs entries in CI, so Vite
source discovery skipped Base UI and nested bindings. Fall back to the
installed package manifest when the require target is missing.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

REVIEW WITHDRAWN

Branch is behind main; updating to restore CLEAN before re-signaling ready.

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

READY FOR REVIEW

@leonidaz leonidaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@leonidaz
leonidaz merged commit 78316b4 into octanejs:main Aug 10, 2026
34 checks passed
@jonkwheeler
jonkwheeler deleted the jon/commonjs-package-condition branch October 20, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants