Socket
Socket
Sign inDemoInstall

@comate/plugin-host

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comate/plugin-host

本包提供在插件进程中运行的逻辑。


Version published
Maintainers
1
Created
Source

Comate插件宿主运行时

本包提供在插件进程中运行的逻辑。

使用时目录结构

对于一个Comate插件,它在构建时,不能@comate/plugin-host与自己的源码打包,即在使用构建工具时,需要设置@comate/plugin-host为外部依赖(externals)。在发布插件时,命令行工具会检查插件包的代码中是否有本项目留下的"THIS IS COMATE"这一段字符串,如存在则禁止发布插件。

正常情况下,在Comate Engine中,运行的代码结构是这样的:

/dist
    index.js # Comate Engine的主入口
/plugins # 放各种Comate插件
    /foo # 每个插件一个独立目录,目录名必须和插件名称一样
        package.json # 插件的描述文件
/node_modules
    /@comate
        /plugin-host # 本项目的内容
package.json # Comate Engine的项目根目录

在这个结构下,根据NodeJS的模块检索逻辑,插件可以顺利地通过import {} from '@comate/plugin-host'拿到本包提供的SDK。

项目目录结构

本项目各目录的职责如下:

  • internals:一系列内部的能力实现,主要被各类Provider所引用。
  • providers:提供给插件开发者的几个Provider基类的实现。
  • utils:一些杂七杂八的工具函数。
  • registry.ts:负责在插件进程内注册和管理插件的能力。`
  • bridge.ts:与Engine进程通信。
  • main.ts:执行插件的入口,读取插件信息、注册能力、调度执行。
  • index.ts:导出面向插件开发者的接口。

FAQs

Package last updated on 11 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc