# @adobe-apimesh/mesh-builder 中文文档

规范地址：https://npmcn.com/package/%40adobe-apimesh/mesh-builder/

版本：2\.6\.0
npm 元数据更新时间：2026-11-05T16:51:40.746Z
中文译文更新时间：2026-11-08T08:53:59.041Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40adobe-apimesh/mesh-builder
原文对照：https://npmcn.com/package/%40adobe-apimesh/mesh-builder/?lang=original

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

- 包体积（解压后）：318 kB，8 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：12 个
- peer 依赖：graphql ^16\.6\.0，@graphql-mesh/cli 0\.82\.30，@adobe/plugin-hooks 0\.4\.0，@graphql-mesh/store 0\.9\.20，@graphql-mesh/types 0\.91\.12，@graphql-mesh/graphql 0\.34\.13，@graphql-mesh/openapi 0\.33\.39，@graphql-mesh/runtime 0\.46\.21，@adobe/plugin-on-fetch 0\.1\.1，@graphql-mesh/json-schema 0\.35\.38，@graphql-mesh/transform-prune 0\.1\.20，@graphql-mesh/transform-prefix 0\.12\.22，@graphql-mesh/transform-rename 0\.14\.22，@graphql-mesh/transform-federation 0\.11\.14，@graphql-mesh/transform-encapsulate 0\.4\.21，@graphql-mesh/transform-hoist-field 0\.2\.21，@graphql-mesh/transform-type-merging 0\.5\.20，@graphql-mesh/transform-filter-schema 0\.15\.23，@graphql-mesh/transform-replace-field 0\.4\.20，@graphql-mesh/transform-naming-convention 0\.13\.22，@graphql-mesh/plugin-http-details-extensions 0\.1\.21，@graphql-mesh/transform-resolvers-composition 0\.13\.20
- 首次发布：2023-10-04T20:19:21.124Z
- 最新版本发布：2026-11-05T16:51:40.545Z
- 近 30 天下载量：1843（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：62（近 12 个月 16 个）

## 中文简介

装有网状文物的软件包

## 安装

```sh
npm install @adobe-apimesh/mesh-builder
```

也可以使用：`pnpm add @adobe-apimesh/mesh-builder`、`yarn add @adobe-apimesh/mesh-builder`、`bun add @adobe-apimesh/mesh-builder`

## README

# 网格构建器

装有网状文物的软件包

## 出口

### 验证梅什

校验Mesh( meshconfig: MeshConfig) QQ 答应

校验网格函数取 `meshConfig` 如果网格限制在CLI规则的范围内,则作为论证和验证。 成功验证后, 函数将解析返回的承诺 。 如果验证失败,无效的所有理由都会被扔入被拒绝的承诺中.

### 构建Mesh

建立Mesh( meshId: 字符串, meshConfig: MeshConfig) QQ 承诺 <boolean QQ 未定义 >

构建网格函数取 `meshId` 财务报告和审定财务报表 `meshConfig` 作为论据,并建造网状文物 `mesh-artifact` 当前工作目录中的文件夹 `meshId` 子目录.

在成功建造之后, `buildMesh` 返回解析为 `true` 财务报告和审定财务报表 `false` 为失败. `buildMesh` 将投出 `MeshBuildError` 如果有build错误.

### 编译Mesh

编译Mesh( meshId: 字符串) QQ 承诺 < string >

编译网格函数取自 `meshId` 查找已建成的 typeScript mesh 文物 `mesh-artifact` 文件夹,然后使用该文件夹汇编到 JavaScript `typescript` 软件包。 它返回已编译并写入文件系统的 JavaScript 文件路径的保证 .

### 常规梅什配置

普通梅什孔菲克(mesh孔菲克:Mesh孔菲克, BasePath?: 字符串) QQ 答应

将 Mesh 配置函数正常化 `meshConfig` 常规 `additionalTypeDefs`。 。 。 .

若为 `additionalTypeDefs` 包含 `.graphql`编号 :`.gql` 路径,它将解决其内容(包括通过 `meshConfig.files`,磁盘,或相对于 `basePath` 在提供时),保留 `additionalTypeDefs` 作为字符串的数组,并删除任何 GraphQL 文件条目 `meshConfig.files`。 。 。 .

```ts
import meshBuilder from "@multitenant-graphql/mesh-builder";

const normalized = await meshBuilder.normalizeMeshConfig(meshConfig);
// or
const normalized = await meshBuilder.normalizeMeshConfig(meshConfig, "/abs/path/to/.meshrc.json");
```

## 类型

```ts
validateMesh(meshConfig: MeshConfig) => Promise<boolean>

buildMesh(meshId: string, meshConfig: MeshConfig) => Promise<boolean | undefined>

compileMesh(meshId: string) => Promise<string[]>

normalizeMeshConfig(meshConfig: MeshConfig, basePath?: string) => Promise<MeshConfig>

type MeshBuildError {
    name: string;
    stack?: string;
    cause?: unknown;
    requestId?: string;
}
```

## 常见问题

### @adobe-apimesh/mesh-builder 是什么？

装有网状文物的软件包

### 如何安装 @adobe-apimesh/mesh-builder？

在项目目录运行 npm install @adobe-apimesh/mesh-builder，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：graphql（^16\.6\.0）、@graphql-mesh/cli（0\.82\.30）、@adobe/plugin-hooks（0\.4\.0）、@graphql-mesh/store（0\.9\.20）、@graphql-mesh/types（0\.91\.12）、@graphql-mesh/graphql（0\.34\.13）、@graphql-mesh/openapi（0\.33\.39）、@graphql-mesh/runtime（0\.46\.21）、@adobe/plugin-on-fetch（0\.1\.1）、@graphql-mesh/json-schema（0\.35\.38）、@graphql-mesh/transform-prune（0\.1\.20）、@graphql-mesh/transform-prefix（0\.12\.22）、@graphql-mesh/transform-rename（0\.14\.22）、@graphql-mesh/transform-federation（0\.11\.14）、@graphql-mesh/transform-encapsulate（0\.4\.21）、@graphql-mesh/transform-hoist-field（0\.2\.21）、@graphql-mesh/transform-type-merging（0\.5\.20）、@graphql-mesh/transform-filter-schema（0\.15\.23）、@graphql-mesh/transform-replace-field（0\.4\.20）、@graphql-mesh/transform-naming-convention（0\.13\.22）、@graphql-mesh/plugin-http-details-extensions（0\.1\.21）、@graphql-mesh/transform-resolvers-composition（0\.13\.20）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @adobe-apimesh/mesh-builder 支持 TypeScript 吗？

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

### @adobe-apimesh/mesh-builder 支持 ESM 还是 CommonJS？

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

### @adobe-apimesh/mesh-builder 可以商用吗？

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

### @adobe-apimesh/mesh-builder 的下载量有多少？

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

### @adobe-apimesh/mesh-builder 还在维护吗？

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

