Configs2026年7月25日·1 分钟阅读

Chameleon (CML) — Cross-Platform Development Framework by Didi

A write-once, run-anywhere framework by Didi that compiles a single codebase to Web, WeChat Mini-Program, Alipay Mini-Program, Baidu Smart App, and native platforms.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Chameleon Overview
直接安装命令
npx -y tokrepo@latest install eeedaf3c-87e3-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Chameleon, abbreviated CML, is a cross-platform development framework created by Didi Chuxing. It enables developers to write application logic once using a unified MVVM syntax and compile it to multiple target platforms including Web, WeChat Mini-Program, Alipay Mini-Program, Baidu Smart App, and native apps via a polymorphic protocol.

What Chameleon Does

  • Compiles a single codebase to Web, WeChat, Alipay, Baidu, and QQ mini-programs
  • Provides a unified component model with platform-specific polymorphic interfaces
  • Includes a cross-platform API library covering network, storage, navigation, and device features
  • Supports a polymorphic protocol allowing platform-specific code when needed
  • Offers a CLI tool for scaffolding, development, and multi-target builds

Architecture Overview

Chameleon uses a compile-time approach: source files written in CML syntax (a superset of Vue-like templates) are parsed and transformed into platform-specific output. The polymorphic protocol lets developers define interface contracts and provide platform-specific implementations, ensuring that unique platform capabilities remain accessible. The runtime layer normalizes lifecycle hooks, event handling, and data binding across targets. The build pipeline uses Webpack internally and outputs platform-native project structures.

Self-Hosting & Configuration

  • Install the chameleon-tool CLI globally via npm
  • Initialize a project with cml init project and select target platforms
  • Configure target-specific settings in the project configuration file
  • Use cml dev for live development with hot reload on the selected platform
  • Build for production with cml build which outputs deployable artifacts for each target

Key Features

  • True multi-platform compilation from a single codebase to 6+ target runtimes
  • Polymorphic protocol for clean separation of cross-platform and platform-specific code
  • Rich built-in component library with consistent behavior across platforms
  • Comprehensive API library (chameleon-api) for network, storage, location, and animation
  • Mature CLI toolchain with scaffolding, dev server, and production build support

Comparison with Similar Tools

  • Taro — compiles React/Vue code to mini-programs and native apps; Chameleon uses its own CML syntax with a stronger emphasis on polymorphic platform abstraction
  • uni-app — Vue-based cross-platform framework with wide platform coverage; Chameleon provides a more explicit polymorphic interface system
  • React Native — targets iOS and Android with native rendering; Chameleon prioritizes web and mini-program targets over native mobile
  • Flutter — uses Dart and its own rendering engine for pixel-perfect cross-platform UI; Chameleon outputs platform-native code for each target

FAQ

Q: What syntax does Chameleon use for templates? A: CML uses a Vue-like template syntax with custom directives. Developers familiar with Vue will find the learning curve minimal.

Q: Can I use platform-specific features? A: Yes. The polymorphic protocol lets you define an interface and provide separate implementations per platform, so you can access native APIs without polluting the shared codebase.

Q: Which mini-program platforms does Chameleon support? A: WeChat, Alipay, Baidu, QQ, and Toutiao mini-programs are all supported as build targets.

Q: Is Chameleon suitable for new projects in 2025? A: Chameleon is best suited for teams that need broad mini-program coverage. Evaluate it alongside Taro and uni-app based on your target platform mix and preferred component model.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产