fix(bundler): fix compile failures on CI and example type errors#96
fix(bundler): fix compile failures on CI and example type errors#96zrosenbauer merged 3 commits intomainfrom
Conversation
The c12 config loader has optional peer deps (chokidar, magicast, giget) that were externalized at `bun build --compile` time. In strict pnpm layouts (e.g. GitHub Actions), Bun couldn't resolve them even when marked --external, causing compile failures. Moves the externalization to tsdown's neverBundle config so these imports are stripped from the bundle before they reach bun. Also adds a --verbose flag to `kidd build` that surfaces bun's stderr on compile failures. Co-Authored-By: Claude <noreply@anthropic.com>
…types - Add `declare module` augmentation to report middleware types so `ctx.report` is available on all commands when middleware is at cli() level - Fix icons example to use `ctx.log.raw()` / `ctx.format.table()` instead of removed `ctx.output` API Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 0b055a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR refactors output operations in example commands from Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 `@packages/bundler/src/compile/compile.ts`:
- Around line 224-227: The callback is mutating the Error parameter (execFileCb
callback) with Object.assign(error, { stderr }); instead create a new error-like
object and pass that (or return a tuple with stderr) to avoid mutating
parameters: build a fresh object that copies error.name, error.message,
error.stack (or use Object.create and assign those properties) plus stderr and
pass that to resolve(err(...)) instead of mutating the original Error; update
the code in the execFileCb callback (where Object.assign is used) and any
consumer (e.g., formatCompileError) to accept the new shape or tuple.
- Around line 200-213: formatCompileError currently returns only the header when
verbose is true but execError.stderr is empty, losing useful spawn-level
messages in execError.message; modify formatCompileError to fall back to
execError.message (trimmed) when stderr is empty and verbose is true, and ensure
you return header + newline + message when present; also avoid mutating the
original error (the Object.assign usage around stderr enrichment) by creating a
new enriched object like { ...error, stderr } instead of mutating error; finally
add a unit test for formatCompileError covering verbose: true with
empty/whitespace stderr but a populated execError.message to prevent
regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5b3f521c-1ced-408f-bffc-649435c84db6
⛔ Files ignored due to path filters (2)
.changeset/fix-compile-ci.mdis excluded by!.changeset/**.changeset/fix-report-augmentation.mdis excluded by!.changeset/**
📒 Files selected for processing (9)
examples/icons/commands/category.tsexamples/icons/commands/show.tspackages/bundler/src/build/map-config.test.tspackages/bundler/src/build/map-config.tspackages/bundler/src/compile/compile.test.tspackages/bundler/src/compile/compile.tspackages/bundler/src/types.tspackages/cli/src/commands/build.tspackages/core/src/middleware/report/types.ts
Summary
chokidar,magicast, andgigetwere externalized atbun build --compiletime via--externalflags. In strict pnpm layouts (GitHub Actions), Bun couldn't resolve them even when marked external. Now they're stripped at the tsdown bundle level vianeverBundle, so they never reach the compile step.--verboseflag tokidd build— surfaces bun's stderr on compile failures instead of the opaque "bun build --compile failed" message.ctx.reportis now typed on all commands whenreport()middleware is registered at thecli()level, matching the existingiconsmiddleware pattern.ctx.outputAPI withctx.log.raw()andctx.format.table().Test plan
pnpm checkpasses (typecheck + lint + format)pnpm testpasses (all 17 tasks)pnpm typecheck --filter='./examples/*'passes (all 6 examples)kidd build --compileworks in CI (GitHub Actions macOS runner)kidd build --compile --verbosesurfaces stderr on failure