Skip to content

feat: add CJS and browser builds via Rollup#109

Merged
kjonescertinia merged 2 commits into
apex-dev-tools:mainfrom
peternhale:feat/multi-format-build
May 12, 2026
Merged

feat: add CJS and browser builds via Rollup#109
kjonescertinia merged 2 commits into
apex-dev-tools:mainfrom
peternhale:feat/multi-format-build

Conversation

@peternhale

Copy link
Copy Markdown
Contributor

Summary

  • Adds multi-format build output (ESM, CJS, browser ESM, browser UMD) using Rollup with esbuild transpilation
  • CJS consumers can now require() the package; browser consumers get a self-contained bundle with antlr4 inlined
  • Type declarations ship as both .d.ts and .d.cts for full TypeScript resolution in all module systems
  • Conditional exports map routes consumers to the correct format automatically

Test plan

  • All 89 existing Jest tests pass
  • ESM import verified: import { ApexParserFactory } from './dist/esm/index.js'
  • CJS require verified: require('./dist/cjs/index.cjs')
  • Browser ESM bundle loads and parses Apex correctly
  • Browser UMD bundle structurally correct (factory pattern verified)
  • Run npx publint and npx arethetypeswrong --pack . for export map validation
  • Test browser bundle in actual browser via <script type="module">

🤖 Generated with Claude Code

The npm package previously shipped ESM-only. This adds CJS (for
require() consumers) and browser (ESM + UMD with antlr4 inlined)
outputs using Rollup with esbuild transpilation. Type declarations
are generated separately with .d.ts and .d.cts for both module systems.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nawforce

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kjonescertinia kjonescertinia self-requested a review May 12, 2026 10:43
@kjonescertinia kjonescertinia merged commit 5840418 into apex-dev-tools:main May 12, 2026
1 check passed
@lcottercertinia

Copy link
Copy Markdown

I came to add this when I noticed the beta release included it. Thanks!

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.

4 participants