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

Revert "feat: support unplugin context (#1728)" #1737

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

xusd320
Copy link
Contributor

@xusd320 xusd320 commented Jan 2, 2025

This reverts commit 3dd6d9d.
Ref: https://github.com/ant-design/ant-design/actions/runs/12576684269/job/35054329597?pr=52120

Received an undefined filePath here:
https://github.com/umijs/dumi/blob/21e1585460fec2ef183695247aac30177992f09e/src/features/compile/makoHooks.ts#L50

Summary by CodeRabbit

以下是发行说明:

  • 新功能

    • 简化了插件钩子的上下文处理
    • 优化了插件系统的配置和扩展性
  • 重大变更

    • 移除了 PluginContext 结构
    • 更新了多个插件钩子的方法签名
    • 调整了文档中的插件配置说明
  • 文档更新

    • 新增了详细的 JSHooks 配置文档
    • 更新了插件配置的说明和示例
  • 依赖变更

    • 移除了 @iconify-json/mdiunplugin-iconsunplugin-replace 依赖
  • 测试和示例

    • 删除了与上下文相关的测试夹具和配置文件

Copy link

Walkthrough

This pull request reverts the changes made in a previous commit (3dd6d9d) related to supporting unplugin context. The revert addresses an issue where an undefined filePath was encountered, as referenced in the provided link.

Changes

Files Summary
crates/binding/src/js_hook.rs, crates/binding/src/js_plugin.rs Removed PluginContext usage and related functionality from hooks, simplifying the function signatures by eliminating context parameters.
crates/mako/src/plugin.rs, crates/mako/src/plugins/bundless_compiler.rs Removed context parameter from before_write_fs function calls.
docs/config.md, docs/config.zh-CN.md Updated documentation to reflect changes in hook functions and plugin compatibility.
e2e/fixtures/plugins.context/, e2e/fixtures/plugins.unplugin/ Removed test fixtures related to unplugin context and plugins.
package.json, pnpm-lock.yaml Removed dependencies related to unplugin and updated package versions.
packages/mako/binding.d.ts, packages/mako/binding.js Removed PluginContext class and related exports.
packages/mako/src/index.ts Removed code related to adding context to each plugin's hook and adapter functions for unplugin.
scripts/mako.js Simplified build script by removing promise handling for watch mode.

pub transform:
Option<ThreadsafeFunction<(PluginContext, String, String), Option<TransformResult>>>,
pub transform_include: Option<ThreadsafeFunction<(PluginContext, String), Option<bool>>>,
pub build_start: Option<ThreadsafeFunction<(), ()>>,

Choose a reason for hiding this comment

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

The removal of PluginContext from TsFnHooks may lead to issues if any functionality relied on the context being passed. Ensure that this change does not break any existing functionality that depends on PluginContext.

Copy link
Contributor

coderabbitai bot commented Jan 2, 2025

Caution

Review failed

The pull request is closed.

概述

遍历

这个拉取请求主要简化了 Mako 构建系统中的插件上下文处理。通过移除 PluginContext,代码库减少了复杂性,并简化了钩子函数的签名。更改涉及多个文件,包括绑定、配置文档和测试夹具,重点是标准化插件接口并移除不必要的上下文传递。

变更

文件路径 变更摘要
crates/binding/src/js_hook.rs 移除 PluginContext,简化 ThreadsafeFunction 签名
crates/mako/src/plugin.rs 修改 before_write_fs 方法签名
docs/config.md 新增 JSHooks 配置文档
packages/mako/binding.d.ts 更新类型定义,移除 PluginContext

序列图

sequenceDiagram
    participant Plugin
    participant BuildSystem
    participant Hook

    Plugin->>BuildSystem: 注册钩子
    BuildSystem->>Hook: 调用钩子函数
    Hook-->>BuildSystem: 返回结果
Loading

可能相关的 PR

诗歌

🐰 代码精灵轻舞动,
上下文烟消云散,
插件hooks更清爽,
构建系统焕然一新,
兔子微笑,代码飞扬!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37fe7c0 and 51e3c6b.

⛔ Files ignored due to path filters (2)
  • e2e/fixtures/plugins/node_modules/plugin/index.js is excluded by !**/node_modules/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (21)
  • crates/binding/src/js_hook.rs (1 hunks)
  • crates/binding/src/js_plugin.rs (6 hunks)
  • crates/mako/src/plugin.rs (2 hunks)
  • crates/mako/src/plugins/bundless_compiler.rs (1 hunks)
  • docs/config.md (2 hunks)
  • docs/config.zh-CN.md (2 hunks)
  • e2e/fixtures/plugins.context/expect.js (0 hunks)
  • e2e/fixtures/plugins.context/mako.config.json (0 hunks)
  • e2e/fixtures/plugins.context/plugin.js (0 hunks)
  • e2e/fixtures/plugins.context/plugins.config.js (0 hunks)
  • e2e/fixtures/plugins.context/src/foo.hoo (0 hunks)
  • e2e/fixtures/plugins.context/src/index.tsx (0 hunks)
  • e2e/fixtures/plugins.unplugin/expect.js (0 hunks)
  • e2e/fixtures/plugins.unplugin/mako.config.json (0 hunks)
  • e2e/fixtures/plugins.unplugin/plugins.config.js (0 hunks)
  • e2e/fixtures/plugins.unplugin/src/index.tsx (0 hunks)
  • package.json (0 hunks)
  • packages/mako/binding.d.ts (0 hunks)
  • packages/mako/binding.js (1 hunks)
  • packages/mako/src/index.ts (0 hunks)
  • scripts/mako.js (1 hunks)

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?

❤️ Share
🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@xusd320 xusd320 merged commit 7e3f726 into master Jan 2, 2025
15 of 16 checks passed
@xusd320 xusd320 deleted the revert/unplugin-context branch January 2, 2025 05:40
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 54.82%. Comparing base (37fe7c0) to head (51e3c6b).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
crates/mako/src/plugin.rs 0.00% 2 Missing ⚠️
crates/mako/src/plugins/bundless_compiler.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1737   +/-   ##
=======================================
  Coverage   54.82%   54.82%           
=======================================
  Files         180      180           
  Lines       18053    18053           
=======================================
  Hits         9897     9897           
  Misses       8156     8156           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant