-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: 支持ts-checker #956
feat: 支持ts-checker #956
Conversation
Co-authored-by: chencheng (云谦) <[email protected]>
3ada245
to
e035da9
Compare
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.
看了下实现,子进程跑的功能还没开发完吗?
packages/bundler-okam/index.js
Outdated
@@ -5,6 +5,7 @@ const assert = require('assert'); | |||
const { createProxy, createHttpsServer } = require('@umijs/bundler-utils'); | |||
const lodash = require('lodash'); | |||
const chalk = require('chalk'); | |||
const { ForkTsChecker } = require('./plugins/fork-ts-checker/index'); |
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.
const { ForkTsChecker } = require('./plugins/fork-ts-checker/index'); | |
const { ForkTsChecker } = require('./fork-ts-checker/index'); |
不要 plugins 目录,因为实际上 bundler-okam 层没有 plugin 机制。
await typeChecker.check(); | ||
} | ||
|
||
runTypeCheckInChildProcess() { |
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.
没有走子进程的这个逻辑吗?
Walkthrough:The changes revolve around enhancing TypeScript type checking capabilities in the build process. New configuration options and classes are introduced to enable type checking using Changes:
Poem:
Note Pull Request Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai Files selected for processing (1)
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
packages/bundler-okam/package.json
is excluded by:!**/*.json
pnpm-lock.yaml
is excluded by:!**/*.yaml
Files selected for processing (5)
- docs/config.md (2 hunks)
- packages/bundler-okam/fork-ts-checker/child_process_fork.js (1 hunks)
- packages/bundler-okam/fork-ts-checker/index.js (1 hunks)
- packages/bundler-okam/fork-ts-checker/ts-checker.js (1 hunks)
- packages/bundler-okam/index.js (4 hunks)
Additional comments: 9
packages/bundler-okam/fork-ts-checker/child_process_fork.js (3)
- 1-1: The comment next to the import statement is in Chinese. For consistency and broader understanding, consider translating it to English.
- 5-8: The
runTypeCheck
function is well-defined and correctly uses async/await for handling asynchronous operations. Good job!- 10-17: The promise chain for handling the outcome of the type checking process is correctly implemented, effectively communicating success or failure to the calling process.
packages/bundler-okam/fork-ts-checker/index.js (3)
- 1-2: The import statements are correctly used and necessary for the functionality of the
ForkTsChecker
class.- 4-22: The
ForkTsChecker
class is well-defined and effectively manages the spawning of a child process for type checking. The use ofstdio: 'inherit'
is a good choice for ensuring visibility of the child process's output.- 25-25: The export statement is correctly implemented, making the
ForkTsChecker
class available for use in other modules.packages/bundler-okam/fork-ts-checker/ts-checker.js (3)
- 1-3: The import statements are correctly used and necessary for the functionality of the
TypeChecker
class. The use offs.promises
for asynchronous file operations is a modern and efficient approach.- 5-94: The
TypeChecker
class is well-defined and effectively performs TypeScript type checking. The comprehensive error handling and the use of standard TypeScript APIs for readingtsconfig.json
, creating a program, and reporting diagnostics are commendable.- 97-97: The export statement is correctly implemented, making the
TypeChecker
class available for use in other modules.
89a5c8c
to
03c56d8
Compare
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
packages/bundler-okam/package.json
is excluded by:!**/*.json
pnpm-lock.yaml
is excluded by:!**/*.yaml
Files selected for processing (5)
- docs/config.md (2 hunks)
- packages/bundler-okam/fork-ts-checker/child_process_fork.js (1 hunks)
- packages/bundler-okam/fork-ts-checker/index.js (1 hunks)
- packages/bundler-okam/fork-ts-checker/ts-checker.js (1 hunks)
- packages/bundler-okam/index.js (4 hunks)
Files skipped from review as they are similar to previous changes (5)
- docs/config.md
- packages/bundler-okam/fork-ts-checker/child_process_fork.js
- packages/bundler-okam/fork-ts-checker/index.js
- packages/bundler-okam/fork-ts-checker/ts-checker.js
- packages/bundler-okam/index.js
使用
parseConfigFileTextToJson
和parseJsonConfigFileContent
解析和读取tsconfig,传入tsc,读取其中的报错信息写在node层,触发时机在 build 完成之后,在子进程中执行,不影响构建速度
config.forkTsChecker
设为 true 开启功能Summary by CodeRabbit
ForkTsChecker
class to run type checking in a child process for TypeScript projects.TypeChecker
class.mako
package to include a dev dependency on TypeScript version5.4.3
.ExtraBuildParams
interface to enable running type checking in a child process.config.md
file to include information about the newforkTsChecker
configuration option.