@mbler/mcx-core 0.1.2-rc.3 → 0.1.2-rc.5

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
@@ -13,9 +13,9 @@ import * as generator from "@babel/generator";
13
13
  import { generate } from "@babel/generator";
14
14
  import * as vm from "node:vm";
15
15
  import { Buffer } from "node:buffer";
16
+ import lib, { BlockComponent, BlockComponent as BlockComponent$1, EntityComponent, EntityComponent as EntityComponent$1, GIFImageComponent, GIFImageComponent as GIFImageComponent$1, ItemComponent, ItemComponent as ItemComponent$1, JPGImageComponent, JPGImageComponent as JPGImageComponent$1, PNGImageComponent, PNGImageComponent as PNGImageComponent$1, SVGImageComponent, SVGImageComponent as SVGImageComponent$1 } from "@mbler/mcx-component";
16
17
  import { existsSync, readFileSync } from "node:fs";
17
18
  import { styleText } from "node:util";
18
- import { BlockComponent, BlockComponent as BlockComponent$1, EntityComponent, EntityComponent as EntityComponent$1, GIFImageComponent, GIFImageComponent as GIFImageComponent$1, ItemComponent, ItemComponent as ItemComponent$1, JPGImageComponent, JPGImageComponent as JPGImageComponent$1, PNGImageComponent, PNGImageComponent as PNGImageComponent$1, SVGImageComponent, SVGImageComponent as SVGImageComponent$1 } from "@mbler/mcx-component";
19
19
  import MagicString from "magic-string";
20
20
  //#region src/ast/tag.ts
