-
Notifications
You must be signed in to change notification settings - Fork 36
refactor: standalone #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: standalone #292
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@eggjs/tsconfig@1.3.3, npm/@vitest/coverage-v8@3.0.7, npm/c8@10.1.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR refactors the standalone module by updating import paths to explicitly include “.js” extensions and converting several synchronous operations to asynchronous ones for consistency. It also improves error handling and updates module declarations to align with the new module interop conventions.
- Update export/import paths to use the “.js” extension.
- Convert synchronous operations (e.g. in EggModuleLoader) to async functions.
- Refine error handling and type declarations in main and configuration files.
Reviewed Changes
File | Description |
---|---|
plugin/dal/index.ts | Added exports for several DAL modules. |
standalone/standalone/index.ts | Updated export paths to use “.js” file extensions. |
standalone/standalone/src/Runner.ts | Refactored Runner initialization, load method, and internal options. |
standalone/standalone/src/main.ts | Updated import for Runner and improved error handling in catch. |
standalone/standalone/src/ModuleConfig.ts | Changed module declaration from ‘egg’ to ‘@eggjs/core’. |
standalone/standalone/src/StandaloneInnerObjectProto.ts | Added an index signature to the prototype class. |
core/common-util/src/ModuleConfigs.ts | Exported the ModuleConfig type for external usage. |
standalone/standalone/src/StandaloneLoadUnit.ts | Updated import path for StandaloneInnerObjectProto to “.js”. |
standalone/standalone/src/EggModuleLoader.ts | Converted generateAppGraph to async and updated initialization. |
core/tegg/index.ts | Adjusted re-exports to include ModuleConfig. |
standalone/standalone/src/StandaloneInnerObject.ts | Updated import path for StandaloneInnerObjectProto to “.js”. |
standalone/standalone/test/fixtures/aop-module/Hello.ts | Changed import from ‘node:assert/strict’ to ‘node:assert’. |
standalone/standalone/src/ConfigSourceLoadUnitHook.ts | Changed a synchronous loader call to an async call using await. |
Copilot reviewed 73 out of 73 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
standalone/standalone/test/fixtures/aop-module/Hello.ts:1
- Replacing 'node:assert/strict' with 'node:assert' may alter the behavior of your assertions. If you intend to use strict assertions, please consider importing from 'node:assert/strict'.
import assert from 'node:assert';
standalone/standalone/src/EggModuleLoader.ts:66
- loaderCache is not populated before attempting to retrieve a loader, so using a non-null assertion might lead to runtime errors. Consider populating loaderCache or handling the case when loaderCache.get(modulePath) returns undefined.
const loader = loaderCache.get(modulePath)!;
}, | ||
"author": "killagu <killa123@126.com>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@eggjs/tsconfig": "^1.0.0", | ||
"@vitest/coverage-v8": "^3.0.5", | ||
"ajv": "^8.17.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
竟然得加这个在 root,要不然 standalone 的 ajv 测试用例会出现编译错误,神奇了。
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #292 +/- ##
==========================================
+ Coverage 84.18% 88.39% +4.20%
==========================================
Files 401 401
Lines 12926 13042 +116
Branches 2127 2250 +123
==========================================
+ Hits 10882 11528 +646
+ Misses 2044 1514 -530 ☔ View full report in Codecov by Sentry. |
No description provided.