# @asyncapi/generator 中文文档

规范地址：https://npmcn.com/package/%40asyncapi/generator/

版本：3\.5\.0
npm 元数据更新时间：2026-10-20T07:30:59.123Z
中文译文更新时间：2026-11-07T01:36:41.777Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40asyncapi/generator
原文对照：https://npmcn.com/package/%40asyncapi/generator/?lang=original
项目主页：https://github.com/asyncapi/generator
源码仓库：https://github.com/asyncapi/generator

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

- 包体积（解压后）：901 kB，305 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=24\.11
- 运行依赖：26 个
- 首次发布：2020-03-18T16:10:39.710Z
- 最新版本发布：2026-10-20T07:30:58.742Z
- 近 30 天下载量：593612（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：237（近 12 个月 18 个）

## 中文简介

AsyncAPI 生成器. 它能生成文件,代码,任何东西!

## 安装

```sh
npm install @asyncapi/generator
```

也可以使用：`pnpm add @asyncapi/generator`、`yarn add @asyncapi/generator`、`bun add @asyncapi/generator`

## README

生成器(Generator)是一个工具,可以用来根据AsyncAPI规格文件作为输入生成任何您想要的. 详情 [读取文件](https://www.asyncapi.com/docs/tools/generator)。 。 。 .

大量模板可供使用,并得到AsyncAPI倡议的正式支持.

## 正式生成器模板列表

| 模板名称 | 说明 | 源代码 |
| --- | --- | --- |
| `@asyncapi/nodejs-template` | (单位:千美元)**存档**生成使用 Hermes 软件包的节点服务 | [点击这里](https://github.com/asyncapi/nodejs-template) |
| `@asyncapi/nodejs-ws-template` | (单位:千美元)**存档**生成只支持 WebSockets 协议的节点服务 | [点击这里](https://github.com/asyncapi/nodejs-ws-template) |
| `@asyncapi/java-template` | 生成 Java JMS 应用程序 | [点击这里](https://github.com/asyncapi/java-template) |
| `@asyncapi/java-spring-template` | (单位:千美元)**存档**) 生成Java Spring服务 | [点击这里](https://github.com/asyncapi/java-spring-template) |
| `@asyncapi/java-spring-cloud-stream-template` | 生成 Java 春云流服务 | [点击这里](https://github.com/asyncapi/java-spring-cloud-stream-template) |
| `@asyncapi/python-paho-template` | (单位:千美元)**存档**)生成使用 Paho 库的 Python 服务 | [点击这里](https://github.com/asyncapi/python-paho-template) |
| `@asyncapi/html-template` | 生成 HTML 文档站点 | [点击这里](https://github.com/asyncapi/html-template) |
| `@asyncapi/markdown-template` | 在 Markdown 文件生成文档 | [点击这里](https://github.com/asyncapi/markdown-template) |
| `@asyncapi/ts-nats-template` | (单位:千美元)**存档**生成 TypeScript NATS 客户端 | [点击这里](https://github.com/asyncapi/ts-nats-template/) |
| `@asyncapi/go-watermill-template` | (单位:千美元)**存档**生成 用水车去客户端 | [点击这里](https://github.com/asyncapi/go-watermill-template) |
| `@asyncapi/dotnet-nats-template` | (单位:千美元)**存档**)生成.NET. C# 客户端使用 NATS | [点击这里](https://github.com/asyncapi/dotnet-nats-template) |
| `@asyncapi/php-template` | (单位:千美元)**存档**) 使用 RabbitMQ 生成 PHP 客户端 | [点击这里](https://github.com/asyncapi/php-template) |
| `@asyncapi/dotnet-rabbitmq-template` | (单位:千美元)**存档**)生成.NET. 使用 RabitMQ 的 C# 客户端 | [点击这里](https://github.com/asyncapi/dotnet-rabbitmq-template) |

> \[注\] 标出模板 **(存档)** 住在这里 [`asyncapi-archived-repos`](https://github.com/asyncapi-archived-repos) 组织,不再保留。 考虑 **[烤入模板](https://www.asyncapi.com/docs/tools/generator/baked-in-templates)** 用于支持的替代品.

上面的模板和社区提供的模板 **[此列表](https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate)**

> \[大 **实验特性 :** AsyncAPI 软件 发电机也跟着来 **烤入模板** - 将正式模板直接运入发电机(`@asyncapi/generator`) (中文(简体) ). 它们涵盖代码、文件、配置和SDK,并保存在 [包装/平板](https://npmcn.com/package/%40asyncapi/generator/packages/templates) 目录,遵循严格,有意见的结构,做到一致性和便于维护. 不建议使用这一特性。 对于那些想尝试或学习更多的人来说 [入库模板文档](https://www.asyncapi.com/docs/tools/generator/baked-in-templates)。 。 。 .

## 常见问题

### @asyncapi/generator 是什么？

AsyncAPI 生成器\. 它能生成文件,代码,任何东西\!

### 如何安装 @asyncapi/generator？

在项目目录运行 npm install @asyncapi/generator，或使用 pnpm add / yarn add / bun add。

### @asyncapi/generator 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/asyncapi\_\_generator 是否存在。

### @asyncapi/generator 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @asyncapi/generator 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=24\.11。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @asyncapi/generator 可以商用吗？

@asyncapi/generator 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @asyncapi/generator 的下载量有多少？

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

### @asyncapi/generator 还在维护吗？

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

