# @eveshipfit/dogma-engine 中文文档

规范地址：https://npmcn.com/package/%40eveshipfit/dogma-engine/

版本：15\.0\.0
npm 元数据更新时间：2026-11-12T18:52:49.983Z
中文译文更新时间：2026-11-14T02:02:39.971Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40eveshipfit/dogma-engine
原文对照：https://npmcn.com/package/%40eveshipfit/dogma-engine/?lang=original
项目主页：https://github.com/EVEShipFit/dogma-engine#readme
源码仓库：https://github.com/EVEShipFit/dogma-engine

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：631 kB，6 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2026-09-13T11:39:38.759Z
- 最新版本发布：2026-11-12T18:52:49.653Z
- 近 30 天下载量：3879（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：30（近 12 个月 30 个）

## 中文简介

用于计算 EVE Online 船舶适配量统计数据的图书馆

## 安装

```sh
npm install @eveshipfit/dogma-engine
```

也可以使用：`pnpm add @eveshipfit/dogma-engine`、`yarn add @eveshipfit/dogma-engine`、`bun add @eveshipfit/dogma-engine`

## README

# EVEShip.fit 为 Javascript 设计的多格玛引擎

[![npm](https://img.shields.io/npm/v/%40eveshipfit%2Fdogma-engine.svg)](https://www.npmjs.com/package/@eveshipfit/dogma-engine) [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/S5V5BkvNf7)

这个库精确地计算出一个EVE Online ship fit的统计数据.

投入是EVE Online公司提供的几个数据文件,以及一个适合的船. 输出是舰只的所有道克玛属性,其物品和人物.

引擎以 Rust 写成,并以 Web Assembly 运行,所以一切都在浏览器中计算;不需要服务器.

## 安装

[`@eveshipfit/sde`](https://www.npmjs.com/package/@eveshipfit/sde) 船舶 `sde.dat` 联合国 `dist` 文件夹; 服务或捆绑文件.

```bash
npm install @eveshipfit/dogma-engine @eveshipfit/sde
```

软件包是一个ES模块,包含TypeScript类型,它随处运行:在捆绑器下 (Vite,webpack,.),来自CDN,或平地 `<script type="module">`。 。 。 .

## 使用量

默认导出会加载 Web Assembly, 在调用其他函数前必须等待一次 .

```js
import wasmInit, {
  load_sde,
  load_eft,
  save_eft,
  load_esi_fitting,
  save_esi_fitting,
  load_dna,
  post_load,
  load_killmail,
  load_link,
  calculate,
  beacon,
} from "@eveshipfit/dogma-engine";

await wasmInit();

const sde = await fetch("/sde.dat").then((response) => response.arrayBuffer());
const buildNumber = load_sde(new Uint8Array(sde));
const fit = {
  ship: { type_id: 587 },
  items: [{ type_id: 2873, slot: { type: "high", index: 0 }, state: "active", charge: { type_id: 185 } }],
  character: { skills: { 3300: 5 } },
};

const calculation = calculate(fit);
/* Or if you want to know the source of the effects: */
const withSources = calculate(fit, { sources: true });
/* Or if you have a beacon in space (like wormhole effects): */
const withBeacon = calculate({ ...fit, incoming: beacon(beaconTypeId) });
/* Or if you have an EFT, the text format EVE copies a fit to the clipboard in: */
const imported = calculate(load_eft("[Rifter, My Rifter]\n200mm AutoCannon I"));
/* And to write a fit back out as EFT: */
const eft = save_eft(fit);
/* Or if you have a fitting a character saved in game, as ESI returns it (and the other way around): */
const fromEsi = load_esi_fitting(fitting);
const toEsi = save_esi_fitting(fit);
/* Or if you have DNA, the fits EVE links to in chat, with or without its `fitting:` prefix: */
const fromDna = load_dna(dna);
/* EFT, ESI and DNA have no states; with the skills set, this sets the ones EVE gives an imported fit: */
const settled = post_load({ ...fromEsi, character: { skills } });
/* Or if you have a killmail, as ESI returns it, for the fit of the ship that died: */
const fromKillmail = load_killmail(killmail);
/* Or if you have an EVEShip.fit link, `<version>:<payload>`, with the payload gunzipped and unbase64'd: */
const fromLink = load_link(version, payload);

/* What EVE would not let you fly, in `violations` of the calculation: */
const validated = calculate(fit, { validate: true });
```

`load_sde` 只能调用一次.

EFT 导入符合英文名称 `sde.dat`。 。 。 . 同时匹配 EVE 支持的其他语言, 手 `names.dat` (另见 `@eveshipfit/sde`改为: `load_names` 同样的方式,之后 `load_sde`。 。 。 .

匹配和计算是平面对象,由包含的TypeScript类型描述. 每一个字段意味着什么 [投入和产出](https://github.com/EVEShipFit/dogma-engine#input-and-output)。 。 。 .

## 再来

引擎是如何工作的,属性 EVEShip.fit 添加及其验证的适配规则都包含在 [主要仓库](https://github.com/EVEShipFit/dogma-engine)。 。 。 .

## 常见问题

### @eveshipfit/dogma-engine 是什么？

用于计算 EVE Online 船舶适配量统计数据的图书馆

### 如何安装 @eveshipfit/dogma-engine？

在项目目录运行 npm install @eveshipfit/dogma-engine，或使用 pnpm add / yarn add / bun add。

### @eveshipfit/dogma-engine 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @eveshipfit/dogma-engine 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @eveshipfit/dogma-engine 可以商用吗？

@eveshipfit/dogma-engine 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @eveshipfit/dogma-engine 的下载量有多少？

根据 npm 官方下载统计，@eveshipfit/dogma-engine 在 2026/10/14 – 2026/11/12 这 30 天内被下载 3,879 次，日均约 129 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @eveshipfit/dogma-engine 还在维护吗？

最新版本 15\.0\.0 发布于 2026/11/13（1 天前）；至今共发布 30 个版本，其中过去 12 个月发布了 30 个；首次发布于 2026/09/13。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

