@mirascript/bindings 0.1.63 → 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/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @mirascript/bindings
|
|
2
2
|
|
|
3
|
-
`@mirascript/bindings`
|
|
3
|
+
`@mirascript/bindings` 提供统一的编译器加载入口。它在 Node.js 环境优先加载 `@mirascript/napi`,在浏览器或原生模块不可用时回退到 `@mirascript/wasm`。
|
|
4
4
|
|
|
5
5
|
## 适用场景
|
|
6
6
|
|
|
7
|
-
- 需要同时支持 Node.js
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- 需要同时支持 Node.js 与浏览器
|
|
8
|
+
- 希望用同一套 API 访问编译器模块
|
|
9
|
+
- 作为上层包(如 `@mirascript/mirascript`、`@mirascript/cli`、`@mirascript/monaco`)的底层依赖
|
|
10
10
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
pnpm add @mirascript/bindings
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## 快速开始
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { loadModule, getModule } from '@mirascript/bindings';
|
|
@@ -25,12 +25,12 @@ const sameModule = getModule();
|
|
|
25
25
|
console.log(mod === sameModule);
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## 导出
|
|
29
29
|
|
|
30
|
-
- `loadModule()
|
|
31
|
-
- `getModule()
|
|
32
|
-
- `@mirascript/bindings/wasm
|
|
33
|
-
- `@mirascript/bindings/napi
|
|
30
|
+
- `loadModule()`:异步加载底层模块
|
|
31
|
+
- `getModule()`:获取已加载模块(未加载时抛错)
|
|
32
|
+
- `@mirascript/bindings/wasm`:强制使用 WebAssembly 实现
|
|
33
|
+
- `@mirascript/bindings/napi`:强制使用 Node 原生实现
|
|
34
34
|
|
|
35
35
|
## 开发
|
|
36
36
|
|
|
@@ -39,4 +39,4 @@ pnpm --filter @mirascript/bindings build
|
|
|
39
39
|
pnpm --filter @mirascript/bindings watch
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
该包只负责装配与分发,实际编译能力由 `@mirascript/napi` 和 `@mirascript/wasm` 提供。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/bindings",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "MiraScript compiler bindings",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@mirascript/napi": "~0.1.
|
|
36
|
-
"@mirascript/wasm": "~0.1.
|
|
35
|
+
"@mirascript/napi": "~0.1.65",
|
|
36
|
+
"@mirascript/wasm": "~0.1.65"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^26.
|
|
39
|
+
"@types/node": "^26.1.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"watch": "pnpm build --watch",
|