/
move-js 架构设计 | move-js architecture design
move-js 架构设计 | move-js architecture design
- 1 一、概要设计
- 2 二、详细设计
- 2.1 1、move编译器接口
- 2.2 2、move-api
- 2.2.1 2.1 package.d.ts
- 2.2.2 2.2 disassemble.d.ts
一、概要设计
1、架构图 | architecture diagram
2、move编译器构建原理图
二、详细设计
1、move编译器接口
1.1 支持的命令
$mc support-cmds [OPTIONS]
命令选项:
选项 | 描述 |
---|---|
| 输出JSON格式 |
标准输出:
{
"code": 0,
"message": "success",
"data": [
"compile",
"test",
"package",
"disassemble"
]
}
错误输出:
1.2 编译命令
$mc compile [OPTIONS]
命令选项:
选项 | 描述 |
---|---|
| 输出JSON格式 |
--path | 工程路径 |
标准输出:
{
"code": 0,
"message": "success"
}
错误输出:
{
"code": 1,
"message": "compile fail",
"data": {
"diagnostics": []
}
}
1.3 测试命令
$mc test [OPTIONS]
命令选项:
选项 | 描述 |
---|---|
| 输出JSON格式 |
--path | 工程路径 |
--filter | 需要测试的函数 |
标准输出:
{
"code": 0,
"message": "success",
"data": {
"test_cases": [],
}
}
错误输出:
{
"code": 1,
"message": "compile fail",
"data": {
"diagnostics": []
}
}
1.4 打包命令
$mc package [OPTIONS]
命令选项:
选项 | 描述 |
---|---|
| 输出JSON格式 |
--path | 工程路径 |
标准输出:
{
"code": 0,
"message": "success",
"data": {
"target_path": "",
}
}
错误输出:
{
"code": 1,
"message": "compile fail",
"data": {
"diagnostics": []
}
}
1.5 反编译命令
$mc disassemble [OPTIONS]
命令选项:
选项 | 描述 |
---|---|
| 输出JSON格式 |
--move-bytecode-path | Move字节码文件路径 |
标准输出:
{
"code": 0,
"message": "success",
"data": {
"code": "反编译后的代码",
}
}
错误输出:
{
"code": 1,
"message": "disassemble fail",
"data": {
"diagnostics": []
}
}
2、move-api
2.1 package.d.ts
import { WasmFs } from '@wasmer/wasmfs';
export interface IDependency {
git?: string;
rev?: string;
local?: string;
}
export interface ITarget {
blobPath?: string;
hash?: string; // target blob hash
}
export interface IMovePackage {
name?: string;
version?: string;
addresses?: Map<string, string>;
dependencies?: Map<string, IDependency>;
devDependencies?: Map<string, IDependency>;
build(): Promise<void>;
test(): Promise<void>;
package(): Promise<ITarget>;
}
export declare type MoveOptions = {
packagePath: string;
test: boolean;
alias?: Map<string, string>;
initFunction?: string;
};
export declare function createMovePackage(wasmfs: WasmFs, opts: MoveOptions): IMovePackage;
2.2 disassemble.d.ts
import { WasmFs } from '@wasmer/wasmfs';
export declare function disassemble(wasmfs: WasmFs, mvPath: string): Promise<string>;
, multiple selections available,
Related content
架构设计 | architecture design
架构设计 | architecture design
More like this
Move 全生态课程
Move 全生态课程
More like this
MoveFunsDAO Weekly Share
MoveFunsDAO Weekly Share
More like this
MoveFunsDAO Private Share
MoveFunsDAO Private Share
More like this
十一放假学什么,一起来学 Move 吧
十一放假学什么,一起来学 Move 吧
More like this