Skip to content
Discussion options

You must be logged in to vote

结论先说:Typert Remote 不是"只能构建期 codegen"。packages/api/remotes/src/client/index.ts 里那份 namespace 数组是一等包的装配清单(把 14 个官方 namespace 挂到 ctx.remote),不是"只有它们才能被调用"的白名单。仓外插件走同一套 Typert 通道完全可行,只是产物要自己生成、exports 要自己声明。

一、证据(0.1.5-alpha.1 线源码)

  1. contribution 是纯数据TypertContribution = { package, face, schemas, model, invocations }packages/typert/registry/src/types.ts),不依赖任何构建期全局状态。
  2. 宿主侧运行时注册是公开 APIctx.typert.register(contribution): TypertDisposerpackages/typert/registry/src/index.ts)。
  3. 自动注册覆盖仓外包packages/typert/loader/src/index.tstypert-loader 跟随 Loader entry 挂载,解析该 entry 的 package.json;只要它导出 ./typert,就 import 其 host 产物并 ctx.typert.register(manifest),entry 卸载时撤销。解析锚点是 ctx.baseUrlcordis.yml 所在目录),所以通过 …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@zhang-guo-wen
Comment options

Answer selected by zhang-guo-wen
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants