@mbler/mcx-core 0.1.3-rc.2 → 0.1.3-rc.4

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/dist/index.js CHANGED
@@ -101,7 +101,7 @@ var McxAst = class McxAst {
101
101
  attrs[key] = getExpressionContent(dir.exp);
102
102
  } else if (dir.name === "on") {
103
103
  const key = `@${getExpressionContent(dir.arg)}`;
104
- attrs[key] = "true";
104
+ attrs[key] = getExpressionContent(dir.exp);
105
105
  }
106
106
  }
107
107
  const children = this.convertVueChildren(node.children);
@@ -1012,6 +1012,7 @@ function processHooks(code) {
1012
1012
 
1013
1013
  //#endregion
1014
1014
  //#region src/transforms/transform/layout.ts
1015
+ const SETUP_CTX_INDEX = 0;
1015
1016
  /**
1016
1017
  * Shared layout generation for both <Form> and <Ui>.
1017
1018
  * Generates layout config with (s) => expr functions for content and params.
@@ -1021,35 +1022,38 @@ function generateLayout(ctx, tagNode, tagName, mode) {
1021
1022
  const parsedObj = [];
1022
1023
  const typeTags = [];
1023
1024
  const elements = [];
1024
- for (const child of tagNode.content) {
1025
- if (child.type !== "TagNode") continue;
1026
- if (child.content.some((i) => i.type === "TagNode")) internalCtx.rollupContext.error(`[${tagName}]: can't support nested elements`, child.loc ? {
1027
- column: child.loc.start.column,
1028
- line: child.loc.start.line
1029
- } : void 0);
1030
- let _for;
1031
- if (typeof child.arr.for === "string") {
1032
- const match = child.arr.for.match(/^(\w+)\s+in\s+(\w+)$/);
1033
- if (match) _for = {
1034
- variable: match[1],
1035
- useSetup: match[2]
1036
- };
1037
- else internalCtx.rollupContext.error(`[${tagName}]: invalid for syntax, expected 'variable in propName'`, child.loc ? {
1038
- column: child.loc.start.column,
1039
- line: child.loc.start.line
1040
- } : void 0);
1025
+ function collectElements(node) {
1026
+ for (const child of node.content) {
1027
+ if (child.type !== "TagNode") continue;
1028
+ if (child.content.some((i) => i.type === "TagNode")) {
1029
+ collectElements(child);
1030
+ continue;
1031
+ }
1032
+ let _for;
1033
+ if (typeof child.arr.for === "string") {
1034
+ const match = child.arr.for.match(/^(\w+)\s+(?:in|of)\s+(\w+)$/);
1035
+ if (match) _for = {
1036
+ variable: match[1],
1037
+ useSetup: match[2]
1038
+ };
1039
+ else internalCtx.rollupContext.error(`[${tagName}]: invalid for syntax, expected 'variable in|of propName'`, child.loc ? {
1040
+ column: child.loc.start.column,
1041
+ line: child.loc.start.line
1042
+ } : void 0);
1043
+ }
1044
+ let _if;
1045
+ if (typeof child.arr.if === "string") _if = { useSetup: child.arr.if };
1046
+ elements.push({
1047
+ arr: child.arr,
1048
+ content: child.content.map((i) => i.type === "TagContent" && i.data || "").join(""),
1049
+ type: child.name,
1050
+ loc: child.loc,
1051
+ ..._for ? { for: _for } : {},
1052
+ ..._if ? { if: _if } : {}
1053
+ });
1041
1054
  }
1042
- let _if;
1043
- if (typeof child.arr.if === "string") _if = { useSetup: child.arr.if };
1044
- elements.push({
1045
- arr: child.arr,
1046
- content: child.content.map((i) => i.type === "TagContent" && i.data || "").join(""),
1047
- type: child.name,
1048
- loc: child.loc,
1049
- ..._for ? { for: _for } : {},
1050
- ..._if ? { if: _if } : {}
1051
- });
1052
1055
  }
1056
+ collectElements(tagNode);
1053
1057
  for (const el of elements) {
1054
1058
  const name = el.type;
1055
1059
  const cleanedArr = { ...el.arr };
@@ -1080,16 +1084,25 @@ function generateLayout(ctx, tagNode, tagName, mode) {
1080
1084
  if (el.if) props.push(t.objectProperty(t.identifier("if"), t.objectExpression([t.objectProperty(t.identifier("useSetup"), t.stringLiteral(el.if.useSetup))])));
1081
1085
  parsedObj.push(t.objectExpression(props));
1082
1086
  }
1083
- let formTypeStr = "ActionFormData";
1084
- if (typeTags.some((t) => [
1085
- "input",
1086
- "dropdown",
1087
- "submit",
1088
- "toggle",
1089
- "slider"
1090
- ].includes(t))) formTypeStr = "ModalFormData";
1091
- else if (typeTags.some((t) => t === "button-m")) formTypeStr = "MessageFormData";
1092
- else if (typeTags.some((t) => t === "button")) formTypeStr = "ActionFormData";
1087
+ let formTypeStr;
1088
+ const explicitType = tagNode.arr.type;
1089
+ if (typeof explicitType === "string") formTypeStr = {
1090
+ modal: "ModalFormData",
1091
+ action: "ActionFormData",
1092
+ message: "MessageFormData"
1093
+ }[explicitType] || "ActionFormData";
1094
+ else {
1095
+ formTypeStr = "ActionFormData";
1096
+ if (typeTags.some((t) => [
1097
+ "input",
1098
+ "dropdown",
1099
+ "submit",
1100
+ "toggle",
1101
+ "slider"
1102
+ ].includes(t))) formTypeStr = "ModalFormData";
1103
+ else if (typeTags.some((t) => t === "button-m")) formTypeStr = "MessageFormData";
1104
+ else if (typeTags.some((t) => t === "button")) formTypeStr = "ActionFormData";
1105
+ }
1093
1106
  return {
1094
1107
  parsedObj,
1095
1108
  formTypeStr
@@ -1212,13 +1225,23 @@ function splitInterpolation(raw) {
1212
1225
  });
1213
1226
  return result;
1214
1227
  }
1215
- /** "a.b.c" → __ctx[0].a.b.c */
1228
+ /** "a.b.c" → __ctx[SETUP_CTX_INDEX].a.b.c */
1216
1229
  function dotAccess(expr, root) {
1217
1230
  const parts = expr.split(".");
1218
- let node = t.memberExpression(root, t.numericLiteral(0), true);
1231
+ let node = t.memberExpression(root, t.numericLiteral(SETUP_CTX_INDEX), true);
1219
1232
  for (const part of parts) node = t.memberExpression(node, t.identifier(part));
1220
1233
  return node;
1221
1234
  }
1235
+ /** Build the shared config object expression for both <Ui> and <Form> transforms */
1236
+ function buildUIConfig(ctx, tagNode, tagName, mode) {
1237
+ const { parsedObj, formTypeStr } = generateLayout(ctx, tagNode, tagName, mode);
1238
+ return t.objectExpression([
1239
+ t.objectProperty(t.identifier("mode"), t.stringLiteral(mode)),
1240
+ t.objectProperty(t.identifier("layout"), t.arrayExpression(parsedObj)),
1241
+ t.objectProperty(t.identifier("use"), t.memberExpression(t.identifier("__minecraft__ui"), t.identifier(formTypeStr))),
1242
+ t.objectProperty(t.identifier("UI"), t.identifier("__minecraft__ui"))
1243
+ ]);
1244
+ }
1222
1245
 
1223
1246
  //#endregion
1224
1247
  //#region src/transforms/transform/ui.ts
@@ -1226,13 +1249,7 @@ async function Comp$3(ctx) {
1226
1249
  ctx.impBody.push(t.importDeclaration([t.importSpecifier(t.identifier("__mcx__ui"), t.identifier("ui"))], t.stringLiteral("@mbler/mcx")), t.importDeclaration([t.importNamespaceSpecifier(t.identifier("__minecraft__ui"))], t.stringLiteral("@minecraft/server-ui")));
1227
1250
  const tagNode = ctx.ctx.compiledCode.strLoc.UI;
1228
1251
  if (!tagNode || tagNode.name !== "Ui") throw new Error("[UI Component]: why did parent not verify?");
1229
- const { parsedObj, formTypeStr } = generateLayout(ctx, tagNode, "Ui", "ui");
1230
- const configObj = t.objectExpression([
1231
- t.objectProperty(t.identifier("mode"), t.stringLiteral("ui")),
1232
- t.objectProperty(t.identifier("layout"), t.arrayExpression(parsedObj)),
1233
- t.objectProperty(t.identifier("use"), t.memberExpression(t.identifier("__minecraft__ui"), t.identifier(formTypeStr))),
1234
- t.objectProperty(t.identifier("UI"), t.identifier("__minecraft__ui"))
1235
- ]);
1252
+ const configObj = buildUIConfig(ctx, tagNode, "Ui", "ui");
1236
1253
  ctx.app([t.objectProperty(t.identifier("ui"), t.newExpression(t.identifier("__mcx__ui"), [configObj, t.identifier(config_default.scriptCompileFn)]))]);
1237
1254
  }
1238
1255
 
@@ -1242,13 +1259,7 @@ async function Comp$2(ctx) {
1242
1259
  ctx.impBody.push(t.importDeclaration([t.importSpecifier(t.identifier("__mcx__ui"), t.identifier("ui"))], t.stringLiteral("@mbler/mcx")), t.importDeclaration([t.importNamespaceSpecifier(t.identifier("__minecraft__ui"))], t.stringLiteral("@minecraft/server-ui")));
1243
1260
  const tagNode = ctx.ctx.compiledCode.strLoc.Form;
1244
1261
  if (!tagNode || tagNode.name !== "Form") throw new Error("[Form Component]: why did parent not verify?");
1245
- const { parsedObj, formTypeStr } = generateLayout(ctx, tagNode, "Form", "form");
1246
- const configObj = t.objectExpression([
1247
- t.objectProperty(t.identifier("mode"), t.stringLiteral("form")),
1248
- t.objectProperty(t.identifier("layout"), t.arrayExpression(parsedObj)),
1249
- t.objectProperty(t.identifier("use"), t.memberExpression(t.identifier("__minecraft__ui"), t.identifier(formTypeStr))),
1250
- t.objectProperty(t.identifier("UI"), t.identifier("__minecraft__ui"))
1251
- ]);
1262
+ const configObj = buildUIConfig(ctx, tagNode, "Form", "form");
1252
1263
  ctx.app([t.objectProperty(t.identifier("ui"), t.newExpression(t.identifier("__mcx__ui"), [configObj, t.identifier(config_default.scriptCompileFn)]))]);
1253
1264
  }
1254
1265
 
@@ -1760,6 +1771,10 @@ async function _transform(ctx) {
1760
1771
  const uiTag = ctx.compiledCode.strLoc.UI;
1761
1772
  const isSetupMode = formTag && formTag.arr.setup !== void 0 || uiTag && uiTag.arr.setup !== void 0;
1762
1773
  const modeType = formTag && formTag.arr.setup !== void 0 ? "form" : uiTag && uiTag.arr.setup !== void 0 ? "ui" : null;
1774
+ const hooks = isSetupMode ? processHooks(ctx.compiledCode.JSIR) : {
1775
+ startup: null,
1776
+ mounted: null
1777
+ };
1763
1778
  const _temp_main = generateMain(ctx.compiledCode.JSIR);
1764
1779
  const mainFn = ctx.mainFn.body = _temp_main[0];
1765
1780
  const prop = [];
@@ -1807,7 +1822,6 @@ async function _transform(ctx) {
1807
1822
  }
1808
1823
  for (const p of parseCtx.prop) if (t.isObjectProperty(p) && t.isIdentifier(p.key)) existingExportNames.add(p.key.name);
1809
1824
  const setupDecls = collectSetupDeclarations(ctx.compiledCode.JSIR, existingExportNames);
1810
- const hooks = processHooks(ctx.compiledCode.JSIR);
1811
1825
  const returnStmt = mainFn[mainFn.length - 1];
1812
1826
  if (t.isReturnStatement(returnStmt) && t.isObjectExpression(returnStmt.argument)) {
1813
1827
  returnStmt.argument.properties.push(...setupDecls);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["interpNode","AST_tag","AST_prop","Utils","CompileData.JsCompileData","Utils","CompileData.MCXCompileData","babelErr","Utils","config","McxUtils","Comp","config","Comp","config","Comp","config","config","EventComp","FormComp","UIComp","AppComp"],"sources":["../src/ast/tag.ts","../src/ast/prop.ts","../src/ast/index.ts","../src/compile-mcx/types.ts","../src/compile-mcx/compiler/compileData.ts","../src/compile-mcx/compiler/utils.ts","../src/compile-mcx/compiler/index.ts","../src/transforms/config.ts","../src/utils.ts","../src/transforms/file_id.ts","../src/transforms/utils.ts","../src/transforms/transform/layout.ts","../src/transforms/transform/ui.ts","../src/transforms/transform/form.ts","../src/transforms/transform/event.ts","../src/transforms/transform/app.ts","../src/mcx-component/cjsTransform.ts","../src/mcx-component/vm.ts","../src/mcx-component/index.ts","../src/transforms/main.ts","../src/transforms/index.ts","../src/compile-mcx/compiler/main.ts","../src/types.ts","../src/mcx-component/types.ts"],"sourcesContent":["import type {\n ParsedTagNode,\n ParsedTagContentNode,\n ParsedCommentNode,\n AttributeMap,\n TagToken,\n TagEndToken,\n} from '../types';\nimport {\n baseParse,\n NodeTypes,\n type RootNode,\n type TemplateChildNode,\n type BaseElementNode,\n type AttributeNode,\n type DirectiveNode,\n type TextNode,\n type CommentNode as VueCommentNode,\n type InterpolationNode,\n type SimpleExpressionNode,\n} from '@vue/compiler-core';\n\nfunction getExpressionContent(expr: { content?: string } | undefined): string {\n return expr?.content ?? 'true';\n}\n\n/** Convert absolute character offset in source to MCX position (line: 1-indexed, column: 0-indexed) */\nfunction absOffsetToMCXPos(\n source: string,\n absOffset: number,\n): { line: number; column: number } {\n let line = 1;\n let col = 0;\n const len = Math.min(absOffset, source.length);\n for (let i = 0; i < len; i++) {\n if (source.charCodeAt(i) === 10) {\n line++;\n col = 0;\n } else {\n col++;\n }\n }\n return { line, column: col };\n}\n\nexport default class McxAst {\n private text: string;\n private includeComments: boolean;\n\n constructor(text: string, includeComments: boolean = false) {\n this.text = text;\n this.includeComments = includeComments;\n }\n\n parseAST(): ParsedTagNode[] {\n const ast: RootNode = baseParse(this.text, {\n comments: true,\n whitespace: 'preserve',\n });\n const result: ParsedTagNode[] = [];\n for (const child of ast.children) {\n const node = this.convertTemplateChild(child);\n if (node && node.type === 'TagNode') result.push(node);\n }\n return result;\n }\n\n private convertTemplateChild(\n node: TemplateChildNode,\n ): ParsedTagNode | ParsedTagContentNode | ParsedCommentNode | null {\n if (node.type === NodeTypes.ELEMENT) {\n return this.convertVueElement(node as BaseElementNode);\n }\n if (node.type === NodeTypes.TEXT) {\n const textNode = node as TextNode;\n if (textNode.content.trim()) {\n return { data: textNode.content, type: 'TagContent' };\n }\n return null;\n }\n if (node.type === NodeTypes.INTERPOLATION) {\n const interpNode = node as InterpolationNode;\n return {\n data: `{{ ${getExpressionContent(interpNode.content as SimpleExpressionNode)} }}`,\n type: 'TagContent',\n };\n }\n if (this.includeComments && node.type === NodeTypes.COMMENT) {\n const commentNode = node as VueCommentNode;\n return {\n data: commentNode.content,\n type: 'Comment',\n loc: {\n start: {\n line: commentNode.loc.start.line,\n column: commentNode.loc.start.column,\n },\n end: {\n line: commentNode.loc.end.line,\n column: commentNode.loc.end.column,\n },\n },\n };\n }\n return null;\n }\n\n private convertVueElement(node: BaseElementNode): ParsedTagNode {\n const attrs: AttributeMap = {};\n for (const prop of node.props) {\n if (prop.type === NodeTypes.ATTRIBUTE) {\n const attr = prop as AttributeNode;\n attrs[attr.name] = attr.value?.content ?? 'true';\n } else if (prop.type === NodeTypes.DIRECTIVE) {\n const dir = prop as DirectiveNode;\n if (dir.name === 'bind') {\n const key = `:${getExpressionContent(dir.arg as SimpleExpressionNode)}`;\n attrs[key] = getExpressionContent(dir.exp as SimpleExpressionNode);\n } else if (dir.name === 'on') {\n const key = `@${getExpressionContent(dir.arg as SimpleExpressionNode)}`;\n attrs[key] = 'true';\n }\n }\n }\n const children = this.convertVueChildren(node.children);\n\n const fullSource = this.text;\n const baseOffset = node.loc.start.offset;\n const elementSource = node.loc.source;\n\n // Find the end of the opening tag (first unquoted >)\n let openEnd = elementSource.length;\n let inQuote: string | null = null;\n for (let i = 0; i < elementSource.length; i++) {\n const c = elementSource[i];\n if (inQuote) {\n if (c === '\\\\') {\n i++;\n continue;\n }\n if (c === inQuote) inQuote = null;\n } else if (c === '\"' || c === \"'\") {\n inQuote = c;\n } else if (c === '>') {\n openEnd = i + 1;\n break;\n }\n }\n\n // Find the start of the closing tag (last </)\n let closeStart = -1;\n if (!node.isSelfClosing) {\n for (let i = elementSource.length - 2; i >= 0; i--) {\n if (elementSource[i] === '<' && elementSource[i + 1] === '/') {\n closeStart = i;\n break;\n }\n }\n }\n\n const openTagStartAbs = baseOffset;\n const openTagEndAbs = baseOffset + openEnd;\n\n let endToken: TagEndToken | null = null;\n if (closeStart >= 0) {\n const closeTagStartAbs = baseOffset + closeStart;\n const closeTagEndAbs = baseOffset + elementSource.length;\n endToken = {\n data: elementSource.slice(closeStart),\n type: 'TagEnd',\n start: absOffsetToMCXPos(fullSource, closeTagStartAbs),\n end: absOffsetToMCXPos(fullSource, closeTagEndAbs),\n };\n }\n\n return {\n start: {\n data: elementSource.slice(0, openEnd),\n type: 'Tag',\n start: absOffsetToMCXPos(fullSource, openTagStartAbs),\n end: absOffsetToMCXPos(fullSource, openTagEndAbs),\n },\n name: node.tag,\n arr: attrs,\n content: children,\n end: endToken,\n loc: {\n start: {\n line: node.loc.start.line,\n column: node.loc.start.column,\n },\n end: {\n line: node.loc.end.line,\n column: node.loc.end.column,\n },\n },\n type: 'TagNode',\n };\n }\n\n private convertVueChildren(\n children: TemplateChildNode[],\n ): (ParsedTagNode | ParsedTagContentNode | ParsedCommentNode)[] {\n const result: (ParsedTagNode | ParsedTagContentNode | ParsedCommentNode)[] =\n [];\n for (const child of children) {\n const node = this.convertTemplateChild(child);\n if (node) result.push(node);\n }\n return result;\n }\n\n static generateCode(node: ParsedTagNode): string {\n let code = `<${node.name}`;\n for (const [key, value] of Object.entries(node.arr || {})) {\n if (value === 'true') {\n code += ` ${key}`;\n } else {\n code += ` ${key}=${String(value)}`;\n }\n }\n code += '>';\n const contentArr = node.content;\n if (Array.isArray(contentArr)) {\n for (const item of contentArr) {\n if ((item as ParsedTagContentNode).type === 'TagContent') {\n code += (item as ParsedTagContentNode).data;\n } else if ((item as ParsedCommentNode).type === 'Comment') {\n code += (item as ParsedCommentNode).data;\n } else {\n code += McxAst.generateCode(item as ParsedTagNode);\n }\n }\n }\n code += `</${node.name}>`;\n return code;\n }\n}\n\nexport { MCXUtils };\nclass MCXUtils {\n static isTagNode(node: unknown): node is ParsedTagNode {\n return (\n !!node &&\n typeof node === 'object' &&\n 'start' in (node as object) &&\n 'name' in (node as object) &&\n 'arr' in (node as object) &&\n 'content' in (node as object) &&\n 'end' in (node as object)\n );\n }\n static isTagContentNode(node: unknown): node is ParsedTagContentNode {\n return (\n !!node &&\n typeof node === 'object' &&\n 'data' in (node as object) &&\n 'type' in (node as object) &&\n (node as ParsedTagContentNode).type === 'TagContent'\n );\n }\n static isCommentNode(node: unknown): node is ParsedCommentNode {\n return (\n !!node &&\n typeof node === 'object' &&\n 'data' in (node as object) &&\n 'type' in (node as object) &&\n 'loc' in (node as object) &&\n (node as ParsedCommentNode).type === 'Comment'\n );\n }\n static isAttributeMap(obj: unknown): obj is AttributeMap {\n return !!obj && typeof obj === 'object' && !Array.isArray(obj);\n }\n static isParseNode(node: unknown): node is ParsedTagNode[] {\n return Array.isArray(node) && (node as unknown[]).every(MCXUtils.isTagNode);\n }\n static isToken(_obj: unknown): boolean {\n return false;\n }\n static isTagToken(_obj: unknown): boolean {\n return false;\n }\n static isTagEndToken(_obj: unknown): boolean {\n return false;\n }\n static isContentToken(_obj: unknown): boolean {\n return false;\n }\n static isCommentToken(_obj: unknown): boolean {\n return false;\n }\n static isBaseToken(_obj: unknown): boolean {\n return false;\n }\n static isTokenType(_value: unknown): boolean {\n return false;\n }\n}\n","import type { PropNode, PropValue } from '../types.js';\n\nconst STATUS = [0, 1]; // 0: key,1: value\n\nexport class Lexer {\n private code: string;\n\n constructor(code: string) {\n this.code = code;\n }\n *tokenize(): IterableIterator<PropNode> {\n let currStatus = STATUS[0]; // 0: key,1: value\n let key = '';\n let value = '';\n let hasEquals = false;\n\n for (const char of this.code) {\n if (/\\s/.test(char)) {\n if (char === '\\n') {\n if (currStatus === STATUS[1] && key && value) {\n const propNode: PropNode = {\n key,\n value: this.HandlerValue(value),\n type: 'PropChar',\n };\n yield propNode;\n } else if (currStatus === STATUS[0] && key) {\n }\n key = '';\n value = '';\n hasEquals = false;\n currStatus = STATUS[0];\n }\n continue; // 跳过所有空白字符\n }\n\n if (char === '=') {\n if (currStatus === STATUS[0]) {\n currStatus = STATUS[1]; // set to value\n hasEquals = true;\n }\n } else {\n if (currStatus === STATUS[0]) {\n key += char; // key\n } else if (currStatus === STATUS[1]) {\n value += char; // value\n }\n }\n }\n if (key && value) {\n const propNode: PropNode = {\n key,\n value: this.HandlerValue(value),\n type: 'PropChar',\n };\n yield propNode;\n }\n }\n HandlerValue(value: string): PropValue {\n const num = Number(value);\n if (!Number.isNaN(num)) return num;\n if (\n ['[', '{'].includes(value.slice(0, 1)) &&\n [']', '}'].includes(value.slice(-1))\n ) {\n return JSON.parse(value);\n }\n return value;\n }\n}\nexport default function PropParser(code: string): PropNode[] {\n const lexer = new Lexer(code);\n return Array.from(lexer.tokenize());\n}\n","import AST_tag from './tag.js';\nimport AST_prop from './prop.js';\nexport default {\n tag: AST_tag,\n prop: AST_prop,\n};\n","import type {\n ImportDeclaration,\n ExportAllDeclaration,\n ExportDefaultDeclaration,\n ExportNamedDeclaration,\n Expression,\n SpreadElement,\n ArgumentPlaceholder,\n CallExpression,\n} from '@babel/types';\nimport { CompileOpt } from '@mbler/mcx-types';\nimport { ParsedTagNode } from '../types';\ninterface callList {\n source: Expression;\n set: (callEXp: CallExpression) => boolean;\n arguments: Array<SpreadElement | Expression | ArgumentPlaceholder>;\n remove: () => void;\n}\ninterface ImportListImport {\n isAll: boolean;\n import?: string | undefined;\n as: string;\n}\ninterface ImportList {\n source: string;\n imported: ImportListImport[];\n raw?: ImportDeclaration;\n}\ninterface BuildCache {\n call: callList[];\n import: ImportList[];\n export: Array<\n ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration\n >;\n}\nexport const _MCXstructureLocComponentTypes = {\n items: 'item',\n blocks: 'block',\n entities: 'entity',\n} as const;\ntype MCXstructureLocComponentType =\n (typeof _MCXstructureLocComponentTypes)[keyof typeof _MCXstructureLocComponentTypes];\ninterface MCXstructureLoc {\n script: string;\n Event: {\n on: 'after' | 'before';\n subscribe: Record<string, string>;\n loc: { line: number; column: number };\n isLoad: boolean;\n };\n Component: Record<\n string,\n {\n type: MCXstructureLocComponentType;\n useExpore: string;\n loc: { line: number; column: number };\n }\n >;\n UI: ParsedTagNode | null;\n Form: ParsedTagNode | null;\n}\nexport type {\n BuildCache,\n ImportList,\n ImportListImport,\n callList,\n CompileOpt,\n MCXstructureLoc,\n MCXstructureLocComponentType,\n};\n","import * as t from '@babel/types';\nimport { BuildCache, MCXstructureLoc } from '../types';\nimport { ParsedTagNode } from '../../types';\nexport class JsCompileData {\n File: string = '__repl';\n isFile: boolean = false;\n constructor(\n public node: t.Program,\n public BuildCache: BuildCache = {\n export: [],\n import: [],\n call: [],\n },\n ) {}\n setFilePath(dir: string) {\n this.isFile = true;\n this.File = dir;\n }\n}\nexport class MCXCompileData {\n File: string = '';\n isFile: boolean = false;\n constructor(\n public raw: ParsedTagNode[],\n public JSIR: JsCompileData,\n public strLoc: MCXstructureLoc,\n ) {}\n setFilePath(dir: string) {\n this.JSIR.setFilePath(dir);\n this.isFile = true;\n this.File = dir;\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport * as Parser from '@babel/parser';\nimport { ImportList, ImportListImport } from '../types';\nimport * as t from '@babel/types';\nexport default class Utils {\n public static async FileAST(\n fileDir: string,\n parserOpt: Parser.ParserOptions,\n ): Promise<t.Program> {\n if (typeof fileDir !== 'string')\n throw new TypeError(\n '[read file]: compile utils was passed a non-string value',\n );\n const file = await readFile(fileDir, 'utf-8');\n if (typeof file !== 'string')\n throw new Error('[read file]: not found file ' + fileDir);\n try {\n return Parser.parse(file, parserOpt).program;\n } catch (err: unknown) {\n throw new Error(\n '[compiler]: babel error' +\n (err instanceof Error ? err.stack : String(err)),\n );\n }\n }\n public static async FileContent(fileDir: string): Promise<string> {\n const file = await readFile(fileDir, 'utf-8');\n return file;\n }\n private static nodeStringValue(node: t.Identifier | t.StringLiteral): string {\n if (node.type == 'StringLiteral') {\n return node.value;\n } else if (node.type == 'Identifier') {\n return node.name;\n }\n throw new TypeError('[read id error]: no way to read string id');\n }\n private static CheckImportNode(\n node: t.ImportDeclaration,\n ir: ImportList,\n ): boolean {\n const newList = Utils.ImportToCache(node);\n // Eliminate common differences\n if (newList.source !== ir.source) return false;\n if (newList.imported.length !== ir.imported.length) return false;\n // in this for, newList.imported and ir.imported is same length\n for (let irIndex = 0; irIndex < newList.imported.length; irIndex++) {\n const newItem = newList.imported[irIndex];\n const oldItem = ir.imported[irIndex];\n if (\n newItem?.import !== oldItem?.import ||\n newItem?.as !== oldItem?.as ||\n newItem?.isAll !== oldItem?.isAll\n )\n return false;\n }\n return true;\n }\n public static CacheToImportNode(ir: ImportList): t.ImportDeclaration {\n if (!ir) throw new TypeError('plase call use right ImportList');\n // first verify ir.raw\n if (ir?.raw && Utils.CheckImportNode(ir?.raw, ir)) return ir.raw;\n const result: Array<\n t.ImportNamespaceSpecifier | t.ImportSpecifier | t.ImportDefaultSpecifier\n > = [];\n for (const ImportIt of ir.imported) {\n if (!ImportIt) continue;\n if (ImportIt.isAll) {\n result.push(t.importNamespaceSpecifier(t.identifier(ImportIt.as)));\n continue;\n }\n if (ImportIt.import == 'default') {\n result.push(t.importDefaultSpecifier(t.identifier(ImportIt.as)));\n continue;\n }\n if (!ImportIt.import)\n throw new TypeError('[compile node]: not found imported');\n result.push(\n t.importSpecifier(\n t.identifier(ImportIt.as),\n t.identifier(ImportIt.import),\n ),\n );\n }\n return t.importDeclaration(result, t.stringLiteral(ir.source));\n }\n public static ImportToCache(node: t.ImportDeclaration): ImportList {\n const result: ImportListImport[] = [];\n for (const item of node.specifiers) {\n const thisName = item.local.name;\n if (item.type == 'ImportNamespaceSpecifier') {\n result.push({\n isAll: true,\n as: thisName,\n });\n } else if (item.type == 'ImportDefaultSpecifier') {\n result.push({\n isAll: false,\n import: 'default',\n as: thisName,\n });\n } else if (item.type == 'ImportSpecifier') {\n result.push({\n isAll: false,\n as: thisName,\n import: Utils.nodeStringValue(item.imported),\n });\n }\n }\n return {\n source: Utils.nodeStringValue(node.source),\n imported: result,\n };\n }\n}\n","import * as t from '@babel/types';\nimport {\n _MCXstructureLocComponentTypes,\n ImportList,\n ImportListImport,\n MCXstructureLoc,\n MCXstructureLocComponentType,\n} from '../types';\nimport * as CompileData from './compileData';\nimport Utils from './utils';\nimport { parse } from '@babel/parser';\nimport { ParsedTagContentNode, ParsedTagNode } from '../../types';\nimport McxAst, { MCXUtils } from '../../ast/tag';\nimport PropParser from '../../ast/prop';\nimport ts from 'typescript';\nexport class CompileError extends Error {\n public loc: { line: number; column: number };\n constructor(message: string, loc: { line: number; column: number }) {\n super(message);\n this.name = 'CompileError';\n this.loc = loc || { line: -1, column: -1 };\n }\n}\n\nfunction extractLoc(node: unknown): { line: number; column: number } {\n if (!node || typeof node !== 'object') return { line: -1, column: -1 };\n const n = node as Record<string, unknown>;\n const loc = n.loc as Record<string, unknown> | undefined;\n // Node with loc.start (Babel or MCX): prefer column\n if (loc?.start) {\n const start = loc.start as Record<string, unknown>;\n const line = typeof start.line === 'number' ? start.line : -1;\n const column = typeof start.column === 'number' ? start.column : -1;\n return { line, column };\n } else if (loc && loc.column !== undefined) {\n return {\n line: typeof loc.line === 'number' ? loc.line : -1,\n column: loc.column as number,\n };\n }\n // MCX Token with unified position: start: { line, column }\n const start = n.start as Record<string, unknown> | undefined;\n if (start && typeof start.line === 'number') {\n return {\n line: start.line,\n column: typeof start.column === 'number' ? (start.column as number) : -1,\n };\n }\n return { line: -1, column: -1 };\n}\n\nfunction makeError(msg: string, node?: unknown) {\n return new CompileError(msg, extractLoc(node));\n}\ninterface ImportTemp {\n source: string;\n import?: string | undefined;\n isAll: boolean;\n}\nexport type Context = Record<string, t.Expression | { status: 'wait' }>;\nexport class CompileJS {\n constructor(public node: t.Program) {\n if (!t.isProgram(node))\n throw makeError(\n \"[compile error]: jsCompile can't work in a not program\",\n node,\n );\n this.CompileData = new CompileData.JsCompileData(node);\n this.run();\n this.writeBuildCache();\n }\n public TopContext: Context = {};\n private indexTemp: Record<string, ImportTemp> = {};\n private push(source: ImportList) {\n for (const node of source.imported) {\n this.indexTemp[node.as] = {\n source: source.source,\n import: node.import,\n isAll: node.isAll,\n };\n }\n }\n private writeBuildCache() {\n const build: ImportList[] = [];\n for (const [as, data] of Object.entries(this.indexTemp)) {\n let found = false;\n for (const i of build) {\n if (i.source === data.source) {\n i.imported.push({ as, isAll: data.isAll, import: data.import });\n found = true;\n break;\n }\n }\n if (!found) {\n build.push({\n source: data.source,\n imported: [{ as, import: data.import, isAll: data.isAll }],\n });\n }\n }\n this.CompileData.BuildCache.import = build;\n }\n private CompileData: CompileData.JsCompileData;\n public getCompileData(): CompileData.JsCompileData {\n return this.CompileData;\n }\n\n private tre(node: t.Block, ExtendContext: Context = {}): void {\n if (!t.isBlock(node))\n throw makeError(\"[compile error]: can't for in not block node\", node);\n const isTop: boolean = t.isProgram(node);\n const currenyContext: Context = isTop ? this.TopContext : ExtendContext;\n for (let index = 0; index < node.body.length; index++) {\n const item = node.body[index];\n const remove = () => {\n node.body.splice(index, 1);\n index--;\n };\n if (!item) continue;\n if (item.type == 'ImportDeclaration') {\n if (!isTop)\n throw makeError(\n '[compile node]: import declaration must use in top.',\n item,\n );\n this.push(Utils.ImportToCache(item));\n remove();\n } else if (item.type == 'BlockStatement') {\n this.tre(item, currenyContext);\n } else if (\n item.type == 'BreakStatement' ||\n item.type == 'EmptyStatement' ||\n item.type == 'ContinueStatement' ||\n item.type == 'ThrowStatement' ||\n item.type == 'WithStatement'\n ) {\n continue;\n } else if (item.type == 'TryStatement') {\n this.tre(item.block, currenyContext);\n } else if (item.type == 'IfStatement') {\n const nodes: t.Statement[] = [item.consequent];\n if (item.alternate) nodes.push(item.alternate);\n this.tre(t.blockStatement(nodes), currenyContext);\n } else if (item.type == 'WhileStatement') {\n this.tre(t.blockStatement([item.body]), currenyContext);\n } else if (item.type == 'ClassDeclaration') {\n if (item.superClass) {\n const superClass = item.superClass;\n if (\n superClass.type == 'ArrayExpression' ||\n superClass.type == 'BooleanLiteral' ||\n superClass.type == 'BinaryExpression' ||\n superClass.type == 'ThisExpression' ||\n superClass.type == 'ArrowFunctionExpression' ||\n superClass.type == 'BigIntLiteral' ||\n superClass.type == 'NumericLiteral' ||\n superClass.type == 'NullLiteral' ||\n superClass.type == 'AssignmentExpression' ||\n superClass.type == 'Super' ||\n superClass.type == 'NewExpression' ||\n superClass.type == 'DoExpression' ||\n superClass.type == 'StringLiteral' ||\n superClass.type == 'YieldExpression' ||\n superClass.type == 'RecordExpression' ||\n superClass.type == 'RegExpLiteral' ||\n superClass.type == 'DecimalLiteral' ||\n superClass.type == 'BindExpression'\n )\n throw makeError(\n \"[compilr error]: class can't extends a not constructor or null\",\n superClass,\n );\n }\n } else if (item.type == 'DoWhileStatement') {\n this.tre(t.blockStatement([item.body]));\n } else if (item.type == 'VariableDeclaration') {\n const declaration = item.declarations;\n for (const varDef of declaration) {\n const init = varDef.init;\n const id = varDef.id;\n if (id.type == 'Identifier') {\n if (!init && (item.kind == 'let' || item.kind == 'var'))\n currenyContext[id.name] = {\n status: 'wait',\n };\n if (!init)\n throw makeError(\n \"[compilr node]: 'const' must has a init\",\n varDef,\n );\n currenyContext[id.name] = init;\n if (\n init &&\n t.isCallExpression(init) &&\n t.isIdentifier(init.callee) &&\n init.callee.name === 'require' &&\n init.arguments.length > 0 &&\n t.isStringLiteral(init.arguments[0])\n ) {\n this.indexTemp[id.name] = {\n source: (init.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n } else if (\n init &&\n t.isCallExpression(init) &&\n t.isImport(init.callee) &&\n init.arguments.length > 0 &&\n t.isStringLiteral(init.arguments[0])\n ) {\n this.indexTemp[id.name] = {\n source: (init.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n }\n }\n }\n } else if (item.type == 'ReturnStatement') {\n continue;\n } else if (\n item.type == 'ExportAllDeclaration' ||\n item.type == 'ExportDefaultDeclaration' ||\n item.type == 'ExportNamedDeclaration'\n ) {\n if (!isTop) {\n throw makeError(\"[compiler]: export node can't in not top\", item);\n }\n this.CompileData.BuildCache.export.push(item);\n remove();\n } else if (item.type == 'SwitchStatement') {\n for (const caseItem of item.cases) {\n this.tre(t.blockStatement(caseItem.consequent), currenyContext);\n }\n } else if (item.type == 'ExpressionStatement') {\n const expr = item.expression;\n if (\n t.isCallExpression(expr) &&\n t.isIdentifier(expr.callee) &&\n expr.callee.name === 'require' &&\n expr.arguments.length > 0 &&\n t.isStringLiteral(expr.arguments[0])\n ) {\n this.indexTemp[\n `__require_${(expr.arguments[0] as t.StringLiteral).value}`\n ] = {\n source: (expr.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n } else if (\n t.isCallExpression(expr) &&\n t.isImport(expr.callee) &&\n expr.arguments.length > 0 &&\n t.isStringLiteral(expr.arguments[0])\n ) {\n this.indexTemp[\n `__import_${(expr.arguments[0] as t.StringLiteral).value}`\n ] = {\n source: (expr.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n }\n } else if (item.type == 'FunctionDeclaration') {\n const funcBody = item.body;\n this.tre(funcBody, currenyContext);\n }\n }\n }\n run() {\n if (!t.isBlock(this.node))\n throw makeError(\"[compile error]: can't for a not block\", this.node);\n this.tre(this.node);\n }\n}\nclass CompileMCX {\n constructor(public code: string) {\n const mcxCode = new McxAst(code).parseAST();\n if (!MCXUtils.isParseNode(mcxCode))\n throw makeError(\n \"[compile error]: mcxCompile can't work in a not mcxNode\",\n );\n this.mcxCode = mcxCode;\n this.structureCheck();\n const JSIR = this.generateJSIR();\n this.CompileData = new CompileData.MCXCompileData(\n mcxCode,\n JSIR,\n this.tempLoc,\n );\n }\n private mcxCode: ParsedTagNode[];\n private tempLoc: MCXstructureLoc = {\n script: '',\n Event: {\n on: 'after',\n subscribe: {},\n loc: { line: -1, column: -1 },\n isLoad: false,\n },\n Component: {},\n UI: null,\n Form: null,\n };\n public getCompileData(): CompileData.MCXCompileData {\n return this.CompileData;\n }\n private checkComponentName(\n name: string,\n ): name is MCXstructureLocComponentType {\n return (Object.values(_MCXstructureLocComponentTypes) as string[]).includes(\n name,\n );\n }\n private checkComponentParentName(\n name: string,\n ): name is keyof typeof _MCXstructureLocComponentTypes {\n return Object.keys(_MCXstructureLocComponentTypes).includes(name);\n }\n private commonTagNodeContent(\n node: ParsedTagNode | ParsedTagContentNode,\n ): string {\n if (MCXUtils.isTagContentNode(node)) {\n return node.data;\n }\n if (MCXUtils.isTagNode(node)) {\n return node.content\n .map(sub =>\n sub.type !== 'Comment' ? this.commonTagNodeContent(sub) : '',\n )\n .join('');\n }\n throw makeError('[mcx compile]: internal error: unknown node type', node);\n }\n private getEventOn(node: ParsedTagNode): 'before' | 'after' {\n if (!MCXUtils.isTagNode(node))\n throw makeError('[mcx compile]: internal error: not tag node', node);\n let on: 'before' | 'after' = 'after';\n const isAfter = typeof node.arr['@after'] == 'string';\n const isBefore = typeof node.arr['@before'] == 'string';\n if (isAfter && isBefore)\n throw makeError(\n \"[mcx compile]: Event node can't has both @after and @before\",\n node,\n );\n if (isAfter) on = 'after';\n if (isBefore) on = 'before';\n return on;\n }\n private structureCheck() {\n let component: ParsedTagNode | null = null;\n const temp: {\n script: string;\n ui: ParsedTagNode | null;\n form: ParsedTagNode | null;\n Event: ParsedTagNode | null;\n Component: Record<MCXstructureLocComponentType, ParsedTagNode>;\n } = {\n script: '',\n Event: null,\n ui: null,\n form: null,\n Component: {} as Record<MCXstructureLocComponentType, ParsedTagNode>,\n };\n for (const node of this.mcxCode || []) {\n if (!MCXUtils.isTagNode(node)) continue;\n if (node.name == 'script') {\n if (temp.script)\n throw makeError('[compile error]: duplicate script node', node);\n const scriptNode =\n node.content.length == 0 ? '' : this.commonTagNodeContent(node);\n let code = scriptNode;\n if (node.arr.lang == 'ts') {\n code = ts.transpileModule(scriptNode, {\n compilerOptions: {\n target: ts.ScriptTarget.ES2024,\n module: ts.ModuleKind.ESNext,\n },\n }).outputText;\n }\n temp.script = code;\n } else if (node.name == 'Event') {\n if (temp.Event)\n throw makeError('[compile error]: duplicate Event node', node);\n // if Component already discovered, report error\n if (component)\n throw makeError(\n '[compile error]: Event node cannot appear after Component',\n node,\n );\n temp.Event = node;\n } else if (node.name == 'Component') {\n if (component)\n throw makeError('[compile error]: duplicate Component node', node);\n // if Event already discovered, report error\n if (temp.Event)\n throw makeError(\n '[compile error]: Component node cannot appear after Event',\n node,\n );\n if (temp.ui)\n throw makeError(\n \"[compile error]: Component node can't use with UI node\",\n );\n component = node;\n } else if (node.name == 'Ui') {\n if (component || temp.Event || temp.ui)\n throw makeError(\n \"[compile error]: UI node can't use with component or event or other ui node\",\n node,\n );\n temp.ui = node;\n } else if (node.name == 'Form') {\n if (component || temp.Event || temp.form || temp.ui)\n throw makeError(\n \"[compile error]: Form node can't use with component, event, Ui, or other Form node\",\n node,\n );\n temp.form = node;\n }\n }\n if (!temp.script) throw makeError('[compile error]: mcx must has a script');\n this.tempLoc.script = temp.script;\n if (temp.Event) {\n const on = this.getEventOn(temp.Event);\n const content = temp.Event.content;\n if (\n content.length == 0 ||\n content.length > 1 ||\n !MCXUtils.isTagContentNode(content[0])\n )\n throw makeError(\n '[compile error]: Event node has invalid content',\n temp.Event,\n );\n const subscribeData = content[0].data.trim();\n this.tempLoc.Event = {\n on: on,\n subscribe: Object.fromEntries(\n PropParser(subscribeData).map(item => [\n item.key,\n item.value.toString(),\n ]),\n ),\n loc: extractLoc(temp.Event),\n isLoad: true,\n };\n }\n if (component) {\n for (const subNode of component.content || []) {\n if (!MCXUtils.isTagNode(subNode)) continue;\n const subName = subNode.name;\n // if is a valid component name\n this.handlerChildComponent(subNode);\n }\n }\n if (temp.ui) {\n this.tempLoc.UI = temp.ui;\n }\n if (temp.form) {\n this.tempLoc.Form = temp.form;\n }\n }\n // input: tag node,handler child node(如 items entities)\n private handlerChildComponent(node: ParsedTagNode): void {\n const name = node.name;\n if (!this.checkComponentParentName(name))\n throw makeError(`[compile error]: invalid component name: ${name}`, node);\n const content = node.content;\n if (!content || content.length == 0)\n throw makeError(\n `[compile error]: component ${name} has no content`,\n node,\n );\n for (const subNode of content) {\n if (!MCXUtils.isTagNode(subNode)) continue;\n const subName = subNode.name;\n const _id = subNode.arr.id;\n if (!_id || typeof _id != 'string' || _id.trim() == '') {\n throw makeError(\n `[compile error]: component ${name} child component ${subName} has no id`,\n subNode,\n );\n }\n const id = _id.trim();\n const content = subNode.content;\n if (content.length == 0) {\n throw makeError(\n `[compile error]: component ${name} child component ${subName} has no content`,\n subNode,\n );\n }\n if (!content[0] || !MCXUtils.isTagContentNode(content[0]))\n throw makeError(\n `[compile error]: component ${name} child component ${subName} has invalid content`,\n subNode,\n );\n const useExpore = content[0].data.trim();\n if (subName == _MCXstructureLocComponentTypes[name]) {\n this.tempLoc.Component[`${name}/${id}`] = {\n type: subName,\n useExpore: useExpore,\n loc: extractLoc(subNode),\n };\n }\n }\n }\n private CompileData: CompileData.MCXCompileData;\n private generateJSIR(): CompileData.JsCompileData {\n if (!this.tempLoc.script.trim())\n throw makeError('[compile error]: mcx must has a script');\n const comiler = compileJSFn(this.tempLoc.script);\n return comiler;\n }\n}\nexport const compileJSFn = ((code: string): CompileData.JsCompileData => {\n if (compileJSFn.cache[code]) return compileJSFn.cache[code];\n let parsedCode: t.File;\n try {\n parsedCode = parse(code, {\n sourceType: 'module',\n allowImportExportEverywhere: true,\n errorRecovery: true,\n allowAwaitOutsideFunction: true,\n allowReturnOutsideFunction: true,\n allowSuperOutsideMethod: true,\n });\n } catch (err: unknown) {\n if (err instanceof SyntaxError) {\n const babelErr = err as SyntaxError & {\n loc?: { column: number; line: number };\n };\n const loc = babelErr.loc ?? { column: -1, line: -1 };\n throw makeError(`[babel parse error]: ${err.message}`, {\n loc: { start: loc },\n });\n }\n throw makeError(`[parse error]: ${String(err)}`);\n }\n const comiler = new CompileJS(parsedCode.program);\n comiler.run();\n const data = comiler.getCompileData();\n compileJSFn.cache[code] = data;\n return data;\n}) as ((code: string) => CompileData.JsCompileData) & {\n cache: Record<string, CompileData.JsCompileData>;\n};\nexport const compileMCXFn = ((mcxCode: string): CompileData.MCXCompileData => {\n if (compileMCXFn.cache[mcxCode]) return compileMCXFn.cache[mcxCode];\n const compiler = new CompileMCX(mcxCode);\n const data = compiler.getCompileData();\n compileMCXFn.cache[mcxCode] = data;\n return data;\n}) as ((mcxCode: string) => CompileData.MCXCompileData) & {\n cache: Record<string, CompileData.MCXCompileData>;\n};\ncompileJSFn.cache = {};\ncompileMCXFn.cache = {};\nexport * from './compileData';\nexport { Utils as MCXNodeUtils };\n","export default {\n // script tag compile function name\n scriptCompileFn: '__main',\n // use event tag , import event as\n eventImported: '__mcx__event',\n eventVarName: '__use_event',\n eventExtendsName: 'McxExtendsBy',\n // paramName\n paramCtx: '__mcx__ctx',\n} as const;\n","import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport type { ReadFileOpt, ParseReadFileOpt, TypeVerifyBody } from './types.js';\n\nexport default class Utils {\n public static async FileExist(path: string): Promise<boolean> {\n try {\n await fs.access(path);\n return true;\n } catch {\n return false;\n }\n }\n public static async readFile(\n filePath: string,\n opt: ReadFileOpt = {},\n ): Promise<object | string> {\n const opts: ParseReadFileOpt = {\n delay: 200,\n maxRetries: 3,\n want: 'string',\n ...opt,\n };\n\n for (let attempt = 0; attempt < opts.maxRetries; attempt++) {\n try {\n const buffer: Buffer = await fs.readFile(filePath);\n let text: string | object;\n if (opts.want === 'string') {\n text = buffer.toString(); // Buffer -> string\n } else if (opts.want === 'object') {\n try {\n text = JSON.parse(buffer.toString()); // Buffer -> string -> object\n } catch {\n text = {};\n }\n } else {\n text = buffer.toString();\n }\n\n return text;\n } catch {\n if (attempt < opts.maxRetries - 1) {\n await Utils.sleep(opts.delay);\n }\n }\n }\n return opts.want === 'object' ? {} : '';\n }\n public static sleep(time: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, time));\n }\n public static TypeVerify<\n T extends Record<string, unknown>,\n U extends TypeVerifyBody,\n >(\n obj: T,\n types: U,\n ): obj is T & {\n [P in keyof U]: {\n boolean: boolean;\n number: number;\n string: string;\n object: object;\n function: Function;\n bigint: bigint;\n symbol: Symbol;\n }[U[P]];\n } {\n for (const item of Object.entries(types)) {\n const [key, ShouldType]: [string, string] = item;\n if (!(typeof obj[key] === ShouldType)) return false;\n }\n return true;\n }\n public static AbsoluteJoin(baseDir: string, inputPath: string): string {\n return path.isAbsolute(inputPath)\n ? inputPath\n : path.join(baseDir, inputPath);\n }\n}\n","let fileIdCounter = 0;\nexport function generateFileId() {\n return `__file_import_${fileIdCounter++}__`;\n}\n","import * as t from '@babel/types';\nimport { JsCompileData } from '../compile-mcx/compiler/compileData';\nimport Utils from '../compile-mcx/compiler/utils';\nimport { ParsedTagNode, transformCtx } from '../types';\nimport config from './config';\nimport McxUtils from '../utils';\nimport * as path from 'node:path';\nimport { generateFileId } from './file_id';\n\nfunction extractVarDefIdList(express: t.LVal | t.VoidPattern): string[] {\n const result: string[] = [];\n if (t.isIdentifier(express)) result.push(express.name);\n if (t.isObjectPattern(express))\n express.properties.forEach(prop => {\n // const {xxx:xxx,xxx=Litter} = xxx\n if (t.isObjectProperty(prop))\n return result.push(\n ...extractVarDefIdList(\n prop.value as t.Identifier | t.AssignmentPattern,\n ),\n );\n // const {...restElement} = xx (restElement in this, ,must identifier)\n if (t.isRestElement(prop) && prop.argument.type == 'Identifier')\n result.push(prop.argument.name);\n });\n if (t.isArrayPattern(express)) {\n for (const element of express.elements) {\n if (!element) continue;\n result.push(...extractVarDefIdList(element));\n }\n }\n if (t.isAssignmentPattern(express)) {\n result.push(...extractVarDefIdList(express.left));\n }\n return result;\n}\nfunction extractIdList(expression: t.Declaration): string[] {\n if (t.isFunctionDeclaration(expression)) {\n return [expression.id?.name || ''];\n }\n if (t.isVariableDeclaration(expression)) {\n const result: string[] = [];\n for (const varDef of expression.declarations) {\n result.push(...extractVarDefIdList(varDef.id));\n }\n return result;\n }\n if (t.isClassDeclaration(expression)) {\n // 'export class {}'is not vaild(error: class name is required).\n return [expression.id?.name || ''];\n }\n return [];\n}\nfunction ToExpression(\n s: t.ExportDefaultDeclaration['declaration'],\n): t.Expression {\n if (t.isFunctionDeclaration(s))\n return t.functionExpression(s.id, s.params, s.body, s.generator, s.async);\n if (t.isClassDeclaration(s))\n return t.classExpression(s.id, s.superClass, s.body, s.decorators);\n if (t.isTSDeclareFunction(s)) return t.objectExpression([]);\n return s;\n}\nfunction generateMain(\n code: JsCompileData,\n): [t.Statement[], t.ImportDeclaration[]] {\n const expBody: (t.ObjectProperty | t.SpreadElement)[] = [];\n const impBody: t.ImportDeclaration[] = code.BuildCache.import.map(\n (item): t.ImportDeclaration => {\n return Utils.CacheToImportNode(item);\n },\n );\n const codeBody: t.Statement[] = code.node.body;\n for (const exp of code.BuildCache.export) {\n if (t.isExportNamedDeclaration(exp)) {\n // export {xxx} from \"./xxx\" or export xxx from \"./xxx\"\n if (\n exp.source &&\n exp.specifiers &&\n exp.specifiers.length >= 1 &&\n exp.source.value.length >= 1\n ) {\n impBody.push(\n t.importDeclaration(\n exp.specifiers.map(item => {\n if (t.isExportDefaultSpecifier(item)) {\n expBody.push(t.objectProperty(item.exported, item.exported));\n return t.importDefaultSpecifier(item.exported);\n }\n if (t.isExportSpecifier(item)) {\n expBody.push(t.objectProperty(item.exported, item.exported));\n return t.importSpecifier(item.local, item.exported);\n }\n if (t.isExportNamespaceSpecifier(item)) {\n expBody.push(t.spreadElement(item.exported));\n return t.importNamespaceSpecifier(item.exported);\n }\n // 这也不是那也不是, 你是个登啊(ts也是galgame)\n throw new Error(\n '[build import]: unexpected export specifier type',\n );\n }),\n exp.source,\n ),\n );\n }\n if (exp.declaration) {\n const idList = extractIdList(exp.declaration);\n // be like: const {} = {}; (worthless)\n if (idList.length < 1) continue;\n codeBody.push(exp.declaration);\n expBody.push(\n ...idList.map(id => {\n return t.objectProperty(t.identifier(id), t.identifier(id));\n }),\n );\n }\n // export { xxx }\n if (exp.specifiers && !exp.source) {\n expBody.push(\n ...exp.specifiers.map(item => {\n if (!t.isExportSpecifier(item))\n throw new Error(`[build import]: invalid specifiers`);\n return t.objectProperty(item.exported, item.local);\n }),\n );\n }\n // export * from \"xxx\"\n } else if (t.isExportAllDeclaration(exp)) {\n // xxx.js => xxx_js(id)\n const id = generateFileId();\n impBody.push(\n t.importDeclaration(\n [t.importNamespaceSpecifier(t.identifier(id))],\n exp.source,\n ),\n );\n expBody.push(t.objectProperty(t.identifier(id), t.identifier(id)));\n // export default {} or export default function a(){}\n } else if (t.isExportDefaultDeclaration(exp)) {\n // to expression\n expBody.push(\n t.objectProperty(\n t.identifier('default'),\n ToExpression(exp.declaration),\n ),\n );\n }\n }\n return [\n [...codeBody, t.returnStatement(t.objectExpression(expBody))],\n impBody,\n ];\n}\nasync function generateEventConfig(\n eventTag: ParsedTagNode,\n ctx: transformCtx,\n impBody: t.ImportDeclaration[],\n): Promise<t.ObjectExpression> {\n const prop = ctx.compiledCode.strLoc.Event.subscribe;\n const argm: t.ObjectExpression = t.objectExpression([\n t.objectProperty(\n t.identifier('on'),\n t.stringLiteral(ctx.compiledCode.strLoc.Event.on),\n ),\n ]);\n if (eventTag.arr.tick) {\n const num = parseFloat(eventTag.arr.tick as string);\n if (!Number.isNaN(num))\n argm.properties.push(\n t.objectProperty(t.identifier('tick'), t.numericLiteral(num)),\n );\n }\n // extract event and hanler\n const data: t.ObjectProperty[] = [];\n const extend: t.Expression[] = [];\n for (const [name, handlerName] of Object.entries(prop)) {\n if (name == config.eventExtendsName) {\n const extendsFile = handlerName.split(',');\n for (const extFile of extendsFile) {\n if (\n !(await McxUtils.FileExist(\n path.join(path.dirname(ctx.currentId), extFile),\n ))\n )\n throw new Error(\n \"[transform event]: [ERR: NOT_FOUND]: can't resolve extend file: \" +\n extFile,\n );\n const id = generateFileId();\n impBody.push(\n t.importDeclaration(\n [t.importDefaultSpecifier(t.identifier(id))],\n t.stringLiteral(extFile),\n ),\n );\n extend.push(t.identifier(id));\n }\n } else {\n data.push(\n t.objectProperty(t.identifier(name), t.stringLiteral(handlerName)),\n );\n }\n }\n argm.properties.push(\n t.objectProperty(t.identifier('data'), t.objectExpression(data)),\n t.objectProperty(t.identifier('extends'), t.arrayExpression(extend)),\n );\n return argm;\n}\n/**\n * record enable\n * @returns {(): void} - only call one\n */\nfunction _enable(): (() => void) & {\n prototype: {\n enable: boolean;\n };\n} {\n let success = false;\n const fn = function () {\n if (success) throw new Error(\"[enable]: can't enable again\");\n success = true;\n fn.prototype.enable = success;\n };\n fn.prototype.enable = success;\n return fn;\n}\nfunction _enableWithData<T>(): ((data: T) => void) & {\n prototype: {\n enable: T | null;\n };\n} {\n let d: null | T = null;\n const fn = function (data: T) {\n if (d) throw new Error(\"[enable]: can't enable again\");\n d = data;\n fn.prototype.enable = d;\n };\n fn.prototype.enable = d;\n return fn;\n}\n// export\nfunction processDefineProp(\n code: JsCompileData,\n mode: 'form' | 'ui',\n impBody: t.ImportDeclaration[],\n): void {\n const obsMap: Record<string, string> = {};\n\n for (const stmt of code.node.body) {\n if (t.isVariableDeclaration(stmt)) {\n for (const decl of stmt.declarations) {\n if (\n t.isCallExpression(decl.init) &&\n t.isIdentifier(decl.init.callee) &&\n decl.init.callee.name === 'defineProp' &&\n t.isIdentifier(decl.id)\n ) {\n const varName = decl.id.name;\n // args: defineProp(defaultValue) or defineProp(name, defaultValue)\n const defaultVal = decl.init.arguments[1] || decl.init.arguments[0];\n let defaultExpr: t.Expression = t.nullLiteral();\n if (defaultVal && t.isExpression(defaultVal)) {\n defaultExpr = defaultVal as t.Expression;\n }\n\n // Build: __mcx__ctx.$prop.varName ?? defaultValue\n const propAccess = t.logicalExpression(\n '??',\n t.memberExpression(\n t.memberExpression(\n t.identifier('__mcx__ctx'),\n t.identifier('$prop'),\n ),\n t.identifier(varName),\n ),\n defaultExpr,\n );\n\n if (mode === 'ui') {\n // Wrap in Observable constructor for CustomForm\n const obsType = inferObservableType(defaultExpr);\n if (obsType) {\n obsMap[obsType] = obsType;\n decl.init = t.newExpression(t.identifier(obsType), [propAccess]);\n } else {\n decl.init = propAccess;\n }\n } else {\n decl.init = propAccess;\n }\n }\n }\n }\n }\n\n if (mode === 'ui' && Object.keys(obsMap).length > 0) {\n impBody.push(\n t.importDeclaration(\n Object.values(obsMap).map(name =>\n t.importSpecifier(t.identifier(name), t.identifier(name)),\n ),\n t.stringLiteral('@minecraft/server-ui'),\n ),\n );\n }\n}\n\nfunction inferObservableType(expr: t.Expression): string | null {\n if (t.isStringLiteral(expr)) return 'ObservableString';\n if (t.isBooleanLiteral(expr)) return 'ObservableBoolean';\n if (t.isNumericLiteral(expr)) return 'ObservableNumber';\n if (t.isNullLiteral(expr)) return 'ObservableString';\n if (t.isIdentifier(expr) && expr.name === 'undefined')\n return 'ObservableString';\n return null;\n}\n\nfunction collectSetupDeclarations(\n code: JsCompileData,\n existingReturnMembers: Set<string>,\n): t.ObjectProperty[] {\n const result: t.ObjectProperty[] = [];\n const seen = new Set(existingReturnMembers);\n\n for (const stmt of code.node.body) {\n if (!t.isDeclaration(stmt)) continue;\n const ids = extractIdList(stmt);\n for (const id of ids) {\n if (id && !seen.has(id)) {\n seen.add(id);\n result.push(t.objectProperty(t.identifier(id), t.identifier(id)));\n }\n }\n }\n return result;\n}\n\nfunction processHooks(code: JsCompileData): {\n startup: t.Expression | null;\n mounted: t.Expression | null;\n} {\n let startup: t.Expression | null = null;\n let mounted: t.Expression | null = null;\n\n const toRemove: number[] = [];\n\n for (let i = 0; i < code.node.body.length; i++) {\n const stmt = code.node.body[i];\n if (!stmt) continue;\n\n if (t.isExpressionStatement(stmt) && t.isCallExpression(stmt.expression)) {\n const call = stmt.expression;\n if (t.isIdentifier(call.callee)) {\n const name = call.callee.name;\n if (name === 'onStartup' || name === 'onMounted') {\n if (call.arguments.length > 0) {\n const cb = call.arguments[0];\n if (t.isExpression(cb)) {\n if (name === 'onStartup') startup = cb as t.Expression;\n else mounted = cb as t.Expression;\n }\n }\n toRemove.push(i);\n }\n }\n }\n }\n\n for (const idx of toRemove.reverse()) {\n code.node.body.splice(idx, 1);\n }\n\n // Clean up imports of onStartup/onMounted from BuildCache\n const hookNames = new Set(['onStartup', 'onMounted']);\n for (const imp of code.BuildCache.import) {\n if (imp.source === '@mbler/mcx') {\n imp.imported = imp.imported.filter(\n item => !hookNames.has(item.import || item.as),\n );\n }\n }\n code.BuildCache.import = code.BuildCache.import.filter(\n imp => imp.source !== '@mbler/mcx' || imp.imported.length > 0,\n );\n\n return { startup, mounted };\n}\n\n// export\nexport {\n extractIdList,\n extractVarDefIdList,\n generateEventConfig,\n _enable,\n generateMain,\n _enableWithData,\n processDefineProp,\n collectSetupDeclarations,\n processHooks,\n};\n","import { ParsedTagNode, transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\n\n/**\n * Shared layout generation for both <Form> and <Ui>.\n * Generates layout config with (s) => expr functions for content and params.\n */\nexport function generateLayout(\n ctx: transformParseCtx,\n tagNode: ParsedTagNode,\n tagName: string,\n mode: 'form' | 'ui',\n) {\n const internalCtx = ctx.ctx;\n\n const parsedObj: t.Expression[] = [];\n const typeTags: string[] = [];\n\n // Collect child elements\n const elements: {\n arr: Record<string, string | boolean>;\n content: string;\n type: string;\n loc?: ParsedTagNode['loc'];\n for?: { variable: string; useSetup: string };\n if?: { useSetup: string };\n }[] = [];\n\n for (const child of tagNode.content) {\n if (child.type !== 'TagNode') continue;\n\n if (child.content.some(i => i.type === 'TagNode')) {\n internalCtx.rollupContext.error(\n `[${tagName}]: can't support nested elements`,\n child.loc\n ? { column: child.loc.start.column, line: child.loc.start.line }\n : void 0,\n );\n }\n\n // parse for\n let _for: { variable: string; useSetup: string } | undefined;\n if (typeof child.arr.for === 'string') {\n const match = (child.arr.for as string).match(\n /^(\\w+)\\s+in\\s+(\\w+)$/,\n );\n if (match) {\n _for = { variable: match[1]!, useSetup: match[2]! };\n } else {\n internalCtx.rollupContext.error(\n `[${tagName}]: invalid for syntax, expected 'variable in propName'`,\n child.loc\n ? { column: child.loc.start.column, line: child.loc.start.line }\n : void 0,\n );\n }\n }\n\n // parse if\n let _if: { useSetup: string } | undefined;\n if (typeof child.arr.if === 'string') {\n _if = { useSetup: child.arr.if as string };\n }\n\n elements.push({\n arr: child.arr,\n content: child.content\n .map(i => (i.type === 'TagContent' && i.data) || '')\n .join(''),\n type: child.name,\n loc: child.loc,\n ...(_for ? { for: _for } : {}),\n ...(_if ? { if: _if } : {}),\n });\n }\n\n // Build layout objects\n for (const el of elements) {\n const name = el.type;\n const cleanedArr = { ...el.arr };\n delete cleanedArr.for;\n delete cleanedArr.if;\n\n // Validate tag type\n const formType = detectFormType(name);\n if (formType === 'invalid') {\n internalCtx.rollupContext.error(\n `[${tagName}]: don't support tag: ${name}`,\n el.loc\n ? { line: el.loc.start.line, column: el.loc.start.column }\n : void 0,\n );\n continue;\n }\n if (formType) typeTags.push(formType);\n\n // Build params: static values as literals, dynamic (:attr) as (s) => expr\n const paramsObj = t.objectExpression(\n Object.entries(cleanedArr)\n .filter(([key]) => key !== 'for' && key !== 'if')\n .map(([key, value]) => {\n const isDynamic = key.startsWith(':');\n const paramName = isDynamic ? key.slice(1) : key;\n // click is always a function reference to setup\n if (paramName === 'click') {\n return t.objectProperty(\n t.identifier(paramName),\n simpleFn(String(value)),\n );\n }\n return t.objectProperty(\n t.identifier(paramName),\n isDynamic\n ? simpleFn(String(value))\n : typeof value === 'boolean'\n ? t.booleanLiteral(value)\n : t.stringLiteral(value),\n );\n }),\n );\n\n // Content: parse {{ }} interpolation, supports mixed text + multiple interpolations\n const contentExpr = parseContent(el.content);\n\n const props: t.ObjectProperty[] = [\n t.objectProperty(t.identifier('type'), t.stringLiteral(name)),\n t.objectProperty(t.identifier('params'), paramsObj),\n t.objectProperty(t.identifier('content'), contentExpr),\n ];\n\n // for\n if (el.for) {\n props.push(\n t.objectProperty(\n t.identifier('for'),\n t.objectExpression([\n t.objectProperty(\n t.identifier('variable'),\n t.stringLiteral(el.for.variable),\n ),\n t.objectProperty(\n t.identifier('useSetup'),\n t.stringLiteral(el.for.useSetup),\n ),\n ]),\n ),\n );\n }\n\n // if\n if (el.if) {\n props.push(\n t.objectProperty(\n t.identifier('if'),\n t.objectExpression([\n t.objectProperty(\n t.identifier('useSetup'),\n t.stringLiteral(el.if.useSetup),\n ),\n ]),\n ),\n );\n }\n\n parsedObj.push(t.objectExpression(props));\n }\n\n // Detect which form type was used\n let formTypeStr = 'ActionFormData';\n if (typeTags.some(t => ['input', 'dropdown', 'submit', 'toggle', 'slider'].includes(t))) {\n formTypeStr = 'ModalFormData';\n } else if (typeTags.some(t => t === 'button-m')) {\n formTypeStr = 'MessageFormData';\n } else if (typeTags.some(t => t === 'button')) {\n formTypeStr = 'ActionFormData';\n }\n\n return { parsedObj, formTypeStr };\n}\n\nfunction detectFormType(\n tag: string,\n): 'modal' | 'message' | 'action' | 'shared' | 'invalid' | null {\n if (['input', 'dropdown', 'submit', 'toggle', 'slider'].includes(tag))\n return 'modal';\n if (tag === 'button-m') return 'message';\n if (tag === 'button') return 'action';\n if (['body', 'divider', 'title', 'label', 'header', 'spacer', 'close-button'].includes(tag))\n return 'shared';\n return 'invalid';\n}\n\n/** Simple arrow function for params (non-reactive): (ctx) => ctx[0].a.b.c */\nfunction simpleFn(expr: string): t.ArrowFunctionExpression {\n const ctx = t.identifier('ctx');\n const body = dotAccess(expr, ctx);\n return t.arrowFunctionExpression([ctx], body);\n}\n\n/** Extract root identifiers from an expression for dependency tracking */\nfunction extractIdentifiers(expr: string): string[] {\n const reserved = new Set(['true', 'false', 'null', 'undefined', 'this', 'new', 'typeof', 'instanceof']);\n const ids = new Set<string>();\n const regex = /\\b([a-zA-Z_$][\\w$]*)\\b/g;\n let m: RegExpExecArray | null;\n while ((m = regex.exec(expr)) !== null) {\n if (!reserved.has(m[1]!)) ids.add(m[1]!);\n }\n return [...ids];\n}\n\n/** Generate new Computation((ctx) => expr, [deps]) */\nfunction arrowFn(expr: string): t.NewExpression {\n const ctx = t.identifier('ctx');\n const body = dotAccess(expr, ctx);\n const evalFn = t.arrowFunctionExpression([ctx], body);\n const ids = extractIdentifiers(expr);\n const deps = ids.map(id => {\n const c = t.identifier('ctx');\n return t.arrowFunctionExpression([c], dotAccess(id, c));\n });\n return t.newExpression(t.identifier('Computation'), [\n evalFn,\n t.arrayExpression(deps),\n ]);\n}\n\n/**\n * Parse content string, returns:\n * - t.stringLiteral for pure static text\n * - t.NewExpression (Computation) for content with {{ }} interpolation\n *\n * Supports:\n * - \"Hello\" → \"Hello\"\n * - \"{{ a }}\" → new Computation((ctx) => ctx[0].a, [ctx => ctx[0].a])\n * - \"Hi {{ a }}\" → new Computation((ctx) => `Hi ${ctx[0].a}`, [ctx => ctx[0].a])\n * - \"{{ a.slice(1,2) }}\" → new Computation((ctx) => ctx[0].a.slice(1,2), [ctx => ctx[0].a])\n */\nfunction parseContent(raw: string): t.Expression {\n // Check for any {{ }} interpolation\n if (!raw.includes('{{ ')) {\n return t.stringLiteral(raw);\n }\n\n const parts = splitInterpolation(raw);\n\n // Single interpolation, no surrounding text → Computation\n if (parts.length === 1 && parts[0]!.type === 'expr') {\n return arrowFn(parts[0]!.value);\n }\n\n // Multiple parts or mixed → template literal Computation\n const ctx = t.identifier('ctx');\n const quasis: t.TemplateElement[] = [];\n const expressions: t.Expression[] = [];\n const allIds = new Set<string>();\n\n for (const part of parts) {\n if (part.type === 'text') {\n quasis.push(t.templateElement({ raw: part.value, cooked: part.value }));\n } else {\n expressions.push(dotAccess(part.value, ctx));\n for (const id of extractIdentifiers(part.value)) {\n allIds.add(id);\n }\n }\n }\n // Template must end with a quasis\n quasis.push(t.templateElement({ raw: '', cooked: '' }, true));\n\n const tpl = t.templateLiteral(quasis, expressions);\n const evalFn = t.arrowFunctionExpression([ctx], tpl);\n const deps = [...allIds].map(id => {\n const c = t.identifier('ctx');\n return t.arrowFunctionExpression([c], dotAccess(id, c));\n });\n return t.newExpression(t.identifier('Computation'), [\n evalFn,\n t.arrayExpression(deps),\n ]);\n}\n\ntype InterpolationPart = { type: 'text'; value: string } | { type: 'expr'; value: string };\n\nfunction splitInterpolation(raw: string): InterpolationPart[] {\n const result: InterpolationPart[] = [];\n const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(raw)) !== null) {\n // Text before this match\n if (match.index > lastIndex) {\n result.push({ type: 'text', value: raw.slice(lastIndex, match.index) });\n }\n // The expression\n result.push({ type: 'expr', value: match[1]! });\n lastIndex = regex.lastIndex;\n }\n // Trailing text\n if (lastIndex < raw.length) {\n result.push({ type: 'text', value: raw.slice(lastIndex) });\n }\n return result;\n}\n\n/** \"a.b.c\" → __ctx[0].a.b.c */\nfunction dotAccess(expr: string, root: t.Identifier): t.Expression {\n const parts = expr.split('.');\n // First part accesses root[0] (the setup object)\n let node: t.Expression = t.memberExpression(root, t.numericLiteral(0), true);\n for (const part of parts) {\n node = t.memberExpression(node, t.identifier(part));\n }\n return node;\n}\n","import { transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport config from '../config';\nimport { generateLayout } from './layout';\n\nexport async function Comp(ctx: transformParseCtx) {\n ctx.impBody.push(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('__mcx__ui'), t.identifier('ui'))],\n t.stringLiteral('@mbler/mcx'),\n ),\n t.importDeclaration(\n [t.importNamespaceSpecifier(t.identifier('__minecraft__ui'))],\n t.stringLiteral('@minecraft/server-ui'),\n ),\n );\n\n const tagNode = ctx.ctx.compiledCode.strLoc.UI;\n if (!tagNode || tagNode.name !== 'Ui')\n throw new Error('[UI Component]: why did parent not verify?');\n\n const { parsedObj, formTypeStr } = generateLayout(ctx, tagNode, 'Ui', 'ui');\n\n const configObj = t.objectExpression([\n t.objectProperty(t.identifier('mode'), t.stringLiteral('ui')),\n t.objectProperty(t.identifier('layout'), t.arrayExpression(parsedObj)),\n t.objectProperty(\n t.identifier('use'),\n t.memberExpression(\n t.identifier('__minecraft__ui'),\n t.identifier(formTypeStr),\n ),\n ),\n t.objectProperty(t.identifier('UI'), t.identifier('__minecraft__ui')),\n ]);\n\n ctx.app([\n t.objectProperty(\n t.identifier('ui'),\n t.newExpression(t.identifier('__mcx__ui'), [\n configObj,\n t.identifier(config.scriptCompileFn),\n ]),\n ),\n ]);\n}\n","import { transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport config from '../config';\nimport { generateLayout } from './layout';\n\nexport async function Comp(ctx: transformParseCtx) {\n ctx.impBody.push(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('__mcx__ui'), t.identifier('ui'))],\n t.stringLiteral('@mbler/mcx'),\n ),\n t.importDeclaration(\n [t.importNamespaceSpecifier(t.identifier('__minecraft__ui'))],\n t.stringLiteral('@minecraft/server-ui'),\n ),\n );\n\n const tagNode = ctx.ctx.compiledCode.strLoc.Form;\n if (!tagNode || tagNode.name !== 'Form')\n throw new Error('[Form Component]: why did parent not verify?');\n\n const { parsedObj, formTypeStr } = generateLayout(ctx, tagNode, 'Form', 'form');\n\n const configObj = t.objectExpression([\n t.objectProperty(t.identifier('mode'), t.stringLiteral('form')),\n t.objectProperty(t.identifier('layout'), t.arrayExpression(parsedObj)),\n t.objectProperty(\n t.identifier('use'),\n t.memberExpression(\n t.identifier('__minecraft__ui'),\n t.identifier(formTypeStr),\n ),\n ),\n t.objectProperty(t.identifier('UI'), t.identifier('__minecraft__ui')),\n ]);\n\n ctx.app([\n t.objectProperty(\n t.identifier('ui'),\n t.newExpression(t.identifier('__mcx__ui'), [\n configObj,\n t.identifier(config.scriptCompileFn),\n ]),\n ),\n ]);\n}\n","import { ParsedTagNode, transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport { generateEventConfig } from '../utils';\nexport async function Comp(ctx: transformParseCtx) {\n const appData = [\n t.objectProperty(\n t.identifier('event'),\n await generateEventConfig(\n ctx.ctx.compiledCode.raw.find(\n node => node.name === 'Event', // compileMCXFn had verify, don't verify\n ) as ParsedTagNode,\n ctx.ctx,\n ctx.impBody,\n ),\n ),\n ];\n ctx.app(appData);\n}\n","import * as path from 'node:path';\nimport { transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport { readFile } from 'node:fs/promises';\nimport { compileMCXFn } from '../../compile-mcx/compiler';\nimport config from '../config';\nexport async function Comp(ctx: transformParseCtx) {\n const eventImportIdList: {\n type: 'default' | 'all';\n as: string;\n }[] = [];\n for (const impNode of ctx.ctx.compiledCode.JSIR.BuildCache.import) {\n const source = impNode.source;\n const parsed = path.parse(source);\n if (!parsed.root && !parsed.dir.startsWith('.')) {\n continue;\n }\n // path\n const fPath = path.join(ctx.ctx.currentId, '../', source);\n try {\n // read file\n const code = await readFile(fPath, 'utf-8');\n const compiledCode = compileMCXFn(code);\n // write cache\n ctx.ctx.cache.set(fPath, compiledCode);\n if (compiledCode.strLoc.Event.isLoad) {\n for (const impItem of impNode.imported) {\n let type: 'all' | 'default';\n if (impItem.isAll) type = 'all';\n else if (impItem.import == 'default') type = 'default';\n else {\n throw new Error(\n \"not vaild importDeclartion: Event mcx only resolve default and all import, can't use other import\",\n );\n }\n eventImportIdList.push({\n type,\n as: impItem.as,\n });\n }\n }\n } catch (err) {\n // if error: file not found, file can't write, mcx syntax error\n ctx.ctx.rollupContext.warn(\n `[extract import]: can't resolve file ${fPath} and import by ${ctx.ctx.currentId}\\n- err: ${err instanceof Error ? err.stack : err}`,\n );\n }\n }\n // only have event import\n if (eventImportIdList.length >= 1) {\n const eventMemberNode = t.memberExpression(\n t.identifier(config.paramCtx),\n t.identifier('event'),\n );\n ctx.mainFn.unshift(\n // add declaration\n\n t.variableDeclaration(\n 'var',\n eventImportIdList.map((item, index) => {\n if (item.type == 'all') {\n return t.variableDeclarator(\n t.identifier(item.as),\n t.objectExpression([\n t.objectProperty(\n t.identifier('default'),\n t.memberExpression(\n eventMemberNode,\n t.numericLiteral(index),\n true,\n ),\n ),\n ]),\n );\n } else if (item.type == 'default') {\n return t.variableDeclarator(\n t.identifier(item.as),\n t.memberExpression(\n eventMemberNode,\n t.numericLiteral(index),\n true,\n ),\n );\n }\n // ts galgame\n throw new Error('[javascript error]: why it not in [default, all]');\n }),\n ),\n );\n // app: add event export to runtime framework\n\n const appData = [\n t.objectProperty(\n t.identifier('event'),\n t.arrayExpression(\n eventImportIdList.map(vl => {\n if (vl.type == 'all') {\n return t.memberExpression(\n t.identifier(vl.as),\n t.identifier('default'),\n );\n } else if (vl.type == 'default') {\n return t.identifier(vl.as);\n }\n throw new Error(\"[add prop]: can't format eventImportList\");\n }),\n ),\n ),\n ];\n ctx.app(appData);\n }\n}\n","import { compileJSFn } from '../compile-mcx/compiler';\nimport { ImportList } from '../compile-mcx/types';\nimport * as t from '@babel/types';\nimport { generateFileId } from '../transforms/file_id';\nimport * as generator from '@babel/generator';\n/**\n * ESM => CJS\n */\nfunction transformESMToCJS(\n code: string,\n pluginContext?: Record<string, string | null | boolean | number>,\n hook?: (\n data: t.CallExpression | t.MemberExpression,\n setData?: (newData: t.Expression) => void,\n ) => void,\n): string {\n const compileData = compileJSFn(code);\n const body = compileData.node.body;\n const defines: t.VariableDeclarator[] = [];\n // import transform\n const importDefines = transformImportIRtoRequire(\n compileData.BuildCache.import,\n );\n for (const importDefine of importDefines) {\n const data = importDefine.init as t.CallExpression | t.MemberExpression;\n if (hook) {\n hook(data, newData => {\n importDefine.init = newData;\n });\n }\n defines.push(importDefine);\n }\n // add plugin context\n if (pluginContext) {\n defines.push(\n ...Object.entries(pluginContext).map(\n ([key, value]): t.VariableDeclarator =>\n t.variableDeclarator(\n t.identifier(key),\n typeof value == 'string'\n ? t.stringLiteral(value)\n : typeof value == 'boolean'\n ? t.booleanLiteral(value)\n : typeof value == 'number'\n ? t.numericLiteral(value)\n : t.nullLiteral(),\n ),\n ),\n );\n }\n\n const exportsArr = compileData.BuildCache.export\n .map(i => {\n if (t.isExportAllDeclaration(i)) {\n const fileId = generateFileId();\n defines.push(\n t.variableDeclarator(\n t.identifier(fileId),\n t.callExpression(t.identifier('require'), [i.source]),\n ),\n );\n return t.assignmentExpression(\n '=',\n t.memberExpression(t.identifier('module'), t.identifier('exports')),\n t.objectExpression([\n t.spreadElement(t.identifier(fileId)),\n t.spreadElement(\n t.memberExpression(\n t.identifier('module'),\n t.identifier('exports'),\n ),\n ),\n ]),\n );\n } else if (t.isExportDefaultDeclaration(i)) {\n if (!i.declaration || t.isTSDeclareFunction(i.declaration))\n return void 0;\n if (t.isExpression(i.declaration)) {\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier('default'),\n ),\n i.declaration,\n );\n }\n if (!i.declaration.id)\n i.declaration.id = t.identifier(generateFileId());\n body.push(i.declaration);\n return t.assignmentExpression(\n '=',\n t.memberExpression(t.identifier('exports'), t.identifier('default')),\n i.declaration.id,\n );\n } else if (t.isExportNamedDeclaration(i)) {\n if (i.source && i.specifiers.length >= 1) {\n const id = t.identifier(generateFileId());\n defines.push(\n t.variableDeclarator(\n id,\n t.callExpression(t.identifier('require'), [i.source]),\n ),\n );\n const exportExprs = i.specifiers\n .map(\n (\n specifier:\n | t.ExportNamespaceSpecifier\n | t.ExportDefaultSpecifier\n | t.ExportSpecifier,\n ) => {\n if (t.isExportNamespaceSpecifier(specifier)) {\n const exportedName = t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : (specifier.exported as t.StringLiteral).value;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(exportedName),\n ),\n id,\n );\n } else if (t.isExportSpecifier(specifier)) {\n const exportedName = t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : (specifier.exported as t.StringLiteral).value;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(exportedName),\n ),\n t.memberExpression(id, t.identifier(specifier.local.name)),\n );\n }\n return null;\n },\n )\n .filter(Boolean) as t.AssignmentExpression[];\n return exportExprs.length === 1\n ? exportExprs[0]\n : t.sequenceExpression(exportExprs);\n } else {\n if (i.declaration) {\n if (\n t.isFunctionDeclaration(i.declaration) ||\n t.isVariableDeclaration(i.declaration)\n ) {\n if (t.isVariableDeclaration(i.declaration)) {\n body.push(i.declaration);\n const assignExprs = i.declaration.declarations.map(decl => {\n const varName = (decl.id as t.Identifier).name;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(varName),\n ),\n t.identifier(varName),\n );\n });\n return assignExprs.length === 1\n ? assignExprs[0]\n : t.sequenceExpression(assignExprs);\n } else {\n const functionId =\n i.declaration.id || t.identifier(generateFileId());\n const funcDecl = t.functionDeclaration(\n functionId,\n i.declaration.params,\n i.declaration.body,\n i.declaration.generator,\n i.declaration.async,\n );\n body.push(funcDecl);\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier((functionId as t.Identifier).name),\n ),\n functionId,\n );\n }\n }\n } else {\n // Handle export { item } - simple variable export\n if (i.specifiers.length >= 1) {\n const exportExprs = i.specifiers\n .map(specifier => {\n if (t.isExportSpecifier(specifier)) {\n const exportedName = t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : (specifier.exported as t.StringLiteral).value;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(exportedName),\n ),\n t.identifier(specifier.local.name),\n );\n }\n return null;\n })\n .filter(Boolean) as t.AssignmentExpression[];\n return exportExprs.length === 1\n ? exportExprs[0]\n : t.sequenceExpression(exportExprs);\n }\n }\n }\n return null;\n }\n })\n .filter(Boolean) as t.AssignmentExpression[];\n\n body.unshift(t.variableDeclaration('var', defines));\n body.push(...exportsArr.map(i => t.expressionStatement(i)));\n\n return generator.generate(t.program(body)).code;\n}\n\n/**\n * import IR => require\n */\nfunction transformImportIRtoRequire(\n importIR: ImportList[],\n): t.VariableDeclarator[] {\n const define: t.VariableDeclarator[] = [\n t.variableDeclarator(\n t.identifier('__import_default'),\n t.functionExpression(\n null,\n [t.identifier('obj')],\n t.blockStatement([\n t.returnStatement(\n t.conditionalExpression(\n t.memberExpression(\n t.identifier('obj'),\n t.identifier('__esModule'),\n ),\n t.memberExpression(t.identifier('obj'), t.identifier('default')),\n t.identifier('obj'),\n ),\n ),\n ]),\n ),\n ),\n ];\n\n for (const data of importIR) {\n for (const imported of data.imported) {\n let vl: t.CallExpression | t.MemberExpression;\n if (!imported.isAll && imported.import) {\n if (imported.import == 'default') {\n vl = t.callExpression(t.identifier('__import_default'), [\n t.callExpression(t.identifier('require'), [\n t.stringLiteral(data.source),\n ]),\n ]);\n } else {\n vl = t.memberExpression(\n t.callExpression(t.identifier('require'), [\n t.stringLiteral(data.source),\n ]),\n t.identifier(imported.import),\n );\n }\n } else {\n vl = t.callExpression(t.identifier('require'), [\n t.stringLiteral(data.source),\n ]);\n }\n define.push(t.variableDeclarator(t.identifier(imported.as), vl));\n }\n }\n return define;\n}\nexport { transformESMToCJS, transformImportIRtoRequire };\n","import * as Module from 'node:module';\nimport * as vm from 'node:vm';\nimport { Buffer } from 'node:buffer';\nimport * as t from '@babel/types';\nimport { parse } from '@babel/parser';\nimport * as generator from '@babel/generator';\nimport { transformESMToCJS } from './cjsTransform';\nconst BLOCKED_MODULES = new Set([\n 'child_process',\n 'node:child_process',\n 'fs',\n 'node:fs',\n 'node:fs/promises',\n 'worker_threads',\n 'node:worker_threads',\n 'cluster',\n 'node:cluster',\n 'dgram',\n 'node:dgram',\n 'net',\n 'node:net',\n 'tls',\n 'node:tls',\n 'tty',\n 'node:tty',\n 'v8',\n 'node:v8',\n 'vm',\n 'node:vm',\n 'async_hooks',\n 'node:async_hooks',\n 'diagnostics_channel',\n 'node:diagnostics_channel',\n]);\n// Enumerate the methods for converting ESM to CJS\nexport enum execESMMethod {\n transformCjs = 0,\n runInVm = 1,\n importESM = 2,\n}\n\nexport class RunScript {\n private _context;\n private _module;\n private _pluginContext;\n constructor(\n public filePath: string = '<repl>',\n public module: 'esm' | 'cjs' = 'cjs',\n private pluginContext?: Record<string, string | null | boolean | number>,\n ) {\n this._module = new Module.Module(this.filePath);\n this._pluginContext = pluginContext || {};\n this._context = this.getContext(this._pluginContext);\n }\n /**\n * run code in nodejs vm\n * @param code {string} exetuce code\n * @returns code exports\n */\n public async run(\n code: string,\n esmExecMethod: execESMMethod = execESMMethod.transformCjs,\n transformCjsHook?: (\n data: t.CallExpression | t.MemberExpression,\n setData?: (newData: t.Expression) => void,\n ) => void,\n ): Promise<unknown> {\n if (this.module === 'esm') {\n if (esmExecMethod == execESMMethod.importESM) {\n let processedCode = code;\n\n if (this.pluginContext) {\n const ast = parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n const contextDefines = Object.entries(this.pluginContext).map(\n ([key, value]): t.VariableDeclarator =>\n t.variableDeclarator(\n t.identifier(key),\n typeof value == 'string'\n ? t.stringLiteral(value)\n : typeof value == 'boolean'\n ? t.booleanLiteral(value)\n : typeof value == 'number'\n ? t.numericLiteral(value)\n : t.nullLiteral(),\n ),\n );\n const contextDeclaration = t.variableDeclaration(\n 'var',\n contextDefines,\n );\n ast.program.body.unshift(contextDeclaration);\n processedCode = generator.generate(ast).code;\n }\n const dataUrl = `data:application/javascript;base64,${Buffer.from(processedCode).toString('base64')}`;\n return await import(dataUrl);\n } else if (esmExecMethod == execESMMethod.transformCjs) {\n const compiledCode = transformESMToCJS(\n code,\n this.pluginContext,\n transformCjsHook,\n );\n const script = new vm.Script(compiledCode, { filename: this.filePath });\n const rel = script.runInContext(this._context);\n return this._context.exports || rel;\n } else if (esmExecMethod == execESMMethod.runInVm) {\n if (typeof vm.SourceTextModule !== 'function') {\n throw new Error('[exec esm]: not support vm.SourceTextModule');\n } else {\n const script = new vm.SourceTextModule(code, {\n context: this._context,\n });\n await script.link(async specifier => {\n return new vm.SourceTextModule(specifier, {\n context: this._context,\n });\n });\n await script.evaluate();\n return script.namespace;\n }\n }\n } else {\n const script = new vm.Script(code, { filename: this.filePath });\n const rel = script.runInContext(this._context);\n return this._context.exports || rel;\n }\n }\n private getContext(pluginContext?: Record<string, unknown>): vm.Context {\n const context: vm.Context = Object.create(pluginContext || null);\n // CJS context setup\n const exports = {};\n const module = {\n exports,\n filename: this.filePath,\n path: this.filePath,\n paths: require.resolve.paths(this.filePath) || [],\n id: this.filePath,\n };\n const originalRequire = Module.createRequire\n ? Module.createRequire(this.filePath)\n : require;\n const restrictedRequire = new Proxy(originalRequire, {\n apply(target, thisArg, args) {\n const id = args[0];\n if (typeof id === 'string' && BLOCKED_MODULES.has(id)) {\n throw new Error(\n `[mcx component]: require('${id}') is not allowed in component scripts`,\n );\n }\n return Reflect.apply(target, thisArg, args);\n },\n });\n Object.assign(context, {\n exports,\n module,\n require: restrictedRequire,\n global: context,\n });\n return vm.createContext(context);\n }\n public static isCanUseEsmRunVm = typeof vm.SourceTextModule == 'function';\n}\nexport { transformESMToCJS };\n","import { cp, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { MCXCompileData } from '../compile-mcx/compiler/compileData';\nimport { execESMMethod, RunScript } from './vm';\nimport * as path from 'node:path';\nimport { MCXstructureLocComponentType } from '../compile-mcx/types';\nimport { transformCtx } from '../types';\nimport * as t from '@babel/types';\nimport type { BaseJson, FilePoint } from './types';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { parse } from '@babel/parser';\nimport { styleText } from 'node:util';\nimport type lib from '@mbler/mcx-component';\n/** Accumulated bind data (e.g. item_texture entries) across all components in a build. */\nlet cachedOption: Record<string, string[] | [string, string][]> = {};\n\n/**\n * Security limits for file I/O operations inside file_edit expressions.\n * Components from @mbler/mcx-component are exempt from these limits.\n */\nconst MAX_FILE_WRITES = 5;\nconst MAX_FILE_READS = 1;\n\n/** Clear all cached bind options (called between builds). */\nexport function clearCachedOptions() {\n cachedOption = {};\n}\n\n/**\n * Resolve a FilePoint to an absolute path on disk.\n *\n * - `base: 'root'` is only allowed when the calling component originates from\n * @mbler/mcx-component (the `sourceIsMcxCore` flag). This prevents third-party\n * components from reading arbitrary filesystem locations.\n * - For `behavior` / `resources`, the file is resolved relative to the\n * corresponding output directory. A path-traversal check ensures the resolved\n * path does not escape the base directory (e.g. via `../`).\n */\nexport function resolveFilePoint(\n point: FilePoint,\n ctx: transformCtx,\n sourceIsMcxCore = false,\n) {\n // \"root\" base: resolve the file path directly against cwd. Only internal\n // mcx-core components are trusted to use this — third-party components\n // would gain unrestricted filesystem access otherwise.\n if (point.base === 'root') {\n if (!sourceIsMcxCore) {\n throw new Error(\n '[mcx component]: \"root\" base is only allowed for components imported from @mbler/mcx-component',\n );\n }\n return path.resolve(point.file);\n }\n let baseDir: string;\n if (point.base === 'behavior') {\n baseDir = ctx.output.behavior;\n } else if (point.base === 'resources') {\n baseDir = ctx.output.resources;\n } else {\n throw new Error('[mcx component]: invalid FilePoint Base');\n }\n const resolved = path.resolve(baseDir, point.file);\n // Path traversal guard: after resolving, the result must still be inside the\n // base directory. If the file contains \"../\" that escapes the root, the\n // startsWith check will fail.\n if (!resolved.startsWith(path.resolve(baseDir))) {\n throw new Error('[mcx component]: Path Traversal detected: ' + point.file);\n }\n return resolved;\n}\n\n/**\n * Maps each locally-bound identifier name to the package it was imported from.\n * Built by walking the AST of the component source code.\n *\n * Example:\n * import { ItemComponent } from '@mbler/mcx-component'\n * → { ItemComponent: '@mbler/mcx-component' }\n *\n * const { SomeHelper } = require('some-lib')\n * → { SomeHelper: 'some-lib' }\n */\ntype ExportSourceMap = Record<string, string>;\n\n/**\n * Walk the component source AST and build a mapping from local variable names\n * to the npm package they were imported/required from.\n *\n * Covers three import patterns:\n * 1. ES module named/default/namespace imports: import { X } from 'pkg'\n * 2. CommonJS direct require: const X = require('pkg')\n * 3. CommonJS destructured require: const { X } = require('pkg')\n * which desugars to a MemberExpression in the AST.\n */\nfunction collectExportSources(code: string): ExportSourceMap {\n const sources: ExportSourceMap = {};\n let ast: ReturnType<typeof parse>;\n try {\n ast = parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n } catch {\n // Parse failure is non-fatal — return empty map and skip the check.\n return sources;\n }\n\n function walk(node: t.Node) {\n if (!node) return;\n\n // Pattern 1: ES module import declarations.\n // e.g. import { ItemComponent, EntityComponent as Entity } from '@mbler/mcx-component'\n if (t.isImportDeclaration(node)) {\n const pkg =\n typeof node.source.value === 'string' ? node.source.value : '';\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec)) {\n // Named import — local.name is the locally bound name,\n // imported.name is the original export name.\n const importedName = t.isIdentifier(spec.imported)\n ? spec.imported.name\n : (spec.imported as t.StringLiteral).value;\n const localName = spec.local.name;\n sources[localName] = pkg;\n } else if (t.isImportDefaultSpecifier(spec)) {\n // import Default from 'pkg'\n sources[spec.local.name] = pkg;\n } else if (t.isImportNamespaceSpecifier(spec)) {\n // import * as ns from 'pkg'\n sources[spec.local.name] = pkg;\n }\n }\n }\n\n // Patterns 2 & 3: CommonJS require calls inside variable declarations.\n if (t.isVariableDeclaration(node)) {\n for (const decl of node.declarations) {\n // Pattern 2: const X = require('pkg')\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isCallExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: 'require' }) &&\n decl.init.arguments.length === 1 &&\n t.isStringLiteral(decl.init.arguments[0])\n ) {\n sources[decl.id.name] = decl.init.arguments[0].value;\n }\n // Pattern 3: const { X } = require('pkg')\n // In the AST this becomes:\n // VariableDeclarator {\n // id: Identifier(X),\n // init: CallExpression {\n // callee: MemberExpression {\n // object: CallExpression { callee: require, arguments: ['pkg'] },\n // property: Identifier(X)\n // }\n // }\n // }\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isCallExpression(decl.init) &&\n t.isMemberExpression(decl.init.callee) &&\n t.isCallExpression(decl.init.callee.object) &&\n t.isIdentifier(decl.init.callee.object.callee, { name: 'require' }) &&\n decl.init.callee.object.arguments.length === 1 &&\n t.isStringLiteral(decl.init.callee.object.arguments[0])\n ) {\n sources[decl.id.name] = decl.init.callee.object.arguments[0].value;\n }\n }\n }\n\n // Generic AST traversal using @babel/types VISITOR_KEYS.\n for (const key of t.VISITOR_KEYS[node.type] || []) {\n const child = (node as unknown as Record<string, unknown>)[key];\n if (Array.isArray(child)) {\n for (const item of child) {\n if (item && typeof item === 'object' && (item as t.Node).type) {\n walk(item as t.Node);\n }\n }\n } else if (child && typeof child === 'object' && (child as t.Node).type) {\n walk(child as t.Node);\n }\n }\n }\n walk(ast.program);\n return sources;\n}\n\n/**\n * Validate that the component only imports from @mbler/mcx-component.\n * Non-mcx-core imports are collected and each unique offending package\n * triggers a console warning (once per package per file).\n * Relative imports ('./...', '../...') are silently allowed.\n */\nfunction checkComponentImports(sources: ExportSourceMap, filePath: string) {\n const allowedPackage = '@mbler/mcx-component';\n const warned = new Set<string>();\n for (const [, pkg] of Object.entries(sources)) {\n if (\n pkg &&\n !pkg.startsWith(allowedPackage) &&\n !pkg.startsWith('.') &&\n !warned.has(pkg)\n ) {\n warned.add(pkg);\n console.warn(\n `[${styleText('red', 'mcx component warning')}]: \"${pkg}\" in ${filePath} is not from \"${allowedPackage}\". Only imports/requires from \"${allowedPackage}\" are recommended.`,\n );\n }\n }\n}\n\n/**\n * Execute file_edit operations defined in a component's _meta.\n * Delegates to execEditInternal with a fresh limits counter.\n *\n * @param isMcxCoreSource - when true, the component originates from\n * @mbler/mcx-component and is exempt from file I/O limits and root base\n * restrictions.\n */\nexport async function execEdit(\n option: BaseJson['_meta']['file_edit'],\n ctx: transformCtx,\n isMcxCoreSource = false,\n) {\n if (!option) return;\n // Shared mutable limits object passed through recursive batch calls so that\n // the total write/read count across the entire file_edit tree is enforced.\n const limits = { writeCount: 0, readCount: 0 };\n await execEditInternal(option, ctx, limits, isMcxCoreSource);\n}\n\n/**\n * Internal recursive implementation of execEdit.\n * Handles three editOption types:\n * - batch: recursively processes a nested array of options\n * - copy_assets: copies a file from source to output via FilePoint resolution\n * - edit: evaluates an expression with define vars, then writes to a file or\n * appends to a bind target (e.g. item_texture)\n *\n * File I/O limits (writes ≤ 5, reads ≤ 1) are enforced on the limits object\n * but skipped entirely when isMcxCoreSource is true.\n */\nasync function execEditInternal(\n option: BaseJson['_meta']['file_edit'],\n ctx: transformCtx,\n limits: { writeCount: number; readCount: number },\n isMcxCoreSource: boolean,\n) {\n if (!option) return;\n for (const editOption of option) {\n if (editOption.type == 'batch') {\n // Recurse into nested batch — limits object is shared so counts persist.\n await execEditInternal(editOption.options, ctx, limits, isMcxCoreSource);\n } else {\n if (editOption.type == 'copy_assets') {\n // copy_assets: resolve both source and output paths, then copy.\n await cp(\n resolveFilePoint(editOption.source, ctx, isMcxCoreSource),\n resolveFilePoint(editOption.output, ctx, isMcxCoreSource),\n {\n recursive: true,\n force: true,\n },\n );\n } else if (editOption.type == 'edit') {\n // edit: build the define variables map from the expression config,\n // then run the expression to produce the output content.\n const defineVars = {} as Record<string, string>;\n for (const [key, entry] of Object.entries(\n editOption.expression.define,\n )) {\n const value = entry as\n | { from: 'var'; data: string }\n | { from: 'read_file'; data: FilePoint; default?: string };\n if (value.from == 'var') {\n // Simple variable reference — just pass through the string value.\n defineVars[key] = value.data;\n } else {\n // File read — enforce the read limit for non-mcx-core sources.\n if (!isMcxCoreSource) {\n limits.readCount++;\n if (limits.readCount > MAX_FILE_READS) {\n throw new Error(\n `[mcx component]: File read limit exceeded (max ${MAX_FILE_READS})`,\n );\n }\n }\n const fileContent = await readFile(\n resolveFilePoint(value.data, ctx, isMcxCoreSource),\n 'utf-8',\n );\n defineVars[key] = fileContent || value.default || '';\n }\n }\n const execResult = await editOption.expression.run(defineVars);\n\n // If the target is a file on disk, write the result and enforce write limit.\n if ('file' in editOption.source) {\n if (!isMcxCoreSource) {\n limits.writeCount++;\n if (limits.writeCount > MAX_FILE_WRITES) {\n throw new Error(\n `[mcx component]: File write limit exceeded (max ${MAX_FILE_WRITES})`,\n );\n }\n }\n const filePath = resolveFilePoint(\n editOption.source,\n ctx,\n isMcxCoreSource,\n );\n await writeFile(filePath, execResult.toString());\n }\n\n // If the target is a bind slot (e.g. item_texture), accumulate entries.\n if ('bind' in editOption.source) {\n if (\n editOption.source.bind == 'item_texture' &&\n editOption.source.type == 'append'\n ) {\n if (!Array.isArray(execResult))\n throw new Error(\n '[mcx component]: json._meta.file_edit: error exec result',\n );\n if (!cachedOption['item_texture'])\n cachedOption['item_texture'] = [];\n if (Array.isArray(execResult)) {\n cachedOption['item_texture'] = [\n ...(cachedOption['item_texture'] as [string, string][]),\n ...(execResult as [string, string][]),\n ];\n }\n }\n } else {\n throw new Error(\n '[mcx component]: json._meta.file_edit: unknown output place.',\n );\n }\n }\n }\n }\n}\n\n/**\n * Generate the final textures/item_texture.json from accumulated bind data.\n * Call this in the plugin's buildEnd / onEnd hook.\n * Merges with any existing item_texture.json in the output directory.\n */\nexport async function generateItemTextureJson(output: {\n resources: string;\n}): Promise<void> {\n const entries = cachedOption['item_texture'] as\n | [string, string][]\n | undefined;\n if (!entries || entries.length === 0) return;\n\n const dir = path.join(output.resources, 'textures');\n const filePath = path.join(dir, 'item_texture.json');\n\n const data: {\n resource_pack_name: string;\n texture_name: string;\n texture_data: Record<string, { textures: string }>;\n } = {\n resource_pack_name: 'mcx.pack.v.',\n texture_name: 'atlas.items',\n texture_data: {},\n };\n\n // Merge with existing data if the file already exists from a prior run.\n try {\n const existing = JSON.parse(readFileSync(filePath, 'utf-8'));\n if (existing.texture_data) {\n data.texture_data = existing.texture_data;\n }\n } catch {\n // File doesn't exist yet, use default empty data.\n }\n\n for (const [key, textures] of entries) {\n data.texture_data[key] = { textures };\n }\n\n await mkdir(dir, { recursive: true });\n await writeFile(filePath, JSON.stringify(data, null, 2));\n}\n\n/**\n * Compile a single MCX component: parse its source, validate imports, execute\n * the script in a VM, then iterate over each declared component to produce\n * its JSON output file.\n *\n * Security measures applied before VM execution:\n * 1. collectExportSources — maps each import to its source package\n * 2. checkComponentImports — warns on non-mcx-core dependencies\n *\n * Per-component restrictions (checked after VM execution):\n * - path traversal guard on the output file point\n * - root base: only allowed if the export came from @mbler/mcx-component\n * - file write limit (≤5) and read limit (≤1): only enforced for\n * non-mcx-core components\n */\nexport async function compileComponent(\n compiledCode: MCXCompileData,\n ctx: transformCtx,\n) {\n const component = compiledCode.strLoc.Component;\n const src = compiledCode.strLoc.script;\n\n // Pre-flight: scan imports and build the export → source package map.\n // This is used both for import validation and for per-component restriction\n // decisions later.\n const exportSources = collectExportSources(src);\n checkComponentImports(exportSources, compiledCode.File);\n\n // Execute the component script in a VM. The transformCjsHook rewrites\n // image file requires (e.g. require('./icon.png')) into\n // require('@mbler/mcx-component').PNGImageComponent(require('node:path').join(...))\n // so that image assets are handled by the mcx-core ImageComponent classes.\n const scriptRunResult = (await new RunScript(compiledCode.File, 'esm').run(\n src,\n execESMMethod.transformCjs,\n (data, setData) => {\n if (\n setData &&\n data.type == 'CallExpression' &&\n data.callee.type == 'Identifier' &&\n data.arguments.length == 1 &&\n data.arguments[0]?.type == 'CallExpression' &&\n data.arguments[0].callee.type == 'Identifier' &&\n data.arguments[0].callee.name == 'require'\n ) {\n const callRequire = data.arguments[0];\n const arg = callRequire.arguments[0];\n if (arg && arg.type == 'StringLiteral') {\n if (/^.+?\\.(png|svg|jpg|jpeg|gif)$/.test(arg.value)) {\n const imageComponentRequire = t.memberExpression(\n t.callExpression(t.identifier('require'), [\n t.stringLiteral('@mbler/mcx-component'),\n ]),\n t.identifier(\n {\n png: 'PNGImageComponent',\n svg: 'SVGImageComponent',\n jpg: 'JPGImageComponent',\n jpeg: 'JPGImageComponent',\n gif: 'GIFImageComponent',\n }[path.extname(arg.value).slice(1)] as string,\n ),\n );\n const finishExpression = t.newExpression(imageComponentRequire, [\n t.callExpression(\n t.memberExpression(\n t.callExpression(t.identifier('require'), [\n t.stringLiteral('node:path'),\n ]),\n t.identifier('join'),\n ),\n [t.stringLiteral(path.dirname(compiledCode.File)), arg],\n ),\n ]);\n setData(finishExpression);\n }\n }\n }\n },\n )) as Record<\n string,\n InstanceType<(typeof lib)[MCXstructureLocComponentType]> | undefined\n >;\n if (!component)\n throw new Error(\n '[component internal error]: compile component: mcx is not component: filePath: ' +\n compiledCode.File,\n );\n if (typeof scriptRunResult !== 'object')\n throw new Error(\n '[component compile error]: exec code: mcx export type is not object',\n );\n\n // Iterate over each declared component entry and produce its output JSON.\n for (const i of Object.entries(component)) {\n const filePoint = path.join(ctx.output.behavior, i[0]);\n\n // Path traversal check: the resolved output must stay inside the behavior dir.\n if (!path.relative(filePoint, ctx.output.behavior).startsWith('..'))\n throw new Error('[component]: Path Traversal: path: ' + filePoint);\n\n const pointExport = i[1].useExpore;\n const pointData = scriptRunResult[pointExport] as InstanceType<\n (typeof lib)[keyof typeof lib]\n >;\n if (!pointExport) {\n throw new Error(\n '[component]: compile: check: not found Component class of file: ' +\n compiledCode.File,\n );\n }\n\n // Ensure the output directory exists before writing.\n if (!existsSync(path.dirname(filePoint))) {\n await mkdir(path.dirname(filePoint), {\n recursive: true,\n });\n }\n\n const json = pointData.toJSON() as unknown as BaseJson;\n if (\n !json._meta ||\n !json._meta.type ||\n !['item', 'entity'].includes(json._meta.type)\n )\n throw new Error('[mcx component]: not mcx json component: unknown type');\n\n if (json._meta.file_edit) {\n // Determine if the component comes from @mbler/mcx-component.\n // Check whether any import in the script originates from that package.\n // This is more reliable than checking the specific export name,\n // since local variables (e.g. const item = new ItemComponent()) are\n // not captured by exportSources.\n const isMcxCoreSource = Object.values(exportSources).some(\n src => src && src.startsWith('@mbler/mcx-component'),\n );\n await execEdit(json._meta.file_edit, ctx, isMcxCoreSource);\n }\n\n // Strip the internal _meta field before writing the final JSON.\n delete (json as unknown as Record<string, string>)['_meta'];\n await writeFile(filePoint, JSON.stringify(json, null, 2));\n }\n}\nexport * from './vm';\n","import { mcxType, transformCtx, transformParseCtx } from '../types';\nimport * as t from '@babel/types';\nimport { generate } from '@babel/generator';\nimport config from './config';\nimport {\n _enable,\n _enableWithData,\n generateMain,\n processDefineProp,\n collectSetupDeclarations,\n processHooks,\n extractIdList,\n} from './utils';\nimport { EventComp, UIComp, FormComp, AppComp } from './transform';\nimport { compileComponent } from '../mcx-component';\n\nexport async function _transform(ctx: transformCtx): Promise<string> {\n // Determine setup mode from tag attributes before generateMain\n const formTag = ctx.compiledCode.strLoc.Form;\n const uiTag = ctx.compiledCode.strLoc.UI;\n const isSetupMode =\n (formTag && formTag.arr.setup !== undefined) ||\n (uiTag && uiTag.arr.setup !== undefined);\n\n // Determine mode type for defineProp (form vs ui)\n const modeType: 'form' | 'ui' | null =\n formTag && formTag.arr.setup !== undefined\n ? 'form'\n : uiTag && uiTag.arr.setup !== undefined\n ? 'ui'\n : null;\n\n const _temp_main = generateMain(ctx.compiledCode.JSIR);\n const mainFn = (ctx.mainFn.body = _temp_main[0]);\n const prop: t.ObjectProperty[] = [];\n const app = _enableWithData<t.ObjectProperty[]>();\n const params: t.FunctionParameter[] = (ctx.mainFn.param = [\n t.identifier(config.paramCtx),\n ]);\n const parseCtx: transformParseCtx = {\n impBody: _temp_main[1],\n mainFn,\n prop,\n ctx: ctx,\n app,\n };\n let type: mcxType = 'app';\n\n // Process defineProp for setup mode before component handlers\n if (isSetupMode && modeType) {\n processDefineProp(ctx.compiledCode.JSIR, modeType, parseCtx.impBody);\n }\n\n // enable setup fn: use to generate setup\n const enableSetup = _enable();\n if (ctx.compiledCode.strLoc.Event.isLoad) {\n // handler event type mcx\n type = 'event';\n // enable export setup\n enableSetup();\n await EventComp(parseCtx);\n }\n if (ctx.compiledCode.strLoc.Form) {\n type = 'form';\n enableSetup();\n await FormComp(parseCtx);\n }\n if (ctx.compiledCode.strLoc.UI) {\n type = 'ui';\n enableSetup();\n await UIComp(parseCtx);\n }\n if (\n Object.getOwnPropertyNames(ctx.compiledCode.strLoc.Component).length >= 1\n ) {\n type = 'component';\n await compileComponent(ctx.compiledCode, ctx);\n return `export default {type:'component',setup:null,app:{}}`;\n }\n if (type == 'app') {\n // enable setup export\n enableSetup();\n // find event mcx import\n await AppComp(parseCtx);\n }\n\n // In setup mode, collect all non-exported declarations into the main function's return\n if (isSetupMode) {\n const existingExportNames = new Set<string>();\n for (const exp of ctx.compiledCode.JSIR.BuildCache.export) {\n if (t.isExportNamedDeclaration(exp) && exp.declaration) {\n const ids = extractIdList(exp.declaration);\n for (const id of ids) existingExportNames.add(id);\n }\n }\n for (const p of parseCtx.prop) {\n if (t.isObjectProperty(p) && t.isIdentifier(p.key)) {\n existingExportNames.add(p.key.name);\n }\n }\n const setupDecls = collectSetupDeclarations(\n ctx.compiledCode.JSIR,\n existingExportNames,\n );\n\n // Process hooks (onStartup / onMounted)\n const hooks = processHooks(ctx.compiledCode.JSIR);\n\n const returnStmt = mainFn[mainFn.length - 1];\n if (\n t.isReturnStatement(returnStmt) &&\n t.isObjectExpression(returnStmt.argument)\n ) {\n returnStmt.argument.properties.push(...setupDecls);\n if (hooks.startup) {\n returnStmt.argument.properties.push(\n t.objectProperty(t.identifier('__mcx_startup'), hooks.startup),\n );\n }\n if (hooks.mounted) {\n returnStmt.argument.properties.push(\n t.objectProperty(t.identifier('__mcx_mounted'), hooks.mounted),\n );\n }\n }\n }\n\n // add default export: type\n prop.push(t.objectProperty(t.identifier('type'), t.stringLiteral(type)));\n if (enableSetup.prototype.enable) {\n prop.push(\n t.objectProperty(\n t.identifier('setup'),\n t.identifier(config.scriptCompileFn),\n ),\n );\n }\n if (app.prototype.enable) {\n prop.push(\n t.objectProperty(\n t.identifier('app'),\n t.objectExpression(app.prototype.enable),\n ),\n );\n }\n // generate code\n const code = generate(\n // create program\n t.program([\n ...parseCtx.impBody,\n t.functionDeclaration(\n t.identifier(config.scriptCompileFn),\n params,\n t.blockStatement(mainFn),\n false,\n false,\n ),\n t.exportDefaultDeclaration(t.objectExpression(prop)),\n ]),\n ).code;\n return code;\n}\n","import type { TransformPluginContext } from 'rollup';\nimport { MCXCompileData } from '../compile-mcx/compiler/compileData';\nimport { CompileOpt } from '@mbler/mcx-types';\nimport { transformCtx } from '../types';\nimport { _transform } from './main';\nimport { program } from '@babel/types';\nimport type { RollupError } from 'rolldown';\nfunction createErrorProxy(err: unknown, id: string): RollupError {\n if (err instanceof Error) {\n return {\n ...err,\n message: `${err.message} (At ${id})`,\n };\n } else {\n return { message: String(err) };\n }\n}\nexport async function transform(\n code: MCXCompileData,\n cache: Map<string, MCXCompileData>,\n id: string,\n context: TransformPluginContext,\n opt: CompileOpt,\n output: transformCtx['output'],\n): Promise<string> {\n try {\n const scriptTag = code.raw.find(node => {\n return node.name == 'script';\n });\n if (!scriptTag)\n throw new Error('[transform check]: not found mcx script tag');\n const transformContext: transformCtx = {\n rollupContext: context,\n impAST: [],\n currentAST: program([]),\n opt,\n currentId: id,\n compiledCode: code,\n cache,\n scriptTag: scriptTag,\n mainFn: {\n param: [],\n body: [],\n },\n output,\n };\n const result = await _transform(transformContext);\n return result;\n } catch (err) {\n context.error(createErrorProxy(err, id));\n return '';\n }\n}\n","import type { Plugin, TransformResult } from 'rollup';\nimport type { Plugin as RolldownPlugin } from 'rolldown';\nimport { CompileOpt } from '../types';\nimport { extname } from 'node:path';\nimport { CompileError, compileMCXFn } from '.';\nimport { transform } from '../../transforms';\nimport type { MCXCompileData } from './compileData';\nimport { readFile } from 'node:fs/promises';\nimport MagicString from 'magic-string';\nimport * as path from 'node:path';\nimport { createRequire } from 'node:module';\nimport { transformCtx } from '../../types';\nimport ts from 'typescript';\nimport { readFileSync } from 'node:fs';\nimport {\n generateItemTextureJson,\n clearCachedOptions,\n} from '../../mcx-component';\nfunction createMcxPlugin(opt: CompileOpt, output: transformCtx['output']) {\n let cache: Map<string, MCXCompileData> = new Map();\n let tsconfig: ts.ParsedCommandLine;\n try {\n const configResult = ts.readConfigFile(opt.tsconfigPath, path => {\n try {\n return readFileSync(path, 'utf-8');\n } catch (error) {\n throw new Error(\n `Failed to read TypeScript config file at ${path}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n });\n\n if (configResult.error) {\n throw new Error(\n `TypeScript configuration error: ${configResult.error.messageText}`,\n );\n }\n\n if (!configResult.config) {\n throw new Error(\n `Empty TypeScript configuration file at ${opt.tsconfigPath}`,\n );\n }\n\n // Parse the configuration with proper path resolution\n const parsedConfig = ts.parseJsonConfigFileContent(\n configResult.config,\n ts.sys,\n path.dirname(opt.tsconfigPath),\n undefined,\n opt.tsconfigPath,\n );\n\n if (parsedConfig.errors.length > 0) {\n const errorMessages = parsedConfig.errors\n .map(err => err.messageText)\n .join('\\n');\n throw new Error(\n `TypeScript configuration parsing errors:\\n${errorMessages}`,\n );\n }\n\n tsconfig = parsedConfig;\n } catch (error) {\n // Fallback to default configuration if reading fails\n console.warn(\n `Failed to load TypeScript config from ${opt.tsconfigPath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n console.warn('Using default TypeScript configuration');\n tsconfig = {\n options: {},\n fileNames: [],\n errors: [],\n };\n }\n const resolveExtensions = ['', '.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'];\n const indexExtensions = resolveExtensions.map(ext => '/index' + ext);\n\n async function tryResolvePath(filePath: string): Promise<string | null> {\n for (const idxExt of indexExtensions) {\n try {\n const fullPath = filePath + idxExt;\n await readFile(fullPath, 'utf-8');\n return fullPath;\n } catch {}\n }\n for (const ext of resolveExtensions) {\n try {\n const fullPath = filePath + ext;\n await readFile(fullPath, 'utf-8');\n return fullPath;\n } catch {}\n }\n return null;\n }\n\n async function resolvePackageExports(\n pkgDir: string,\n subPath: string,\n pkgJson: Record<string, unknown>,\n ): Promise<string | null> {\n const exports = pkgJson.exports;\n if (exports) {\n const subImport = subPath.startsWith('./') ? subPath : `./${subPath}`;\n if (typeof exports === 'object' && exports !== null) {\n const exp = exports as Record<string, unknown>;\n if (exp[subImport]) {\n const target = exp[subImport];\n if (typeof target === 'string') {\n return path.join(pkgDir, target);\n } else if (typeof target === 'object' && target !== null) {\n const targetObj = target as Record<string, unknown>;\n if (targetObj.import) {\n return path.join(pkgDir, targetObj.import as string);\n }\n return path.join(\n pkgDir,\n (targetObj.default as string) ||\n (Object.values(targetObj)[0] as string),\n );\n }\n }\n if (subImport.endsWith('/') || subImport.endsWith('/*')) {\n const dirMapping = subImport.slice(0, -1);\n for (const [key, value] of Object.entries(exp)) {\n if (key.startsWith(dirMapping) && key !== dirMapping) {\n const target = value as string;\n return path.join(pkgDir, target);\n }\n }\n }\n } else if (typeof exports === 'string') {\n return path.join(pkgDir, exports);\n }\n }\n return null;\n }\n\n return {\n name: 'mbler-mcx-core',\n async resolveId(id, imp) {\n const i = path.parse(id);\n if (i.dir.startsWith('.') || i.root) {\n if (imp) {\n const baseDir = path.dirname(imp);\n const resolved = await tryResolvePath(path.join(baseDir, id));\n if (resolved) return resolved;\n }\n return null;\n } else {\n // First try Node.js native resolution for reliable symlink/pkg resolution\n if (imp) {\n try {\n const localRequire = createRequire(imp);\n const resolved = localRequire.resolve(id);\n if (resolved) return resolved;\n } catch {\n // fall through to manual resolution\n }\n }\n const isScopedPackage = id.startsWith('@');\n const parts = id.split('/');\n const pkgName = isScopedPackage\n ? `${parts[0]}/${parts[1]}`\n : (parts[0] as string);\n const subPath = isScopedPackage\n ? parts.slice(2).join('/')\n : parts.slice(1).join('/');\n const d = path.join(opt.moduleDir, pkgName);\n let pkgJson: Record<string, unknown>;\n try {\n pkgJson = JSON.parse(\n await readFile(path.join(d, 'package.json'), 'utf-8'),\n );\n } catch (err: unknown) {\n const nodeErr = err as { code?: string; message?: string };\n if (!nodeErr.code || nodeErr.code === 'ENOENT') {\n throw new Error(\n `[mcx resolveId]: package.json not found for '${id}' at '${d}'`,\n );\n } else {\n throw new Error(\n `[mcx resolveId]: invalid package.json for '${id}': ${nodeErr.message}`,\n );\n }\n }\n if (subPath) {\n const fromExports = await resolvePackageExports(d, subPath, pkgJson);\n if (fromExports) return fromExports;\n const fromDist = await tryResolvePath(\n path.join(d, './dist', subPath),\n );\n if (fromDist) return fromDist;\n const fromRoot = await tryResolvePath(path.join(d, subPath));\n if (fromRoot) return fromRoot;\n return null;\n }\n return path.join(d, pkgJson.main as string);\n }\n },\n transform: async function (\n code: string,\n id: string,\n ): Promise<TransformResult> {\n const magic = new MagicString(code);\n const ext = extname(id).slice(1);\n const tsRegex = /^.+?\\.(ts|mts|cts)$/;\n if (ext == 'mcx') {\n let compileData: MCXCompileData;\n try {\n compileData = cache.has(id)\n ? (cache.get(id) as MCXCompileData)\n : compileMCXFn(code);\n cache.set(id, compileData);\n } catch (err: unknown) {\n if (err instanceof CompileError) {\n this.error(err.message, {\n column: err.loc.column,\n line: err.loc.line,\n });\n } else {\n this.error(\n err instanceof Error\n ? `${err.message} : ${err.stack}`\n : String(err),\n );\n }\n return;\n }\n compileData.setFilePath(id);\n const compiledCode = await transform(\n compileData,\n cache,\n id,\n this,\n opt,\n output,\n );\n return {\n code: compiledCode,\n map: opt.sourcemap\n ? magic.generateMap({ hires: true, source: id })\n : void 0,\n };\n } else if (tsRegex.test(id)) {\n // Use the parsed TypeScript configuration\n const compiledCode = ts.transpileModule(code, {\n compilerOptions: tsconfig.options,\n fileName: id,\n }).outputText;\n return {\n code: compiledCode,\n map: opt.sourcemap\n ? magic.generateMap({ hires: true, source: id })\n : void 0,\n };\n }\n return null;\n },\n async buildEnd() {\n cache.clear();\n await generateItemTextureJson(output);\n clearCachedOptions();\n },\n buildStart() {\n cache = new Map();\n },\n } satisfies Plugin;\n}\n\nexport function rollupPlugin(\n opt: CompileOpt,\n output: transformCtx['output'],\n): Plugin {\n return createMcxPlugin(opt, output);\n}\n\nexport function rolldownPlugin(\n opt: CompileOpt,\n output: transformCtx['output'],\n): RolldownPlugin {\n return createMcxPlugin(opt, output) as unknown as RolldownPlugin;\n}\n","import type { TransformPluginContext } from 'rollup';\nimport type { MCXCompileData } from './compile-mcx/compiler/compileData';\nimport { CompileOpt } from '@mbler/mcx-types';\nimport * as t from '@babel/types';\ninterface BaseToken {\n data: string;\n type: TokenType;\n start: MCXPosition;\n end: MCXPosition;\n}\ninterface TagToken extends BaseToken {\n type: 'Tag';\n}\ninterface TagEndToken extends BaseToken {\n type: 'TagEnd';\n}\ninterface ContentToken extends BaseToken {\n type: 'Content';\n}\ninterface CommentToken extends BaseToken {\n type: 'Comment';\n}\ntype Token = TagToken | TagEndToken | ContentToken | CommentToken;\ntype AttributeMap = Record<string, string | boolean>;\n/** 统一的位置信息结构 */\ninterface MCXPosition {\n line: number;\n column: number;\n}\n\ninterface MCXLoc {\n start: MCXPosition;\n end: MCXPosition;\n}\ninterface ParsedTagNode {\n start: TagToken;\n name: string;\n arr: AttributeMap;\n content: (ParsedTagContentNode | ParsedTagNode | ParsedCommentNode)[];\n end: TagEndToken | null;\n loc: MCXLoc;\n type: 'TagNode';\n}\ninterface ParsedTagContentNode {\n data: string;\n type: 'TagContent';\n}\ninterface ParsedCommentNode {\n data: string;\n type: 'Comment';\n loc?: MCXLoc;\n}\ntype TokenType = 'Tag' | 'TagEnd' | 'Content' | 'Comment';\ntype PropValue = number | string | object;\ninterface PropNode {\n key: string;\n value: PropValue;\n type: 'PropChar' | 'PropObject';\n}\ntype JsType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'object'\n | 'function'\n | 'bigint'\n | 'symbol';\ninterface TypeVerifyBody {\n [key: string]: JsType;\n}\nexport interface ParseReadFileOpt {\n delay: number;\n maxRetries: number;\n want: 'string' | 'object';\n}\nexport type ReadFileOpt = Partial<ParseReadFileOpt>;\nexport type mcxType = 'component' | 'event' | 'app' | 'ui' | 'form';\nexport type {\n Token,\n ContentToken,\n TagEndToken,\n TagToken,\n CommentToken,\n BaseToken,\n AttributeMap,\n PropValue,\n TokenType,\n ParsedTagContentNode,\n ParsedCommentNode,\n TypeVerifyBody,\n JsType,\n PropNode,\n ParsedTagNode,\n MCXLoc,\n MCXPosition,\n};\nexport interface transformCtx {\n rollupContext: TransformPluginContext;\n compiledCode: MCXCompileData;\n cache: Map<string, MCXCompileData>;\n currentId: string;\n scriptTag: ParsedTagNode;\n currentAST: t.Program;\n mainFn: {\n param: t.FunctionParameter[];\n body: t.Statement[];\n };\n impAST: t.ImportDeclaration[];\n opt: CompileOpt;\n output: {\n dist: string;\n behavior: string;\n resources: string;\n };\n}\nexport interface transformParseCtx {\n prop: t.ObjectProperty[];\n impBody: t.ImportDeclaration[];\n mainFn: t.Statement[];\n ctx: transformCtx;\n app: ((data: t.ObjectProperty[]) => void) & {\n prototype: { enable: t.ObjectProperty[] | null };\n };\n}\n","import type {\n Rarity,\n ItemComponentOptions,\n FoodEffect,\n EntityComponentOptions,\n} from '@mbler/mcx-component';\n\nexport interface FilePoint {\n base: 'behavior' | 'resources' | 'root';\n file: string;\n}\n\nexport interface FileBindSource {\n bind: 'item_texture';\n type: 'append' | 'all_replace';\n}\n\nexport type DefineEntry =\n | {\n from: 'var';\n data: string;\n }\n | {\n from: 'read_file';\n data: FilePoint;\n default?: string;\n };\n\nexport type FileEditExpression<\n T extends Record<string, DefineEntry> = Record<string, DefineEntry>,\n> = {\n define: T;\n run: (define: { [K in keyof T]: string }) => Promise<\n string | string[] | [string, string][]\n >;\n};\n\nexport function createFileEdit<\n T extends Record<string, DefineEntry>,\n>(expression: {\n define: T;\n run: (define: { [K in keyof T]: string }) => Promise<\n string | string[] | [string, string][]\n >;\n}): FileEditExpression<T> {\n return expression;\n}\n\nexport type FileEditOption =\n | {\n type: 'edit';\n id?: string;\n source: FilePoint | FileBindSource;\n expression: FileEditExpression<Record<string, DefineEntry>>;\n }\n | {\n type: 'copy_assets';\n id?: string;\n source: FilePoint;\n output: FilePoint;\n };\n\nexport interface BaseJson {\n format_version: string;\n _meta: {\n type: 'item' | 'entity';\n file_edit?: (\n | FileEditOption\n | {\n type: 'batch';\n options: FileEditOption[];\n id?: string;\n }\n )[];\n };\n}\n\nexport type {\n Rarity,\n ItemCompon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IAChB,IAAI;IACJ,IAAI;KACF,cAAc,MAAM,IAAI,GAAG,GACtB,MAAM,IAAI,GAAG,GACd,aAAa,KAAK;KACtB,MAAM,IAAI,IAAI,YAAY;aACnB,KAAc;KACrB,IAAI,eAAe,cACjB,KAAK,MAAM,IAAI,SAAS;MACtB,QAAQ,IAAI,IAAI;MAChB,MAAM,IAAI,IAAI;MACf,CAAC;UAEF,KAAK,MACH,eAAe,QACX,GAAG,IAAI,QAAQ,KAAK,IAAI,UACxB,OAAO,IAAI,CAChB;KAEH;;IAEF,YAAY,YAAY,GAAG;IAS3B,OAAO;KACL,MAAM,MATmB,UACzB,aACA,OACA,IACA,MACA,KACA,OACD;KAGC,KAAK,IAAI,YACL,MAAM,YAAY;MAAE,OAAO;MAAM,QAAQ;MAAI,CAAC,GAC9C,KAAK;KACV;UACI,IAAI,QAAQ,KAAK,GAAG,EAMzB,OAAO;IACL,MALmB,GAAG,gBAAgB,MAAM;KAC5C,iBAAiB,SAAS;KAC1B,UAAU;KACX,CAAC,CAAC;IAGD,KAAK,IAAI,YACL,MAAM,YAAY;KAAE,OAAO;KAAM,QAAQ;KAAI,CAAC,GAC9C,KAAK;IACV;GAEH,OAAO;;EAET,MAAM,WAAW;GACf,MAAM,OAAO;GACb,MAAM,wBAAwB,OAAO;GACrC,oBAAoB;;EAEtB,aAAa;GACX,wBAAQ,IAAI,KAAK;;EAEpB;;AAGH,SAAgB,aACd,KACA,QACQ;CACR,OAAO,gBAAgB,KAAK,OAAO;;AAGrC,SAAgB,eACd,KACA,QACgB;CAChB,OAAO,gBAAgB,KAAK,OAAO;;;;;;;;;;AEpPrC,SAAgB,eAEd,YAKwB;CACxB,OAAO"}
1
+ {"version":3,"file":"index.js","names":["interpNode","AST_tag","AST_prop","Utils","CompileData.JsCompileData","Utils","CompileData.MCXCompileData","babelErr","Utils","config","McxUtils","Comp","config","Comp","config","Comp","config","config","EventComp","FormComp","UIComp","AppComp"],"sources":["../src/ast/tag.ts","../src/ast/prop.ts","../src/ast/index.ts","../src/compile-mcx/types.ts","../src/compile-mcx/compiler/compileData.ts","../src/compile-mcx/compiler/utils.ts","../src/compile-mcx/compiler/index.ts","../src/transforms/config.ts","../src/utils.ts","../src/transforms/file_id.ts","../src/transforms/utils.ts","../src/transforms/transform/layout.ts","../src/transforms/transform/ui.ts","../src/transforms/transform/form.ts","../src/transforms/transform/event.ts","../src/transforms/transform/app.ts","../src/mcx-component/cjsTransform.ts","../src/mcx-component/vm.ts","../src/mcx-component/index.ts","../src/transforms/main.ts","../src/transforms/index.ts","../src/compile-mcx/compiler/main.ts","../src/types.ts","../src/mcx-component/types.ts"],"sourcesContent":["import type {\n ParsedTagNode,\n ParsedTagContentNode,\n ParsedCommentNode,\n AttributeMap,\n TagToken,\n TagEndToken,\n} from '../types';\nimport {\n baseParse,\n NodeTypes,\n type RootNode,\n type TemplateChildNode,\n type BaseElementNode,\n type AttributeNode,\n type DirectiveNode,\n type TextNode,\n type CommentNode as VueCommentNode,\n type InterpolationNode,\n type SimpleExpressionNode,\n} from '@vue/compiler-core';\n\nfunction getExpressionContent(expr: { content?: string } | undefined): string {\n return expr?.content ?? 'true';\n}\n\n/** Convert absolute character offset in source to MCX position (line: 1-indexed, column: 0-indexed) */\nfunction absOffsetToMCXPos(\n source: string,\n absOffset: number,\n): { line: number; column: number } {\n let line = 1;\n let col = 0;\n const len = Math.min(absOffset, source.length);\n for (let i = 0; i < len; i++) {\n if (source.charCodeAt(i) === 10) {\n line++;\n col = 0;\n } else {\n col++;\n }\n }\n return { line, column: col };\n}\n\nexport default class McxAst {\n private text: string;\n private includeComments: boolean;\n\n constructor(text: string, includeComments: boolean = false) {\n this.text = text;\n this.includeComments = includeComments;\n }\n\n parseAST(): ParsedTagNode[] {\n const ast: RootNode = baseParse(this.text, {\n comments: true,\n whitespace: 'preserve',\n });\n const result: ParsedTagNode[] = [];\n for (const child of ast.children) {\n const node = this.convertTemplateChild(child);\n if (node && node.type === 'TagNode') result.push(node);\n }\n return result;\n }\n\n private convertTemplateChild(\n node: TemplateChildNode,\n ): ParsedTagNode | ParsedTagContentNode | ParsedCommentNode | null {\n if (node.type === NodeTypes.ELEMENT) {\n return this.convertVueElement(node as BaseElementNode);\n }\n if (node.type === NodeTypes.TEXT) {\n const textNode = node as TextNode;\n if (textNode.content.trim()) {\n return { data: textNode.content, type: 'TagContent' };\n }\n return null;\n }\n if (node.type === NodeTypes.INTERPOLATION) {\n const interpNode = node as InterpolationNode;\n return {\n data: `{{ ${getExpressionContent(interpNode.content as SimpleExpressionNode)} }}`,\n type: 'TagContent',\n };\n }\n if (this.includeComments && node.type === NodeTypes.COMMENT) {\n const commentNode = node as VueCommentNode;\n return {\n data: commentNode.content,\n type: 'Comment',\n loc: {\n start: {\n line: commentNode.loc.start.line,\n column: commentNode.loc.start.column,\n },\n end: {\n line: commentNode.loc.end.line,\n column: commentNode.loc.end.column,\n },\n },\n };\n }\n return null;\n }\n\n private convertVueElement(node: BaseElementNode): ParsedTagNode {\n const attrs: AttributeMap = {};\n for (const prop of node.props) {\n if (prop.type === NodeTypes.ATTRIBUTE) {\n const attr = prop as AttributeNode;\n attrs[attr.name] = attr.value?.content ?? 'true';\n } else if (prop.type === NodeTypes.DIRECTIVE) {\n const dir = prop as DirectiveNode;\n if (dir.name === 'bind') {\n const key = `:${getExpressionContent(dir.arg as SimpleExpressionNode)}`;\n attrs[key] = getExpressionContent(dir.exp as SimpleExpressionNode);\n } else if (dir.name === 'on') {\n const key = `@${getExpressionContent(dir.arg as SimpleExpressionNode)}`;\n attrs[key] = getExpressionContent(dir.exp as SimpleExpressionNode);\n }\n }\n }\n const children = this.convertVueChildren(node.children);\n\n const fullSource = this.text;\n const baseOffset = node.loc.start.offset;\n const elementSource = node.loc.source;\n\n // Find the end of the opening tag (first unquoted >)\n let openEnd = elementSource.length;\n let inQuote: string | null = null;\n for (let i = 0; i < elementSource.length; i++) {\n const c = elementSource[i];\n if (inQuote) {\n if (c === '\\\\') {\n i++;\n continue;\n }\n if (c === inQuote) inQuote = null;\n } else if (c === '\"' || c === \"'\") {\n inQuote = c;\n } else if (c === '>') {\n openEnd = i + 1;\n break;\n }\n }\n\n // Find the start of the closing tag (last </)\n let closeStart = -1;\n if (!node.isSelfClosing) {\n for (let i = elementSource.length - 2; i >= 0; i--) {\n if (elementSource[i] === '<' && elementSource[i + 1] === '/') {\n closeStart = i;\n break;\n }\n }\n }\n\n const openTagStartAbs = baseOffset;\n const openTagEndAbs = baseOffset + openEnd;\n\n let endToken: TagEndToken | null = null;\n if (closeStart >= 0) {\n const closeTagStartAbs = baseOffset + closeStart;\n const closeTagEndAbs = baseOffset + elementSource.length;\n endToken = {\n data: elementSource.slice(closeStart),\n type: 'TagEnd',\n start: absOffsetToMCXPos(fullSource, closeTagStartAbs),\n end: absOffsetToMCXPos(fullSource, closeTagEndAbs),\n };\n }\n\n return {\n start: {\n data: elementSource.slice(0, openEnd),\n type: 'Tag',\n start: absOffsetToMCXPos(fullSource, openTagStartAbs),\n end: absOffsetToMCXPos(fullSource, openTagEndAbs),\n },\n name: node.tag,\n arr: attrs,\n content: children,\n end: endToken,\n loc: {\n start: {\n line: node.loc.start.line,\n column: node.loc.start.column,\n },\n end: {\n line: node.loc.end.line,\n column: node.loc.end.column,\n },\n },\n type: 'TagNode',\n };\n }\n\n private convertVueChildren(\n children: TemplateChildNode[],\n ): (ParsedTagNode | ParsedTagContentNode | ParsedCommentNode)[] {\n const result: (ParsedTagNode | ParsedTagContentNode | ParsedCommentNode)[] =\n [];\n for (const child of children) {\n const node = this.convertTemplateChild(child);\n if (node) result.push(node);\n }\n return result;\n }\n\n static generateCode(node: ParsedTagNode): string {\n let code = `<${node.name}`;\n for (const [key, value] of Object.entries(node.arr || {})) {\n if (value === 'true') {\n code += ` ${key}`;\n } else {\n code += ` ${key}=${String(value)}`;\n }\n }\n code += '>';\n const contentArr = node.content;\n if (Array.isArray(contentArr)) {\n for (const item of contentArr) {\n if ((item as ParsedTagContentNode).type === 'TagContent') {\n code += (item as ParsedTagContentNode).data;\n } else if ((item as ParsedCommentNode).type === 'Comment') {\n code += (item as ParsedCommentNode).data;\n } else {\n code += McxAst.generateCode(item as ParsedTagNode);\n }\n }\n }\n code += `</${node.name}>`;\n return code;\n }\n}\n\nexport { MCXUtils };\nclass MCXUtils {\n static isTagNode(node: unknown): node is ParsedTagNode {\n return (\n !!node &&\n typeof node === 'object' &&\n 'start' in (node as object) &&\n 'name' in (node as object) &&\n 'arr' in (node as object) &&\n 'content' in (node as object) &&\n 'end' in (node as object)\n );\n }\n static isTagContentNode(node: unknown): node is ParsedTagContentNode {\n return (\n !!node &&\n typeof node === 'object' &&\n 'data' in (node as object) &&\n 'type' in (node as object) &&\n (node as ParsedTagContentNode).type === 'TagContent'\n );\n }\n static isCommentNode(node: unknown): node is ParsedCommentNode {\n return (\n !!node &&\n typeof node === 'object' &&\n 'data' in (node as object) &&\n 'type' in (node as object) &&\n 'loc' in (node as object) &&\n (node as ParsedCommentNode).type === 'Comment'\n );\n }\n static isAttributeMap(obj: unknown): obj is AttributeMap {\n return !!obj && typeof obj === 'object' && !Array.isArray(obj);\n }\n static isParseNode(node: unknown): node is ParsedTagNode[] {\n return Array.isArray(node) && (node as unknown[]).every(MCXUtils.isTagNode);\n }\n static isToken(_obj: unknown): boolean {\n return false;\n }\n static isTagToken(_obj: unknown): boolean {\n return false;\n }\n static isTagEndToken(_obj: unknown): boolean {\n return false;\n }\n static isContentToken(_obj: unknown): boolean {\n return false;\n }\n static isCommentToken(_obj: unknown): boolean {\n return false;\n }\n static isBaseToken(_obj: unknown): boolean {\n return false;\n }\n static isTokenType(_value: unknown): boolean {\n return false;\n }\n}\n","import type { PropNode, PropValue } from '../types.js';\n\nconst STATUS = [0, 1]; // 0: key,1: value\n\nexport class Lexer {\n private code: string;\n\n constructor(code: string) {\n this.code = code;\n }\n *tokenize(): IterableIterator<PropNode> {\n let currStatus = STATUS[0]; // 0: key,1: value\n let key = '';\n let value = '';\n let hasEquals = false;\n\n for (const char of this.code) {\n if (/\\s/.test(char)) {\n if (char === '\\n') {\n if (currStatus === STATUS[1] && key && value) {\n const propNode: PropNode = {\n key,\n value: this.HandlerValue(value),\n type: 'PropChar',\n };\n yield propNode;\n } else if (currStatus === STATUS[0] && key) {\n }\n key = '';\n value = '';\n hasEquals = false;\n currStatus = STATUS[0];\n }\n continue; // 跳过所有空白字符\n }\n\n if (char === '=') {\n if (currStatus === STATUS[0]) {\n currStatus = STATUS[1]; // set to value\n hasEquals = true;\n }\n } else {\n if (currStatus === STATUS[0]) {\n key += char; // key\n } else if (currStatus === STATUS[1]) {\n value += char; // value\n }\n }\n }\n if (key && value) {\n const propNode: PropNode = {\n key,\n value: this.HandlerValue(value),\n type: 'PropChar',\n };\n yield propNode;\n }\n }\n HandlerValue(value: string): PropValue {\n const num = Number(value);\n if (!Number.isNaN(num)) return num;\n if (\n ['[', '{'].includes(value.slice(0, 1)) &&\n [']', '}'].includes(value.slice(-1))\n ) {\n return JSON.parse(value);\n }\n return value;\n }\n}\nexport default function PropParser(code: string): PropNode[] {\n const lexer = new Lexer(code);\n return Array.from(lexer.tokenize());\n}\n","import AST_tag from './tag.js';\nimport AST_prop from './prop.js';\nexport default {\n tag: AST_tag,\n prop: AST_prop,\n};\n","import type {\n ImportDeclaration,\n ExportAllDeclaration,\n ExportDefaultDeclaration,\n ExportNamedDeclaration,\n Expression,\n SpreadElement,\n ArgumentPlaceholder,\n CallExpression,\n} from '@babel/types';\nimport { CompileOpt } from '@mbler/mcx-types';\nimport { ParsedTagNode } from '../types';\ninterface callList {\n source: Expression;\n set: (callEXp: CallExpression) => boolean;\n arguments: Array<SpreadElement | Expression | ArgumentPlaceholder>;\n remove: () => void;\n}\ninterface ImportListImport {\n isAll: boolean;\n import?: string | undefined;\n as: string;\n}\ninterface ImportList {\n source: string;\n imported: ImportListImport[];\n raw?: ImportDeclaration;\n}\ninterface BuildCache {\n call: callList[];\n import: ImportList[];\n export: Array<\n ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration\n >;\n}\nexport const _MCXstructureLocComponentTypes = {\n items: 'item',\n blocks: 'block',\n entities: 'entity',\n} as const;\ntype MCXstructureLocComponentType =\n (typeof _MCXstructureLocComponentTypes)[keyof typeof _MCXstructureLocComponentTypes];\ninterface MCXstructureLoc {\n script: string;\n Event: {\n on: 'after' | 'before';\n subscribe: Record<string, string>;\n loc: { line: number; column: number };\n isLoad: boolean;\n };\n Component: Record<\n string,\n {\n type: MCXstructureLocComponentType;\n useExpore: string;\n loc: { line: number; column: number };\n }\n >;\n UI: ParsedTagNode | null;\n Form: ParsedTagNode | null;\n}\nexport type {\n BuildCache,\n ImportList,\n ImportListImport,\n callList,\n CompileOpt,\n MCXstructureLoc,\n MCXstructureLocComponentType,\n};\n","import * as t from '@babel/types';\nimport { BuildCache, MCXstructureLoc } from '../types';\nimport { ParsedTagNode } from '../../types';\nexport class JsCompileData {\n File: string = '__repl';\n isFile: boolean = false;\n constructor(\n public node: t.Program,\n public BuildCache: BuildCache = {\n export: [],\n import: [],\n call: [],\n },\n ) {}\n setFilePath(dir: string) {\n this.isFile = true;\n this.File = dir;\n }\n}\nexport class MCXCompileData {\n File: string = '';\n isFile: boolean = false;\n constructor(\n public raw: ParsedTagNode[],\n public JSIR: JsCompileData,\n public strLoc: MCXstructureLoc,\n ) {}\n setFilePath(dir: string) {\n this.JSIR.setFilePath(dir);\n this.isFile = true;\n this.File = dir;\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport * as Parser from '@babel/parser';\nimport { ImportList, ImportListImport } from '../types';\nimport * as t from '@babel/types';\nexport default class Utils {\n public static async FileAST(\n fileDir: string,\n parserOpt: Parser.ParserOptions,\n ): Promise<t.Program> {\n if (typeof fileDir !== 'string')\n throw new TypeError(\n '[read file]: compile utils was passed a non-string value',\n );\n const file = await readFile(fileDir, 'utf-8');\n if (typeof file !== 'string')\n throw new Error('[read file]: not found file ' + fileDir);\n try {\n return Parser.parse(file, parserOpt).program;\n } catch (err: unknown) {\n throw new Error(\n '[compiler]: babel error' +\n (err instanceof Error ? err.stack : String(err)),\n );\n }\n }\n public static async FileContent(fileDir: string): Promise<string> {\n const file = await readFile(fileDir, 'utf-8');\n return file;\n }\n private static nodeStringValue(node: t.Identifier | t.StringLiteral): string {\n if (node.type == 'StringLiteral') {\n return node.value;\n } else if (node.type == 'Identifier') {\n return node.name;\n }\n throw new TypeError('[read id error]: no way to read string id');\n }\n private static CheckImportNode(\n node: t.ImportDeclaration,\n ir: ImportList,\n ): boolean {\n const newList = Utils.ImportToCache(node);\n // Eliminate common differences\n if (newList.source !== ir.source) return false;\n if (newList.imported.length !== ir.imported.length) return false;\n // in this for, newList.imported and ir.imported is same length\n for (let irIndex = 0; irIndex < newList.imported.length; irIndex++) {\n const newItem = newList.imported[irIndex];\n const oldItem = ir.imported[irIndex];\n if (\n newItem?.import !== oldItem?.import ||\n newItem?.as !== oldItem?.as ||\n newItem?.isAll !== oldItem?.isAll\n )\n return false;\n }\n return true;\n }\n public static CacheToImportNode(ir: ImportList): t.ImportDeclaration {\n if (!ir) throw new TypeError('plase call use right ImportList');\n // first verify ir.raw\n if (ir?.raw && Utils.CheckImportNode(ir?.raw, ir)) return ir.raw;\n const result: Array<\n t.ImportNamespaceSpecifier | t.ImportSpecifier | t.ImportDefaultSpecifier\n > = [];\n for (const ImportIt of ir.imported) {\n if (!ImportIt) continue;\n if (ImportIt.isAll) {\n result.push(t.importNamespaceSpecifier(t.identifier(ImportIt.as)));\n continue;\n }\n if (ImportIt.import == 'default') {\n result.push(t.importDefaultSpecifier(t.identifier(ImportIt.as)));\n continue;\n }\n if (!ImportIt.import)\n throw new TypeError('[compile node]: not found imported');\n result.push(\n t.importSpecifier(\n t.identifier(ImportIt.as),\n t.identifier(ImportIt.import),\n ),\n );\n }\n return t.importDeclaration(result, t.stringLiteral(ir.source));\n }\n public static ImportToCache(node: t.ImportDeclaration): ImportList {\n const result: ImportListImport[] = [];\n for (const item of node.specifiers) {\n const thisName = item.local.name;\n if (item.type == 'ImportNamespaceSpecifier') {\n result.push({\n isAll: true,\n as: thisName,\n });\n } else if (item.type == 'ImportDefaultSpecifier') {\n result.push({\n isAll: false,\n import: 'default',\n as: thisName,\n });\n } else if (item.type == 'ImportSpecifier') {\n result.push({\n isAll: false,\n as: thisName,\n import: Utils.nodeStringValue(item.imported),\n });\n }\n }\n return {\n source: Utils.nodeStringValue(node.source),\n imported: result,\n };\n }\n}\n","import * as t from '@babel/types';\nimport {\n _MCXstructureLocComponentTypes,\n ImportList,\n ImportListImport,\n MCXstructureLoc,\n MCXstructureLocComponentType,\n} from '../types';\nimport * as CompileData from './compileData';\nimport Utils from './utils';\nimport { parse } from '@babel/parser';\nimport { ParsedTagContentNode, ParsedTagNode } from '../../types';\nimport McxAst, { MCXUtils } from '../../ast/tag';\nimport PropParser from '../../ast/prop';\nimport ts from 'typescript';\nexport class CompileError extends Error {\n public loc: { line: number; column: number };\n constructor(message: string, loc: { line: number; column: number }) {\n super(message);\n this.name = 'CompileError';\n this.loc = loc || { line: -1, column: -1 };\n }\n}\n\nfunction extractLoc(node: unknown): { line: number; column: number } {\n if (!node || typeof node !== 'object') return { line: -1, column: -1 };\n const n = node as Record<string, unknown>;\n const loc = n.loc as Record<string, unknown> | undefined;\n // Node with loc.start (Babel or MCX): prefer column\n if (loc?.start) {\n const start = loc.start as Record<string, unknown>;\n const line = typeof start.line === 'number' ? start.line : -1;\n const column = typeof start.column === 'number' ? start.column : -1;\n return { line, column };\n } else if (loc && loc.column !== undefined) {\n return {\n line: typeof loc.line === 'number' ? loc.line : -1,\n column: loc.column as number,\n };\n }\n // MCX Token with unified position: start: { line, column }\n const start = n.start as Record<string, unknown> | undefined;\n if (start && typeof start.line === 'number') {\n return {\n line: start.line,\n column: typeof start.column === 'number' ? (start.column as number) : -1,\n };\n }\n return { line: -1, column: -1 };\n}\n\nfunction makeError(msg: string, node?: unknown) {\n return new CompileError(msg, extractLoc(node));\n}\ninterface ImportTemp {\n source: string;\n import?: string | undefined;\n isAll: boolean;\n}\nexport type Context = Record<string, t.Expression | { status: 'wait' }>;\nexport class CompileJS {\n constructor(public node: t.Program) {\n if (!t.isProgram(node))\n throw makeError(\n \"[compile error]: jsCompile can't work in a not program\",\n node,\n );\n this.CompileData = new CompileData.JsCompileData(node);\n this.run();\n this.writeBuildCache();\n }\n public TopContext: Context = {};\n private indexTemp: Record<string, ImportTemp> = {};\n private push(source: ImportList) {\n for (const node of source.imported) {\n this.indexTemp[node.as] = {\n source: source.source,\n import: node.import,\n isAll: node.isAll,\n };\n }\n }\n private writeBuildCache() {\n const build: ImportList[] = [];\n for (const [as, data] of Object.entries(this.indexTemp)) {\n let found = false;\n for (const i of build) {\n if (i.source === data.source) {\n i.imported.push({ as, isAll: data.isAll, import: data.import });\n found = true;\n break;\n }\n }\n if (!found) {\n build.push({\n source: data.source,\n imported: [{ as, import: data.import, isAll: data.isAll }],\n });\n }\n }\n this.CompileData.BuildCache.import = build;\n }\n private CompileData: CompileData.JsCompileData;\n public getCompileData(): CompileData.JsCompileData {\n return this.CompileData;\n }\n\n private tre(node: t.Block, ExtendContext: Context = {}): void {\n if (!t.isBlock(node))\n throw makeError(\"[compile error]: can't for in not block node\", node);\n const isTop: boolean = t.isProgram(node);\n const currenyContext: Context = isTop ? this.TopContext : ExtendContext;\n for (let index = 0; index < node.body.length; index++) {\n const item = node.body[index];\n const remove = () => {\n node.body.splice(index, 1);\n index--;\n };\n if (!item) continue;\n if (item.type == 'ImportDeclaration') {\n if (!isTop)\n throw makeError(\n '[compile node]: import declaration must use in top.',\n item,\n );\n this.push(Utils.ImportToCache(item));\n remove();\n } else if (item.type == 'BlockStatement') {\n this.tre(item, currenyContext);\n } else if (\n item.type == 'BreakStatement' ||\n item.type == 'EmptyStatement' ||\n item.type == 'ContinueStatement' ||\n item.type == 'ThrowStatement' ||\n item.type == 'WithStatement'\n ) {\n continue;\n } else if (item.type == 'TryStatement') {\n this.tre(item.block, currenyContext);\n } else if (item.type == 'IfStatement') {\n const nodes: t.Statement[] = [item.consequent];\n if (item.alternate) nodes.push(item.alternate);\n this.tre(t.blockStatement(nodes), currenyContext);\n } else if (item.type == 'WhileStatement') {\n this.tre(t.blockStatement([item.body]), currenyContext);\n } else if (item.type == 'ClassDeclaration') {\n if (item.superClass) {\n const superClass = item.superClass;\n if (\n superClass.type == 'ArrayExpression' ||\n superClass.type == 'BooleanLiteral' ||\n superClass.type == 'BinaryExpression' ||\n superClass.type == 'ThisExpression' ||\n superClass.type == 'ArrowFunctionExpression' ||\n superClass.type == 'BigIntLiteral' ||\n superClass.type == 'NumericLiteral' ||\n superClass.type == 'NullLiteral' ||\n superClass.type == 'AssignmentExpression' ||\n superClass.type == 'Super' ||\n superClass.type == 'NewExpression' ||\n superClass.type == 'DoExpression' ||\n superClass.type == 'StringLiteral' ||\n superClass.type == 'YieldExpression' ||\n superClass.type == 'RecordExpression' ||\n superClass.type == 'RegExpLiteral' ||\n superClass.type == 'DecimalLiteral' ||\n superClass.type == 'BindExpression'\n )\n throw makeError(\n \"[compilr error]: class can't extends a not constructor or null\",\n superClass,\n );\n }\n } else if (item.type == 'DoWhileStatement') {\n this.tre(t.blockStatement([item.body]));\n } else if (item.type == 'VariableDeclaration') {\n const declaration = item.declarations;\n for (const varDef of declaration) {\n const init = varDef.init;\n const id = varDef.id;\n if (id.type == 'Identifier') {\n if (!init && (item.kind == 'let' || item.kind == 'var'))\n currenyContext[id.name] = {\n status: 'wait',\n };\n if (!init)\n throw makeError(\n \"[compilr node]: 'const' must has a init\",\n varDef,\n );\n currenyContext[id.name] = init;\n if (\n init &&\n t.isCallExpression(init) &&\n t.isIdentifier(init.callee) &&\n init.callee.name === 'require' &&\n init.arguments.length > 0 &&\n t.isStringLiteral(init.arguments[0])\n ) {\n this.indexTemp[id.name] = {\n source: (init.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n } else if (\n init &&\n t.isCallExpression(init) &&\n t.isImport(init.callee) &&\n init.arguments.length > 0 &&\n t.isStringLiteral(init.arguments[0])\n ) {\n this.indexTemp[id.name] = {\n source: (init.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n }\n }\n }\n } else if (item.type == 'ReturnStatement') {\n continue;\n } else if (\n item.type == 'ExportAllDeclaration' ||\n item.type == 'ExportDefaultDeclaration' ||\n item.type == 'ExportNamedDeclaration'\n ) {\n if (!isTop) {\n throw makeError(\"[compiler]: export node can't in not top\", item);\n }\n this.CompileData.BuildCache.export.push(item);\n remove();\n } else if (item.type == 'SwitchStatement') {\n for (const caseItem of item.cases) {\n this.tre(t.blockStatement(caseItem.consequent), currenyContext);\n }\n } else if (item.type == 'ExpressionStatement') {\n const expr = item.expression;\n if (\n t.isCallExpression(expr) &&\n t.isIdentifier(expr.callee) &&\n expr.callee.name === 'require' &&\n expr.arguments.length > 0 &&\n t.isStringLiteral(expr.arguments[0])\n ) {\n this.indexTemp[\n `__require_${(expr.arguments[0] as t.StringLiteral).value}`\n ] = {\n source: (expr.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n } else if (\n t.isCallExpression(expr) &&\n t.isImport(expr.callee) &&\n expr.arguments.length > 0 &&\n t.isStringLiteral(expr.arguments[0])\n ) {\n this.indexTemp[\n `__import_${(expr.arguments[0] as t.StringLiteral).value}`\n ] = {\n source: (expr.arguments[0] as t.StringLiteral).value,\n import: 'default',\n isAll: false,\n };\n }\n } else if (item.type == 'FunctionDeclaration') {\n const funcBody = item.body;\n this.tre(funcBody, currenyContext);\n }\n }\n }\n run() {\n if (!t.isBlock(this.node))\n throw makeError(\"[compile error]: can't for a not block\", this.node);\n this.tre(this.node);\n }\n}\nclass CompileMCX {\n constructor(public code: string) {\n const mcxCode = new McxAst(code).parseAST();\n if (!MCXUtils.isParseNode(mcxCode))\n throw makeError(\n \"[compile error]: mcxCompile can't work in a not mcxNode\",\n );\n this.mcxCode = mcxCode;\n this.structureCheck();\n const JSIR = this.generateJSIR();\n this.CompileData = new CompileData.MCXCompileData(\n mcxCode,\n JSIR,\n this.tempLoc,\n );\n }\n private mcxCode: ParsedTagNode[];\n private tempLoc: MCXstructureLoc = {\n script: '',\n Event: {\n on: 'after',\n subscribe: {},\n loc: { line: -1, column: -1 },\n isLoad: false,\n },\n Component: {},\n UI: null,\n Form: null,\n };\n public getCompileData(): CompileData.MCXCompileData {\n return this.CompileData;\n }\n private checkComponentName(\n name: string,\n ): name is MCXstructureLocComponentType {\n return (Object.values(_MCXstructureLocComponentTypes) as string[]).includes(\n name,\n );\n }\n private checkComponentParentName(\n name: string,\n ): name is keyof typeof _MCXstructureLocComponentTypes {\n return Object.keys(_MCXstructureLocComponentTypes).includes(name);\n }\n private commonTagNodeContent(\n node: ParsedTagNode | ParsedTagContentNode,\n ): string {\n if (MCXUtils.isTagContentNode(node)) {\n return node.data;\n }\n if (MCXUtils.isTagNode(node)) {\n return node.content\n .map(sub =>\n sub.type !== 'Comment' ? this.commonTagNodeContent(sub) : '',\n )\n .join('');\n }\n throw makeError('[mcx compile]: internal error: unknown node type', node);\n }\n private getEventOn(node: ParsedTagNode): 'before' | 'after' {\n if (!MCXUtils.isTagNode(node))\n throw makeError('[mcx compile]: internal error: not tag node', node);\n let on: 'before' | 'after' = 'after';\n const isAfter = typeof node.arr['@after'] == 'string';\n const isBefore = typeof node.arr['@before'] == 'string';\n if (isAfter && isBefore)\n throw makeError(\n \"[mcx compile]: Event node can't has both @after and @before\",\n node,\n );\n if (isAfter) on = 'after';\n if (isBefore) on = 'before';\n return on;\n }\n private structureCheck() {\n let component: ParsedTagNode | null = null;\n const temp: {\n script: string;\n ui: ParsedTagNode | null;\n form: ParsedTagNode | null;\n Event: ParsedTagNode | null;\n Component: Record<MCXstructureLocComponentType, ParsedTagNode>;\n } = {\n script: '',\n Event: null,\n ui: null,\n form: null,\n Component: {} as Record<MCXstructureLocComponentType, ParsedTagNode>,\n };\n for (const node of this.mcxCode || []) {\n if (!MCXUtils.isTagNode(node)) continue;\n if (node.name == 'script') {\n if (temp.script)\n throw makeError('[compile error]: duplicate script node', node);\n const scriptNode =\n node.content.length == 0 ? '' : this.commonTagNodeContent(node);\n let code = scriptNode;\n if (node.arr.lang == 'ts') {\n code = ts.transpileModule(scriptNode, {\n compilerOptions: {\n target: ts.ScriptTarget.ES2024,\n module: ts.ModuleKind.ESNext,\n },\n }).outputText;\n }\n temp.script = code;\n } else if (node.name == 'Event') {\n if (temp.Event)\n throw makeError('[compile error]: duplicate Event node', node);\n // if Component already discovered, report error\n if (component)\n throw makeError(\n '[compile error]: Event node cannot appear after Component',\n node,\n );\n temp.Event = node;\n } else if (node.name == 'Component') {\n if (component)\n throw makeError('[compile error]: duplicate Component node', node);\n // if Event already discovered, report error\n if (temp.Event)\n throw makeError(\n '[compile error]: Component node cannot appear after Event',\n node,\n );\n if (temp.ui)\n throw makeError(\n \"[compile error]: Component node can't use with UI node\",\n );\n component = node;\n } else if (node.name == 'Ui') {\n if (component || temp.Event || temp.ui)\n throw makeError(\n \"[compile error]: UI node can't use with component or event or other ui node\",\n node,\n );\n temp.ui = node;\n } else if (node.name == 'Form') {\n if (component || temp.Event || temp.form || temp.ui)\n throw makeError(\n \"[compile error]: Form node can't use with component, event, Ui, or other Form node\",\n node,\n );\n temp.form = node;\n }\n }\n if (!temp.script) throw makeError('[compile error]: mcx must has a script');\n this.tempLoc.script = temp.script;\n if (temp.Event) {\n const on = this.getEventOn(temp.Event);\n const content = temp.Event.content;\n if (\n content.length == 0 ||\n content.length > 1 ||\n !MCXUtils.isTagContentNode(content[0])\n )\n throw makeError(\n '[compile error]: Event node has invalid content',\n temp.Event,\n );\n const subscribeData = content[0].data.trim();\n this.tempLoc.Event = {\n on: on,\n subscribe: Object.fromEntries(\n PropParser(subscribeData).map(item => [\n item.key,\n item.value.toString(),\n ]),\n ),\n loc: extractLoc(temp.Event),\n isLoad: true,\n };\n }\n if (component) {\n for (const subNode of component.content || []) {\n if (!MCXUtils.isTagNode(subNode)) continue;\n const subName = subNode.name;\n // if is a valid component name\n this.handlerChildComponent(subNode);\n }\n }\n if (temp.ui) {\n this.tempLoc.UI = temp.ui;\n }\n if (temp.form) {\n this.tempLoc.Form = temp.form;\n }\n }\n // input: tag node,handler child node(如 items entities)\n private handlerChildComponent(node: ParsedTagNode): void {\n const name = node.name;\n if (!this.checkComponentParentName(name))\n throw makeError(`[compile error]: invalid component name: ${name}`, node);\n const content = node.content;\n if (!content || content.length == 0)\n throw makeError(\n `[compile error]: component ${name} has no content`,\n node,\n );\n for (const subNode of content) {\n if (!MCXUtils.isTagNode(subNode)) continue;\n const subName = subNode.name;\n const _id = subNode.arr.id;\n if (!_id || typeof _id != 'string' || _id.trim() == '') {\n throw makeError(\n `[compile error]: component ${name} child component ${subName} has no id`,\n subNode,\n );\n }\n const id = _id.trim();\n const content = subNode.content;\n if (content.length == 0) {\n throw makeError(\n `[compile error]: component ${name} child component ${subName} has no content`,\n subNode,\n );\n }\n if (!content[0] || !MCXUtils.isTagContentNode(content[0]))\n throw makeError(\n `[compile error]: component ${name} child component ${subName} has invalid content`,\n subNode,\n );\n const useExpore = content[0].data.trim();\n if (subName == _MCXstructureLocComponentTypes[name]) {\n this.tempLoc.Component[`${name}/${id}`] = {\n type: subName,\n useExpore: useExpore,\n loc: extractLoc(subNode),\n };\n }\n }\n }\n private CompileData: CompileData.MCXCompileData;\n private generateJSIR(): CompileData.JsCompileData {\n if (!this.tempLoc.script.trim())\n throw makeError('[compile error]: mcx must has a script');\n const comiler = compileJSFn(this.tempLoc.script);\n return comiler;\n }\n}\nexport const compileJSFn = ((code: string): CompileData.JsCompileData => {\n if (compileJSFn.cache[code]) return compileJSFn.cache[code];\n let parsedCode: t.File;\n try {\n parsedCode = parse(code, {\n sourceType: 'module',\n allowImportExportEverywhere: true,\n errorRecovery: true,\n allowAwaitOutsideFunction: true,\n allowReturnOutsideFunction: true,\n allowSuperOutsideMethod: true,\n });\n } catch (err: unknown) {\n if (err instanceof SyntaxError) {\n const babelErr = err as SyntaxError & {\n loc?: { column: number; line: number };\n };\n const loc = babelErr.loc ?? { column: -1, line: -1 };\n throw makeError(`[babel parse error]: ${err.message}`, {\n loc: { start: loc },\n });\n }\n throw makeError(`[parse error]: ${String(err)}`);\n }\n const comiler = new CompileJS(parsedCode.program);\n comiler.run();\n const data = comiler.getCompileData();\n compileJSFn.cache[code] = data;\n return data;\n}) as ((code: string) => CompileData.JsCompileData) & {\n cache: Record<string, CompileData.JsCompileData>;\n};\nexport const compileMCXFn = ((mcxCode: string): CompileData.MCXCompileData => {\n if (compileMCXFn.cache[mcxCode]) return compileMCXFn.cache[mcxCode];\n const compiler = new CompileMCX(mcxCode);\n const data = compiler.getCompileData();\n compileMCXFn.cache[mcxCode] = data;\n return data;\n}) as ((mcxCode: string) => CompileData.MCXCompileData) & {\n cache: Record<string, CompileData.MCXCompileData>;\n};\ncompileJSFn.cache = {};\ncompileMCXFn.cache = {};\nexport * from './compileData';\nexport { Utils as MCXNodeUtils };\n","export default {\n // script tag compile function name\n scriptCompileFn: '__main',\n // use event tag , import event as\n eventImported: '__mcx__event',\n eventVarName: '__use_event',\n eventExtendsName: 'McxExtendsBy',\n // paramName\n paramCtx: '__mcx__ctx',\n} as const;\n","import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport type { ReadFileOpt, ParseReadFileOpt, TypeVerifyBody } from './types.js';\n\nexport default class Utils {\n public static async FileExist(path: string): Promise<boolean> {\n try {\n await fs.access(path);\n return true;\n } catch {\n return false;\n }\n }\n public static async readFile(\n filePath: string,\n opt: ReadFileOpt = {},\n ): Promise<object | string> {\n const opts: ParseReadFileOpt = {\n delay: 200,\n maxRetries: 3,\n want: 'string',\n ...opt,\n };\n\n for (let attempt = 0; attempt < opts.maxRetries; attempt++) {\n try {\n const buffer: Buffer = await fs.readFile(filePath);\n let text: string | object;\n if (opts.want === 'string') {\n text = buffer.toString(); // Buffer -> string\n } else if (opts.want === 'object') {\n try {\n text = JSON.parse(buffer.toString()); // Buffer -> string -> object\n } catch {\n text = {};\n }\n } else {\n text = buffer.toString();\n }\n\n return text;\n } catch {\n if (attempt < opts.maxRetries - 1) {\n await Utils.sleep(opts.delay);\n }\n }\n }\n return opts.want === 'object' ? {} : '';\n }\n public static sleep(time: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, time));\n }\n public static TypeVerify<\n T extends Record<string, unknown>,\n U extends TypeVerifyBody,\n >(\n obj: T,\n types: U,\n ): obj is T & {\n [P in keyof U]: {\n boolean: boolean;\n number: number;\n string: string;\n object: object;\n function: Function;\n bigint: bigint;\n symbol: Symbol;\n }[U[P]];\n } {\n for (const item of Object.entries(types)) {\n const [key, ShouldType]: [string, string] = item;\n if (!(typeof obj[key] === ShouldType)) return false;\n }\n return true;\n }\n public static AbsoluteJoin(baseDir: string, inputPath: string): string {\n return path.isAbsolute(inputPath)\n ? inputPath\n : path.join(baseDir, inputPath);\n }\n}\n","let fileIdCounter = 0;\nexport function generateFileId() {\n return `__file_import_${fileIdCounter++}__`;\n}\n","import * as t from '@babel/types';\nimport { JsCompileData } from '../compile-mcx/compiler/compileData';\nimport Utils from '../compile-mcx/compiler/utils';\nimport { ParsedTagNode, transformCtx } from '../types';\nimport config from './config';\nimport McxUtils from '../utils';\nimport * as path from 'node:path';\nimport { generateFileId } from './file_id';\n\nfunction extractVarDefIdList(express: t.LVal | t.VoidPattern): string[] {\n const result: string[] = [];\n if (t.isIdentifier(express)) result.push(express.name);\n if (t.isObjectPattern(express))\n express.properties.forEach(prop => {\n // const {xxx:xxx,xxx=Litter} = xxx\n if (t.isObjectProperty(prop))\n return result.push(\n ...extractVarDefIdList(\n prop.value as t.Identifier | t.AssignmentPattern,\n ),\n );\n // const {...restElement} = xx (restElement in this, ,must identifier)\n if (t.isRestElement(prop) && prop.argument.type == 'Identifier')\n result.push(prop.argument.name);\n });\n if (t.isArrayPattern(express)) {\n for (const element of express.elements) {\n if (!element) continue;\n result.push(...extractVarDefIdList(element));\n }\n }\n if (t.isAssignmentPattern(express)) {\n result.push(...extractVarDefIdList(express.left));\n }\n return result;\n}\nfunction extractIdList(expression: t.Declaration): string[] {\n if (t.isFunctionDeclaration(expression)) {\n return [expression.id?.name || ''];\n }\n if (t.isVariableDeclaration(expression)) {\n const result: string[] = [];\n for (const varDef of expression.declarations) {\n result.push(...extractVarDefIdList(varDef.id));\n }\n return result;\n }\n if (t.isClassDeclaration(expression)) {\n // 'export class {}'is not vaild(error: class name is required).\n return [expression.id?.name || ''];\n }\n return [];\n}\nfunction ToExpression(\n s: t.ExportDefaultDeclaration['declaration'],\n): t.Expression {\n if (t.isFunctionDeclaration(s))\n return t.functionExpression(s.id, s.params, s.body, s.generator, s.async);\n if (t.isClassDeclaration(s))\n return t.classExpression(s.id, s.superClass, s.body, s.decorators);\n if (t.isTSDeclareFunction(s)) return t.objectExpression([]);\n return s;\n}\nfunction generateMain(\n code: JsCompileData,\n): [t.Statement[], t.ImportDeclaration[]] {\n const expBody: (t.ObjectProperty | t.SpreadElement)[] = [];\n const impBody: t.ImportDeclaration[] = code.BuildCache.import.map(\n (item): t.ImportDeclaration => {\n return Utils.CacheToImportNode(item);\n },\n );\n const codeBody: t.Statement[] = code.node.body;\n for (const exp of code.BuildCache.export) {\n if (t.isExportNamedDeclaration(exp)) {\n // export {xxx} from \"./xxx\" or export xxx from \"./xxx\"\n if (\n exp.source &&\n exp.specifiers &&\n exp.specifiers.length >= 1 &&\n exp.source.value.length >= 1\n ) {\n impBody.push(\n t.importDeclaration(\n exp.specifiers.map(item => {\n if (t.isExportDefaultSpecifier(item)) {\n expBody.push(t.objectProperty(item.exported, item.exported));\n return t.importDefaultSpecifier(item.exported);\n }\n if (t.isExportSpecifier(item)) {\n expBody.push(t.objectProperty(item.exported, item.exported));\n return t.importSpecifier(item.local, item.exported);\n }\n if (t.isExportNamespaceSpecifier(item)) {\n expBody.push(t.spreadElement(item.exported));\n return t.importNamespaceSpecifier(item.exported);\n }\n // 这也不是那也不是, 你是个登啊(ts也是galgame)\n throw new Error(\n '[build import]: unexpected export specifier type',\n );\n }),\n exp.source,\n ),\n );\n }\n if (exp.declaration) {\n const idList = extractIdList(exp.declaration);\n // be like: const {} = {}; (worthless)\n if (idList.length < 1) continue;\n codeBody.push(exp.declaration);\n expBody.push(\n ...idList.map(id => {\n return t.objectProperty(t.identifier(id), t.identifier(id));\n }),\n );\n }\n // export { xxx }\n if (exp.specifiers && !exp.source) {\n expBody.push(\n ...exp.specifiers.map(item => {\n if (!t.isExportSpecifier(item))\n throw new Error(`[build import]: invalid specifiers`);\n return t.objectProperty(item.exported, item.local);\n }),\n );\n }\n // export * from \"xxx\"\n } else if (t.isExportAllDeclaration(exp)) {\n // xxx.js => xxx_js(id)\n const id = generateFileId();\n impBody.push(\n t.importDeclaration(\n [t.importNamespaceSpecifier(t.identifier(id))],\n exp.source,\n ),\n );\n expBody.push(t.objectProperty(t.identifier(id), t.identifier(id)));\n // export default {} or export default function a(){}\n } else if (t.isExportDefaultDeclaration(exp)) {\n // to expression\n expBody.push(\n t.objectProperty(\n t.identifier('default'),\n ToExpression(exp.declaration),\n ),\n );\n }\n }\n return [\n [...codeBody, t.returnStatement(t.objectExpression(expBody))],\n impBody,\n ];\n}\nasync function generateEventConfig(\n eventTag: ParsedTagNode,\n ctx: transformCtx,\n impBody: t.ImportDeclaration[],\n): Promise<t.ObjectExpression> {\n const prop = ctx.compiledCode.strLoc.Event.subscribe;\n const argm: t.ObjectExpression = t.objectExpression([\n t.objectProperty(\n t.identifier('on'),\n t.stringLiteral(ctx.compiledCode.strLoc.Event.on),\n ),\n ]);\n if (eventTag.arr.tick) {\n const num = parseFloat(eventTag.arr.tick as string);\n if (!Number.isNaN(num))\n argm.properties.push(\n t.objectProperty(t.identifier('tick'), t.numericLiteral(num)),\n );\n }\n // extract event and hanler\n const data: t.ObjectProperty[] = [];\n const extend: t.Expression[] = [];\n for (const [name, handlerName] of Object.entries(prop)) {\n if (name == config.eventExtendsName) {\n const extendsFile = handlerName.split(',');\n for (const extFile of extendsFile) {\n if (\n !(await McxUtils.FileExist(\n path.join(path.dirname(ctx.currentId), extFile),\n ))\n )\n throw new Error(\n \"[transform event]: [ERR: NOT_FOUND]: can't resolve extend file: \" +\n extFile,\n );\n const id = generateFileId();\n impBody.push(\n t.importDeclaration(\n [t.importDefaultSpecifier(t.identifier(id))],\n t.stringLiteral(extFile),\n ),\n );\n extend.push(t.identifier(id));\n }\n } else {\n data.push(\n t.objectProperty(t.identifier(name), t.stringLiteral(handlerName)),\n );\n }\n }\n argm.properties.push(\n t.objectProperty(t.identifier('data'), t.objectExpression(data)),\n t.objectProperty(t.identifier('extends'), t.arrayExpression(extend)),\n );\n return argm;\n}\n/**\n * record enable\n * @returns {(): void} - only call one\n */\nfunction _enable(): (() => void) & {\n prototype: {\n enable: boolean;\n };\n} {\n let success = false;\n const fn = function () {\n if (success) throw new Error(\"[enable]: can't enable again\");\n success = true;\n fn.prototype.enable = success;\n };\n fn.prototype.enable = success;\n return fn;\n}\nfunction _enableWithData<T>(): ((data: T) => void) & {\n prototype: {\n enable: T | null;\n };\n} {\n let d: null | T = null;\n const fn = function (data: T) {\n if (d) throw new Error(\"[enable]: can't enable again\");\n d = data;\n fn.prototype.enable = d;\n };\n fn.prototype.enable = d;\n return fn;\n}\n// export\nfunction processDefineProp(\n code: JsCompileData,\n mode: 'form' | 'ui',\n impBody: t.ImportDeclaration[],\n): void {\n const obsMap: Record<string, string> = {};\n\n for (const stmt of code.node.body) {\n if (t.isVariableDeclaration(stmt)) {\n for (const decl of stmt.declarations) {\n if (\n t.isCallExpression(decl.init) &&\n t.isIdentifier(decl.init.callee) &&\n decl.init.callee.name === 'defineProp' &&\n t.isIdentifier(decl.id)\n ) {\n const varName = decl.id.name;\n // args: defineProp(defaultValue) or defineProp(name, defaultValue)\n const defaultVal = decl.init.arguments[1] || decl.init.arguments[0];\n let defaultExpr: t.Expression = t.nullLiteral();\n if (defaultVal && t.isExpression(defaultVal)) {\n defaultExpr = defaultVal as t.Expression;\n }\n\n // Build: __mcx__ctx.$prop.varName ?? defaultValue\n const propAccess = t.logicalExpression(\n '??',\n t.memberExpression(\n t.memberExpression(\n t.identifier('__mcx__ctx'),\n t.identifier('$prop'),\n ),\n t.identifier(varName),\n ),\n defaultExpr,\n );\n\n if (mode === 'ui') {\n // Wrap in Observable constructor for CustomForm\n const obsType = inferObservableType(defaultExpr);\n if (obsType) {\n obsMap[obsType] = obsType;\n decl.init = t.newExpression(t.identifier(obsType), [propAccess]);\n } else {\n decl.init = propAccess;\n }\n } else {\n decl.init = propAccess;\n }\n }\n }\n }\n }\n\n if (mode === 'ui' && Object.keys(obsMap).length > 0) {\n impBody.push(\n t.importDeclaration(\n Object.values(obsMap).map(name =>\n t.importSpecifier(t.identifier(name), t.identifier(name)),\n ),\n t.stringLiteral('@minecraft/server-ui'),\n ),\n );\n }\n}\n\nfunction inferObservableType(expr: t.Expression): string | null {\n if (t.isStringLiteral(expr)) return 'ObservableString';\n if (t.isBooleanLiteral(expr)) return 'ObservableBoolean';\n if (t.isNumericLiteral(expr)) return 'ObservableNumber';\n if (t.isNullLiteral(expr)) return 'ObservableString';\n if (t.isIdentifier(expr) && expr.name === 'undefined')\n return 'ObservableString';\n return null;\n}\n\nfunction collectSetupDeclarations(\n code: JsCompileData,\n existingReturnMembers: Set<string>,\n): t.ObjectProperty[] {\n const result: t.ObjectProperty[] = [];\n const seen = new Set(existingReturnMembers);\n\n for (const stmt of code.node.body) {\n if (!t.isDeclaration(stmt)) continue;\n const ids = extractIdList(stmt);\n for (const id of ids) {\n if (id && !seen.has(id)) {\n seen.add(id);\n result.push(t.objectProperty(t.identifier(id), t.identifier(id)));\n }\n }\n }\n return result;\n}\n\nfunction processHooks(code: JsCompileData): {\n startup: t.Expression | null;\n mounted: t.Expression | null;\n} {\n let startup: t.Expression | null = null;\n let mounted: t.Expression | null = null;\n\n const toRemove: number[] = [];\n\n for (let i = 0; i < code.node.body.length; i++) {\n const stmt = code.node.body[i];\n if (!stmt) continue;\n\n if (t.isExpressionStatement(stmt) && t.isCallExpression(stmt.expression)) {\n const call = stmt.expression;\n if (t.isIdentifier(call.callee)) {\n const name = call.callee.name;\n if (name === 'onStartup' || name === 'onMounted') {\n if (call.arguments.length > 0) {\n const cb = call.arguments[0];\n if (t.isExpression(cb)) {\n if (name === 'onStartup') startup = cb as t.Expression;\n else mounted = cb as t.Expression;\n }\n }\n toRemove.push(i);\n }\n }\n }\n }\n\n for (const idx of toRemove.reverse()) {\n code.node.body.splice(idx, 1);\n }\n\n // Clean up imports of onStartup/onMounted from BuildCache\n const hookNames = new Set(['onStartup', 'onMounted']);\n for (const imp of code.BuildCache.import) {\n if (imp.source === '@mbler/mcx') {\n imp.imported = imp.imported.filter(\n item => !hookNames.has(item.import || item.as),\n );\n }\n }\n code.BuildCache.import = code.BuildCache.import.filter(\n imp => imp.source !== '@mbler/mcx' || imp.imported.length > 0,\n );\n\n return { startup, mounted };\n}\n\n// export\nexport {\n extractIdList,\n extractVarDefIdList,\n generateEventConfig,\n _enable,\n generateMain,\n _enableWithData,\n processDefineProp,\n collectSetupDeclarations,\n processHooks,\n};\n","import { ParsedTagNode, transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\n\nconst SETUP_CTX_INDEX = 0;\n\n/**\n * Shared layout generation for both <Form> and <Ui>.\n * Generates layout config with (s) => expr functions for content and params.\n */\nexport function generateLayout(\n ctx: transformParseCtx,\n tagNode: ParsedTagNode,\n tagName: string,\n mode: 'form' | 'ui',\n) {\n const internalCtx = ctx.ctx;\n\n const parsedObj: t.Expression[] = [];\n const typeTags: string[] = [];\n\n // Collect child elements (recursively flatten nested groups)\n const elements: {\n arr: Record<string, string | boolean>;\n content: string;\n type: string;\n loc?: ParsedTagNode['loc'];\n for?: { variable: string; useSetup: string };\n if?: { useSetup: string };\n }[] = [];\n\n function collectElements(node: ParsedTagNode) {\n for (const child of node.content) {\n if (child.type !== 'TagNode') continue;\n\n if (child.content.some(i => i.type === 'TagNode')) {\n collectElements(child);\n continue;\n }\n\n // parse for — support both `in` and `of` keywords\n let _for: { variable: string; useSetup: string } | undefined;\n if (typeof child.arr.for === 'string') {\n const match = (child.arr.for as string).match(\n /^(\\w+)\\s+(?:in|of)\\s+(\\w+)$/,\n );\n if (match) {\n _for = { variable: match[1]!, useSetup: match[2]! };\n } else {\n internalCtx.rollupContext.error(\n `[${tagName}]: invalid for syntax, expected 'variable in|of propName'`,\n child.loc\n ? { column: child.loc.start.column, line: child.loc.start.line }\n : void 0,\n );\n }\n }\n\n // parse if\n let _if: { useSetup: string } | undefined;\n if (typeof child.arr.if === 'string') {\n _if = { useSetup: child.arr.if as string };\n }\n\n elements.push({\n arr: child.arr,\n content: child.content\n .map(i => (i.type === 'TagContent' && i.data) || '')\n .join(''),\n type: child.name,\n loc: child.loc,\n ...(_for ? { for: _for } : {}),\n ...(_if ? { if: _if } : {}),\n });\n }\n }\n\n collectElements(tagNode);\n\n // Build layout objects\n for (const el of elements) {\n const name = el.type;\n const cleanedArr = { ...el.arr };\n delete cleanedArr.for;\n delete cleanedArr.if;\n\n // Validate tag type\n const formType = detectFormType(name);\n if (formType === 'invalid') {\n internalCtx.rollupContext.error(\n `[${tagName}]: don't support tag: ${name}`,\n el.loc\n ? { line: el.loc.start.line, column: el.loc.start.column }\n : void 0,\n );\n continue;\n }\n if (formType) typeTags.push(formType);\n\n // Build params: static values as literals, dynamic (:attr) as (s) => expr\n const paramsObj = t.objectExpression(\n Object.entries(cleanedArr)\n .filter(([key]) => key !== 'for' && key !== 'if')\n .map(([key, value]) => {\n const isDynamic = key.startsWith(':');\n const paramName = isDynamic ? key.slice(1) : key;\n // click is always a function reference to setup\n if (paramName === 'click') {\n return t.objectProperty(\n t.identifier(paramName),\n simpleFn(String(value)),\n );\n }\n return t.objectProperty(\n t.identifier(paramName),\n isDynamic\n ? simpleFn(String(value))\n : typeof value === 'boolean'\n ? t.booleanLiteral(value)\n : t.stringLiteral(value),\n );\n }),\n );\n\n // Content: parse {{ }} interpolation, supports mixed text + multiple interpolations\n const contentExpr = parseContent(el.content);\n\n const props: t.ObjectProperty[] = [\n t.objectProperty(t.identifier('type'), t.stringLiteral(name)),\n t.objectProperty(t.identifier('params'), paramsObj),\n t.objectProperty(t.identifier('content'), contentExpr),\n ];\n\n // for\n if (el.for) {\n props.push(\n t.objectProperty(\n t.identifier('for'),\n t.objectExpression([\n t.objectProperty(\n t.identifier('variable'),\n t.stringLiteral(el.for.variable),\n ),\n t.objectProperty(\n t.identifier('useSetup'),\n t.stringLiteral(el.for.useSetup),\n ),\n ]),\n ),\n );\n }\n\n // if\n if (el.if) {\n props.push(\n t.objectProperty(\n t.identifier('if'),\n t.objectExpression([\n t.objectProperty(\n t.identifier('useSetup'),\n t.stringLiteral(el.if.useSetup),\n ),\n ]),\n ),\n );\n }\n\n parsedObj.push(t.objectExpression(props));\n }\n\n // Detect which form type was used (explicit type attr overrides heuristic)\n let formTypeStr: string;\n const explicitType = tagNode.arr.type;\n if (typeof explicitType === 'string') {\n const typeMap: Record<string, string> = {\n modal: 'ModalFormData',\n action: 'ActionFormData',\n message: 'MessageFormData',\n };\n formTypeStr = typeMap[explicitType] || 'ActionFormData';\n } else {\n formTypeStr = 'ActionFormData';\n if (typeTags.some(t => ['input', 'dropdown', 'submit', 'toggle', 'slider'].includes(t))) {\n formTypeStr = 'ModalFormData';\n } else if (typeTags.some(t => t === 'button-m')) {\n formTypeStr = 'MessageFormData';\n } else if (typeTags.some(t => t === 'button')) {\n formTypeStr = 'ActionFormData';\n }\n }\n\n return { parsedObj, formTypeStr };\n}\n\nfunction detectFormType(\n tag: string,\n): 'modal' | 'message' | 'action' | 'shared' | 'invalid' | null {\n if (['input', 'dropdown', 'submit', 'toggle', 'slider'].includes(tag))\n return 'modal';\n if (tag === 'button-m') return 'message';\n if (tag === 'button') return 'action';\n if (['body', 'divider', 'title', 'label', 'header', 'spacer', 'close-button'].includes(tag))\n return 'shared';\n return 'invalid';\n}\n\n/** Simple arrow function for params (non-reactive): (ctx) => ctx[0].a.b.c */\nfunction simpleFn(expr: string): t.ArrowFunctionExpression {\n const ctx = t.identifier('ctx');\n const body = dotAccess(expr, ctx);\n return t.arrowFunctionExpression([ctx], body);\n}\n\n/** Extract root identifiers from an expression for dependency tracking */\nfunction extractIdentifiers(expr: string): string[] {\n const reserved = new Set(['true', 'false', 'null', 'undefined', 'this', 'new', 'typeof', 'instanceof']);\n const ids = new Set<string>();\n const regex = /\\b([a-zA-Z_$][\\w$]*)\\b/g;\n let m: RegExpExecArray | null;\n while ((m = regex.exec(expr)) !== null) {\n if (!reserved.has(m[1]!)) ids.add(m[1]!);\n }\n return [...ids];\n}\n\n/** Generate new Computation((ctx) => expr, [deps]) */\nfunction arrowFn(expr: string): t.NewExpression {\n const ctx = t.identifier('ctx');\n const body = dotAccess(expr, ctx);\n const evalFn = t.arrowFunctionExpression([ctx], body);\n const ids = extractIdentifiers(expr);\n const deps = ids.map(id => {\n const c = t.identifier('ctx');\n return t.arrowFunctionExpression([c], dotAccess(id, c));\n });\n return t.newExpression(t.identifier('Computation'), [\n evalFn,\n t.arrayExpression(deps),\n ]);\n}\n\n/**\n * Parse content string, returns:\n * - t.stringLiteral for pure static text\n * - t.NewExpression (Computation) for content with {{ }} interpolation\n *\n * Supports:\n * - \"Hello\" → \"Hello\"\n * - \"{{ a }}\" → new Computation((ctx) => ctx[0].a, [ctx => ctx[0].a])\n * - \"Hi {{ a }}\" → new Computation((ctx) => `Hi ${ctx[0].a}`, [ctx => ctx[0].a])\n * - \"{{ a.slice(1,2) }}\" → new Computation((ctx) => ctx[0].a.slice(1,2), [ctx => ctx[0].a])\n */\nfunction parseContent(raw: string): t.Expression {\n // Check for any {{ }} interpolation\n if (!raw.includes('{{ ')) {\n return t.stringLiteral(raw);\n }\n\n const parts = splitInterpolation(raw);\n\n // Single interpolation, no surrounding text → Computation\n if (parts.length === 1 && parts[0]!.type === 'expr') {\n return arrowFn(parts[0]!.value);\n }\n\n // Multiple parts or mixed → template literal Computation\n const ctx = t.identifier('ctx');\n const quasis: t.TemplateElement[] = [];\n const expressions: t.Expression[] = [];\n const allIds = new Set<string>();\n\n for (const part of parts) {\n if (part.type === 'text') {\n quasis.push(t.templateElement({ raw: part.value, cooked: part.value }));\n } else {\n expressions.push(dotAccess(part.value, ctx));\n for (const id of extractIdentifiers(part.value)) {\n allIds.add(id);\n }\n }\n }\n // Template must end with a quasis\n quasis.push(t.templateElement({ raw: '', cooked: '' }, true));\n\n const tpl = t.templateLiteral(quasis, expressions);\n const evalFn = t.arrowFunctionExpression([ctx], tpl);\n const deps = [...allIds].map(id => {\n const c = t.identifier('ctx');\n return t.arrowFunctionExpression([c], dotAccess(id, c));\n });\n return t.newExpression(t.identifier('Computation'), [\n evalFn,\n t.arrayExpression(deps),\n ]);\n}\n\ntype InterpolationPart = { type: 'text'; value: string } | { type: 'expr'; value: string };\n\nfunction splitInterpolation(raw: string): InterpolationPart[] {\n const result: InterpolationPart[] = [];\n const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(raw)) !== null) {\n // Text before this match\n if (match.index > lastIndex) {\n result.push({ type: 'text', value: raw.slice(lastIndex, match.index) });\n }\n // The expression\n result.push({ type: 'expr', value: match[1]! });\n lastIndex = regex.lastIndex;\n }\n // Trailing text\n if (lastIndex < raw.length) {\n result.push({ type: 'text', value: raw.slice(lastIndex) });\n }\n return result;\n}\n\n/** \"a.b.c\" → __ctx[SETUP_CTX_INDEX].a.b.c */\nfunction dotAccess(expr: string, root: t.Identifier): t.Expression {\n const parts = expr.split('.');\n // First part accesses root[SETUP_CTX_INDEX] (the setup object)\n let node: t.Expression = t.memberExpression(root, t.numericLiteral(SETUP_CTX_INDEX), true);\n for (const part of parts) {\n node = t.memberExpression(node, t.identifier(part));\n }\n return node;\n}\n\n/** Build the shared config object expression for both <Ui> and <Form> transforms */\nexport function buildUIConfig(\n ctx: transformParseCtx,\n tagNode: ParsedTagNode,\n tagName: string,\n mode: 'form' | 'ui',\n): t.ObjectExpression {\n const { parsedObj, formTypeStr } = generateLayout(ctx, tagNode, tagName, mode);\n return t.objectExpression([\n t.objectProperty(t.identifier('mode'), t.stringLiteral(mode)),\n t.objectProperty(t.identifier('layout'), t.arrayExpression(parsedObj)),\n t.objectProperty(\n t.identifier('use'),\n t.memberExpression(t.identifier('__minecraft__ui'), t.identifier(formTypeStr)),\n ),\n t.objectProperty(t.identifier('UI'), t.identifier('__minecraft__ui')),\n ]);\n}\n","import { transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport config from '../config';\nimport { buildUIConfig } from './layout';\n\nexport async function Comp(ctx: transformParseCtx) {\n ctx.impBody.push(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('__mcx__ui'), t.identifier('ui'))],\n t.stringLiteral('@mbler/mcx'),\n ),\n t.importDeclaration(\n [t.importNamespaceSpecifier(t.identifier('__minecraft__ui'))],\n t.stringLiteral('@minecraft/server-ui'),\n ),\n );\n\n const tagNode = ctx.ctx.compiledCode.strLoc.UI;\n if (!tagNode || tagNode.name !== 'Ui')\n throw new Error('[UI Component]: why did parent not verify?');\n\n const configObj = buildUIConfig(ctx, tagNode, 'Ui', 'ui');\n\n ctx.app([\n t.objectProperty(\n t.identifier('ui'),\n t.newExpression(t.identifier('__mcx__ui'), [\n configObj,\n t.identifier(config.scriptCompileFn),\n ]),\n ),\n ]);\n}\n","import { transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport config from '../config';\nimport { buildUIConfig } from './layout';\n\nexport async function Comp(ctx: transformParseCtx) {\n ctx.impBody.push(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('__mcx__ui'), t.identifier('ui'))],\n t.stringLiteral('@mbler/mcx'),\n ),\n t.importDeclaration(\n [t.importNamespaceSpecifier(t.identifier('__minecraft__ui'))],\n t.stringLiteral('@minecraft/server-ui'),\n ),\n );\n\n const tagNode = ctx.ctx.compiledCode.strLoc.Form;\n if (!tagNode || tagNode.name !== 'Form')\n throw new Error('[Form Component]: why did parent not verify?');\n\n const configObj = buildUIConfig(ctx, tagNode, 'Form', 'form');\n\n ctx.app([\n t.objectProperty(\n t.identifier('ui'),\n t.newExpression(t.identifier('__mcx__ui'), [\n configObj,\n t.identifier(config.scriptCompileFn),\n ]),\n ),\n ]);\n}\n","import { ParsedTagNode, transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport { generateEventConfig } from '../utils';\nexport async function Comp(ctx: transformParseCtx) {\n const appData = [\n t.objectProperty(\n t.identifier('event'),\n await generateEventConfig(\n ctx.ctx.compiledCode.raw.find(\n node => node.name === 'Event', // compileMCXFn had verify, don't verify\n ) as ParsedTagNode,\n ctx.ctx,\n ctx.impBody,\n ),\n ),\n ];\n ctx.app(appData);\n}\n","import * as path from 'node:path';\nimport { transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport { readFile } from 'node:fs/promises';\nimport { compileMCXFn } from '../../compile-mcx/compiler';\nimport config from '../config';\nexport async function Comp(ctx: transformParseCtx) {\n const eventImportIdList: {\n type: 'default' | 'all';\n as: string;\n }[] = [];\n for (const impNode of ctx.ctx.compiledCode.JSIR.BuildCache.import) {\n const source = impNode.source;\n const parsed = path.parse(source);\n if (!parsed.root && !parsed.dir.startsWith('.')) {\n continue;\n }\n // path\n const fPath = path.join(ctx.ctx.currentId, '../', source);\n try {\n // read file\n const code = await readFile(fPath, 'utf-8');\n const compiledCode = compileMCXFn(code);\n // write cache\n ctx.ctx.cache.set(fPath, compiledCode);\n if (compiledCode.strLoc.Event.isLoad) {\n for (const impItem of impNode.imported) {\n let type: 'all' | 'default';\n if (impItem.isAll) type = 'all';\n else if (impItem.import == 'default') type = 'default';\n else {\n throw new Error(\n \"not vaild importDeclartion: Event mcx only resolve default and all import, can't use other import\",\n );\n }\n eventImportIdList.push({\n type,\n as: impItem.as,\n });\n }\n }\n } catch (err) {\n // if error: file not found, file can't write, mcx syntax error\n ctx.ctx.rollupContext.warn(\n `[extract import]: can't resolve file ${fPath} and import by ${ctx.ctx.currentId}\\n- err: ${err instanceof Error ? err.stack : err}`,\n );\n }\n }\n // only have event import\n if (eventImportIdList.length >= 1) {\n const eventMemberNode = t.memberExpression(\n t.identifier(config.paramCtx),\n t.identifier('event'),\n );\n ctx.mainFn.unshift(\n // add declaration\n\n t.variableDeclaration(\n 'var',\n eventImportIdList.map((item, index) => {\n if (item.type == 'all') {\n return t.variableDeclarator(\n t.identifier(item.as),\n t.objectExpression([\n t.objectProperty(\n t.identifier('default'),\n t.memberExpression(\n eventMemberNode,\n t.numericLiteral(index),\n true,\n ),\n ),\n ]),\n );\n } else if (item.type == 'default') {\n return t.variableDeclarator(\n t.identifier(item.as),\n t.memberExpression(\n eventMemberNode,\n t.numericLiteral(index),\n true,\n ),\n );\n }\n // ts galgame\n throw new Error('[javascript error]: why it not in [default, all]');\n }),\n ),\n );\n // app: add event export to runtime framework\n\n const appData = [\n t.objectProperty(\n t.identifier('event'),\n t.arrayExpression(\n eventImportIdList.map(vl => {\n if (vl.type == 'all') {\n return t.memberExpression(\n t.identifier(vl.as),\n t.identifier('default'),\n );\n } else if (vl.type == 'default') {\n return t.identifier(vl.as);\n }\n throw new Error(\"[add prop]: can't format eventImportList\");\n }),\n ),\n ),\n ];\n ctx.app(appData);\n }\n}\n","import { compileJSFn } from '../compile-mcx/compiler';\nimport { ImportList } from '../compile-mcx/types';\nimport * as t from '@babel/types';\nimport { generateFileId } from '../transforms/file_id';\nimport * as generator from '@babel/generator';\n/**\n * ESM => CJS\n */\nfunction transformESMToCJS(\n code: string,\n pluginContext?: Record<string, string | null | boolean | number>,\n hook?: (\n data: t.CallExpression | t.MemberExpression,\n setData?: (newData: t.Expression) => void,\n ) => void,\n): string {\n const compileData = compileJSFn(code);\n const body = compileData.node.body;\n const defines: t.VariableDeclarator[] = [];\n // import transform\n const importDefines = transformImportIRtoRequire(\n compileData.BuildCache.import,\n );\n for (const importDefine of importDefines) {\n const data = importDefine.init as t.CallExpression | t.MemberExpression;\n if (hook) {\n hook(data, newData => {\n importDefine.init = newData;\n });\n }\n defines.push(importDefine);\n }\n // add plugin context\n if (pluginContext) {\n defines.push(\n ...Object.entries(pluginContext).map(\n ([key, value]): t.VariableDeclarator =>\n t.variableDeclarator(\n t.identifier(key),\n typeof value == 'string'\n ? t.stringLiteral(value)\n : typeof value == 'boolean'\n ? t.booleanLiteral(value)\n : typeof value == 'number'\n ? t.numericLiteral(value)\n : t.nullLiteral(),\n ),\n ),\n );\n }\n\n const exportsArr = compileData.BuildCache.export\n .map(i => {\n if (t.isExportAllDeclaration(i)) {\n const fileId = generateFileId();\n defines.push(\n t.variableDeclarator(\n t.identifier(fileId),\n t.callExpression(t.identifier('require'), [i.source]),\n ),\n );\n return t.assignmentExpression(\n '=',\n t.memberExpression(t.identifier('module'), t.identifier('exports')),\n t.objectExpression([\n t.spreadElement(t.identifier(fileId)),\n t.spreadElement(\n t.memberExpression(\n t.identifier('module'),\n t.identifier('exports'),\n ),\n ),\n ]),\n );\n } else if (t.isExportDefaultDeclaration(i)) {\n if (!i.declaration || t.isTSDeclareFunction(i.declaration))\n return void 0;\n if (t.isExpression(i.declaration)) {\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier('default'),\n ),\n i.declaration,\n );\n }\n if (!i.declaration.id)\n i.declaration.id = t.identifier(generateFileId());\n body.push(i.declaration);\n return t.assignmentExpression(\n '=',\n t.memberExpression(t.identifier('exports'), t.identifier('default')),\n i.declaration.id,\n );\n } else if (t.isExportNamedDeclaration(i)) {\n if (i.source && i.specifiers.length >= 1) {\n const id = t.identifier(generateFileId());\n defines.push(\n t.variableDeclarator(\n id,\n t.callExpression(t.identifier('require'), [i.source]),\n ),\n );\n const exportExprs = i.specifiers\n .map(\n (\n specifier:\n | t.ExportNamespaceSpecifier\n | t.ExportDefaultSpecifier\n | t.ExportSpecifier,\n ) => {\n if (t.isExportNamespaceSpecifier(specifier)) {\n const exportedName = t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : (specifier.exported as t.StringLiteral).value;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(exportedName),\n ),\n id,\n );\n } else if (t.isExportSpecifier(specifier)) {\n const exportedName = t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : (specifier.exported as t.StringLiteral).value;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(exportedName),\n ),\n t.memberExpression(id, t.identifier(specifier.local.name)),\n );\n }\n return null;\n },\n )\n .filter(Boolean) as t.AssignmentExpression[];\n return exportExprs.length === 1\n ? exportExprs[0]\n : t.sequenceExpression(exportExprs);\n } else {\n if (i.declaration) {\n if (\n t.isFunctionDeclaration(i.declaration) ||\n t.isVariableDeclaration(i.declaration)\n ) {\n if (t.isVariableDeclaration(i.declaration)) {\n body.push(i.declaration);\n const assignExprs = i.declaration.declarations.map(decl => {\n const varName = (decl.id as t.Identifier).name;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(varName),\n ),\n t.identifier(varName),\n );\n });\n return assignExprs.length === 1\n ? assignExprs[0]\n : t.sequenceExpression(assignExprs);\n } else {\n const functionId =\n i.declaration.id || t.identifier(generateFileId());\n const funcDecl = t.functionDeclaration(\n functionId,\n i.declaration.params,\n i.declaration.body,\n i.declaration.generator,\n i.declaration.async,\n );\n body.push(funcDecl);\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier((functionId as t.Identifier).name),\n ),\n functionId,\n );\n }\n }\n } else {\n // Handle export { item } - simple variable export\n if (i.specifiers.length >= 1) {\n const exportExprs = i.specifiers\n .map(specifier => {\n if (t.isExportSpecifier(specifier)) {\n const exportedName = t.isIdentifier(specifier.exported)\n ? specifier.exported.name\n : (specifier.exported as t.StringLiteral).value;\n return t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier('exports'),\n t.identifier(exportedName),\n ),\n t.identifier(specifier.local.name),\n );\n }\n return null;\n })\n .filter(Boolean) as t.AssignmentExpression[];\n return exportExprs.length === 1\n ? exportExprs[0]\n : t.sequenceExpression(exportExprs);\n }\n }\n }\n return null;\n }\n })\n .filter(Boolean) as t.AssignmentExpression[];\n\n body.unshift(t.variableDeclaration('var', defines));\n body.push(...exportsArr.map(i => t.expressionStatement(i)));\n\n return generator.generate(t.program(body)).code;\n}\n\n/**\n * import IR => require\n */\nfunction transformImportIRtoRequire(\n importIR: ImportList[],\n): t.VariableDeclarator[] {\n const define: t.VariableDeclarator[] = [\n t.variableDeclarator(\n t.identifier('__import_default'),\n t.functionExpression(\n null,\n [t.identifier('obj')],\n t.blockStatement([\n t.returnStatement(\n t.conditionalExpression(\n t.memberExpression(\n t.identifier('obj'),\n t.identifier('__esModule'),\n ),\n t.memberExpression(t.identifier('obj'), t.identifier('default')),\n t.identifier('obj'),\n ),\n ),\n ]),\n ),\n ),\n ];\n\n for (const data of importIR) {\n for (const imported of data.imported) {\n let vl: t.CallExpression | t.MemberExpression;\n if (!imported.isAll && imported.import) {\n if (imported.import == 'default') {\n vl = t.callExpression(t.identifier('__import_default'), [\n t.callExpression(t.identifier('require'), [\n t.stringLiteral(data.source),\n ]),\n ]);\n } else {\n vl = t.memberExpression(\n t.callExpression(t.identifier('require'), [\n t.stringLiteral(data.source),\n ]),\n t.identifier(imported.import),\n );\n }\n } else {\n vl = t.callExpression(t.identifier('require'), [\n t.stringLiteral(data.source),\n ]);\n }\n define.push(t.variableDeclarator(t.identifier(imported.as), vl));\n }\n }\n return define;\n}\nexport { transformESMToCJS, transformImportIRtoRequire };\n","import * as Module from 'node:module';\nimport * as vm from 'node:vm';\nimport { Buffer } from 'node:buffer';\nimport * as t from '@babel/types';\nimport { parse } from '@babel/parser';\nimport * as generator from '@babel/generator';\nimport { transformESMToCJS } from './cjsTransform';\nconst BLOCKED_MODULES = new Set([\n 'child_process',\n 'node:child_process',\n 'fs',\n 'node:fs',\n 'node:fs/promises',\n 'worker_threads',\n 'node:worker_threads',\n 'cluster',\n 'node:cluster',\n 'dgram',\n 'node:dgram',\n 'net',\n 'node:net',\n 'tls',\n 'node:tls',\n 'tty',\n 'node:tty',\n 'v8',\n 'node:v8',\n 'vm',\n 'node:vm',\n 'async_hooks',\n 'node:async_hooks',\n 'diagnostics_channel',\n 'node:diagnostics_channel',\n]);\n// Enumerate the methods for converting ESM to CJS\nexport enum execESMMethod {\n transformCjs = 0,\n runInVm = 1,\n importESM = 2,\n}\n\nexport class RunScript {\n private _context;\n private _module;\n private _pluginContext;\n constructor(\n public filePath: string = '<repl>',\n public module: 'esm' | 'cjs' = 'cjs',\n private pluginContext?: Record<string, string | null | boolean | number>,\n ) {\n this._module = new Module.Module(this.filePath);\n this._pluginContext = pluginContext || {};\n this._context = this.getContext(this._pluginContext);\n }\n /**\n * run code in nodejs vm\n * @param code {string} exetuce code\n * @returns code exports\n */\n public async run(\n code: string,\n esmExecMethod: execESMMethod = execESMMethod.transformCjs,\n transformCjsHook?: (\n data: t.CallExpression | t.MemberExpression,\n setData?: (newData: t.Expression) => void,\n ) => void,\n ): Promise<unknown> {\n if (this.module === 'esm') {\n if (esmExecMethod == execESMMethod.importESM) {\n let processedCode = code;\n\n if (this.pluginContext) {\n const ast = parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n const contextDefines = Object.entries(this.pluginContext).map(\n ([key, value]): t.VariableDeclarator =>\n t.variableDeclarator(\n t.identifier(key),\n typeof value == 'string'\n ? t.stringLiteral(value)\n : typeof value == 'boolean'\n ? t.booleanLiteral(value)\n : typeof value == 'number'\n ? t.numericLiteral(value)\n : t.nullLiteral(),\n ),\n );\n const contextDeclaration = t.variableDeclaration(\n 'var',\n contextDefines,\n );\n ast.program.body.unshift(contextDeclaration);\n processedCode = generator.generate(ast).code;\n }\n const dataUrl = `data:application/javascript;base64,${Buffer.from(processedCode).toString('base64')}`;\n return await import(dataUrl);\n } else if (esmExecMethod == execESMMethod.transformCjs) {\n const compiledCode = transformESMToCJS(\n code,\n this.pluginContext,\n transformCjsHook,\n );\n const script = new vm.Script(compiledCode, { filename: this.filePath });\n const rel = script.runInContext(this._context);\n return this._context.exports || rel;\n } else if (esmExecMethod == execESMMethod.runInVm) {\n if (typeof vm.SourceTextModule !== 'function') {\n throw new Error('[exec esm]: not support vm.SourceTextModule');\n } else {\n const script = new vm.SourceTextModule(code, {\n context: this._context,\n });\n await script.link(async specifier => {\n return new vm.SourceTextModule(specifier, {\n context: this._context,\n });\n });\n await script.evaluate();\n return script.namespace;\n }\n }\n } else {\n const script = new vm.Script(code, { filename: this.filePath });\n const rel = script.runInContext(this._context);\n return this._context.exports || rel;\n }\n }\n private getContext(pluginContext?: Record<string, unknown>): vm.Context {\n const context: vm.Context = Object.create(pluginContext || null);\n // CJS context setup\n const exports = {};\n const module = {\n exports,\n filename: this.filePath,\n path: this.filePath,\n paths: require.resolve.paths(this.filePath) || [],\n id: this.filePath,\n };\n const originalRequire = Module.createRequire\n ? Module.createRequire(this.filePath)\n : require;\n const restrictedRequire = new Proxy(originalRequire, {\n apply(target, thisArg, args) {\n const id = args[0];\n if (typeof id === 'string' && BLOCKED_MODULES.has(id)) {\n throw new Error(\n `[mcx component]: require('${id}') is not allowed in component scripts`,\n );\n }\n return Reflect.apply(target, thisArg, args);\n },\n });\n Object.assign(context, {\n exports,\n module,\n require: restrictedRequire,\n global: context,\n });\n return vm.createContext(context);\n }\n public static isCanUseEsmRunVm = typeof vm.SourceTextModule == 'function';\n}\nexport { transformESMToCJS };\n","import { cp, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { MCXCompileData } from '../compile-mcx/compiler/compileData';\nimport { execESMMethod, RunScript } from './vm';\nimport * as path from 'node:path';\nimport { MCXstructureLocComponentType } from '../compile-mcx/types';\nimport { transformCtx } from '../types';\nimport * as t from '@babel/types';\nimport type { BaseJson, FilePoint } from './types';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { parse } from '@babel/parser';\nimport { styleText } from 'node:util';\nimport type lib from '@mbler/mcx-component';\n/** Accumulated bind data (e.g. item_texture entries) across all components in a build. */\nlet cachedOption: Record<string, string[] | [string, string][]> = {};\n\n/**\n * Security limits for file I/O operations inside file_edit expressions.\n * Components from @mbler/mcx-component are exempt from these limits.\n */\nconst MAX_FILE_WRITES = 5;\nconst MAX_FILE_READS = 1;\n\n/** Clear all cached bind options (called between builds). */\nexport function clearCachedOptions() {\n cachedOption = {};\n}\n\n/**\n * Resolve a FilePoint to an absolute path on disk.\n *\n * - `base: 'root'` is only allowed when the calling component originates from\n * @mbler/mcx-component (the `sourceIsMcxCore` flag). This prevents third-party\n * components from reading arbitrary filesystem locations.\n * - For `behavior` / `resources`, the file is resolved relative to the\n * corresponding output directory. A path-traversal check ensures the resolved\n * path does not escape the base directory (e.g. via `../`).\n */\nexport function resolveFilePoint(\n point: FilePoint,\n ctx: transformCtx,\n sourceIsMcxCore = false,\n) {\n // \"root\" base: resolve the file path directly against cwd. Only internal\n // mcx-core components are trusted to use this — third-party components\n // would gain unrestricted filesystem access otherwise.\n if (point.base === 'root') {\n if (!sourceIsMcxCore) {\n throw new Error(\n '[mcx component]: \"root\" base is only allowed for components imported from @mbler/mcx-component',\n );\n }\n return path.resolve(point.file);\n }\n let baseDir: string;\n if (point.base === 'behavior') {\n baseDir = ctx.output.behavior;\n } else if (point.base === 'resources') {\n baseDir = ctx.output.resources;\n } else {\n throw new Error('[mcx component]: invalid FilePoint Base');\n }\n const resolved = path.resolve(baseDir, point.file);\n // Path traversal guard: after resolving, the result must still be inside the\n // base directory. If the file contains \"../\" that escapes the root, the\n // startsWith check will fail.\n if (!resolved.startsWith(path.resolve(baseDir))) {\n throw new Error('[mcx component]: Path Traversal detected: ' + point.file);\n }\n return resolved;\n}\n\n/**\n * Maps each locally-bound identifier name to the package it was imported from.\n * Built by walking the AST of the component source code.\n *\n * Example:\n * import { ItemComponent } from '@mbler/mcx-component'\n * → { ItemComponent: '@mbler/mcx-component' }\n *\n * const { SomeHelper } = require('some-lib')\n * → { SomeHelper: 'some-lib' }\n */\ntype ExportSourceMap = Record<string, string>;\n\n/**\n * Walk the component source AST and build a mapping from local variable names\n * to the npm package they were imported/required from.\n *\n * Covers three import patterns:\n * 1. ES module named/default/namespace imports: import { X } from 'pkg'\n * 2. CommonJS direct require: const X = require('pkg')\n * 3. CommonJS destructured require: const { X } = require('pkg')\n * which desugars to a MemberExpression in the AST.\n */\nfunction collectExportSources(code: string): ExportSourceMap {\n const sources: ExportSourceMap = {};\n let ast: ReturnType<typeof parse>;\n try {\n ast = parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n } catch {\n // Parse failure is non-fatal — return empty map and skip the check.\n return sources;\n }\n\n function walk(node: t.Node) {\n if (!node) return;\n\n // Pattern 1: ES module import declarations.\n // e.g. import { ItemComponent, EntityComponent as Entity } from '@mbler/mcx-component'\n if (t.isImportDeclaration(node)) {\n const pkg =\n typeof node.source.value === 'string' ? node.source.value : '';\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec)) {\n // Named import — local.name is the locally bound name,\n // imported.name is the original export name.\n const importedName = t.isIdentifier(spec.imported)\n ? spec.imported.name\n : (spec.imported as t.StringLiteral).value;\n const localName = spec.local.name;\n sources[localName] = pkg;\n } else if (t.isImportDefaultSpecifier(spec)) {\n // import Default from 'pkg'\n sources[spec.local.name] = pkg;\n } else if (t.isImportNamespaceSpecifier(spec)) {\n // import * as ns from 'pkg'\n sources[spec.local.name] = pkg;\n }\n }\n }\n\n // Patterns 2 & 3: CommonJS require calls inside variable declarations.\n if (t.isVariableDeclaration(node)) {\n for (const decl of node.declarations) {\n // Pattern 2: const X = require('pkg')\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isCallExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: 'require' }) &&\n decl.init.arguments.length === 1 &&\n t.isStringLiteral(decl.init.arguments[0])\n ) {\n sources[decl.id.name] = decl.init.arguments[0].value;\n }\n // Pattern 3: const { X } = require('pkg')\n // In the AST this becomes:\n // VariableDeclarator {\n // id: Identifier(X),\n // init: CallExpression {\n // callee: MemberExpression {\n // object: CallExpression { callee: require, arguments: ['pkg'] },\n // property: Identifier(X)\n // }\n // }\n // }\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isCallExpression(decl.init) &&\n t.isMemberExpression(decl.init.callee) &&\n t.isCallExpression(decl.init.callee.object) &&\n t.isIdentifier(decl.init.callee.object.callee, { name: 'require' }) &&\n decl.init.callee.object.arguments.length === 1 &&\n t.isStringLiteral(decl.init.callee.object.arguments[0])\n ) {\n sources[decl.id.name] = decl.init.callee.object.arguments[0].value;\n }\n }\n }\n\n // Generic AST traversal using @babel/types VISITOR_KEYS.\n for (const key of t.VISITOR_KEYS[node.type] || []) {\n const child = (node as unknown as Record<string, unknown>)[key];\n if (Array.isArray(child)) {\n for (const item of child) {\n if (item && typeof item === 'object' && (item as t.Node).type) {\n walk(item as t.Node);\n }\n }\n } else if (child && typeof child === 'object' && (child as t.Node).type) {\n walk(child as t.Node);\n }\n }\n }\n walk(ast.program);\n return sources;\n}\n\n/**\n * Validate that the component only imports from @mbler/mcx-component.\n * Non-mcx-core imports are collected and each unique offending package\n * triggers a console warning (once per package per file).\n * Relative imports ('./...', '../...') are silently allowed.\n */\nfunction checkComponentImports(sources: ExportSourceMap, filePath: string) {\n const allowedPackage = '@mbler/mcx-component';\n const warned = new Set<string>();\n for (const [, pkg] of Object.entries(sources)) {\n if (\n pkg &&\n !pkg.startsWith(allowedPackage) &&\n !pkg.startsWith('.') &&\n !warned.has(pkg)\n ) {\n warned.add(pkg);\n console.warn(\n `[${styleText('red', 'mcx component warning')}]: \"${pkg}\" in ${filePath} is not from \"${allowedPackage}\". Only imports/requires from \"${allowedPackage}\" are recommended.`,\n );\n }\n }\n}\n\n/**\n * Execute file_edit operations defined in a component's _meta.\n * Delegates to execEditInternal with a fresh limits counter.\n *\n * @param isMcxCoreSource - when true, the component originates from\n * @mbler/mcx-component and is exempt from file I/O limits and root base\n * restrictions.\n */\nexport async function execEdit(\n option: BaseJson['_meta']['file_edit'],\n ctx: transformCtx,\n isMcxCoreSource = false,\n) {\n if (!option) return;\n // Shared mutable limits object passed through recursive batch calls so that\n // the total write/read count across the entire file_edit tree is enforced.\n const limits = { writeCount: 0, readCount: 0 };\n await execEditInternal(option, ctx, limits, isMcxCoreSource);\n}\n\n/**\n * Internal recursive implementation of execEdit.\n * Handles three editOption types:\n * - batch: recursively processes a nested array of options\n * - copy_assets: copies a file from source to output via FilePoint resolution\n * - edit: evaluates an expression with define vars, then writes to a file or\n * appends to a bind target (e.g. item_texture)\n *\n * File I/O limits (writes ≤ 5, reads ≤ 1) are enforced on the limits object\n * but skipped entirely when isMcxCoreSource is true.\n */\nasync function execEditInternal(\n option: BaseJson['_meta']['file_edit'],\n ctx: transformCtx,\n limits: { writeCount: number; readCount: number },\n isMcxCoreSource: boolean,\n) {\n if (!option) return;\n for (const editOption of option) {\n if (editOption.type == 'batch') {\n // Recurse into nested batch — limits object is shared so counts persist.\n await execEditInternal(editOption.options, ctx, limits, isMcxCoreSource);\n } else {\n if (editOption.type == 'copy_assets') {\n // copy_assets: resolve both source and output paths, then copy.\n await cp(\n resolveFilePoint(editOption.source, ctx, isMcxCoreSource),\n resolveFilePoint(editOption.output, ctx, isMcxCoreSource),\n {\n recursive: true,\n force: true,\n },\n );\n } else if (editOption.type == 'edit') {\n // edit: build the define variables map from the expression config,\n // then run the expression to produce the output content.\n const defineVars = {} as Record<string, string>;\n for (const [key, entry] of Object.entries(\n editOption.expression.define,\n )) {\n const value = entry as\n | { from: 'var'; data: string }\n | { from: 'read_file'; data: FilePoint; default?: string };\n if (value.from == 'var') {\n // Simple variable reference — just pass through the string value.\n defineVars[key] = value.data;\n } else {\n // File read — enforce the read limit for non-mcx-core sources.\n if (!isMcxCoreSource) {\n limits.readCount++;\n if (limits.readCount > MAX_FILE_READS) {\n throw new Error(\n `[mcx component]: File read limit exceeded (max ${MAX_FILE_READS})`,\n );\n }\n }\n const fileContent = await readFile(\n resolveFilePoint(value.data, ctx, isMcxCoreSource),\n 'utf-8',\n );\n defineVars[key] = fileContent || value.default || '';\n }\n }\n const execResult = await editOption.expression.run(defineVars);\n\n // If the target is a file on disk, write the result and enforce write limit.\n if ('file' in editOption.source) {\n if (!isMcxCoreSource) {\n limits.writeCount++;\n if (limits.writeCount > MAX_FILE_WRITES) {\n throw new Error(\n `[mcx component]: File write limit exceeded (max ${MAX_FILE_WRITES})`,\n );\n }\n }\n const filePath = resolveFilePoint(\n editOption.source,\n ctx,\n isMcxCoreSource,\n );\n await writeFile(filePath, execResult.toString());\n }\n\n // If the target is a bind slot (e.g. item_texture), accumulate entries.\n if ('bind' in editOption.source) {\n if (\n editOption.source.bind == 'item_texture' &&\n editOption.source.type == 'append'\n ) {\n if (!Array.isArray(execResult))\n throw new Error(\n '[mcx component]: json._meta.file_edit: error exec result',\n );\n if (!cachedOption['item_texture'])\n cachedOption['item_texture'] = [];\n if (Array.isArray(execResult)) {\n cachedOption['item_texture'] = [\n ...(cachedOption['item_texture'] as [string, string][]),\n ...(execResult as [string, string][]),\n ];\n }\n }\n } else {\n throw new Error(\n '[mcx component]: json._meta.file_edit: unknown output place.',\n );\n }\n }\n }\n }\n}\n\n/**\n * Generate the final textures/item_texture.json from accumulated bind data.\n * Call this in the plugin's buildEnd / onEnd hook.\n * Merges with any existing item_texture.json in the output directory.\n */\nexport async function generateItemTextureJson(output: {\n resources: string;\n}): Promise<void> {\n const entries = cachedOption['item_texture'] as\n | [string, string][]\n | undefined;\n if (!entries || entries.length === 0) return;\n\n const dir = path.join(output.resources, 'textures');\n const filePath = path.join(dir, 'item_texture.json');\n\n const data: {\n resource_pack_name: string;\n texture_name: string;\n texture_data: Record<string, { textures: string }>;\n } = {\n resource_pack_name: 'mcx.pack.v.',\n texture_name: 'atlas.items',\n texture_data: {},\n };\n\n // Merge with existing data if the file already exists from a prior run.\n try {\n const existing = JSON.parse(readFileSync(filePath, 'utf-8'));\n if (existing.texture_data) {\n data.texture_data = existing.texture_data;\n }\n } catch {\n // File doesn't exist yet, use default empty data.\n }\n\n for (const [key, textures] of entries) {\n data.texture_data[key] = { textures };\n }\n\n await mkdir(dir, { recursive: true });\n await writeFile(filePath, JSON.stringify(data, null, 2));\n}\n\n/**\n * Compile a single MCX component: parse its source, validate imports, execute\n * the script in a VM, then iterate over each declared component to produce\n * its JSON output file.\n *\n * Security measures applied before VM execution:\n * 1. collectExportSources — maps each import to its source package\n * 2. checkComponentImports — warns on non-mcx-core dependencies\n *\n * Per-component restrictions (checked after VM execution):\n * - path traversal guard on the output file point\n * - root base: only allowed if the export came from @mbler/mcx-component\n * - file write limit (≤5) and read limit (≤1): only enforced for\n * non-mcx-core components\n */\nexport async function compileComponent(\n compiledCode: MCXCompileData,\n ctx: transformCtx,\n) {\n const component = compiledCode.strLoc.Component;\n const src = compiledCode.strLoc.script;\n\n // Pre-flight: scan imports and build the export → source package map.\n // This is used both for import validation and for per-component restriction\n // decisions later.\n const exportSources = collectExportSources(src);\n checkComponentImports(exportSources, compiledCode.File);\n\n // Execute the component script in a VM. The transformCjsHook rewrites\n // image file requires (e.g. require('./icon.png')) into\n // require('@mbler/mcx-component').PNGImageComponent(require('node:path').join(...))\n // so that image assets are handled by the mcx-core ImageComponent classes.\n const scriptRunResult = (await new RunScript(compiledCode.File, 'esm').run(\n src,\n execESMMethod.transformCjs,\n (data, setData) => {\n if (\n setData &&\n data.type == 'CallExpression' &&\n data.callee.type == 'Identifier' &&\n data.arguments.length == 1 &&\n data.arguments[0]?.type == 'CallExpression' &&\n data.arguments[0].callee.type == 'Identifier' &&\n data.arguments[0].callee.name == 'require'\n ) {\n const callRequire = data.arguments[0];\n const arg = callRequire.arguments[0];\n if (arg && arg.type == 'StringLiteral') {\n if (/^.+?\\.(png|svg|jpg|jpeg|gif)$/.test(arg.value)) {\n const imageComponentRequire = t.memberExpression(\n t.callExpression(t.identifier('require'), [\n t.stringLiteral('@mbler/mcx-component'),\n ]),\n t.identifier(\n {\n png: 'PNGImageComponent',\n svg: 'SVGImageComponent',\n jpg: 'JPGImageComponent',\n jpeg: 'JPGImageComponent',\n gif: 'GIFImageComponent',\n }[path.extname(arg.value).slice(1)] as string,\n ),\n );\n const finishExpression = t.newExpression(imageComponentRequire, [\n t.callExpression(\n t.memberExpression(\n t.callExpression(t.identifier('require'), [\n t.stringLiteral('node:path'),\n ]),\n t.identifier('join'),\n ),\n [t.stringLiteral(path.dirname(compiledCode.File)), arg],\n ),\n ]);\n setData(finishExpression);\n }\n }\n }\n },\n )) as Record<\n string,\n InstanceType<(typeof lib)[MCXstructureLocComponentType]> | undefined\n >;\n if (!component)\n throw new Error(\n '[component internal error]: compile component: mcx is not component: filePath: ' +\n compiledCode.File,\n );\n if (typeof scriptRunResult !== 'object')\n throw new Error(\n '[component compile error]: exec code: mcx export type is not object',\n );\n\n // Iterate over each declared component entry and produce its output JSON.\n for (const i of Object.entries(component)) {\n const filePoint = path.join(ctx.output.behavior, i[0]);\n\n // Path traversal check: the resolved output must stay inside the behavior dir.\n if (!path.relative(filePoint, ctx.output.behavior).startsWith('..'))\n throw new Error('[component]: Path Traversal: path: ' + filePoint);\n\n const pointExport = i[1].useExpore;\n const pointData = scriptRunResult[pointExport] as InstanceType<\n (typeof lib)[keyof typeof lib]\n >;\n if (!pointExport) {\n throw new Error(\n '[component]: compile: check: not found Component class of file: ' +\n compiledCode.File,\n );\n }\n\n // Ensure the output directory exists before writing.\n if (!existsSync(path.dirname(filePoint))) {\n await mkdir(path.dirname(filePoint), {\n recursive: true,\n });\n }\n\n const json = pointData.toJSON() as unknown as BaseJson;\n if (\n !json._meta ||\n !json._meta.type ||\n !['item', 'entity'].includes(json._meta.type)\n )\n throw new Error('[mcx component]: not mcx json component: unknown type');\n\n if (json._meta.file_edit) {\n // Determine if the component comes from @mbler/mcx-component.\n // Check whether any import in the script originates from that package.\n // This is more reliable than checking the specific export name,\n // since local variables (e.g. const item = new ItemComponent()) are\n // not captured by exportSources.\n const isMcxCoreSource = Object.values(exportSources).some(\n src => src && src.startsWith('@mbler/mcx-component'),\n );\n await execEdit(json._meta.file_edit, ctx, isMcxCoreSource);\n }\n\n // Strip the internal _meta field before writing the final JSON.\n delete (json as unknown as Record<string, string>)['_meta'];\n await writeFile(filePoint, JSON.stringify(json, null, 2));\n }\n}\nexport * from './vm';\n","import { mcxType, transformCtx, transformParseCtx } from '../types';\nimport * as t from '@babel/types';\nimport { generate } from '@babel/generator';\nimport config from './config';\nimport {\n _enable,\n _enableWithData,\n generateMain,\n processDefineProp,\n collectSetupDeclarations,\n processHooks,\n extractIdList,\n} from './utils';\nimport { EventComp, UIComp, FormComp, AppComp } from './transform';\nimport { compileComponent } from '../mcx-component';\n\nexport async function _transform(ctx: transformCtx): Promise<string> {\n // Determine setup mode from tag attributes before generateMain\n const formTag = ctx.compiledCode.strLoc.Form;\n const uiTag = ctx.compiledCode.strLoc.UI;\n const isSetupMode =\n (formTag && formTag.arr.setup !== undefined) ||\n (uiTag && uiTag.arr.setup !== undefined);\n\n // Determine mode type for defineProp (form vs ui)\n const modeType: 'form' | 'ui' | null =\n formTag && formTag.arr.setup !== undefined\n ? 'form'\n : uiTag && uiTag.arr.setup !== undefined\n ? 'ui'\n : null;\n\n // Process hooks BEFORE generateMain so hook calls are removed from body\n const hooks = isSetupMode ? processHooks(ctx.compiledCode.JSIR) : { startup: null, mounted: null };\n\n const _temp_main = generateMain(ctx.compiledCode.JSIR);\n const mainFn = (ctx.mainFn.body = _temp_main[0]);\n const prop: t.ObjectProperty[] = [];\n const app = _enableWithData<t.ObjectProperty[]>();\n const params: t.FunctionParameter[] = (ctx.mainFn.param = [\n t.identifier(config.paramCtx),\n ]);\n const parseCtx: transformParseCtx = {\n impBody: _temp_main[1],\n mainFn,\n prop,\n ctx: ctx,\n app,\n };\n let type: mcxType = 'app';\n\n // Process defineProp for setup mode before component handlers\n if (isSetupMode && modeType) {\n processDefineProp(ctx.compiledCode.JSIR, modeType, parseCtx.impBody);\n }\n\n // enable setup fn: use to generate setup\n const enableSetup = _enable();\n if (ctx.compiledCode.strLoc.Event.isLoad) {\n // handler event type mcx\n type = 'event';\n // enable export setup\n enableSetup();\n await EventComp(parseCtx);\n }\n if (ctx.compiledCode.strLoc.Form) {\n type = 'form';\n enableSetup();\n await FormComp(parseCtx);\n }\n if (ctx.compiledCode.strLoc.UI) {\n type = 'ui';\n enableSetup();\n await UIComp(parseCtx);\n }\n if (\n Object.getOwnPropertyNames(ctx.compiledCode.strLoc.Component).length >= 1\n ) {\n type = 'component';\n await compileComponent(ctx.compiledCode, ctx);\n return `export default {type:'component',setup:null,app:{}}`;\n }\n if (type == 'app') {\n // enable setup export\n enableSetup();\n // find event mcx import\n await AppComp(parseCtx);\n }\n\n // In setup mode, collect all non-exported declarations into the main function's return\n if (isSetupMode) {\n const existingExportNames = new Set<string>();\n for (const exp of ctx.compiledCode.JSIR.BuildCache.export) {\n if (t.isExportNamedDeclaration(exp) && exp.declaration) {\n const ids = extractIdList(exp.declaration);\n for (const id of ids) existingExportNames.add(id);\n }\n }\n for (const p of parseCtx.prop) {\n if (t.isObjectProperty(p) && t.isIdentifier(p.key)) {\n existingExportNames.add(p.key.name);\n }\n }\n const setupDecls = collectSetupDeclarations(\n ctx.compiledCode.JSIR,\n existingExportNames,\n );\n\n const returnStmt = mainFn[mainFn.length - 1];\n if (\n t.isReturnStatement(returnStmt) &&\n t.isObjectExpression(returnStmt.argument)\n ) {\n returnStmt.argument.properties.push(...setupDecls);\n if (hooks.startup) {\n returnStmt.argument.properties.push(\n t.objectProperty(t.identifier('__mcx_startup'), hooks.startup),\n );\n }\n if (hooks.mounted) {\n returnStmt.argument.properties.push(\n t.objectProperty(t.identifier('__mcx_mounted'), hooks.mounted),\n );\n }\n }\n }\n\n // add default export: type\n prop.push(t.objectProperty(t.identifier('type'), t.stringLiteral(type)));\n if (enableSetup.prototype.enable) {\n prop.push(\n t.objectProperty(\n t.identifier('setup'),\n t.identifier(config.scriptCompileFn),\n ),\n );\n }\n if (app.prototype.enable) {\n prop.push(\n t.objectProperty(\n t.identifier('app'),\n t.objectExpression(app.prototype.enable),\n ),\n );\n }\n // generate code\n const code = generate(\n // create program\n t.program([\n ...parseCtx.impBody,\n t.functionDeclaration(\n t.identifier(config.scriptCompileFn),\n params,\n t.blockStatement(mainFn),\n false,\n false,\n ),\n t.exportDefaultDeclaration(t.objectExpression(prop)),\n ]),\n ).code;\n return code;\n}\n","import type { TransformPluginContext } from 'rollup';\nimport { MCXCompileData } from '../compile-mcx/compiler/compileData';\nimport { CompileOpt } from '@mbler/mcx-types';\nimport { transformCtx } from '../types';\nimport { _transform } from './main';\nimport { program } from '@babel/types';\nimport type { RollupError } from 'rolldown';\nfunction createErrorProxy(err: unknown, id: string): RollupError {\n if (err instanceof Error) {\n return {\n ...err,\n message: `${err.message} (At ${id})`,\n };\n } else {\n return { message: String(err) };\n }\n}\nexport async function transform(\n code: MCXCompileData,\n cache: Map<string, MCXCompileData>,\n id: string,\n context: TransformPluginContext,\n opt: CompileOpt,\n output: transformCtx['output'],\n): Promise<string> {\n try {\n const scriptTag = code.raw.find(node => {\n return node.name == 'script';\n });\n if (!scriptTag)\n throw new Error('[transform check]: not found mcx script tag');\n const transformContext: transformCtx = {\n rollupContext: context,\n impAST: [],\n currentAST: program([]),\n opt,\n currentId: id,\n compiledCode: code,\n cache,\n scriptTag: scriptTag,\n mainFn: {\n param: [],\n body: [],\n },\n output,\n };\n const result = await _transform(transformContext);\n return result;\n } catch (err) {\n context.error(createErrorProxy(err, id));\n return '';\n }\n}\n","import type { Plugin, TransformResult } from 'rollup';\nimport type { Plugin as RolldownPlugin } from 'rolldown';\nimport { CompileOpt } from '../types';\nimport { extname } from 'node:path';\nimport { CompileError, compileMCXFn } from '.';\nimport { transform } from '../../transforms';\nimport type { MCXCompileData } from './compileData';\nimport { readFile } from 'node:fs/promises';\nimport MagicString from 'magic-string';\nimport * as path from 'node:path';\nimport { createRequire } from 'node:module';\nimport { transformCtx } from '../../types';\nimport ts from 'typescript';\nimport { readFileSync } from 'node:fs';\nimport {\n generateItemTextureJson,\n clearCachedOptions,\n} from '../../mcx-component';\nfunction createMcxPlugin(opt: CompileOpt, output: transformCtx['output']) {\n let cache: Map<string, MCXCompileData> = new Map();\n let tsconfig: ts.ParsedCommandLine;\n try {\n const configResult = ts.readConfigFile(opt.tsconfigPath, path => {\n try {\n return readFileSync(path, 'utf-8');\n } catch (error) {\n throw new Error(\n `Failed to read TypeScript config file at ${path}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n });\n\n if (configResult.error) {\n throw new Error(\n `TypeScript configuration error: ${configResult.error.messageText}`,\n );\n }\n\n if (!configResult.config) {\n throw new Error(\n `Empty TypeScript configuration file at ${opt.tsconfigPath}`,\n );\n }\n\n // Parse the configuration with proper path resolution\n const parsedConfig = ts.parseJsonConfigFileContent(\n configResult.config,\n ts.sys,\n path.dirname(opt.tsconfigPath),\n undefined,\n opt.tsconfigPath,\n );\n\n if (parsedConfig.errors.length > 0) {\n const errorMessages = parsedConfig.errors\n .map(err => err.messageText)\n .join('\\n');\n throw new Error(\n `TypeScript configuration parsing errors:\\n${errorMessages}`,\n );\n }\n\n tsconfig = parsedConfig;\n } catch (error) {\n // Fallback to default configuration if reading fails\n console.warn(\n `Failed to load TypeScript config from ${opt.tsconfigPath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n console.warn('Using default TypeScript configuration');\n tsconfig = {\n options: {},\n fileNames: [],\n errors: [],\n };\n }\n const resolveExtensions = ['', '.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'];\n const indexExtensions = resolveExtensions.map(ext => '/index' + ext);\n\n async function tryResolvePath(filePath: string): Promise<string | null> {\n for (const idxExt of indexExtensions) {\n try {\n const fullPath = filePath + idxExt;\n await readFile(fullPath, 'utf-8');\n return fullPath;\n } catch {}\n }\n for (const ext of resolveExtensions) {\n try {\n const fullPath = filePath + ext;\n await readFile(fullPath, 'utf-8');\n return fullPath;\n } catch {}\n }\n return null;\n }\n\n async function resolvePackageExports(\n pkgDir: string,\n subPath: string,\n pkgJson: Record<string, unknown>,\n ): Promise<string | null> {\n const exports = pkgJson.exports;\n if (exports) {\n const subImport = subPath.startsWith('./') ? subPath : `./${subPath}`;\n if (typeof exports === 'object' && exports !== null) {\n const exp = exports as Record<string, unknown>;\n if (exp[subImport]) {\n const target = exp[subImport];\n if (typeof target === 'string') {\n return path.join(pkgDir, target);\n } else if (typeof target === 'object' && target !== null) {\n const targetObj = target as Record<string, unknown>;\n if (targetObj.import) {\n return path.join(pkgDir, targetObj.import as string);\n }\n return path.join(\n pkgDir,\n (targetObj.default as string) ||\n (Object.values(targetObj)[0] as string),\n );\n }\n }\n if (subImport.endsWith('/') || subImport.endsWith('/*')) {\n const dirMapping = subImport.slice(0, -1);\n for (const [key, value] of Object.entries(exp)) {\n if (key.startsWith(dirMapping) && key !== dirMapping) {\n const target = value as string;\n return path.join(pkgDir, target);\n }\n }\n }\n } else if (typeof exports === 'string') {\n return path.join(pkgDir, exports);\n }\n }\n return null;\n }\n\n return {\n name: 'mbler-mcx-core',\n async resolveId(id, imp) {\n const i = path.parse(id);\n if (i.dir.startsWith('.') || i.root) {\n if (imp) {\n const baseDir = path.dirname(imp);\n const resolved = await tryResolvePath(path.join(baseDir, id));\n if (resolved) return resolved;\n }\n return null;\n } else {\n // First try Node.js native resolution for reliable symlink/pkg resolution\n if (imp) {\n try {\n const localRequire = createRequire(imp);\n const resolved = localRequire.resolve(id);\n if (resolved) return resolved;\n } catch {\n // fall through to manual resolution\n }\n }\n const isScopedPackage = id.startsWith('@');\n const parts = id.split('/');\n const pkgName = isScopedPackage\n ? `${parts[0]}/${parts[1]}`\n : (parts[0] as string);\n const subPath = isScopedPackage\n ? parts.slice(2).join('/')\n : parts.slice(1).join('/');\n const d = path.join(opt.moduleDir, pkgName);\n let pkgJson: Record<string, unknown>;\n try {\n pkgJson = JSON.parse(\n await readFile(path.join(d, 'package.json'), 'utf-8'),\n );\n } catch (err: unknown) {\n const nodeErr = err as { code?: string; message?: string };\n if (!nodeErr.code || nodeErr.code === 'ENOENT') {\n throw new Error(\n `[mcx resolveId]: package.json not found for '${id}' at '${d}'`,\n );\n } else {\n throw new Error(\n `[mcx resolveId]: invalid package.json for '${id}': ${nodeErr.message}`,\n );\n }\n }\n if (subPath) {\n const fromExports = await resolvePackageExports(d, subPath, pkgJson);\n if (fromExports) return fromExports;\n const fromDist = await tryResolvePath(\n path.join(d, './dist', subPath),\n );\n if (fromDist) return fromDist;\n const fromRoot = await tryResolvePath(path.join(d, subPath));\n if (fromRoot) return fromRoot;\n return null;\n }\n return path.join(d, pkgJson.main as string);\n }\n },\n transform: async function (\n code: string,\n id: string,\n ): Promise<TransformResult> {\n const magic = new MagicString(code);\n const ext = extname(id).slice(1);\n const tsRegex = /^.+?\\.(ts|mts|cts)$/;\n if (ext == 'mcx') {\n let compileData: MCXCompileData;\n try {\n compileData = cache.has(id)\n ? (cache.get(id) as MCXCompileData)\n : compileMCXFn(code);\n cache.set(id, compileData);\n } catch (err: unknown) {\n if (err instanceof CompileError) {\n this.error(err.message, {\n column: err.loc.column,\n line: err.loc.line,\n });\n } else {\n this.error(\n err instanceof Error\n ? `${err.message} : ${err.stack}`\n : String(err),\n );\n }\n return;\n }\n compileData.setFilePath(id);\n const compiledCode = await transform(\n compileData,\n cache,\n id,\n this,\n opt,\n output,\n );\n return {\n code: compiledCode,\n map: opt.sourcemap\n ? magic.generateMap({ hires: true, source: id })\n : void 0,\n };\n } else if (tsRegex.test(id)) {\n // Use the parsed TypeScript configuration\n const compiledCode = ts.transpileModule(code, {\n compilerOptions: tsconfig.options,\n fileName: id,\n }).outputText;\n return {\n code: compiledCode,\n map: opt.sourcemap\n ? magic.generateMap({ hires: true, source: id })\n : void 0,\n };\n }\n return null;\n },\n async buildEnd() {\n cache.clear();\n await generateItemTextureJson(output);\n clearCachedOptions();\n },\n buildStart() {\n cache = new Map();\n },\n } satisfies Plugin;\n}\n\nexport function rollupPlugin(\n opt: CompileOpt,\n output: transformCtx['output'],\n): Plugin {\n return createMcxPlugin(opt, output);\n}\n\nexport function rolldownPlugin(\n opt: CompileOpt,\n output: transformCtx['output'],\n): RolldownPlugin {\n return createMcxPlugin(opt, output) as unknown as RolldownPlugin;\n}\n","import type { TransformPluginContext } from 'rollup';\nimport type { MCXCompileData } from './compile-mcx/compiler/compileData';\nimport { CompileOpt } from '@mbler/mcx-types';\nimport * as t from '@babel/types';\ninterface BaseToken {\n data: string;\n type: TokenType;\n start: MCXPosition;\n end: MCXPosition;\n}\ninterface TagToken extends BaseToken {\n type: 'Tag';\n}\ninterface TagEndToken extends BaseToken {\n type: 'TagEnd';\n}\ninterface ContentToken extends BaseToken {\n type: 'Content';\n}\ninterface CommentToken extends BaseToken {\n type: 'Comment';\n}\ntype Token = TagToken | TagEndToken | ContentToken | CommentToken;\ntype AttributeMap = Record<string, string | boolean>;\n/** 统一的位置信息结构 */\ninterface MCXPosition {\n line: number;\n column: number;\n}\n\ninterface MCXLoc {\n start: MCXPosition;\n end: MCXPosition;\n}\ninterface ParsedTagNode {\n start: TagToken;\n name: string;\n arr: AttributeMap;\n content: (ParsedTagContentNode | ParsedTagNode | ParsedCommentNode)[];\n end: TagEndToken | null;\n loc: MCXLoc;\n type: 'TagNode';\n}\ninterface ParsedTagContentNode {\n data: string;\n type: 'TagContent';\n}\ninterface ParsedCommentNode {\n data: string;\n type: 'Comment';\n loc?: MCXLoc;\n}\ntype TokenType = 'Tag' | 'TagEnd' | 'Content' | 'Comment';\ntype PropValue = number | string | object;\ninterface PropNode {\n key: string;\n value: PropValue;\n type: 'PropChar' | 'PropObject';\n}\ntype JsType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'object'\n | 'function'\n | 'bigint'\n | 'symbol';\ninterface TypeVerifyBody {\n [key: string]: JsType;\n}\nexport interface ParseReadFileOpt {\n delay: number;\n maxRetries: number;\n want: 'string' | 'object';\n}\nexport type ReadFileOpt = Partial<ParseReadFileOpt>;\nexport type mcxType = 'component' | 'event' | 'app' | 'ui' | 'form';\nexport type {\n Token,\n ContentToken,\n TagEndToken,\n TagToken,\n CommentToken,\n BaseToken,\n AttributeMap,\n PropValue,\n TokenType,\n ParsedTagContentNode,\n ParsedCommentNode,\n TypeVerifyBody,\n JsType,\n PropNode,\n ParsedTagNode,\n MCXLoc,\n MCXPosition,\n};\nexport interface transformCtx {\n rollupContext: TransformPluginContext;\n compiledCode: MCXCompileData;\n cache: Map<string, MCXCompileData>;\n currentId: string;\n scriptTag: ParsedTagNode;\n currentAST: t.Program;\n mainFn: {\n param: t.FunctionParameter[];\n body: t.Statement[];\n };\n impAST: t.ImportDeclaration[];\n opt: CompileOpt;\n output: {\n dist: string;\n behavior: string;\n resources: string;\n };\n}\nexport interface transformParseCtx {\n prop: t.ObjectProperty[];\n impBody: t.ImportDeclaration[];\n mainFn: t.Statement[];\n ctx: transformCtx;\n app: ((data: t.ObjectProperty[]) => void) & {\n prototype: { enable: t.ObjectProperty[] | null };\n };\n}\n","import type {\n Rarity,\n ItemComponentOptions,\n FoodEffect,\n EntityComponentOptions,\n} from '@mbler/mcx-component';\n\nexport interface FilePoint {\n base: 'behavior' | 'resources' | 'root';\n file: string;\n}\n\nexport interface FileBindSource {\n bind: 'item_texture';\n type: 'append' | 'all_replace';\n}\n\nexport type DefineEntry =\n | {\n from: 'var';\n data: string;\n }\n | {\n from: 'read_file';\n data: FilePoint;\n default?: string;\n };\n\nexport type FileEditExpression<\n T extends Record<string, DefineEntry> = Record<string, DefineEntry>,\n> = {\n define: T;\n run: (define: { [K in keyof T]: string }) => Promise<\n string | string[] | [string, string][]\n >;\n};\n\nexport function createFileEdit<\n T extends Record<string, DefineEntry>,\n>(expression: {\n define: T;\n run: (define: { [K in keyof T]: string }) => Promise<\n string | string[] | [string, string][]\n >;\n}): FileEditExpression<T> {\n return expression;\n}\n\nexport type FileEditOption =\n | {\n type: 'edit';\n id?: string;\n source: FilePoint | FileBindSource;\n expression: FileEditExpression<Record<string, DefineEntry>>;\n }\n | {\n type: 'copy_assets';\n id?: string;\n source: FilePoint;\n output: FilePoint;\n };\n\nexport interface BaseJson {\n format_version: string;\n _meta: {\n type: 'item' | 'entity';\n file_edit?: (\n | FileEditOption\n | {\n type: 'batch';\n options: FileEditOption[];\n id?: string;\n }\n )[];\n };\n}\n\nexport type {\n Rarity,\n ItemComponentOptions,\n FoodEffect,\n EntityComponentOptions,\n};\nexport type {\n ParticleType,\n SoundEvent,\n EnchantableSlot,\n} from '@mbler/mcx-component';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,qBAAqB,MAAgD;CAC5E,OAAO,MAAM,WAAW;;;AAI1B,SAAS,kBACP,QACA,WACkC;CAClC,IAAI,OAAO;CACX,IAAI,MAAM;CACV,MAAM,MAAM,KAAK,IAAI,WAAW,OAAO,OAAO;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,KACvB,IAAI,OAAO,WAAW,EAAE,KAAK,IAAI;EAC/B;EACA,MAAM;QAEN;CAGJ,OAAO;EAAE;EAAM,QAAQ;EAAK;;AAG9B,IAAqB,SAArB,MAAqB,OAAO;CAC1B,AAAQ;CACR,AAAQ;CAER,YAAY,MAAc,kBAA2B,OAAO;EAC1D,KAAK,OAAO;EACZ,KAAK,kBAAkB;;CAGzB,WAA4B;EAC1B,MAAM,MAAgB,UAAU,KAAK,MAAM;GACzC,UAAU;GACV,YAAY;GACb,CAAC;EACF,MAAM,SAA0B,EAAE;EAClC,KAAK,MAAM,SAAS,IAAI,UAAU;GAChC,MAAM,OAAO,KAAK,qBAAqB,MAAM;GAC7C,IAAI,QAAQ,KAAK,SAAS,WAAW,OAAO,KAAK,KAAK;;EAExD,OAAO;;CAGT,AAAQ,qBACN,MACiE;EACjE,IAAI,KAAK,SAAS,UAAU,SAC1B,OAAO,KAAK,kBAAkB,KAAwB;EAExD,IAAI,KAAK,SAAS,UAAU,MAAM;GAChC,MAAM,WAAW;GACjB,IAAI,SAAS,QAAQ,MAAM,EACzB,OAAO;IAAE,MAAM,SAAS;IAAS,MAAM;IAAc;GAEvD,OAAO;;EAET,IAAI,KAAK,SAAS,UAAU,e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OAAO;IAChB,IAAI;IACJ,IAAI;KACF,cAAc,MAAM,IAAI,GAAG,GACtB,MAAM,IAAI,GAAG,GACd,aAAa,KAAK;KACtB,MAAM,IAAI,IAAI,YAAY;aACnB,KAAc;KACrB,IAAI,eAAe,cACjB,KAAK,MAAM,IAAI,SAAS;MACtB,QAAQ,IAAI,IAAI;MAChB,MAAM,IAAI,IAAI;MACf,CAAC;UAEF,KAAK,MACH,eAAe,QACX,GAAG,IAAI,QAAQ,KAAK,IAAI,UACxB,OAAO,IAAI,CAChB;KAEH;;IAEF,YAAY,YAAY,GAAG;IAS3B,OAAO;KACL,MAAM,MATmB,UACzB,aACA,OACA,IACA,MACA,KACA,OACD;KAGC,KAAK,IAAI,YACL,MAAM,YAAY;MAAE,OAAO;MAAM,QAAQ;MAAI,CAAC,GAC9C,KAAK;KACV;UACI,IAAI,QAAQ,KAAK,GAAG,EAMzB,OAAO;IACL,MALmB,GAAG,gBAAgB,MAAM;KAC5C,iBAAiB,SAAS;KAC1B,UAAU;KACX,CAAC,CAAC;IAGD,KAAK,IAAI,YACL,MAAM,YAAY;KAAE,OAAO;KAAM,QAAQ;KAAI,CAAC,GAC9C,KAAK;IACV;GAEH,OAAO;;EAET,MAAM,WAAW;GACf,MAAM,OAAO;GACb,MAAM,wBAAwB,OAAO;GACrC,oBAAoB;;EAEtB,aAAa;GACX,wBAAQ,IAAI,KAAK;;EAEpB;;AAGH,SAAgB,aACd,KACA,QACQ;CACR,OAAO,gBAAgB,KAAK,OAAO;;AAGrC,SAAgB,eACd,KACA,QACgB;CAChB,OAAO,gBAAgB,KAAK,OAAO;;;;;;;;;;AEpPrC,SAAgB,eAEd,YAKwB;CACxB,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbler/mcx-core",
3
- "version": "0.1.3-rc.2",
3
+ "version": "0.1.3-rc.4",
4
4
  "description": "a DSL compiler of mcx",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [
@@ -32,7 +32,7 @@
32
32
  "@vue/compiler-sfc": "^3.5.39",
33
33
  "magic-string": "0.30.21",
34
34
  "typescript": "5.9.3",
35
- "@mbler/mcx-types": "0.0.4-rc.4"
35
+ "@mbler/mcx-types": "0.0.4-rc.5"
36
36
  },
37
37
  "devDependencies": {
38
38
  "rolldown": "1.0.0-rc.18",