fix(tegg-loader): ignore non-runtime module files#6031
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesLoader glob exclusions
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Code Review
This pull request updates LoaderUtil.ts to exclude TypeScript declaration files (.d.mts, .d.cts) and Vitest configuration files (vitest.config.) from runtime module loading, and adds corresponding unit tests. The reviewer suggests also excluding Vitest workspace configuration files (vitest.workspace.) and adding a corresponding test assertion.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // test runner configuration is not an application module | ||
| '!**/vitest.config.*', |
There was a problem hiding this comment.
In addition to vitest.config.*, Vitest workspace configuration files (e.g., vitest.workspace.ts or vitest.workspace.mjs) are also common in monorepos and should be excluded from runtime module discovery to prevent similar loading failures.
| // test runner configuration is not an application module | |
| '!**/vitest.config.*', | |
| // test runner configuration is not an application module | |
| '!**/vitest.config.*', | |
| '!**/vitest.workspace.*', |
| assert(patterns.includes('!**/*.d.ts')); | ||
| assert(patterns.includes('!**/*.d.mts')); | ||
| assert(patterns.includes('!**/*.d.cts')); | ||
| assert(patterns.includes('!**/vitest.config.*')); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #6031 +/- ##
==========================================
+ Coverage 81.98% 82.17% +0.18%
==========================================
Files 678 678
Lines 20838 20842 +4
Branches 4154 4155 +1
==========================================
+ Hits 17085 17127 +42
+ Misses 3235 3207 -28
+ Partials 518 508 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR hardens TEGG runtime module discovery by expanding the ignore glob patterns so that TypeScript declaration entrypoints (.d.mts, .d.cts) and package-local Vitest config files (vitest.config.*) are not treated as runtime application modules.
Changes:
- Extend
LoaderUtil.filePattern()to exclude**/*.d.mts,**/*.d.cts, and**/vitest.config.*. - Add a regression test asserting these exclusions are present in the generated file patterns.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tegg/core/loader/src/LoaderUtil.ts | Adds new exclude patterns for declaration variants and Vitest config files in runtime module globbing. |
| tegg/core/loader/test/Loader.test.ts | Adds a test to assert the new exclude patterns are included in LoaderUtil.filePattern(). |
|
Superseded by #6033. This patch is already included in the beta.24 baseline branch (codex/release-beta24-patchless) and was published with v4.1.2-beta.24. |
What changed
Exclude TypeScript declaration variants (
.d.mts,.d.cts) andvitest.config.*from TEGG runtime module discovery.Why
The extension-aware glob includes
.mts/.cts/.mjs, so declaration files and package-local Vitest config can otherwise be imported as application modules. This currently requires a Chair-bin postinstall patch and can fail when a published TEGG module containsvitest.config.mjs.Verification
vitest run --project @eggjs/tegg-loader tegg/core/loader/test/Loader.test.tsSummary by CodeRabbit