fix(cluster): add missing exports for agent_worker and app_worker#5536
fix(cluster): add missing exports for agent_worker and app_worker#5536
Conversation
- Export agent_worker and app_worker modules in cluster package.json - Add corresponding entries in tsdown.config.ts for build process - Update TypeScript config templates to use PartialEggConfig type - Simplify config.local.ts and config.prod.ts templates 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds two new worker entry points to the cluster package (exports and tsdown entries). Refactors Egg template configs from factory functions to static object exports typed as PartialEggConfig. Also updates the pnpm workspace catalog to bump Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly adds the missing exports for agent_worker and app_worker in the @eggjs/cluster package. The changes to package.json and tsdown.config.ts are appropriate to expose these modules. The PR also includes beneficial refactoring of the TypeScript configuration templates, simplifying them and adopting the PartialEggConfig type for better type safety. I've suggested a further improvement to use the defineConfig helper for consistency and better type safety across all configuration files.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #5536 +/- ##
=======================================
Coverage 75.87% 75.87%
=======================================
Files 114 114
Lines 5770 5770
Branches 1149 1149
=======================================
Hits 4378 4378
Misses 1212 1212
Partials 180 180 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
tools/create-egg/src/templates/simple-ts/config/config.default.ts (1)
10-10: Cast the final return to PartialEggConfig (and drop the interim cast)Avoids potential excess property checks from
bizConfig.sourceUrland is clearer.- } as PartialEggConfig; + }; @@ - return { - ...config, - ...bizConfig, - }; + return { + ...config, + ...bizConfig, + } as PartialEggConfig;Also applies to: 18-21
packages/cluster/tsdown.config.ts (1)
6-7: Optional: prefer hyphenated filenames for consistencyRepo guidelines favor lowercase with hyphens. Consider
agent-worker.tsandapp-worker.tsin a future major/minor if compatibility allows.packages/cluster/package.json (1)
8-9: Consider adding explicit types mappings for subpath exportsImproves TS resolution for
./agent_workerand./app_workerwithout relying on heuristic.d.tslookup.".": "./dist/index.js", - "./agent_worker": "./dist/agent_worker.js", - "./app_worker": "./dist/app_worker.js", + "./agent_worker": { "types": "./dist/agent_worker.d.ts", "default": "./dist/agent_worker.js" }, + "./app_worker": { "types": "./dist/app_worker.d.ts", "default": "./dist/app_worker.js" }, @@ ".": "./src/index.ts", - "./agent_worker": "./src/agent_worker.ts", - "./app_worker": "./src/app_worker.ts", + "./agent_worker": { "types": "./src/agent_worker.ts", "default": "./src/agent_worker.ts" }, + "./app_worker": { "types": "./src/app_worker.ts", "default": "./src/app_worker.ts" },Also applies to: 16-17
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/cluster/package.json(1 hunks)packages/cluster/tsdown.config.ts(1 hunks)tools/create-egg/src/templates/simple-ts/config/config.default.ts(2 hunks)tools/create-egg/src/templates/simple-ts/config/config.local.ts(1 hunks)tools/create-egg/src/templates/simple-ts/config/config.prod.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable
Files:
tools/create-egg/src/templates/simple-ts/config/config.default.tspackages/cluster/tsdown.config.tstools/create-egg/src/templates/simple-ts/config/config.local.tstools/create-egg/src/templates/simple-ts/config/config.prod.ts
packages/*/package.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use "workspace:*" for internal workspace dependencies in package.json
Files:
packages/cluster/package.json
{packages,plugins,tools}/**/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
{packages,plugins,tools}/**/package.json: Individual packages must reference external dependencies via "catalog:" from pnpm-workspace.yaml
Use "workspace:*" for internal monorepo dependencies between packages
Files:
packages/cluster/package.json
packages/*/tsdown.config.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Each package must provide a tsdown.config.ts for unbundled ESM builds
Files:
packages/cluster/tsdown.config.ts
{packages,plugins,tools}/**/tsdown.config.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Each package must use tsdown for unbundled ESM builds with type declarations (unbundle: true, dts: true)
Files:
packages/cluster/tsdown.config.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to packages/egg/tsdown.config.ts : packages/egg must use tsdown configured for unbundled ESM output
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to tools/egg-bin/tsdown.config.ts : egg-bin tool must use tsdown for TypeScript compilation
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to packages/egg/tsdown.config.ts : packages/egg must use tsdown configured for unbundled ESM output
Applied to files:
tools/create-egg/src/templates/simple-ts/config/config.default.tspackages/cluster/tsdown.config.tstools/create-egg/src/templates/simple-ts/config/config.local.tstools/create-egg/src/templates/simple-ts/config/config.prod.ts
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to packages/egg/tsconfig.json : packages/egg/tsconfig.json must extend eggjs/tsconfig and enable strict mode
Applied to files:
tools/create-egg/src/templates/simple-ts/config/config.default.ts
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to tools/egg-bin/tsdown.config.ts : egg-bin tool must use tsdown for TypeScript compilation
Applied to files:
tools/create-egg/src/templates/simple-ts/config/config.default.tspackages/cluster/tsdown.config.ts
📚 Learning: 2025-09-18T07:56:17.417Z
Learnt from: CR
PR: eggjs/egg#0
File: AGENTS.md:0-0
Timestamp: 2025-09-18T07:56:17.417Z
Learning: Applies to **/*.ts : Re-export types thoughtfully to keep the public API stable
Applied to files:
tools/create-egg/src/templates/simple-ts/config/config.default.ts
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to plugins/*/package.json : Plugin package.json must include an eggPlugin configuration field
Applied to files:
tools/create-egg/src/templates/simple-ts/config/config.default.ts
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to plugins/*/package.json : Plugin package.json must export TS sources in development ("exports": { ".": "./src/index.ts", "./agent": "./src/agent.ts", "./app": "./src/app.ts", "./package.json": "./package.json" })
Applied to files:
packages/cluster/package.jsonpackages/cluster/tsdown.config.ts
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to plugins/*/package.json : Plugin package.json must mirror exports for publish via publishConfig.exports pointing to compiled JS in dist (e.g., "./dist/index.js")
Applied to files:
packages/cluster/package.json
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to plugins/**/tsdown.config.ts : All plugins must use the standard tsdown configuration template (entry: 'src/**/*.ts', unbundle: true, dts: true, exports.devExports: true)
Applied to files:
packages/cluster/tsdown.config.ts
📚 Learning: 2025-09-15T01:56:16.297Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-15T01:56:16.297Z
Learning: Applies to {packages,plugins,tools}/**/tsdown.config.ts : Each package must use tsdown for unbundled ESM builds with type declarations (unbundle: true, dts: true)
Applied to files:
packages/cluster/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsdown.config.ts : Each package must provide a tsdown.config.ts for unbundled ESM builds
Applied to files:
packages/cluster/tsdown.config.ts
🧬 Code graph analysis (3)
tools/create-egg/src/templates/simple-ts/config/config.default.ts (1)
packages/egg/src/lib/types.ts (1)
PartialEggConfig(97-97)
tools/create-egg/src/templates/simple-ts/config/config.local.ts (1)
packages/egg/src/lib/types.ts (1)
PartialEggConfig(97-97)
tools/create-egg/src/templates/simple-ts/config/config.prod.ts (1)
packages/egg/src/lib/types.ts (1)
PartialEggConfig(97-97)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Test egg-bin (macos-latest, 22)
- GitHub Check: Test egg-bin (windows-latest, 24)
- GitHub Check: Test egg-bin (ubuntu-latest, 22)
- GitHub Check: Test egg-bin (windows-latest, 22)
- GitHub Check: Test egg-bin (macos-latest, 24)
- GitHub Check: Test egg-bin (ubuntu-latest, 24)
- GitHub Check: Test packages (macos-latest, 24)
- GitHub Check: Test packages (macos-latest, 22)
- GitHub Check: Test packages (ubuntu-latest, 22)
- GitHub Check: Test packages (windows-latest, 24)
- GitHub Check: Test packages (ubuntu-latest, 24)
- GitHub Check: Test packages (windows-latest, 22)
🔇 Additional comments (5)
tools/create-egg/src/templates/simple-ts/config/config.default.ts (1)
1-1: Importing PartialEggConfig is correctMatches the new typing direction.
packages/cluster/tsdown.config.ts (1)
6-7: LGTM: added agent_worker and app_worker entriesEntries align with new subpath exports.
tools/create-egg/src/templates/simple-ts/config/config.local.ts (1)
1-5: LGTM: static object export with PartialEggConfigTemplate matches the new typing approach.
tools/create-egg/src/templates/simple-ts/config/config.prod.ts (1)
1-5: LGTM: static object export with PartialEggConfigConsistent with the updated template suite.
packages/cluster/package.json (1)
8-9: Approve: agent_worker & app_worker subpath exports verified
Matches tsdown entries; dev → ./src/.ts, publish → ./dist/.js.

🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
Chores