mbler 0.1.1 → 0.1.3-alpna-r1
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/LICENSE +21 -0
- package/README.md +32 -0
- package/bin/mbler.js +12 -12
- package/bin/minify.js +58 -44
- package/lib/build/build-g-config.json +11 -11
- package/lib/data/includes.json +12 -12
- package/lib/data/version.json +88 -88
- package/lib/mcx/compile-mcx/compile.js +1 -1
- package/lib/mcx/compile-mcx/compiler/bundler.js +1 -0
- package/lib/mcx/compile-mcx/compiler/compileData.js +1 -0
- package/lib/mcx/compile-mcx/compiler/compileMain.js +1 -0
- package/lib/mcx/compile-mcx/compiler/index.js +1 -0
- package/lib/mcx/compile-mcx/compiler/utils.js +1 -0
- package/lib/modules/create-game/mbler.config.json +13 -13
- package/lib/modules/gameLib/mbler.config.json +15 -15
- package/lib/modules/gutils/mbler.config.json +11 -11
- package/lib/modules/innerDef.json +4 -4
- package/lib/runTemp/config.json +3 -3
- package/lib/start/create.js +1 -1
- package/lib/start/index.js +1 -1
- package/lib/start/rechce.js +1 -1
- package/package.json +49 -1
- package/test/2x sword/behavior/scripts/index.js +24 -24
- package/test/2x sword/mbler.config.json +11 -11
- package/test/2x sword/package.json +13 -13
- package/test/README.md +7 -7
- package/test/des/index.js +19 -19
- package/test/des/mbler.config.json +4 -4
- package/test/des/package.json +6 -6
- package/test/initializer/index.js +5 -5
- package/test/initializer/mbler.config.json +4 -4
- package/test/initializer/package.json +6 -6
- package/test/mbler-int/behavior/res/items/mang_one_int.json +21 -21
- package/test/mbler-int/behavior/scripts/index.js +7 -7
- package/test/mbler-int/behavior/scripts/lib/event/index.js +19 -19
- package/test/mbler-int/behavior/scripts/lib/ui/Lore.js +18 -18
- package/test/mbler-int/behavior/scripts/lib/ui/baseUi.js +6 -6
- package/test/mbler-int/behavior/scripts/lib/ui/index.js +206 -206
- package/test/mbler-int/behavior/scripts/lib/utils/index.js +51 -51
- package/test/mbler-int/mbler.config.json +18 -18
- package/test/mbler-int/package.json +12 -12
- package/test/script-mbler/behavior/scripts/index.js +5 -5
- package/test/script-mbler/behavior/scripts/index.ts +5 -5
- package/test/script-mbler/mbler.config.json +14 -14
- package/test/script-mbler/package.json +15 -15
- package/lib/mcx/compile-mcx/_compile.js +0 -602
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RuanhoR
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# McBeBuilder - MBLER
|
|
2
|
+
|
|
3
|
+
#### 介绍
|
|
4
|
+
一个针对Minecraft JavaScript API 的nodejs包,让你的附加包版本管理更简单
|
|
5
|
+
### 安装
|
|
6
|
+
确保你已经安装以下工具:
|
|
7
|
+
- Node.js 与 npm
|
|
8
|
+
- Git
|
|
9
|
+
推荐使用 GitHub 仓库:
|
|
10
|
+
从 [这里](https://github.com/RuanhoR/mbler/releases) 选择版本下载,到达这个目录(使用命令行cd),运行`npm link`
|
|
11
|
+
也可使用 Gitee 的克隆链接或github镜像站,可能速度更快
|
|
12
|
+
本项目目前迁移`typescript`,你也可以直接运行`tsc`进行构建
|
|
13
|
+
- npm `npm install -g mbler`
|
|
14
|
+
安装成功后,你可以直接使用:
|
|
15
|
+
```bash
|
|
16
|
+
# 获取版本
|
|
17
|
+
mbler -v
|
|
18
|
+
```
|
|
19
|
+
初始化目录配置文件
|
|
20
|
+
```bash
|
|
21
|
+
mbler -c <项目路径>
|
|
22
|
+
mbler init
|
|
23
|
+
```
|
|
24
|
+
** 详细请看 : [文档](https://mbler-docs.ruanhor.dpdns.org/) **
|
|
25
|
+
|
|
26
|
+
### 发布平台
|
|
27
|
+
[github](https://github.com/RuanhoR/mbler)
|
|
28
|
+
[gitee](https://gitee.com/n304sc-haoran/mbler)
|
|
29
|
+
|
|
30
|
+
## 文档
|
|
31
|
+
[中文](https://zh.mbler-docs.ruanhor.dpdns.org/)
|
|
32
|
+
[英文](https://mbler-docs.ruanhor.dpdns.org/)
|
package/bin/mbler.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @description MCBE附加包开发工具
|
|
6
|
-
* @author github-Ruanhor
|
|
7
|
-
*/
|
|
8
|
-
const main = require('./../lib/start');
|
|
9
|
-
try {
|
|
10
|
-
new main(require('path').dirname(__dirname))
|
|
11
|
-
} catch (error) {
|
|
12
|
-
console.log("[runtime error]: " + error.stack);
|
|
13
|
-
process.exit(1)
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @description MCBE附加包开发工具
|
|
6
|
+
* @author github-Ruanhor
|
|
7
|
+
*/
|
|
8
|
+
const main = require('./../lib/start');
|
|
9
|
+
try {
|
|
10
|
+
new main(require('path').dirname(__dirname))
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.log("[runtime error]: " + error.stack);
|
|
13
|
+
process.exit(1)
|
|
14
14
|
}
|
package/bin/minify.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const { execSync } = require(
|
|
2
|
-
const fs = require(
|
|
3
|
-
const path = require(
|
|
4
|
-
const { minify } = require(
|
|
1
|
+
const { execSync } = require("child_process");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { minify } = require("terser");
|
|
5
5
|
|
|
6
6
|
// 清理 dist 目录
|
|
7
7
|
fs.rmSync(path.join(__dirname, "../dist"), {
|
|
8
8
|
recursive: true,
|
|
9
|
-
force: true
|
|
9
|
+
force: true,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
// 编译 TypeScript
|
|
13
13
|
try {
|
|
14
|
-
execSync(
|
|
15
|
-
stdio:
|
|
14
|
+
execSync("tsc", {
|
|
15
|
+
stdio: "inherit",
|
|
16
16
|
});
|
|
17
|
-
console.log(
|
|
17
|
+
console.log("TypeScript 编译完成!");
|
|
18
18
|
} catch (error) {
|
|
19
|
-
console.error(
|
|
19
|
+
console.error("TypeScript 编译失败:", error.message);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const distDir = path.resolve(__dirname,
|
|
23
|
-
console.log(
|
|
22
|
+
const distDir = path.resolve(__dirname, "./../dist");
|
|
23
|
+
console.log(distDir);
|
|
24
24
|
|
|
25
25
|
if (!fs.existsSync(distDir)) {
|
|
26
|
-
console.error(
|
|
26
|
+
console.error("dist 目录不存在:", distDir);
|
|
27
27
|
process.exit(1);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -33,13 +33,13 @@ const jsonFiles = [];
|
|
|
33
33
|
// 扫描编译后的 JS 文件
|
|
34
34
|
function scanDistDirectory(directory) {
|
|
35
35
|
const files = fs.readdirSync(directory);
|
|
36
|
-
files.forEach(file => {
|
|
36
|
+
files.forEach((file) => {
|
|
37
37
|
const fullPath = path.join(directory, file);
|
|
38
38
|
const stat = fs.statSync(fullPath);
|
|
39
39
|
|
|
40
40
|
if (stat.isDirectory()) {
|
|
41
41
|
scanDistDirectory(fullPath); // 递归扫描子目录
|
|
42
|
-
} else if (file.endsWith(
|
|
42
|
+
} else if (file.endsWith(".js") && !file.endsWith(".min.js")) {
|
|
43
43
|
jsFiles.push(fullPath);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
@@ -48,7 +48,7 @@ function scanDistDirectory(directory) {
|
|
|
48
48
|
// 扫描源码中的 JSON 文件
|
|
49
49
|
function scanSrcJsonDirectory(directory) {
|
|
50
50
|
const files = fs.readdirSync(directory);
|
|
51
|
-
files.forEach(file => {
|
|
51
|
+
files.forEach((file) => {
|
|
52
52
|
const fullPath = path.join(directory, file);
|
|
53
53
|
const stat = fs.statSync(fullPath);
|
|
54
54
|
|
|
@@ -56,11 +56,14 @@ function scanSrcJsonDirectory(directory) {
|
|
|
56
56
|
scanSrcJsonDirectory(fullPath); // 递归扫描子目录
|
|
57
57
|
} else if (file.endsWith(".json")) {
|
|
58
58
|
// 计算对应的 dist 路径
|
|
59
|
-
const relativePath = path.relative(
|
|
59
|
+
const relativePath = path.relative(
|
|
60
|
+
path.join(__dirname, "../src"),
|
|
61
|
+
fullPath,
|
|
62
|
+
);
|
|
60
63
|
const distPath = path.join(distDir, "lib", relativePath);
|
|
61
64
|
jsonFiles.push({
|
|
62
65
|
srcPath: fullPath,
|
|
63
|
-
distPath: distPath
|
|
66
|
+
distPath: distPath,
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
69
|
});
|
|
@@ -70,12 +73,12 @@ scanDistDirectory(distDir);
|
|
|
70
73
|
scanSrcJsonDirectory(path.join(__dirname, "../src"));
|
|
71
74
|
|
|
72
75
|
if (jsFiles.length === 0) {
|
|
73
|
-
console.log(
|
|
76
|
+
console.log("没有找到需要压缩的文件");
|
|
74
77
|
process.exit(0);
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
console.log(`${jsFiles.length} 个文件需要处理`);
|
|
78
|
-
|
|
81
|
+
processFiles()
|
|
79
82
|
async function processFiles() {
|
|
80
83
|
let successCount = 0;
|
|
81
84
|
let failCount = 0;
|
|
@@ -84,9 +87,13 @@ async function processFiles() {
|
|
|
84
87
|
for (const jsonFile of jsonFiles) {
|
|
85
88
|
try {
|
|
86
89
|
console.log(`复制 JSON: ${jsonFile.srcPath} -> ${jsonFile.distPath}`);
|
|
87
|
-
|
|
88
|
-
try{
|
|
89
|
-
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
// 确保目标目录存在
|
|
93
|
+
await fs.promises.mkdir(path.dirname(jsonFile.distPath), {
|
|
94
|
+
recursive: true,
|
|
95
|
+
});
|
|
96
|
+
} catch {}
|
|
90
97
|
await fs.promises.copyFile(jsonFile.srcPath, jsonFile.distPath);
|
|
91
98
|
successCount++;
|
|
92
99
|
} catch (error) {
|
|
@@ -99,24 +106,24 @@ try{ // 确保目标目录存在
|
|
|
99
106
|
for (const filePath of jsFiles) {
|
|
100
107
|
try {
|
|
101
108
|
// 处理 JS 文件压缩
|
|
102
|
-
const originalCode = fs.readFileSync(filePath,
|
|
109
|
+
const originalCode = fs.readFileSync(filePath, "utf8");
|
|
103
110
|
const result = await minify(originalCode, {
|
|
104
111
|
compress: {
|
|
105
112
|
drop_console: false,
|
|
106
113
|
dead_code: true,
|
|
107
|
-
drop_debugger: true
|
|
114
|
+
drop_debugger: true,
|
|
108
115
|
},
|
|
109
116
|
mangle: true,
|
|
110
117
|
format: {
|
|
111
|
-
comments: false
|
|
112
|
-
}
|
|
118
|
+
comments: false,
|
|
119
|
+
},
|
|
113
120
|
});
|
|
114
121
|
|
|
115
122
|
if (result.error) {
|
|
116
123
|
throw new Error(result.error);
|
|
117
124
|
}
|
|
118
125
|
|
|
119
|
-
fs.writeFileSync(filePath, result.code,
|
|
126
|
+
fs.writeFileSync(filePath, result.code, "utf8");
|
|
120
127
|
successCount++;
|
|
121
128
|
} catch (error) {
|
|
122
129
|
console.error(`处理失败 ${filePath}:`, error.message);
|
|
@@ -127,29 +134,36 @@ try{ // 确保目标目录存在
|
|
|
127
134
|
console.log(`\n处理完成: 成功 ${successCount} 个, 失败 ${failCount} 个`);
|
|
128
135
|
// 复制其他必要文件
|
|
129
136
|
await Promise.all([
|
|
130
|
-
async function(){
|
|
131
|
-
const fileC = JSON.parse(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
(async function () {
|
|
138
|
+
const fileC = JSON.parse(
|
|
139
|
+
await fs.promises.readFile(
|
|
140
|
+
path.join(__dirname, "../package.json"),
|
|
141
|
+
"utf-8",
|
|
142
|
+
),
|
|
143
|
+
);
|
|
144
|
+
delete fileC.devDependencies;
|
|
145
|
+
await fs.promises.writeFile(
|
|
146
|
+
path.join(distDir, "package.json"),
|
|
147
|
+
JSON.stringify(fileC),
|
|
148
|
+
);
|
|
149
|
+
})(),
|
|
135
150
|
fs.promises.cp(
|
|
136
151
|
path.join(__dirname, "../bin"),
|
|
137
152
|
path.join(__dirname, "../dist/bin"),
|
|
138
|
-
{ recursive: true, force: true }
|
|
153
|
+
{ recursive: true, force: true },
|
|
139
154
|
),
|
|
140
155
|
fs.promises.cp(
|
|
141
156
|
path.join(__dirname, "../test"),
|
|
142
157
|
path.join(__dirname, "../dist/test"),
|
|
143
|
-
{ recursive: true, force: true }
|
|
144
|
-
)
|
|
158
|
+
{ recursive: true, force: true },
|
|
159
|
+
),
|
|
160
|
+
fs.promises.cp(
|
|
161
|
+
path.join(__dirname, "../README.md"),
|
|
162
|
+
path.join(__dirname, "../dist/README.md"),
|
|
163
|
+
),
|
|
164
|
+
fs.promises.cp(
|
|
165
|
+
path.join(__dirname, "../LICENSE"),
|
|
166
|
+
path.join(__dirname, "../dist/LICENSE"),
|
|
167
|
+
),
|
|
145
168
|
]);
|
|
146
|
-
|
|
147
|
-
if (failCount > 0) {
|
|
148
|
-
process.exit(1);
|
|
149
|
-
}
|
|
150
169
|
}
|
|
151
|
-
|
|
152
|
-
processFiles().catch(err => {
|
|
153
|
-
console.error('处理过程中出现错误:', err);
|
|
154
|
-
process.exit(1);
|
|
155
|
-
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"resources": {
|
|
3
|
-
"header": "48793164",
|
|
4
|
-
"module": "ab43f7cb"
|
|
5
|
-
},
|
|
6
|
-
"data": {
|
|
7
|
-
"header": "7604691",
|
|
8
|
-
"module": "bcd46f7a"
|
|
9
|
-
},
|
|
10
|
-
"ScriptId": "4654236ace4",
|
|
11
|
-
"PackageFile": "mbler.config.json"
|
|
1
|
+
{
|
|
2
|
+
"resources": {
|
|
3
|
+
"header": "48793164",
|
|
4
|
+
"module": "ab43f7cb"
|
|
5
|
+
},
|
|
6
|
+
"data": {
|
|
7
|
+
"header": "7604691",
|
|
8
|
+
"module": "bcd46f7a"
|
|
9
|
+
},
|
|
10
|
+
"ScriptId": "4654236ace4",
|
|
11
|
+
"PackageFile": "mbler.config.json"
|
|
12
12
|
}
|
package/lib/data/includes.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
[
|
|
2
|
-
"items",
|
|
3
|
-
"entities",
|
|
4
|
-
"texts",
|
|
5
|
-
"pack_icon.png",
|
|
6
|
-
"recipes",
|
|
7
|
-
"functions",
|
|
8
|
-
"loot_tables",
|
|
9
|
-
"blocks",
|
|
10
|
-
"animation_controllers",
|
|
11
|
-
"spawn_rules",
|
|
12
|
-
"animations"
|
|
1
|
+
[
|
|
2
|
+
"items",
|
|
3
|
+
"entities",
|
|
4
|
+
"texts",
|
|
5
|
+
"pack_icon.png",
|
|
6
|
+
"recipes",
|
|
7
|
+
"functions",
|
|
8
|
+
"loot_tables",
|
|
9
|
+
"blocks",
|
|
10
|
+
"animation_controllers",
|
|
11
|
+
"spawn_rules",
|
|
12
|
+
"animations"
|
|
13
13
|
]
|
package/lib/data/version.json
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "版本表",
|
|
3
|
-
"version": [
|
|
4
|
-
{
|
|
5
|
-
"range": [
|
|
6
|
-
"1.21.130",
|
|
7
|
-
"1.21.139"
|
|
8
|
-
],
|
|
9
|
-
"format": {
|
|
10
|
-
"server": "2.4.0",
|
|
11
|
-
"server_ui": "2.0.0"
|
|
12
|
-
},
|
|
13
|
-
"beta": {
|
|
14
|
-
"server": "2.5.0-beta",
|
|
15
|
-
"server_ui": "2.1.0-beta"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"range": [
|
|
20
|
-
"1.21.120",
|
|
21
|
-
"1.21.129"
|
|
22
|
-
],
|
|
23
|
-
"format": {
|
|
24
|
-
"server": "2.3.0",
|
|
25
|
-
"server_ui": "2.0.0"
|
|
26
|
-
},
|
|
27
|
-
"beta": {
|
|
28
|
-
"server": "2.4.0-beta",
|
|
29
|
-
"server_ui": "2.1.0-beta"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"range": [
|
|
34
|
-
"1.21.110",
|
|
35
|
-
"1.21.119"
|
|
36
|
-
],
|
|
37
|
-
"format": {
|
|
38
|
-
"server": "2.2.0",
|
|
39
|
-
"server_ui": "2.0.0"
|
|
40
|
-
},
|
|
41
|
-
"beta": {
|
|
42
|
-
"server": "2.3.0-beta",
|
|
43
|
-
"server_ui": "2.1.0-beta"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"range": [
|
|
48
|
-
"1.21.90",
|
|
49
|
-
"1.21.109"
|
|
50
|
-
],
|
|
51
|
-
"format": {
|
|
52
|
-
"server": "2.1.0",
|
|
53
|
-
"server_ui": "2.0.0"
|
|
54
|
-
},
|
|
55
|
-
"beta": {
|
|
56
|
-
"server": "2.2.0-beta",
|
|
57
|
-
"server_ui": "2.1.0-beta"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"range": [
|
|
62
|
-
"1.21.70",
|
|
63
|
-
"1.21.89"
|
|
64
|
-
],
|
|
65
|
-
"format": {
|
|
66
|
-
"server": "1.19.0",
|
|
67
|
-
"server_ui": "1.3.0"
|
|
68
|
-
},
|
|
69
|
-
"beta": {
|
|
70
|
-
"server": "2.0.0-beta",
|
|
71
|
-
"server_ui": "2.0.0-beta"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"range": [
|
|
76
|
-
"1.21.60",
|
|
77
|
-
"1.21.69"
|
|
78
|
-
],
|
|
79
|
-
"format": {
|
|
80
|
-
"server": "1.17.0",
|
|
81
|
-
"server_ui": "1.3.0"
|
|
82
|
-
},
|
|
83
|
-
"beta": {
|
|
84
|
-
"server": "1.18.0-beta",
|
|
85
|
-
"server_ui": "1.4.0-beta"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"description": "版本表",
|
|
3
|
+
"version": [
|
|
4
|
+
{
|
|
5
|
+
"range": [
|
|
6
|
+
"1.21.130",
|
|
7
|
+
"1.21.139"
|
|
8
|
+
],
|
|
9
|
+
"format": {
|
|
10
|
+
"server": "2.4.0",
|
|
11
|
+
"server_ui": "2.0.0"
|
|
12
|
+
},
|
|
13
|
+
"beta": {
|
|
14
|
+
"server": "2.5.0-beta",
|
|
15
|
+
"server_ui": "2.1.0-beta"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"range": [
|
|
20
|
+
"1.21.120",
|
|
21
|
+
"1.21.129"
|
|
22
|
+
],
|
|
23
|
+
"format": {
|
|
24
|
+
"server": "2.3.0",
|
|
25
|
+
"server_ui": "2.0.0"
|
|
26
|
+
},
|
|
27
|
+
"beta": {
|
|
28
|
+
"server": "2.4.0-beta",
|
|
29
|
+
"server_ui": "2.1.0-beta"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"range": [
|
|
34
|
+
"1.21.110",
|
|
35
|
+
"1.21.119"
|
|
36
|
+
],
|
|
37
|
+
"format": {
|
|
38
|
+
"server": "2.2.0",
|
|
39
|
+
"server_ui": "2.0.0"
|
|
40
|
+
},
|
|
41
|
+
"beta": {
|
|
42
|
+
"server": "2.3.0-beta",
|
|
43
|
+
"server_ui": "2.1.0-beta"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"range": [
|
|
48
|
+
"1.21.90",
|
|
49
|
+
"1.21.109"
|
|
50
|
+
],
|
|
51
|
+
"format": {
|
|
52
|
+
"server": "2.1.0",
|
|
53
|
+
"server_ui": "2.0.0"
|
|
54
|
+
},
|
|
55
|
+
"beta": {
|
|
56
|
+
"server": "2.2.0-beta",
|
|
57
|
+
"server_ui": "2.1.0-beta"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"range": [
|
|
62
|
+
"1.21.70",
|
|
63
|
+
"1.21.89"
|
|
64
|
+
],
|
|
65
|
+
"format": {
|
|
66
|
+
"server": "1.19.0",
|
|
67
|
+
"server_ui": "1.3.0"
|
|
68
|
+
},
|
|
69
|
+
"beta": {
|
|
70
|
+
"server": "2.0.0-beta",
|
|
71
|
+
"server_ui": "2.0.0-beta"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"range": [
|
|
76
|
+
"1.21.60",
|
|
77
|
+
"1.21.69"
|
|
78
|
+
],
|
|
79
|
+
"format": {
|
|
80
|
+
"server": "1.17.0",
|
|
81
|
+
"server_ui": "1.3.0"
|
|
82
|
+
},
|
|
83
|
+
"beta": {
|
|
84
|
+
"server": "1.18.0-beta",
|
|
85
|
+
"server_ui": "1.4.0-beta"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=CompileMcxProject;const utils_js_1=__importDefault(require("./../utils.js"))
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=CompileMcxProject;const utils_js_1=__importDefault(require("./../utils.js"));function CompileMcxProject(t){return new Compile(t).start()}class Compile{BuildOpt;constructor(t){if(this.BuildOpt=t,!utils_js_1.default.TypeVerify(this.BuildOpt,{cacheDir:"string",main:"string",moduleDir:"string",output:"string",isCache:"boolean"}))throw new TypeError("[compile checker]Input Opt is not right")}async start(){}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function bundlerWrite(e){}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=bundlerWrite;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MCXCompileData=exports.JsCompileData=void 0;class JsCompileData{node;BuildCache;File="__repl";isFile=!1;constructor(e,i={export:[],import:[],call:[]}){this.node=e,this.BuildCache=i}setFilePath(e){this.isFile=!0,this.File=e}}exports.JsCompileData=JsCompileData;class MCXCompileData{raw;JSIR;File="";isFile=!1;constructor(e,i){this.raw=e,this.JSIR=i}setFilePath(e){this.JSIR.setFilePath(e),this.isFile=!0,this.File=e}}exports.MCXCompileData=MCXCompileData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var i=e(t),n=0;n<i.length;n++)"default"!==i[n]&&__createBinding(r,t,i[n]);return __setModuleDefault(r,t),r}}();Object.defineProperty(exports,"__esModule",{value:!0});const utils_1=require("./../../../utils"),compiler=__importStar(require("./")),promises_1=require("node:fs/promises"),node_path_1=require("node:path");class CompileMain{opt;main="";constructor(e){this.opt=e,"string"==typeof e.main&&(this.main=(0,utils_1.join)(e.ProjectDir,e.main))}async start(){if(!this.main)throw new Error("[mcx load]: mcx loader must has a main file");const e=await(0,promises_1.readFile)(this.main,"utf-8");this.compMain(e)}compMain(e){if(".js"!==(0,node_path_1.extname)(this.main))throw new Error("[load project]: main file must is a javascript.");return compiler.compileJS(e)}}exports.default=CompileMain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var i=e(t),o=0;o<i.length;o++)"default"!==i[o]&&__createBinding(r,t,i[o]);return __setModuleDefault(r,t),r}}(),__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.compileJS=compileJS;const t=__importStar(require("@babel/types")),CompileData=__importStar(require("./compileData")),utils_1=__importDefault(require("./utils")),parser_1=require("@babel/parser");class CompileJS{node;constructor(e){if(this.node=e,!t.isProgram(e))throw new Error("[compile error]: jsCompile can't work in a not program");this.run(),this.CompileData=new CompileData.JsCompileData(e)}TopContext={};indexTemp={};push=e=>{for(const t of e.imported)this.indexTemp[t.as]={source:e.source,import:t.import,isAll:t.isAll}};takeInnerMost(e){if(!t.isMemberExpression(e))throw new Error("[take item}: must MemberExpression");let r,i=e.object;for(;;)if("MemberExpression"!==i.type){if(t.isLiteral(i)||"NewExpression"==i.type||"Super"==i.type||"Identifier"==i.type||"Import"==i.type||"ThisExpression"==i.type){r=i;break}if("CallExpression"!=i.type)return t.stringLiteral("");{const e=i.callee;"MemberExpression"==e.type&&(i=e.object),i=e}}else i=i.object;return r}writeImportKeys=[];writeBuildCache(){const e=[];let t=[];for(const[r,i]of Object.entries(this.indexTemp))if(e.includes(i.source)){let e=!1;for(const o in t){const n=t[o];n&&(n.source==i.source&&(n.imported.push({as:r,isAll:i.isAll,import:i.import}),e=!0))}if(!e)throw new Error("[mcx compoiler]: internal error: unexpected source")}else t.push({source:i.source,imported:[{as:r,import:i.import,isAll:i.isAll}]}),e.push(i.source)}CompileData;conditionalInTempImport(e,r){if("Identifier"==e.type)e.name in this.indexTemp&&!this.writeImportKeys.includes(e.name)&&this.writeImportKeys.push(e.name);else if("FunctionExpression"==e.type)this.tre(t.blockStatement([e.body]));else if("ArrowFunctionExpression"==e.type)t.isExpression(e.body)?this.conditionalInTempImport(e.body,r):this.tre(e.body);else{if(t.isLiteral(e))return;e.type}}tre(e){if(!t.isBlock(e))throw new Error("[compile error]: can't for in not block node");const r=t.isProgram(e),i=r?this.TopContext:{};for(let o in e.body){const n=e.body[o];if(n)if("ImportDeclaration"==n.type){if(!r)throw new Error("[compile node]: import declaration must use in top.");this.push(utils_1.default.ImportToCache(n))}else if("BlockStatement"==n.type)this.tre(n);else{if("BreakStatement"==n.type||"EmptyStatement"==n.type||"ContinueStatement"==n.type||"ThrowStatement"==n.type||"WithStatement"==n.type)continue;if("TryStatement"==n.type)this.tre(t.blockStatement(n.block.body));else if("IfStatement"==n.type){const e=n.test;this.conditionalInTempImport(e,i);const r=[n.consequent];n.alternate&&r.push(n.alternate),this.tre(t.blockStatement(r))}else if("WhileStatement"==n.type)this.tre(t.blockStatement([n.body]));else if("ClassDeclaration"==n.type){if(n.superClass){const e=n.superClass;let t=null;if("Identifier"==e.type&&(t=e.name),"MemberExpression"==e.type){const r=this.takeInnerMost(e);"Identifier"==r.type&&(t=r.name)}if("ArrayExpression"==e.type||"BooleanLiteral"==e.type||"BinaryExpression"==e.type||"ThisExpression"==e.type||"ArrowFunctionExpression"==e.type||"BigIntLiteral"==e.type||"NumericLiteral"==e.type||"NullLiteral"==e.type||"AssignmentExpression"==e.type||"Super"==e.type||"NewExpression"==e.type||"DoExpression"==e.type||"StringLiteral"==e.type||"YieldExpression"==e.type||"RecordExpression"==e.type||"RegExpLiteral"==e.type||"DecimalLiteral"==e.type||"BindExpression"==e.type)throw new Error("[compilr error]: class can't extends a not constructor or null");t&&this.indexTemp[t]&&this.writeImportKeys.push(t)}}else if("DoWhileStatement"==n.type)this.tre(t.blockStatement([n.body])),this.conditionalInTempImport(n.test,i);else if("VariableDeclaration"==n.type){const e=n.declarations;for(const t of e){const e=t.init,r=t.id;if("Identifier"==r.type){if(e||"let"!=n.kind&&"var"!=n.kind||(i[r.name]={status:"wait"}),!e)throw new Error("[compilr node]: 'const' must has a init");i[r.name]=e}}}else if("ReturnStatement"==n.type){const e=n.argument;if(!e)continue;this.conditionalInTempImport(e,i)}else if("ExportAllDeclaration"==n.type||"ExportDefaultDeclaration"==n.type||"ExportNamedDeclaration"==n.type){if(!r)throw new Error("[compiler]: export node can't in not top");this.CompileData.BuildCache.export.push(n)}else n.type}}}run(){if(!t.isBlock(this.node))throw new Error("[compile error]: can't for a not block");this.tre(this.node)}}function compileJS(e){const t=new CompileJS((0,parser_1.parse)(e).program);return t.run(),t.CompileData}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var i=e(t),o=0;o<i.length;o++)"default"!==i[o]&&__createBinding(r,t,i[o]);return __setModuleDefault(r,t),r}}(),__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const promises_1=require("node:fs/promises"),parser_1=__importDefault(require("@babel/parser")),t=__importStar(require("@babel/types"));class Utils{static async FileAST(e,t){if("string"!=typeof e)throw new TypeError("[read file]: compile utils was passed a non-string value");const r=await(0,promises_1.readFile)(e,"utf-8");if("string"!=typeof r)throw new Error("[read file]: not found file "+e);try{return parser_1.default.parse(r).program}catch(e){throw new Error("[compile ast]: "+e.stack)}}static async FileContent(e){return await(0,promises_1.readFile)(e,"utf-8")}static nodeStringValue(e){if("StringLiteral"==e.type)return e.value;if("Identifier"==e.type)return e.name;throw new TypeError("[read id error]: no way to read string id")}static CheckImportNode(e,t){const r=Utils.ImportToCache(e);if(r.source!==t.source)return!1;if(r.imported.length!==t.imported.length)return!1;for(let e=0;e<r.imported.length;e++){const i=r.imported[e],o=t.imported[e];if(i?.import!==o?.import||i?.as!==o?.as||i?.isAll!==o?.isAll)return!1}return!0}static CacheToImportNode(e){if(!e)throw new TypeError("plase call use right ImportList");if(e?.raw&&Utils.CheckImportNode(e?.raw,e))return e.raw;let r=[];for(let i of e.imported)if(i)if(i.isAll)r.push(t.importNamespaceSpecifier(t.identifier(i.as)));else if("default"!=i.import){if(!i.import)throw new TypeError("[compile node]: not found imported");r.push(t.importSpecifier(t.identifier(i.as),t.identifier(i.import)))}else r.push(t.importDefaultSpecifier(t.identifier(i.as)));return t.importDeclaration(r,t.stringLiteral(e.source))}static ImportToCache(e){const t=[];for(let r of e.specifiers){const e=r.local.name;"ImportNamespaceSpecifier"==r.type?t.push({isAll:!0,as:e}):"ImportDefaultSpecifier"==r.type?t.push({isAll:!1,import:"default",as:e}):"ImportSpecifier"==r.type&&t.push({isAll:!1,as:e,import:Utils.nodeStringValue(r.imported)})}return{source:Utils.nodeStringValue(e.source),imported:t}}}exports.default=Utils;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-game",
|
|
3
|
-
"description": "create game fast",
|
|
4
|
-
"git": "gitee.com/ykxyx666_admin/sapi-game.git",
|
|
5
|
-
"version": "0.0.1",
|
|
6
|
-
"type": "scriptsDes",
|
|
7
|
-
"script": {
|
|
8
|
-
"main": "./src/main.js"
|
|
9
|
-
},
|
|
10
|
-
"mcVersion": [
|
|
11
|
-
"1.21.10",
|
|
12
|
-
"1.21.120"
|
|
13
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"name": "create-game",
|
|
3
|
+
"description": "create game fast",
|
|
4
|
+
"git": "gitee.com/ykxyx666_admin/sapi-game.git",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"type": "scriptsDes",
|
|
7
|
+
"script": {
|
|
8
|
+
"main": "./src/main.js"
|
|
9
|
+
},
|
|
10
|
+
"mcVersion": [
|
|
11
|
+
"1.21.10",
|
|
12
|
+
"1.21.120"
|
|
13
|
+
]
|
|
14
14
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "GameLib",
|
|
3
|
-
"description": "test",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"type": "scriptsDes",
|
|
6
|
-
"script": {
|
|
7
|
-
"main": "./src/index.js",
|
|
8
|
-
"dependencies":{
|
|
9
|
-
"gutils": "inner"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"mcVersion": [
|
|
13
|
-
"1.21.10",
|
|
14
|
-
"1.21.120"
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"name": "GameLib",
|
|
3
|
+
"description": "test",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "scriptsDes",
|
|
6
|
+
"script": {
|
|
7
|
+
"main": "./src/index.js",
|
|
8
|
+
"dependencies":{
|
|
9
|
+
"gutils": "inner"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"mcVersion": [
|
|
13
|
+
"1.21.10",
|
|
14
|
+
"1.21.120"
|
|
15
|
+
]
|
|
16
16
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gutils",
|
|
3
|
-
"description": "t",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"type": "scriptsDes",
|
|
6
|
-
"script": {
|
|
7
|
-
"main": "./src/index.js",
|
|
8
|
-
"dependencies": [
|
|
9
|
-
"gutils"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gutils",
|
|
3
|
+
"description": "t",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "scriptsDes",
|
|
6
|
+
"script": {
|
|
7
|
+
"main": "./src/index.js",
|
|
8
|
+
"dependencies": [
|
|
9
|
+
"gutils"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
"gameLib",
|
|
3
|
-
"gutils",
|
|
4
|
-
"create-game"
|
|
1
|
+
[
|
|
2
|
+
"gameLib",
|
|
3
|
+
"gutils",
|
|
4
|
+
"create-game"
|
|
5
5
|
]
|
package/lib/runTemp/config.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"MAX": 3,
|
|
3
|
-
"CACHE_DESC": ".cache.json"
|
|
1
|
+
{
|
|
2
|
+
"MAX": 3,
|
|
3
|
+
"CACHE_DESC": ".cache.json"
|
|
4
4
|
}
|