Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
{
   "code": 0,
   "message": "success",
   "data": [
       "compile",
       "test",
       "package",
       "disassemble"
   ]
}

错误输出:

Code Block

1.2 编译命令

...

Code Block
{
   "code": 1,
   "message": "compile fail",
   "data": {
       "diagnostics": []
   }
}

1.4

...

打包命令

Code Block
$mc package [OPTIONS] 

...

Code Block
{
   "code": 1,
   "message": "compile fail",
   "data": {
       "diagnostics": []
   }
}

2、move-api

...

1

...

.

...

5 反编译命令

Code Block
import$mc {disassemble WasmFs } from '@wasmer/wasmfs';

/**
 * Git interface
 */
export interface IGit [OPTIONS] 

命令选项:

选项

描述

--json

输出JSON格式

--move-bytecode-path

Move字节码文件路径

标准输出:

Code Block
{
    /**
     * Download code to dest path
     *
     * @param repoUrl
     * @param destPath
     */
    download(repoUrl: string, destPath: string): Promise<void>;
}

/**
 * Git
 *
 */
export declare class Git implements IGit"code": 0,
   "message": "success",
   "data": {
       "code": "反编译后的代码",
   }
}

错误输出:

Code Block
{
   "code": 1,
   "message": "disassemble fail",
   "data": {
    wasmfs?: WasmFs;     constructor(wasmfs: WasmFs);"diagnostics": []
    download(zipURL: string, destPath: string): Promise<void>;
}}
}

2、move-api

2.

...

1 package.d.ts

Code Block
import { WasmFs } from '@wasmer/wasmfs';

export interface IDependency {
    git?: string;
    rev?: string;
    local?: string;
}

export interface IMovePackageITarget {
    nameblobPath?: string;
    versionhash?: string; // target   addresses?: Map<string, string>;
    dependencies?: Map<string, IDependency>;
    devDependencies?: Map<string, IDependency>;
    build(): void;
blob hash
}

export declare type MoveOptions = {
    packagePath: string;
    test: boolean;
    alias?: Map<string, string>;
    initFunction?: string;
};

export declare class MovePackage implements interface IMovePackage {
    name?: string;
    version?: string;
    addresses?: Map<string, string>;
    devDependenciesdependencies?: Map<string, IDependency>;
    dependenciesdevDependencies?: Map<string, IDependency>;
    private wasmfs;
    private packagePath;
    private packageAlias;
build(): Promise<void>;
   private test;
    private initFunction?;
    constructor(wasmfs: WasmFs, opts: MoveOptions)(): Promise<void>;
    parseTomlpackage(tomlContent: string): voidPromise<ITarget>;
}

export declare parseDeps(thisDeps: Map<string, IDependency>, tomlDeps: any): void;type MoveOptions = {
     build()packagePath: Promise<void>;
    getAllDeps(): string[];
    collectDependencies(allDeps: string[], modules: Map<string, IDependency>): voidtest: boolean;
    getAllAddresses()alias?: Map<string, string>;
    collectAddresses(allAddresssinitFunction?: Map<string, string>, modules: Map<string, IDependency>): voidstring;
};

export declare function buildPackagecreateMovePackage(wasmfs: WasmFs, packagePathopts: string, deps: string[], addresses: Map<string, string>MoveOptions): Promise<void>IMovePackage;
}

...

2.

...

2 disassemble.d.ts

Code Block
import { WasmFs } from '@wasmer/wasmfs';

export interfacedeclare IDisassemble {
    disassemble(name: string, bytecode: string, callback: (ok: boolean, data: string) => void): Promise<void>;
}

export declare class Disassemble implements IDisassemble {
    private wasmfs;
    constructor(wasmfs: WasmFs);
    disassemble(name: string, bytecode: string, callback: (ok: boolean, data: string) => void): Promise<void>;
}function disassemble(wasmfs: WasmFs, mvPath: string): Promise<string>;