# @comate/plugin-host

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

Latest version **0.9.2** (published 2024-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @comate/plugin-host
pnpm add @comate/plugin-host
yarn add @comate/plugin-host
bun add @comate/plugin-host
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.2 |
| Published | 2024-03-11 |
| First published | 2024-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.10.0 |
| Dependencies | 3 |
| Unpacked size | 85.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | otakustay |

## Links

- npm: https://www.npmjs.com/package/@comate/plugin-host
- npm.io page: https://npm.io/package/@comate/plugin-host

## Dependencies (3)

- [unixify](https://npm.io/package/unixify.md) ^1.0.0
- [markdown-table](https://npm.io/package/markdown-table.md) ^3.0.3
- [@comate/plugin-shared-internals](https://npm.io/package/@comate/plugin-shared-internals.md) ^0.9.2

## Recent versions

- 0.9.2 (latest) — 2024-03-11
- 0.9.1 — 2024-03-11
- 0.9.0 — 2024-03-11

## README

# Comate插件宿主运行时

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

## 使用时目录结构

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

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

```text
/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`：导出面向插件开发者的接口。

---
_Source: https://npm.io/package/@comate/plugin-host · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
