Skip to content

[codex] Expose CLJS agencies from root entrypoint#27

Draft
meekmachine wants to merge 1 commit into
mainfrom
codex/js-entrypoint-exports
Draft

[codex] Expose CLJS agencies from root entrypoint#27
meekmachine wants to merge 1 commit into
mainfrom
codex/js-entrypoint-exports

Conversation

@meekmachine

Copy link
Copy Markdown
Owner

Summary

  • exposes the CLJS-built agency constructors from the normal package entrypoint after the CLJS bundle is emitted
  • updates CLJS smoke tests to import from ../dist/index.js rather than ../dist/cljs/index.js
  • updates the README to make the root entrypoint the LoomLarge-facing import path while preserving ./cljs for existing experiments

Part of meekmachine/LoomLarge#693.

Why

Polyester can use CLJS internally, but LoomLarge should consume a compiled JavaScript package API. This gives LoomLarge @lovelace_lol/polyester / compatibility imports without needing /cljs paths.

Validation

  • npm ci --ignore-scripts
  • npm run typecheck
  • npm test
  • node scripts/expose-cljs-main-exports.mjs

Blocked locally:

  • npm ci / full npm run build reaches shadow-cljs and fails because this machine only has Java 11. The failure is UnsupportedClassVersionError for class file version 65. CI/package builds with Java 21 should cover the full CLJS build.

@meekmachine meekmachine left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I found two concrete issues here.

  1. test:cljs no longer validates the new root-entrypoint contract. The smoke scripts now import from ../dist/index.js, but package.json still runs npm run build:cljs before those tests. build:cljs only emits the CLJS bundle; it does not run tsup or scripts/expose-cljs-main-exports.mjs, so the root dist/index.js export surface can be stale or missing and the test won’t catch it reliably. This should build the full package (or at least run tsup plus the expose script) before the smoke tests.

  2. The package still advertises a CommonJS root entrypoint via exports["."].require = "./dist/index.cjs", but the new root CLJS exports are implemented there as stubs that always throw. So the PR’s new “import from the normal package entrypoint” contract only works for ESM consumers and fails at runtime for require() consumers. That is a compatibility risk unless the docs/package metadata explicitly scope the feature to ESM-only consumers.

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