Skip to content
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: add rscClient.logServerComponent config #1200

Merged
merged 1 commit into from
May 23, 2024
Merged

feat: add rscClient.logServerComponent config #1200

merged 1 commit into from
May 23, 2024

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented May 23, 2024

Close #1195

Summary by CodeRabbit

  • 新功能
    • rscClientrscServer 添加了更详细的配置选项。
    • rscClient 现在支持 logServerComponent 配置,可以设置为 errorignore
    • rscServer 现在支持 emitCSSclientComponentTpl 配置。

@sorrycc sorrycc merged commit 26603c3 into master May 23, 2024
2 checks passed
Copy link
Contributor

coderabbitai bot commented May 23, 2024

Walkthrough

这次更新主要涉及 BuildParams 结构体的扩展,包括对 rscServerrscClient 的特定配置,新增了 LogServerComponent 枚举,并在文档和配置文件中反映了这些变化,允许在 RSC 客户端打包时遇到 use server 时配置为 errorignore

Changes

文件路径 变更摘要
crates/binding/src/lib.rs 更新 BuildParams 结构体,增加 rscServerrscClient 的具体配置。
crates/mako/src/config/config.rs 新增 LogServerComponent 枚举,更新 RscClientConfig 结构体,增加 log_server_component 字段。
crates/mako/src/features/rsc.rs 修改 Config 结构体的使用,调整与 LogServerComponent 相关的逻辑。
docs/config.md 添加 rscClientrscServer 的配置说明,指定类型和默认值。
e2e/fixtures/rsc.client.dynamic_client/mako.config.json rscClient 对象下新增 "logServerComponent": "error"
e2e/fixtures/rsc.client.error/mako.config.json rscClient 对象下新增 "logServerComponent": "error"
packages/mako/binding.d.ts 更新 BuildParams 接口,增加 rscServerrscClient 的具体配置。

Assessment against linked issues

Objective Addressed Explanation
支持配置为 ignore 在 RSC 客户端打包时遇到 use server (Issue #1195)

在代码的世界里,有一只兔子,
它跳跃在字节之间,轻盈如丝。
配置文件更新,逻辑更清晰,
服务器组件的日志,如今可忽略不计。
代码如诗,变化如梦,
兔子在键盘上,舞出新的篇章。


Note

Free review on us!

CodeRabbit is offering free reviews until Mon May 27 2024 to showcase some of the refinements we've made.

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@delete-merged-branch delete-merged-branch bot deleted the sorrycc-dwti branch May 23, 2024 06:14
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7977f30 and ae28de0.
Files selected for processing (7)
  • crates/binding/src/lib.rs (1 hunks)
  • crates/mako/src/config/config.rs (1 hunks)
  • crates/mako/src/features/rsc.rs (2 hunks)
  • docs/config.md (1 hunks)
  • e2e/fixtures/rsc.client.dynamic_client/mako.config.json (1 hunks)
  • e2e/fixtures/rsc.client.error/mako.config.json (1 hunks)
  • packages/mako/binding.d.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • e2e/fixtures/rsc.client.dynamic_client/mako.config.json
  • e2e/fixtures/rsc.client.error/mako.config.json
Additional Context Used
LanguageTool (9)
docs/config.md (9)

Near line 17: The word ‘mako’ is not correct in this context. Consider using the plural form, adding a determiner like ‘the’ or ‘a’, or adding a preposition like ‘at’ or ‘in’.
Context: ...s" } } ``` Notice: When you're using mako with Umi, prefer to config the bundler ...


Near line 91: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... used in server-side rendering scenarios, because when server-side rendering, you don't n...


Near line 138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...ing a pure server-side rendering project, because assets files are not needed at this tim...


Near line 268: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... configuration can only be used with umd, because injecting CSS is not a recommended way ...


Near line 326: Loose punctuation mark.
Context: ... Output related configuration. - path, output directory - mode, output mode,...


Near line 341: Loose punctuation mark.
Context: ...on items are supported. - skipModules, optimize the size by skipping modules w...


Near line 351: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...o set dynamicImportToRequire to true, because the runtime does not yet support node-s...


Near line 394: Loose punctuation mark.
Context: ...r to enable px2rem conversion. - root, root font size, default is 100 - `pro...


Near line 442: Loose punctuation mark.
Context: ... } resolveconfiguration. -alias, alias configuration - extensions`, fil...

Additional comments not posted (7)
packages/mako/binding.d.ts (2)

143-148: 新增的 rscServer 配置项允许用户更详细地设置 RSC 服务器的行为,这与 PR 目标一致,增强了配置能力。


149-153: 新增的 rscClient 配置项实现了 PR 目标,允许用户自定义 RSC 客户端的错误处理行为。

crates/mako/src/features/rsc.rs (1)

40-42: 根据 LogServerComponent 的设置添加的错误处理逻辑正确无误。当设置为 Error 时,它会返回一个错误,这与 PR 目标一致,允许可配置的错误处理。

crates/binding/src/lib.rs (1)

131-137: 新增的 rscServerrscClient 配置项允许用户更详细地设置 RSC 服务器和客户端的行为,这与 PR 目标一致,增强了配置能力。

docs/config.md (1)

458-471: 文档中正确描述了新的 rscServerrscClient 配置项及其默认值。这对于用户理解至关重要,并且与 PR 目标一致。

crates/mako/src/config/config.rs (2)

379-385: 新增枚举 LogServerComponent 定义良好,符合 PR 目标。


388-391: 更新的结构 RscClientConfig 包含了新的字段 log_server_component,类型和序列化都正确。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rsc client 打包时遇到 use server,现在是 error,支持配置为 ignore
1 participant