mirror of
https://github.com/openharmony/ark_ts2abc.git
synced 2026-07-21 16:35:29 -04:00
revise README
Signed-off-by: hufeng <hufeng20@huawei.com> Change-Id: Id5cd2bd6d21fcc264b1eaf3d90f6dcc70d636b6a
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
- [ts2abc <a name="EN-US_TOPIC_0000001137330686"></a>](#ts2abc-)
|
||||
- [Introduction<a name="section11660541593"></a>](#introduction)
|
||||
- [Directory Structure<a name="section161941989596"></a>](#directory-structure)
|
||||
- [Note<a name="section0446154755015"></a>](#note)
|
||||
- [Build<a name="section0446154755015"></a>](#Build)
|
||||
- [Usage Guidelines<a name="section33105542504"></a>](#usage-guidelines)
|
||||
- [Repositories Involved<a name="section1371113476307"></a>](#repositories-involved)
|
||||
|
||||
@@ -28,13 +28,27 @@ For more infomation, see: [ARK Runtime Subsystem](https://gitee.com/openharmony/
|
||||
|
||||
```
|
||||
|
||||
## Note<a name="section0446154755015"></a>
|
||||
## Build<a name="section0446154755015"></a>
|
||||
|
||||
ts2abc uses the command line interaction mode and converts JS code into ARK bytecode files that can be run on an ARK runtime system. ts2abc supports Windows, Linux, and macOS.
|
||||
ts2abc uses the command line interaction mode and converts JS code into ARK bytecode files that can be run on an ARK runtime system. ts2abc supports Windows, Linux, and macOS. Front-end tools, converting JS source code into ARK bytecode, can be built by specifing the `--build-target` with `ark_ts2abc` on Linux.
|
||||
|
||||
```
|
||||
$ ./build.sh --product-name Hi3516DV300 --build-target ark_ts2abc
|
||||
```
|
||||
|
||||
### Usage Guidelines<a name="section33105542504"></a>
|
||||
|
||||
You can run **node --expose-gc _your\_path_\_to/index.js \[options\] _your\_file_.js** to convert a JS file into an ARK bytecode file using ts2abc. If no parameter is specified for **\[options\]**, an ARK binary file is generated by default. The **index.js** file is the executable file generated after ts2abc compilation.
|
||||
Install `node` and `npm`
|
||||
|
||||
convert JS to ARK bytecode
|
||||
|
||||
```
|
||||
$ cd out/ohos-arm-release/clang_x64/ark/ark/build
|
||||
$ npm install
|
||||
$ node --expose-gc src/index.js [options] file.js
|
||||
```
|
||||
|
||||
If no parameter is specified for **\[options\]**, an ARK binary file is generated by default.
|
||||
|
||||
<a name="table2035444615598"></a>
|
||||
<table><thead align="left"><tr id="row535415467591"><th class="cellrowborder" valign="top" width="12.898710128987101%" id="mcps1.1.6.1.1"><p id="p13354134619595"><a name="p13354134619595"></a><a name="p13354134619595"></a>Option</p>
|
||||
|
||||
+18
-4
@@ -3,7 +3,7 @@
|
||||
- [ts2abc组件<a name="ZH-CN_TOPIC_0000001137330686"></a>](#ts2abc组件)
|
||||
- [简介<a name="section11660541593"></a>](#简介)
|
||||
- [目录<a name="section161941989596"></a>](#目录)
|
||||
- [说明<a name="section0446154755015"></a>](#说明)
|
||||
- [编译构建<a name="section0446154755015"></a>](#编译构建)
|
||||
- [使用说明<a name="section33105542504"></a>](#使用说明)
|
||||
- [相关仓<a name="section1371113476307"></a>](#相关仓)
|
||||
|
||||
@@ -28,13 +28,27 @@ ts2abc组件是方舟运行时子系统的前端工具,支持将JavaScript文
|
||||
└── ts2abc # abc文件生成相关
|
||||
```
|
||||
|
||||
## 说明<a name="section0446154755015"></a>
|
||||
## 编译构建<a name="section0446154755015"></a>
|
||||
|
||||
ts2abc组件采用命令行交互方式,支持将JavaScript代码转换为方舟字节码文件,使其能够在方舟运行时上运行。支持Windows/Linux/MacOS平台。
|
||||
ts2abc组件采用命令行交互方式,支持将JavaScript代码转换为方舟字节码文件,使其能够在方舟运行时上运行。支持Windows/Linux/MacOS平台。方舟前端工具在linux平台上可通过全量编译或指定编译前端工具链获取。
|
||||
|
||||
```
|
||||
$ ./build.sh --product-name Hi3516DV300 --build-target ark_ts2abc
|
||||
```
|
||||
|
||||
### 使用说明<a name="section33105542504"></a>
|
||||
|
||||
ts2abc组件将JavaScript文件转换为方舟字节码文件,命令行格式为: node --expose-gc your\_path\_to/index.js \[options\] your\_file.js。当不输入任何option参数时,默认生成方舟二进制文件。其中index.js是ts2abc组件编译后的可执行文件。
|
||||
安装`node`和`npm`
|
||||
|
||||
使用ts2abc组件将JavaScript文件转换为方舟字节码文件
|
||||
|
||||
```
|
||||
$ cd out/ohos-arm-release/clang_x64/ark/ark/build
|
||||
$ npm install
|
||||
$ node --expose-gc src/index.js [options] file.js
|
||||
```
|
||||
|
||||
当不输入任何option参数时,默认生成方舟二进制文件。
|
||||
|
||||
<a name="table2035444615598"></a>
|
||||
<table><thead align="left"><tr id="row535415467591"><th class="cellrowborder" valign="top" width="12.898710128987101%" id="mcps1.1.6.1.1"><p id="p13354134619595"><a name="p13354134619595"></a><a name="p13354134619595"></a>选项</p>
|
||||
|
||||
Reference in New Issue
Block a user