@anduin/pangea

中文文档
0.7.7发布于 2026/08/10TypeScriptES Module零依赖近 30 天下载 2020

Parser for Blueprint that outputs the Blueprint Intermediate Represenation

原始使用文档
文档目录12 节
  1. Installation
  2. Usage
  3. Documentation
  4. Package Development
  5. Setup
  6. Develop
  7. Test
  8. Build
  9. Maintainer Guide
  10. Publish a new version to npm
  11. Regenerate the tree-sitter-catala grammar WASM
  12. Model generation

PANGEA - Blueprint Intermediate Representation toolchain

This project can be run by both Bun and Node.js, however, the test suite for this project is written to run with Bun Test.

Installation

npm install @anduin/pangea
# or
bun add @anduin/pangea

Usage

const pangea = require('@anduin/pangea')

const rawRule =
`\`\`\`catala
scope Individual_Part_I:
definition for_subscription_documents__fn_disable_and_clear_data equals
    fn_has_option_values of gatingbox,
        [gatingbox_options.check_this_box_if_you_would_li]
\`\`\``
const result = await pangea.parseBIRFromCatalaEn(rawRule)

console.log(result)

Documentation

For detail design of Intermediate Representation, see the documentation at: Notion

Design of Blueprint Intermediate Representation

Package Development

Setup

bun install
bun run init   # inlines committed wasm files into src/*-wasm-uint8array.ts

Note: the tree-sitter-catala git submodule is only required if you need to regenerate the grammar WASM (see below). For normal development you don't need to initialize it — the pre-built .wasm is committed at scripts/tree-sitter-catala_en.wasm.

Develop

bun run dev

Test

bun test

Build

bun run build

Outputs compiled JS + .d.ts to dist/.

Maintainer Guide

Publish a new version to npm

  1. Bump version in package.json.
  2. Commit and push.
  3. Trigger the Publish NPM workflow in GitHub Actions (workflow_dispatch).

Publishing uses npm Trusted Publishers via OIDC — no npm token secret is involved. The workflow runs bun install, bun test, bun run build, then npm publish --provenance from the repo root. Only files matching the files field (dist/) are shipped.

Regenerate the tree-sitter-catala grammar WASM

Only needed when the upstream CatalaLang/tree-sitter-catala grammar changes.

Requires the tree-sitter CLI (installed on demand via bunx; if the download fails, install globally with npm i -g tree-sitter-cli).

bun run rebuild:grammar

What it does:

  1. Initializes the src/tree-sitter-catala submodule if missing.
  2. Runs tree-sitter generate and tree-sitter build --wasm inside src/tree-sitter-catala/en.
  3. Copies the resulting .wasm to scripts/tree-sitter-catala_en.wasm.
  4. Runs bun run init to base64-inline both that file and web-tree-sitter.wasm into src/*-wasm-uint8array.ts.

After it completes, run bun run build && bun test, then commit:

  • scripts/tree-sitter-catala_en.wasm
  • src/tree-sitter-catala_en-wasm-uint8array.ts

Model generation

If generating models for other languages is needed, consider using quicktype.

版本与发布记录

@anduin/pangea 共发布 10 个版本,首次发布于 2026/04/17;过去 12 个月发布了 10 个版本。

版本发布日期距今
0.7.7latest2026/08/102 个月前
0.7.62026/07/283 个月前
0.7.52026/07/014 个月前
0.7.42026/06/104 个月前
0.7.32026/06/104 个月前
0.7.22026/05/115 个月前

关于 @anduin/pangea 的常见问题

@anduin/pangea 是什么?

Parser for Blueprint that outputs the Blueprint Intermediate Represenation

如何安装 @anduin/pangea?

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

@anduin/pangea 支持 TypeScript 吗?

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

@anduin/pangea 支持 ESM 还是 CommonJS?

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

@anduin/pangea 可以商用吗?

@anduin/pangea 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@anduin/pangea 的下载量有多少?

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

@anduin/pangea 还在维护吗?

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