@cobalt-ui/core

中文文档
1.12.0发布于 2024/11/24MITTypeScriptES Module近 30 天下载 1746

Parser/validator for the Design Tokens Community Group (DTCG) standard.

此软件包已被标记为弃用

This package is no longer maintained. Please upgrade to @terrazzo/parser.

原始使用文档

@cobalt-ui/core

Parser/validator for the Design Tokens Community Group (DTCG) standard.

For the CLI, use @cobalt-ui/cli.

Install

npm install @cobalt-ui/core

Usage

Parse a tokens.json file into a JS object

import co from "@cobalt-ui/core";

const designTokens = {
  color: {
    red:   {$type: "color", $value: "#e34850"},
    green: {$type: "color", $value: "#2d9d78"},
    blue:  {$type: "color", $value: "#2680eb"},
  },
};

const {errors, warnings, result} = co.parse(designTokens);
NameTypeDescription
resultToken[]Flattened array of all parsed tokens in the schema (this may be incomplete if errors present)
errorsstring[] | undefinedIf present, unrecoverable errors were encountered (you should probably throw with these messages).
warningsstring[] | undefinedIf present, the parser found schema issues that are likely undesirable, but the schema is still usable (you should probably show the user).

版本与发布记录

@cobalt-ui/core 共发布 49 个版本,首次发布于 2021/11/27;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.12.0latest2024/11/242 年前
1.11.32024/07/232 年前
1.11.22024/05/232 年前
1.11.12024/04/122 年前
1.11.02024/03/312 年前
1.10.22024/03/302 年前

关于 @cobalt-ui/core 的常见问题

@cobalt-ui/core 是什么?

Parser/validator for the Design Tokens Community Group (DTCG) standard.注意:该包已被作者标记为弃用——This package is no longer maintained. Please upgrade to @terrazzo/parser.

如何安装 @cobalt-ui/core?

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

@cobalt-ui/core 支持 TypeScript 吗?

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

@cobalt-ui/core 支持 ESM 还是 CommonJS?

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

@cobalt-ui/core 可以商用吗?

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

@cobalt-ui/core 的下载量有多少?

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

@cobalt-ui/core 还在维护吗?

最新版本 1.12.0 发布于 2024/11/24(2 年前);至今共发布 49 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/11/27。作者已将其标记为弃用,新项目建议寻找替代方案。