@mirascript/wasm 0.1.64 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/lib/wasm_bg.wasm +0 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @mirascript/wasm
|
|
2
2
|
|
|
3
|
-
`@mirascript/wasm` 提供 MiraScript 编译器的 WebAssembly 封装,适用于浏览器、Web Worker
|
|
3
|
+
`@mirascript/wasm` 提供 MiraScript 编译器的 WebAssembly 封装,适用于浏览器、Web Worker 和其他不便使用原生模块的环境。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 能力概览
|
|
6
6
|
|
|
7
|
-
- 初始化 WebAssembly
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- 初始化 WebAssembly 编译模块
|
|
8
|
+
- 提供同步编译接口
|
|
9
|
+
- 返回编译产物与诊断信息
|
|
10
10
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
pnpm add @mirascript/wasm
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## 快速开始
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { init, compileSync } from '@mirascript/wasm';
|
|
@@ -29,6 +29,10 @@ console.log(result.diagnostics);
|
|
|
29
29
|
console.log(result.chunk);
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## 使用建议
|
|
33
|
+
|
|
34
|
+
如果项目需要同时兼容 Node.js 与浏览器,优先使用 `@mirascript/bindings` 统一加载入口。
|
|
35
|
+
|
|
32
36
|
## 构建
|
|
33
37
|
|
|
34
38
|
```bash
|
|
@@ -36,8 +40,4 @@ pnpm --filter @mirascript/wasm build:dev
|
|
|
36
40
|
pnpm --filter @mirascript/wasm build
|
|
37
41
|
```
|
|
38
42
|
|
|
39
|
-
构建依赖 `wasm-pack
|
|
40
|
-
|
|
41
|
-
## 说明
|
|
42
|
-
|
|
43
|
-
如果你的代码既要在 Node.js 运行,也要在浏览器运行,优先使用 `@mirascript/bindings`,由它自动选择原生或 WebAssembly 实现。
|
|
43
|
+
构建依赖 Rust 工具链与 `wasm-pack`。
|
package/lib/wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/wasm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "MiraScript compiler for WebAssembly",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^26.
|
|
33
|
+
"@types/node": "^26.1.1",
|
|
34
34
|
"nodemon": "^3.1.14",
|
|
35
|
-
"@mirascript/constants": "~0.1.
|
|
35
|
+
"@mirascript/constants": "~0.1.65"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"wasm": "wasm-pack build --target web --out-dir ../../packages/wasm/lib --no-pack ../../crates/wasm",
|