# @flowscripter/template-bun-wasm-rust-library 中文文档

规范地址：https://npmcn.com/package/%40flowscripter/template-bun-wasm-rust-library/

版本：1\.3\.41
npm 元数据更新时间：2026-11-12T08:21:23.008Z
中文译文更新时间：2026-11-15T00:53:02.116Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40flowscripter/template-bun-wasm-rust-library
原文对照：https://npmcn.com/package/%40flowscripter/template-bun-wasm-rust-library/?lang=original
项目主页：https://github.com/flowscripter/template-bun-wasm-rust-library#readme
源码仓库：https://github.com/flowscripter/template-bun-wasm-rust-library

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

- 包体积（解压后）：22.4 kB，19 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：typescript ^7\.0\.2
- 首次发布：2025-04-19T21:35:15.616Z
- 最新版本发布：2026-11-12T08:21:22.143Z
- 近 30 天下载量：2697（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：54（近 12 个月 50 个）

## 中文简介

一个 Rust 库的项目模板已编译到作为 Bun 模块曝光的 WASM

## 安装

```sh
npm install @flowscripter/template-bun-wasm-rust-library
```

也可以使用：`pnpm add @flowscripter/template-bun-wasm-rust-library`、`yarn add @flowscripter/template-bun-wasm-rust-library`、`bun add @flowscripter/template-bun-wasm-rust-library`

## README

# 模板 - bun -wasm - rust - 图书馆

[![version](https://img.shields.io/github/v/release/flowscripter/template-bun-wasm-rust-library?sort=semver)](https://github.com/flowscripter/template-bun-wasm-rust-library/releases) [![build](https://img.shields.io/github/actions/workflow/status/flowscripter/template-bun-wasm-rust-library/release-bun-wasm-rust-library.yml)](https://github.com/flowscripter/template-bun-wasm-rust-library/actions/workflows/release-bun-wasm-rust-library.yml) [![coverage](https://codecov.io/gh/flowscripter/template-bun-wasm-rust-library/graph/badge.svg?token=uWK0oWsBjr)](https://codecov.io/gh/flowscripter/template-bun-wasm-rust-library) [![docs](https://img.shields.io/badge/docs-API-blue)](https://flowscripter.github.io/template-bun-wasm-rust-library/index.html) [![license: MIT](https://img.shields.io/github/license/flowscripter/template-bun-wasm-rust-library)](https://github.com/flowscripter/template-bun-wasm-rust-library/blob/main/LICENSE)

> 一个 Rust 库的项目模板被编译为作为 Bun 模块曝光的 WASM .

## 模板使用

以此为模板创建新 Bun 项目 :

`bun create @flowscripter/template-bun-wasm-rust-library`

## Bun 模块使用

添加模块 :

`bun add @flowscripter/template-bun-wasm-rust-library`

使用模块 :

```typescript
import { world } from "@flowscripter/template-bun-wasm-rust-library";

world();
```

## 发展

安装 [包装](https://rustwasm.github.io/wasm-pack/)数字 :

`cargo install wasm-pack`

安装依赖性 :

`bun install`

构建 WASM/JS/类型(生产) `dist/` 对于Node.js和TypeScript消费者; Bun 直接使用原始来源:

`bun run build`

建立联合来文/类型(制作人) `dist/` 对于Node.js和TypeScript消费者; Bun 直接使用原始来源:

`bun run build`

测试 :

`cargo test && bun test`

格式 :

`bunx oxfmt`

林特:

`cargo fmt && bunx oxlint index.ts src/ tests/`

生成 HTML API 文档 :

`bunx typedoc index.ts`

## 文档

### 概览

用于在下标测试渲染的美人鱼图样本 :

```mermaid
classDiagram
    Foo <|-- Bar
```

### API 密码

链接自动生成的 API 文件 :

[API 文档](https://flowscripter.github.io/template-bun-wasm-rust-library/index.html)

## 许可证

麻省理工学院

## 常见问题

### @flowscripter/template-bun-wasm-rust-library 是什么？

一个 Rust 库的项目模板已编译到作为 Bun 模块曝光的 WASM

### 如何安装 @flowscripter/template-bun-wasm-rust-library？

在项目目录运行 npm install @flowscripter/template-bun-wasm-rust-library，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：typescript（^7\.0\.2）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @flowscripter/template-bun-wasm-rust-library 支持 TypeScript 吗？

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

### @flowscripter/template-bun-wasm-rust-library 支持 ESM 还是 CommonJS？

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

### @flowscripter/template-bun-wasm-rust-library 可以商用吗？

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

### @flowscripter/template-bun-wasm-rust-library 的下载量有多少？

根据 npm 官方下载统计，@flowscripter/template-bun-wasm-rust-library 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,697 次，日均约 90 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @flowscripter/template-bun-wasm-rust-library 还在维护吗？

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

