@mirascript/cli 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 +8 -19
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mirascript/cli
|
|
2
2
|
|
|
3
|
-
`@mirascript/cli` 是 MiraScript
|
|
3
|
+
`@mirascript/cli` 是 MiraScript 的命令行工具,提供脚本执行、REPL 与格式化能力,对外暴露 `mirascript` 命令。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -8,12 +8,6 @@
|
|
|
8
8
|
pnpm add -D @mirascript/cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
或直接在工作区中调用:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm --filter @mirascript/cli build
|
|
15
|
-
```
|
|
16
|
-
|
|
17
11
|
## 命令概览
|
|
18
12
|
|
|
19
13
|
### 运行脚本
|
|
@@ -22,20 +16,15 @@ pnpm --filter @mirascript/cli build
|
|
|
22
16
|
mirascript run examples/01_hello_world.mira
|
|
23
17
|
```
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
常用选项:
|
|
26
20
|
|
|
27
21
|
- `-e, --eval <script>`:直接执行内联脚本
|
|
28
22
|
- `-t, --template`:以模板模式执行
|
|
23
|
+
- `--no-template`:强制使用脚本模式
|
|
29
24
|
- `-v, --variable <key=value>`:注入全局变量,可重复使用
|
|
30
|
-
- `--timeout <ms
|
|
31
|
-
|
|
32
|
-
示例:
|
|
25
|
+
- `--timeout <ms>`:执行超时(`0` 表示不超时)
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
mirascript run -e "1 + 2"
|
|
36
|
-
mirascript run --template template.miratpl
|
|
37
|
-
mirascript run -v name=world examples/11_interpolation.mira
|
|
38
|
-
```
|
|
27
|
+
如果未提供脚本路径和 `-e`,会进入 REPL。
|
|
39
28
|
|
|
40
29
|
### 格式化脚本
|
|
41
30
|
|
|
@@ -44,10 +33,10 @@ mirascript format examples/**/*.mira
|
|
|
44
33
|
mirascript format --write examples/**/*.mira
|
|
45
34
|
```
|
|
46
35
|
|
|
47
|
-
|
|
36
|
+
也支持从标准输入读取:
|
|
48
37
|
|
|
49
38
|
```bash
|
|
50
|
-
|
|
39
|
+
mirascript format - < script.mira
|
|
51
40
|
```
|
|
52
41
|
|
|
53
42
|
## 开发
|
|
@@ -57,4 +46,4 @@ pnpm --filter @mirascript/cli build
|
|
|
57
46
|
pnpm --filter @mirascript/cli watch
|
|
58
47
|
```
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
本包依赖 `@mirascript/mirascript` 与 `@mirascript/bindings`,建议先在仓库根目录完成依赖安装。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Cli for MiraScript, an expression based scripting language.",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"ansi-styles": "^6.2.3",
|
|
39
39
|
"commander": "^15.0.0",
|
|
40
40
|
"supports-color": "^10.2.2",
|
|
41
|
-
"@mirascript/bindings": "~0.1.
|
|
42
|
-
"@mirascript/mirascript": "~0.1.
|
|
41
|
+
"@mirascript/bindings": "~0.1.65",
|
|
42
|
+
"@mirascript/mirascript": "~0.1.65"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^26.
|
|
46
|
-
"type-fest": "^5.
|
|
45
|
+
"@types/node": "^26.1.1",
|
|
46
|
+
"type-fest": "^5.8.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"watch": "pnpm build --watch",
|
|
50
|
-
"build": "pnpm clean && node ./esbuild.config.js",
|
|
50
|
+
"build": "pnpm clean && pnpm tsc && node ./esbuild.config.js",
|
|
51
51
|
"clean": "rimraf dist"
|
|
52
52
|
}
|
|
53
53
|
}
|