@cmssy/core

中文文档
19.30.0发布于 2026/11/06MITTypeScriptESM + CJS构建来源已验证近 30 天下载 8268

Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.

原始使用文档
文档目录4 节
  1. Configure once
  2. What is in the box
  3. Versioning: this package, not the API
  4. License

@cmssy/core

Framework-agnostic client for a cmssy headless site. Builds the delivery request, defines blocks and layouts, resolves media and locales, and verifies webhooks. Everything the framework packages are built on.

pnpm add @cmssy/core

Most sites do not install this directly. Use @cmssy/next with @cmssy/react, or @cmssy/astro / @cmssy/remix, which pull this in. Reach for @cmssy/core when you are wiring a framework we do not ship bindings for.

Configure once

import { defineCmssyConfig, createCmssyClient } from "@cmssy/core";

export const cmssy = defineCmssyConfig({
  org: process.env.CMSSY_ORG_SLUG,
  workspaceSlug: process.env.CMSSY_WORKSPACE_SLUG,
});

export const client = createCmssyClient(cmssy);

defineCmssyConfig validates the required values and throws if one is missing. Do not paper over a missing org or workspace slug with ?? "" - an empty segment builds a delivery URL like /public//graphql that fails far from the cause.

What is in the box

defineCmssyConfig, createCmssyClient, graphqlRequest for the transport; fields and defineCmssyLayout for block and layout definitions; mediaUrl, mediaUrls, mediaAlt, mediaType, mediaDuration and the MediaType vocabulary for media; localizeHref, resolveCmssyLocale, CMSSY_LOCALE_HEADER for i18n; applyCmssyCsp and verifyCmssyWebhook for the edges. Full signatures in docs/reference/sdk-api.md.

Versioning: this package, not the API

Pinning this package does not pin the API it talks to. They are two separate things and only one of them is in your lockfile.

  • The package version covers this client: its exports, their signatures, its behaviour. Normal semver - a major means your code may need changing.
  • The delivery API is a hosted service. Its GraphQL schema can change on any deploy, and it does so without a release here. A field removed from the schema is gone for @cmssy/[email protected] exactly as it is for the next version.

So "@cmssy/core": "16.9.0" in your package.json is not a compatibility guarantee against the server, and there is currently no API version you can pin instead - the delivery endpoint has no version segment.

What protects you today:

  • Every change to the schema runs against this SDK's own operations in CI before it can merge, so the queries shipped here keep working.
  • A breaking change cannot merge silently. It fails the gate, and shipping one anyway requires an explicit, recorded approval.
  • Fields we intend to remove are marked @deprecated in the schema first, which shows up in your codegen output and your editor.

What does not exist yet, stated plainly rather than implied: there is no guaranteed deprecation window, no minimum notice period, and no dated API version to pin. If your own documents select fields beyond what this package queries, validate them against the live schema in your own CI.

License

MIT

版本与发布记录

@cmssy/core 共发布 147 个版本,首次发布于 2026/07/14;过去 12 个月发布了 147 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
19.30.0latest2026/11/063 天前
19.29.02026/11/045 天前
19.28.12026/11/045 天前
19.28.02026/11/045 天前
19.27.02026/10/319 天前
19.26.32026/10/3010 天前

关于 @cmssy/core 的常见问题

@cmssy/core 是什么?

Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.

如何安装 @cmssy/core?

在项目目录运行 npm install @cmssy/core,或使用 pnpm add / yarn add / bun add。

@cmssy/core 支持 TypeScript 吗?

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

@cmssy/core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cmssy/core 需要什么版本的 Node.js?

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

@cmssy/core 可以商用吗?

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

@cmssy/core 的下载量有多少?

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

@cmssy/core 还在维护吗?

最新版本 19.30.0 发布于 2026/11/06(3 天前);至今共发布 147 个版本,其中过去 12 个月发布了 147 个;首次发布于 2026/07/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。