@accordproject/cicero-core

中文文档
3.1.0发布于 2026/10/20Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 6724

Cicero Core - Implementation of Accord Protocol Template Specification

原始使用文档
文档目录6 节
  1. Documentation
  2. Installation
  3. Usage
  4. Browser support
  5. Development
  6. License

Cicero Core

Core classes to manage the grammar, models and logic of Accord Project legal templates.

Documentation

http://docs.accordproject.org

Installation

npm install @accordproject/cicero-core --save

Usage

cicero-core is a native TypeScript package, typed via lib/index.d.ts. Its exports map selects one of three builds:

  • require() loads the CommonJS build in lib/;
  • Node's import loads the ES module build in lib/esm/;
  • a bundler targeting the web (webpack 5, Vite, Rollup, esbuild) loads the browser ES module build in lib/esm-browser/.
import { Template, Clause, TemplateLoader, TemplateLibrary } from '@accordproject/cicero-core';

There is no prebuilt browser bundle; import the package from a bundled application. See MIGRATION.md if you used the UMD bundle of earlier versions.

Browser support

The browser build replaces Node built-ins (fs, path, util) with empty modules. APIs that read from the filesystem or the network are therefore not available in the browser and will throw if called. Browser usage is intended for in-memory archives (e.g. an archive fetched as an ArrayBuffer).

Not available in the browser (Node-only):

  • Template.fromDirectory() — reads a template directory from disk.
  • Template.fromUrl() and the archive loaders — DefaultArchiveLoader, HTTPArchiveLoader, GitHubArchiveLoader, CompositeArchiveLoader, APArchiveLoader (filesystem / URL backed loading).
  • TemplateLibrary operations that read remote indices or use the on-disk cache.
  • Any disk-writing helper in the template saver (e.g. extracting an archive to a directory).

Available in the browser:

  • Template.fromArchive(buffer) — load a (.cta) archive from an ArrayBuffer/Uint8Array.
  • template.toArchive(language, options) — including PKCS#12 signing/verification (the cryptography uses the pure-JS node-forge and runs in the browser).
  • getMetadata(), getModelManager(), getTemplate(), getLogicManager() and the draft/trigger logic.

These are exercised by the Playwright end-to-end tests in the repository's e2e/ workspace, which bundle lib/esm-browser and run it in a headless Chromium.

Development

cicero-core is written in TypeScript (src/) and compiled to lib/ with tsc. Requires Node.js >= 22.

npm run build         # tsc: src -> lib (+ .d.ts), then esbuild: lib/esm and lib/esm-browser
npm run test:esm      # smoke test of the ES module builds (after build)
npm run lint          # eslint + license header check
npm test              # lint + build + jest unit tests
npm run test:cov      # the above, with coverage

Browser end-to-end (Playwright) tests live in the repo's e2e/ workspace; run them from the repository root with npm run test:e2e.

License

Accord Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.

© 2017-2019 Clause, Inc.

版本与发布记录

@accordproject/cicero-core 共发布 765 个版本,首次发布于 2018/04/10;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.1.0latest2026/10/2017 天前
3.0.02026/10/1125 天前
2.3.02026/10/1125 天前
2.2.02026/09/141 个月前
2.1.12026/08/062 个月前
2.1.02026/07/223 个月前

其他发布通道:unstable → 0.25.1-20250329112129。

关于 @accordproject/cicero-core 的常见问题

@accordproject/cicero-core 是什么?

Cicero Core - Implementation of Accord Protocol Template Specification

如何安装 @accordproject/cicero-core?

在项目目录运行 npm install @accordproject/cicero-core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@accordproject/concerto-core(^5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@accordproject/cicero-core 支持 TypeScript 吗?

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

@accordproject/cicero-core 支持 ESM 还是 CommonJS?

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

@accordproject/cicero-core 需要什么版本的 Node.js?

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

@accordproject/cicero-core 可以商用吗?

@accordproject/cicero-core 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@accordproject/cicero-core 的下载量有多少?

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

@accordproject/cicero-core 还在维护吗?

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