feat(loader-fs): extract shared loader fs package#5947
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new ChangesLoaderFS Package Extraction
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Deploying egg with
|
| Latest commit: |
3dbb371
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a115d30f.egg-cci.pages.dev |
| Branch Preview URL: | https://agent-egg-dev-03217a77.egg-cci.pages.dev |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #5947 +/- ##
=======================================
Coverage 85.21% 85.21%
=======================================
Files 669 669
Lines 19304 19320 +16
Branches 3787 3792 +5
=======================================
+ Hits 16449 16464 +15
- Misses 2463 2464 +1
Partials 392 392 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Deploying egg-v3 with
|
| Latest commit: |
3dbb371
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cd77e37c.egg-v3.pages.dev |
| Branch Preview URL: | https://agent-egg-dev-03217a77.egg-v3.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request extracts the LoaderFS and RealLoaderFS filesystem abstractions from the core package into a new standalone package, @eggjs/loader-fs, and updates the core package to consume and re-export them. Feedback focuses on refining the new package by updating debug namespaces and error prefixes to reflect the move. Additionally, there are suggestions to improve the robustness of file extension detection for module loading and to enhance error handling when catching non-Error values.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/loader-fs/package.json`:
- Around line 28-37: Remove the unsupported publishConfig.exports block from
package.json (the nested "publishConfig" object containing "exports") and ensure
the package's top-level "exports" is rewritten to point to the compiled artifact
(change exports["."] to "./dist/index.js") as part of the build/publish step, or
alternatively add a "files" whitelist that omits TypeScript sources so published
tarball contains only compiled ./dist; update your packaging/build script that
produces published metadata rather than relying on publishConfig.exports.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f2cbc8f9-ff27-4339-bf2d-8ad32541c9d8
📒 Files selected for processing (22)
packages/core/package.jsonpackages/core/src/index.tspackages/core/src/loader/egg_loader.tspackages/core/src/loader/file_loader.tspackages/core/src/loader/loader_fs.tspackages/core/test/loader/file_loader.test.tspackages/core/test/loader/loader_fs.test.tspackages/loader-fs/CHANGELOG.mdpackages/loader-fs/README.mdpackages/loader-fs/package.jsonpackages/loader-fs/src/index.tspackages/loader-fs/test/fixtures/loadfile/object.jspackages/loader-fs/test/fixtures/loadfile/package.jsonpackages/loader-fs/test/fixtures/loadfile/plain.ymlpackages/loader-fs/test/loader_fs.test.tspackages/loader-fs/tsconfig.jsonpackages/loader-fs/tsdown.config.tstsconfig.jsonwiki/index.mdwiki/log.mdwiki/packages/core.mdwiki/packages/loader-fs.md
There was a problem hiding this comment.
Pull request overview
This PR extracts the loader-facing filesystem boundary (LoaderFS / RealLoaderFS) into a new workspace package @eggjs/loader-fs, then updates @eggjs/core to consume and re-export that API while preserving a compatibility re-export file.
Changes:
- Add new
@eggjs/loader-fspackage containingLoaderFS,LoaderFSGlobOptions, andRealLoaderFS, plus focused unit tests/fixtures. - Update
@eggjs/coreto depend on@eggjs/loader-fs, re-export its API, and migrate internal loader imports. - Update wiki documentation to reflect the new package boundary and ownership.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wiki/packages/loader-fs.md | New wiki page documenting the new @eggjs/loader-fs package and its responsibilities. |
| wiki/packages/core.md | Updates core docs to describe consuming/re-exporting LoaderFS from @eggjs/loader-fs. |
| wiki/log.md | Adds a changelog entry documenting the package extraction. |
| wiki/index.md | Adds the new Loader FS wiki page to the wiki index. |
| tsconfig.json | Adds packages/loader-fs to TS project references. |
| packages/loader-fs/tsdown.config.ts | Adds build config for the new package. |
| packages/loader-fs/tsconfig.json | Adds package TS config extending the repo root config. |
| packages/loader-fs/test/loader_fs.test.ts | Adds unit tests for RealLoaderFS behavior (exists/stat/realpath/readJSON/glob/loadFile). |
| packages/loader-fs/test/fixtures/loadfile/plain.yml | Fixture for non-module file loading behavior. |
| packages/loader-fs/test/fixtures/loadfile/package.json | Fixture to force CJS semantics for fixture modules. |
| packages/loader-fs/test/fixtures/loadfile/object.js | Fixture module for JS load behavior. |
| packages/loader-fs/src/index.ts | Introduces LoaderFS interface and RealLoaderFS implementation. |
| packages/loader-fs/README.md | Adds package README describing purpose and basic usage. |
| packages/loader-fs/package.json | Defines the new workspace package metadata, exports, deps, and scripts. |
| packages/loader-fs/CHANGELOG.md | Adds initial changelog for the new package. |
| packages/core/test/loader/loader_fs.test.ts | Switches tests to import RealLoaderFS from @eggjs/loader-fs. |
| packages/core/test/loader/file_loader.test.ts | Switches tests to import RealLoaderFS / LoaderFSGlobOptions from @eggjs/loader-fs. |
| packages/core/src/loader/loader_fs.ts | Converts existing file into a compatibility re-export of @eggjs/loader-fs. |
| packages/core/src/loader/file_loader.ts | Updates loader implementation to import RealLoaderFS/LoaderFS from @eggjs/loader-fs. |
| packages/core/src/loader/egg_loader.ts | Updates loader implementation to import RealLoaderFS/LoaderFS from @eggjs/loader-fs. |
| packages/core/src/index.ts | Re-exports @eggjs/loader-fs from core’s public entrypoint. |
| packages/core/package.json | Adds @eggjs/loader-fs as a dependency. |
Summary
@eggjs/loader-fsworkspace package for the loader-facingLoaderFS/RealLoaderFSboundary@eggjs/coredepend on and re-export@eggjs/loader-fs, while keeping the existingpackages/core/src/loader/loader_fs.tscompatibility re-exportValidation
pnpm exec vitest run packages/loader-fs/test/loader_fs.test.ts packages/core/test/index.test.ts packages/core/test/loader/loader_fs.test.ts packages/core/test/loader/file_loader.test.ts packages/core/test/loader/egg_loader.test.ts --bail 1 --retry 2 --testTimeout 20000 --hookTimeout 20000pnpm --filter @eggjs/loader-fs run typecheckpnpm --filter @eggjs/core run typecheckpnpm exec oxfmt --check packages/loader-fs packages/core/src/index.ts packages/core/src/loader/loader_fs.ts packages/core/src/loader/file_loader.ts packages/core/src/loader/egg_loader.ts packages/core/test/loader/loader_fs.test.ts packages/core/test/loader/file_loader.test.ts wiki/index.md wiki/log.md wiki/packages/core.md wiki/packages/loader-fs.mdpnpm exec oxlint --type-aware --type-check --quiet packages/loader-fs/src/index.ts packages/loader-fs/test/loader_fs.test.ts packages/core/src/index.ts packages/core/src/loader/loader_fs.ts packages/core/src/loader/file_loader.ts packages/core/src/loader/egg_loader.ts packages/core/test/loader/loader_fs.test.ts packages/core/test/loader/file_loader.test.tsgit diff --cached --unified=0 -- packages/loader-fs packages/core/src/loader/loader_fs.ts packages/core/src/index.ts packages/core/src/loader/file_loader.ts packages/core/src/loader/egg_loader.ts packages/core/test/loader/loader_fs.test.ts packages/core/test/loader/file_loader.test.ts | rg '^\\+.*\\bany\\b'before commit: no matchesSummary by CodeRabbit
New Features
Documentation
Refactor
Tests
Chores