@adobe-apimesh/mesh-builder

中文文档
2.6.0发布于 2026/11/06Apache-2.0CommonJS近 30 天下载 1843

Package with mesh artifacts building and compiling logic

原始使用文档
文档目录6 节
  1. Exports
  2. validateMesh
  3. buildMesh
  4. compileMesh
  5. normalizeMeshConfig
  6. Types

Mesh Builder

Package with mesh artifacts building and compiling logic

Exports

validateMesh

validateMesh(meshConfig: MeshConfig) => Promise

Validate Mesh function takes the meshConfig as argument and validates if the mesh confines with the CLI rules. Upon a successful validation the function resolves the returned promise. If validation fails, all reasons for invalidation will be thrown in the rejected promise.

buildMesh

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

Build Mesh function takes the meshId and meshConfig as arguments and builds the mesh artifacts under the mesh-artifact folder in the current working directory under the meshId sub directory.

Upon a successful build, buildMesh returns a Promise that resolves to true and false for a failure. buildMesh will throw MeshBuildError if there is a bulid error.

compileMesh

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

Compile Mesh function takes the meshId to find the built TypeScript mesh artifacts under the mesh-artifact folder and compiles them to JavaScript using the typescript package. It returns a Promise of JavaScript file paths that have been compiled and written to file system.

normalizeMeshConfig

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

Normalize Mesh Config function takes the meshConfig and normalizes additionalTypeDefs.

If additionalTypeDefs contains .graphql/.gql paths, it will resolve their contents (including via meshConfig.files, disk, or relative to basePath when provided), keeps additionalTypeDefs as an array of strings, and removes any GraphQL file entries from meshConfig.files.

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");

Types

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 共发布 62 个版本,首次发布于 2023/10/05;过去 12 个月发布了 16 个版本。

版本发布日期距今
2.6.0latest2026/11/062 天前
2.6.0-alpha.02026/11/043 天前
2.5.52026/11/035 天前
2.5.42026/09/171 个月前
2.5.32026/09/111 个月前
2.5.3-alpha.02026/09/091 个月前

其他发布通道:beta → 1.3.4-beta.0。

关于 @adobe-apimesh/mesh-builder 的常见问题

@adobe-apimesh/mesh-builder 是什么?

Package with mesh artifacts building and compiling logic

如何安装 @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 和提交记录判断。