衍生解释——Lit:Lit 是 Google 开发的轻量级 Web Components 库。它基于浏览器原生的 Custom Elements 和 Shadow DOM 标准,提供了响应式属性、模板字面量(html\...`)等便捷 API。OpenClaw 的 A2UI 渲染器使用 Lit 来实现 ` 自定义元素,将 JSONL 命令解析为实际的 DOM 元素。
function isDisabledByEnv() {
if (isTruthyEnvValue(process.env.OPENCLAW_SKIP_CANVAS_HOST)) return true;
if (process.env.NODE_ENV === "test") return true;
if (process.env.VITEST) return true;
return false;
}
# 1. 收集输入文件列表
INPUT_PATHS=(
"$ROOT_DIR/package.json"
"$ROOT_DIR/pnpm-lock.yaml"
"$A2UI_RENDERER_DIR" # 整个 Lit 渲染器目录
"$A2UI_APP_DIR" # 整个应用逻辑目录
)
# 2. 计算当前哈希(内嵌 Node.js 脚本递归遍历所有文件)
current_hash="$(compute_hash)"
# 3. 与上次哈希比较
if [[ -f "$HASH_FILE" ]]; then
previous_hash="$(cat "$HASH_FILE")"
if [[ "$previous_hash" == "$current_hash" && -f "$OUTPUT_FILE" ]]; then
echo "A2UI bundle up to date; skipping."
exit 0
fi
fi
# Docker builds exclude vendor/apps via .dockerignore.
# In that environment we must keep the prebuilt bundle.
if [[ ! -d "$A2UI_RENDERER_DIR" || ! -d "$A2UI_APP_DIR" ]]; then
echo "A2UI sources missing; keeping prebuilt bundle."
exit 0
fi