Skip to content

[Bug] pi-plugin check / pack 不检查 manifest.renderer 入口文件,缺文件也能打包,安装时才报 PLUGIN_INVALID #1464

Description

@GalaxyXieyu

问题描述 / What happened?

pi-plugin check 会检查 main、ui.panel、contributes.views[].entry 指向的文件是否存在(packages/plugin-devkit/src/check.ts:191-230,main.missing / panel.missing / view.missing),但不检查 manifest.renderer。入口文件缺了,check 照样通过;pack 先跑 check(pack.ts:124),所以也照样打出 .piplug。

host-core 加载插件时会检查这个文件(crates/host-core/src/plugins/manifest.rs:76 → renderer.rs:59-71),缺了就报 PLUGIN_INVALID: renderer entry missing: <entry>,renderer.rs:175 有对应测试。所以这样的包能通过 check 和 pack,但装不上,和 #943 是同一类问题。

SDK 的 manifestRendererError(packages/plugin-sdk/src/index.ts:2113)只检查格式(相对路径、.js/.mjs),不看文件在不在。

复现步骤 / Steps to reproduce

  1. 在 main 779e16d9c 上编译 packages/plugin-sdk 和 packages/plugin-devkit
  2. cp -r examples/plugins/ui-slots-lab /tmp/lab && rm /tmp/lab/renderer/index.mjs
  3. node packages/plugin-devkit/dist/cli.js check /tmp/lab
  4. node packages/plugin-devkit/dist/cli.js pack /tmp/lab --out /tmp/dist

预期行为 / Expected behavior

check 报错(和 view.missing 一样),pack 中止。

实际行为 / Actual behavior

OK lab.ui-slots@0.1.0 — 8 files, 27.5 KB
Packed lab.ui-slots-0.1.0.piplug (8 files, 28.3 KB)

对照:删掉 main.js 时,check 会报 main.missing: manifest.main "main.js" does not exist,退出码 1。

应用版本 / App version

main 779e16d9c(源码构建的 plugin-devkit 0.17.0,不是安装包)

操作系统 / Operating system

Linux

其他 / Additional context

修复打算(只改 plugin-devkit,fix(plugin-devkit)):在 check.ts 里照 views 的写法,对 manifest.renderer 加 renderer.escapes(路径越界)和 renderer.missing(文件不存在)两个 error,再加测试。

这个 issue 只讲 check / pack 的漏检。我没在 app 里实际安装这个坏包,安装失败的结论来自上面 host-core 的代码和测试。

Activity

  1. added a commit that references this issue on Oct 8, 2026
    1b6f8a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions