mbler 0.1.3-alpha → 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 -21
- package/README.md +8 -4
- package/bin/mbler.js +12 -12
- package/bin/minify.js +58 -44
- package/lib/build/base.js +1 -297
- package/lib/build/build-g-config.json +12 -12
- package/lib/build/getModule.js +1 -182
- package/lib/build/index.js +1 -370
- package/lib/build/manifest.build.js +1 -103
- package/lib/build/mcVersion.js +1 -86
- package/lib/build/utils.js +1 -6
- package/lib/code-processor/c-handler-export.js +1 -12
- package/lib/code-processor/index.js +1 -141
- package/lib/code-processor/mtreehandler.js +1 -164
- package/lib/commander/index.js +1 -154
- package/lib/data/includes.json +13 -13
- package/lib/data/version.json +88 -88
- package/lib/git/clone.js +1 -28
- package/lib/git/index.js +1 -12
- package/lib/git/pull.js +1 -100
- package/lib/lang/__translate.js +1 -93
- package/lib/lang/en.js +1 -128
- package/lib/lang/index.js +1 -78
- package/lib/lang/zh.js +1 -146
- package/lib/loger/colors.js +1 -13
- package/lib/loger/index.js +1 -136
- package/lib/mcx/ast/index.js +1 -11
- package/lib/mcx/ast/prop.js +1 -78
- package/lib/mcx/ast/tag.js +1 -246
- package/lib/mcx/compile-component/lib.js +1 -106
- package/lib/mcx/compile-component/types.js +1 -2
- package/lib/mcx/compile-component/utils.js +1 -26
- package/lib/mcx/compile-mcx/compile.js +1 -34
- 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/mcx/compile-mcx/context.js +1 -19
- package/lib/mcx/compile-mcx/index.js +1 -10
- package/lib/mcx/compile-mcx/mcx/index.js +1 -2
- package/lib/mcx/compile-mcx/mcx/types.js +1 -2
- package/lib/mcx/compile-mcx/template/module.js +1 -42
- package/lib/mcx/compile-mcx/types.js +1 -2
- package/lib/mcx/compile-mcx/utils.node.js +1 -207
- package/lib/mcx/index.js +1 -13
- package/lib/mcx/test/index.js +1 -7
- package/lib/mcx/test.js +1 -21
- package/lib/mcx/types.js +1 -2
- package/lib/mcx/utils.js +1 -86
- package/lib/module-handler/index.js +1 -482
- package/lib/modules/create-game/mbler.config.json +13 -13
- package/lib/modules/create-game/src/Runner/RunnerManager.js +1 -113
- package/lib/modules/create-game/src/Runner/scriptRunner.js +1 -70
- package/lib/modules/create-game/src/config.js +1 -27
- package/lib/modules/create-game/src/constants.js +1 -19
- package/lib/modules/create-game/src/createGameModule.js +1 -24
- package/lib/modules/create-game/src/gameComponent/common/autoStop.js +1 -38
- package/lib/modules/create-game/src/gameComponent/common/lazyLoader.js +1 -76
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/onTimeEvent.js +1 -36
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/stopWatch.js +1 -90
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/tickEvent.js +1 -29
- package/lib/modules/create-game/src/gameComponent/common/timer/onTimeEvent.js +1 -36
- package/lib/modules/create-game/src/gameComponent/common/timer/tickEvent.js +1 -29
- package/lib/modules/create-game/src/gameComponent/common/timer/timer.js +1 -87
- package/lib/modules/create-game/src/gameComponent/gameComponent.js +1 -53
- package/lib/modules/create-game/src/gameComponent/index.js +1 -31
- package/lib/modules/create-game/src/gameComponent/player/blockInteractionBlocker.js +1 -40
- package/lib/modules/create-game/src/gameComponent/player/entityInteractionBlocker.js +1 -48
- package/lib/modules/create-game/src/gameComponent/player/healthIndicator.js +1 -48
- package/lib/modules/create-game/src/gameComponent/player/regionMonitor.js +1 -22
- package/lib/modules/create-game/src/gameComponent/player/respawn.js +1 -59
- package/lib/modules/create-game/src/gameComponent/player/spawnProtector.js +1 -69
- package/lib/modules/create-game/src/gameComponent/region/regionProtecter.js +1 -53
- package/lib/modules/create-game/src/gameComponent/region/regionTeamChooser.js +1 -71
- package/lib/modules/create-game/src/gameComponent/region/regionTeamCleaner.js +1 -20
- package/lib/modules/create-game/src/gameComponent/view/infoScoreboard.js +1 -77
- package/lib/modules/create-game/src/gameComponent/view/teamScoreboard.js +1 -83
- package/lib/modules/create-game/src/gameContext.js +1 -6
- package/lib/modules/create-game/src/gameEngine.js +1 -139
- package/lib/modules/create-game/src/gameEvent/eventManager.js +1 -108
- package/lib/modules/create-game/src/gameEvent/eventSignal.js +1 -28
- package/lib/modules/create-game/src/gameEvent/events/buttonPush.js +1 -41
- package/lib/modules/create-game/src/gameEvent/events/inSlot.js +1 -77
- package/lib/modules/create-game/src/gameEvent/events/interval.js +1 -51
- package/lib/modules/create-game/src/gameEvent/events/itemUse.js +1 -36
- package/lib/modules/create-game/src/gameEvent/events/onBlock.js +1 -106
- package/lib/modules/create-game/src/gameEvent/events/regionEvents.js +1 -105
- package/lib/modules/create-game/src/gameEvent/events/signClick.js +1 -45
- package/lib/modules/create-game/src/gameEvent/gameEvent.js +1 -54
- package/lib/modules/create-game/src/gameEvent/index.js +1 -20
- package/lib/modules/create-game/src/gameEvent/mapEventSignal.js +1 -101
- package/lib/modules/create-game/src/gameEvent/subscription.js +1 -17
- package/lib/modules/create-game/src/gamePlayer/gamePlayer.js +1 -102
- package/lib/modules/create-game/src/gamePlayer/groupBuilder.js +1 -38
- package/lib/modules/create-game/src/gamePlayer/groupSet.js +1 -96
- package/lib/modules/create-game/src/gamePlayer/index.js +1 -25
- package/lib/modules/create-game/src/gamePlayer/playerGroup.js +1 -145
- package/lib/modules/create-game/src/gamePlayer/playerManager.js +1 -57
- package/lib/modules/create-game/src/gameRegion/gameRegion.js +1 -229
- package/lib/modules/create-game/src/gameRegion/index.js +1 -43
- package/lib/modules/create-game/src/gameRegion/regionHelper.js +1 -79
- package/lib/modules/create-game/src/gameState/common/autoStop.js +1 -39
- package/lib/modules/create-game/src/gameState/gameState.js +1 -169
- package/lib/modules/create-game/src/gameState/index.js +1 -7
- package/lib/modules/create-game/src/gameState/types.js +1 -35
- package/lib/modules/create-game/src/gameStructure/gameStructure.js +1 -36
- package/lib/modules/create-game/src/main.js +1 -86
- package/lib/modules/create-game/src/system/gameCommand.js +1 -107
- package/lib/modules/create-game/src/system/gameManager.js +1 -124
- package/lib/modules/create-game/src/system/globalPlayerManager.js +1 -119
- package/lib/modules/create-game/src/utils/GameError.js +1 -31
- package/lib/modules/create-game/src/utils/algorithm.js +1 -95
- package/lib/modules/create-game/src/utils/chunk.js +1 -63
- package/lib/modules/create-game/src/utils/deferredObject.js +1 -27
- package/lib/modules/create-game/src/utils/duration.js +1 -25
- package/lib/modules/create-game/src/utils/func.js +1 -20
- package/lib/modules/create-game/src/utils/index.js +1 -52
- package/lib/modules/create-game/src/utils/interfaces.js +1 -2
- package/lib/modules/create-game/src/utils/logger.js +1 -47
- package/lib/modules/create-game/src/utils/random.js +1 -76
- package/lib/modules/create-game/src/utils/vanila-data.js +1 -123
- package/lib/modules/create-game/src/utils/vector.js +1 -96
- package/lib/modules/gameLib/mbler.config.json +15 -15
- package/lib/modules/gameLib/src/config.js +1 -134
- package/lib/modules/gameLib/src/data.js +1 -77
- package/lib/modules/gameLib/src/entity.js +1 -256
- package/lib/modules/gameLib/src/event.js +1 -285
- package/lib/modules/gameLib/src/index.js +1 -20
- package/lib/modules/gameLib/src/loger.js +1 -21
- package/lib/modules/gameLib/src/ui.js +1 -209
- package/lib/modules/gameLib/src/utils.js +1 -122
- package/lib/modules/gutils/mbler.config.json +11 -11
- package/lib/modules/gutils/src/index.js +1 -22
- package/lib/modules/innerDef.json +4 -4
- package/lib/runTemp/File.js +1 -54
- package/lib/runTemp/config.json +3 -3
- package/lib/runTemp/index.js +1 -137
- package/lib/runTemp/securityFile.js +1 -93
- package/lib/start/addPack.js +1 -3
- package/lib/start/clean.js +1 -84
- package/lib/start/create.js +1 -146
- package/lib/start/dev.js +1 -99
- package/lib/start/getResConfig.js +1 -3
- package/lib/start/incg.js +1 -3
- package/lib/start/index.js +1 -207
- package/lib/start/init.js +1 -125
- package/lib/start/rechce.js +1 -57
- package/lib/start/unaddPack.js +1 -3
- package/lib/start/unincg.js +1 -67
- package/lib/start/version.js +1 -73
- package/lib/utils/index.js +1 -298
- package/lib/uuid/index.js +1 -27
- 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 -0
- 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/lib/mcx/ast/tag.js
CHANGED
|
@@ -1,246 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class Lexer {
|
|
4
|
-
text;
|
|
5
|
-
booleanProxyCache;
|
|
6
|
-
constructor(text) {
|
|
7
|
-
this.text = text;
|
|
8
|
-
this.booleanProxyCache = new WeakMap();
|
|
9
|
-
}
|
|
10
|
-
get tokens() {
|
|
11
|
-
return {
|
|
12
|
-
[Symbol.iterator]: () => this.tokenIterator()
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 解析标签属性,如:<div id="app" disabled />
|
|
17
|
-
*/
|
|
18
|
-
parseAttributes(tagContent) {
|
|
19
|
-
const attributes = {};
|
|
20
|
-
let currentKey = '';
|
|
21
|
-
let currentValue = '';
|
|
22
|
-
let inKey = true;
|
|
23
|
-
let name = '';
|
|
24
|
-
let inValue = false;
|
|
25
|
-
let quoteChar = null;
|
|
26
|
-
let isTagName = true;
|
|
27
|
-
for (let i = 0; i < tagContent.length; i++) {
|
|
28
|
-
const char = tagContent[i];
|
|
29
|
-
if (isTagName) {
|
|
30
|
-
if (char === ' ' || char === '>') {
|
|
31
|
-
name = currentKey.trim();
|
|
32
|
-
currentKey = '';
|
|
33
|
-
isTagName = false;
|
|
34
|
-
if (char === '>')
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
currentKey += char;
|
|
39
|
-
}
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (inValue) {
|
|
43
|
-
if (char === quoteChar &&
|
|
44
|
-
(currentValue.length === 0 || currentValue[currentValue.length - 1] !== '\\')) {
|
|
45
|
-
attributes[currentKey.trim()] = currentValue;
|
|
46
|
-
currentKey = '';
|
|
47
|
-
currentValue = '';
|
|
48
|
-
inKey = true;
|
|
49
|
-
inValue = false;
|
|
50
|
-
quoteChar = null;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
currentValue += char;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else if (char === '=' && inKey) {
|
|
57
|
-
inKey = false;
|
|
58
|
-
inValue = true;
|
|
59
|
-
const nextIndex = i + 1;
|
|
60
|
-
const nextChar = nextIndex < tagContent.length ? tagContent[nextIndex] : ' ';
|
|
61
|
-
quoteChar = (nextChar === '"' || nextChar === "'") ? nextChar : null;
|
|
62
|
-
}
|
|
63
|
-
else if (char === ' ' && inKey && currentKey) {
|
|
64
|
-
attributes[currentKey.trim()] = 'true';
|
|
65
|
-
currentKey = '';
|
|
66
|
-
}
|
|
67
|
-
else if (inKey) {
|
|
68
|
-
currentKey += char;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (isTagName) {
|
|
72
|
-
name = currentKey.trim();
|
|
73
|
-
}
|
|
74
|
-
else if (currentKey) {
|
|
75
|
-
attributes[currentKey.trim()] = inValue ?
|
|
76
|
-
currentValue.replace(/^["']/, '').replace(/["']$/, '') :
|
|
77
|
-
'true';
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
name,
|
|
81
|
-
arr: attributes,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 拆分输入文本为 Token 流:Tag、TagEnd、Content
|
|
86
|
-
*/
|
|
87
|
-
*tagSplitIterator() {
|
|
88
|
-
let inTag = false;
|
|
89
|
-
let buffer = '';
|
|
90
|
-
let inContent = false;
|
|
91
|
-
let contentBuffer = '';
|
|
92
|
-
for (const char of this.text) {
|
|
93
|
-
if (char === '<') {
|
|
94
|
-
if (contentBuffer) {
|
|
95
|
-
const n = {
|
|
96
|
-
data: contentBuffer,
|
|
97
|
-
type: 'Content'
|
|
98
|
-
};
|
|
99
|
-
yield n;
|
|
100
|
-
contentBuffer = '';
|
|
101
|
-
}
|
|
102
|
-
inTag = true;
|
|
103
|
-
buffer = '<';
|
|
104
|
-
}
|
|
105
|
-
else if (char === '>') {
|
|
106
|
-
if (!inTag) {
|
|
107
|
-
throw new Error("未匹配的 '>'");
|
|
108
|
-
}
|
|
109
|
-
buffer += '>';
|
|
110
|
-
inTag = false;
|
|
111
|
-
const type = buffer.startsWith('</') ? 'TagEnd' : 'Tag';
|
|
112
|
-
const n = {
|
|
113
|
-
data: buffer,
|
|
114
|
-
type
|
|
115
|
-
};
|
|
116
|
-
yield n;
|
|
117
|
-
buffer = '';
|
|
118
|
-
}
|
|
119
|
-
else if (inTag) {
|
|
120
|
-
buffer += char;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
contentBuffer += char;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (contentBuffer) {
|
|
127
|
-
const n = {
|
|
128
|
-
data: contentBuffer,
|
|
129
|
-
type: 'Content'
|
|
130
|
-
};
|
|
131
|
-
yield n;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 生成 Token 迭代器,用于遍历所有结构化 Token
|
|
136
|
-
*/
|
|
137
|
-
*tokenIterator() {
|
|
138
|
-
const tagTokens = Array.from(this.tagSplitIterator());
|
|
139
|
-
let currentTag = null;
|
|
140
|
-
let contentStartIndex = 0;
|
|
141
|
-
for (let i = 0; i < tagTokens.length; i++) {
|
|
142
|
-
const token = tagTokens[i];
|
|
143
|
-
if (!token)
|
|
144
|
-
continue;
|
|
145
|
-
if (token.type === 'Tag') {
|
|
146
|
-
const arr = this.parseAttributes(token.data.slice(1, -1));
|
|
147
|
-
currentTag = {
|
|
148
|
-
start: token,
|
|
149
|
-
name: arr.name,
|
|
150
|
-
arr: arr.arr,
|
|
151
|
-
content: null,
|
|
152
|
-
end: null,
|
|
153
|
-
};
|
|
154
|
-
contentStartIndex = i + 1;
|
|
155
|
-
}
|
|
156
|
-
else if (token.type === 'TagEnd' && currentTag) {
|
|
157
|
-
currentTag.end = token;
|
|
158
|
-
let contentData = '';
|
|
159
|
-
for (let j = contentStartIndex; j < i; j++) {
|
|
160
|
-
const contentToken = tagTokens[j];
|
|
161
|
-
contentData += contentToken.data;
|
|
162
|
-
}
|
|
163
|
-
const n = {
|
|
164
|
-
data: contentData,
|
|
165
|
-
type: 'TagContent',
|
|
166
|
-
};
|
|
167
|
-
currentTag.content = n;
|
|
168
|
-
// 构造最终的 ParsedTagNode
|
|
169
|
-
const tagNode = {
|
|
170
|
-
start: currentTag.start,
|
|
171
|
-
name: currentTag.name,
|
|
172
|
-
arr: currentTag.arr,
|
|
173
|
-
content: currentTag.content,
|
|
174
|
-
end: currentTag.end,
|
|
175
|
-
};
|
|
176
|
-
yield tagNode; // 直接 yield 结构化 AST 节点
|
|
177
|
-
currentTag = null;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* 创建一个动态布尔属性访问的 Proxy(可选功能)
|
|
183
|
-
*/
|
|
184
|
-
getBooleanCheckProxy() {
|
|
185
|
-
if (!this.booleanProxyCache.has(this)) {
|
|
186
|
-
const charMap = new Map();
|
|
187
|
-
const proxy = new Proxy({}, {
|
|
188
|
-
get(_, prop) {
|
|
189
|
-
if (typeof prop !== 'string')
|
|
190
|
-
return false;
|
|
191
|
-
return charMap.get(prop) || false;
|
|
192
|
-
},
|
|
193
|
-
set(_, prop, value) {
|
|
194
|
-
if (typeof prop !== 'string')
|
|
195
|
-
return false;
|
|
196
|
-
charMap.set(prop, Boolean(value));
|
|
197
|
-
return true;
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
this.booleanProxyCache.set(this, proxy);
|
|
201
|
-
}
|
|
202
|
-
return this.booleanProxyCache.get(this);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
class McxAst {
|
|
206
|
-
text;
|
|
207
|
-
constructor(text) {
|
|
208
|
-
this.text = text;
|
|
209
|
-
}
|
|
210
|
-
getAST() {
|
|
211
|
-
const lexer = new Lexer(this.text);
|
|
212
|
-
return Array.from(lexer.tokens);
|
|
213
|
-
}
|
|
214
|
-
get data() {
|
|
215
|
-
return this.getAST();
|
|
216
|
-
}
|
|
217
|
-
parseAST() {
|
|
218
|
-
return this.getAST();
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* 生成代码字符串
|
|
222
|
-
* @param node 要生成代码的AST节点
|
|
223
|
-
* @returns 生成的代码字符串
|
|
224
|
-
*/
|
|
225
|
-
static generateCode(node) {
|
|
226
|
-
let code = `<${node.name}`;
|
|
227
|
-
// 添加属性
|
|
228
|
-
for (const [key, value] of Object.entries(node.arr)) {
|
|
229
|
-
if (value === 'true') {
|
|
230
|
-
code += ` ${key}`;
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
code += ` ${key}=${value}`;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
code += '>';
|
|
237
|
-
// 添加内容
|
|
238
|
-
if (node.content) {
|
|
239
|
-
code += node.content.data;
|
|
240
|
-
}
|
|
241
|
-
// 添加结束标签
|
|
242
|
-
code += `</${node.name}>`;
|
|
243
|
-
return code;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
exports.default = McxAst;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class Lexer{text;booleanProxyCache;constructor(t){this.text=t,this.booleanProxyCache=new WeakMap}get tokens(){return{[Symbol.iterator]:()=>this.tokenIterator()}}parseAttributes(t){const e={};let r="",n="",o=!0,a="",s=!1,l=null,i=!0;for(let c=0;c<t.length;c++){const h=t[c];if(i)if(" "===h||">"===h){if(a=r.trim(),r="",i=!1,">"===h)break}else r+=h;else if(s)h!==l||0!==n.length&&"\\"===n[n.length-1]?n+=h:(e[r.trim()]=n,r="",n="",o=!0,s=!1,l=null);else if("="===h&&o){o=!1,s=!0;const e=c+1,r=e<t.length?t[e]:" ";l='"'===r||"'"===r?r:null}else" "===h&&o&&r?(e[r.trim()]="true",r=""):o&&(r+=h)}return i?a=r.trim():r&&(e[r.trim()]=s?n.replace(/^["']/,"").replace(/["']$/,""):"true"),{name:a,arr:e}}*tagSplitIterator(){let t=!1,e="",r="";for(const n of this.text)if("<"===n){if(r){const t={data:r,type:"Content"};yield t,r=""}t=!0,e="<"}else if(">"===n){if(!t)throw new Error("未匹配的 '>'");e+=">",t=!1;const r=e.startsWith("</")?"TagEnd":"Tag",n={data:e,type:r};yield n,e=""}else t?e+=n:r+=n;if(r){const t={data:r,type:"Content"};yield t}}*tokenIterator(){const t=Array.from(this.tagSplitIterator());let e=null,r=0;for(let n=0;n<t.length;n++){const o=t[n];if(o)if("Tag"===o.type){const t=this.parseAttributes(o.data.slice(1,-1));e={start:o,name:t.name,arr:t.arr,content:null,end:null},r=n+1}else if("TagEnd"===o.type&&e){e.end=o;let a="";for(let e=r;e<n;e++){a+=t[e].data}const s={data:a,type:"TagContent"};e.content=s;const l={start:e.start,name:e.name,arr:e.arr,content:e.content,end:e.end};yield l,e=null}}}getBooleanCheckProxy(){if(!this.booleanProxyCache.has(this)){const t=new Map,e=new Proxy({},{get:(e,r)=>"string"==typeof r&&(t.get(r)||!1),set:(e,r,n)=>"string"==typeof r&&(t.set(r,Boolean(n)),!0)});this.booleanProxyCache.set(this,e)}return this.booleanProxyCache.get(this)}}class McxAst{text;constructor(t){this.text=t}getAST(){const t=new Lexer(this.text);return Array.from(t.tokens)}get data(){return this.getAST()}parseAST(){return this.getAST()}static generateCode(t){let e=`<${t.name}`;for(const[r,n]of Object.entries(t.arr))e+="true"===n?` ${r}`:` ${r}=${n}`;return e+=">",t.content&&(e+=t.content.data),e+=`</${t.name}>`,e}}exports.default=McxAst;
|
|
@@ -1,106 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ItemComponent = void 0;
|
|
4
|
-
class ItemComponent {
|
|
5
|
-
#opt;
|
|
6
|
-
constructor(opt) {
|
|
7
|
-
this.#opt = opt;
|
|
8
|
-
}
|
|
9
|
-
toJSON() {
|
|
10
|
-
if (!this.#opt)
|
|
11
|
-
throw new Error("[mcx component]: cannot read component");
|
|
12
|
-
const result = {
|
|
13
|
-
format_version: "",
|
|
14
|
-
"minecraft:item": {
|
|
15
|
-
components: {},
|
|
16
|
-
description: {
|
|
17
|
-
identifier: ""
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
if (typeof this.#opt.format == "string" && /\d.\d.\d/.test(this.#opt.format)) {
|
|
22
|
-
result["format_version"] = this.#opt.format;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
throw new Error("[compile component]: no format");
|
|
26
|
-
}
|
|
27
|
-
if (typeof this.#opt.id == "string" && /[a-zA-Z0-9_]:[a-zA-Z0-9_]/.test(this.#opt.id)) {
|
|
28
|
-
result["minecraft:item"].description.identifier = this.#opt.id;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
throw new Error("[compile component]:cno id");
|
|
32
|
-
}
|
|
33
|
-
const ApplyComponents = result["minecraft:item"].components;
|
|
34
|
-
if (typeof this.#opt.name == "string") {
|
|
35
|
-
ApplyComponents["minecraft:display_name"] = {
|
|
36
|
-
value: this.#opt.name
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
if (this.#opt.components) {
|
|
40
|
-
const components = this.#opt.components;
|
|
41
|
-
if (typeof components.damage == "number") {
|
|
42
|
-
ApplyComponents["minecraft:damage"] = {
|
|
43
|
-
value: components.damage
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
if (typeof components.offHand == "boolean" && components.offHand) {
|
|
47
|
-
ApplyComponents["minecraft:allow_off_hand"] = {
|
|
48
|
-
value: true
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (typeof components.DestroyInCreate == "boolean") {
|
|
52
|
-
ApplyComponents["minecraft:can_destroy_in_creative"] = {
|
|
53
|
-
value: components.DestroyInCreate
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
// 外界方法
|
|
60
|
-
/**
|
|
61
|
-
* set name
|
|
62
|
-
* @throws {Error}&
|
|
63
|
-
* @param {string} newValue
|
|
64
|
-
* @returns {void}
|
|
65
|
-
*/
|
|
66
|
-
setName(newValue) {
|
|
67
|
-
if (typeof newValue == "string") {
|
|
68
|
-
this.#opt.name = newValue;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new Error("[set error]: name type error");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
setIcon(newValue) {
|
|
75
|
-
if (typeof newValue == "string") {
|
|
76
|
-
this.#opt.components.icon = newValue;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
throw new Error("[set error]: icon: type error");
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* get name
|
|
84
|
-
* @returns {string} name
|
|
85
|
-
*/
|
|
86
|
-
getName() {
|
|
87
|
-
return this.#opt.name;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* set identifier
|
|
91
|
-
* @param {string} newValue
|
|
92
|
-
*/
|
|
93
|
-
setId(newValue) {
|
|
94
|
-
if (typeof newValue == "string") {
|
|
95
|
-
this.#opt.id == newValue;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
throw new Error("[set error]: id: type error");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
getId() { }
|
|
102
|
-
}
|
|
103
|
-
exports.ItemComponent = ItemComponent;
|
|
104
|
-
exports.default = {
|
|
105
|
-
Item: ItemComponent
|
|
106
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemComponent=void 0;class ItemComponent{#t;constructor(t){this.#t=t}toJSON(){if(!this.#t)throw new Error("[mcx component]: cannot read component");const t={format_version:"","minecraft:item":{components:{},description:{identifier:""}}};if("string"!=typeof this.#t.format||!/\d.\d.\d/.test(this.#t.format))throw new Error("[compile component]: no format");if(t.format_version=this.#t.format,"string"!=typeof this.#t.id||!/[a-zA-Z0-9_]:[a-zA-Z0-9_]/.test(this.#t.id))throw new Error("[compile component]:cno id");t["minecraft:item"].description.identifier=this.#t.id;const e=t["minecraft:item"].components;if("string"==typeof this.#t.name&&(e["minecraft:display_name"]={value:this.#t.name}),this.#t.components){const t=this.#t.components;"number"==typeof t.damage&&(e["minecraft:damage"]={value:t.damage}),"boolean"==typeof t.offHand&&t.offHand&&(e["minecraft:allow_off_hand"]={value:!0}),"boolean"==typeof t.DestroyInCreate&&(e["minecraft:can_destroy_in_creative"]={value:t.DestroyInCreate})}return t}setName(t){if("string"!=typeof t)throw new Error("[set error]: name type error");this.#t.name=t}setIcon(t){if("string"!=typeof t)throw new Error("[set error]: icon: type error");this.#t.components.icon=t}getName(){return this.#t.name}setId(t){if("string"!=typeof t)throw new Error("[set error]: id: type error");this.#t.id}getId(){}}exports.ItemComponent=ItemComponent,exports.default={Item:ItemComponent};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const normalize = (v) => {
|
|
4
|
-
return String(v || '').trim();
|
|
5
|
-
};
|
|
6
|
-
const parts = (v) => {
|
|
7
|
-
return normalize(v)
|
|
8
|
-
.split('.')
|
|
9
|
-
.slice(0, 3)
|
|
10
|
-
.map((n) => parseInt(n, 10) || 0);
|
|
11
|
-
};
|
|
12
|
-
// 比较版本号,返回 1 表示 a > b,-1 表示 a < b,0 表示相等
|
|
13
|
-
const compareVar = (a, b) => {
|
|
14
|
-
const A = parts(a);
|
|
15
|
-
const B = parts(b);
|
|
16
|
-
for (let i = 0; i < 3; i++) {
|
|
17
|
-
const a = A[i];
|
|
18
|
-
const b = B[i];
|
|
19
|
-
if (!a || !b)
|
|
20
|
-
continue;
|
|
21
|
-
if (a !== b)
|
|
22
|
-
return a > b ? 1 : -1;
|
|
23
|
-
}
|
|
24
|
-
return 0;
|
|
25
|
-
};
|
|
26
|
-
exports.default = compareVar;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const normalize=r=>String(r||"").trim(),parts=r=>normalize(r).split(".").slice(0,3).map(r=>parseInt(r,10)||0),compareVar=(r,e)=>{const t=parts(r),s=parts(e);for(let r=0;r<3;r++){const e=t[r],a=s[r];if(e&&a&&e!==a)return e>a?1:-1}return 0};exports.default=compareVar;
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = CompileMcxProject;
|
|
7
|
-
const utils_js_1 = __importDefault(require("./../utils.js"));
|
|
8
|
-
/*import _compile from "./_compile.js"*/
|
|
9
|
-
/**
|
|
10
|
-
* @description - this is a function factory to generate mcxProject
|
|
11
|
-
*/
|
|
12
|
-
function CompileMcxProject(BuildOpt) {
|
|
13
|
-
return (new Compile(BuildOpt)).start();
|
|
14
|
-
}
|
|
15
|
-
class Compile {
|
|
16
|
-
BuildOpt;
|
|
17
|
-
constructor(BuildOpt) {
|
|
18
|
-
this.BuildOpt = BuildOpt;
|
|
19
|
-
// 类型验证
|
|
20
|
-
if (!utils_js_1.default.TypeVerify(this.BuildOpt, {
|
|
21
|
-
cacheDir: "string",
|
|
22
|
-
main: "string",
|
|
23
|
-
moduleDir: "string",
|
|
24
|
-
output: "string",
|
|
25
|
-
isCache: "boolean"
|
|
26
|
-
})) {
|
|
27
|
-
throw new TypeError("[compile checker]Input Opt is not right");
|
|
28
|
-
}
|
|
29
|
-
;
|
|
30
|
-
}
|
|
31
|
-
async start() {
|
|
32
|
-
/*await (new _compile(this.BuildOpt)).compile();*/
|
|
33
|
-
}
|
|
34
|
-
}
|
|
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,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InfoCompile = void 0;
|
|
7
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
-
const buildSystem = node_os_1.default.type();
|
|
9
|
-
const buildSystemVersion = node_os_1.default.version();
|
|
10
|
-
class Context {
|
|
11
|
-
__MCX__ = {
|
|
12
|
-
author: "github@RuanhoR",
|
|
13
|
-
buildSystem,
|
|
14
|
-
buildSystemVersion,
|
|
15
|
-
buildTime: Date.now()
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.default = Context;
|
|
19
|
-
exports.InfoCompile = ["__MCX__"];
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.InfoCompile=void 0;const node_os_1=__importDefault(require("node:os")),buildSystem=node_os_1.default.type(),buildSystemVersion=node_os_1.default.version();class Context{__MCX__={author:"github@RuanhoR",buildSystem:buildSystem,buildSystemVersion:buildSystemVersion,buildTime:Date.now()}}exports.default=Context,exports.InfoCompile=["__MCX__"];
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = CompileMcxDir;
|
|
7
|
-
const compile_js_1 = __importDefault(require("./compile.js"));
|
|
8
|
-
async function CompileMcxDir(BuildOpt) {
|
|
9
|
-
await (0, compile_js_1.default)(BuildOpt);
|
|
10
|
-
}
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=CompileMcxDir;const compile_js_1=__importDefault(require("./compile.js"));async function CompileMcxDir(e){await(0,compile_js_1.default)(e)}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class Module {
|
|
4
|
-
modules;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.init();
|
|
7
|
-
}
|
|
8
|
-
init() {
|
|
9
|
-
}
|
|
10
|
-
import(ModuleDir, dirname) {
|
|
11
|
-
const _Import = (ModuleDir, dirname) => {
|
|
12
|
-
const foundModule = this.modules[key];
|
|
13
|
-
if (foundModule) {
|
|
14
|
-
if (foundModule.isLoad)
|
|
15
|
-
return foundModule.data;
|
|
16
|
-
foundModule.Load();
|
|
17
|
-
return foundModule.data;
|
|
18
|
-
}
|
|
19
|
-
throw new Error(`Cannot find module '${ModuleDir}'`);
|
|
20
|
-
};
|
|
21
|
-
_Import(ModuleDir, dirname);
|
|
22
|
-
}
|
|
23
|
-
HandlerModule(id, fn) {
|
|
24
|
-
if (typeof fn !== "function" || typeof name !== "")
|
|
25
|
-
throw new Error("Cannot create Module");
|
|
26
|
-
this.modules[id] = {
|
|
27
|
-
fn: fn,
|
|
28
|
-
isLoad: false,
|
|
29
|
-
Load() {
|
|
30
|
-
if (isLoad)
|
|
31
|
-
return;
|
|
32
|
-
const __Module = {
|
|
33
|
-
export: {},
|
|
34
|
-
currenyId: id
|
|
35
|
-
};
|
|
36
|
-
fn(__Module);
|
|
37
|
-
this.data = exp;
|
|
38
|
-
this.isLoad = true;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class Module{modules;constructor(){this.init()}init(){}import(e,o){(e=>{const o=this.modules[key];if(o)return o.isLoad||o.Load(),o.data;throw new Error(`Cannot find module '${e}'`)})(e)}HandlerModule(e,o){if("function"!=typeof o||""!=typeof name)throw new Error("Cannot create Module");this.modules[e]={fn:o,isLoad:!1,Load(){if(isLoad)return;o({export:{},currenyId:e}),this.data=exp,this.isLoad=!0}}}}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|