refactor: 插件系统重构为进程启动 + HTTP 代理链模式 #16
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概述
破坏性更新:将插件系统从 import 模式重构为进程启动 + HTTP 代理链模式。
动机
之前为了支持流传输,使用了强制 import 的方式加载插件,但这破坏了最初通过
__CALLBACK_URL__启动子进程的设计。本次重构回归进程模式,同时使用标准 HTTP 代理协议实现流式传输。架构
主要变更
新增
@jixo/proxy-plugin-server包:提供createProxyServer()启动插件 HTTP 代理重写
hooks-executor.ts:HooksPool进程池(配置 hash 去重 + 引用计数)__CALLBACK_URL__协议回报端口HTTP_PROXY环境变量构建 hop 链proxy-server.ts:通过 HTTP 代理转发到插件链更新
createProxyServer()测试
hooks-executor: 初始化、生命周期、precheck、disabled hooksproxy-plugin-server: callback 回调、ProxyPlugin 接口兼容性破坏性变更
startPluginServer和definePlugin导出createProxyServer()