Skip to content

fix: drop unnecessary CJS output and optimize turbo config - #2

Merged
beeeku merged 2 commits into
masterfrom
fix/drop-cjs-fix-turbo
Mar 20, 2026
Merged

beeeku merged 2 commits into
masterfrom
fix/drop-cjs-fix-turbo

Conversation

@beeeku

@beeeku beeeku commented Mar 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Remove CJS format from all 21 bunup.config.ts files (packages + integrations) — output is now ESM-only, roughly halving dist size
  • Remove "main" and "require" entries from all 21 package.json exports — consumers are Cloudflare Workers (ESM-only)
  • Remove "dependsOn": ["build"] from turbo test task — tests import from ../src/, not dist
  • Add "outputs": [] to turbo typecheck and lint tasks for proper caching

Test plan

  • bun run build passes — only .js and .d.ts files in dist (no .cjs / .d.cts)
  • bun run typecheck passes
  • bun run test passes (confirms tests do not depend on build output)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Migrated packages to ESM-only distribution, removing CommonJS entrypoints and require mappings.
    • Updated build configs to emit ESM artifacts only (no CJS builds).
    • Adjusted dependency declarations across packages (moved/removed several deps between runtime and dev).
    • Refined task orchestration settings to improve caching and build/test behavior.

All packages target ESM-only consumers (Cloudflare Workers), so CJS
output was dead weight roughly doubling dist size. Also fix turbo task
config: remove build dependency from test (tests import from src/),
and add outputs:[] to typecheck and lint for proper caching.

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

Copy link
Copy Markdown
Contributor

Bundle Size Report

Package Base PR Delta
@workkit/ai 64KiB 43KiB -22KiB
@workkit/ai-gateway 81KiB 56KiB -25KiB
@workkit/api 137KiB 82KiB -55KiB
@workkit/astro 29KiB 18KiB -11KiB
@workkit/auth 69KiB 48KiB -22KiB
@workkit/cache 55KiB 38KiB -17KiB
@workkit/cli 142KiB 107KiB -35KiB
@workkit/cron 69KiB 49KiB -21KiB
@workkit/crypto 64KiB 26KiB -39KiB
@workkit/d1 142KiB 90KiB -53KiB
@workkit/do 40KiB 26KiB -14KiB
@workkit/env 63KiB 43KiB -20KiB
@workkit/errors 59KiB 40KiB -20KiB
@workkit/hono 37KiB 25KiB -13KiB
@workkit/kv 48KiB 33KiB -15KiB
@workkit/queue 32KiB 21KiB -11KiB
@workkit/r2 83KiB 57KiB -26KiB
@workkit/ratelimit 46KiB 32KiB -15KiB
@workkit/remix 49KiB 34KiB -16KiB
@workkit/testing 380KiB 102KiB -279KiB
@workkit/types 34KiB 19KiB -15KiB

@coderabbitai

coderabbitai Bot commented Mar 20, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3da8799e-cdc8-486b-89e1-b73ed6f8bd9c

📥 Commits

Reviewing files that changed from the base of the PR and between 914438f and 8dd1dba.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • integrations/remix/package.json
  • packages/cli/package.json

📝 Walkthrough

Walkthrough

This PR changes build outputs to ESM-only across integrations and packages by updating bunup configs and package.json export maps, and adjusts turbo task definitions related to test, typecheck, and lint outputs.

Changes

