@effect/printer-ansi

中文文档
0.51.0发布于 2026/07/30MITTypeScriptESM + CJS构建来源已验证近 30 天下载 99.7万

An easy to use, extensible pretty-printer for rendering documents for the terminal

原始使用文档
文档目录5 节
  1. Installation
  2. @effect/printer-ansi
  3. Overview
  4. Terminal Output and Untrusted Text
  5. Acknowledgements

ANSI Terminal Pretty Printer for Effect-TS

Installation

@effect/printer-ansi

npm install @effect/printer-ansi
pnpm install @effect/printer-ansi
yarn add @effect/printer-ansi

Overview

This package defines a renderer for documents generated by the @effect/printer package, suitable for displaying them on ANSI-compatible terminals, including colors, bolding, underlining and italicizing.

For more information about @effect/printer in general, refer to the main @effect/printer package documentation.

Terminal Output and Untrusted Text

Text leaves are rendered verbatim, including control characters. Rendering returns a string and does not make untrusted text safe for a terminal. Apply AnsiDoc.sanitize to attacker-controlled subtrees before writing the result to a terminal. Keep trusted, intentional terminal sequences outside the sanitized subtree.

Acknowledgements

This package is a port of https://github.com/quchen/prettyprinter

版本与发布记录

@effect/printer-ansi 共发布 307 个版本,首次发布于 2022/05/27;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.51.0latest2026/07/303 个月前
0.50.02026/07/134 个月前
0.49.02026/03/207 个月前
0.48.02026/03/177 个月前
0.47.02025/11/041 年前
0.46.02025/09/301.1 年前

其他发布通道:snapshot → 0.0.0-snapshot-6ebc752baf28354006ca2a0ae783a5bccf5de9ad。

关于 @effect/printer-ansi 的常见问题

@effect/printer-ansi 是什么?

An easy to use, extensible pretty-printer for rendering documents for the terminal

如何安装 @effect/printer-ansi?

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

@effect/printer-ansi 支持 TypeScript 吗?

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

@effect/printer-ansi 支持 ESM 还是 CommonJS?

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

@effect/printer-ansi 可以商用吗?

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

@effect/printer-ansi 的下载量有多少?

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

@effect/printer-ansi 还在维护吗?

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