@mirascript/wasm 0.1.62-alpha.15 → 0.1.62-alpha.20

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.
Files changed (2) hide show
  1. package/README.md +43 -0
  2. package/package.json +7 -2
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @mirascript/wasm
2
+
3
+ `@mirascript/wasm` 提供 MiraScript 编译器的 WebAssembly 封装,适用于浏览器、Web Worker 以及不方便加载原生 Node 模块的环境。
4
+
5
+ ## 功能
6
+
7
+ - 初始化 WebAssembly 编译器模块
8
+ - 创建底层编译配置对象
9
+ - 提供同步编译接口,输出字节码和诊断信息
10
+
11
+ ## 安装
12
+
13
+ ```bash
14
+ pnpm add @mirascript/wasm
15
+ ```
16
+
17
+ ## 基本用法
18
+
19
+ ```ts
20
+ import { init, compileSync } from '@mirascript/wasm';
21
+
22
+ await init();
23
+
24
+ const result = compileSync('1 + 2', {
25
+ input_mode: 'Script',
26
+ });
27
+
28
+ console.log(result.diagnostics);
29
+ console.log(result.chunk);
30
+ ```
31
+
32
+ ## 构建
33
+
34
+ ```bash
35
+ pnpm --filter @mirascript/wasm build:dev
36
+ pnpm --filter @mirascript/wasm build
37
+ ```
38
+
39
+ 构建依赖 `wasm-pack` 与 Rust 工具链。
40
+
41
+ ## 说明
42
+
43
+ 如果你的代码既要在 Node.js 运行,也要在浏览器运行,优先使用 `@mirascript/bindings`,由它自动选择原生或 WebAssembly 实现。
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@mirascript/wasm",
3
- "version": "0.1.62-alpha.15",
3
+ "version": "0.1.62-alpha.20",
4
4
  "author": "CloudPSS",
5
5
  "license": "MIT",
6
6
  "description": "MiraScript compiler for WebAssembly",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/CloudPSS/MiraScript.git",
10
+ "directory": "packages/wasm"
11
+ },
7
12
  "type": "module",
8
13
  "main": "dist/index.js",
9
14
  "types": "dist/index.d.ts",
@@ -19,7 +24,7 @@
19
24
  "devDependencies": {
20
25
  "@types/node": "^25.6.0",
21
26
  "nodemon": "^3.1.14",
22
- "@mirascript/constants": "~0.1.62-alpha.15"
27
+ "@mirascript/constants": "~0.1.62-alpha.20"
23
28
  },
24
29
  "scripts": {
25
30
  "wasm": "wasm-pack build --target web --out-dir ../../packages/wasm/lib --no-pack ../../crates/wasm",