21
21
  function createPos(line, column) {
@@ -1622,7 +1622,7 @@ async function compileComponent(compiledCode, ctx) {
1622
1622
  const json = pointData.toJSON();
1623
1623
  if (!json._meta || !json._meta.type || !["item", "entity"].includes(json._meta.type)) throw new Error("[mcx component]: not mcx json component: unknown type");
1624
1624
  if (json._meta.file_edit) {
1625
- const isMcxCoreSource = (exportSources[pointExport] ?? "").startsWith("@mbler/mcx-component");
1625
+ const isMcxCoreSource = (exportSources[pointExport] ?? "").startsWith("@mbler/mcx-component") || pointData && typeof pointData.constructor === "function" && (pointData.constructor === lib.item || pointData.constructor === lib.entity || pointData.constructor === lib.block);
1626
1626
  await execEdit(json._meta.file_edit, ctx, isMcxCoreSource);
1627
1627
  }
1628
1628
  delete json["_meta"];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Lexer","Parser","AST_tag","AST_prop","Utils","CompileData.JsCompileData","Utils","CompileData.MCXCompileData","babelErr","Utils","config","McxUtils","Comp","config","Comp","config","config","EventComp","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/ui.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 BaseToken,\n TagToken,\n TagEndToken,\n ContentToken,\n CommentToken,\n Token,\n ParsedTagNode,\n AttributeMap,\n ParsedTagContentNode,\n ParsedCommentNode,\n MCXLoc,\n MCXPosition,\n TokenType,\n} from './../types.js';\n\nfunction createPos(line: number, column: number): MCXPosition {\n return { line, column };\n}\nclass Tokenizer {\n private text: string;\n\n constructor(text: string) {\n this.text = text;\n }\n *splitTokens(): IterableIterator<Token> {\n const text = this.text;\n let i = 0;\n let line = 1;\n let column = 0;\n const len = text.length;\n\n while (i < len) {\n const ch = text[i];\n\n if (ch === '<') {\n if (text.startsWith('!--', i + 1)) {\n const commentStart = i;\n const tokenStartLine = line;\n const tokenStartColumn = column;\n const endIdx = text.indexOf('-->', i + 4);\n const commentEnd = endIdx === -1 ? len - 1 : endIdx + 2;\n for (let j = i; j <= commentEnd; j++) {\n if (text[j] === '\\n') {\n line++;\n column = 0;\n } else {\n column++;\n }\n }\n const buffer = text.slice(commentStart, commentEnd + 1);\n const tok: Token = {\n data: buffer,\n type: 'Comment' as TokenType,\n start: createPos(tokenStartLine, tokenStartColumn),\n end: createPos(line, column),\n };\n yield tok;\n i = commentEnd + 1;\n if (i < len && text[i] === '>') column++;\n continue;\n }\n const tokenStart = i;\n const tokenStartLine = line;\n const tokenStartColumn = column;\n let j = i + 1;\n let sawGt = false;\n for (; j < len; j++) {\n const c = text[j];\n if (c === '>') {\n sawGt = true;\n break;\n }\n if (c === '\\n') {\n line++;\n column = 0;\n } else {\n column++;\n }\n }\n const buffer = text.slice(tokenStart, sawGt ? j + 1 : len);\n const type: TokenType = buffer.startsWith('</') ? 'TagEnd' : 'Tag';\n const tok: Token = {\n data: buffer,\n type,\n start: createPos(tokenStartLine, tokenStartColumn),\n end: createPos(line, column),\n };\n yield tok;\n i = sawGt ? j + 1 : len;\n if (sawGt) column++;\n } else {\n const contentStart = i;\n const contentStartLine = line;\n const contentStartColumn = column;\n let j = i;\n for (; j < len; j++) {\n const c = text[j];\n if (c === '<') break;\n if (c === '\\n') {\n line++;\n column = 0;\n } else {\n column++;\n }\n }\n const data = text.slice(contentStart, j);\n const n: Token = {\n data,\n type: 'Content',\n start: createPos(contentStartLine, contentStartColumn),\n end: createPos(line, j > contentStart ? column - 1 : column),\n };\n yield n;\n i = j;\n }\n }\n }\n}\n\nclass Lexer {\n private text: string;\n private includeComments: boolean;\n private booleanProxyCache: WeakMap<object, Record<string, boolean>>;\n\n constructor(text: string, includeComments: boolean = false) {\n this.text = text;\n this.includeComments = includeComments;\n this.booleanProxyCache = new WeakMap();\n }\n *tokenStream(): IterableIterator<Token> {\n const tokenizer = new Tokenizer(this.text);\n\n for (const token of Array.from(tokenizer.splitTokens())) {\n // 如果includeComments为false,跳过注释Token\n if (!this.includeComments && token.type === 'Comment') {\n continue;\n }\n yield token;\n }\n }\n\n /**\n * 生成 Token 迭代器,用于遍历所有结构化 Token\n */\n *tokenIterator(): IterableIterator<Token> {\n yield* this.tokenStream();\n }\n\n get tokens(): Iterable<Token> {\n return {\n [Symbol.iterator]: () => this.tokenIterator(),\n };\n }\n\n /**\n * 创建一个动态布尔属性访问的 Proxy(可选功能)\n */\n getBooleanCheckProxy(): Record<string, boolean> {\n if (!this.booleanProxyCache.has(this)) {\n const charMap = new Map<string, boolean>();\n const proxy = new Proxy(\n {},\n {\n get(_: unknown, prop: string | symbol): boolean {\n if (typeof prop !== 'string') return false;\n return charMap.get(prop) || false;\n },\n set(_: unknown, prop: string | symbol, value: unknown): boolean {\n if (typeof prop !== 'string') return false;\n charMap.set(prop, Boolean(value));\n return true;\n },\n },\n );\n this.booleanProxyCache.set(this, proxy as Record<string, boolean>);\n }\n return this.booleanProxyCache.get(this) as Record<string, boolean>;\n }\n}\n\n/** Parser - 负责将Token流解析为AST */\nclass Parser {\n private lexer: Lexer;\n\n constructor(lexer: Lexer) {\n this.lexer = lexer;\n }\n\n /**\n * 解析标签属性,如:<div id=\"app\" disabled />\n */\n private parseAttributes(tagContent: string): {\n name: string;\n arr: AttributeMap;\n } {\n const attributes: Record<string, string> = {};\n let currentKey = '';\n let currentValue = '';\n let inKey = true;\n let name = '';\n let inValue = false;\n let quoteChar: string | null = null;\n let isTagName = true;\n\n for (let i = 0; i < tagContent.length; i++) {\n const char = tagContent[i];\n\n if (isTagName) {\n if (char === ' ' || char === '>') {\n name = currentKey.trim();\n currentKey = '';\n isTagName = false;\n if (char === '>') break;\n } else {\n currentKey += char;\n }\n continue;\n }\n\n if (inValue) {\n if (\n char === quoteChar &&\n (currentValue.length === 0 ||\n currentValue[currentValue.length - 1] !== '\\\\')\n ) {\n attributes[currentKey.trim()] = currentValue;\n currentKey = '';\n currentValue = '';\n inKey = true;\n inValue = false;\n quoteChar = null;\n } else {\n currentValue += char;\n }\n } else if (char === '=' && inKey) {\n inKey = false;\n inValue = true;\n const nextIndex = i + 1;\n const nextChar =\n nextIndex < tagContent.length ? tagContent[nextIndex] : ' ';\n quoteChar = null;\n } else if (char === ' ' && inKey && currentKey) {\n attributes[currentKey.trim()] = 'true';\n currentKey = '';\n } else if (inKey) {\n currentKey += char;\n }\n }\n\n if (isTagName) {\n name = currentKey.trim();\n } else if (currentKey) {\n attributes[currentKey.trim()] = inValue\n ? currentValue.replace(/^[\"']/, '').replace(/[\"']$/, '')\n : 'true';\n }\n\n return {\n name,\n arr: attributes,\n };\n }\n\n /**\n * 基于stack的解析以支持嵌套,并为ParsedTagNode添加loc: { start, end }\n * Content和Comment改为递归节点数组 (ParsedTagContentNode | ParsedCommentNode | ParsedTagNode)[]\n */\n *parseAST(): IterableIterator<ParsedTagNode> {\n const rawTokens = Array.from(this.lexer.tokenStream());\n const root: (ParsedTagNode | ParsedTagContentNode | ParsedCommentNode)[] =\n [];\n const stack: ParsedTagNode[] = [];\n\n for (let idx = 0; idx < rawTokens.length; idx++) {\n const token = rawTokens[idx];\n if (!token) continue;\n\n if (token.type === 'Content') {\n const contentNode: ParsedTagContentNode = {\n data: token.data,\n type: 'TagContent',\n };\n if (stack.length > 0) {\n const top = stack[stack.length - 1];\n (top as ParsedTagNode).content.push(contentNode);\n } else {\n root.push(contentNode);\n }\n } else if (token.type === 'Comment') {\n const commentNode: ParsedCommentNode = {\n data: token.data,\n type: 'Comment',\n loc: {\n start: { ...token.start },\n end: { ...token.end },\n },\n };\n if (stack.length > 0) {\n const top = stack[stack.length - 1];\n (top as ParsedTagNode).content.push(commentNode);\n } else {\n root.push(commentNode);\n }\n } else if (token.type === 'Tag') {\n const inner = token.data.slice(1, -1).trim();\n // 自闭合 <br/> 或 <img ... /> 也当作单节点(没有 end),这里简单检测末尾 '/'\n const isSelfClosing = inner.endsWith('/');\n const arr = this.parseAttributes(\n isSelfClosing ? inner.slice(0, -1).trim() : inner,\n );\n const node: ParsedTagNode = {\n start: token as TagToken,\n name: arr.name,\n arr: arr.arr as AttributeMap,\n // content 现在是一个数组,包含文本节点、注释节点或子标签\n content: [] as (\n | ParsedTagContentNode\n | ParsedCommentNode\n | ParsedTagNode\n )[],\n end: null,\n type: 'TagNode',\n loc: {\n start: { ...token.start },\n end: { ...token.end },\n } as MCXLoc,\n };\n\n if (isSelfClosing) {\n // self-closing: immediately close and attach to parent or root\n if (stack.length > 0) {\n (stack[stack.length - 1] as ParsedTagNode).content.push(node);\n } else {\n // yield top-level node\n yield node;\n }\n } else {\n stack.push(node);\n }\n } else if (token.type === 'TagEnd') {\n // 从 '</name>' 中提取 name\n const name = token.data\n .replace(/^<\\/\\s*/, '')\n .replace(/\\s*>$/, '')\n .trim();\n // 找到最近的匹配开始标签\n for (let s = stack.length - 1; s >= 0; s--) {\n const candidate = stack[s];\n if (candidate && candidate.name === name) {\n // 设置结束\n candidate.end = token;\n candidate.loc.end = { ...token.end };\n // 从 stack 中移除并附加到父节点或作为顶层节点产出\n stack.splice(s, 1);\n if (stack.length > 0) {\n (stack[stack.length - 1] as ParsedTagNode).content.push(\n candidate,\n );\n } else {\n // yield completed top-level node\n yield candidate;\n }\n break;\n }\n }\n }\n }\n while (stack.length > 0) {\n const node = stack.shift()!;\n if (stack.length > 0) {\n (stack[0] as ParsedTagNode).content.push(node);\n } else {\n yield node;\n }\n }\n }\n\n get ast(): Iterable<ParsedTagNode> {\n return {\n [Symbol.iterator]: () => this.parseAST(),\n };\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 private getAST(): ParsedTagNode[] {\n const lexer = new Lexer(this.text, this.includeComments);\n const parser = new Parser(lexer);\n return Array.from(parser.parseAST());\n }\n\n get data(): ParsedTagNode[] {\n return this.getAST();\n }\n\n parseAST(): ParsedTagNode[] {\n return this.getAST();\n }\n\n /**\n * 生成代码字符串\n * @param node 代码的AST节点\n * @returns 代码字符串\n */\n static generateCode(node: ParsedTagNode): string {\n let code = `<${node.name}`;\n // 添加属性\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 {\n code += McxAst.generateCode(item as ParsedTagNode);\n }\n }\n }\n code += `</${node.name}>`;\n return code;\n }\n}\n\nexport { Tokenizer, Lexer, Parser, 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 isToken(obj: unknown): obj is Token {\n return (\n !!obj &&\n typeof obj === 'object' &&\n 'data' in (obj as object) &&\n 'type' in (obj as object) &&\n 'start' in (obj as object) &&\n 'end' in (obj as object) &&\n ((obj as Token).type === 'Tag' ||\n (obj as Token).type === 'TagEnd' ||\n (obj as Token).type === 'Content' ||\n (obj as Token).type === 'Comment')\n );\n }\n static isTagToken(obj: unknown): obj is TagToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'Tag';\n }\n static isTagEndToken(obj: unknown): obj is TagEndToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'TagEnd';\n }\n static isContentToken(obj: unknown): obj is ContentToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'Content';\n }\n static isCommentToken(obj: unknown): obj is CommentToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'Comment';\n }\n static isBaseToken(obj: unknown): obj is BaseToken {\n return (\n !!obj &&\n typeof obj === 'object' &&\n 'data' in (obj as object) &&\n 'type' in (obj as object) &&\n 'start' in (obj as object) &&\n 'end' in (obj as object)\n );\n }\n static isTokenType(value: unknown): value is TokenType {\n return (\n value === 'Tag' ||\n value === 'TagEnd' ||\n value === 'Content' ||\n value === 'Comment'\n );\n }\n static isParseNode(node: unknown): node is ParsedTagNode[] {\n return Array.isArray(node) && (node as unknown[]).every(MCXUtils.isTagNode);\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 { ParserOptions } from '@babel/parser';\nimport 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}\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).program;\n } catch (err: unknown) {\n throw new Error('[compiler]: babel error' + (err instanceof Error ? err.stack : String(err)));\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 * as 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 { line: start.line, column: typeof start.column === 'number' ? (start.column as number) : -1 };\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 };\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(name);\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 Event: ParsedTagNode | null;\n Component: Record<MCXstructureLocComponentType, ParsedTagNode>;\n } = {\n script: '',\n Event: null,\n ui: 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 }\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 }\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\nexport {\n extractIdList,\n extractVarDefIdList,\n generateEventConfig,\n _enable,\n generateMain,\n _enableWithData,\n};\n","import { MCXstructureLoc } from '../../compile-mcx/types';\nimport { ContentToken, ParsedTagNode, transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport config from '../config';\nexport async function Comp(ctx: transformParseCtx) {\n const internalCtx = ctx.ctx;\n\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 uiTagNode = ctx.ctx.compiledCode.strLoc.UI;\n if (!uiTagNode || uiTagNode?.name !== 'Ui')\n throw new Error(\"[UI Component]: why didn't parent compeled verify?\");\n let MCXUIType: 'ActionFormData' | 'MessageFormData' | 'ModalFormData' | null =\n null;\n const UITree: {\n arr: Record<string, string | boolean>;\n content: string;\n type: string;\n loc?: ParsedTagNode['loc'];\n }[] = [];\n for (const uiClientTag of uiTagNode.content) {\n if (uiClientTag.type == 'TagNode') {\n // if has client TagNode\n if (uiClientTag.content.some(i => i.type == 'TagNode')) {\n internalCtx.rollupContext.error(\n \"[UI]: can't support ui client element\",\n uiClientTag.loc\n ? {\n column: uiClientTag.loc.start.column,\n line: uiClientTag.loc.start.line,\n }\n : void 0,\n );\n }\n // add to tree\n UITree.push({\n arr: uiClientTag.arr,\n content: uiClientTag.content\n .map(i => (i.type == 'TagContent' && i.data) || '')\n .join(''),\n type: uiClientTag.name,\n loc: uiClientTag.loc,\n });\n }\n // continue TagContentNode\n }\n const parsedObj: t.Expression[] = [];\n function pushToTree(\n name: string,\n params: Record<string, string | boolean>,\n content: string,\n ) {\n parsedObj.push(\n t.objectExpression([\n t.objectProperty(t.identifier('type'), t.stringLiteral(name)),\n t.objectProperty(\n t.identifier('params'),\n t.objectExpression(\n Object.entries(params).map(([key, value]) => {\n const isDynamic = key.startsWith(':');\n const paramName = isDynamic ? key.slice(1) : key;\n return t.objectProperty(\n t.identifier(paramName),\n isDynamic\n ? t.objectExpression([\n t.objectProperty(\n t.identifier('useProp'),\n t.stringLiteral(String(value)),\n ),\n ])\n : typeof value == 'boolean'\n ? t.booleanLiteral(value)\n : t.stringLiteral(value),\n );\n }),\n ),\n ),\n t.objectProperty(\n t.identifier('content'),\n content.startsWith('{{ ') && content.endsWith(' }}')\n ? t.objectExpression([\n t.objectProperty(\n t.identifier('useProp'),\n t.stringLiteral(content.slice(3, content.length - 3).trim()),\n ),\n ])\n : t.stringLiteral(content),\n ),\n ]),\n );\n }\n // generate type and parsed tree\n for (const tp of UITree) {\n const name = tp.type;\n // only ModalFormData Element\n if (['input', 'dropdown', 'submit', 'toggle', 'slider'].includes(name)) {\n // ModalFromData\n if (MCXUIType && MCXUIType !== 'ModalFormData') {\n internalCtx.rollupContext.error(\n \"[UI]: a mcx can't have a ModalFormData Node and other form tag\",\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n }\n MCXUIType = 'ModalFormData';\n pushToTree(name, tp.arr, tp.content);\n }\n // only MessageFormData Element\n else if (['button-m'].includes(name)) {\n if (MCXUIType && MCXUIType !== 'MessageFormData') {\n internalCtx.rollupContext.error(\n '[UI]: ',\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n }\n MCXUIType = 'MessageFormData';\n pushToTree(name, tp.arr, tp.content);\n }\n // public\n else if (['body', 'divider', 'title', 'label'].includes(name)) {\n pushToTree(name, tp.arr, tp.content);\n } else if (name == 'button') {\n if (MCXUIType !== 'ActionFormData' && MCXUIType)\n internalCtx.rollupContext.error(\n \"[UI]: don't support use button for messageFormData\",\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n pushToTree(name, tp.arr, tp.content);\n MCXUIType = 'ActionFormData';\n } else {\n internalCtx.rollupContext.error(\n \"[UI]: don't support tag: \" + name,\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n }\n }\n if (!MCXUIType) MCXUIType = 'ActionFormData';\n const finallyData = t.objectExpression([\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(MCXUIType),\n ),\n ),\n t.objectProperty(t.identifier('UI'), t.identifier('__minecraft__ui')),\n ]);\n ctx.app([\n t.objectProperty(\n t.identifier('ui'),\n t.newExpression(t.identifier('__mcx__ui'), [\n finallyData,\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 lib from '@mbler/mcx-component';\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';\n\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 THIS specific export comes from @mbler/mcx-component.\n // If yes, the component is trusted and bypasses file I/O limits\n // and root base restrictions. If not, restrictions apply.\n const isMcxCoreSource = (exportSources[pointExport] ?? '').startsWith(\n '@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}\n\nexport * from './vm';\nexport {\n ItemComponent,\n EntityComponent,\n BlockComponent,\n PNGImageComponent,\n SVGImageComponent,\n GIFImageComponent,\n JPGImageComponent,\n} from '@mbler/mcx-component';\n","import { mcxType, transformCtx, transformParseCtx } from '../types';\nimport * as t from '@babel/types';\nimport { generate } from '@babel/generator';\nimport config from './config';\nimport { _enable, _enableWithData, generateMain } from './utils';\nimport { EventComp, UIComp, AppComp } from './transform';\nimport { compileComponent } from '../mcx-component';\nexport async function _transform(ctx: transformCtx): Promise<string> {\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 // 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.UI) {\n type = 'ui'; // ui mcx\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 // 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 }\n}\n","import type { Plugin, TransformResult } from 'rollup';\nimport type { Plugin as RolldownPlugin } from 'rolldown';\nimport { CompileOpt } from '../types';\nimport { extname, isAbsolute, join } from 'node:path';\nimport { CompileError, compileMCXFn } from '.';\nimport { transform } from '../../transforms';\nimport type { MCXCompileData } from './compileData';\nimport { readFile, rm } from 'node:fs/promises';\nimport MagicString from 'magic-string';\nimport * as path from 'node:path';\nimport { transformCtx } from '../../types';\nimport * as 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) || (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 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 const error: CompileError = err;\n this.error(error.message, {\n column: error.loc.column,\n line: error.loc.line,\n });\n }\n this.error(\n err instanceof Error\n ? `${err.message} : ${err.stack}`\n : String(err),\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';\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 { ParticleType, SoundEvent, EnchantableSlot, Rarity, ItemComponentOptions, FoodEffect, EntityComponentOptions } 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 { Rarity, ItemComponentOptions, FoodEffect, EntityComponentOptions };\nexport type { ParticleType, SoundEvent, EnchantableSlot } from '@mbler/mcx-component';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,UAAU,MAAc,QAA6B;CAC5D,OAAO;EAAE;EAAM;EAAQ;;AAEzB,IAAM,YAAN,MAAgB;CACd;CAEA,YAAY,MAAc;EACxB,KAAK,OAAO;;CAEd,CAAC,cAAuC;EACtC,MAAM,OAAO,KAAK;EAClB,IAAI,IAAI;EACR,IAAI,OAAO;EACX,IAAI,SAAS;EACb,MAAM,MAAM,KAAK;EAEjB,OAAO,IAAI,KAGT,IAFW,KAAK,OAEL,KAAK;GACd,IAAI,KAAK,WAAW,OAAO,IAAI,EAAE,EAAE;IACjC,MAAM,eAAe;IACrB,MAAM,iBAAiB;IACvB,MAAM,mBAAmB;IACzB,MAAM,SAAS,KAAK,QAAQ,OAAO,IAAI,EAAE;IACzC,MAAM,aAAa,WAAW,KAAK,MAAM,IAAI,SAAS;IACtD,KAAK,IAAI,IAAI,GAAG,KAAK,YAAY,KAC/B,IAAI,KAAK,OAAO,MAAM;KACpB;KACA,SAAS;WAET;IAUJ,MAAM;KALJ,MAFa,KAAK,MAAM,cAAc,aAAa,EAEvC;KACZ,MAAM;KACN,OAAO,UAAU,gBAAgB,iBAAiB;KAClD,KAAK,UAAU,MAAM,OAAO;KAErB;IACT,IAAI,aAAa;IACjB,IAAI,IAAI,OAAO,KAAK,OAAO,KAAK;IAChC;;GA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;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;;;;;;;;AE7OrC,SAAgB,eAEd,YAKwB;CACxB,OAAO"}
1
+ {"version":3,"file":"index.js","names":["Lexer","Parser","AST_tag","AST_prop","Utils","CompileData.JsCompileData","Utils","CompileData.MCXCompileData","babelErr","Utils","config","McxUtils","Comp","config","Comp","config","config","EventComp","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/ui.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 BaseToken,\n TagToken,\n TagEndToken,\n ContentToken,\n CommentToken,\n Token,\n ParsedTagNode,\n AttributeMap,\n ParsedTagContentNode,\n ParsedCommentNode,\n MCXLoc,\n MCXPosition,\n TokenType,\n} from './../types.js';\n\nfunction createPos(line: number, column: number): MCXPosition {\n return { line, column };\n}\nclass Tokenizer {\n private text: string;\n\n constructor(text: string) {\n this.text = text;\n }\n *splitTokens(): IterableIterator<Token> {\n const text = this.text;\n let i = 0;\n let line = 1;\n let column = 0;\n const len = text.length;\n\n while (i < len) {\n const ch = text[i];\n\n if (ch === '<') {\n if (text.startsWith('!--', i + 1)) {\n const commentStart = i;\n const tokenStartLine = line;\n const tokenStartColumn = column;\n const endIdx = text.indexOf('-->', i + 4);\n const commentEnd = endIdx === -1 ? len - 1 : endIdx + 2;\n for (let j = i; j <= commentEnd; j++) {\n if (text[j] === '\\n') {\n line++;\n column = 0;\n } else {\n column++;\n }\n }\n const buffer = text.slice(commentStart, commentEnd + 1);\n const tok: Token = {\n data: buffer,\n type: 'Comment' as TokenType,\n start: createPos(tokenStartLine, tokenStartColumn),\n end: createPos(line, column),\n };\n yield tok;\n i = commentEnd + 1;\n if (i < len && text[i] === '>') column++;\n continue;\n }\n const tokenStart = i;\n const tokenStartLine = line;\n const tokenStartColumn = column;\n let j = i + 1;\n let sawGt = false;\n for (; j < len; j++) {\n const c = text[j];\n if (c === '>') {\n sawGt = true;\n break;\n }\n if (c === '\\n') {\n line++;\n column = 0;\n } else {\n column++;\n }\n }\n const buffer = text.slice(tokenStart, sawGt ? j + 1 : len);\n const type: TokenType = buffer.startsWith('</') ? 'TagEnd' : 'Tag';\n const tok: Token = {\n data: buffer,\n type,\n start: createPos(tokenStartLine, tokenStartColumn),\n end: createPos(line, column),\n };\n yield tok;\n i = sawGt ? j + 1 : len;\n if (sawGt) column++;\n } else {\n const contentStart = i;\n const contentStartLine = line;\n const contentStartColumn = column;\n let j = i;\n for (; j < len; j++) {\n const c = text[j];\n if (c === '<') break;\n if (c === '\\n') {\n line++;\n column = 0;\n } else {\n column++;\n }\n }\n const data = text.slice(contentStart, j);\n const n: Token = {\n data,\n type: 'Content',\n start: createPos(contentStartLine, contentStartColumn),\n end: createPos(line, j > contentStart ? column - 1 : column),\n };\n yield n;\n i = j;\n }\n }\n }\n}\n\nclass Lexer {\n private text: string;\n private includeComments: boolean;\n private booleanProxyCache: WeakMap<object, Record<string, boolean>>;\n\n constructor(text: string, includeComments: boolean = false) {\n this.text = text;\n this.includeComments = includeComments;\n this.booleanProxyCache = new WeakMap();\n }\n *tokenStream(): IterableIterator<Token> {\n const tokenizer = new Tokenizer(this.text);\n\n for (const token of Array.from(tokenizer.splitTokens())) {\n // 如果includeComments为false,跳过注释Token\n if (!this.includeComments && token.type === 'Comment') {\n continue;\n }\n yield token;\n }\n }\n\n /**\n * 生成 Token 迭代器,用于遍历所有结构化 Token\n */\n *tokenIterator(): IterableIterator<Token> {\n yield* this.tokenStream();\n }\n\n get tokens(): Iterable<Token> {\n return {\n [Symbol.iterator]: () => this.tokenIterator(),\n };\n }\n\n /**\n * 创建一个动态布尔属性访问的 Proxy(可选功能)\n */\n getBooleanCheckProxy(): Record<string, boolean> {\n if (!this.booleanProxyCache.has(this)) {\n const charMap = new Map<string, boolean>();\n const proxy = new Proxy(\n {},\n {\n get(_: unknown, prop: string | symbol): boolean {\n if (typeof prop !== 'string') return false;\n return charMap.get(prop) || false;\n },\n set(_: unknown, prop: string | symbol, value: unknown): boolean {\n if (typeof prop !== 'string') return false;\n charMap.set(prop, Boolean(value));\n return true;\n },\n },\n );\n this.booleanProxyCache.set(this, proxy as Record<string, boolean>);\n }\n return this.booleanProxyCache.get(this) as Record<string, boolean>;\n }\n}\n\n/** Parser - 负责将Token流解析为AST */\nclass Parser {\n private lexer: Lexer;\n\n constructor(lexer: Lexer) {\n this.lexer = lexer;\n }\n\n /**\n * 解析标签属性,如:<div id=\"app\" disabled />\n */\n private parseAttributes(tagContent: string): {\n name: string;\n arr: AttributeMap;\n } {\n const attributes: Record<string, string> = {};\n let currentKey = '';\n let currentValue = '';\n let inKey = true;\n let name = '';\n let inValue = false;\n let quoteChar: string | null = null;\n let isTagName = true;\n\n for (let i = 0; i < tagContent.length; i++) {\n const char = tagContent[i];\n\n if (isTagName) {\n if (char === ' ' || char === '>') {\n name = currentKey.trim();\n currentKey = '';\n isTagName = false;\n if (char === '>') break;\n } else {\n currentKey += char;\n }\n continue;\n }\n\n if (inValue) {\n if (\n char === quoteChar &&\n (currentValue.length === 0 ||\n currentValue[currentValue.length - 1] !== '\\\\')\n ) {\n attributes[currentKey.trim()] = currentValue;\n currentKey = '';\n currentValue = '';\n inKey = true;\n inValue = false;\n quoteChar = null;\n } else {\n currentValue += char;\n }\n } else if (char === '=' && inKey) {\n inKey = false;\n inValue = true;\n const nextIndex = i + 1;\n const nextChar =\n nextIndex < tagContent.length ? tagContent[nextIndex] : ' ';\n quoteChar = null;\n } else if (char === ' ' && inKey && currentKey) {\n attributes[currentKey.trim()] = 'true';\n currentKey = '';\n } else if (inKey) {\n currentKey += char;\n }\n }\n\n if (isTagName) {\n name = currentKey.trim();\n } else if (currentKey) {\n attributes[currentKey.trim()] = inValue\n ? currentValue.replace(/^[\"']/, '').replace(/[\"']$/, '')\n : 'true';\n }\n\n return {\n name,\n arr: attributes,\n };\n }\n\n /**\n * 基于stack的解析以支持嵌套,并为ParsedTagNode添加loc: { start, end }\n * Content和Comment改为递归节点数组 (ParsedTagContentNode | ParsedCommentNode | ParsedTagNode)[]\n */\n *parseAST(): IterableIterator<ParsedTagNode> {\n const rawTokens = Array.from(this.lexer.tokenStream());\n const root: (ParsedTagNode | ParsedTagContentNode | ParsedCommentNode)[] =\n [];\n const stack: ParsedTagNode[] = [];\n\n for (let idx = 0; idx < rawTokens.length; idx++) {\n const token = rawTokens[idx];\n if (!token) continue;\n\n if (token.type === 'Content') {\n const contentNode: ParsedTagContentNode = {\n data: token.data,\n type: 'TagContent',\n };\n if (stack.length > 0) {\n const top = stack[stack.length - 1];\n (top as ParsedTagNode).content.push(contentNode);\n } else {\n root.push(contentNode);\n }\n } else if (token.type === 'Comment') {\n const commentNode: ParsedCommentNode = {\n data: token.data,\n type: 'Comment',\n loc: {\n start: { ...token.start },\n end: { ...token.end },\n },\n };\n if (stack.length > 0) {\n const top = stack[stack.length - 1];\n (top as ParsedTagNode).content.push(commentNode);\n } else {\n root.push(commentNode);\n }\n } else if (token.type === 'Tag') {\n const inner = token.data.slice(1, -1).trim();\n // 自闭合 <br/> 或 <img ... /> 也当作单节点(没有 end),这里简单检测末尾 '/'\n const isSelfClosing = inner.endsWith('/');\n const arr = this.parseAttributes(\n isSelfClosing ? inner.slice(0, -1).trim() : inner,\n );\n const node: ParsedTagNode = {\n start: token as TagToken,\n name: arr.name,\n arr: arr.arr as AttributeMap,\n // content 现在是一个数组,包含文本节点、注释节点或子标签\n content: [] as (\n | ParsedTagContentNode\n | ParsedCommentNode\n | ParsedTagNode\n )[],\n end: null,\n type: 'TagNode',\n loc: {\n start: { ...token.start },\n end: { ...token.end },\n } as MCXLoc,\n };\n\n if (isSelfClosing) {\n // self-closing: immediately close and attach to parent or root\n if (stack.length > 0) {\n (stack[stack.length - 1] as ParsedTagNode).content.push(node);\n } else {\n // yield top-level node\n yield node;\n }\n } else {\n stack.push(node);\n }\n } else if (token.type === 'TagEnd') {\n // 从 '</name>' 中提取 name\n const name = token.data\n .replace(/^<\\/\\s*/, '')\n .replace(/\\s*>$/, '')\n .trim();\n // 找到最近的匹配开始标签\n for (let s = stack.length - 1; s >= 0; s--) {\n const candidate = stack[s];\n if (candidate && candidate.name === name) {\n // 设置结束\n candidate.end = token;\n candidate.loc.end = { ...token.end };\n // 从 stack 中移除并附加到父节点或作为顶层节点产出\n stack.splice(s, 1);\n if (stack.length > 0) {\n (stack[stack.length - 1] as ParsedTagNode).content.push(\n candidate,\n );\n } else {\n // yield completed top-level node\n yield candidate;\n }\n break;\n }\n }\n }\n }\n while (stack.length > 0) {\n const node = stack.shift()!;\n if (stack.length > 0) {\n (stack[0] as ParsedTagNode).content.push(node);\n } else {\n yield node;\n }\n }\n }\n\n get ast(): Iterable<ParsedTagNode> {\n return {\n [Symbol.iterator]: () => this.parseAST(),\n };\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 private getAST(): ParsedTagNode[] {\n const lexer = new Lexer(this.text, this.includeComments);\n const parser = new Parser(lexer);\n return Array.from(parser.parseAST());\n }\n\n get data(): ParsedTagNode[] {\n return this.getAST();\n }\n\n parseAST(): ParsedTagNode[] {\n return this.getAST();\n }\n\n /**\n * 生成代码字符串\n * @param node 代码的AST节点\n * @returns 代码字符串\n */\n static generateCode(node: ParsedTagNode): string {\n let code = `<${node.name}`;\n // 添加属性\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 {\n code += McxAst.generateCode(item as ParsedTagNode);\n }\n }\n }\n code += `</${node.name}>`;\n return code;\n }\n}\n\nexport { Tokenizer, Lexer, Parser, 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 isToken(obj: unknown): obj is Token {\n return (\n !!obj &&\n typeof obj === 'object' &&\n 'data' in (obj as object) &&\n 'type' in (obj as object) &&\n 'start' in (obj as object) &&\n 'end' in (obj as object) &&\n ((obj as Token).type === 'Tag' ||\n (obj as Token).type === 'TagEnd' ||\n (obj as Token).type === 'Content' ||\n (obj as Token).type === 'Comment')\n );\n }\n static isTagToken(obj: unknown): obj is TagToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'Tag';\n }\n static isTagEndToken(obj: unknown): obj is TagEndToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'TagEnd';\n }\n static isContentToken(obj: unknown): obj is ContentToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'Content';\n }\n static isCommentToken(obj: unknown): obj is CommentToken {\n return MCXUtils.isToken(obj) && (obj as Token).type === 'Comment';\n }\n static isBaseToken(obj: unknown): obj is BaseToken {\n return (\n !!obj &&\n typeof obj === 'object' &&\n 'data' in (obj as object) &&\n 'type' in (obj as object) &&\n 'start' in (obj as object) &&\n 'end' in (obj as object)\n );\n }\n static isTokenType(value: unknown): value is TokenType {\n return (\n value === 'Tag' ||\n value === 'TagEnd' ||\n value === 'Content' ||\n value === 'Comment'\n );\n }\n static isParseNode(node: unknown): node is ParsedTagNode[] {\n return Array.isArray(node) && (node as unknown[]).every(MCXUtils.isTagNode);\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 { ParserOptions } from '@babel/parser';\nimport 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}\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).program;\n } catch (err: unknown) {\n throw new Error('[compiler]: babel error' + (err instanceof Error ? err.stack : String(err)));\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 * as 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 { line: start.line, column: typeof start.column === 'number' ? (start.column as number) : -1 };\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 };\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(name);\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 Event: ParsedTagNode | null;\n Component: Record<MCXstructureLocComponentType, ParsedTagNode>;\n } = {\n script: '',\n Event: null,\n ui: 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 }\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 }\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\nexport {\n extractIdList,\n extractVarDefIdList,\n generateEventConfig,\n _enable,\n generateMain,\n _enableWithData,\n};\n","import { MCXstructureLoc } from '../../compile-mcx/types';\nimport { ContentToken, ParsedTagNode, transformParseCtx } from '../../types';\nimport * as t from '@babel/types';\nimport config from '../config';\nexport async function Comp(ctx: transformParseCtx) {\n const internalCtx = ctx.ctx;\n\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 uiTagNode = ctx.ctx.compiledCode.strLoc.UI;\n if (!uiTagNode || uiTagNode?.name !== 'Ui')\n throw new Error(\"[UI Component]: why didn't parent compeled verify?\");\n let MCXUIType: 'ActionFormData' | 'MessageFormData' | 'ModalFormData' | null =\n null;\n const UITree: {\n arr: Record<string, string | boolean>;\n content: string;\n type: string;\n loc?: ParsedTagNode['loc'];\n }[] = [];\n for (const uiClientTag of uiTagNode.content) {\n if (uiClientTag.type == 'TagNode') {\n // if has client TagNode\n if (uiClientTag.content.some(i => i.type == 'TagNode')) {\n internalCtx.rollupContext.error(\n \"[UI]: can't support ui client element\",\n uiClientTag.loc\n ? {\n column: uiClientTag.loc.start.column,\n line: uiClientTag.loc.start.line,\n }\n : void 0,\n );\n }\n // add to tree\n UITree.push({\n arr: uiClientTag.arr,\n content: uiClientTag.content\n .map(i => (i.type == 'TagContent' && i.data) || '')\n .join(''),\n type: uiClientTag.name,\n loc: uiClientTag.loc,\n });\n }\n // continue TagContentNode\n }\n const parsedObj: t.Expression[] = [];\n function pushToTree(\n name: string,\n params: Record<string, string | boolean>,\n content: string,\n ) {\n parsedObj.push(\n t.objectExpression([\n t.objectProperty(t.identifier('type'), t.stringLiteral(name)),\n t.objectProperty(\n t.identifier('params'),\n t.objectExpression(\n Object.entries(params).map(([key, value]) => {\n const isDynamic = key.startsWith(':');\n const paramName = isDynamic ? key.slice(1) : key;\n return t.objectProperty(\n t.identifier(paramName),\n isDynamic\n ? t.objectExpression([\n t.objectProperty(\n t.identifier('useProp'),\n t.stringLiteral(String(value)),\n ),\n ])\n : typeof value == 'boolean'\n ? t.booleanLiteral(value)\n : t.stringLiteral(value),\n );\n }),\n ),\n ),\n t.objectProperty(\n t.identifier('content'),\n content.startsWith('{{ ') && content.endsWith(' }}')\n ? t.objectExpression([\n t.objectProperty(\n t.identifier('useProp'),\n t.stringLiteral(content.slice(3, content.length - 3).trim()),\n ),\n ])\n : t.stringLiteral(content),\n ),\n ]),\n );\n }\n // generate type and parsed tree\n for (const tp of UITree) {\n const name = tp.type;\n // only ModalFormData Element\n if (['input', 'dropdown', 'submit', 'toggle', 'slider'].includes(name)) {\n // ModalFromData\n if (MCXUIType && MCXUIType !== 'ModalFormData') {\n internalCtx.rollupContext.error(\n \"[UI]: a mcx can't have a ModalFormData Node and other form tag\",\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n }\n MCXUIType = 'ModalFormData';\n pushToTree(name, tp.arr, tp.content);\n }\n // only MessageFormData Element\n else if (['button-m'].includes(name)) {\n if (MCXUIType && MCXUIType !== 'MessageFormData') {\n internalCtx.rollupContext.error(\n '[UI]: ',\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n }\n MCXUIType = 'MessageFormData';\n pushToTree(name, tp.arr, tp.content);\n }\n // public\n else if (['body', 'divider', 'title', 'label'].includes(name)) {\n pushToTree(name, tp.arr, tp.content);\n } else if (name == 'button') {\n if (MCXUIType !== 'ActionFormData' && MCXUIType)\n internalCtx.rollupContext.error(\n \"[UI]: don't support use button for messageFormData\",\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n pushToTree(name, tp.arr, tp.content);\n MCXUIType = 'ActionFormData';\n } else {\n internalCtx.rollupContext.error(\n \"[UI]: don't support tag: \" + name,\n tp.loc\n ? {\n line: tp.loc.start.line,\n column: tp.loc.start.column,\n }\n : void 0,\n );\n }\n }\n if (!MCXUIType) MCXUIType = 'ActionFormData';\n const finallyData = t.objectExpression([\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(MCXUIType),\n ),\n ),\n t.objectProperty(t.identifier('UI'), t.identifier('__minecraft__ui')),\n ]);\n ctx.app([\n t.objectProperty(\n t.identifier('ui'),\n t.newExpression(t.identifier('__mcx__ui'), [\n finallyData,\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 lib from '@mbler/mcx-component';\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';\n\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 THIS specific export comes from @mbler/mcx-component.\n // If yes, the component is trusted and bypasses file I/O limits\n // and root base restrictions. If not, restrictions apply.\n const isMcxCoreSource =\n (exportSources[pointExport] ?? '').startsWith(\n '@mbler/mcx-component',\n ) ||\n (pointData &&\n typeof pointData.constructor === 'function' &&\n (pointData.constructor === lib.item ||\n pointData.constructor === lib.entity ||\n pointData.constructor === lib.block));\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}\n\nexport * from './vm';\nexport {\n ItemComponent,\n EntityComponent,\n BlockComponent,\n PNGImageComponent,\n SVGImageComponent,\n GIFImageComponent,\n JPGImageComponent,\n} from '@mbler/mcx-component';\n","import { mcxType, transformCtx, transformParseCtx } from '../types';\nimport * as t from '@babel/types';\nimport { generate } from '@babel/generator';\nimport config from './config';\nimport { _enable, _enableWithData, generateMain } from './utils';\nimport { EventComp, UIComp, AppComp } from './transform';\nimport { compileComponent } from '../mcx-component';\nexport async function _transform(ctx: transformCtx): Promise<string> {\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 // 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.UI) {\n type = 'ui'; // ui mcx\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 // 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 }\n}\n","import type { Plugin, TransformResult } from 'rollup';\nimport type { Plugin as RolldownPlugin } from 'rolldown';\nimport { CompileOpt } from '../types';\nimport { extname, isAbsolute, join } from 'node:path';\nimport { CompileError, compileMCXFn } from '.';\nimport { transform } from '../../transforms';\nimport type { MCXCompileData } from './compileData';\nimport { readFile, rm } from 'node:fs/promises';\nimport MagicString from 'magic-string';\nimport * as path from 'node:path';\nimport { transformCtx } from '../../types';\nimport * as 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) || (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 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 const error: CompileError = err;\n this.error(error.message, {\n column: error.loc.column,\n line: error.loc.line,\n });\n }\n this.error(\n err instanceof Error\n ? `${err.message} : ${err.stack}`\n : String(err),\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';\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 { ParticleType, SoundEvent, EnchantableSlot, Rarity, ItemComponentOptions, FoodEffect, EntityComponentOptions } 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 { Rarity, ItemComponentOptions, FoodEffect, EntityComponentOptions };\nexport type { ParticleType, SoundEvent, EnchantableSlot } from '@mbler/mcx-component';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,UAAU,MAAc,QAA6B;CAC5D,OAAO;EAAE;EAAM;EAAQ;;AAEzB,IAAM,YAAN,MAAgB;CACd;CAEA,YAAY,MAAc;EACxB,KAAK,OAAO;;CAEd,CAAC,cAAuC;EACtC,MAAM,OAAO,KAAK;EAClB,IAAI,IAAI;EACR,IAAI,OAAO;EACX,IAAI,SAAS;EACb,MAAM,MAAM,KAAK;EAEjB,OAAO,IAAI,KAGT,IAFW,KAAK,OAEL,KAAK;GACd,IAAI,KAAK,WAAW,OAAO,IAAI,EAAE,EAAE;IACjC,MAAM,eAAe;IACrB,MAAM,iBAAiB;IACvB,MAAM,m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;KACrB,IAAI,eAAe,cAAc;MAC/B,MAAM,QAAsB;MAC5B,KAAK,MAAM,MAAM,SAAS;OACxB,QAAQ,MAAM,IAAI;OAClB,MAAM,MAAM,IAAI;OACjB,CAAC;;KAEJ,KAAK,MACH,eAAe,QACX,GAAG,IAAI,QAAQ,KAAK,IAAI,UACxB,OAAO,IAAI,CAChB;KACD;;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;;;;;;;;AE7OrC,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.2-rc.3",
3
+ "version": "0.1.2-rc.5",
4
4
  "description": "a DSL compiler of mcx",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [