@automann/maple-mono-cn

中文文档
7.9.2发布于 2026/07/16OFL-1.1TypeScriptES Module零依赖近 30 天下载 2986

Unofficial, reproducible webfont packaging of Maple Mono CN

原始使用文档
文档目录4 节
  1. Install
  2. Giscus and other iframes
  3. Rebuild
  4. License

@automann/maple-mono-cn

Unofficial, reproducible webfont packaging of Maple Mono CN. This package is not affiliated with or endorsed by the Maple Mono project.

The package tracks Maple Mono 7.9 and contains five upright static weights:

WeightCSS entry
Thin 100@automann/maple-mono-cn/thin.css
ExtraLight 200@automann/maple-mono-cn/extra-light.css
Light 300@automann/maple-mono-cn/light.css
Regular 400@automann/maple-mono-cn/regular.css
Medium 500@automann/maple-mono-cn/medium.css

The package contains:

  • complete Maple Mono CN character coverage, split into WOFF2 files selected by unicode-range;
  • one official non-CN MapleMono-Regular.ttf for build-time OG image renderers such as Satori;
  • one complete CN Regular font exposed through a cached Node loader for build-time OG rendering;
  • no Nerd Font glyphs;
  • no runtime CDN dependency.

Install

pnpm add @automann/maple-mono-cn

Import the browser font once from your global stylesheet:

@import "@automann/maple-mono-cn/regular.css";

:root {
  --font-mono: "Maple Mono CN", ui-monospace, monospace;
}

The package root also resolves to Regular 400. Numeric aliases (100.css, 200.css, 300.css, 400.css, and 500.css) are available for tooling that selects fonts by weight. Import only the weights the site uses: each CSS entry references a separate WOFF2 directory, so importing Regular does not bundle the other four weights.

The browser downloads only the WOFF2 ranges needed by the text on the current page. Do not preload the complete font set.

For an OG image renderer:

import MapleMono from "@automann/maple-mono-cn/og";

For complete Chinese glyph coverage, use the Node-only loader instead of importing the large TTF into a JavaScript build chunk:

import { loadMapleMonoCnRegular } from "@automann/maple-mono-cn/og-cn";

const mapleMonoCn = await loadMapleMonoCnRegular();

The loader reads and caches the official CN Regular font on first use. It is intended for static builds and other Node.js renderers, not browser bundles.

Giscus and other iframes

CSS loaded inside a third-party iframe cannot resolve an npm package at runtime. Copy dist/ to a public directory during your application build:

pnpm exec maple-mono-cn-copy public/fonts/maple-mono-cn

Then reference /fonts/maple-mono-cn/regular.css by URL from the iframe theme. The command copies only Regular 400, its WOFF2 files, and the OFL text by default; relative font URLs remain self-hosted. Select additional weights explicitly when needed:

pnpm exec maple-mono-cn-copy public/fonts/maple-mono-cn --weights 300,400,500

Rebuild

Requires Node.js 20 or newer, pnpm, and network access for the first build:

pnpm install
pnpm build
pnpm test

The build downloads the two official Maple Mono 7.9 archives, verifies their pinned SHA-256 hashes, extracts the five required upright fonts, and regenerates dist/. Downloads are cached under .cache/upstream/ and are not published.

License

The fonts and derived webfont files are distributed under the SIL Open Font License 1.1. See LICENSE and FONTLOG.md. Maple Mono is copyright the Maple Mono Project Authors. The package is free and must not be represented as an official upstream release.

版本与发布记录

@automann/maple-mono-cn 共发布 3 个版本,首次发布于 2026/07/15;过去 12 个月发布了 3 个版本。

版本发布日期距今
7.9.2latest2026/07/163 个月前
7.9.12026/07/163 个月前
7.9.02026/07/153 个月前

关于 @automann/maple-mono-cn 的常见问题

@automann/maple-mono-cn 是什么?

Unofficial, reproducible webfont packaging of Maple Mono CN

如何安装 @automann/maple-mono-cn?

在项目目录运行 npm install @automann/maple-mono-cn,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 maple-mono-cn-copy,可以用 npx maple-mono-cn-copy 直接运行。

@automann/maple-mono-cn 支持 TypeScript 吗?

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

@automann/maple-mono-cn 支持 ESM 还是 CommonJS?

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

@automann/maple-mono-cn 需要什么版本的 Node.js?

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

@automann/maple-mono-cn 可以商用吗?

@automann/maple-mono-cn 使用 OFL-1.1 许可。声明的许可为 OFL-1.1,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@automann/maple-mono-cn 的下载量有多少?

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

@automann/maple-mono-cn 还在维护吗?

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