Cohort / File(s) Summary
Build Format Configs
integrations/astro/bunup.config.ts, integrations/hono/bunup.config.ts, integrations/remix/bunup.config.ts, packages/ai-gateway/bunup.config.ts, packages/ai/bunup.config.ts, packages/api/bunup.config.ts, packages/auth/bunup.config.ts, packages/cache/bunup.config.ts, packages/cli/bunup.config.ts, packages/cron/bunup.config.ts, packages/crypto/bunup.config.ts, packages/d1/bunup.config.ts, packages/do/bunup.config.ts, packages/env/bunup.config.ts, packages/errors/bunup.config.ts, packages/kv/bunup.config.ts, packages/queue/bunup.config.ts, packages/r2/bunup.config.ts, packages/ratelimit/bunup.config.ts, packages/testing/bunup.config.ts, packages/types/bunup.config.ts
Replaced format: ["esm","cjs"] with format: ["esm"] in Bunup configs; CJS artifacts no longer emitted.
Package Export Maps
integrations/astro/package.json, integrations/hono/package.json, integrations/remix/package.json, packages/ai-gateway/package.json, packages/ai/package.json, packages/api/package.json, packages/auth/package.json, packages/cache/package.json, packages/cli/package.json, packages/cron/package.json, packages/crypto/package.json, packages/d1/package.json, packages/do/package.json, packages/env/package.json, packages/errors/package.json, packages/kv/package.json, packages/queue/package.json, packages/r2/package.json, packages/ratelimit/package.json, packages/testing/package.json, packages/types/package.json
Removed CommonJS exports["."].require conditions and removed top-level main fields that pointed to CJS outputs; retained ESM import mappings and type references.
Dependency / Manifest Edits
integrations/remix/package.json, integrations/astro/package.json, integrations/hono/package.json, packages/cli/package.json, packages/cache/package.json, packages/crypto/package.json, packages/remix/package.json
Adjusted dependency sections: added or moved dev/peer dependencies in a few manifests (e.g., @standard-schema/spec, zod, reclassifications between dependencies/devDependencies/peerDependencies).
Build Orchestration
turbo.json
Removed test.dependsOn: ["build"]; added outputs: [] to typecheck and lint task entries to change caching/output tracking.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through configs, snipped the CJS,
Trimmed exports tidy, set ESM free,
No extra bundles in my burrow today,
Turbo tasks trimmed to a hop and a sway,
A bright clean build — nibble, then play! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main changes: dropping CJS output and optimizing turbo config, which accurately reflects the substantial modifications across 21+ files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drop-cjs-fix-turbo

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@integrations/remix/package.json`:
- Around line 42-44: The package currently lists "@standard-schema/spec" only
under peerDependencies; add the same version ("^1.1.0") to devDependencies in
package.json so local tooling (typecheck, test, build) can resolve the type-only
imports from action.ts and types.ts during development; update the
devDependencies section to include "@standard-schema/spec": "^1.1.0".

In `@packages/cli/package.json`:
- Around line 39-42: The four workspace packages "@workkit/d1", "@workkit/env",
"@workkit/errors", and "@workkit/types" are marked external by the bundler and
are required at runtime by the CLI, so they must be listed under dependencies
rather than devDependencies in package.json; update package.json to remove these
entries from devDependencies and add them to dependencies (preserving the
"workspace:*" version specifiers) so they are resolved for end users at runtime.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3e73ffae-b594-419e-9484-78598ae137af

📥 Commits

Reviewing files that changed from the base of the PR and between 5727169 and 914438f.

📒 Files selected for processing (43)
  • integrations/astro/bunup.config.ts
  • integrations/astro/package.json
  • integrations/hono/bunup.config.ts
  • integrations/hono/package.json
  • integrations/remix/bunup.config.ts
  • integrations/remix/package.json
  • packages/ai-gateway/bunup.config.ts
  • packages/ai-gateway/package.json
  • packages/ai/bunup.config.ts
  • packages/ai/package.json
  • packages/api/bunup.config.ts
  • packages/api/package.json
  • packages/auth/bunup.config.ts
  • packages/auth/package.json
  • packages/cache/bunup.config.ts
  • packages/cache/package.json
  • packages/cli/bunup.config.ts
  • packages/cli/package.json
  • packages/cron/bunup.config.ts
  • packages/cron/package.json
  • packages/crypto/bunup.config.ts
  • packages/crypto/package.json
  • packages/d1/bunup.config.ts
  • packages/d1/package.json
  • packages/do/bunup.config.ts
  • packages/do/package.json
  • packages/env/bunup.config.ts
  • packages/env/package.json
  • packages/errors/bunup.config.ts
  • packages/errors/package.json
  • packages/kv/bunup.config.ts
  • packages/kv/package.json
  • packages/queue/bunup.config.ts
  • packages/queue/package.json
  • packages/r2/bunup.config.ts
  • packages/r2/package.json
  • packages/ratelimit/bunup.config.ts
  • packages/ratelimit/package.json
  • packages/testing/bunup.config.ts
  • packages/testing/package.json
  • packages/types/bunup.config.ts
  • packages/types/package.json
  • turbo.json
💤 Files with no reviewable changes (15)
  • packages/types/package.json
  • packages/cron/package.json
  • packages/r2/package.json
  • packages/kv/package.json
  • packages/ratelimit/package.json
  • packages/d1/package.json
  • packages/do/package.json
  • packages/ai-gateway/package.json
  • packages/ai/package.json
  • packages/auth/package.json
  • packages/cache/package.json
  • packages/crypto/package.json
  • packages/queue/package.json
  • packages/api/package.json
  • packages/testing/package.json

Comment thread integrations/remix/package.json
Comment thread packages/cli/package.json Outdated
- CLI: move @workkit/{d1,env,errors,types} to dependencies — they are
  marked external in bunup and must be resolved at runtime by consumers
- Remix: add @standard-schema/spec to devDependencies alongside peerDeps
  so local tooling can resolve type-only imports during development

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@beeeku
beeeku merged commit d0d6b8f into master Mar 20, 2026
6 of 7 checks passed
@beeeku
beeeku deleted the fix/drop-cjs-fix-turbo branch March 20, 2026 18:42
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