chore: refresh benchmark gate metrics
Moon Mustache is a reusable Mustache template engine and safe multi-file generator for MoonBit.
它把结构化数据可靠地转换为配置、文档、通知和项目文件,并提供解析诊断、严格模式、Bundle 校验、资源限制与跨实现一致性测试。核心库可嵌入 MoonBit 项目;CLI 和浏览器 Playground 用于直接运行同一套 MoonBit 引擎。
要求:MoonBit 工具链;文件读写与 Playground 还需要 Node.js。
moon run cli --template "Hello {{name}}" --var name=MoonBit
输出:
Hello MoonBit
直接验证仓库:
moon check --deny-warn moon test --deny-warn --target wasm-gc python scripts/test_cli_integration.py
也可以用一个命令生成带逐步日志和 JSON 摘要的验收证据:
python scripts/verify.py
示例 manifest 同时定义文件模板、共享 partial 和 dev / prod profile。下面的命令先合并 JSON 上下文,再生成 .env、README 和部署配置:
dev
prod
.env
moon run --target js cli \ --bundle-manifest-file examples/bundle/manifest.json \ --bundle-profile dev \ --json-file examples/bundle/context.json \ --bundle-output-dir out_bundle_demo \ --bundle-validation-file out_bundle_demo/validation.md \ --bundle-plan-file out_bundle_demo/plan.md
如果只想在 CI 中检查,不写生成文件:
moon run --target js cli \ --bundle-manifest-file examples/bundle/manifest.json \ --bundle-profile dev \ --json-file examples/bundle/context.json \ --bundle-check-only \ --strict --strict-missing
严格模式遇到缺失变量、解析错误或不安全输出路径时会阻止生成,并返回非零退出码。
Moon Mustache 围绕“可复用、可诊断、可验证”设计:
wasm
wasm-gc
js
native
测试不是一个总数,而是针对不同风险的分层证据:
moon test --deny-warn
mustache/spec
python scripts/verify_official_spec_fixtures.py && moon run official_spec_report
mustache.js
cd playground && npm run differential
python scripts/test_cli_integration.py
python scripts/run_coverage.py --minimum 90 --cli-core-minimum 70
python scripts/run_fault_injection.py
python scripts/test_backend_conformance.py
官方 fixture 的来源和许可证保留在 third_party/mustache-spec/;差分测试使用固定 seed,可重复运行。精确测试数、fixture 通过数和核心覆盖率只在自动生成的 Metrics Snapshot 中维护,避免多处手工数字互相冲突。
third_party/mustache-spec/
专项鼓励奖对应证据与最短复现路径见 专项鼓励奖证据索引。
扫描模板依赖的数据和 Partial:
moon run cli --template "{{#user}}{{name}}{{/user}}{{> footer}}" --scan
在严格模式中检查缺失变量:
moon run cli --template "Hello {{name}}" --strict --strict-missing
从文件渲染:
moon run --target js cli \ --template-file examples/files/template.mustache \ --json-file examples/files/context.json \ --partials-json-file examples/files/partials.json
打印更多可复制命令:
moon run cli --examples
{{name}}
{{{name}}}
{{& name}}
{{#items}}...{{/items}}
{{^empty}}...{{/empty}}
{{> card}}
{{=<% %>=}}
{{user.name}}
{{.}}
完整矩阵见 Compatibility Matrix,已知边界见 Known Limitations。
稳定核心 API 包括:
parse
render
render_with_partials
prepare
render_checked_with_options
parse_json_context
scan_template_references
TemplateBundle
类型、参数和错误行为见 API Guide。可编译示例见 Executable Examples,API 稳定层级见 Stability Policy。
cd playground npm ci npm run dev
Playground 构建时编译仓库中的 MoonBit browser bridge,不依赖在线后端,也不以 mustache.js 代替产品实现。界面提供 Render、Diagnose、Compare、Evidence、Generate 五个视图:Compare 明确把 mustache.js 标为参考实现;Evidence 从生成指标快照展示规范、差分、Mutation、后端和 CLI 分层证据,并展开逐 mutant 检测器;Generate 则通过真实 TemplateBundle API 预览 moon.mod、README、源码、包配置和 CI 五个文件。入口默认中文并可切换英文。
moon.mod
template + context + partials │ ▼ scanner → parser → prepared AST → checked renderer │ ┌───────────────┼───────────────┐ ▼ ▼ ▼ library API CLI browser bridge
Bundle 层在核心渲染器上增加 manifest/profile 解析、路径安全校验、批量渲染和报告输出。设计取舍见 Architecture 与 Design Choices。
src/
cli/
browser_bridge/
playground/
examples/
scripts/
docs/
*_demo/
bellesz0611/moon-mustache@0.2.0
1.0
Moon Mustache 使用 MIT License。导入的 mustache/spec fixture 同样按其 MIT License 使用,来源与保留声明见 THIRD_PARTY_NOTICES.md。
A Mustache template engine implementation for MoonBit
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
Moon Mustache
Moon Mustache is a reusable Mustache template engine and safe multi-file generator for MoonBit.
它把结构化数据可靠地转换为配置、文档、通知和项目文件,并提供解析诊断、严格模式、Bundle 校验、资源限制与跨实现一致性测试。核心库可嵌入 MoonBit 项目;CLI 和浏览器 Playground 用于直接运行同一套 MoonBit 引擎。
60 秒体验
要求:MoonBit 工具链;文件读写与 Playground 还需要 Node.js。
输出:
直接验证仓库:
也可以用一个命令生成带逐步日志和 JSON 摘要的验收证据:
一个完整任务:安全生成项目文件
示例 manifest 同时定义文件模板、共享 partial 和
dev/prodprofile。下面的命令先合并 JSON 上下文,再生成.env、README 和部署配置:如果只想在 CI 中检查,不写生成文件:
严格模式遇到缺失变量、解析错误或不安全输出路径时会阻止生成,并返回非零退出码。
为什么不是简单的字符串替换
Moon Mustache 围绕“可复用、可诊断、可验证”设计:
wasm、wasm-gc、js、native四后端 CI测试证据
测试不是一个总数,而是针对不同风险的分层证据:
moon test --deny-warnmustache/spec核心和可选语义一致,来源是否漂移python scripts/verify_official_spec_fixtures.py && moon run official_spec_reportmustache.js输出一致,失败是否能自动缩成最小样本cd playground && npm run differentialpython scripts/test_cli_integration.pypython scripts/run_coverage.py --minimum 90 --cli-core-minimum 70python scripts/run_fault_injection.pypython scripts/test_backend_conformance.py,CI 强制包含 native官方 fixture 的来源和许可证保留在
third_party/mustache-spec/;差分测试使用固定 seed,可重复运行。精确测试数、fixture 通过数和核心覆盖率只在自动生成的 Metrics Snapshot 中维护,避免多处手工数字互相冲突。专项鼓励奖对应证据与最短复现路径见 专项鼓励奖证据索引。
常用 CLI
扫描模板依赖的数据和 Partial:
在严格模式中检查缺失变量:
从文件渲染:
打印更多可复制命令:
支持的 Mustache 语法
{{name}}{{{name}}}/{{& name}}{{#items}}...{{/items}}{{^empty}}...{{/empty}}{{> card}}{{=<% %>=}}{{user.name}}/{{.}}完整矩阵见 Compatibility Matrix,已知边界见 Known Limitations。
作为 MoonBit 库使用
稳定核心 API 包括:
parse、render、render_with_partialsprepare与 prepared render 系列render_checked_with_optionsparse_json_context与 JSON render 系列scan_template_referencesTemplateBundle、manifest、validation 与 plan 系列类型、参数和错误行为见 API Guide。可编译示例见 Executable Examples,API 稳定层级见 Stability Policy。
Playground
Playground 构建时编译仓库中的 MoonBit browser bridge,不依赖在线后端,也不以
mustache.js代替产品实现。界面提供 Render、Diagnose、Compare、Evidence、Generate 五个视图:Compare 明确把mustache.js标为参考实现;Evidence 从生成指标快照展示规范、差分、Mutation、后端和 CLI 分层证据,并展开逐 mutant 检测器;Generate 则通过真实TemplateBundleAPI 预览moon.mod、README、源码、包配置和 CI 五个文件。入口默认中文并可切换英文。架构
Bundle 层在核心渲染器上增加 manifest/profile 解析、路径安全校验、批量渲染和报告输出。设计取舍见 Architecture 与 Design Choices。
仓库导航
src/:核心实现、规范 fixture 适配与单元测试cli/:命令行入口和 Node 文件桥browser_bridge/、playground/:浏览器引擎与交互界面examples/:文件渲染和 Bundle 示例scripts/:覆盖率、差分、文档与验收自动化third_party/mustache-spec/:带许可证的上游 fixturedocs/:API、架构、兼容性与维护文档*_demo/:下游场景证明,不属于核心库 API发布与维护
bellesz0611/moon-mustache@0.2.01.0,核心 API 是主要兼容目标License
Moon Mustache 使用 MIT License。导入的
mustache/specfixture 同样按其 MIT License 使用,来源与保留声明见 THIRD_PARTY_NOTICES.md。