@mirascript/mirascript 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.
- package/README.md +46 -0
- package/dist/{chunk-6CAGNGY6.js → chunk-BO6334I2.js} +2 -2
- package/dist/{chunk-VRGQ23AK.js → chunk-XGQ5WIOD.js} +2 -2
- package/dist/compiler/worker.js +1 -1
- package/dist/helpers/constants.d.ts +1 -1
- package/dist/helpers/constants.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/subtle.js +2 -2
- package/package.json +8 -3
- package/src/helpers/constants.ts +1 -1
- /package/dist/{chunk-6CAGNGY6.js.map → chunk-BO6334I2.js.map} +0 -0
- /package/dist/{chunk-VRGQ23AK.js.map → chunk-XGQ5WIOD.js.map} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @mirascript/mirascript
|
|
2
|
+
|
|
3
|
+
`@mirascript/mirascript` 是 MiraScript 的核心 TypeScript API,负责连接底层编译器、生成可执行脚本,并导出运行时与虚拟机相关能力。
|
|
4
|
+
|
|
5
|
+
## 能力概览
|
|
6
|
+
|
|
7
|
+
- 将 MiraScript 源码编译为可执行的 JavaScript 包装对象
|
|
8
|
+
- 提供同步与异步编译接口
|
|
9
|
+
- 导出编译器、VM、序列化等上层 API
|
|
10
|
+
- 在需要时自动加载底层编译器模块
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @mirascript/mirascript
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 基本示例
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { compile, compileSync } from '@mirascript/mirascript';
|
|
22
|
+
|
|
23
|
+
const script = await compile('1 + 2');
|
|
24
|
+
console.log(script());
|
|
25
|
+
|
|
26
|
+
const syncScript = compileSync('let x = 3; x * 7');
|
|
27
|
+
console.log(syncScript());
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 常用导出
|
|
31
|
+
|
|
32
|
+
- `compile()` / `compileSync()`:编译源代码
|
|
33
|
+
- `serialize()`:序列化运行时值
|
|
34
|
+
- `./subtle`:较底层的接口与工具
|
|
35
|
+
- `compiler/*`、`vm/*`:编译器与运行时内部模块
|
|
36
|
+
|
|
37
|
+
## 开发
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm --filter @mirascript/mirascript build
|
|
41
|
+
pnpm --filter @mirascript/mirascript watch
|
|
42
|
+
pnpm --filter @mirascript/mirascript test
|
|
43
|
+
pnpm --filter @mirascript/mirascript bench
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
如果你需要直接访问底层 Rust/WASM 编译器能力,优先查看 `@mirascript/bindings`、`@mirascript/napi` 和 `@mirascript/wasm`。
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
parseDiagnostics,
|
|
47
47
|
toString,
|
|
48
48
|
values
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-XGQ5WIOD.js";
|
|
50
50
|
|
|
51
51
|
// src/compiler/load-module.ts
|
|
52
52
|
import { loadModule } from "@mirascript/bindings";
|
|
@@ -3977,4 +3977,4 @@ export {
|
|
|
3977
3977
|
emitScript,
|
|
3978
3978
|
lib
|
|
3979
3979
|
};
|
|
3980
|
-
//# sourceMappingURL=chunk-
|
|
3980
|
+
//# sourceMappingURL=chunk-BO6334I2.js.map
|
|
@@ -36,7 +36,7 @@ var REG_HEX = /0[xX][a-fA-F0-9_]*[a-fA-F0-9]/;
|
|
|
36
36
|
var REG_OCT = /0[oO][0-7_]*[0-7]/;
|
|
37
37
|
var REG_BIN = /0[bB][01_]*[01]/;
|
|
38
38
|
var REG_NUMBER = /\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?[\d_]*\d)?/u;
|
|
39
|
-
var VM_ARRAY_MAX_LENGTH =
|
|
39
|
+
var VM_ARRAY_MAX_LENGTH = 16777216;
|
|
40
40
|
var kVmScript = /* @__PURE__ */ Symbol.for("mirascript.vm.script");
|
|
41
41
|
var kVmFunction = /* @__PURE__ */ Symbol.for("mirascript.vm.function");
|
|
42
42
|
var kVmFunctionProxy = /* @__PURE__ */ Symbol.for("mirascript.vm.function.proxy");
|
|
@@ -1812,4 +1812,4 @@ export {
|
|
|
1812
1812
|
parseDiagnostics,
|
|
1813
1813
|
formatDiagnostics
|
|
1814
1814
|
};
|
|
1815
|
-
//# sourceMappingURL=chunk-
|
|
1815
|
+
//# sourceMappingURL=chunk-XGQ5WIOD.js.map
|
package/dist/compiler/worker.js
CHANGED
|
@@ -7,7 +7,7 @@ export declare const REG_HEX: RegExp;
|
|
|
7
7
|
export declare const REG_OCT: RegExp;
|
|
8
8
|
export declare const REG_BIN: RegExp;
|
|
9
9
|
export declare const REG_NUMBER: RegExp;
|
|
10
|
-
export declare const VM_ARRAY_MAX_LENGTH =
|
|
10
|
+
export declare const VM_ARRAY_MAX_LENGTH = 16777216;
|
|
11
11
|
export declare const kVmScript: unique symbol;
|
|
12
12
|
export declare const kVmFunction: unique symbol;
|
|
13
13
|
export declare const kVmFunctionProxy: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAkD,CAAC;AAC9E,eAAO,MAAM,WAAW,QAC2I,CAAC;AACpK,eAAO,MAAM,mBAAmB,QAAiE,CAAC;AAClG,eAAO,MAAM,gBAAgB,QAA2D,CAAC;AACzF,eAAO,MAAM,cAAc,QAAmB,CAAC;AAC/C,eAAO,MAAM,OAAO,QAAkC,CAAC;AACvD,eAAO,MAAM,OAAO,QAAsB,CAAC;AAC3C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,UAAU,QAAiD,CAAC;AACzE,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAkD,CAAC;AAC9E,eAAO,MAAM,WAAW,QAC2I,CAAC;AACpK,eAAO,MAAM,mBAAmB,QAAiE,CAAC;AAClG,eAAO,MAAM,gBAAgB,QAA2D,CAAC;AACzF,eAAO,MAAM,cAAc,QAAmB,CAAC;AAC/C,eAAO,MAAM,OAAO,QAAkC,CAAC;AACvD,eAAO,MAAM,OAAO,QAAsB,CAAC;AAC3C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,UAAU,QAAiD,CAAC;AACzE,eAAO,MAAM,mBAAmB,WAAa,CAAC;AAE9C,eAAO,MAAM,SAAS,eAAqC,CAAC;AAC5D,eAAO,MAAM,WAAW,eAAuC,CAAC;AAChE,eAAO,MAAM,gBAAgB,eAA6C,CAAC;AAC3E,eAAO,MAAM,UAAU,eAAsC,CAAC;AAC9D,eAAO,MAAM,SAAS,eAAqC,CAAC;AAC5D,eAAO,MAAM,SAAS,eAAqC,CAAC;AAC5D,eAAO,MAAM,UAAU,eAAsC,CAAC;AAE9D,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAC9C,eAAO,MAAM,0BAA0B,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
unwrapFromVmValue,
|
|
13
13
|
wrapScript,
|
|
14
14
|
wrapToVmValue
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BO6334I2.js";
|
|
16
16
|
import {
|
|
17
17
|
VmError,
|
|
18
18
|
defineProperty,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
isVmValue,
|
|
39
39
|
isVmWrapper,
|
|
40
40
|
serialize
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-XGQ5WIOD.js";
|
|
42
42
|
|
|
43
43
|
// src/compiler/compile-fast.ts
|
|
44
44
|
import { isKeyword } from "@mirascript/constants";
|
package/dist/subtle.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
lib,
|
|
7
7
|
operations_exports,
|
|
8
8
|
wrapScript
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BO6334I2.js";
|
|
10
10
|
import {
|
|
11
11
|
DiagnosticCode,
|
|
12
12
|
REG_IDENTIFIER,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
serializeRecord,
|
|
28
28
|
serializeRecordKey,
|
|
29
29
|
serializeString
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XGQ5WIOD.js";
|
|
31
31
|
|
|
32
32
|
// src/subtle.ts
|
|
33
33
|
import { OpCode, isKeyword } from "@mirascript/constants";
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/mirascript",
|
|
3
|
-
"version": "0.1.62-alpha.
|
|
3
|
+
"version": "0.1.62-alpha.20",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An expression based scripting language.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/CloudPSS/MiraScript.git",
|
|
10
|
+
"directory": "packages/mirascript"
|
|
11
|
+
},
|
|
7
12
|
"type": "module",
|
|
8
13
|
"main": "./dist/index.js",
|
|
9
14
|
"types": "./dist/index.d.ts",
|
|
@@ -29,8 +34,8 @@
|
|
|
29
34
|
"@cloudpss/worker": "^0.1.11",
|
|
30
35
|
"source-map-js": "^1.2.1",
|
|
31
36
|
"supports-color": "^10.2.2",
|
|
32
|
-
"@mirascript/bindings": "~0.1.62-alpha.
|
|
33
|
-
"@mirascript/constants": "~0.1.62-alpha.
|
|
37
|
+
"@mirascript/bindings": "~0.1.62-alpha.20",
|
|
38
|
+
"@mirascript/constants": "~0.1.62-alpha.20"
|
|
34
39
|
},
|
|
35
40
|
"devDependencies": {
|
|
36
41
|
"@types/node": "^25.6.0",
|
package/src/helpers/constants.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const REG_HEX = /0[xX][a-fA-F0-9_]*[a-fA-F0-9]/;
|
|
|
8
8
|
export const REG_OCT = /0[oO][0-7_]*[0-7]/;
|
|
9
9
|
export const REG_BIN = /0[bB][01_]*[01]/;
|
|
10
10
|
export const REG_NUMBER = /\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?[\d_]*\d)?/u;
|
|
11
|
-
export const VM_ARRAY_MAX_LENGTH =
|
|
11
|
+
export const VM_ARRAY_MAX_LENGTH = 0x100_0000; // 16 M
|
|
12
12
|
|
|
13
13
|
export const kVmScript = Symbol.for('mirascript.vm.script');
|
|
14
14
|
export const kVmFunction = Symbol.for('mirascript.vm.function');
|
|
File without changes
|
|
File without changes
|